From d0eeff917c8093bd32433d6d5e035be56548d51b Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Tue, 5 Apr 2022 20:21:44 -0400 Subject: [PATCH 1/3] Update React DevTools backend/hook from 4.17.0 to 4.24.3 --- .../actors/replay/react-devtools/README.md | 72 +- .../actors/replay/react-devtools/hook.js | 419 +- .../react-devtools/react_devtools_backend.js | 12749 +++++++++------- 3 files changed, 7382 insertions(+), 5858 deletions(-) diff --git a/devtools/server/actors/replay/react-devtools/README.md b/devtools/server/actors/replay/react-devtools/README.md index f5c5c9cad207a..c52308d49b0e6 100644 --- a/devtools/server/actors/replay/react-devtools/README.md +++ b/devtools/server/actors/replay/react-devtools/README.md @@ -2,28 +2,28 @@ The files in this directory are from the React Devtools (https://github.com/facebook/react/tree/master/packages/react-devtools), and are loaded into recording processes so that the devtools hooks will be detected by any React application on the page and allow events to be sent to the driver and from there on to any clients viewing the recording. -From the base React revision b9964684bd8c909fc3d88f1cd47aa1f45ea7ba32, the other files are as follows: +From the base React revision [`adb8ebc927ea091ba5ffba6a9f30dbe62eaee0c5`](https://github.com/facebook/react/commit/adb8ebc927ea091ba5ffba6a9f30dbe62eaee0c5), the other files are as follows: ### contentScript.js -Modified from `react/packages/react-devtools-extensions/src/contentScript.js` +Modified from (react) [`packages/react-devtools-extensions/src/contentScript.js`](https://github.com/facebook/react/blob/main/packages/react-devtools-extensions/src/contentScript.js). ### hook.js -Modified from `packages/react-devtools-shared/src/hook.js` +Modified from (react) [`packages/react-devtools-shared/src/hook.js`](https://github.com/facebook/react/blob/main/packages/react-devtools-shared/src/hook.js). ### react_devtools_backend.js After building React, this is modified from the generated file `packages/react-devtools-extensions/firefox/build/unpacked/build/react_devtools_backend.js` with the patch below. -``` +```diff @@ -1,3 +1,5 @@ +function reactDevtoolsBackend(window) { + /******/ (function(modules) { // webpackBootstrap - /******/ // The module cache - /******/ var installedModules = {}; -@@ -10498,6 +10500,18 @@ + /******/ // The module cache + /******/ var installedModules = {}; +@@ -11462,6 +11464,18 @@ class agent_Agent extends events["a" /* default */] { bridge.send('isSynchronousXHRSupported', Object(utils["h" /* isSynchronousXHRSupported */])()); setupHighlighter(bridge, this); TraceUpdates_initialize(this); @@ -42,16 +42,16 @@ After building React, this is modified from the generated file `packages/react-d } get rendererInterfaces() { -@@ -11444,7 +11458,7 @@ - +@@ -12946,7 +12960,7 @@ function getStackByFiberInDevAndProd(workTagMap, workInProgress, currentDispatch + let welcomeHasInitialized = false; function welcome(event) { - if (event.source !== window || event.data.source !== 'react-devtools-content-script') { + if (event.data.source !== 'react-devtools-content-script') { return; - } - -@@ -11487,13 +11501,8 @@ + } // In some circumstances, this method is called more than once for a single welcome message. + // The exact circumstances of this are unclear, though it seems related to 3rd party event batching code. +@@ -13005,13 +13019,8 @@ function setup(hook) { }, send(event, payload, transferable) { @@ -67,11 +67,12 @@ After building React, this is modified from the generated file `packages/react-d } }); -@@ -15243,4 +15252,8 @@ +@@ -16548,4 +16557,8 @@ function setStyle(agent, id, rendererID, name, value) { } /***/ }) - /******/ ]); +-/******/ ]); ++/******/ ]); + +} + @@ -80,15 +81,34 @@ After building React, this is modified from the generated file `packages/react-d ## Updating to a newer version of React Devtools -* clone the React repository and build the firefox extension: - ``` - git clone https://github.com/facebook/react.git - cd react - yarn - yarn build-for-devtools - cd packages/react-devtools-extensions/ - yarn build:firefox - ``` -* copy `packages/react-devtools-extensions/firefox/build/unpacked/build/react_devtools_backend.js` to this folder and apply the modifications from the patch above -* check if there have been any changes in `packages/react-devtools-shared/src/hook.js` since the last update and apply them to the file in this folder -* update the React revision and the patch in this file +1. Clone the React repository and build the firefox extension: +```sh +git clone https://github.com/facebook/react.git + +cd react + +# Install build dependencies. +yarn install + +cd scripts/release/ + +# Install release script dependencies. +yarn install + +cd ../../ + +# Download the latest React release (built from CI). +# You can build this locally too but it's much slower. +scripts/release/download-experimental-build.js --commit=main + +cd packages/react-devtools-extensions/ + +# Build the Firefox extension +yarn build:firefox +``` + +2. Copy `packages/react-devtools-extensions/firefox/build/unpacked/build/react_devtools_backend.js` to this folder and apply the modifications from the patch above. + +3. Check if there have been any changes in `packages/react-devtools-shared/src/hook.js` since the last update and apply them to the file in this folder. + +4. Update the React revision and the patch in this file diff --git a/devtools/server/actors/replay/react-devtools/hook.js b/devtools/server/actors/replay/react-devtools/hook.js index 1370d67a2bada..7829dde861d43 100644 --- a/devtools/server/actors/replay/react-devtools/hook.js +++ b/devtools/server/actors/replay/react-devtools/hook.js @@ -2,9 +2,10 @@ * Install the hook on window, which is an event emitter. * Note because Chrome content scripts cannot directly modify the window object, * we are evaling this function by inserting a script tag. - * That's why we have to inline the whole event emitter implementation here. + * That's why we have to inline the whole event emitter implementation, + * the string format implementation, and part of the console implementation here. * - * @flow + * @flow */ function installHook(target) { @@ -16,6 +17,22 @@ function installHook(target) { return null; } + let targetConsole = console; + let targetConsoleMethods = {}; + + for (const method in console) { + targetConsoleMethods[method] = console[method]; + } + + function dangerous_setTargetConsoleForTesting(targetConsoleForTesting) { + targetConsole = targetConsoleForTesting; + targetConsoleMethods = {}; + + for (const method in targetConsole) { + targetConsoleMethods[method] = console[method]; + } + } + function detectReactBuildType(renderer) { try { if (typeof renderer.version === 'string') { @@ -25,12 +42,11 @@ function installHook(target) { // We are currently only using 0 (PROD) and 1 (DEV) // but might add 2 (PROFILE) in the future. return 'development'; - } - - // React 16 uses flat bundles. If we report the bundle as production + } // React 16 uses flat bundles. If we report the bundle as production // version, it means we also minified and envified it ourselves. - return 'production'; - // Note: There is still a risk that the CommonJS entry point has not + + + return 'production'; // Note: There is still a risk that the CommonJS entry point has not // been envified or uglified. In this case the user would have *both* // development and production bundle, but only the prod one would run. // This would be really bad. We have a separate check for this because @@ -38,55 +54,56 @@ function installHook(target) { } const toString = Function.prototype.toString; + if (renderer.Mount && renderer.Mount._renderNewRootComponent) { // React DOM Stack - const renderRootCode = toString.call( - renderer.Mount._renderNewRootComponent, - ); - // Filter out bad results (if that is even possible): + const renderRootCode = toString.call(renderer.Mount._renderNewRootComponent); // Filter out bad results (if that is even possible): + if (renderRootCode.indexOf('function') !== 0) { // Hope for the best if we're not sure. return 'production'; - } - // Check for React DOM Stack < 15.1.0 in development. + } // Check for React DOM Stack < 15.1.0 in development. // If it contains "storedMeasure" call, it's wrapped in ReactPerf (DEV only). // This would be true even if it's minified, as method name still matches. + + if (renderRootCode.indexOf('storedMeasure') !== -1) { return 'development'; - } - // For other versions (and configurations) it's not so easy. + } // For other versions (and configurations) it's not so easy. // Let's quickly exclude proper production builds. // If it contains a warning message, it's either a DEV build, // or an PROD build without proper dead code elimination. + + if (renderRootCode.indexOf('should be a pure function') !== -1) { // Now how do we tell a DEV build from a bad PROD build? // If we see NODE_ENV, we're going to assume this is a dev build // because most likely it is referring to an empty shim. if (renderRootCode.indexOf('NODE_ENV') !== -1) { return 'development'; - } - // If we see "development", we're dealing with an envified DEV build + } // If we see "development", we're dealing with an envified DEV build // (such as the official React DEV UMD). + + if (renderRootCode.indexOf('development') !== -1) { return 'development'; - } - // I've seen process.env.NODE_ENV !== 'production' being smartly + } // I've seen process.env.NODE_ENV !== 'production' being smartly // replaced by `true` in DEV by Webpack. I don't know how that // works but we can safely guard against it because `true` was // never used in the function source since it was written. + + if (renderRootCode.indexOf('true') !== -1) { return 'development'; - } - // By now either it is a production build that has not been minified, + } // By now either it is a production build that has not been minified, // or (worse) this is a minified development build using non-standard // environment (e.g. "staging"). We're going to look at whether // the function argument name is mangled: - if ( - // 0.13 to 15 - renderRootCode.indexOf('nextElement') !== -1 || - // 0.12 - renderRootCode.indexOf('nextComponent') !== -1 - ) { + + + if ( // 0.13 to 15 + renderRootCode.indexOf('nextElement') !== -1 || // 0.12 + renderRootCode.indexOf('nextComponent') !== -1) { // We can't be certain whether this is a development build or not, // but it is definitely unminified. return 'unminified'; @@ -94,28 +111,27 @@ function installHook(target) { // This is likely a minified development build. return 'development'; } - } - // By now we know that it's envified and dead code elimination worked, + } // By now we know that it's envified and dead code elimination worked, // but what if it's still not minified? (Is this even possible?) // Let's check matches for the first argument name. - if ( - // 0.13 to 15 - renderRootCode.indexOf('nextElement') !== -1 || - // 0.12 - renderRootCode.indexOf('nextComponent') !== -1 - ) { + + + if ( // 0.13 to 15 + renderRootCode.indexOf('nextElement') !== -1 || // 0.12 + renderRootCode.indexOf('nextComponent') !== -1) { return 'unminified'; - } - // Seems like we're using the production version. + } // Seems like we're using the production version. // However, the branch above is Stack-only so this is 15 or earlier. + + return 'outdated'; } - } catch (err) { - // Weird environments may exist. + } catch (err) {// Weird environments may exist. // This code needs a higher fault tolerance // because it runs even with closed DevTools. // TODO: should we catch errors in all injected code, and not just this part? } + return 'production'; } @@ -124,27 +140,147 @@ function installHook(target) { // Needs to be super safe. try { const toString = Function.prototype.toString; - const code = toString.call(fn); - - // This is a string embedded in the passed function under DEV-only + const code = toString.call(fn); // This is a string embedded in the passed function under DEV-only // condition. However the function executes only in PROD. Therefore, // if we see it, dead code elimination did not work. + if (code.indexOf('^_^') > -1) { // Remember to report during next injection. - hasDetectedBadDCE = true; - - // Bonus: throw an exception hoping that it gets picked up by a reporting system. + hasDetectedBadDCE = true; // Bonus: throw an exception hoping that it gets picked up by a reporting system. // Not synchronously so that it doesn't break the calling code. - setTimeout(function() { - throw new Error( - 'React is running in production mode, but dead code ' + - 'elimination has not been applied. Read how to correctly ' + - 'configure React for production: ' + - 'https://reactjs.org/link/perf-use-production-build', - ); + + setTimeout(function () { + throw new Error('React is running in production mode, but dead code ' + 'elimination has not been applied. Read how to correctly ' + 'configure React for production: ' + 'https://reactjs.org/link/perf-use-production-build'); }); } } catch (err) {} + } // NOTE: KEEP IN SYNC with src/backend/utils.js + + + function format(maybeMessage, ...inputArgs) { + const args = inputArgs.slice(); // Symbols cannot be concatenated with Strings. + + let formatted = String(maybeMessage); // If the first argument is a string, check for substitutions. + + if (typeof maybeMessage === 'string') { + if (args.length) { + const REGEXP = /(%?)(%([jds]))/g; + formatted = formatted.replace(REGEXP, (match, escaped, ptn, flag) => { + let arg = args.shift(); + + switch (flag) { + case 's': + arg += ''; + break; + + case 'd': + case 'i': + arg = parseInt(arg, 10).toString(); + break; + + case 'f': + arg = parseFloat(arg).toString(); + break; + } + + if (!escaped) { + return arg; + } + + args.unshift(arg); + return match; + }); + } + } // Arguments that remain after formatting. + + + if (args.length) { + for (let i = 0; i < args.length; i++) { + formatted += ' ' + String(args[i]); + } + } // Update escaped %% values. + + + formatted = formatted.replace(/%{2,2}/g, '%'); + return String(formatted); + } + + let unpatchFn = null; // NOTE: KEEP IN SYNC with src/backend/console.js:patchForStrictMode + // This function hides or dims console logs during the initial double renderer + // in Strict Mode. We need this function because during initial render, + // React and DevTools are connecting and the renderer interface isn't avaiable + // and we want to be able to have consistent logging behavior for double logs + // during the initial renderer. + + function patchConsoleForInitialRenderInStrictMode({ + hideConsoleLogsInStrictMode, + browserTheme + }) { + const overrideConsoleMethods = ['error', 'trace', 'warn', 'log']; + + if (unpatchFn !== null) { + // Don't patch twice. + return; + } + + const originalConsoleMethods = {}; + + unpatchFn = () => { + for (const method in originalConsoleMethods) { + try { + // $FlowFixMe property error|warn is not writable. + targetConsole[method] = originalConsoleMethods[method]; + } catch (error) {} + } + }; + + overrideConsoleMethods.forEach(method => { + try { + const originalMethod = originalConsoleMethods[method] = targetConsole[method].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ ? targetConsole[method].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ : targetConsole[method]; + + const overrideMethod = (...args) => { + if (!hideConsoleLogsInStrictMode) { + // Dim the text color of the double logs if we're not + // hiding them. + let color; + + switch (method) { + case 'warn': + color = browserTheme === 'light' ? process.env.LIGHT_MODE_DIMMED_WARNING_COLOR : process.env.DARK_MODE_DIMMED_WARNING_COLOR; + break; + + case 'error': + color = browserTheme === 'light' ? process.env.LIGHT_MODE_DIMMED_ERROR_COLOR : process.env.DARK_MODE_DIMMED_ERROR_COLOR; + break; + + case 'log': + default: + color = browserTheme === 'light' ? process.env.LIGHT_MODE_DIMMED_LOG_COLOR : process.env.DARK_MODE_DIMMED_LOG_COLOR; + break; + } + + if (color) { + originalMethod(`%c${format(...args)}`, `color: ${color}`); + } else { + throw Error('Console color is not defined'); + } + } + }; + + overrideMethod.__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ = originalMethod; + originalMethod.__REACT_DEVTOOLS_STRICT_MODE_OVERRIDE_METHOD__ = overrideMethod; // $FlowFixMe property error|warn is not writable. + + targetConsole[method] = overrideMethod; + } catch (error) {} + }); + } // NOTE: KEEP IN SYNC with src/backend/console.js:unpatchForStrictMode + + + function unpatchConsoleForInitialRenderInStrictMode() { + if (unpatchFn !== null) { + unpatchFn(); + unpatchFn = null; + } } let uidCounter = 0; @@ -152,66 +288,63 @@ function installHook(target) { function inject(renderer) { const id = ++uidCounter; renderers.set(id, renderer); - - const reactBuildType = hasDetectedBadDCE - ? 'deadcode' - : detectReactBuildType(renderer); - - // Patching the console enables DevTools to do a few useful things: + const reactBuildType = hasDetectedBadDCE ? 'deadcode' : detectReactBuildType(renderer); // Patching the console enables DevTools to do a few useful things: // * Append component stacks to warnings and error messages + // * Disabling or marking logs during a double render in Strict Mode // * Disable logging during re-renders to inspect hooks (see inspectHooksOfFiber) // // For React Native, we intentionally patch early (during injection). // This provides React Native developers with components stacks even if they don't run DevTools. + // // This won't work for DOM though, since this entire file is eval'ed and inserted as a script tag. - // In that case, we'll patch later (when the frontend attaches). + // In that case, we'll only patch parts of the console that are needed during the first render + // and patch everything else later (when the frontend attaches). // // Don't patch in test environments because we don't want to interfere with Jest's own console overrides. // // Note that because this function is inlined, this conditional check must only use static booleans. // Otherwise the extension will throw with an undefined error. // (See comments in the try/catch below for more context on inlining.) - if (!__EXTENSION__ && !__TEST__) { + + if (!__TEST__ && !__EXTENSION__) { try { - const appendComponentStack = - window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ !== false; - const breakOnConsoleErrors = - window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ === true; - const showInlineWarningsAndErrors = - window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ !== false; - - // The installHook() function is injected by being stringified in the browser, + const appendComponentStack = window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ !== false; + const breakOnConsoleErrors = window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ === true; + const showInlineWarningsAndErrors = window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ !== false; + const hideConsoleLogsInStrictMode = window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ === true; + const browserTheme = window.__REACT_DEVTOOLS_BROWSER_THEME__; // The installHook() function is injected by being stringified in the browser, // so imports outside of this function do not get included. // // Normally we could check "typeof patchConsole === 'function'", // but Webpack wraps imports with an object (e.g. _backend_console__WEBPACK_IMPORTED_MODULE_0__) // and the object itself will be undefined as well for the reasons mentioned above, // so we use try/catch instead. - if ( - appendComponentStack || - breakOnConsoleErrors || - showInlineWarningsAndErrors - ) { - registerRendererWithConsole(renderer); - patchConsole({ - appendComponentStack, - breakOnConsoleErrors, - showInlineWarningsAndErrors, - }); - } - } catch (error) {} - } - // If we have just reloaded to profile, we need to inject the renderer interface before the app loads. + registerRendererWithConsole(renderer); + patchConsole({ + appendComponentStack, + breakOnConsoleErrors, + showInlineWarningsAndErrors, + hideConsoleLogsInStrictMode, + browserTheme + }); + } catch (error) {} + } // If we have just reloaded to profile, we need to inject the renderer interface before the app loads. // Otherwise the renderer won't yet exist and we can skip this step. + + const attach = target.__REACT_DEVTOOLS_ATTACH__; + if (typeof attach === 'function') { const rendererInterface = attach(hook, id, renderer, target); hook.rendererInterfaces.set(id, rendererInterface); } - hook.emit('renderer', {id, renderer, reactBuildType}); - + hook.emit('renderer', { + id, + renderer, + reactBuildType + }); return id; } @@ -226,6 +359,7 @@ function installHook(target) { if (!listeners[event]) { listeners[event] = []; } + listeners[event].push(fn); } @@ -233,10 +367,13 @@ function installHook(target) { if (!listeners[event]) { return; } + const index = listeners[event].indexOf(fn); + if (index !== -1) { listeners[event].splice(index, 1); } + if (!listeners[event].length) { delete listeners[event]; } @@ -250,14 +387,17 @@ function installHook(target) { function getFiberRoots(rendererID) { const roots = fiberRoots; + if (!roots[rendererID]) { roots[rendererID] = new Set(); } + return roots[rendererID]; } function onCommitFiberUnmount(rendererID, fiber) { const rendererInterface = rendererInterfaces.get(rendererID); + if (rendererInterface != null) { rendererInterface.handleCommitFiberUnmount(fiber); } @@ -267,16 +407,16 @@ function installHook(target) { const mountedRoots = hook.getFiberRoots(rendererID); const current = root.current; const isKnownRoot = mountedRoots.has(root); - const isUnmounting = - current.memoizedState == null || current.memoizedState.element == null; + const isUnmounting = current.memoizedState == null || current.memoizedState.element == null; // Keep track of mounted roots so we can hydrate when DevTools connect. - // Keep track of mounted roots so we can hydrate when DevTools connect. if (!isKnownRoot && !isUnmounting) { mountedRoots.add(root); } else if (isKnownRoot && isUnmounting) { mountedRoots.delete(root); } + const rendererInterface = rendererInterfaces.get(rendererID); + if (rendererInterface != null) { rendererInterface.handleCommitFiberRoot(root, priorityLevel); } @@ -284,57 +424,116 @@ function installHook(target) { function onPostCommitFiberRoot(rendererID, root) { const rendererInterface = rendererInterfaces.get(rendererID); + if (rendererInterface != null) { rendererInterface.handlePostCommitFiberRoot(root); } } - // TODO: More meaningful names for "rendererInterfaces" and "renderers". + function setStrictMode(rendererID, isStrictMode) { + const rendererInterface = rendererInterfaces.get(rendererID); + + if (rendererInterface != null) { + if (isStrictMode) { + rendererInterface.patchConsoleForStrictMode(); + } else { + rendererInterface.unpatchConsoleForStrictMode(); + } + } else { + // This should only happen during initial render in the extension before DevTools + // finishes its handshake with the injected renderer + if (isStrictMode) { + const hideConsoleLogsInStrictMode = window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ === true; + const browserTheme = window.__REACT_DEVTOOLS_BROWSER_THEME__; + patchConsoleForInitialRenderInStrictMode({ + hideConsoleLogsInStrictMode, + browserTheme + }); + } else { + unpatchConsoleForInitialRenderInStrictMode(); + } + } + } + + const openModuleRangesStack = []; + const moduleRanges = []; + + function getTopStackFrameString(error) { + const frames = error.stack.split('\n'); + const frame = frames.length > 1 ? frames[1] : null; + return frame; + } + + function getInternalModuleRanges() { + return moduleRanges; + } + + function registerInternalModuleStart(error) { + const startStackFrame = getTopStackFrameString(error); + + if (startStackFrame !== null) { + openModuleRangesStack.push(startStackFrame); + } + } + + function registerInternalModuleStop(error) { + if (openModuleRangesStack.length > 0) { + const startStackFrame = openModuleRangesStack.pop(); + const stopStackFrame = getTopStackFrameString(error); + + if (stopStackFrame !== null) { + moduleRanges.push([startStackFrame, stopStackFrame]); + } + } + } // TODO: More meaningful names for "rendererInterfaces" and "renderers". + + const fiberRoots = {}; const rendererInterfaces = new Map(); const listeners = {}; const renderers = new Map(); - const hook = { rendererInterfaces, listeners, - // Fast Refresh for web relies on this. renderers, - emit, getFiberRoots, inject, on, off, sub, - // This is a legacy flag. // React v16 checks the hook for this to ensure DevTools is new enough. supportsFiber: true, - // React calls these methods. checkDCE, onCommitFiberUnmount, onCommitFiberRoot, onPostCommitFiberRoot, + setStrictMode, + // Schedule Profiler runtime helpers. + // These internal React modules to report their own boundaries + // which in turn enables the profiler to dim or filter internal frames. + getInternalModuleRanges, + registerInternalModuleStart, + registerInternalModuleStop }; - Object.defineProperty( - target, - '__REACT_DEVTOOLS_GLOBAL_HOOK__', - ({ - // This property needs to be configurable for the test environment, - // else we won't be able to delete and recreate it beween tests. - configurable: __DEV__, - enumerable: false, - get() { - return hook; - }, - }), - ); + if (__TEST__) { + hook.dangerous_setTargetConsoleForTesting = dangerous_setTargetConsoleForTesting; + } - return hook; -} + Object.defineProperty(target, '__REACT_DEVTOOLS_GLOBAL_HOOK__', { + // This property needs to be configurable for the test environment, + // else we won't be able to delete and recreate it between tests. + configurable: __DEV__, + enumerable: false, -exports.installHook = installHook; + get() { + return hook; + } + + }); + return hook; +} \ No newline at end of file diff --git a/devtools/server/actors/replay/react-devtools/react_devtools_backend.js b/devtools/server/actors/replay/react-devtools/react_devtools_backend.js index bb4c761750e94..74bb00688fce6 100644 --- a/devtools/server/actors/replay/react-devtools/react_devtools_backend.js +++ b/devtools/server/actors/replay/react-devtools/react_devtools_backend.js @@ -1,89 +1,89 @@ function reactDevtoolsBackend(window) { /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; +/******/ // The module cache +/******/ var installedModules = {}; /******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { +/******/ // The require function +/******/ function __webpack_require__(moduleId) { /******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) { +/******/ return installedModules[moduleId].exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ i: moduleId, +/******/ l: false, +/******/ exports: {} +/******/ }; /******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ -/******/ // Flag the module as loaded -/******/ module.l = true; +/******/ // Flag the module as loaded +/******/ module.l = true; /******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } /******/ /******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; /******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; /******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; +/******/ // define getter function for harmony exports +/******/ __webpack_require__.d = function(exports, name, getter) { +/******/ if(!__webpack_require__.o(exports, name)) { +/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); +/******/ } +/******/ }; /******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; /******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; +/******/ // create a fake namespace object +/******/ // mode & 1: value is a module id, require it +/******/ // mode & 2: merge all properties of value into the ns +/******/ // mode & 4: return value when already ns object +/******/ // mode & 8|1: behave like require +/******/ __webpack_require__.t = function(value, mode) { +/******/ if(mode & 1) value = __webpack_require__(value); +/******/ if(mode & 8) return value; +/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; +/******/ var ns = Object.create(null); +/******/ __webpack_require__.r(ns); +/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); +/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); +/******/ return ns; +/******/ }; /******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function getDefault() { return module['default']; } : +/******/ function getModuleExports() { return module; }; +/******/ __webpack_require__.d(getter, 'a', getter); +/******/ return getter; +/******/ }; /******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; +/******/ // Object.prototype.hasOwnProperty.call +/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; /******/ /******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 20); +/******/ // Load entry module and return exports +/******/ return __webpack_require__(__webpack_require__.s = 25); /******/ }) /************************************************************************/ /******/ ([ @@ -102,10 +102,12 @@ function reactDevtoolsBackend(window) { /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return ElementTypeRoot; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return ElementTypeSuspense; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return ElementTypeSuspenseList; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return ElementTypeTracingMarker; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ComponentFilterElementType; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ComponentFilterDisplayName; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return ComponentFilterLocation; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ComponentFilterHOC; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return StrictMode; }); /** * Copyright (c) Facebook, Inc. and its affiliates. * @@ -132,7 +134,8 @@ const ElementTypeOtherOrUnknown = 9; const ElementTypeProfiler = 10; const ElementTypeRoot = 11; const ElementTypeSuspense = 12; -const ElementTypeSuspenseList = 13; // Different types of elements displayed in the Elements tree. +const ElementTypeSuspenseList = 13; +const ElementTypeTracingMarker = 14; // Different types of elements displayed in the Elements tree. // These types may be used to visually distinguish types, // or to enable/disable certain functionality. @@ -144,120 +147,46 @@ const ComponentFilterElementType = 1; const ComponentFilterDisplayName = 2; const ComponentFilterLocation = 3; const ComponentFilterHOC = 4; +const StrictMode = 1; /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; - -// EXPORTS -__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ getAllEnumerableKeys; }); -__webpack_require__.d(__webpack_exports__, "f", function() { return /* binding */ getDisplayName; }); -__webpack_require__.d(__webpack_exports__, "i", function() { return /* binding */ getUID; }); -__webpack_require__.d(__webpack_exports__, "m", function() { return /* binding */ utfEncodeString; }); -__webpack_require__.d(__webpack_exports__, "j", function() { return /* binding */ printOperationsArray; }); -__webpack_require__.d(__webpack_exports__, "e", function() { return /* binding */ getDefaultComponentFilters; }); -__webpack_require__.d(__webpack_exports__, "h", function() { return /* binding */ getInObject; }); -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ deletePathInObject; }); -__webpack_require__.d(__webpack_exports__, "k", function() { return /* binding */ renamePathInObject; }); -__webpack_require__.d(__webpack_exports__, "l", function() { return /* binding */ setInObject; }); -__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ getDataType; }); -__webpack_require__.d(__webpack_exports__, "g", function() { return /* binding */ getDisplayNameForReactElement; }); -__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ formatDataForPreview; }); - -// UNUSED EXPORTS: alphaSortKeys, utfDecodeString, getSavedComponentFilters, saveComponentFilters, getAppendComponentStack, setAppendComponentStack, getBreakOnConsoleErrors, setBreakOnConsoleErrors, getShowInlineWarningsAndErrors, setShowInlineWarningsAndErrors, separateDisplayNameAndHOCs, shallowDiffers - -// EXTERNAL MODULE: /home/marvin/Misc/projects/replay/react/node_modules/lru-cache/index.js -var lru_cache = __webpack_require__(17); -var lru_cache_default = /*#__PURE__*/__webpack_require__.n(lru_cache); - -// EXTERNAL MODULE: /home/marvin/Misc/projects/replay/react/build/node_modules/react-is/index.js -var react_is = __webpack_require__(6); - -// CONCATENATED MODULE: ../shared/ReactSymbols.js -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ -// ATTENTION -// When adding new symbols to this file, -// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' -// The Symbol used to tag the ReactElement-like types. If there is no native Symbol -// nor polyfill, then a plain number is used for performance. -let REACT_ELEMENT_TYPE = 0xeac7; -let REACT_PORTAL_TYPE = 0xeaca; -let REACT_FRAGMENT_TYPE = 0xeacb; -let REACT_STRICT_MODE_TYPE = 0xeacc; -let REACT_PROFILER_TYPE = 0xead2; -let REACT_PROVIDER_TYPE = 0xeacd; -let REACT_CONTEXT_TYPE = 0xeace; -let REACT_FORWARD_REF_TYPE = 0xead0; -let REACT_SUSPENSE_TYPE = 0xead1; -let REACT_SUSPENSE_LIST_TYPE = 0xead8; -let REACT_MEMO_TYPE = 0xead3; -let REACT_LAZY_TYPE = 0xead4; -let REACT_SCOPE_TYPE = 0xead7; -let REACT_OPAQUE_ID_TYPE = 0xeae0; -let REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1; -let REACT_OFFSCREEN_TYPE = 0xeae2; -let REACT_LEGACY_HIDDEN_TYPE = 0xeae3; -let REACT_CACHE_TYPE = 0xeae4; - -if (typeof Symbol === 'function' && Symbol.for) { - const symbolFor = Symbol.for; - REACT_ELEMENT_TYPE = symbolFor('react.element'); - REACT_PORTAL_TYPE = symbolFor('react.portal'); - REACT_FRAGMENT_TYPE = symbolFor('react.fragment'); - REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode'); - REACT_PROFILER_TYPE = symbolFor('react.profiler'); - REACT_PROVIDER_TYPE = symbolFor('react.provider'); - REACT_CONTEXT_TYPE = symbolFor('react.context'); - REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref'); - REACT_SUSPENSE_TYPE = symbolFor('react.suspense'); - REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list'); - REACT_MEMO_TYPE = symbolFor('react.memo'); - REACT_LAZY_TYPE = symbolFor('react.lazy'); - REACT_SCOPE_TYPE = symbolFor('react.scope'); - REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id'); - REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode'); - REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen'); - REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden'); - REACT_CACHE_TYPE = symbolFor('react.cache'); -} - -const MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; -const FAUX_ITERATOR_SYMBOL = '@@iterator'; -function getIteratorFn(maybeIterable) { - if (maybeIterable === null || typeof maybeIterable !== 'object') { - return null; - } - - const maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; - - if (typeof maybeIterator === 'function') { - return maybeIterator; - } - - return null; -} -// EXTERNAL MODULE: ../react-devtools-shared/src/constants.js -var constants = __webpack_require__(2); - -// EXTERNAL MODULE: ../react-devtools-shared/src/types.js -var types = __webpack_require__(0); - -// EXTERNAL MODULE: ../react-devtools-shared/src/storage.js -var storage = __webpack_require__(5); - -// EXTERNAL MODULE: ../react-devtools-shared/src/hydration.js -var hydration = __webpack_require__(8); - -// CONCATENATED MODULE: ../react-devtools-shared/src/utils.js +/* unused harmony export CHROME_WEBSTORE_EXTENSION_ID */ +/* unused harmony export INTERNAL_EXTENSION_ID */ +/* unused harmony export LOCAL_EXTENSION_ID */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return __DEBUG__; }); +/* unused harmony export __PERFORMANCE_PROFILE__ */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return TREE_OPERATION_ADD; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return TREE_OPERATION_REMOVE; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return TREE_OPERATION_REORDER_CHILDREN; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return TREE_OPERATION_UPDATE_TREE_BASE_DURATION; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return TREE_OPERATION_REMOVE_ROOT; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return TREE_OPERATION_SET_SUBTREE_MODE; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return PROFILING_FLAG_BASIC_SUPPORT; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return PROFILING_FLAG_TIMELINE_SUPPORT; }); +/* unused harmony export LOCAL_STORAGE_DEFAULT_TAB_KEY */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LOCAL_STORAGE_FILTER_PREFERENCES_KEY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return SESSION_STORAGE_LAST_SELECTION_KEY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return LOCAL_STORAGE_OPEN_IN_EDITOR_URL; }); +/* unused harmony export LOCAL_STORAGE_PARSE_HOOK_NAMES_KEY */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return SESSION_STORAGE_RELOAD_AND_PROFILE_KEY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return LOCAL_STORAGE_SHOULD_PATCH_CONSOLE_KEY; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY; }); +/* unused harmony export LOCAL_STORAGE_TRACE_UPDATES_ENABLED_KEY */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE; }); +/* unused harmony export PROFILER_EXPORT_VERSION */ +/* unused harmony export CHANGE_LOG_URL */ +/* unused harmony export UNSUPPORTED_VERSION_URL */ +/* unused harmony export REACT_DEVTOOLS_WORKPLACE_URL */ +/* unused harmony export THEME_STYLES */ +/* unused harmony export COMFORTABLE_LINE_HEIGHT */ +/* unused harmony export COMPACT_LINE_HEIGHT */ /** * Copyright (c) Facebook, Inc. and its affiliates. * @@ -266,1099 +195,1210 @@ var hydration = __webpack_require__(8); * * */ +const CHROME_WEBSTORE_EXTENSION_ID = 'fmkadmapgofadopljbjfkapdkoienihi'; +const INTERNAL_EXTENSION_ID = 'dnjnjgbfilfphmojnmhliehogmojhclc'; +const LOCAL_EXTENSION_ID = 'ikiahnapldjmdmpkmfhjdjilojjhgcbf'; // Flip this flag to true to enable verbose console debug logging. +const __DEBUG__ = false; // Flip this flag to true to enable performance.mark() and performance.measure() timings. +const __PERFORMANCE_PROFILE__ = false; +const TREE_OPERATION_ADD = 1; +const TREE_OPERATION_REMOVE = 2; +const TREE_OPERATION_REORDER_CHILDREN = 3; +const TREE_OPERATION_UPDATE_TREE_BASE_DURATION = 4; +const TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS = 5; +const TREE_OPERATION_REMOVE_ROOT = 6; +const TREE_OPERATION_SET_SUBTREE_MODE = 7; +const PROFILING_FLAG_BASIC_SUPPORT = 0b01; +const PROFILING_FLAG_TIMELINE_SUPPORT = 0b10; +const LOCAL_STORAGE_DEFAULT_TAB_KEY = 'React::DevTools::defaultTab'; +const LOCAL_STORAGE_FILTER_PREFERENCES_KEY = 'React::DevTools::componentFilters'; +const SESSION_STORAGE_LAST_SELECTION_KEY = 'React::DevTools::lastSelection'; +const LOCAL_STORAGE_OPEN_IN_EDITOR_URL = 'React::DevTools::openInEditorUrl'; +const LOCAL_STORAGE_PARSE_HOOK_NAMES_KEY = 'React::DevTools::parseHookNames'; +const SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY = 'React::DevTools::recordChangeDescriptions'; +const SESSION_STORAGE_RELOAD_AND_PROFILE_KEY = 'React::DevTools::reloadAndProfile'; +const LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS = 'React::DevTools::breakOnConsoleErrors'; +const LOCAL_STORAGE_SHOULD_PATCH_CONSOLE_KEY = 'React::DevTools::appendComponentStack'; +const LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY = 'React::DevTools::showInlineWarningsAndErrors'; +const LOCAL_STORAGE_TRACE_UPDATES_ENABLED_KEY = 'React::DevTools::traceUpdatesEnabled'; +const LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE = 'React::DevTools::hideConsoleLogsInStrictMode'; +const PROFILER_EXPORT_VERSION = 5; +const CHANGE_LOG_URL = 'https://github.com/facebook/react/blob/main/packages/react-devtools/CHANGELOG.md'; +const UNSUPPORTED_VERSION_URL = 'https://reactjs.org/blog/2019/08/15/new-react-devtools.html#how-do-i-get-the-old-version-back'; +const REACT_DEVTOOLS_WORKPLACE_URL = 'https://fburl.com/react-devtools-workplace-group'; +const THEME_STYLES = { + light: { + '--color-attribute-name': '#ef6632', + '--color-attribute-name-not-editable': '#23272f', + '--color-attribute-name-inverted': 'rgba(255, 255, 255, 0.7)', + '--color-attribute-value': '#1a1aa6', + '--color-attribute-value-inverted': '#ffffff', + '--color-attribute-editable-value': '#1a1aa6', + '--color-background': '#ffffff', + '--color-background-hover': 'rgba(0, 136, 250, 0.1)', + '--color-background-inactive': '#e5e5e5', + '--color-background-invalid': '#fff0f0', + '--color-background-selected': '#0088fa', + '--color-button-background': '#ffffff', + '--color-button-background-focus': '#ededed', + '--color-button': '#5f6673', + '--color-button-disabled': '#cfd1d5', + '--color-button-active': '#0088fa', + '--color-button-focus': '#23272f', + '--color-button-hover': '#23272f', + '--color-border': '#eeeeee', + '--color-commit-did-not-render-fill': '#cfd1d5', + '--color-commit-did-not-render-fill-text': '#000000', + '--color-commit-did-not-render-pattern': '#cfd1d5', + '--color-commit-did-not-render-pattern-text': '#333333', + '--color-commit-gradient-0': '#37afa9', + '--color-commit-gradient-1': '#63b19e', + '--color-commit-gradient-2': '#80b393', + '--color-commit-gradient-3': '#97b488', + '--color-commit-gradient-4': '#abb67d', + '--color-commit-gradient-5': '#beb771', + '--color-commit-gradient-6': '#cfb965', + '--color-commit-gradient-7': '#dfba57', + '--color-commit-gradient-8': '#efbb49', + '--color-commit-gradient-9': '#febc38', + '--color-commit-gradient-text': '#000000', + '--color-component-name': '#6a51b2', + '--color-component-name-inverted': '#ffffff', + '--color-component-badge-background': 'rgba(0, 0, 0, 0.1)', + '--color-component-badge-background-inverted': 'rgba(255, 255, 255, 0.25)', + '--color-component-badge-count': '#777d88', + '--color-component-badge-count-inverted': 'rgba(255, 255, 255, 0.7)', + '--color-console-error-badge-text': '#ffffff', + '--color-console-error-background': '#fff0f0', + '--color-console-error-border': '#ffd6d6', + '--color-console-error-icon': '#eb3941', + '--color-console-error-text': '#fe2e31', + '--color-console-warning-badge-text': '#000000', + '--color-console-warning-background': '#fffbe5', + '--color-console-warning-border': '#fff5c1', + '--color-console-warning-icon': '#f4bd00', + '--color-console-warning-text': '#64460c', + '--color-context-background': 'rgba(0,0,0,.9)', + '--color-context-background-hover': 'rgba(255, 255, 255, 0.1)', + '--color-context-background-selected': '#178fb9', + '--color-context-border': '#3d424a', + '--color-context-text': '#ffffff', + '--color-context-text-selected': '#ffffff', + '--color-dim': '#777d88', + '--color-dimmer': '#cfd1d5', + '--color-dimmest': '#eff0f1', + '--color-error-background': 'hsl(0, 100%, 97%)', + '--color-error-border': 'hsl(0, 100%, 92%)', + '--color-error-text': '#ff0000', + '--color-expand-collapse-toggle': '#777d88', + '--color-link': '#0000ff', + '--color-modal-background': 'rgba(255, 255, 255, 0.75)', + '--color-bridge-version-npm-background': '#eff0f1', + '--color-bridge-version-npm-text': '#000000', + '--color-bridge-version-number': '#0088fa', + '--color-primitive-hook-badge-background': '#e5e5e5', + '--color-primitive-hook-badge-text': '#5f6673', + '--color-record-active': '#fc3a4b', + '--color-record-hover': '#3578e5', + '--color-record-inactive': '#0088fa', + '--color-resize-bar': '#eeeeee', + '--color-resize-bar-active': '#dcdcdc', + '--color-resize-bar-border': '#d1d1d1', + '--color-resize-bar-dot': '#333333', + '--color-timeline-internal-module': '#d1d1d1', + '--color-timeline-internal-module-hover': '#c9c9c9', + '--color-timeline-internal-module-text': '#444', + '--color-timeline-native-event': '#ccc', + '--color-timeline-native-event-hover': '#aaa', + '--color-timeline-network-primary': '#fcf3dc', + '--color-timeline-network-primary-hover': '#f0e7d1', + '--color-timeline-network-secondary': '#efc457', + '--color-timeline-network-secondary-hover': '#e3ba52', + '--color-timeline-priority-background': '#f6f6f6', + '--color-timeline-priority-border': '#eeeeee', + '--color-timeline-user-timing': '#c9cacd', + '--color-timeline-user-timing-hover': '#93959a', + '--color-timeline-react-idle': '#d3e5f6', + '--color-timeline-react-idle-hover': '#c3d9ef', + '--color-timeline-react-render': '#9fc3f3', + '--color-timeline-react-render-hover': '#83afe9', + '--color-timeline-react-render-text': '#11365e', + '--color-timeline-react-commit': '#c88ff0', + '--color-timeline-react-commit-hover': '#b281d6', + '--color-timeline-react-commit-text': '#3e2c4a', + '--color-timeline-react-layout-effects': '#b281d6', + '--color-timeline-react-layout-effects-hover': '#9d71bd', + '--color-timeline-react-layout-effects-text': '#3e2c4a', + '--color-timeline-react-passive-effects': '#b281d6', + '--color-timeline-react-passive-effects-hover': '#9d71bd', + '--color-timeline-react-passive-effects-text': '#3e2c4a', + '--color-timeline-react-schedule': '#9fc3f3', + '--color-timeline-react-schedule-hover': '#2683E2', + '--color-timeline-react-suspense-rejected': '#f1cc14', + '--color-timeline-react-suspense-rejected-hover': '#ffdf37', + '--color-timeline-react-suspense-resolved': '#a6e59f', + '--color-timeline-react-suspense-resolved-hover': '#89d281', + '--color-timeline-react-suspense-unresolved': '#c9cacd', + '--color-timeline-react-suspense-unresolved-hover': '#93959a', + '--color-timeline-thrown-error': '#ee1638', + '--color-timeline-thrown-error-hover': '#da1030', + '--color-timeline-text-color': '#000000', + '--color-timeline-text-dim-color': '#ccc', + '--color-timeline-react-work-border': '#eeeeee', + '--color-search-match': 'yellow', + '--color-search-match-current': '#f7923b', + '--color-selected-tree-highlight-active': 'rgba(0, 136, 250, 0.1)', + '--color-selected-tree-highlight-inactive': 'rgba(0, 0, 0, 0.05)', + '--color-scroll-caret': 'rgba(150, 150, 150, 0.5)', + '--color-tab-selected-border': '#0088fa', + '--color-text': '#000000', + '--color-text-invalid': '#ff0000', + '--color-text-selected': '#ffffff', + '--color-toggle-background-invalid': '#fc3a4b', + '--color-toggle-background-on': '#0088fa', + '--color-toggle-background-off': '#cfd1d5', + '--color-toggle-text': '#ffffff', + '--color-warning-background': '#fb3655', + '--color-warning-background-hover': '#f82042', + '--color-warning-text-color': '#ffffff', + '--color-warning-text-color-inverted': '#fd4d69', + // The styles below should be kept in sync with 'root.css' + // They are repeated there because they're used by e.g. tooltips or context menus + // which get rendered outside of the DOM subtree (where normal theme/styles are written). + '--color-scroll-thumb': '#c2c2c2', + '--color-scroll-track': '#fafafa', + '--color-tooltip-background': 'rgba(0, 0, 0, 0.9)', + '--color-tooltip-text': '#ffffff' + }, + dark: { + '--color-attribute-name': '#9d87d2', + '--color-attribute-name-not-editable': '#ededed', + '--color-attribute-name-inverted': '#282828', + '--color-attribute-value': '#cedae0', + '--color-attribute-value-inverted': '#ffffff', + '--color-attribute-editable-value': 'yellow', + '--color-background': '#282c34', + '--color-background-hover': 'rgba(255, 255, 255, 0.1)', + '--color-background-inactive': '#3d424a', + '--color-background-invalid': '#5c0000', + '--color-background-selected': '#178fb9', + '--color-button-background': '#282c34', + '--color-button-background-focus': '#3d424a', + '--color-button': '#afb3b9', + '--color-button-active': '#61dafb', + '--color-button-disabled': '#4f5766', + '--color-button-focus': '#a2e9fc', + '--color-button-hover': '#ededed', + '--color-border': '#3d424a', + '--color-commit-did-not-render-fill': '#777d88', + '--color-commit-did-not-render-fill-text': '#000000', + '--color-commit-did-not-render-pattern': '#666c77', + '--color-commit-did-not-render-pattern-text': '#ffffff', + '--color-commit-gradient-0': '#37afa9', + '--color-commit-gradient-1': '#63b19e', + '--color-commit-gradient-2': '#80b393', + '--color-commit-gradient-3': '#97b488', + '--color-commit-gradient-4': '#abb67d', + '--color-commit-gradient-5': '#beb771', + '--color-commit-gradient-6': '#cfb965', + '--color-commit-gradient-7': '#dfba57', + '--color-commit-gradient-8': '#efbb49', + '--color-commit-gradient-9': '#febc38', + '--color-commit-gradient-text': '#000000', + '--color-component-name': '#61dafb', + '--color-component-name-inverted': '#282828', + '--color-component-badge-background': 'rgba(255, 255, 255, 0.25)', + '--color-component-badge-background-inverted': 'rgba(0, 0, 0, 0.25)', + '--color-component-badge-count': '#8f949d', + '--color-component-badge-count-inverted': 'rgba(255, 255, 255, 0.7)', + '--color-console-error-badge-text': '#000000', + '--color-console-error-background': '#290000', + '--color-console-error-border': '#5c0000', + '--color-console-error-icon': '#eb3941', + '--color-console-error-text': '#fc7f7f', + '--color-console-warning-badge-text': '#000000', + '--color-console-warning-background': '#332b00', + '--color-console-warning-border': '#665500', + '--color-console-warning-icon': '#f4bd00', + '--color-console-warning-text': '#f5f2ed', + '--color-context-background': 'rgba(255,255,255,.95)', + '--color-context-background-hover': 'rgba(0, 136, 250, 0.1)', + '--color-context-background-selected': '#0088fa', + '--color-context-border': '#eeeeee', + '--color-context-text': '#000000', + '--color-context-text-selected': '#ffffff', + '--color-dim': '#8f949d', + '--color-dimmer': '#777d88', + '--color-dimmest': '#4f5766', + '--color-error-background': '#200', + '--color-error-border': '#900', + '--color-error-text': '#f55', + '--color-expand-collapse-toggle': '#8f949d', + '--color-link': '#61dafb', + '--color-modal-background': 'rgba(0, 0, 0, 0.75)', + '--color-bridge-version-npm-background': 'rgba(0, 0, 0, 0.25)', + '--color-bridge-version-npm-text': '#ffffff', + '--color-bridge-version-number': 'yellow', + '--color-primitive-hook-badge-background': 'rgba(0, 0, 0, 0.25)', + '--color-primitive-hook-badge-text': 'rgba(255, 255, 255, 0.7)', + '--color-record-active': '#fc3a4b', + '--color-record-hover': '#a2e9fc', + '--color-record-inactive': '#61dafb', + '--color-resize-bar': '#282c34', + '--color-resize-bar-active': '#31363f', + '--color-resize-bar-border': '#3d424a', + '--color-resize-bar-dot': '#cfd1d5', + '--color-timeline-internal-module': '#303542', + '--color-timeline-internal-module-hover': '#363b4a', + '--color-timeline-internal-module-text': '#7f8899', + '--color-timeline-native-event': '#b2b2b2', + '--color-timeline-native-event-hover': '#949494', + '--color-timeline-network-primary': '#fcf3dc', + '--color-timeline-network-primary-hover': '#e3dbc5', + '--color-timeline-network-secondary': '#efc457', + '--color-timeline-network-secondary-hover': '#d6af4d', + '--color-timeline-priority-background': '#1d2129', + '--color-timeline-priority-border': '#282c34', + '--color-timeline-user-timing': '#c9cacd', + '--color-timeline-user-timing-hover': '#93959a', + '--color-timeline-react-idle': '#3d485b', + '--color-timeline-react-idle-hover': '#465269', + '--color-timeline-react-render': '#2683E2', + '--color-timeline-react-render-hover': '#1a76d4', + '--color-timeline-react-render-text': '#11365e', + '--color-timeline-react-commit': '#731fad', + '--color-timeline-react-commit-hover': '#611b94', + '--color-timeline-react-commit-text': '#e5c1ff', + '--color-timeline-react-layout-effects': '#611b94', + '--color-timeline-react-layout-effects-hover': '#51167a', + '--color-timeline-react-layout-effects-text': '#e5c1ff', + '--color-timeline-react-passive-effects': '#611b94', + '--color-timeline-react-passive-effects-hover': '#51167a', + '--color-timeline-react-passive-effects-text': '#e5c1ff', + '--color-timeline-react-schedule': '#2683E2', + '--color-timeline-react-schedule-hover': '#1a76d4', + '--color-timeline-react-suspense-rejected': '#f1cc14', + '--color-timeline-react-suspense-rejected-hover': '#e4c00f', + '--color-timeline-react-suspense-resolved': '#a6e59f', + '--color-timeline-react-suspense-resolved-hover': '#89d281', + '--color-timeline-react-suspense-unresolved': '#c9cacd', + '--color-timeline-react-suspense-unresolved-hover': '#93959a', + '--color-timeline-thrown-error': '#fb3655', + '--color-timeline-thrown-error-hover': '#f82042', + '--color-timeline-text-color': '#282c34', + '--color-timeline-text-dim-color': '#555b66', + '--color-timeline-react-work-border': '#3d424a', + '--color-search-match': 'yellow', + '--color-search-match-current': '#f7923b', + '--color-selected-tree-highlight-active': 'rgba(23, 143, 185, 0.15)', + '--color-selected-tree-highlight-inactive': 'rgba(255, 255, 255, 0.05)', + '--color-scroll-caret': '#4f5766', + '--color-shadow': 'rgba(0, 0, 0, 0.5)', + '--color-tab-selected-border': '#178fb9', + '--color-text': '#ffffff', + '--color-text-invalid': '#ff8080', + '--color-text-selected': '#ffffff', + '--color-toggle-background-invalid': '#fc3a4b', + '--color-toggle-background-on': '#178fb9', + '--color-toggle-background-off': '#777d88', + '--color-toggle-text': '#ffffff', + '--color-warning-background': '#ee1638', + '--color-warning-background-hover': '#da1030', + '--color-warning-text-color': '#ffffff', + '--color-warning-text-color-inverted': '#ee1638', + // The styles below should be kept in sync with 'root.css' + // They are repeated there because they're used by e.g. tooltips or context menus + // which get rendered outside of the DOM subtree (where normal theme/styles are written). + '--color-scroll-thumb': '#afb3b9', + '--color-scroll-track': '#313640', + '--color-tooltip-background': 'rgba(255, 255, 255, 0.95)', + '--color-tooltip-text': '#000000' + }, + compact: { + '--font-size-monospace-small': '9px', + '--font-size-monospace-normal': '11px', + '--font-size-monospace-large': '15px', + '--font-size-sans-small': '10px', + '--font-size-sans-normal': '12px', + '--font-size-sans-large': '14px', + '--line-height-data': '18px' + }, + comfortable: { + '--font-size-monospace-small': '10px', + '--font-size-monospace-normal': '13px', + '--font-size-monospace-large': '17px', + '--font-size-sans-small': '12px', + '--font-size-sans-normal': '14px', + '--font-size-sans-large': '16px', + '--line-height-data': '22px' + } +}; // HACK +// +// Sometimes the inline target is rendered before root styles are applied, +// which would result in e.g. NaN itemSize being passed to react-window list. +const COMFORTABLE_LINE_HEIGHT = parseInt(THEME_STYLES.comfortable['--line-height-data'], 10); +const COMPACT_LINE_HEIGHT = parseInt(THEME_STYLES.compact['--line-height-data'], 10); +/***/ }), +/* 2 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { +"use strict"; +/* WEBPACK VAR INJECTION */(function(process) {/* unused harmony export alphaSortKeys */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return getAllEnumerableKeys; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return getDisplayName; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return getUID; }); +/* unused harmony export utfDecodeString */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return utfEncodeString; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return printOperationsArray; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return getDefaultComponentFilters; }); +/* unused harmony export getSavedComponentFilters */ +/* unused harmony export saveComponentFilters */ +/* unused harmony export getAppendComponentStack */ +/* unused harmony export setAppendComponentStack */ +/* unused harmony export getBreakOnConsoleErrors */ +/* unused harmony export setBreakOnConsoleErrors */ +/* unused harmony export getHideConsoleLogsInStrictMode */ +/* unused harmony export sethideConsoleLogsInStrictMode */ +/* unused harmony export getShowInlineWarningsAndErrors */ +/* unused harmony export setShowInlineWarningsAndErrors */ +/* unused harmony export getDefaultOpenInEditorURL */ +/* unused harmony export getOpenInEditorURL */ +/* unused harmony export separateDisplayNameAndHOCs */ +/* unused harmony export shallowDiffers */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return getInObject; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return deletePathInObject; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return renamePathInObject; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return setInObject; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return getDataType; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getDisplayNameForReactElement; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return formatDataForPreview; }); +/* harmony import */ var lru_cache__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(22); +/* harmony import */ var lru_cache__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lru_cache__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7); +/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_is__WEBPACK_IMPORTED_MODULE_1__); +/* harmony import */ var shared_ReactSymbols__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18); +/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1); +/* harmony import */ var react_devtools_shared_src_types__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(0); +/* harmony import */ var _storage__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(5); +/* harmony import */ var _hydration__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(10); +/* harmony import */ var _isArray__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6); +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ -const cachedDisplayNames = new WeakMap(); // On large trees, encoding takes significant time. -// Try to reuse the already encoded strings. - -const encodedStringCache = new lru_cache_default.a({ - max: 1000 -}); -function alphaSortKeys(a, b) { - if (a.toString() > b.toString()) { - return 1; - } else if (b.toString() > a.toString()) { - return -1; - } else { - return 0; - } -} -function getAllEnumerableKeys(obj) { - const keys = new Set(); - let current = obj; - - while (current != null) { - const currentKeys = [...Object.keys(current), ...Object.getOwnPropertySymbols(current)]; - const descriptors = Object.getOwnPropertyDescriptors(current); - currentKeys.forEach(key => { - // $FlowFixMe: key can be a Symbol https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor - if (descriptors[key].enumerable) { - keys.add(key); - } - }); - current = Object.getPrototypeOf(current); - } - - return keys; -} -function getDisplayName(type, fallbackName = 'Anonymous') { - const nameFromCache = cachedDisplayNames.get(type); - - if (nameFromCache != null) { - return nameFromCache; - } - - let displayName = fallbackName; // The displayName property is not guaranteed to be a string. - // It's only safe to use for our purposes if it's a string. - // github.com/facebook/react-devtools/issues/803 - - if (typeof type.displayName === 'string') { - displayName = type.displayName; - } else if (typeof type.name === 'string' && type.name !== '') { - displayName = type.name; - } - - cachedDisplayNames.set(type, displayName); - return displayName; -} -let uidCounter = 0; -function getUID() { - return ++uidCounter; -} -function utfDecodeString(array) { - return String.fromCodePoint(...array); -} -function utfEncodeString(string) { - const cached = encodedStringCache.get(string); - - if (cached !== undefined) { - return cached; - } - - const encoded = new Array(string.length); - - for (let i = 0; i < string.length; i++) { - encoded[i] = string.codePointAt(i); - } - - encodedStringCache.set(string, encoded); - return encoded; -} -function printOperationsArray(operations) { - // The first two values are always rendererID and rootID - const rendererID = operations[0]; - const rootID = operations[1]; - const logs = [`operations for renderer:${rendererID} and root:${rootID}`]; - let i = 2; // Reassemble the string table. - - const stringTable = [null // ID = 0 corresponds to the null string. - ]; - const stringTableSize = operations[i++]; - const stringTableEnd = i + stringTableSize; - - while (i < stringTableEnd) { - const nextLength = operations[i++]; - const nextString = utfDecodeString(operations.slice(i, i + nextLength)); - stringTable.push(nextString); - i += nextLength; - } - - while (i < operations.length) { - const operation = operations[i]; - - switch (operation) { - case constants["h" /* TREE_OPERATION_ADD */]: - { - const id = operations[i + 1]; - const type = operations[i + 2]; - i += 3; - - if (type === types["m" /* ElementTypeRoot */]) { - logs.push(`Add new root node ${id}`); - i++; // supportsProfiling - - i++; // hasOwnerMetadata - } else { - const parentID = operations[i]; - i++; - i++; // ownerID - - const displayNameStringID = operations[i]; - const displayName = stringTable[displayNameStringID]; - i++; - i++; // key - - logs.push(`Add node ${id} (${displayName || 'null'}) as child of ${parentID}`); - } - - break; - } - - case constants["i" /* TREE_OPERATION_REMOVE */]: - { - const removeLength = operations[i + 1]; - i += 2; - - for (let removeIndex = 0; removeIndex < removeLength; removeIndex++) { - const id = operations[i]; - i += 1; - logs.push(`Remove node ${id}`); - } - - break; - } - - case constants["j" /* TREE_OPERATION_REMOVE_ROOT */]: - { - i += 1; - logs.push(`Remove root ${rootID}`); - break; - } - - case constants["k" /* TREE_OPERATION_REORDER_CHILDREN */]: - { - const id = operations[i + 1]; - const numChildren = operations[i + 2]; - i += 3; - const children = operations.slice(i, i + numChildren); - i += numChildren; - logs.push(`Re-order node ${id} children ${children.join(',')}`); - break; - } - - case constants["m" /* TREE_OPERATION_UPDATE_TREE_BASE_DURATION */]: - // Base duration updates are only sent while profiling is in progress. - // We can ignore them at this point. - // The profiler UI uses them lazily in order to generate the tree. - i += 3; - break; - - case constants["l" /* TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS */]: - const id = operations[i + 1]; - const numErrors = operations[i + 2]; - const numWarnings = operations[i + 3]; - i += 4; - logs.push(`Node ${id} has ${numErrors} errors and ${numWarnings} warnings`); - break; - - default: - throw Error(`Unsupported Bridge operation "${operation}"`); - } - } - - console.log(logs.join('\n ')); -} -function getDefaultComponentFilters() { - return [{ - type: types["b" /* ComponentFilterElementType */], - value: types["i" /* ElementTypeHostComponent */], - isEnabled: true - }]; -} -function getSavedComponentFilters() { - try { - const raw = Object(storage["a" /* localStorageGetItem */])(constants["a" /* LOCAL_STORAGE_FILTER_PREFERENCES_KEY */]); - - if (raw != null) { - return JSON.parse(raw); - } - } catch (error) {} - - return getDefaultComponentFilters(); -} -function saveComponentFilters(componentFilters) { - Object(storage["b" /* localStorageSetItem */])(constants["a" /* LOCAL_STORAGE_FILTER_PREFERENCES_KEY */], JSON.stringify(componentFilters)); -} -function getAppendComponentStack() { - try { - const raw = Object(storage["a" /* localStorageGetItem */])(constants["c" /* LOCAL_STORAGE_SHOULD_PATCH_CONSOLE_KEY */]); - - if (raw != null) { - return JSON.parse(raw); - } - } catch (error) {} - - return true; -} -function setAppendComponentStack(value) { - Object(storage["b" /* localStorageSetItem */])(constants["c" /* LOCAL_STORAGE_SHOULD_PATCH_CONSOLE_KEY */], JSON.stringify(value)); -} -function getBreakOnConsoleErrors() { - try { - const raw = Object(storage["a" /* localStorageGetItem */])(constants["b" /* LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS */]); - - if (raw != null) { - return JSON.parse(raw); - } - } catch (error) {} - - return false; -} -function setBreakOnConsoleErrors(value) { - Object(storage["b" /* localStorageSetItem */])(constants["b" /* LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS */], JSON.stringify(value)); -} -function getShowInlineWarningsAndErrors() { - try { - const raw = Object(storage["a" /* localStorageGetItem */])(constants["d" /* LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY */]); - - if (raw != null) { - return JSON.parse(raw); - } - } catch (error) {} - - return true; -} -function setShowInlineWarningsAndErrors(value) { - Object(storage["b" /* localStorageSetItem */])(constants["d" /* LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY */], JSON.stringify(value)); -} -function separateDisplayNameAndHOCs(displayName, type) { - if (displayName === null) { - return [null, null]; - } - - let hocDisplayNames = null; - - switch (type) { - case types["e" /* ElementTypeClass */]: - case types["g" /* ElementTypeForwardRef */]: - case types["h" /* ElementTypeFunction */]: - case types["j" /* ElementTypeMemo */]: - if (displayName.indexOf('(') >= 0) { - const matches = displayName.match(/[^()]+/g); - - if (matches != null) { - displayName = matches.pop(); - hocDisplayNames = matches; - } - } - - break; - - default: - break; - } - - if (type === types["j" /* ElementTypeMemo */]) { - if (hocDisplayNames === null) { - hocDisplayNames = ['Memo']; - } else { - hocDisplayNames.unshift('Memo'); - } - } else if (type === types["g" /* ElementTypeForwardRef */]) { - if (hocDisplayNames === null) { - hocDisplayNames = ['ForwardRef']; - } else { - hocDisplayNames.unshift('ForwardRef'); - } - } - return [displayName, hocDisplayNames]; -} // Pulled from react-compat -// https://github.com/developit/preact-compat/blob/7c5de00e7c85e2ffd011bf3af02899b63f699d3a/src/index.js#L349 -function shallowDiffers(prev, next) { - for (const attribute in prev) { - if (!(attribute in next)) { - return true; - } - } - for (const attribute in next) { - if (prev[attribute] !== next[attribute]) { - return true; - } - } - return false; -} -function getInObject(object, path) { - return path.reduce((reduced, attr) => { - if (reduced) { - if (hasOwnProperty.call(reduced, attr)) { - return reduced[attr]; - } - if (typeof reduced[Symbol.iterator] === 'function') { - // Convert iterable to array and return array[index] - // - // TRICKY - // Don't use [...spread] syntax for this purpose. - // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values. - // Other types (e.g. typed arrays, Sets) will not spread correctly. - return Array.from(reduced)[attr]; - } - } - return null; - }, object); -} -function deletePathInObject(object, path) { - const length = path.length; - const last = path[length - 1]; - if (object != null) { - const parent = getInObject(object, path.slice(0, length - 1)); +const cachedDisplayNames = new WeakMap(); // On large trees, encoding takes significant time. +// Try to reuse the already encoded strings. - if (parent) { - if (Array.isArray(parent)) { - parent.splice(last, 1); - } else { - delete parent[last]; - } - } +const encodedStringCache = new lru_cache__WEBPACK_IMPORTED_MODULE_0___default.a({ + max: 1000 +}); +function alphaSortKeys(a, b) { + if (a.toString() > b.toString()) { + return 1; + } else if (b.toString() > a.toString()) { + return -1; + } else { + return 0; } } -function renamePathInObject(object, oldPath, newPath) { - const length = oldPath.length; - - if (object != null) { - const parent = getInObject(object, oldPath.slice(0, length - 1)); - - if (parent) { - const lastOld = oldPath[length - 1]; - const lastNew = newPath[length - 1]; - parent[lastNew] = parent[lastOld]; +function getAllEnumerableKeys(obj) { + const keys = new Set(); + let current = obj; - if (Array.isArray(parent)) { - parent.splice(lastOld, 1); - } else { - delete parent[lastOld]; + while (current != null) { + const currentKeys = [...Object.keys(current), ...Object.getOwnPropertySymbols(current)]; + const descriptors = Object.getOwnPropertyDescriptors(current); + currentKeys.forEach(key => { + // $FlowFixMe: key can be a Symbol https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor + if (descriptors[key].enumerable) { + keys.add(key); } - } + }); + current = Object.getPrototypeOf(current); } -} -function setInObject(object, path, value) { - const length = path.length; - const last = path[length - 1]; - - if (object != null) { - const parent = getInObject(object, path.slice(0, length - 1)); - if (parent) { - parent[last] = value; - } - } + return keys; } +function getDisplayName(type, fallbackName = 'Anonymous') { + const nameFromCache = cachedDisplayNames.get(type); -/** - * Get a enhanced/artificial type string based on the object instance - */ -function getDataType(data) { - if (data === null) { - return 'null'; - } else if (data === undefined) { - return 'undefined'; + if (nameFromCache != null) { + return nameFromCache; } - if (Object(react_is["isElement"])(data)) { - return 'react_element'; - } + let displayName = fallbackName; // The displayName property is not guaranteed to be a string. + // It's only safe to use for our purposes if it's a string. + // github.com/facebook/react-devtools/issues/803 - if (typeof HTMLElement !== 'undefined' && data instanceof HTMLElement) { - return 'html_element'; + if (typeof type.displayName === 'string') { + displayName = type.displayName; + } else if (typeof type.name === 'string' && type.name !== '') { + displayName = type.name; } - const type = typeof data; - - switch (type) { - case 'bigint': - return 'bigint'; - - case 'boolean': - return 'boolean'; - - case 'function': - return 'function'; + cachedDisplayNames.set(type, displayName); + return displayName; +} +let uidCounter = 0; +function getUID() { + return ++uidCounter; +} +function utfDecodeString(array) { + // Avoid spreading the array (e.g. String.fromCodePoint(...array)) + // Functions arguments are first placed on the stack before the function is called + // which throws a RangeError for large arrays. + // See github.com/facebook/react/issues/22293 + let string = ''; - case 'number': - if (Number.isNaN(data)) { - return 'nan'; - } else if (!Number.isFinite(data)) { - return 'infinity'; - } else { - return 'number'; - } + for (let i = 0; i < array.length; i++) { + const char = array[i]; + string += String.fromCodePoint(char); + } - case 'object': - if (Array.isArray(data)) { - return 'array'; - } else if (ArrayBuffer.isView(data)) { - return hasOwnProperty.call(data.constructor, 'BYTES_PER_ELEMENT') ? 'typed_array' : 'data_view'; - } else if (data.constructor && data.constructor.name === 'ArrayBuffer') { - // HACK This ArrayBuffer check is gross; is there a better way? - // We could try to create a new DataView with the value. - // If it doesn't error, we know it's an ArrayBuffer, - // but this seems kind of awkward and expensive. - return 'array_buffer'; - } else if (typeof data[Symbol.iterator] === 'function') { - const iterator = data[Symbol.iterator](); + return string; +} - if (!iterator) {// Proxies might break assumptoins about iterators. - // See github.com/facebook/react/issues/21654 - } else { - return iterator === data ? 'opaque_iterator' : 'iterator'; - } - } else if (data.constructor && data.constructor.name === 'RegExp') { - return 'regexp'; - } else { - const toStringValue = Object.prototype.toString.call(data); +function surrogatePairToCodePoint(charCode1, charCode2) { + return ((charCode1 & 0x3ff) << 10) + (charCode2 & 0x3ff) + 0x10000; +} // Credit for this encoding approach goes to Tim Down: +// https://stackoverflow.com/questions/4877326/how-can-i-tell-if-a-string-contains-multibyte-characters-in-javascript - if (toStringValue === '[object Date]') { - return 'date'; - } else if (toStringValue === '[object HTMLAllCollection]') { - return 'html_all_collection'; - } - } - return 'object'; +function utfEncodeString(string) { + const cached = encodedStringCache.get(string); - case 'string': - return 'string'; + if (cached !== undefined) { + return cached; + } - case 'symbol': - return 'symbol'; + const encoded = []; + let i = 0; + let charCode; - case 'undefined': - if (Object.prototype.toString.call(data) === '[object HTMLAllCollection]') { - return 'html_all_collection'; - } + while (i < string.length) { + charCode = string.charCodeAt(i); // Handle multibyte unicode characters (like emoji). - return 'undefined'; + if ((charCode & 0xf800) === 0xd800) { + encoded.push(surrogatePairToCodePoint(charCode, string.charCodeAt(++i))); + } else { + encoded.push(charCode); + } - default: - return 'unknown'; + ++i; } + + encodedStringCache.set(string, encoded); + return encoded; } -function getDisplayNameForReactElement(element) { - const elementType = Object(react_is["typeOf"])(element); +function printOperationsArray(operations) { + // The first two values are always rendererID and rootID + const rendererID = operations[0]; + const rootID = operations[1]; + const logs = [`operations for renderer:${rendererID} and root:${rootID}`]; + let i = 2; // Reassemble the string table. - switch (elementType) { - case react_is["ContextConsumer"]: - return 'ContextConsumer'; + const stringTable = [null // ID = 0 corresponds to the null string. + ]; + const stringTableSize = operations[i++]; + const stringTableEnd = i + stringTableSize; - case react_is["ContextProvider"]: - return 'ContextProvider'; + while (i < stringTableEnd) { + const nextLength = operations[i++]; + const nextString = utfDecodeString(operations.slice(i, i + nextLength)); + stringTable.push(nextString); + i += nextLength; + } - case react_is["ForwardRef"]: - return 'ForwardRef'; + while (i < operations.length) { + const operation = operations[i]; - case react_is["Fragment"]: - return 'Fragment'; + switch (operation) { + case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_ADD */ "l"]: + { + const id = operations[i + 1]; + const type = operations[i + 2]; + i += 3; - case react_is["Lazy"]: - return 'Lazy'; + if (type === react_devtools_shared_src_types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeRoot */ "m"]) { + logs.push(`Add new root node ${id}`); + i++; // isStrictModeCompliant - case react_is["Memo"]: - return 'Memo'; + i++; // supportsProfiling - case react_is["Portal"]: - return 'Portal'; + i++; // supportsStrictMode - case react_is["Profiler"]: - return 'Profiler'; + i++; // hasOwnerMetadata + } else { + const parentID = operations[i]; + i++; + i++; // ownerID - case react_is["StrictMode"]: - return 'StrictMode'; + const displayNameStringID = operations[i]; + const displayName = stringTable[displayNameStringID]; + i++; + i++; // key - case react_is["Suspense"]: - return 'Suspense'; + logs.push(`Add node ${id} (${displayName || 'null'}) as child of ${parentID}`); + } - case REACT_SUSPENSE_LIST_TYPE: - return 'SuspenseList'; + break; + } - default: - const { - type - } = element; + case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_REMOVE */ "m"]: + { + const removeLength = operations[i + 1]; + i += 2; - if (typeof type === 'string') { - return type; - } else if (typeof type === 'function') { - return getDisplayName(type, 'Anonymous'); - } else if (type != null) { - return 'NotImplementedInDevtools'; - } else { - return 'Element'; - } + for (let removeIndex = 0; removeIndex < removeLength; removeIndex++) { + const id = operations[i]; + i += 1; + logs.push(`Remove node ${id}`); + } - } -} -const MAX_PREVIEW_STRING_LENGTH = 50; + break; + } -function truncateForDisplay(string, length = MAX_PREVIEW_STRING_LENGTH) { - if (string.length > length) { - return string.substr(0, length) + '…'; - } else { - return string; - } -} // Attempts to mimic Chrome's inline preview for values. -// For example, the following value... -// { -// foo: 123, -// bar: "abc", -// baz: [true, false], -// qux: { ab: 1, cd: 2 } -// }; -// -// Would show a preview of... -// {foo: 123, bar: "abc", baz: Array(2), qux: {…}} -// -// And the following value... -// [ -// 123, -// "abc", -// [true, false], -// { foo: 123, bar: "abc" } -// ]; -// -// Would show a preview of... -// [123, "abc", Array(2), {…}] + case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_REMOVE_ROOT */ "n"]: + { + i += 1; + logs.push(`Remove root ${rootID}`); + break; + } + case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_SET_SUBTREE_MODE */ "p"]: + { + const id = operations[i + 1]; + const mode = operations[i + 1]; + i += 3; + logs.push(`Mode ${mode} set for subtree with root ${id}`); + break; + } -function formatDataForPreview(data, showFormattedValue) { - if (data != null && hasOwnProperty.call(data, hydration["b" /* meta */].type)) { - return showFormattedValue ? data[hydration["b" /* meta */].preview_long] : data[hydration["b" /* meta */].preview_short]; - } + case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_REORDER_CHILDREN */ "o"]: + { + const id = operations[i + 1]; + const numChildren = operations[i + 2]; + i += 3; + const children = operations.slice(i, i + numChildren); + i += numChildren; + logs.push(`Re-order node ${id} children ${children.join(',')}`); + break; + } - const type = getDataType(data); + case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_UPDATE_TREE_BASE_DURATION */ "r"]: + // Base duration updates are only sent while profiling is in progress. + // We can ignore them at this point. + // The profiler UI uses them lazily in order to generate the tree. + i += 3; + break; - switch (type) { - case 'html_element': - return `<${truncateForDisplay(data.tagName.toLowerCase())} />`; + case _constants__WEBPACK_IMPORTED_MODULE_3__[/* TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS */ "q"]: + const id = operations[i + 1]; + const numErrors = operations[i + 2]; + const numWarnings = operations[i + 3]; + i += 4; + logs.push(`Node ${id} has ${numErrors} errors and ${numWarnings} warnings`); + break; - case 'function': - return truncateForDisplay(`ƒ ${typeof data.name === 'function' ? '' : data.name}() {}`); + default: + throw Error(`Unsupported Bridge operation "${operation}"`); + } + } - case 'string': - return `"${data}"`; + console.log(logs.join('\n ')); +} +function getDefaultComponentFilters() { + return [{ + type: react_devtools_shared_src_types__WEBPACK_IMPORTED_MODULE_4__[/* ComponentFilterElementType */ "b"], + value: react_devtools_shared_src_types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeHostComponent */ "i"], + isEnabled: true + }]; +} +function getSavedComponentFilters() { + try { + const raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_FILTER_PREFERENCES_KEY */ "a"]); - case 'bigint': - return truncateForDisplay(data.toString() + 'n'); + if (raw != null) { + return JSON.parse(raw); + } + } catch (error) {} - case 'regexp': - return truncateForDisplay(data.toString()); + return getDefaultComponentFilters(); +} +function saveComponentFilters(componentFilters) { + Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageSetItem */ "b"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_FILTER_PREFERENCES_KEY */ "a"], JSON.stringify(componentFilters)); +} +function getAppendComponentStack() { + try { + const raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_SHOULD_PATCH_CONSOLE_KEY */ "e"]); - case 'symbol': - return truncateForDisplay(data.toString()); + if (raw != null) { + return JSON.parse(raw); + } + } catch (error) {} - case 'react_element': - return `<${truncateForDisplay(getDisplayNameForReactElement(data) || 'Unknown')} />`; + return true; +} +function setAppendComponentStack(value) { + Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageSetItem */ "b"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_SHOULD_PATCH_CONSOLE_KEY */ "e"], JSON.stringify(value)); +} +function getBreakOnConsoleErrors() { + try { + const raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS */ "d"]); - case 'array_buffer': - return `ArrayBuffer(${data.byteLength})`; + if (raw != null) { + return JSON.parse(raw); + } + } catch (error) {} - case 'data_view': - return `DataView(${data.buffer.byteLength})`; + return false; +} +function setBreakOnConsoleErrors(value) { + Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageSetItem */ "b"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS */ "d"], JSON.stringify(value)); +} +function getHideConsoleLogsInStrictMode() { + try { + const raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE */ "b"]); - case 'array': - if (showFormattedValue) { - let formatted = ''; + if (raw != null) { + return JSON.parse(raw); + } + } catch (error) {} - for (let i = 0; i < data.length; i++) { - if (i > 0) { - formatted += ', '; - } + return false; +} +function sethideConsoleLogsInStrictMode(value) { + Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageSetItem */ "b"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_HIDE_CONSOLE_LOGS_IN_STRICT_MODE */ "b"], JSON.stringify(value)); +} +function getShowInlineWarningsAndErrors() { + try { + const raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY */ "f"]); - formatted += formatDataForPreview(data[i], false); + if (raw != null) { + return JSON.parse(raw); + } + } catch (error) {} - if (formatted.length > MAX_PREVIEW_STRING_LENGTH) { - // Prevent doing a lot of unnecessary iteration... - break; - } - } + return true; +} +function setShowInlineWarningsAndErrors(value) { + Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageSetItem */ "b"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY */ "f"], JSON.stringify(value)); +} +function getDefaultOpenInEditorURL() { + return typeof process.env.EDITOR_URL === 'string' ? process.env.EDITOR_URL : ''; +} +function getOpenInEditorURL() { + try { + const raw = Object(_storage__WEBPACK_IMPORTED_MODULE_5__[/* localStorageGetItem */ "a"])(_constants__WEBPACK_IMPORTED_MODULE_3__[/* LOCAL_STORAGE_OPEN_IN_EDITOR_URL */ "c"]); - return `[${truncateForDisplay(formatted)}]`; - } else { - const length = hasOwnProperty.call(data, hydration["b" /* meta */].size) ? data[hydration["b" /* meta */].size] : data.length; - return `Array(${length})`; - } + if (raw != null) { + return JSON.parse(raw); + } + } catch (error) {} - case 'typed_array': - const shortName = `${data.constructor.name}(${data.length})`; + return getDefaultOpenInEditorURL(); +} +function separateDisplayNameAndHOCs(displayName, type) { + if (displayName === null) { + return [null, null]; + } - if (showFormattedValue) { - let formatted = ''; + let hocDisplayNames = null; - for (let i = 0; i < data.length; i++) { - if (i > 0) { - formatted += ', '; - } + switch (type) { + case react_devtools_shared_src_types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeClass */ "e"]: + case react_devtools_shared_src_types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeForwardRef */ "g"]: + case react_devtools_shared_src_types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeFunction */ "h"]: + case react_devtools_shared_src_types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeMemo */ "j"]: + if (displayName.indexOf('(') >= 0) { + const matches = displayName.match(/[^()]+/g); - formatted += data[i]; + if (matches != null) { + displayName = matches.pop(); + hocDisplayNames = matches; + } + } - if (formatted.length > MAX_PREVIEW_STRING_LENGTH) { - // Prevent doing a lot of unnecessary iteration... - break; - } - } + break; - return `${shortName} [${truncateForDisplay(formatted)}]`; - } else { - return shortName; - } + default: + break; + } - case 'iterator': - const name = data.constructor.name; + if (type === react_devtools_shared_src_types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeMemo */ "j"]) { + if (hocDisplayNames === null) { + hocDisplayNames = ['Memo']; + } else { + hocDisplayNames.unshift('Memo'); + } + } else if (type === react_devtools_shared_src_types__WEBPACK_IMPORTED_MODULE_4__[/* ElementTypeForwardRef */ "g"]) { + if (hocDisplayNames === null) { + hocDisplayNames = ['ForwardRef']; + } else { + hocDisplayNames.unshift('ForwardRef'); + } + } - if (showFormattedValue) { + return [displayName, hocDisplayNames]; +} // Pulled from react-compat +// https://github.com/developit/preact-compat/blob/7c5de00e7c85e2ffd011bf3af02899b63f699d3a/src/index.js#L349 + +function shallowDiffers(prev, next) { + for (const attribute in prev) { + if (!(attribute in next)) { + return true; + } + } + + for (const attribute in next) { + if (prev[attribute] !== next[attribute]) { + return true; + } + } + + return false; +} +function getInObject(object, path) { + return path.reduce((reduced, attr) => { + if (reduced) { + if (hasOwnProperty.call(reduced, attr)) { + return reduced[attr]; + } + + if (typeof reduced[Symbol.iterator] === 'function') { + // Convert iterable to array and return array[index] + // // TRICKY // Don't use [...spread] syntax for this purpose. // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values. // Other types (e.g. typed arrays, Sets) will not spread correctly. - const array = Array.from(data); - let formatted = ''; + return Array.from(reduced)[attr]; + } + } - for (let i = 0; i < array.length; i++) { - const entryOrEntries = array[i]; + return null; + }, object); +} +function deletePathInObject(object, path) { + const length = path.length; + const last = path[length - 1]; - if (i > 0) { - formatted += ', '; - } // TRICKY - // Browsers display Maps and Sets differently. - // To mimic their behavior, detect if we've been given an entries tuple. - // Map(2) {"abc" => 123, "def" => 123} - // Set(2) {"abc", 123} + if (object != null) { + const parent = getInObject(object, path.slice(0, length - 1)); + if (parent) { + if (Object(_isArray__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(parent)) { + parent.splice(last, 1); + } else { + delete parent[last]; + } + } + } +} +function renamePathInObject(object, oldPath, newPath) { + const length = oldPath.length; - if (Array.isArray(entryOrEntries)) { - const key = formatDataForPreview(entryOrEntries[0], true); - const value = formatDataForPreview(entryOrEntries[1], false); - formatted += `${key} => ${value}`; - } else { - formatted += formatDataForPreview(entryOrEntries, false); - } + if (object != null) { + const parent = getInObject(object, oldPath.slice(0, length - 1)); - if (formatted.length > MAX_PREVIEW_STRING_LENGTH) { - // Prevent doing a lot of unnecessary iteration... - break; - } - } + if (parent) { + const lastOld = oldPath[length - 1]; + const lastNew = newPath[length - 1]; + parent[lastNew] = parent[lastOld]; - return `${name}(${data.size}) {${truncateForDisplay(formatted)}}`; + if (Object(_isArray__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(parent)) { + parent.splice(lastOld, 1); } else { - return `${name}(${data.size})`; + delete parent[lastOld]; } + } + } +} +function setInObject(object, path, value) { + const length = path.length; + const last = path[length - 1]; - case 'opaque_iterator': - { - return data[Symbol.toStringTag]; - } + if (object != null) { + const parent = getInObject(object, path.slice(0, length - 1)); - case 'date': - return data.toString(); + if (parent) { + parent[last] = value; + } + } +} - case 'object': - if (showFormattedValue) { - const keys = Array.from(getAllEnumerableKeys(data)).sort(alphaSortKeys); - let formatted = ''; +/** + * Get a enhanced/artificial type string based on the object instance + */ +function getDataType(data) { + if (data === null) { + return 'null'; + } else if (data === undefined) { + return 'undefined'; + } - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; + if (Object(react_is__WEBPACK_IMPORTED_MODULE_1__["isElement"])(data)) { + return 'react_element'; + } - if (i > 0) { - formatted += ', '; - } + if (typeof HTMLElement !== 'undefined' && data instanceof HTMLElement) { + return 'html_element'; + } - formatted += `${key.toString()}: ${formatDataForPreview(data[key], false)}`; + const type = typeof data; - if (formatted.length > MAX_PREVIEW_STRING_LENGTH) { - // Prevent doing a lot of unnecessary iteration... - break; - } - } + switch (type) { + case 'bigint': + return 'bigint'; - return `{${truncateForDisplay(formatted)}}`; + case 'boolean': + return 'boolean'; + + case 'function': + return 'function'; + + case 'number': + if (Number.isNaN(data)) { + return 'nan'; + } else if (!Number.isFinite(data)) { + return 'infinity'; } else { - return '{…}'; + return 'number'; } - case 'boolean': - case 'number': - case 'infinity': - case 'nan': - case 'null': - case 'undefined': - return data; + case 'object': + if (Object(_isArray__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(data)) { + return 'array'; + } else if (ArrayBuffer.isView(data)) { + return hasOwnProperty.call(data.constructor, 'BYTES_PER_ELEMENT') ? 'typed_array' : 'data_view'; + } else if (data.constructor && data.constructor.name === 'ArrayBuffer') { + // HACK This ArrayBuffer check is gross; is there a better way? + // We could try to create a new DataView with the value. + // If it doesn't error, we know it's an ArrayBuffer, + // but this seems kind of awkward and expensive. + return 'array_buffer'; + } else if (typeof data[Symbol.iterator] === 'function') { + const iterator = data[Symbol.iterator](); - default: - try { - return truncateForDisplay('' + data); - } catch (error) { - return 'unserializable'; + if (!iterator) {// Proxies might break assumptoins about iterators. + // See github.com/facebook/react/issues/21654 + } else { + return iterator === data ? 'opaque_iterator' : 'iterator'; + } + } else if (data.constructor && data.constructor.name === 'RegExp') { + return 'regexp'; + } else { + const toStringValue = Object.prototype.toString.call(data); + + if (toStringValue === '[object Date]') { + return 'date'; + } else if (toStringValue === '[object HTMLAllCollection]') { + return 'html_all_collection'; + } } - } -} + return 'object'; -/***/ }), -/* 2 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + case 'string': + return 'string'; -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "n", function() { return __DEBUG__; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return TREE_OPERATION_ADD; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return TREE_OPERATION_REMOVE; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return TREE_OPERATION_REORDER_CHILDREN; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "m", function() { return TREE_OPERATION_UPDATE_TREE_BASE_DURATION; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return TREE_OPERATION_REMOVE_ROOT; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LOCAL_STORAGE_FILTER_PREFERENCES_KEY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return SESSION_STORAGE_LAST_SELECTION_KEY; }); -/* unused harmony export LOCAL_STORAGE_PARSE_HOOK_NAMES_KEY */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return SESSION_STORAGE_RELOAD_AND_PROFILE_KEY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return LOCAL_STORAGE_SHOULD_PATCH_CONSOLE_KEY; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY; }); -/* unused harmony export LOCAL_STORAGE_TRACE_UPDATES_ENABLED_KEY */ -/* unused harmony export PROFILER_EXPORT_VERSION */ -/* unused harmony export CHANGE_LOG_URL */ -/* unused harmony export UNSUPPORTED_VERSION_URL */ -/* unused harmony export REACT_DEVTOOLS_WORKPLACE_URL */ -/* unused harmony export THEME_STYLES */ -/* unused harmony export COMFORTABLE_LINE_HEIGHT */ -/* unused harmony export COMPACT_LINE_HEIGHT */ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ -// Flip this flag to true to enable verbose console debug logging. -const __DEBUG__ = false; -const TREE_OPERATION_ADD = 1; -const TREE_OPERATION_REMOVE = 2; -const TREE_OPERATION_REORDER_CHILDREN = 3; -const TREE_OPERATION_UPDATE_TREE_BASE_DURATION = 4; -const TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS = 5; -const TREE_OPERATION_REMOVE_ROOT = 6; -const LOCAL_STORAGE_FILTER_PREFERENCES_KEY = 'React::DevTools::componentFilters'; -const SESSION_STORAGE_LAST_SELECTION_KEY = 'React::DevTools::lastSelection'; -const LOCAL_STORAGE_PARSE_HOOK_NAMES_KEY = 'React::DevTools::parseHookNames'; -const SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY = 'React::DevTools::recordChangeDescriptions'; -const SESSION_STORAGE_RELOAD_AND_PROFILE_KEY = 'React::DevTools::reloadAndProfile'; -const LOCAL_STORAGE_SHOULD_BREAK_ON_CONSOLE_ERRORS = 'React::DevTools::breakOnConsoleErrors'; -const LOCAL_STORAGE_SHOULD_PATCH_CONSOLE_KEY = 'React::DevTools::appendComponentStack'; -const LOCAL_STORAGE_SHOW_INLINE_WARNINGS_AND_ERRORS_KEY = 'React::DevTools::showInlineWarningsAndErrors'; -const LOCAL_STORAGE_TRACE_UPDATES_ENABLED_KEY = 'React::DevTools::traceUpdatesEnabled'; -const PROFILER_EXPORT_VERSION = 5; -const CHANGE_LOG_URL = 'https://github.com/facebook/react/blob/main/packages/react-devtools/CHANGELOG.md'; -const UNSUPPORTED_VERSION_URL = 'https://reactjs.org/blog/2019/08/15/new-react-devtools.html#how-do-i-get-the-old-version-back'; -const REACT_DEVTOOLS_WORKPLACE_URL = 'https://fburl.com/react-devtools-workplace-group'; -const THEME_STYLES = { - light: { - '--color-attribute-name': '#ef6632', - '--color-attribute-name-not-editable': '#23272f', - '--color-attribute-name-inverted': 'rgba(255, 255, 255, 0.7)', - '--color-attribute-value': '#1a1aa6', - '--color-attribute-value-inverted': '#ffffff', - '--color-attribute-editable-value': '#1a1aa6', - '--color-background': '#ffffff', - '--color-background-hover': 'rgba(0, 136, 250, 0.1)', - '--color-background-inactive': '#e5e5e5', - '--color-background-invalid': '#fff0f0', - '--color-background-selected': '#0088fa', - '--color-button-background': '#ffffff', - '--color-button-background-focus': '#ededed', - '--color-button': '#5f6673', - '--color-button-disabled': '#cfd1d5', - '--color-button-active': '#0088fa', - '--color-button-focus': '#23272f', - '--color-button-hover': '#23272f', - '--color-border': '#eeeeee', - '--color-commit-did-not-render-fill': '#cfd1d5', - '--color-commit-did-not-render-fill-text': '#000000', - '--color-commit-did-not-render-pattern': '#cfd1d5', - '--color-commit-did-not-render-pattern-text': '#333333', - '--color-commit-gradient-0': '#37afa9', - '--color-commit-gradient-1': '#63b19e', - '--color-commit-gradient-2': '#80b393', - '--color-commit-gradient-3': '#97b488', - '--color-commit-gradient-4': '#abb67d', - '--color-commit-gradient-5': '#beb771', - '--color-commit-gradient-6': '#cfb965', - '--color-commit-gradient-7': '#dfba57', - '--color-commit-gradient-8': '#efbb49', - '--color-commit-gradient-9': '#febc38', - '--color-commit-gradient-text': '#000000', - '--color-component-name': '#6a51b2', - '--color-component-name-inverted': '#ffffff', - '--color-component-badge-background': 'rgba(0, 0, 0, 0.1)', - '--color-component-badge-background-inverted': 'rgba(255, 255, 255, 0.25)', - '--color-component-badge-count': '#777d88', - '--color-component-badge-count-inverted': 'rgba(255, 255, 255, 0.7)', - '--color-console-error-badge-text': '#ffffff', - '--color-console-error-background': '#fff0f0', - '--color-console-error-border': '#ffd6d6', - '--color-console-error-icon': '#eb3941', - '--color-console-error-text': '#fe2e31', - '--color-console-warning-badge-text': '#000000', - '--color-console-warning-background': '#fffbe5', - '--color-console-warning-border': '#fff5c1', - '--color-console-warning-icon': '#f4bd00', - '--color-console-warning-text': '#64460c', - '--color-context-background': 'rgba(0,0,0,.9)', - '--color-context-background-hover': 'rgba(255, 255, 255, 0.1)', - '--color-context-background-selected': '#178fb9', - '--color-context-border': '#3d424a', - '--color-context-text': '#ffffff', - '--color-context-text-selected': '#ffffff', - '--color-dim': '#777d88', - '--color-dimmer': '#cfd1d5', - '--color-dimmest': '#eff0f1', - '--color-error-background': 'hsl(0, 100%, 97%)', - '--color-error-border': 'hsl(0, 100%, 92%)', - '--color-error-text': '#ff0000', - '--color-expand-collapse-toggle': '#777d88', - '--color-link': '#0000ff', - '--color-modal-background': 'rgba(255, 255, 255, 0.75)', - '--color-bridge-version-npm-background': '#eff0f1', - '--color-bridge-version-npm-text': '#000000', - '--color-bridge-version-number': '#0088fa', - '--color-primitive-hook-badge-background': '#e5e5e5', - '--color-primitive-hook-badge-text': '#5f6673', - '--color-record-active': '#fc3a4b', - '--color-record-hover': '#3578e5', - '--color-record-inactive': '#0088fa', - '--color-resize-bar': '#eeeeee', - '--color-resize-bar-active': '#dcdcdc', - '--color-resize-bar-border': '#d1d1d1', - '--color-resize-bar-dot': '#333333', - '--color-scheduling-profiler-native-event': '#ccc', - '--color-scheduling-profiler-native-event-hover': '#aaa', - '--color-scheduling-profiler-network-primary': '#fcf3dc', - '--color-scheduling-profiler-network-primary-hover': '#f0e7d1', - '--color-scheduling-profiler-network-secondary': '#efc457', - '--color-scheduling-profiler-network-secondary-hover': '#e3ba52', - '--color-scheduling-profiler-priority-background': '#f6f6f6', - '--color-scheduling-profiler-priority-border': '#eeeeee', - '--color-scheduling-profiler-user-timing': '#c9cacd', - '--color-scheduling-profiler-user-timing-hover': '#93959a', - '--color-scheduling-profiler-react-idle': '#d3e5f6', - '--color-scheduling-profiler-react-idle-hover': '#c3d9ef', - '--color-scheduling-profiler-react-render': '#9fc3f3', - '--color-scheduling-profiler-react-render-hover': '#83afe9', - '--color-scheduling-profiler-react-render-text': '#11365e', - '--color-scheduling-profiler-react-commit': '#c88ff0', - '--color-scheduling-profiler-react-commit-hover': '#b281d6', - '--color-scheduling-profiler-react-commit-text': '#3e2c4a', - '--color-scheduling-profiler-react-layout-effects': '#b281d6', - '--color-scheduling-profiler-react-layout-effects-hover': '#9d71bd', - '--color-scheduling-profiler-react-layout-effects-text': '#3e2c4a', - '--color-scheduling-profiler-react-passive-effects': '#b281d6', - '--color-scheduling-profiler-react-passive-effects-hover': '#9d71bd', - '--color-scheduling-profiler-react-passive-effects-text': '#3e2c4a', - '--color-scheduling-profiler-react-schedule': '#9fc3f3', - '--color-scheduling-profiler-react-schedule-hover': '#2683E2', - '--color-scheduling-profiler-react-suspense-rejected': '#f1cc14', - '--color-scheduling-profiler-react-suspense-rejected-hover': '#ffdf37', - '--color-scheduling-profiler-react-suspense-resolved': '#a6e59f', - '--color-scheduling-profiler-react-suspense-resolved-hover': '#89d281', - '--color-scheduling-profiler-react-suspense-unresolved': '#c9cacd', - '--color-scheduling-profiler-react-suspense-unresolved-hover': '#93959a', - '--color-scheduling-profiler-text-color': '#000000', - '--color-scheduling-profiler-text-dim-color': '#ccc', - '--color-scheduling-profiler-react-work-border': '#ffffff', - '--color-search-match': 'yellow', - '--color-search-match-current': '#f7923b', - '--color-selected-tree-highlight-active': 'rgba(0, 136, 250, 0.1)', - '--color-selected-tree-highlight-inactive': 'rgba(0, 0, 0, 0.05)', - '--color-scroll-caret': 'rgba(150, 150, 150, 0.5)', - '--color-tab-selected-border': '#0088fa', - '--color-text': '#000000', - '--color-text-invalid': '#ff0000', - '--color-text-selected': '#ffffff', - '--color-toggle-background-invalid': '#fc3a4b', - '--color-toggle-background-on': '#0088fa', - '--color-toggle-background-off': '#cfd1d5', - '--color-toggle-text': '#ffffff', - '--color-warning-background': '#fb3655', - '--color-warning-background-hover': '#f82042', - '--color-warning-text-color': '#ffffff', - '--color-warning-text-color-inverted': '#fd4d69', - // The styles below should be kept in sync with 'root.css' - // They are repeated there because they're used by e.g. tooltips or context menus - // which get rendered outside of the DOM subtree (where normal theme/styles are written). - '--color-scroll-thumb': '#c2c2c2', - '--color-scroll-track': '#fafafa', - '--color-tooltip-background': 'rgba(0, 0, 0, 0.9)', - '--color-tooltip-text': '#ffffff' - }, - dark: { - '--color-attribute-name': '#9d87d2', - '--color-attribute-name-not-editable': '#ededed', - '--color-attribute-name-inverted': '#282828', - '--color-attribute-value': '#cedae0', - '--color-attribute-value-inverted': '#ffffff', - '--color-attribute-editable-value': 'yellow', - '--color-background': '#282c34', - '--color-background-hover': 'rgba(255, 255, 255, 0.1)', - '--color-background-inactive': '#3d424a', - '--color-background-invalid': '#5c0000', - '--color-background-selected': '#178fb9', - '--color-button-background': '#282c34', - '--color-button-background-focus': '#3d424a', - '--color-button': '#afb3b9', - '--color-button-active': '#61dafb', - '--color-button-disabled': '#4f5766', - '--color-button-focus': '#a2e9fc', - '--color-button-hover': '#ededed', - '--color-border': '#3d424a', - '--color-commit-did-not-render-fill': '#777d88', - '--color-commit-did-not-render-fill-text': '#000000', - '--color-commit-did-not-render-pattern': '#666c77', - '--color-commit-did-not-render-pattern-text': '#ffffff', - '--color-commit-gradient-0': '#37afa9', - '--color-commit-gradient-1': '#63b19e', - '--color-commit-gradient-2': '#80b393', - '--color-commit-gradient-3': '#97b488', - '--color-commit-gradient-4': '#abb67d', - '--color-commit-gradient-5': '#beb771', - '--color-commit-gradient-6': '#cfb965', - '--color-commit-gradient-7': '#dfba57', - '--color-commit-gradient-8': '#efbb49', - '--color-commit-gradient-9': '#febc38', - '--color-commit-gradient-text': '#000000', - '--color-component-name': '#61dafb', - '--color-component-name-inverted': '#282828', - '--color-component-badge-background': 'rgba(255, 255, 255, 0.25)', - '--color-component-badge-background-inverted': 'rgba(0, 0, 0, 0.25)', - '--color-component-badge-count': '#8f949d', - '--color-component-badge-count-inverted': 'rgba(255, 255, 255, 0.7)', - '--color-console-error-badge-text': '#000000', - '--color-console-error-background': '#290000', - '--color-console-error-border': '#5c0000', - '--color-console-error-icon': '#eb3941', - '--color-console-error-text': '#fc7f7f', - '--color-console-warning-badge-text': '#000000', - '--color-console-warning-background': '#332b00', - '--color-console-warning-border': '#665500', - '--color-console-warning-icon': '#f4bd00', - '--color-console-warning-text': '#f5f2ed', - '--color-context-background': 'rgba(255,255,255,.95)', - '--color-context-background-hover': 'rgba(0, 136, 250, 0.1)', - '--color-context-background-selected': '#0088fa', - '--color-context-border': '#eeeeee', - '--color-context-text': '#000000', - '--color-context-text-selected': '#ffffff', - '--color-dim': '#8f949d', - '--color-dimmer': '#777d88', - '--color-dimmest': '#4f5766', - '--color-error-background': '#200', - '--color-error-border': '#900', - '--color-error-text': '#f55', - '--color-expand-collapse-toggle': '#8f949d', - '--color-link': '#61dafb', - '--color-modal-background': 'rgba(0, 0, 0, 0.75)', - '--color-bridge-version-npm-background': 'rgba(0, 0, 0, 0.25)', - '--color-bridge-version-npm-text': '#ffffff', - '--color-bridge-version-number': 'yellow', - '--color-primitive-hook-badge-background': 'rgba(0, 0, 0, 0.25)', - '--color-primitive-hook-badge-text': 'rgba(255, 255, 255, 0.7)', - '--color-record-active': '#fc3a4b', - '--color-record-hover': '#a2e9fc', - '--color-record-inactive': '#61dafb', - '--color-resize-bar': '#282c34', - '--color-resize-bar-active': '#31363f', - '--color-resize-bar-border': '#3d424a', - '--color-resize-bar-dot': '#cfd1d5', - '--color-scheduling-profiler-native-event': '#b2b2b2', - '--color-scheduling-profiler-native-event-hover': '#949494', - '--color-scheduling-profiler-network-primary': '#fcf3dc', - '--color-scheduling-profiler-network-primary-hover': '#e3dbc5', - '--color-scheduling-profiler-network-secondary': '#efc457', - '--color-scheduling-profiler-network-secondary-hover': '#d6af4d', - '--color-scheduling-profiler-priority-background': '#1d2129', - '--color-scheduling-profiler-priority-border': '#282c34', - '--color-scheduling-profiler-user-timing': '#c9cacd', - '--color-scheduling-profiler-user-timing-hover': '#93959a', - '--color-scheduling-profiler-react-idle': '#3d485b', - '--color-scheduling-profiler-react-idle-hover': '#465269', - '--color-scheduling-profiler-react-render': '#2683E2', - '--color-scheduling-profiler-react-render-hover': '#1a76d4', - '--color-scheduling-profiler-react-render-text': '#11365e', - '--color-scheduling-profiler-react-commit': '#731fad', - '--color-scheduling-profiler-react-commit-hover': '#611b94', - '--color-scheduling-profiler-react-commit-text': '#e5c1ff', - '--color-scheduling-profiler-react-layout-effects': '#611b94', - '--color-scheduling-profiler-react-layout-effects-hover': '#51167a', - '--color-scheduling-profiler-react-layout-effects-text': '#e5c1ff', - '--color-scheduling-profiler-react-passive-effects': '#611b94', - '--color-scheduling-profiler-react-passive-effects-hover': '#51167a', - '--color-scheduling-profiler-react-passive-effects-text': '#e5c1ff', - '--color-scheduling-profiler-react-schedule': '#2683E2', - '--color-scheduling-profiler-react-schedule-hover': '#1a76d4', - '--color-scheduling-profiler-react-suspense-rejected': '#f1cc14', - '--color-scheduling-profiler-react-suspense-rejected-hover': '#e4c00f', - '--color-scheduling-profiler-react-suspense-resolved': '#a6e59f', - '--color-scheduling-profiler-react-suspense-resolved-hover': '#89d281', - '--color-scheduling-profiler-react-suspense-unresolved': '#c9cacd', - '--color-scheduling-profiler-react-suspense-unresolved-hover': '#93959a', - '--color-scheduling-profiler-text-color': '#282c34', - '--color-scheduling-profiler-text-dim-color': '#555b66', - '--color-scheduling-profiler-react-work-border': '#ffffff', - '--color-search-match': 'yellow', - '--color-search-match-current': '#f7923b', - '--color-selected-tree-highlight-active': 'rgba(23, 143, 185, 0.15)', - '--color-selected-tree-highlight-inactive': 'rgba(255, 255, 255, 0.05)', - '--color-scroll-caret': '#4f5766', - '--color-shadow': 'rgba(0, 0, 0, 0.5)', - '--color-tab-selected-border': '#178fb9', - '--color-text': '#ffffff', - '--color-text-invalid': '#ff8080', - '--color-text-selected': '#ffffff', - '--color-toggle-background-invalid': '#fc3a4b', - '--color-toggle-background-on': '#178fb9', - '--color-toggle-background-off': '#777d88', - '--color-toggle-text': '#ffffff', - '--color-warning-background': '#ee1638', - '--color-warning-background-hover': '#da1030', - '--color-warning-text-color': '#ffffff', - '--color-warning-text-color-inverted': '#ee1638', - // The styles below should be kept in sync with 'root.css' - // They are repeated there because they're used by e.g. tooltips or context menus - // which get rendered outside of the DOM subtree (where normal theme/styles are written). - '--color-scroll-thumb': '#afb3b9', - '--color-scroll-track': '#313640', - '--color-tooltip-background': 'rgba(255, 255, 255, 0.95)', - '--color-tooltip-text': '#000000' - }, - compact: { - '--font-size-monospace-small': '9px', - '--font-size-monospace-normal': '11px', - '--font-size-monospace-large': '15px', - '--font-size-sans-small': '10px', - '--font-size-sans-normal': '12px', - '--font-size-sans-large': '14px', - '--line-height-data': '18px' - }, - comfortable: { - '--font-size-monospace-small': '10px', - '--font-size-monospace-normal': '13px', - '--font-size-monospace-large': '17px', - '--font-size-sans-small': '12px', - '--font-size-sans-normal': '14px', - '--font-size-sans-large': '16px', - '--line-height-data': '22px' + case 'symbol': + return 'symbol'; + + case 'undefined': + if (Object.prototype.toString.call(data) === '[object HTMLAllCollection]') { + return 'html_all_collection'; + } + + return 'undefined'; + + default: + return 'unknown'; } -}; // HACK +} +function getDisplayNameForReactElement(element) { + const elementType = Object(react_is__WEBPACK_IMPORTED_MODULE_1__["typeOf"])(element); + + switch (elementType) { + case react_is__WEBPACK_IMPORTED_MODULE_1__["ContextConsumer"]: + return 'ContextConsumer'; + + case react_is__WEBPACK_IMPORTED_MODULE_1__["ContextProvider"]: + return 'ContextProvider'; + + case react_is__WEBPACK_IMPORTED_MODULE_1__["ForwardRef"]: + return 'ForwardRef'; + + case react_is__WEBPACK_IMPORTED_MODULE_1__["Fragment"]: + return 'Fragment'; + + case react_is__WEBPACK_IMPORTED_MODULE_1__["Lazy"]: + return 'Lazy'; + + case react_is__WEBPACK_IMPORTED_MODULE_1__["Memo"]: + return 'Memo'; + + case react_is__WEBPACK_IMPORTED_MODULE_1__["Portal"]: + return 'Portal'; + + case react_is__WEBPACK_IMPORTED_MODULE_1__["Profiler"]: + return 'Profiler'; + + case react_is__WEBPACK_IMPORTED_MODULE_1__["StrictMode"]: + return 'StrictMode'; + + case react_is__WEBPACK_IMPORTED_MODULE_1__["Suspense"]: + return 'Suspense'; + + case shared_ReactSymbols__WEBPACK_IMPORTED_MODULE_2__[/* REACT_SUSPENSE_LIST_TYPE */ "a"]: + return 'SuspenseList'; + + case shared_ReactSymbols__WEBPACK_IMPORTED_MODULE_2__[/* REACT_TRACING_MARKER_TYPE */ "b"]: + return 'TracingMarker'; + + default: + const { + type + } = element; + + if (typeof type === 'string') { + return type; + } else if (typeof type === 'function') { + return getDisplayName(type, 'Anonymous'); + } else if (type != null) { + return 'NotImplementedInDevtools'; + } else { + return 'Element'; + } + + } +} +const MAX_PREVIEW_STRING_LENGTH = 50; + +function truncateForDisplay(string, length = MAX_PREVIEW_STRING_LENGTH) { + if (string.length > length) { + return string.substr(0, length) + '…'; + } else { + return string; + } +} // Attempts to mimic Chrome's inline preview for values. +// For example, the following value... +// { +// foo: 123, +// bar: "abc", +// baz: [true, false], +// qux: { ab: 1, cd: 2 } +// }; // -// Sometimes the inline target is rendered before root styles are applied, -// which would result in e.g. NaN itemSize being passed to react-window list. +// Would show a preview of... +// {foo: 123, bar: "abc", baz: Array(2), qux: {…}} +// +// And the following value... +// [ +// 123, +// "abc", +// [true, false], +// { foo: 123, bar: "abc" } +// ]; +// +// Would show a preview of... +// [123, "abc", Array(2), {…}] -const COMFORTABLE_LINE_HEIGHT = parseInt(THEME_STYLES.comfortable['--line-height-data'], 10); -const COMPACT_LINE_HEIGHT = parseInt(THEME_STYLES.compact['--line-height-data'], 10); +function formatDataForPreview(data, showFormattedValue) { + if (data != null && hasOwnProperty.call(data, _hydration__WEBPACK_IMPORTED_MODULE_6__[/* meta */ "b"].type)) { + return showFormattedValue ? data[_hydration__WEBPACK_IMPORTED_MODULE_6__[/* meta */ "b"].preview_long] : data[_hydration__WEBPACK_IMPORTED_MODULE_6__[/* meta */ "b"].preview_short]; + } + + const type = getDataType(data); + + switch (type) { + case 'html_element': + return `<${truncateForDisplay(data.tagName.toLowerCase())} />`; + + case 'function': + return truncateForDisplay(`ƒ ${typeof data.name === 'function' ? '' : data.name}() {}`); + + case 'string': + return `"${data}"`; + + case 'bigint': + return truncateForDisplay(data.toString() + 'n'); + + case 'regexp': + return truncateForDisplay(data.toString()); + + case 'symbol': + return truncateForDisplay(data.toString()); + + case 'react_element': + return `<${truncateForDisplay(getDisplayNameForReactElement(data) || 'Unknown')} />`; + + case 'array_buffer': + return `ArrayBuffer(${data.byteLength})`; + + case 'data_view': + return `DataView(${data.buffer.byteLength})`; + + case 'array': + if (showFormattedValue) { + let formatted = ''; + + for (let i = 0; i < data.length; i++) { + if (i > 0) { + formatted += ', '; + } + + formatted += formatDataForPreview(data[i], false); + + if (formatted.length > MAX_PREVIEW_STRING_LENGTH) { + // Prevent doing a lot of unnecessary iteration... + break; + } + } + + return `[${truncateForDisplay(formatted)}]`; + } else { + const length = hasOwnProperty.call(data, _hydration__WEBPACK_IMPORTED_MODULE_6__[/* meta */ "b"].size) ? data[_hydration__WEBPACK_IMPORTED_MODULE_6__[/* meta */ "b"].size] : data.length; + return `Array(${length})`; + } + + case 'typed_array': + const shortName = `${data.constructor.name}(${data.length})`; + + if (showFormattedValue) { + let formatted = ''; + + for (let i = 0; i < data.length; i++) { + if (i > 0) { + formatted += ', '; + } + + formatted += data[i]; + + if (formatted.length > MAX_PREVIEW_STRING_LENGTH) { + // Prevent doing a lot of unnecessary iteration... + break; + } + } + + return `${shortName} [${truncateForDisplay(formatted)}]`; + } else { + return shortName; + } + + case 'iterator': + const name = data.constructor.name; + + if (showFormattedValue) { + // TRICKY + // Don't use [...spread] syntax for this purpose. + // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values. + // Other types (e.g. typed arrays, Sets) will not spread correctly. + const array = Array.from(data); + let formatted = ''; + + for (let i = 0; i < array.length; i++) { + const entryOrEntries = array[i]; + + if (i > 0) { + formatted += ', '; + } // TRICKY + // Browsers display Maps and Sets differently. + // To mimic their behavior, detect if we've been given an entries tuple. + // Map(2) {"abc" => 123, "def" => 123} + // Set(2) {"abc", 123} + + + if (Object(_isArray__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])(entryOrEntries)) { + const key = formatDataForPreview(entryOrEntries[0], true); + const value = formatDataForPreview(entryOrEntries[1], false); + formatted += `${key} => ${value}`; + } else { + formatted += formatDataForPreview(entryOrEntries, false); + } + + if (formatted.length > MAX_PREVIEW_STRING_LENGTH) { + // Prevent doing a lot of unnecessary iteration... + break; + } + } + + return `${name}(${data.size}) {${truncateForDisplay(formatted)}}`; + } else { + return `${name}(${data.size})`; + } + + case 'opaque_iterator': + { + return data[Symbol.toStringTag]; + } + + case 'date': + return data.toString(); + + case 'object': + if (showFormattedValue) { + const keys = Array.from(getAllEnumerableKeys(data)).sort(alphaSortKeys); + let formatted = ''; + + for (let i = 0; i < keys.length; i++) { + const key = keys[i]; + + if (i > 0) { + formatted += ', '; + } + + formatted += `${key.toString()}: ${formatDataForPreview(data[key], false)}`; + + if (formatted.length > MAX_PREVIEW_STRING_LENGTH) { + // Prevent doing a lot of unnecessary iteration... + break; + } + } + + return `{${truncateForDisplay(formatted)}}`; + } else { + return '{…}'; + } + + case 'boolean': + case 'number': + case 'infinity': + case 'nan': + case 'null': + case 'undefined': + return data; + + default: + try { + return truncateForDisplay(String(data)); + } catch (error) { + return 'unserializable'; + } + + } +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(20))) /***/ }), /* 3 */ @@ -1369,6 +1409,7 @@ const COMPACT_LINE_HEIGHT = parseInt(THEME_STYLES.compact['--line-height-data'], /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CONCURRENT_MODE_SYMBOL_STRING; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CONTEXT_NUMBER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return CONTEXT_SYMBOL_STRING; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return SERVER_CONTEXT_SYMBOL_STRING; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return DEPRECATED_ASYNC_MODE_SYMBOL_STRING; }); /* unused harmony export ELEMENT_NUMBER */ /* unused harmony export ELEMENT_SYMBOL_STRING */ @@ -1382,8 +1423,6 @@ const COMPACT_LINE_HEIGHT = parseInt(THEME_STYLES.compact['--line-height-data'], /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return LAZY_SYMBOL_STRING; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "j", function() { return MEMO_NUMBER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "k", function() { return MEMO_SYMBOL_STRING; }); -/* unused harmony export OPAQUE_ID_NUMBER */ -/* unused harmony export OPAQUE_ID_SYMBOL_STRING */ /* unused harmony export PORTAL_NUMBER */ /* unused harmony export PORTAL_SYMBOL_STRING */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "l", function() { return PROFILER_NUMBER; }); @@ -1392,12 +1431,13 @@ const COMPACT_LINE_HEIGHT = parseInt(THEME_STYLES.compact['--line-height-data'], /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "o", function() { return PROVIDER_SYMBOL_STRING; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "p", function() { return SCOPE_NUMBER; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "q", function() { return SCOPE_SYMBOL_STRING; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "r", function() { return STRICT_MODE_NUMBER; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return STRICT_MODE_SYMBOL_STRING; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return SUSPENSE_NUMBER; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return SUSPENSE_SYMBOL_STRING; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return SUSPENSE_LIST_NUMBER; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return SUSPENSE_LIST_SYMBOL_STRING; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "s", function() { return STRICT_MODE_NUMBER; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "t", function() { return STRICT_MODE_SYMBOL_STRING; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "w", function() { return SUSPENSE_NUMBER; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "x", function() { return SUSPENSE_SYMBOL_STRING; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "u", function() { return SUSPENSE_LIST_NUMBER; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "v", function() { return SUSPENSE_LIST_SYMBOL_STRING; }); +/* unused harmony export SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED_SYMBOL_STRING */ /** * Copyright (c) Facebook, Inc. and its affiliates. * @@ -1415,6 +1455,7 @@ const CONCURRENT_MODE_NUMBER = 0xeacf; const CONCURRENT_MODE_SYMBOL_STRING = 'Symbol(react.concurrent_mode)'; const CONTEXT_NUMBER = 0xeace; const CONTEXT_SYMBOL_STRING = 'Symbol(react.context)'; +const SERVER_CONTEXT_SYMBOL_STRING = 'Symbol(react.server_context)'; const DEPRECATED_ASYNC_MODE_SYMBOL_STRING = 'Symbol(react.async_mode)'; const ELEMENT_NUMBER = 0xeac7; const ELEMENT_SYMBOL_STRING = 'Symbol(react.element)'; @@ -1428,8 +1469,6 @@ const LAZY_NUMBER = 0xead4; const LAZY_SYMBOL_STRING = 'Symbol(react.lazy)'; const MEMO_NUMBER = 0xead3; const MEMO_SYMBOL_STRING = 'Symbol(react.memo)'; -const OPAQUE_ID_NUMBER = 0xeae0; -const OPAQUE_ID_SYMBOL_STRING = 'Symbol(react.opaque.id)'; const PORTAL_NUMBER = 0xeaca; const PORTAL_SYMBOL_STRING = 'Symbol(react.portal)'; const PROFILER_NUMBER = 0xead2; @@ -1444,25 +1483,303 @@ const SUSPENSE_NUMBER = 0xead1; const SUSPENSE_SYMBOL_STRING = 'Symbol(react.suspense)'; const SUSPENSE_LIST_NUMBER = 0xead8; const SUSPENSE_LIST_SYMBOL_STRING = 'Symbol(react.suspense_list)'; +const SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED_SYMBOL_STRING = 'Symbol(react.server_context.defaultValue)'; + +/***/ }), +/* 4 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cleanForBridge; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return copyToClipboard; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return copyWithDelete; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return copyWithRename; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return copyWithSet; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getEffectDurations; }); +/* unused harmony export serializeToString */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return format; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return isSynchronousXHRSupported; }); +/* harmony import */ var clipboard_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21); +/* harmony import */ var clipboard_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(clipboard_js__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _hydration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10); +/* harmony import */ var shared_isArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8); +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ + + + +function cleanForBridge(data, isPathAllowed, path = []) { + if (data !== null) { + const cleanedPaths = []; + const unserializablePaths = []; + const cleanedData = Object(_hydration__WEBPACK_IMPORTED_MODULE_1__[/* dehydrate */ "a"])(data, cleanedPaths, unserializablePaths, path, isPathAllowed); + return { + data: cleanedData, + cleaned: cleanedPaths, + unserializable: unserializablePaths + }; + } else { + return null; + } +} +function copyToClipboard(value) { + const safeToCopy = serializeToString(value); + const text = safeToCopy === undefined ? 'undefined' : safeToCopy; + const { + clipboardCopyText + } = window.__REACT_DEVTOOLS_GLOBAL_HOOK__; // On Firefox navigator.clipboard.writeText has to be called from + // the content script js code (because it requires the clipboardWrite + // permission to be allowed out of a "user handling" callback), + // clipboardCopyText is an helper injected into the page from. + // injectGlobalHook. + + if (typeof clipboardCopyText === 'function') { + clipboardCopyText(text).catch(err => {}); + } else { + Object(clipboard_js__WEBPACK_IMPORTED_MODULE_0__["copy"])(text); + } +} +function copyWithDelete(obj, path, index = 0) { + const key = path[index]; + const updated = Object(shared_isArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(obj) ? obj.slice() : { ...obj + }; + + if (index + 1 === path.length) { + if (Object(shared_isArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(updated)) { + updated.splice(key, 1); + } else { + delete updated[key]; + } + } else { + // $FlowFixMe number or string is fine here + updated[key] = copyWithDelete(obj[key], path, index + 1); + } + + return updated; +} // This function expects paths to be the same except for the final value. +// e.g. ['path', 'to', 'foo'] and ['path', 'to', 'bar'] + +function copyWithRename(obj, oldPath, newPath, index = 0) { + const oldKey = oldPath[index]; + const updated = Object(shared_isArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(obj) ? obj.slice() : { ...obj + }; + + if (index + 1 === oldPath.length) { + const newKey = newPath[index]; // $FlowFixMe number or string is fine here + + updated[newKey] = updated[oldKey]; + + if (Object(shared_isArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(updated)) { + updated.splice(oldKey, 1); + } else { + delete updated[oldKey]; + } + } else { + // $FlowFixMe number or string is fine here + updated[oldKey] = copyWithRename(obj[oldKey], oldPath, newPath, index + 1); + } + + return updated; +} +function copyWithSet(obj, path, value, index = 0) { + if (index >= path.length) { + return value; + } + + const key = path[index]; + const updated = Object(shared_isArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(obj) ? obj.slice() : { ...obj + }; // $FlowFixMe number or string is fine here + + updated[key] = copyWithSet(obj[key], path, value, index + 1); + return updated; +} +function getEffectDurations(root) { + // Profiling durations are only available for certain builds. + // If available, they'll be stored on the HostRoot. + let effectDuration = null; + let passiveEffectDuration = null; + const hostRoot = root.current; + + if (hostRoot != null) { + const stateNode = hostRoot.stateNode; + + if (stateNode != null) { + effectDuration = stateNode.effectDuration != null ? stateNode.effectDuration : null; + passiveEffectDuration = stateNode.passiveEffectDuration != null ? stateNode.passiveEffectDuration : null; + } + } + + return { + effectDuration, + passiveEffectDuration + }; +} +function serializeToString(data) { + const cache = new Set(); // Use a custom replacer function to protect against circular references. + + return JSON.stringify(data, (key, value) => { + if (typeof value === 'object' && value !== null) { + if (cache.has(value)) { + return; + } + + cache.add(value); + } // $FlowFixMe + + + if (typeof value === 'bigint') { + return value.toString() + 'n'; + } + + return value; + }); +} // based on https://github.com/tmpfs/format-util/blob/0e62d430efb0a1c51448709abd3e2406c14d8401/format.js#L1 +// based on https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions +// Implements s, d, i and f placeholders +// NOTE: KEEP IN SYNC with src/hook.js + +function format(maybeMessage, ...inputArgs) { + const args = inputArgs.slice(); + let formatted = String(maybeMessage); // If the first argument is a string, check for substitutions. + + if (typeof maybeMessage === 'string') { + if (args.length) { + const REGEXP = /(%?)(%([jds]))/g; + formatted = formatted.replace(REGEXP, (match, escaped, ptn, flag) => { + let arg = args.shift(); + + switch (flag) { + case 's': + arg += ''; + break; + + case 'd': + case 'i': + arg = parseInt(arg, 10).toString(); + break; + + case 'f': + arg = parseFloat(arg).toString(); + break; + } + + if (!escaped) { + return arg; + } + + args.unshift(arg); + return match; + }); + } + } // Arguments that remain after formatting. + + + if (args.length) { + for (let i = 0; i < args.length; i++) { + formatted += ' ' + String(args[i]); + } + } // Update escaped %% values. + + + formatted = formatted.replace(/%{2,2}/g, '%'); + return String(formatted); +} +function isSynchronousXHRSupported() { + return !!(window.document && window.document.featurePolicy && window.document.featurePolicy.allowsFeature('sync-xhr')); +} + +/***/ }), +/* 5 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return localStorageGetItem; }); +/* unused harmony export localStorageRemoveItem */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return localStorageSetItem; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return sessionStorageGetItem; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return sessionStorageRemoveItem; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return sessionStorageSetItem; }); +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ +function localStorageGetItem(key) { + try { + return localStorage.getItem(key); + } catch (error) { + return null; + } +} +function localStorageRemoveItem(key) { + try { + localStorage.removeItem(key); + } catch (error) {} +} +function localStorageSetItem(key, value) { + try { + return localStorage.setItem(key, value); + } catch (error) {} +} +function sessionStorageGetItem(key) { + try { + return sessionStorage.getItem(key); + } catch (error) { + return null; + } +} +function sessionStorageRemoveItem(key) { + try { + sessionStorage.removeItem(key); + } catch (error) {} +} +function sessionStorageSetItem(key, value) { + try { + return sessionStorage.setItem(key, value); + } catch (error) {} +} + +/***/ }), +/* 6 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ +const isArray = Array.isArray; +/* harmony default export */ __webpack_exports__["a"] = (isArray); /***/ }), -/* 4 */ +/* 7 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +if (true) { + module.exports = __webpack_require__(28); +} else {} + +/***/ }), +/* 8 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return cleanForBridge; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return copyToClipboard; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return copyWithDelete; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return copyWithRename; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return copyWithSet; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return getEffectDurations; }); -/* unused harmony export serializeToString */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return format; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return isSynchronousXHRSupported; }); -/* harmony import */ var clipboard_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(18); -/* harmony import */ var clipboard_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(clipboard_js__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _hydration__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8); -/* harmony import */ var shared_isArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(9); /** * Copyright (c) Facebook, Inc. and its affiliates. * @@ -1471,3586 +1788,4058 @@ const SUSPENSE_LIST_SYMBOL_STRING = 'Symbol(react.suspense_list)'; * * */ +const isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare +function isArray(a) { + return isArrayImpl(a); +} +/* harmony default export */ __webpack_exports__["a"] = (isArray); -function cleanForBridge(data, isPathAllowed, path = []) { - if (data !== null) { - const cleanedPaths = []; - const unserializablePaths = []; - const cleanedData = Object(_hydration__WEBPACK_IMPORTED_MODULE_1__[/* dehydrate */ "a"])(data, cleanedPaths, unserializablePaths, path, isPathAllowed); - return { - data: cleanedData, - cleaned: cleanedPaths, - unserializable: unserializablePaths +/***/ }), +/* 9 */ +/***/ (function(module, exports, __webpack_require__) { + +/* WEBPACK VAR INJECTION */(function(process) {exports = module.exports = SemVer; +var debug; +/* istanbul ignore next */ + +if (typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) { + debug = function () { + var args = Array.prototype.slice.call(arguments, 0); + args.unshift('SEMVER'); + console.log.apply(console, args); + }; +} else { + debug = function () {}; +} // Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. + + +exports.SEMVER_SPEC_VERSION = '2.0.0'; +var MAX_LENGTH = 256; +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || +/* istanbul ignore next */ +9007199254740991; // Max safe segment length for coercion. + +var MAX_SAFE_COMPONENT_LENGTH = 16; // The actual regexps go on exports.re + +var re = exports.re = []; +var src = exports.src = []; +var t = exports.tokens = {}; +var R = 0; + +function tok(n) { + t[n] = R++; +} // The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + + +tok('NUMERICIDENTIFIER'); +src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*'; +tok('NUMERICIDENTIFIERLOOSE'); +src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+'; // ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +tok('NONNUMERICIDENTIFIER'); +src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; // ## Main Version +// Three dot-separated numeric identifiers. + +tok('MAINVERSION'); +src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')'; +tok('MAINVERSIONLOOSE'); +src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')'; // ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +tok('PRERELEASEIDENTIFIER'); +src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + '|' + src[t.NONNUMERICIDENTIFIER] + ')'; +tok('PRERELEASEIDENTIFIERLOOSE'); +src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + '|' + src[t.NONNUMERICIDENTIFIER] + ')'; // ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +tok('PRERELEASE'); +src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))'; +tok('PRERELEASELOOSE'); +src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))'; // ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +tok('BUILDIDENTIFIER'); +src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; // ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +tok('BUILD'); +src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))'; // ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +tok('FULL'); +tok('FULLPLAIN'); +src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + src[t.PRERELEASE] + '?' + src[t.BUILD] + '?'; +src[t.FULL] = '^' + src[t.FULLPLAIN] + '$'; // like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. + +tok('LOOSEPLAIN'); +src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + src[t.PRERELEASELOOSE] + '?' + src[t.BUILD] + '?'; +tok('LOOSE'); +src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$'; +tok('GTLT'); +src[t.GTLT] = '((?:<|>)?=?)'; // Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. + +tok('XRANGEIDENTIFIERLOOSE'); +src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; +tok('XRANGEIDENTIFIER'); +src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*'; +tok('XRANGEPLAIN'); +src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:' + src[t.PRERELEASE] + ')?' + src[t.BUILD] + '?' + ')?)?'; +tok('XRANGEPLAINLOOSE'); +src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[t.PRERELEASELOOSE] + ')?' + src[t.BUILD] + '?' + ')?)?'; +tok('XRANGE'); +src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$'; +tok('XRANGELOOSE'); +src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$'; // Coercion. +// Extract anything that could conceivably be a part of a valid semver + +tok('COERCE'); +src[t.COERCE] = '(^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])'; +tok('COERCERTL'); +re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g'); // Tilde ranges. +// Meaning is "reasonably at or greater than" + +tok('LONETILDE'); +src[t.LONETILDE] = '(?:~>?)'; +tok('TILDETRIM'); +src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+'; +re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g'); +var tildeTrimReplace = '$1~'; +tok('TILDE'); +src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$'; +tok('TILDELOOSE'); +src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$'; // Caret ranges. +// Meaning is "at least and backwards compatible with" + +tok('LONECARET'); +src[t.LONECARET] = '(?:\\^)'; +tok('CARETTRIM'); +src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+'; +re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g'); +var caretTrimReplace = '$1^'; +tok('CARET'); +src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$'; +tok('CARETLOOSE'); +src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$'; // A simple gt/lt/eq thing, or just "" to indicate "any version" + +tok('COMPARATORLOOSE'); +src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$'; +tok('COMPARATOR'); +src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$'; // An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` + +tok('COMPARATORTRIM'); +src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')'; // this one has to use the /g flag + +re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g'); +var comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. + +tok('HYPHENRANGE'); +src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAIN] + ')' + '\\s*$'; +tok('HYPHENRANGELOOSE'); +src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s*$'; // Star ranges basically just allow anything at all. + +tok('STAR'); +src[t.STAR] = '(<|>)?=?\\s*\\*'; // Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. + +for (var i = 0; i < R; i++) { + debug(i, src[i]); + + if (!re[i]) { + re[i] = new RegExp(src[i]); + } +} + +exports.parse = parse; + +function parse(version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false }; - } else { + } + + if (version instanceof SemVer) { + return version; + } + + if (typeof version !== 'string') { + return null; + } + + if (version.length > MAX_LENGTH) { + return null; + } + + var r = options.loose ? re[t.LOOSE] : re[t.FULL]; + + if (!r.test(version)) { + return null; + } + + try { + return new SemVer(version, options); + } catch (er) { return null; } } -function copyToClipboard(value) { - const safeToCopy = serializeToString(value); - const text = safeToCopy === undefined ? 'undefined' : safeToCopy; - const { - clipboardCopyText - } = window.__REACT_DEVTOOLS_GLOBAL_HOOK__; // On Firefox navigator.clipboard.writeText has to be called from - // the content script js code (because it requires the clipboardWrite - // permission to be allowed out of a "user handling" callback), - // clipboardCopyText is an helper injected into the page from. - // injectGlobalHook. - if (typeof clipboardCopyText === 'function') { - clipboardCopyText(text).catch(err => {}); - } else { - Object(clipboard_js__WEBPACK_IMPORTED_MODULE_0__["copy"])(text); - } +exports.valid = valid; + +function valid(version, options) { + var v = parse(version, options); + return v ? v.version : null; } -function copyWithDelete(obj, path, index = 0) { - const key = path[index]; - const updated = Object(shared_isArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(obj) ? obj.slice() : { ...obj - }; - if (index + 1 === path.length) { - if (Object(shared_isArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(updated)) { - updated.splice(key, 1); +exports.clean = clean; + +function clean(version, options) { + var s = parse(version.trim().replace(/^[=v]+/, ''), options); + return s ? s.version : null; +} + +exports.SemVer = SemVer; + +function SemVer(version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } + + if (version instanceof SemVer) { + if (version.loose === options.loose) { + return version; } else { - delete updated[key]; + version = version.version; } - } else { - // $FlowFixMe number or string is fine here - updated[key] = copyWithDelete(obj[key], path, index + 1); + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version); } - return updated; -} // This function expects paths to be the same except for the final value. -// e.g. ['path', 'to', 'foo'] and ['path', 'to', 'bar'] + if (version.length > MAX_LENGTH) { + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters'); + } -function copyWithRename(obj, oldPath, newPath, index = 0) { - const oldKey = oldPath[index]; - const updated = Object(shared_isArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(obj) ? obj.slice() : { ...obj - }; + if (!(this instanceof SemVer)) { + return new SemVer(version, options); + } - if (index + 1 === oldPath.length) { - const newKey = newPath[index]; // $FlowFixMe number or string is fine here + debug('SemVer', version, options); + this.options = options; + this.loose = !!options.loose; + var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); - updated[newKey] = updated[oldKey]; + if (!m) { + throw new TypeError('Invalid Version: ' + version); + } - if (Object(shared_isArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(updated)) { - updated.splice(oldKey, 1); - } else { - delete updated[oldKey]; - } + this.raw = version; // these are actually numbers + + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; + + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version'); + } + + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version'); + } + + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version'); + } // numberify any prerelease numeric ids + + + if (!m[4]) { + this.prerelease = []; } else { - // $FlowFixMe number or string is fine here - updated[oldKey] = copyWithRename(obj[oldKey], oldPath, newPath, index + 1); + this.prerelease = m[4].split('.').map(function (id) { + if (/^[0-9]+$/.test(id)) { + var num = +id; + + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num; + } + } + + return id; + }); } - return updated; + this.build = m[5] ? m[5].split('.') : []; + this.format(); } -function copyWithSet(obj, path, value, index = 0) { - if (index >= path.length) { - return value; + +SemVer.prototype.format = function () { + this.version = this.major + '.' + this.minor + '.' + this.patch; + + if (this.prerelease.length) { + this.version += '-' + this.prerelease.join('.'); } - const key = path[index]; - const updated = Object(shared_isArray__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"])(obj) ? obj.slice() : { ...obj - }; // $FlowFixMe number or string is fine here + return this.version; +}; - updated[key] = copyWithSet(obj[key], path, value, index + 1); - return updated; -} -function getEffectDurations(root) { - // Profiling durations are only available for certain builds. - // If available, they'll be stored on the HostRoot. - let effectDuration = null; - let passiveEffectDuration = null; - const hostRoot = root.current; +SemVer.prototype.toString = function () { + return this.version; +}; - if (hostRoot != null) { - const stateNode = hostRoot.stateNode; +SemVer.prototype.compare = function (other) { + debug('SemVer.compare', this.version, this.options, other); - if (stateNode != null) { - effectDuration = stateNode.effectDuration != null ? stateNode.effectDuration : null; - passiveEffectDuration = stateNode.passiveEffectDuration != null ? stateNode.passiveEffectDuration : null; + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + + return this.compareMain(other) || this.comparePre(other); +}; + +SemVer.prototype.compareMain = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } + + return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch); +}; + +SemVer.prototype.comparePre = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); + } // NOT having a prerelease is > having one + + + if (this.prerelease.length && !other.prerelease.length) { + return -1; + } else if (!this.prerelease.length && other.prerelease.length) { + return 1; + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0; + } + + var i = 0; + + do { + var a = this.prerelease[i]; + var b = other.prerelease[i]; + debug('prerelease compare', i, a, b); + + if (a === undefined && b === undefined) { + return 0; + } else if (b === undefined) { + return 1; + } else if (a === undefined) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); } + } while (++i); +}; + +SemVer.prototype.compareBuild = function (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options); } - return { - effectDuration, - passiveEffectDuration - }; -} -function serializeToString(data) { - const cache = new Set(); // Use a custom replacer function to protect against circular references. + var i = 0; + + do { + var a = this.build[i]; + var b = other.build[i]; + debug('prerelease compare', i, a, b); + + if (a === undefined && b === undefined) { + return 0; + } else if (b === undefined) { + return 1; + } else if (a === undefined) { + return -1; + } else if (a === b) { + continue; + } else { + return compareIdentifiers(a, b); + } + } while (++i); +}; // preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. + + +SemVer.prototype.inc = function (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc('pre', identifier); + break; + + case 'preminor': + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc('pre', identifier); + break; + + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0; + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + // If the input is a non-prerelease version, this acts the same as + // prepatch. - return JSON.stringify(data, (key, value) => { - if (typeof value === 'object' && value !== null) { - if (cache.has(value)) { - return; + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier); } - cache.add(value); - } // $FlowFixMe + this.inc('pre', identifier); + break; + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { + this.major++; + } - if (typeof value === 'bigint') { - return value.toString() + 'n'; - } + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; - return value; - }); -} // based on https://github.com/tmpfs/format-util/blob/0e62d430efb0a1c51448709abd3e2406c14d8401/format.js#L1 -// based on https://developer.mozilla.org/en-US/docs/Web/API/console#Using_string_substitutions -// Implements s, d, i and f placeholders + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++; + } -function format(maybeMessage, ...inputArgs) { - const args = inputArgs.slice(); // Symbols cannot be concatenated with Strings. + this.patch = 0; + this.prerelease = []; + break; - let formatted = typeof maybeMessage === 'symbol' ? maybeMessage.toString() : '' + maybeMessage; // If the first argument is a string, check for substitutions. + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++; + } - if (typeof maybeMessage === 'string') { - if (args.length) { - const REGEXP = /(%?)(%([jds]))/g; - formatted = formatted.replace(REGEXP, (match, escaped, ptn, flag) => { - let arg = args.shift(); + this.prerelease = []; + break; + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. - switch (flag) { - case 's': - arg += ''; - break; + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0]; + } else { + var i = this.prerelease.length; - case 'd': - case 'i': - arg = parseInt(arg, 10).toString(); - break; + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } - case 'f': - arg = parseFloat(arg).toString(); - break; + if (i === -1) { + // didn't increment anything + this.prerelease.push(0); } + } - if (!escaped) { - return arg; + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0]; + } + } else { + this.prerelease = [identifier, 0]; } + } - args.unshift(arg); - return match; - }); - } - } // Arguments that remain after formatting. + break; + default: + throw new Error('invalid increment argument: ' + release); + } - if (args.length) { - for (let i = 0; i < args.length; i++) { - const arg = args[i]; // Symbols cannot be concatenated with Strings. + this.format(); + this.raw = this.version; + return this; +}; - formatted += ' ' + (typeof arg === 'symbol' ? arg.toString() : arg); - } - } // Update escaped %% values. +exports.inc = inc; +function inc(version, release, loose, identifier) { + if (typeof loose === 'string') { + identifier = loose; + loose = undefined; + } - formatted = formatted.replace(/%{2,2}/g, '%'); - return '' + formatted; -} -function isSynchronousXHRSupported() { - return !!(window.document && window.document.featurePolicy && window.document.featurePolicy.allowsFeature('sync-xhr')); + try { + return new SemVer(version, loose).inc(release, identifier).version; + } catch (er) { + return null; + } } -/***/ }), -/* 5 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +exports.diff = diff; -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return localStorageGetItem; }); -/* unused harmony export localStorageRemoveItem */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return localStorageSetItem; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return sessionStorageGetItem; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return sessionStorageRemoveItem; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return sessionStorageSetItem; }); -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ -function localStorageGetItem(key) { - try { - return localStorage.getItem(key); - } catch (error) { +function diff(version1, version2) { + if (eq(version1, version2)) { return null; + } else { + var v1 = parse(version1); + var v2 = parse(version2); + var prefix = ''; + + if (v1.prerelease.length || v2.prerelease.length) { + prefix = 'pre'; + var defaultResult = 'prerelease'; + } + + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key; + } + } + } + + return defaultResult; // may be undefined } } -function localStorageRemoveItem(key) { - try { - localStorage.removeItem(key); - } catch (error) {} -} -function localStorageSetItem(key, value) { - try { - return localStorage.setItem(key, value); - } catch (error) {} -} -function sessionStorageGetItem(key) { - try { - return sessionStorage.getItem(key); - } catch (error) { - return null; + +exports.compareIdentifiers = compareIdentifiers; +var numeric = /^[0-9]+$/; + +function compareIdentifiers(a, b) { + var anum = numeric.test(a); + var bnum = numeric.test(b); + + if (anum && bnum) { + a = +a; + b = +b; } + + return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; } -function sessionStorageRemoveItem(key) { - try { - sessionStorage.removeItem(key); - } catch (error) {} + +exports.rcompareIdentifiers = rcompareIdentifiers; + +function rcompareIdentifiers(a, b) { + return compareIdentifiers(b, a); } -function sessionStorageSetItem(key, value) { - try { - return sessionStorage.setItem(key, value); - } catch (error) {} + +exports.major = major; + +function major(a, loose) { + return new SemVer(a, loose).major; } -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { +exports.minor = minor; -"use strict"; +function minor(a, loose) { + return new SemVer(a, loose).minor; +} +exports.patch = patch; -if (true) { - module.exports = __webpack_require__(25); -} else {} +function patch(a, loose) { + return new SemVer(a, loose).patch; +} -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { +exports.compare = compare; -"use strict"; -/* -object-assign -(c) Sindre Sorhus -@license MIT -*/ +function compare(a, b, loose) { + return new SemVer(a, loose).compare(new SemVer(b, loose)); +} -/* eslint-disable no-unused-vars */ +exports.compareLoose = compareLoose; + +function compareLoose(a, b) { + return compare(a, b, true); +} + +exports.compareBuild = compareBuild; -var getOwnPropertySymbols = Object.getOwnPropertySymbols; -var hasOwnProperty = Object.prototype.hasOwnProperty; -var propIsEnumerable = Object.prototype.propertyIsEnumerable; +function compareBuild(a, b, loose) { + var versionA = new SemVer(a, loose); + var versionB = new SemVer(b, loose); + return versionA.compare(versionB) || versionA.compareBuild(versionB); +} -function toObject(val) { - if (val === null || val === undefined) { - throw new TypeError('Object.assign cannot be called with null or undefined'); - } +exports.rcompare = rcompare; - return Object(val); +function rcompare(a, b, loose) { + return compare(b, a, loose); } -function shouldUseNative() { - try { - if (!Object.assign) { - return false; - } // Detect buggy property enumeration order in older V8 versions. - // https://bugs.chromium.org/p/v8/issues/detail?id=4118 +exports.sort = sort; +function sort(list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(a, b, loose); + }); +} - var test1 = new String('abc'); // eslint-disable-line no-new-wrappers +exports.rsort = rsort; - test1[5] = 'de'; +function rsort(list, loose) { + return list.sort(function (a, b) { + return exports.compareBuild(b, a, loose); + }); +} - if (Object.getOwnPropertyNames(test1)[0] === '5') { - return false; - } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 +exports.gt = gt; +function gt(a, b, loose) { + return compare(a, b, loose) > 0; +} - var test2 = {}; +exports.lt = lt; - for (var i = 0; i < 10; i++) { - test2['_' + String.fromCharCode(i)] = i; - } +function lt(a, b, loose) { + return compare(a, b, loose) < 0; +} - var order2 = Object.getOwnPropertyNames(test2).map(function (n) { - return test2[n]; - }); +exports.eq = eq; - if (order2.join('') !== '0123456789') { - return false; - } // https://bugs.chromium.org/p/v8/issues/detail?id=3056 +function eq(a, b, loose) { + return compare(a, b, loose) === 0; +} +exports.neq = neq; - var test3 = {}; - 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { - test3[letter] = letter; - }); +function neq(a, b, loose) { + return compare(a, b, loose) !== 0; +} - if (Object.keys(Object.assign({}, test3)).join('') !== 'abcdefghijklmnopqrst') { - return false; - } +exports.gte = gte; - return true; - } catch (err) { - // We don't expect any of the above to throw, but better to be safe. - return false; - } +function gte(a, b, loose) { + return compare(a, b, loose) >= 0; } -module.exports = shouldUseNative() ? Object.assign : function (target, source) { - var from; - var to = toObject(target); - var symbols; +exports.lte = lte; - for (var s = 1; s < arguments.length; s++) { - from = Object(arguments[s]); +function lte(a, b, loose) { + return compare(a, b, loose) <= 0; +} - for (var key in from) { - if (hasOwnProperty.call(from, key)) { - to[key] = from[key]; - } - } +exports.cmp = cmp; - if (getOwnPropertySymbols) { - symbols = getOwnPropertySymbols(from); +function cmp(a, op, b, loose) { + switch (op) { + case '===': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + return a === b; - for (var i = 0; i < symbols.length; i++) { - if (propIsEnumerable.call(from, symbols[i])) { - to[symbols[i]] = from[symbols[i]]; - } - } - } - } + case '!==': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + return a !== b; - return to; -}; + case '': + case '=': + case '==': + return eq(a, b, loose); -/***/ }), -/* 8 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + case '!=': + return neq(a, b, loose); -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return meta; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return dehydrate; }); -/* unused harmony export fillInPath */ -/* unused harmony export hydrate */ -/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1); -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ + case '>': + return gt(a, b, loose); -const meta = { - inspectable: Symbol('inspectable'), - inspected: Symbol('inspected'), - name: Symbol('name'), - preview_long: Symbol('preview_long'), - preview_short: Symbol('preview_short'), - readonly: Symbol('readonly'), - size: Symbol('size'), - type: Symbol('type'), - unserializable: Symbol('unserializable') -}; -// This threshold determines the depth at which the bridge "dehydrates" nested data. -// Dehydration means that we don't serialize the data for e.g. postMessage or stringify, -// unless the frontend explicitly requests it (e.g. a user clicks to expand a props object). -// -// Reducing this threshold will improve the speed of initial component inspection, -// but may decrease the responsiveness of expanding objects/arrays to inspect further. -const LEVEL_THRESHOLD = 2; -/** - * Generate the dehydrated metadata for complex object instances - */ + case '>=': + return gte(a, b, loose); -function createDehydrated(type, inspectable, data, cleaned, path) { - cleaned.push(path); - const dehydrated = { - inspectable, - type, - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - name: !data.constructor || data.constructor.name === 'Object' ? '' : data.constructor.name - }; + case '<': + return lt(a, b, loose); - if (type === 'array' || type === 'typed_array') { - dehydrated.size = data.length; - } else if (type === 'object') { - dehydrated.size = Object.keys(data).length; - } + case '<=': + return lte(a, b, loose); - if (type === 'iterator' || type === 'typed_array') { - dehydrated.readonly = true; + default: + throw new TypeError('Invalid operator: ' + op); } - - return dehydrated; } -/** - * Strip out complex data (instances, functions, and data nested > LEVEL_THRESHOLD levels deep). - * The paths of the stripped out objects are appended to the `cleaned` list. - * On the other side of the barrier, the cleaned list is used to "re-hydrate" the cleaned representation into - * an object with symbols as attributes, so that a sanitized object can be distinguished from a normal object. - * - * Input: {"some": {"attr": fn()}, "other": AnInstance} - * Output: { - * "some": { - * "attr": {"name": the fn.name, type: "function"} - * }, - * "other": { - * "name": "AnInstance", - * "type": "object", - * }, - * } - * and cleaned = [["some", "attr"], ["other"]] - */ - - -function dehydrate(data, cleaned, unserializable, path, isPathAllowed, level = 0) { - const type = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getDataType */ "d"])(data); - let isPathAllowedCheck; - - switch (type) { - case 'html_element': - cleaned.push(path); - return { - inspectable: false, - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - name: data.tagName, - type - }; - - case 'function': - cleaned.push(path); - return { - inspectable: false, - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - name: typeof data.name === 'function' || !data.name ? 'function' : data.name, - type - }; - - case 'string': - isPathAllowedCheck = isPathAllowed(path); - - if (isPathAllowedCheck) { - return data; - } else { - return data.length <= 500 ? data : data.slice(0, 500) + '...'; - } - case 'bigint': - cleaned.push(path); - return { - inspectable: false, - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - name: data.toString(), - type - }; +exports.Comparator = Comparator; - case 'symbol': - cleaned.push(path); - return { - inspectable: false, - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - name: data.toString(), - type - }; - // React Elements aren't very inspector-friendly, - // and often contain private fields or circular references. +function Comparator(comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } - case 'react_element': - cleaned.push(path); - return { - inspectable: false, - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - name: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getDisplayNameForReactElement */ "g"])(data) || 'Unknown', - type - }; - // ArrayBuffers error if you try to inspect them. + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp; + } else { + comp = comp.value; + } + } - case 'array_buffer': - case 'data_view': - cleaned.push(path); - return { - inspectable: false, - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - name: type === 'data_view' ? 'DataView' : 'ArrayBuffer', - size: data.byteLength, - type - }; + if (!(this instanceof Comparator)) { + return new Comparator(comp, options); + } - case 'array': - isPathAllowedCheck = isPathAllowed(path); + debug('comparator', comp, options); + this.options = options; + this.loose = !!options.loose; + this.parse(comp); - if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) { - return createDehydrated(type, true, data, cleaned, path); - } + if (this.semver === ANY) { + this.value = ''; + } else { + this.value = this.operator + this.semver.version; + } - return data.map((item, i) => dehydrate(item, cleaned, unserializable, path.concat([i]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1)); + debug('comp', this); +} - case 'html_all_collection': - case 'typed_array': - case 'iterator': - isPathAllowedCheck = isPathAllowed(path); +var ANY = {}; - if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) { - return createDehydrated(type, true, data, cleaned, path); - } else { - const unserializableValue = { - unserializable: true, - type: type, - readonly: true, - size: type === 'typed_array' ? data.length : undefined, - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - name: !data.constructor || data.constructor.name === 'Object' ? '' : data.constructor.name - }; // TRICKY - // Don't use [...spread] syntax for this purpose. - // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values. - // Other types (e.g. typed arrays, Sets) will not spread correctly. +Comparator.prototype.parse = function (comp) { + var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; + var m = comp.match(r); - Array.from(data).forEach((item, i) => unserializableValue[i] = dehydrate(item, cleaned, unserializable, path.concat([i]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1)); - unserializable.push(path); - return unserializableValue; - } + if (!m) { + throw new TypeError('Invalid comparator: ' + comp); + } - case 'opaque_iterator': - cleaned.push(path); - return { - inspectable: false, - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - name: data[Symbol.toStringTag], - type - }; + this.operator = m[1] !== undefined ? m[1] : ''; - case 'date': - cleaned.push(path); - return { - inspectable: false, - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - name: data.toString(), - type - }; + if (this.operator === '=') { + this.operator = ''; + } // if it literally is just '>' or '' then allow anything. - case 'regexp': - cleaned.push(path); - return { - inspectable: false, - preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), - preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), - name: data.toString(), - type - }; - case 'object': - isPathAllowedCheck = isPathAllowed(path); + if (!m[2]) { + this.semver = ANY; + } else { + this.semver = new SemVer(m[2], this.options.loose); + } +}; - if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) { - return createDehydrated(type, true, data, cleaned, path); - } else { - const object = {}; - Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getAllEnumerableKeys */ "c"])(data).forEach(key => { - const name = key.toString(); - object[name] = dehydrate(data[key], cleaned, unserializable, path.concat([name]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1); - }); - return object; - } +Comparator.prototype.toString = function () { + return this.value; +}; - case 'infinity': - case 'nan': - case 'undefined': - // Some values are lossy when sent through a WebSocket. - // We dehydrate+rehydrate them to preserve their type. - cleaned.push(path); - return { - type - }; +Comparator.prototype.test = function (version) { + debug('Comparator.test', version, this.options.loose); - default: - return data; + if (this.semver === ANY || version === ANY) { + return true; } -} -function fillInPath(object, data, path, value) { - const target = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getInObject */ "h"])(object, path); - if (target != null) { - if (!target[meta.unserializable]) { - delete target[meta.inspectable]; - delete target[meta.inspected]; - delete target[meta.name]; - delete target[meta.preview_long]; - delete target[meta.preview_short]; - delete target[meta.readonly]; - delete target[meta.size]; - delete target[meta.type]; + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; } } - if (value !== null && data.unserializable.length > 0) { - const unserializablePath = data.unserializable[0]; - let isMatch = unserializablePath.length === path.length; - - for (let i = 0; i < path.length; i++) { - if (path[i] !== unserializablePath[i]) { - isMatch = false; - break; - } - } + return cmp(version, this.operator, this.semver, this.options); +}; - if (isMatch) { - upgradeUnserializable(value, value); - } +Comparator.prototype.intersects = function (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required'); } - Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* setInObject */ "l"])(object, path, value); -} -function hydrate(object, cleaned, unserializable) { - cleaned.forEach(path => { - const length = path.length; - const last = path[length - 1]; - const parent = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getInObject */ "h"])(object, path.slice(0, length - 1)); - - if (!parent || !parent.hasOwnProperty(last)) { - return; - } + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } - const value = parent[last]; + var rangeTmp; - if (!value) { - return; - } else if (value.type === 'infinity') { - parent[last] = Infinity; - } else if (value.type === 'nan') { - parent[last] = NaN; - } else if (value.type === 'undefined') { - parent[last] = undefined; - } else { - // Replace the string keys with Symbols so they're non-enumerable. - const replaced = {}; - replaced[meta.inspectable] = !!value.inspectable; - replaced[meta.inspected] = false; - replaced[meta.name] = value.name; - replaced[meta.preview_long] = value.preview_long; - replaced[meta.preview_short] = value.preview_short; - replaced[meta.size] = value.size; - replaced[meta.readonly] = !!value.readonly; - replaced[meta.type] = value.type; - parent[last] = replaced; + if (this.operator === '') { + if (this.value === '') { + return true; } - }); - unserializable.forEach(path => { - const length = path.length; - const last = path[length - 1]; - const parent = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getInObject */ "h"])(object, path.slice(0, length - 1)); - if (!parent || !parent.hasOwnProperty(last)) { - return; + rangeTmp = new Range(comp.value, options); + return satisfies(this.value, rangeTmp, options); + } else if (comp.operator === '') { + if (comp.value === '') { + return true; } - const node = parent[last]; - const replacement = { ...node - }; - upgradeUnserializable(replacement, node); - parent[last] = replacement; - }); - return object; -} + rangeTmp = new Range(this.value, options); + return satisfies(comp.semver, rangeTmp, options); + } -function upgradeUnserializable(destination, source) { - Object.defineProperties(destination, { - [meta.inspected]: { - configurable: true, - enumerable: false, - value: !!source.inspected - }, - [meta.name]: { - configurable: true, - enumerable: false, - value: source.name - }, - [meta.preview_long]: { - configurable: true, - enumerable: false, - value: source.preview_long - }, - [meta.preview_short]: { - configurable: true, - enumerable: false, - value: source.preview_short - }, - [meta.size]: { - configurable: true, - enumerable: false, - value: source.size - }, - [meta.readonly]: { - configurable: true, - enumerable: false, - value: !!source.readonly - }, - [meta.type]: { - configurable: true, - enumerable: false, - value: source.type - }, - [meta.unserializable]: { - configurable: true, - enumerable: false, - value: !!source.unserializable + var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>'); + var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<'); + var sameSemVer = this.semver.version === comp.semver.version; + var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<='); + var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<'); + var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>'); + return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; +}; + +exports.Range = Range; + +function Range(range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + }; + } + + if (range instanceof Range) { + if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { + return range; + } else { + return new Range(range.raw, options); } - }); - delete destination.inspected; - delete destination.name; - delete destination.preview_long; - delete destination.preview_short; - delete destination.size; - delete destination.readonly; - delete destination.type; - delete destination.unserializable; -} + } -/***/ }), -/* 9 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + if (range instanceof Comparator) { + return new Range(range.value, options); + } -"use strict"; -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ -const isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare + if (!(this instanceof Range)) { + return new Range(range, options); + } -function isArray(a) { - return isArrayImpl(a); -} + this.options = options; + this.loose = !!options.loose; + this.includePrerelease = !!options.includePrerelease; // First, split based on boolean or || -/* harmony default export */ __webpack_exports__["a"] = (isArray); + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map(function (range) { + return this.parseRange(range.trim()); + }, this).filter(function (c) { + // throw out any that are not relevant for whatever reason + return c.length; + }); -/***/ }), -/* 10 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range); + } -"use strict"; + this.format(); +} -// EXPORTS -__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ registerRenderer; }); -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ patch; }); -__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ unpatch; }); +Range.prototype.format = function () { + this.range = this.set.map(function (comps) { + return comps.join(' ').trim(); + }).join('||').trim(); + return this.range; +}; -// UNUSED EXPORTS: isStringComponentStack, dangerous_setTargetConsoleForTesting +Range.prototype.toString = function () { + return this.range; +}; -// EXTERNAL MODULE: ../react-devtools-shared/src/backend/renderer.js + 2 modules -var backend_renderer = __webpack_require__(14); +Range.prototype.parseRange = function (range) { + var loose = this.options.loose; + range = range.trim(); // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` -// EXTERNAL MODULE: ../react-devtools-shared/src/backend/ReactSymbols.js -var ReactSymbols = __webpack_require__(3); + var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; + range = range.replace(hr, hyphenReplace); + debug('hyphen replace', range); // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` -// CONCATENATED MODULE: ../react-devtools-shared/src/backend/DevToolsConsolePatching.js -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ -// This is a DevTools fork of shared/ConsolePatchingDev. -// The shared console patching code is DEV-only. -// We can't use it since DevTools only ships production builds. -// Helpers to patch console.logs to avoid logging during side-effect free -// replaying on render function. This currently only patches the object -// lazily which won't cover if the log function was extracted eagerly. -// We could also eagerly patch the method. -let disabledDepth = 0; -let prevLog; -let prevInfo; -let prevWarn; -let prevError; -let prevGroup; -let prevGroupCollapsed; -let prevGroupEnd; + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); + debug('comparator trim', range, re[t.COMPARATORTRIM]); // `~ 1.2.3` => `~1.2.3` -function disabledLog() {} + range = range.replace(re[t.TILDETRIM], tildeTrimReplace); // `^ 1.2.3` => `^1.2.3` -disabledLog.__reactDisabledLog = true; -function disableLogs() { - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - prevLog = console.log; - prevInfo = console.info; - prevWarn = console.warn; - prevError = console.error; - prevGroup = console.group; - prevGroupCollapsed = console.groupCollapsed; - prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + range = range.replace(re[t.CARETTRIM], caretTrimReplace); // normalize spaces - const props = { - configurable: true, - enumerable: true, - value: disabledLog, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. + range = range.split(/\s+/).join(' '); // At this point, the range is completely trimmed and + // ready to be split into comparators. - Object.defineProperties(console, { - info: props, - log: props, - warn: props, - error: props, - group: props, - groupCollapsed: props, - groupEnd: props + var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; + var set = range.split(' ').map(function (comp) { + return parseComparator(comp, this.options); + }, this).join(' ').split(/\s+/); + + if (this.options.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function (comp) { + return !!comp.match(compRe); }); - /* eslint-enable react-internal/no-production-logging */ } - disabledDepth++; -} -function reenableLogs() { - disabledDepth--; + set = set.map(function (comp) { + return new Comparator(comp, this.options); + }, this); + return set; +}; - if (disabledDepth === 0) { - /* eslint-disable react-internal/no-production-logging */ - const props = { - configurable: true, - enumerable: true, - writable: true - }; // $FlowFixMe Flow thinks console is immutable. +Range.prototype.intersects = function (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required'); + } - Object.defineProperties(console, { - log: { ...props, - value: prevLog - }, - info: { ...props, - value: prevInfo - }, - warn: { ...props, - value: prevWarn - }, - error: { ...props, - value: prevError - }, - group: { ...props, - value: prevGroup - }, - groupCollapsed: { ...props, - value: prevGroupCollapsed - }, - groupEnd: { ...props, - value: prevGroupEnd - } + return this.set.some(function (thisComparators) { + return isSatisfiable(thisComparators, options) && range.set.some(function (rangeComparators) { + return isSatisfiable(rangeComparators, options) && thisComparators.every(function (thisComparator) { + return rangeComparators.every(function (rangeComparator) { + return thisComparator.intersects(rangeComparator, options); + }); + }); }); - /* eslint-enable react-internal/no-production-logging */ - } + }); +}; // take a set of comparators and determine whether there +// exists a version which can satisfy it - if (disabledDepth < 0) { - console.error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + +function isSatisfiable(comparators, options) { + var result = true; + var remainingComparators = comparators.slice(); + var testComparator = remainingComparators.pop(); + + while (result && remainingComparators.length) { + result = remainingComparators.every(function (otherComparator) { + return testComparator.intersects(otherComparator, options); + }); + testComparator = remainingComparators.pop(); } -} -// CONCATENATED MODULE: ../react-devtools-shared/src/backend/DevToolsComponentStackFrame.js -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ -// This is a DevTools fork of ReactComponentStackFrame. -// This fork enables DevTools to use the same "native" component stack format, -// while still maintaining support for multiple renderer versions -// (which use different values for ReactTypeOfWork). - // The shared console patching code is DEV-only. -// We can't use it since DevTools only ships production builds. + + return result; +} // Mostly just for testing and legacy API reasons + + +exports.toComparators = toComparators; + +function toComparators(range, options) { + return new Range(range, options).set.map(function (comp) { + return comp.map(function (c) { + return c.value; + }).join(' ').trim().split(' '); + }); +} // comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. -let prefix; -function describeBuiltInComponentFrame(name, source, ownerFn) { - if (prefix === undefined) { - // Extract the VM specific prefix used by each line. - try { - throw Error(); - } catch (x) { - const match = x.stack.trim().match(/\n( *(at )?)/); - prefix = match && match[1] || ''; - } - } // We use the prefix to ensure our stacks line up with native stack frames. +function parseComparator(comp, options) { + debug('comp', comp, options); + comp = replaceCarets(comp, options); + debug('caret', comp); + comp = replaceTildes(comp, options); + debug('tildes', comp); + comp = replaceXRanges(comp, options); + debug('xrange', comp); + comp = replaceStars(comp, options); + debug('stars', comp); + return comp; +} +function isX(id) { + return !id || id.toLowerCase() === 'x' || id === '*'; +} // ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 - return '\n' + prefix + name; -} -let reentry = false; -let componentFrameCache; -if (true) { - const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; - componentFrameCache = new PossiblyWeakMap(); +function replaceTildes(comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceTilde(comp, options); + }).join(' '); } -function describeNativeComponentFrame(fn, construct, currentDispatcherRef) { - // If something asked for a stack inside a fake render, it should get ignored. - if (!fn || reentry) { - return ''; - } - - if (true) { - const frame = componentFrameCache.get(fn); +function replaceTilde(comp, options) { + var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]; + return comp.replace(r, function (_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr); + var ret; - if (frame !== undefined) { - return frame; + if (isX(M)) { + ret = ''; + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + } else if (pr) { + debug('replaceTilde pr', pr); + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0'; + } else { + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0'; } - } - - let control; - const previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. - Error.prepareStackTrace = undefined; - reentry = true; // Override the dispatcher so effects scheduled by this shallow render are thrown away. - // - // Note that unlike the code this was forked from (in ReactComponentStackFrame) - // DevTools should override the dispatcher even when DevTools is compiled in production mode, - // because the app itself may be in development mode and log errors/warnings. + debug('tilde return', ret); + return ret; + }); +} // ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 - const previousDispatcher = currentDispatcherRef.current; - currentDispatcherRef.current = null; - disableLogs(); - try { - // This should throw. - if (construct) { - // Something should be setting the props in the constructor. - const Fake = function () { - throw Error(); - }; // $FlowFixMe +function replaceCarets(comp, options) { + return comp.trim().split(/\s+/).map(function (comp) { + return replaceCaret(comp, options); + }).join(' '); +} +function replaceCaret(comp, options) { + debug('caret', comp, options); + var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]; + return comp.replace(r, function (_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr); + var ret; - Object.defineProperty(Fake.prototype, 'props', { - set: function () { - // We use a throwing setter instead of frozen or non-writable props - // because that won't throw in a non-strict mode function. - throw Error(); - } - }); + if (isX(M)) { + ret = ''; + } else if (isX(m)) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + } else if (isX(p)) { + if (M === '0') { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + } else { + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; + } + } else if (pr) { + debug('replaceCaret pr', pr); - if (typeof Reflect === 'object' && Reflect.construct) { - // We construct a different control for this case to include any extra - // frames added by the construct call. - try { - Reflect.construct(Fake, []); - } catch (x) { - control = x; + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1); + } else { + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0'; } - - Reflect.construct(fn, [], Fake); } else { - try { - Fake.call(); - } catch (x) { - control = x; - } - - fn.call(Fake.prototype); + ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0'; } } else { - try { - throw Error(); - } catch (x) { - control = x; - } + debug('no pr'); - fn(); + if (M === '0') { + if (m === '0') { + ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1); + } else { + ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0'; + } + } else { + ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0'; + } } - } catch (sample) { - // This is inlined manually because closure doesn't do it for us. - if (sample && control && typeof sample.stack === 'string') { - // This extracts the first frame from the sample that isn't also in the control. - // Skipping one frame that we assume is the frame that calls the two. - const sampleLines = sample.stack.split('\n'); - const controlLines = control.stack.split('\n'); - let s = sampleLines.length - 1; - let c = controlLines.length - 1; - while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { - // We expect at least one stack frame to be shared. - // Typically this will be the root most one. However, stack frames may be - // cut off due to maximum stack limits. In this case, one maybe cut off - // earlier than the other. We assume that the sample is longer or the same - // and there for cut off earlier. So we should find the root most frame in - // the sample somewhere in the control. - c--; - } + debug('caret return', ret); + return ret; + }); +} - for (; s >= 1 && c >= 0; s--, c--) { - // Next we find the first one that isn't the same which should be the - // frame that called our sample function and the control. - if (sampleLines[s] !== controlLines[c]) { - // In V8, the first line is describing the message but other VMs don't. - // If we're about to return the first line, and the control is also on the same - // line, that's a pretty good indicator that our sample threw at same line as - // the control. I.e. before we entered the sample frame. So we ignore this result. - // This can happen if you passed a class to function component, or non-function. - if (s !== 1 || c !== 1) { - do { - s--; - c--; // We may still have similar intermediate frames from the construct call. - // The next one that isn't the same should be our match though. +function replaceXRanges(comp, options) { + debug('replaceXRanges', comp, options); + return comp.split(/\s+/).map(function (comp) { + return replaceXRange(comp, options); + }).join(' '); +} - if (c < 0 || sampleLines[s] !== controlLines[c]) { - // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. - const frame = '\n' + sampleLines[s].replace(' at new ', ' at '); +function replaceXRange(comp, options) { + comp = comp.trim(); + var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; + return comp.replace(r, function (ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr); + var xM = isX(M); + var xm = xM || isX(m); + var xp = xm || isX(p); + var anyX = xp; - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, frame); - } - } // Return the line we found. + if (gtlt === '=' && anyX) { + gtlt = ''; + } // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + + + pr = options.includePrerelease ? '-0' : ''; + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0'; + } else { + // nothing is forbidden + ret = '*'; + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0; + } + p = 0; + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>='; - return frame; - } - } while (s >= 1 && c >= 0); - } + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else { + m = +m + 1; + p = 0; + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<'; - break; + if (xm) { + M = +M + 1; + } else { + m = +m + 1; } } + + ret = gtlt + M + '.' + m + '.' + p + pr; + } else if (xm) { + ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr; + } else if (xp) { + ret = '>=' + M + '.' + m + '.0' + pr + ' <' + M + '.' + (+m + 1) + '.0' + pr; } - } finally { - reentry = false; - Error.prepareStackTrace = previousPrepareStackTrace; - currentDispatcherRef.current = previousDispatcher; - reenableLogs(); - } // Fallback to just using the name if we couldn't make it throw. + debug('xRange return', ret); + return ret; + }); +} // Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. - const name = fn ? fn.displayName || fn.name : ''; - const syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; - if (true) { - if (typeof fn === 'function') { - componentFrameCache.set(fn, syntheticFrame); - } +function replaceStars(comp, options) { + debug('replaceStars', comp, options); // Looseness is ignored here. star is always as loose as it gets! + + return comp.trim().replace(re[t.STAR], ''); +} // This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 + + +function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) { + if (isX(fM)) { + from = ''; + } else if (isX(fm)) { + from = '>=' + fM + '.0.0'; + } else if (isX(fp)) { + from = '>=' + fM + '.' + fm + '.0'; + } else { + from = '>=' + from; } - return syntheticFrame; -} -function describeClassComponentFrame(ctor, source, ownerFn, currentDispatcherRef) { - return describeNativeComponentFrame(ctor, true, currentDispatcherRef); -} -function describeFunctionComponentFrame(fn, source, ownerFn, currentDispatcherRef) { - return describeNativeComponentFrame(fn, false, currentDispatcherRef); -} + if (isX(tM)) { + to = ''; + } else if (isX(tm)) { + to = '<' + (+tM + 1) + '.0.0'; + } else if (isX(tp)) { + to = '<' + tM + '.' + (+tm + 1) + '.0'; + } else if (tpr) { + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; + } else { + to = '<=' + to; + } -function shouldConstruct(Component) { - const prototype = Component.prototype; - return !!(prototype && prototype.isReactComponent); -} + return (from + ' ' + to).trim(); +} // if ANY of the sets match ALL of its comparators, then pass -function describeUnknownElementTypeFrameInDEV(type, source, ownerFn, currentDispatcherRef) { - if (false) {} - if (type == null) { - return ''; +Range.prototype.test = function (version) { + if (!version) { + return false; } - if (typeof type === 'function') { - return describeNativeComponentFrame(type, shouldConstruct(type), currentDispatcherRef); + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options); + } catch (er) { + return false; + } } - if (typeof type === 'string') { - return describeBuiltInComponentFrame(type, source, ownerFn); + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true; + } } - switch (type) { - case ReactSymbols["v" /* SUSPENSE_NUMBER */]: - case ReactSymbols["w" /* SUSPENSE_SYMBOL_STRING */]: - return describeBuiltInComponentFrame('Suspense', source, ownerFn); + return false; +}; - case ReactSymbols["t" /* SUSPENSE_LIST_NUMBER */]: - case ReactSymbols["u" /* SUSPENSE_LIST_SYMBOL_STRING */]: - return describeBuiltInComponentFrame('SuspenseList', source, ownerFn); +function testSet(set, version, options) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false; + } } - if (typeof type === 'object') { - switch (type.$$typeof) { - case ReactSymbols["f" /* FORWARD_REF_NUMBER */]: - case ReactSymbols["g" /* FORWARD_REF_SYMBOL_STRING */]: - return describeFunctionComponentFrame(type.render, source, ownerFn, currentDispatcherRef); + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (i = 0; i < set.length; i++) { + debug(set[i].semver); - case ReactSymbols["j" /* MEMO_NUMBER */]: - case ReactSymbols["k" /* MEMO_SYMBOL_STRING */]: - // Memo may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn, currentDispatcherRef); + if (set[i].semver === ANY) { + continue; + } - case ReactSymbols["h" /* LAZY_NUMBER */]: - case ReactSymbols["i" /* LAZY_SYMBOL_STRING */]: - { - const lazyComponent = type; - const payload = lazyComponent._payload; - const init = lazyComponent._init; + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver; - try { - // Lazy may contain any component type so we recursively resolve it. - return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn, currentDispatcherRef); - } catch (x) {} + if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { + return true; } - } + } + } // Version has a -pre, but it's not one of the ones we like. + + + return false; } - return ''; + return true; } -// CONCATENATED MODULE: ../react-devtools-shared/src/backend/DevToolsFiberComponentStack.js -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ -// This is a DevTools fork of ReactFiberComponentStack. -// This fork enables DevTools to use the same "native" component stack format, -// while still maintaining support for multiple renderer versions -// (which use different values for ReactTypeOfWork). +exports.satisfies = satisfies; -function describeFiber(workTagMap, workInProgress, currentDispatcherRef) { - const { - HostComponent, - LazyComponent, - SuspenseComponent, - SuspenseListComponent, - FunctionComponent, - IndeterminateComponent, - SimpleMemoComponent, - ForwardRef, - ClassComponent - } = workTagMap; - const owner = true ? workInProgress._debugOwner ? workInProgress._debugOwner.type : null : undefined; - const source = true ? workInProgress._debugSource : undefined; +function satisfies(version, range, options) { + try { + range = new Range(range, options); + } catch (er) { + return false; + } - switch (workInProgress.tag) { - case HostComponent: - return describeBuiltInComponentFrame(workInProgress.type, source, owner); + return range.test(version); +} - case LazyComponent: - return describeBuiltInComponentFrame('Lazy', source, owner); +exports.maxSatisfying = maxSatisfying; - case SuspenseComponent: - return describeBuiltInComponentFrame('Suspense', source, owner); +function maxSatisfying(versions, range, options) { + var max = null; + var maxSV = null; - case SuspenseListComponent: - return describeBuiltInComponentFrame('SuspenseList', source, owner); + try { + var rangeObj = new Range(range, options); + } catch (er) { + return null; + } - case FunctionComponent: - case IndeterminateComponent: - case SimpleMemoComponent: - return describeFunctionComponentFrame(workInProgress.type, source, owner, currentDispatcherRef); + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v; + maxSV = new SemVer(max, options); + } + } + }); + return max; +} - case ForwardRef: - return describeFunctionComponentFrame(workInProgress.type.render, source, owner, currentDispatcherRef); +exports.minSatisfying = minSatisfying; - case ClassComponent: - return describeClassComponentFrame(workInProgress.type, source, owner, currentDispatcherRef); +function minSatisfying(versions, range, options) { + var min = null; + var minSV = null; - default: - return ''; + try { + var rangeObj = new Range(range, options); + } catch (er) { + return null; } + + versions.forEach(function (v) { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v; + minSV = new SemVer(min, options); + } + } + }); + return min; } -function getStackByFiberInDevAndProd(workTagMap, workInProgress, currentDispatcherRef) { - try { - let info = ''; - let node = workInProgress; +exports.minVersion = minVersion; - do { - info += describeFiber(workTagMap, node, currentDispatcherRef); - node = node.return; - } while (node); +function minVersion(range, loose) { + range = new Range(range, loose); + var minver = new SemVer('0.0.0'); - return info; - } catch (x) { - return '\nError generating stack: ' + x.message + '\n' + x.stack; + if (range.test(minver)) { + return minver; } -} -// CONCATENATED MODULE: ../react-devtools-shared/src/backend/console.js -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ + minver = new SemVer('0.0.0-0'); -const APPEND_STACK_TO_METHODS = ['error', 'trace', 'warn']; // React's custom built component stack strings match "\s{4}in" -// Chrome's prefix matches "\s{4}at" + if (range.test(minver)) { + return minver; + } -const PREFIX_REGEX = /\s{4}(in|at)\s{1}/; // Firefox and Safari have no prefix ("") -// but we can fallback to looking for location info (e.g. "foo.js:12:345") + minver = null; -const ROW_COLUMN_NUMBER_REGEX = /:\d+:\d+(\n|$)/; -function isStringComponentStack(text) { - return PREFIX_REGEX.test(text) || ROW_COLUMN_NUMBER_REGEX.test(text); -} -const injectedRenderers = new Map(); -let targetConsole = console; -let targetConsoleMethods = {}; + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; + comparators.forEach(function (comparator) { + // Clone to avoid manipulating the comparator's semver object. + var compver = new SemVer(comparator.semver.version); -for (const method in console) { - targetConsoleMethods[method] = console[method]; -} + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++; + } else { + compver.prerelease.push(0); + } -let unpatchFn = null; // Enables e.g. Jest tests to inject a mock console object. + compver.raw = compver.format(); -function dangerous_setTargetConsoleForTesting(targetConsoleForTesting) { - targetConsole = targetConsoleForTesting; - targetConsoleMethods = {}; + /* fallthrough */ - for (const method in targetConsole) { - targetConsoleMethods[method] = console[method]; - } -} // v16 renderers should use this method to inject internals necessary to generate a component stack. -// These internals will be used if the console is patched. -// Injecting them separately allows the console to easily be patched or un-patched later (at runtime). + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver; + } -function registerRenderer(renderer, onErrorOrWarning) { - const { - currentDispatcherRef, - getCurrentFiber, - findFiberByHostInstance, - version - } = renderer; // Ignore React v15 and older because they don't expose a component stack anyway. + break; - if (typeof findFiberByHostInstance !== 'function') { - return; - } // currentDispatcherRef gets injected for v16.8+ to support hooks inspection. - // getCurrentFiber gets injected for v16.9+. + case '<': + case '<=': + /* Ignore maximum versions */ + break; + /* istanbul ignore next */ - if (currentDispatcherRef != null && typeof getCurrentFiber === 'function') { - const { - ReactTypeOfWork - } = Object(backend_renderer["b" /* getInternalReactConstants */])(version); - injectedRenderers.set(renderer, { - currentDispatcherRef, - getCurrentFiber, - workTagMap: ReactTypeOfWork, - onErrorOrWarning + default: + throw new Error('Unexpected operation: ' + comparator.operator); + } }); } + + if (minver && range.test(minver)) { + return minver; + } + + return null; } -const consoleSettingsRef = { - appendComponentStack: false, - breakOnConsoleErrors: false, - showInlineWarningsAndErrors: false -}; // Patches console methods to append component stack for the current fiber. -// Call unpatch() to remove the injected behavior. -function patch({ - appendComponentStack, - breakOnConsoleErrors, - showInlineWarningsAndErrors -}) { - // Settings may change after we've patched the console. - // Using a shared ref allows the patch function to read the latest values. - consoleSettingsRef.appendComponentStack = appendComponentStack; - consoleSettingsRef.breakOnConsoleErrors = breakOnConsoleErrors; - consoleSettingsRef.showInlineWarningsAndErrors = showInlineWarningsAndErrors; +exports.validRange = validRange; - if (unpatchFn !== null) { - // Don't patch twice. - return; +function validRange(range, options) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*'; + } catch (er) { + return null; } +} // Determine if version is less than all the versions possible in the range - const originalConsoleMethods = {}; - unpatchFn = () => { - for (const method in originalConsoleMethods) { - try { - // $FlowFixMe property error|warn is not writable. - targetConsole[method] = originalConsoleMethods[method]; - } catch (error) {} - } - }; +exports.ltr = ltr; - APPEND_STACK_TO_METHODS.forEach(method => { - try { - const originalMethod = originalConsoleMethods[method] = targetConsole[method]; +function ltr(version, range, options) { + return outside(version, range, '<', options); +} // Determine if version is greater than all the versions possible in the range. - const overrideMethod = (...args) => { - let shouldAppendWarningStack = false; - if (consoleSettingsRef.appendComponentStack) { - const lastArg = args.length > 0 ? args[args.length - 1] : null; - const alreadyHasComponentStack = typeof lastArg === 'string' && isStringComponentStack(lastArg); // If we are ever called with a string that already has a component stack, - // e.g. a React error/warning, don't append a second stack. +exports.gtr = gtr; - shouldAppendWarningStack = !alreadyHasComponentStack; - } +function gtr(version, range, options) { + return outside(version, range, '>', options); +} - const shouldShowInlineWarningsAndErrors = consoleSettingsRef.showInlineWarningsAndErrors && (method === 'error' || method === 'warn'); +exports.outside = outside; - if (shouldAppendWarningStack || shouldShowInlineWarningsAndErrors) { - // Search for the first renderer that has a current Fiber. - // We don't handle the edge case of stacks for more than one (e.g. interleaved renderers?) - // eslint-disable-next-line no-for-of-loops/no-for-of-loops - for (const { - currentDispatcherRef, - getCurrentFiber, - onErrorOrWarning, - workTagMap - } of injectedRenderers.values()) { - const current = getCurrentFiber(); +function outside(version, range, hilo, options) { + version = new SemVer(version, options); + range = new Range(range, options); + var gtfn, ltefn, ltfn, comp, ecomp; - if (current != null) { - try { - if (shouldShowInlineWarningsAndErrors) { - // patch() is called by two places: (1) the hook and (2) the renderer backend. - // The backend is what implements a message queue, so it's the only one that injects onErrorOrWarning. - if (typeof onErrorOrWarning === 'function') { - onErrorOrWarning(current, method, // Copy args before we mutate them (e.g. adding the component stack) - args.slice()); - } - } + switch (hilo) { + case '>': + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = '>'; + ecomp = '>='; + break; - if (shouldAppendWarningStack) { - const componentStack = getStackByFiberInDevAndProd(workTagMap, current, currentDispatcherRef); + case '<': + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = '<'; + ecomp = '<='; + break; - if (componentStack !== '') { - args.push(componentStack); - } - } - } catch (error) {// Don't let a DevTools or React internal error interfere with logging. - } finally { - break; - } - } - } - } + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); + } // If it satisifes the range it is not outside - if (consoleSettingsRef.breakOnConsoleErrors) { - // --- Welcome to debugging with React DevTools --- - // This debugger statement means that you've enabled the "break on warnings" feature. - // Use the browser's Call Stack panel to step out of this override function- - // to where the original warning or error was logged. - // eslint-disable-next-line no-debugger - debugger; - } - originalMethod(...args); - }; + if (satisfies(version, range, options)) { + return false; + } // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. - overrideMethod.__REACT_DEVTOOLS_ORIGINAL_METHOD__ = originalMethod; - originalMethod.__REACT_DEVTOOLS_OVERRIDE_METHOD__ = overrideMethod; // $FlowFixMe property error|warn is not writable. - targetConsole[method] = overrideMethod; - } catch (error) {} - }); -} // Removed component stack patch from console methods. + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; + var high = null; + var low = null; + comparators.forEach(function (comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0'); + } -function unpatch() { - if (unpatchFn !== null) { - unpatchFn(); - unpatchFn = null; + high = high || comparator; + low = low || comparator; + + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator; + } + }); // If the edge version comparator has a operator then our version + // isn't outside it + + if (high.operator === comp || high.operator === ecomp) { + return false; + } // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + + + if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } } + + return true; +} + +exports.prerelease = prerelease; + +function prerelease(version, options) { + var parsed = parse(version, options); + return parsed && parsed.prerelease.length ? parsed.prerelease : null; } -/***/ }), -/* 11 */ -/***/ (function(module, exports, __webpack_require__) { +exports.intersects = intersects; + +function intersects(r1, r2, options) { + r1 = new Range(r1, options); + r2 = new Range(r2, options); + return r1.intersects(r2); +} -/* WEBPACK VAR INJECTION */(function(process) {exports = module.exports = SemVer; -var debug; -/* istanbul ignore next */ +exports.coerce = coerce; -if (typeof process === 'object' && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG)) { - debug = function () { - var args = Array.prototype.slice.call(arguments, 0); - args.unshift('SEMVER'); - console.log.apply(console, args); - }; -} else { - debug = function () {}; -} // Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. +function coerce(version, options) { + if (version instanceof SemVer) { + return version; + } + if (typeof version === 'number') { + version = String(version); + } -exports.SEMVER_SPEC_VERSION = '2.0.0'; -var MAX_LENGTH = 256; -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || -/* istanbul ignore next */ -9007199254740991; // Max safe segment length for coercion. + if (typeof version !== 'string') { + return null; + } -var MAX_SAFE_COMPONENT_LENGTH = 16; // The actual regexps go on exports.re + options = options || {}; + var match = null; -var re = exports.re = []; -var src = exports.src = []; -var t = exports.tokens = {}; -var R = 0; + if (!options.rtl) { + match = version.match(re[t.COERCE]); + } else { + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + var next; -function tok(n) { - t[n] = R++; -} // The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. + while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) { + if (!match || next.index + next[0].length !== match.index + match[0].length) { + match = next; + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length; + } // leave it in a clean state -tok('NUMERICIDENTIFIER'); -src[t.NUMERICIDENTIFIER] = '0|[1-9]\\d*'; -tok('NUMERICIDENTIFIERLOOSE'); -src[t.NUMERICIDENTIFIERLOOSE] = '[0-9]+'; // ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. -tok('NONNUMERICIDENTIFIER'); -src[t.NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; // ## Main Version -// Three dot-separated numeric identifiers. + re[t.COERCERTL].lastIndex = -1; + } -tok('MAINVERSION'); -src[t.MAINVERSION] = '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')\\.' + '(' + src[t.NUMERICIDENTIFIER] + ')'; -tok('MAINVERSIONLOOSE'); -src[t.MAINVERSIONLOOSE] = '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')\\.' + '(' + src[t.NUMERICIDENTIFIERLOOSE] + ')'; // ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. + if (match === null) { + return null; + } -tok('PRERELEASEIDENTIFIER'); -src[t.PRERELEASEIDENTIFIER] = '(?:' + src[t.NUMERICIDENTIFIER] + '|' + src[t.NONNUMERICIDENTIFIER] + ')'; -tok('PRERELEASEIDENTIFIERLOOSE'); -src[t.PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[t.NUMERICIDENTIFIERLOOSE] + '|' + src[t.NONNUMERICIDENTIFIER] + ')'; // ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. + return parse(match[2] + '.' + (match[3] || '0') + '.' + (match[4] || '0'), options); +} +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(20))) -tok('PRERELEASE'); -src[t.PRERELEASE] = '(?:-(' + src[t.PRERELEASEIDENTIFIER] + '(?:\\.' + src[t.PRERELEASEIDENTIFIER] + ')*))'; -tok('PRERELEASELOOSE'); -src[t.PRERELEASELOOSE] = '(?:-?(' + src[t.PRERELEASEIDENTIFIERLOOSE] + '(?:\\.' + src[t.PRERELEASEIDENTIFIERLOOSE] + ')*))'; // ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. +/***/ }), +/* 10 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { -tok('BUILDIDENTIFIER'); -src[t.BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; // ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return meta; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return dehydrate; }); +/* unused harmony export fillInPath */ +/* unused harmony export hydrate */ +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ -tok('BUILD'); -src[t.BUILD] = '(?:\\+(' + src[t.BUILDIDENTIFIER] + '(?:\\.' + src[t.BUILDIDENTIFIER] + ')*))'; // ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. +const meta = { + inspectable: Symbol('inspectable'), + inspected: Symbol('inspected'), + name: Symbol('name'), + preview_long: Symbol('preview_long'), + preview_short: Symbol('preview_short'), + readonly: Symbol('readonly'), + size: Symbol('size'), + type: Symbol('type'), + unserializable: Symbol('unserializable') +}; +// This threshold determines the depth at which the bridge "dehydrates" nested data. +// Dehydration means that we don't serialize the data for e.g. postMessage or stringify, +// unless the frontend explicitly requests it (e.g. a user clicks to expand a props object). +// +// Reducing this threshold will improve the speed of initial component inspection, +// but may decrease the responsiveness of expanding objects/arrays to inspect further. +const LEVEL_THRESHOLD = 2; +/** + * Generate the dehydrated metadata for complex object instances + */ -tok('FULL'); -tok('FULLPLAIN'); -src[t.FULLPLAIN] = 'v?' + src[t.MAINVERSION] + src[t.PRERELEASE] + '?' + src[t.BUILD] + '?'; -src[t.FULL] = '^' + src[t.FULLPLAIN] + '$'; // like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. +function createDehydrated(type, inspectable, data, cleaned, path) { + cleaned.push(path); + const dehydrated = { + inspectable, + type, + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + name: !data.constructor || data.constructor.name === 'Object' ? '' : data.constructor.name + }; -tok('LOOSEPLAIN'); -src[t.LOOSEPLAIN] = '[v=\\s]*' + src[t.MAINVERSIONLOOSE] + src[t.PRERELEASELOOSE] + '?' + src[t.BUILD] + '?'; -tok('LOOSE'); -src[t.LOOSE] = '^' + src[t.LOOSEPLAIN] + '$'; -tok('GTLT'); -src[t.GTLT] = '((?:<|>)?=?)'; // Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. + if (type === 'array' || type === 'typed_array') { + dehydrated.size = data.length; + } else if (type === 'object') { + dehydrated.size = Object.keys(data).length; + } -tok('XRANGEIDENTIFIERLOOSE'); -src[t.XRANGEIDENTIFIERLOOSE] = src[t.NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; -tok('XRANGEIDENTIFIER'); -src[t.XRANGEIDENTIFIER] = src[t.NUMERICIDENTIFIER] + '|x|X|\\*'; -tok('XRANGEPLAIN'); -src[t.XRANGEPLAIN] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIER] + ')' + '(?:' + src[t.PRERELEASE] + ')?' + src[t.BUILD] + '?' + ')?)?'; -tok('XRANGEPLAINLOOSE'); -src[t.XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:\\.(' + src[t.XRANGEIDENTIFIERLOOSE] + ')' + '(?:' + src[t.PRERELEASELOOSE] + ')?' + src[t.BUILD] + '?' + ')?)?'; -tok('XRANGE'); -src[t.XRANGE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAIN] + '$'; -tok('XRANGELOOSE'); -src[t.XRANGELOOSE] = '^' + src[t.GTLT] + '\\s*' + src[t.XRANGEPLAINLOOSE] + '$'; // Coercion. -// Extract anything that could conceivably be a part of a valid semver + if (type === 'iterator' || type === 'typed_array') { + dehydrated.readonly = true; + } -tok('COERCE'); -src[t.COERCE] = '(^|[^\\d])' + '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + '(?:$|[^\\d])'; -tok('COERCERTL'); -re[t.COERCERTL] = new RegExp(src[t.COERCE], 'g'); // Tilde ranges. -// Meaning is "reasonably at or greater than" + return dehydrated; +} +/** + * Strip out complex data (instances, functions, and data nested > LEVEL_THRESHOLD levels deep). + * The paths of the stripped out objects are appended to the `cleaned` list. + * On the other side of the barrier, the cleaned list is used to "re-hydrate" the cleaned representation into + * an object with symbols as attributes, so that a sanitized object can be distinguished from a normal object. + * + * Input: {"some": {"attr": fn()}, "other": AnInstance} + * Output: { + * "some": { + * "attr": {"name": the fn.name, type: "function"} + * }, + * "other": { + * "name": "AnInstance", + * "type": "object", + * }, + * } + * and cleaned = [["some", "attr"], ["other"]] + */ -tok('LONETILDE'); -src[t.LONETILDE] = '(?:~>?)'; -tok('TILDETRIM'); -src[t.TILDETRIM] = '(\\s*)' + src[t.LONETILDE] + '\\s+'; -re[t.TILDETRIM] = new RegExp(src[t.TILDETRIM], 'g'); -var tildeTrimReplace = '$1~'; -tok('TILDE'); -src[t.TILDE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAIN] + '$'; -tok('TILDELOOSE'); -src[t.TILDELOOSE] = '^' + src[t.LONETILDE] + src[t.XRANGEPLAINLOOSE] + '$'; // Caret ranges. -// Meaning is "at least and backwards compatible with" -tok('LONECARET'); -src[t.LONECARET] = '(?:\\^)'; -tok('CARETTRIM'); -src[t.CARETTRIM] = '(\\s*)' + src[t.LONECARET] + '\\s+'; -re[t.CARETTRIM] = new RegExp(src[t.CARETTRIM], 'g'); -var caretTrimReplace = '$1^'; -tok('CARET'); -src[t.CARET] = '^' + src[t.LONECARET] + src[t.XRANGEPLAIN] + '$'; -tok('CARETLOOSE'); -src[t.CARETLOOSE] = '^' + src[t.LONECARET] + src[t.XRANGEPLAINLOOSE] + '$'; // A simple gt/lt/eq thing, or just "" to indicate "any version" +function dehydrate(data, cleaned, unserializable, path, isPathAllowed, level = 0) { + const type = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getDataType */ "d"])(data); + let isPathAllowedCheck; -tok('COMPARATORLOOSE'); -src[t.COMPARATORLOOSE] = '^' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + ')$|^$'; -tok('COMPARATOR'); -src[t.COMPARATOR] = '^' + src[t.GTLT] + '\\s*(' + src[t.FULLPLAIN] + ')$|^$'; // An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` + switch (type) { + case 'html_element': + cleaned.push(path); + return { + inspectable: false, + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + name: data.tagName, + type + }; -tok('COMPARATORTRIM'); -src[t.COMPARATORTRIM] = '(\\s*)' + src[t.GTLT] + '\\s*(' + src[t.LOOSEPLAIN] + '|' + src[t.XRANGEPLAIN] + ')'; // this one has to use the /g flag + case 'function': + cleaned.push(path); + return { + inspectable: false, + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + name: typeof data.name === 'function' || !data.name ? 'function' : data.name, + type + }; -re[t.COMPARATORTRIM] = new RegExp(src[t.COMPARATORTRIM], 'g'); -var comparatorTrimReplace = '$1$2$3'; // Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. + case 'string': + isPathAllowedCheck = isPathAllowed(path); -tok('HYPHENRANGE'); -src[t.HYPHENRANGE] = '^\\s*(' + src[t.XRANGEPLAIN] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAIN] + ')' + '\\s*$'; -tok('HYPHENRANGELOOSE'); -src[t.HYPHENRANGELOOSE] = '^\\s*(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s+-\\s+' + '(' + src[t.XRANGEPLAINLOOSE] + ')' + '\\s*$'; // Star ranges basically just allow anything at all. + if (isPathAllowedCheck) { + return data; + } else { + return data.length <= 500 ? data : data.slice(0, 500) + '...'; + } -tok('STAR'); -src[t.STAR] = '(<|>)?=?\\s*\\*'; // Compile to actual regexp objects. -// All are flag-free, unless they were created above with a flag. + case 'bigint': + cleaned.push(path); + return { + inspectable: false, + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + name: data.toString(), + type + }; -for (var i = 0; i < R; i++) { - debug(i, src[i]); + case 'symbol': + cleaned.push(path); + return { + inspectable: false, + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + name: data.toString(), + type + }; + // React Elements aren't very inspector-friendly, + // and often contain private fields or circular references. - if (!re[i]) { - re[i] = new RegExp(src[i]); - } -} + case 'react_element': + cleaned.push(path); + return { + inspectable: false, + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + name: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getDisplayNameForReactElement */ "g"])(data) || 'Unknown', + type + }; + // ArrayBuffers error if you try to inspect them. -exports.parse = parse; + case 'array_buffer': + case 'data_view': + cleaned.push(path); + return { + inspectable: false, + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + name: type === 'data_view' ? 'DataView' : 'ArrayBuffer', + size: data.byteLength, + type + }; -function parse(version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - }; - } + case 'array': + isPathAllowedCheck = isPathAllowed(path); - if (version instanceof SemVer) { - return version; - } + if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) { + return createDehydrated(type, true, data, cleaned, path); + } - if (typeof version !== 'string') { - return null; - } + return data.map((item, i) => dehydrate(item, cleaned, unserializable, path.concat([i]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1)); - if (version.length > MAX_LENGTH) { - return null; - } + case 'html_all_collection': + case 'typed_array': + case 'iterator': + isPathAllowedCheck = isPathAllowed(path); - var r = options.loose ? re[t.LOOSE] : re[t.FULL]; + if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) { + return createDehydrated(type, true, data, cleaned, path); + } else { + const unserializableValue = { + unserializable: true, + type: type, + readonly: true, + size: type === 'typed_array' ? data.length : undefined, + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + name: !data.constructor || data.constructor.name === 'Object' ? '' : data.constructor.name + }; // TRICKY + // Don't use [...spread] syntax for this purpose. + // This project uses @babel/plugin-transform-spread in "loose" mode which only works with Array values. + // Other types (e.g. typed arrays, Sets) will not spread correctly. - if (!r.test(version)) { - return null; - } + Array.from(data).forEach((item, i) => unserializableValue[i] = dehydrate(item, cleaned, unserializable, path.concat([i]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1)); + unserializable.push(path); + return unserializableValue; + } - try { - return new SemVer(version, options); - } catch (er) { - return null; - } -} + case 'opaque_iterator': + cleaned.push(path); + return { + inspectable: false, + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + name: data[Symbol.toStringTag], + type + }; -exports.valid = valid; + case 'date': + cleaned.push(path); + return { + inspectable: false, + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + name: data.toString(), + type + }; -function valid(version, options) { - var v = parse(version, options); - return v ? v.version : null; -} + case 'regexp': + cleaned.push(path); + return { + inspectable: false, + preview_short: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, false), + preview_long: Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* formatDataForPreview */ "b"])(data, true), + name: data.toString(), + type + }; -exports.clean = clean; + case 'object': + isPathAllowedCheck = isPathAllowed(path); -function clean(version, options) { - var s = parse(version.trim().replace(/^[=v]+/, ''), options); - return s ? s.version : null; -} + if (level >= LEVEL_THRESHOLD && !isPathAllowedCheck) { + return createDehydrated(type, true, data, cleaned, path); + } else { + const object = {}; + Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getAllEnumerableKeys */ "c"])(data).forEach(key => { + const name = key.toString(); + object[name] = dehydrate(data[key], cleaned, unserializable, path.concat([name]), isPathAllowed, isPathAllowedCheck ? 1 : level + 1); + }); + return object; + } -exports.SemVer = SemVer; + case 'infinity': + case 'nan': + case 'undefined': + // Some values are lossy when sent through a WebSocket. + // We dehydrate+rehydrate them to preserve their type. + cleaned.push(path); + return { + type + }; -function SemVer(version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - }; + default: + return data; } +} +function fillInPath(object, data, path, value) { + const target = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getInObject */ "h"])(object, path); - if (version instanceof SemVer) { - if (version.loose === options.loose) { - return version; - } else { - version = version.version; + if (target != null) { + if (!target[meta.unserializable]) { + delete target[meta.inspectable]; + delete target[meta.inspected]; + delete target[meta.name]; + delete target[meta.preview_long]; + delete target[meta.preview_short]; + delete target[meta.readonly]; + delete target[meta.size]; + delete target[meta.type]; } - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version); - } - - if (version.length > MAX_LENGTH) { - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters'); - } - - if (!(this instanceof SemVer)) { - return new SemVer(version, options); - } - - debug('SemVer', version, options); - this.options = options; - this.loose = !!options.loose; - var m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]); - - if (!m) { - throw new TypeError('Invalid Version: ' + version); } - this.raw = version; // these are actually numbers + if (value !== null && data.unserializable.length > 0) { + const unserializablePath = data.unserializable[0]; + let isMatch = unserializablePath.length === path.length; - this.major = +m[1]; - this.minor = +m[2]; - this.patch = +m[3]; + for (let i = 0; i < path.length; i++) { + if (path[i] !== unserializablePath[i]) { + isMatch = false; + break; + } + } - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version'); + if (isMatch) { + upgradeUnserializable(value, value); + } } - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version'); - } + Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* setInObject */ "l"])(object, path, value); +} +function hydrate(object, cleaned, unserializable) { + cleaned.forEach(path => { + const length = path.length; + const last = path[length - 1]; + const parent = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getInObject */ "h"])(object, path.slice(0, length - 1)); - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version'); - } // numberify any prerelease numeric ids + if (!parent || !parent.hasOwnProperty(last)) { + return; + } + const value = parent[last]; - if (!m[4]) { - this.prerelease = []; - } else { - this.prerelease = m[4].split('.').map(function (id) { - if (/^[0-9]+$/.test(id)) { - var num = +id; + if (!value) { + return; + } else if (value.type === 'infinity') { + parent[last] = Infinity; + } else if (value.type === 'nan') { + parent[last] = NaN; + } else if (value.type === 'undefined') { + parent[last] = undefined; + } else { + // Replace the string keys with Symbols so they're non-enumerable. + const replaced = {}; + replaced[meta.inspectable] = !!value.inspectable; + replaced[meta.inspected] = false; + replaced[meta.name] = value.name; + replaced[meta.preview_long] = value.preview_long; + replaced[meta.preview_short] = value.preview_short; + replaced[meta.size] = value.size; + replaced[meta.readonly] = !!value.readonly; + replaced[meta.type] = value.type; + parent[last] = replaced; + } + }); + unserializable.forEach(path => { + const length = path.length; + const last = path[length - 1]; + const parent = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* getInObject */ "h"])(object, path.slice(0, length - 1)); - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num; - } - } + if (!parent || !parent.hasOwnProperty(last)) { + return; + } - return id; - }); - } + const node = parent[last]; + const replacement = { ...node + }; + upgradeUnserializable(replacement, node); + parent[last] = replacement; + }); + return object; +} - this.build = m[5] ? m[5].split('.') : []; - this.format(); +function upgradeUnserializable(destination, source) { + Object.defineProperties(destination, { + [meta.inspected]: { + configurable: true, + enumerable: false, + value: !!source.inspected + }, + [meta.name]: { + configurable: true, + enumerable: false, + value: source.name + }, + [meta.preview_long]: { + configurable: true, + enumerable: false, + value: source.preview_long + }, + [meta.preview_short]: { + configurable: true, + enumerable: false, + value: source.preview_short + }, + [meta.size]: { + configurable: true, + enumerable: false, + value: source.size + }, + [meta.readonly]: { + configurable: true, + enumerable: false, + value: !!source.readonly + }, + [meta.type]: { + configurable: true, + enumerable: false, + value: source.type + }, + [meta.unserializable]: { + configurable: true, + enumerable: false, + value: !!source.unserializable + } + }); + delete destination.inspected; + delete destination.name; + delete destination.preview_long; + delete destination.preview_short; + delete destination.size; + delete destination.readonly; + delete destination.type; + delete destination.unserializable; } -SemVer.prototype.format = function () { - this.version = this.major + '.' + this.minor + '.' + this.patch; +/***/ }), +/* 11 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - if (this.prerelease.length) { - this.version += '-' + this.prerelease.join('.'); - } +"use strict"; +/* WEBPACK VAR INJECTION */(function(global) {/* unused harmony export isStringComponentStack */ +/* unused harmony export dangerous_setTargetConsoleForTesting */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return registerRenderer; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return patch; }); +/* unused harmony export unpatch */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return patchForStrictMode; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return unpatchForStrictMode; }); +/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); +/* harmony import */ var _renderer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16); +/* harmony import */ var _DevToolsFiberComponentStack__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(24); +/* harmony import */ var react_devtools_feature_flags__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(12); +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ - return this.version; -}; -SemVer.prototype.toString = function () { - return this.version; -}; -SemVer.prototype.compare = function (other) { - debug('SemVer.compare', this.version, this.options, other); - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options); - } +const OVERRIDE_CONSOLE_METHODS = ['error', 'trace', 'warn']; +const DIMMED_NODE_CONSOLE_COLOR = '\x1b[2m%s\x1b[0m'; // React's custom built component stack strings match "\s{4}in" +// Chrome's prefix matches "\s{4}at" - return this.compareMain(other) || this.comparePre(other); -}; +const PREFIX_REGEX = /\s{4}(in|at)\s{1}/; // Firefox and Safari have no prefix ("") +// but we can fallback to looking for location info (e.g. "foo.js:12:345") -SemVer.prototype.compareMain = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options); - } +const ROW_COLUMN_NUMBER_REGEX = /:\d+:\d+(\n|$)/; +function isStringComponentStack(text) { + return PREFIX_REGEX.test(text) || ROW_COLUMN_NUMBER_REGEX.test(text); +} +const STYLE_DIRECTIVE_REGEX = /^%c/; // This function tells whether or not the arguments for a console +// method has been overridden by the patchForStrictMode function. +// If it has we'll need to do some special formatting of the arguments +// so the console color stays consistent - return compareIdentifiers(this.major, other.major) || compareIdentifiers(this.minor, other.minor) || compareIdentifiers(this.patch, other.patch); -}; +function isStrictModeOverride(args, method) { + return args.length === 2 && STYLE_DIRECTIVE_REGEX.test(args[0]) && args[1] === `color: ${getConsoleColor(method) || ''}`; +} -SemVer.prototype.comparePre = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options); - } // NOT having a prerelease is > having one +function getConsoleColor(method) { + switch (method) { + case 'warn': + return consoleSettingsRef.browserTheme === 'light' ? "rgba(250, 180, 50, 0.75)" : "rgba(250, 180, 50, 0.5)"; + case 'error': + return consoleSettingsRef.browserTheme === 'light' ? "rgba(250, 123, 130, 0.75)" : "rgba(250, 123, 130, 0.5)"; - if (this.prerelease.length && !other.prerelease.length) { - return -1; - } else if (!this.prerelease.length && other.prerelease.length) { - return 1; - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0; + case 'log': + default: + return consoleSettingsRef.browserTheme === 'light' ? "rgba(125, 125, 125, 0.75)" : "rgba(125, 125, 125, 0.5)"; } +} - var i = 0; +const injectedRenderers = new Map(); +let targetConsole = console; +let targetConsoleMethods = {}; - do { - var a = this.prerelease[i]; - var b = other.prerelease[i]; - debug('prerelease compare', i, a, b); +for (const method in console) { + targetConsoleMethods[method] = console[method]; +} - if (a === undefined && b === undefined) { - return 0; - } else if (b === undefined) { - return 1; - } else if (a === undefined) { - return -1; - } else if (a === b) { - continue; - } else { - return compareIdentifiers(a, b); - } - } while (++i); -}; +let unpatchFn = null; +let isNode = false; -SemVer.prototype.compareBuild = function (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options); +try { + isNode = undefined === global; +} catch (error) {} // Enables e.g. Jest tests to inject a mock console object. + + +function dangerous_setTargetConsoleForTesting(targetConsoleForTesting) { + targetConsole = targetConsoleForTesting; + targetConsoleMethods = {}; + + for (const method in targetConsole) { + targetConsoleMethods[method] = console[method]; } +} // v16 renderers should use this method to inject internals necessary to generate a component stack. +// These internals will be used if the console is patched. +// Injecting them separately allows the console to easily be patched or un-patched later (at runtime). - var i = 0; +function registerRenderer(renderer, onErrorOrWarning) { + const { + currentDispatcherRef, + getCurrentFiber, + findFiberByHostInstance, + version + } = renderer; // Ignore React v15 and older because they don't expose a component stack anyway. - do { - var a = this.build[i]; - var b = other.build[i]; - debug('prerelease compare', i, a, b); + if (typeof findFiberByHostInstance !== 'function') { + return; + } // currentDispatcherRef gets injected for v16.8+ to support hooks inspection. + // getCurrentFiber gets injected for v16.9+. - if (a === undefined && b === undefined) { - return 0; - } else if (b === undefined) { - return 1; - } else if (a === undefined) { - return -1; - } else if (a === b) { - continue; - } else { - return compareIdentifiers(a, b); - } - } while (++i); -}; // preminor will bump the version up to the next minor release, and immediately -// down to pre-release. premajor and prepatch work the same way. + if (currentDispatcherRef != null && typeof getCurrentFiber === 'function') { + const { + ReactTypeOfWork + } = Object(_renderer__WEBPACK_IMPORTED_MODULE_1__[/* getInternalReactConstants */ "b"])(version); + injectedRenderers.set(renderer, { + currentDispatcherRef, + getCurrentFiber, + workTagMap: ReactTypeOfWork, + onErrorOrWarning + }); + } +} +const consoleSettingsRef = { + appendComponentStack: false, + breakOnConsoleErrors: false, + showInlineWarningsAndErrors: false, + hideConsoleLogsInStrictMode: false, + browserTheme: 'dark' +}; // Patches console methods to append component stack for the current fiber. +// Call unpatch() to remove the injected behavior. -SemVer.prototype.inc = function (release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0; - this.patch = 0; - this.minor = 0; - this.major++; - this.inc('pre', identifier); - break; +function patch({ + appendComponentStack, + breakOnConsoleErrors, + showInlineWarningsAndErrors, + hideConsoleLogsInStrictMode, + browserTheme +}) { + // Settings may change after we've patched the console. + // Using a shared ref allows the patch function to read the latest values. + consoleSettingsRef.appendComponentStack = appendComponentStack; + consoleSettingsRef.breakOnConsoleErrors = breakOnConsoleErrors; + consoleSettingsRef.showInlineWarningsAndErrors = showInlineWarningsAndErrors; + consoleSettingsRef.hideConsoleLogsInStrictMode = hideConsoleLogsInStrictMode; + consoleSettingsRef.browserTheme = browserTheme; - case 'preminor': - this.prerelease.length = 0; - this.patch = 0; - this.minor++; - this.inc('pre', identifier); - break; + if (appendComponentStack || breakOnConsoleErrors || showInlineWarningsAndErrors) { + if (unpatchFn !== null) { + // Don't patch twice. + return; + } - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0; - this.inc('patch', identifier); - this.inc('pre', identifier); - break; - // If the input is a non-prerelease version, this acts the same as - // prepatch. + const originalConsoleMethods = {}; - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier); + unpatchFn = () => { + for (const method in originalConsoleMethods) { + try { + // $FlowFixMe property error|warn is not writable. + targetConsole[method] = originalConsoleMethods[method]; + } catch (error) {} } + }; - this.inc('pre', identifier); - break; + OVERRIDE_CONSOLE_METHODS.forEach(method => { + try { + const originalMethod = originalConsoleMethods[method] = targetConsole[method].__REACT_DEVTOOLS_ORIGINAL_METHOD__ ? targetConsole[method].__REACT_DEVTOOLS_ORIGINAL_METHOD__ : targetConsole[method]; - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) { - this.major++; - } + const overrideMethod = (...args) => { + let shouldAppendWarningStack = false; - this.minor = 0; - this.patch = 0; - this.prerelease = []; - break; + if (method !== 'log') { + if (consoleSettingsRef.appendComponentStack) { + const lastArg = args.length > 0 ? args[args.length - 1] : null; + const alreadyHasComponentStack = typeof lastArg === 'string' && isStringComponentStack(lastArg); // If we are ever called with a string that already has a component stack, + // e.g. a React error/warning, don't append a second stack. - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++; - } + shouldAppendWarningStack = !alreadyHasComponentStack; + } + } - this.patch = 0; - this.prerelease = []; - break; + const shouldShowInlineWarningsAndErrors = consoleSettingsRef.showInlineWarningsAndErrors && (method === 'error' || method === 'warn'); // Search for the first renderer that has a current Fiber. + // We don't handle the edge case of stacks for more than one (e.g. interleaved renderers?) + // eslint-disable-next-line no-for-of-loops/no-for-of-loops - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++; - } + for (const { + currentDispatcherRef, + getCurrentFiber, + onErrorOrWarning, + workTagMap + } of injectedRenderers.values()) { + const current = getCurrentFiber(); - this.prerelease = []; - break; - // This probably shouldn't be used publicly. - // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + if (current != null) { + try { + if (shouldShowInlineWarningsAndErrors) { + // patch() is called by two places: (1) the hook and (2) the renderer backend. + // The backend is what implements a message queue, so it's the only one that injects onErrorOrWarning. + if (typeof onErrorOrWarning === 'function') { + onErrorOrWarning(current, method, // Copy args before we mutate them (e.g. adding the component stack) + args.slice()); + } + } - case 'pre': - if (this.prerelease.length === 0) { - this.prerelease = [0]; - } else { - var i = this.prerelease.length; + if (shouldAppendWarningStack) { + const componentStack = Object(_DevToolsFiberComponentStack__WEBPACK_IMPORTED_MODULE_2__[/* getStackByFiberInDevAndProd */ "a"])(workTagMap, current, currentDispatcherRef); - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++; - i = -2; + if (componentStack !== '') { + if (isStrictModeOverride(args, method)) { + args[0] = Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* format */ "f"])(args[0], componentStack); + } else { + args.push(componentStack); + } + } + } + } catch (error) { + // Don't let a DevTools or React internal error interfere with logging. + setTimeout(() => { + throw error; + }, 0); + } finally { + break; + } + } } - } - - if (i === -1) { - // didn't increment anything - this.prerelease.push(0); - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) { - this.prerelease = [identifier, 0]; + if (consoleSettingsRef.breakOnConsoleErrors) { + // --- Welcome to debugging with React DevTools --- + // This debugger statement means that you've enabled the "break on warnings" feature. + // Use the browser's Call Stack panel to step out of this override function- + // to where the original warning or error was logged. + // eslint-disable-next-line no-debugger + debugger; } - } else { - this.prerelease = [identifier, 0]; - } - } - - break; - - default: - throw new Error('invalid increment argument: ' + release); - } - this.format(); - this.raw = this.version; - return this; -}; + originalMethod(...args); + }; -exports.inc = inc; + overrideMethod.__REACT_DEVTOOLS_ORIGINAL_METHOD__ = originalMethod; + originalMethod.__REACT_DEVTOOLS_OVERRIDE_METHOD__ = overrideMethod; // $FlowFixMe property error|warn is not writable. -function inc(version, release, loose, identifier) { - if (typeof loose === 'string') { - identifier = loose; - loose = undefined; + targetConsole[method] = overrideMethod; + } catch (error) {} + }); + } else { + unpatch(); } +} // Removed component stack patch from console methods. - try { - return new SemVer(version, loose).inc(release, identifier).version; - } catch (er) { - return null; +function unpatch() { + if (unpatchFn !== null) { + unpatchFn(); + unpatchFn = null; } } +let unpatchForStrictModeFn = null; // NOTE: KEEP IN SYNC with src/hook.js:patchConsoleForInitialRenderInStrictMode -exports.diff = diff; - -function diff(version1, version2) { - if (eq(version1, version2)) { - return null; - } else { - var v1 = parse(version1); - var v2 = parse(version2); - var prefix = ''; +function patchForStrictMode() { + if (react_devtools_feature_flags__WEBPACK_IMPORTED_MODULE_3__[/* consoleManagedByDevToolsDuringStrictMode */ "a"]) { + const overrideConsoleMethods = ['error', 'trace', 'warn', 'log']; - if (v1.prerelease.length || v2.prerelease.length) { - prefix = 'pre'; - var defaultResult = 'prerelease'; + if (unpatchForStrictModeFn !== null) { + // Don't patch twice. + return; } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key; - } + const originalConsoleMethods = {}; + + unpatchForStrictModeFn = () => { + for (const method in originalConsoleMethods) { + try { + // $FlowFixMe property error|warn is not writable. + targetConsole[method] = originalConsoleMethods[method]; + } catch (error) {} } - } + }; - return defaultResult; // may be undefined - } -} + overrideConsoleMethods.forEach(method => { + try { + const originalMethod = originalConsoleMethods[method] = targetConsole[method].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ ? targetConsole[method].__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ : targetConsole[method]; + + const overrideMethod = (...args) => { + if (!consoleSettingsRef.hideConsoleLogsInStrictMode) { + // Dim the text color of the double logs if we're not + // hiding them. + if (isNode) { + originalMethod(DIMMED_NODE_CONSOLE_COLOR, Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* format */ "f"])(...args)); + } else { + const color = getConsoleColor(method); -exports.compareIdentifiers = compareIdentifiers; -var numeric = /^[0-9]+$/; + if (color) { + originalMethod(`%c${Object(_utils__WEBPACK_IMPORTED_MODULE_0__[/* format */ "f"])(...args)}`, `color: ${color}`); + } else { + throw Error('Console color is not defined'); + } + } + } + }; -function compareIdentifiers(a, b) { - var anum = numeric.test(a); - var bnum = numeric.test(b); + overrideMethod.__REACT_DEVTOOLS_STRICT_MODE_ORIGINAL_METHOD__ = originalMethod; + originalMethod.__REACT_DEVTOOLS_STRICT_MODE_OVERRIDE_METHOD__ = overrideMethod; // $FlowFixMe property error|warn is not writable. - if (anum && bnum) { - a = +a; - b = +b; + targetConsole[method] = overrideMethod; + } catch (error) {} + }); } +} // NOTE: KEEP IN SYNC with src/hook.js:unpatchConsoleForInitialRenderInStrictMode - return a === b ? 0 : anum && !bnum ? -1 : bnum && !anum ? 1 : a < b ? -1 : 1; -} - -exports.rcompareIdentifiers = rcompareIdentifiers; - -function rcompareIdentifiers(a, b) { - return compareIdentifiers(b, a); -} - -exports.major = major; - -function major(a, loose) { - return new SemVer(a, loose).major; +function unpatchForStrictMode() { + if (react_devtools_feature_flags__WEBPACK_IMPORTED_MODULE_3__[/* consoleManagedByDevToolsDuringStrictMode */ "a"]) { + if (unpatchForStrictModeFn !== null) { + unpatchForStrictModeFn(); + unpatchForStrictModeFn = null; + } + } } +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(19))) -exports.minor = minor; +/***/ }), +/* 12 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { -function minor(a, loose) { - return new SemVer(a, loose).minor; -} +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return consoleManagedByDevToolsDuringStrictMode; }); +/* unused harmony export enableLogger */ +/* unused harmony export enableNamedHooksFeature */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return enableProfilerChangedHookIndices; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return enableStyleXFeatures; }); +/* unused harmony export isInternalFacebookBuild */ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ -exports.patch = patch; +/************************************************************************ + * This file is forked between different DevTools implementations. + * It should never be imported directly! + * It should always be imported from "react-devtools-feature-flags". + ************************************************************************/ +const consoleManagedByDevToolsDuringStrictMode = true; +const enableLogger = false; +const enableNamedHooksFeature = true; +const enableProfilerChangedHookIndices = true; +const enableStyleXFeatures = false; +const isInternalFacebookBuild = false; +/************************************************************************ + * Do not edit the code below. + * It ensures this fork exports the same types as the default flags file. + ************************************************************************/ -function patch(a, loose) { - return new SemVer(a, loose).patch; -} +// eslint-disable-next-line no-unused-expressions +null; -exports.compare = compare; +/***/ }), +/* 13 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { -function compare(a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)); -} +"use strict"; +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EventEmitter; }); +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -exports.compareLoose = compareLoose; +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ +class EventEmitter { + constructor() { + _defineProperty(this, "listenersMap", new Map()); + } -function compareLoose(a, b) { - return compare(a, b, true); -} + addListener(event, listener) { + const listeners = this.listenersMap.get(event); -exports.compareBuild = compareBuild; + if (listeners === undefined) { + this.listenersMap.set(event, [listener]); + } else { + const index = listeners.indexOf(listener); -function compareBuild(a, b, loose) { - var versionA = new SemVer(a, loose); - var versionB = new SemVer(b, loose); - return versionA.compare(versionB) || versionA.compareBuild(versionB); -} + if (index < 0) { + listeners.push(listener); + } + } + } -exports.rcompare = rcompare; + emit(event, ...args) { + const listeners = this.listenersMap.get(event); -function rcompare(a, b, loose) { - return compare(b, a, loose); -} + if (listeners !== undefined) { + if (listeners.length === 1) { + // No need to clone or try/catch + const listener = listeners[0]; + listener.apply(null, args); + } else { + let didThrow = false; + let caughtError = null; + const clonedListeners = Array.from(listeners); -exports.sort = sort; + for (let i = 0; i < clonedListeners.length; i++) { + const listener = clonedListeners[i]; -function sort(list, loose) { - return list.sort(function (a, b) { - return exports.compareBuild(a, b, loose); - }); -} + try { + listener.apply(null, args); + } catch (error) { + if (caughtError === null) { + didThrow = true; + caughtError = error; + } + } + } -exports.rsort = rsort; + if (didThrow) { + throw caughtError; + } + } + } + } -function rsort(list, loose) { - return list.sort(function (a, b) { - return exports.compareBuild(b, a, loose); - }); -} + removeAllListeners() { + this.listenersMap.clear(); + } -exports.gt = gt; + removeListener(event, listener) { + const listeners = this.listenersMap.get(event); -function gt(a, b, loose) { - return compare(a, b, loose) > 0; -} + if (listeners !== undefined) { + const index = listeners.indexOf(listener); -exports.lt = lt; + if (index >= 0) { + listeners.splice(index, 1); + } + } + } -function lt(a, b, loose) { - return compare(a, b, loose) < 0; } -exports.eq = eq; +/***/ }), +/* 14 */ +/***/ (function(module, exports, __webpack_require__) { -function eq(a, b, loose) { - return compare(a, b, loose) === 0; -} +/* WEBPACK VAR INJECTION */(function(global) {/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ -exports.neq = neq; +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; +/** Used as references for various `Number` constants. */ -function neq(a, b, loose) { - return compare(a, b, loose) !== 0; -} +var NAN = 0 / 0; +/** `Object#toString` result references. */ -exports.gte = gte; +var symbolTag = '[object Symbol]'; +/** Used to match leading and trailing whitespace. */ -function gte(a, b, loose) { - return compare(a, b, loose) >= 0; -} +var reTrim = /^\s+|\s+$/g; +/** Used to detect bad signed hexadecimal string values. */ -exports.lte = lte; +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; +/** Used to detect binary string values. */ -function lte(a, b, loose) { - return compare(a, b, loose) <= 0; -} +var reIsBinary = /^0b[01]+$/i; +/** Used to detect octal string values. */ -exports.cmp = cmp; +var reIsOctal = /^0o[0-7]+$/i; +/** Built-in method references without a dependency on `root`. */ -function cmp(a, op, b, loose) { - switch (op) { - case '===': - if (typeof a === 'object') a = a.version; - if (typeof b === 'object') b = b.version; - return a === b; +var freeParseInt = parseInt; +/** Detect free variable `global` from Node.js. */ - case '!==': - if (typeof a === 'object') a = a.version; - if (typeof b === 'object') b = b.version; - return a !== b; +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; +/** Detect free variable `self`. */ - case '': - case '=': - case '==': - return eq(a, b, loose); +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; +/** Used as a reference to the global object. */ - case '!=': - return neq(a, b, loose); +var root = freeGlobal || freeSelf || Function('return this')(); +/** Used for built-in method references. */ - case '>': - return gt(a, b, loose); +var objectProto = Object.prototype; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ - case '>=': - return gte(a, b, loose); +var objectToString = objectProto.toString; +/* Built-in method references for those with the same name as other `lodash` methods. */ - case '<': - return lt(a, b, loose); +var nativeMax = Math.max, + nativeMin = Math.min; +/** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ - case '<=': - return lte(a, b, loose); +var now = function () { + return root.Date.now(); +}; +/** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ - default: - throw new TypeError('Invalid operator: ' + op); - } -} -exports.Comparator = Comparator; +function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; -function Comparator(comp, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - }; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); } - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp; - } else { - comp = comp.value; - } - } + wait = toNumber(wait) || 0; - if (!(this instanceof Comparator)) { - return new Comparator(comp, options); + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; } - debug('comparator', comp, options); - this.options = options; - this.loose = !!options.loose; - this.parse(comp); - - if (this.semver === ANY) { - this.value = ''; - } else { - this.value = this.operator + this.semver.version; + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; } - debug('comp', this); -} - -var ANY = {}; + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; // Start the timer for the trailing edge. -Comparator.prototype.parse = function (comp) { - var r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; - var m = comp.match(r); + timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. - if (!m) { - throw new TypeError('Invalid comparator: ' + comp); + return leading ? invokeFunc(time) : result; } - this.operator = m[1] !== undefined ? m[1] : ''; - - if (this.operator === '=') { - this.operator = ''; - } // if it literally is just '>' or '' then allow anything. - - - if (!m[2]) { - this.semver = ANY; - } else { - this.semver = new SemVer(m[2], this.options.loose); + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + result = wait - timeSinceLastCall; + return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; } -}; -Comparator.prototype.toString = function () { - return this.value; -}; - -Comparator.prototype.test = function (version) { - debug('Comparator.test', version, this.options.loose); + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. - if (this.semver === ANY || version === ANY) { - return true; + return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; } - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options); - } catch (er) { - return false; - } - } + function timerExpired() { + var time = now(); - return cmp(version, this.operator, this.semver, this.options); -}; + if (shouldInvoke(time)) { + return trailingEdge(time); + } // Restart the timer. -Comparator.prototype.intersects = function (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required'); - } - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - }; + timerId = setTimeout(timerExpired, remainingWait(time)); } - var rangeTmp; - - if (this.operator === '') { - if (this.value === '') { - return true; - } + function trailingEdge(time) { + timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. - rangeTmp = new Range(comp.value, options); - return satisfies(this.value, rangeTmp, options); - } else if (comp.operator === '') { - if (comp.value === '') { - return true; + if (trailing && lastArgs) { + return invokeFunc(time); } - rangeTmp = new Range(this.value, options); - return satisfies(comp.semver, rangeTmp, options); - } - - var sameDirectionIncreasing = (this.operator === '>=' || this.operator === '>') && (comp.operator === '>=' || comp.operator === '>'); - var sameDirectionDecreasing = (this.operator === '<=' || this.operator === '<') && (comp.operator === '<=' || comp.operator === '<'); - var sameSemVer = this.semver.version === comp.semver.version; - var differentDirectionsInclusive = (this.operator === '>=' || this.operator === '<=') && (comp.operator === '>=' || comp.operator === '<='); - var oppositeDirectionsLessThan = cmp(this.semver, '<', comp.semver, options) && (this.operator === '>=' || this.operator === '>') && (comp.operator === '<=' || comp.operator === '<'); - var oppositeDirectionsGreaterThan = cmp(this.semver, '>', comp.semver, options) && (this.operator === '<=' || this.operator === '<') && (comp.operator === '>=' || comp.operator === '>'); - return sameDirectionIncreasing || sameDirectionDecreasing || sameSemVer && differentDirectionsInclusive || oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; -}; - -exports.Range = Range; - -function Range(range, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - }; + lastArgs = lastThis = undefined; + return result; } - if (range instanceof Range) { - if (range.loose === !!options.loose && range.includePrerelease === !!options.includePrerelease) { - return range; - } else { - return new Range(range.raw, options); + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); } - } - - if (range instanceof Comparator) { - return new Range(range.value, options); - } - if (!(this instanceof Range)) { - return new Range(range, options); + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; } - this.options = options; - this.loose = !!options.loose; - this.includePrerelease = !!options.includePrerelease; // First, split based on boolean or || - - this.raw = range; - this.set = range.split(/\s*\|\|\s*/).map(function (range) { - return this.parseRange(range.trim()); - }, this).filter(function (c) { - // throw out any that are not relevant for whatever reason - return c.length; - }); - - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range); + function flush() { + return timerId === undefined ? result : trailingEdge(now()); } - this.format(); -} - -Range.prototype.format = function () { - this.range = this.set.map(function (comps) { - return comps.join(' ').trim(); - }).join('||').trim(); - return this.range; -}; - -Range.prototype.toString = function () { - return this.range; -}; - -Range.prototype.parseRange = function (range) { - var loose = this.options.loose; - range = range.trim(); // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - - var hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE]; - range = range.replace(hr, hyphenReplace); - debug('hyphen replace', range); // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace); - debug('comparator trim', range, re[t.COMPARATORTRIM]); // `~ 1.2.3` => `~1.2.3` - - range = range.replace(re[t.TILDETRIM], tildeTrimReplace); // `^ 1.2.3` => `^1.2.3` - - range = range.replace(re[t.CARETTRIM], caretTrimReplace); // normalize spaces - - range = range.split(/\s+/).join(' '); // At this point, the range is completely trimmed and - // ready to be split into comparators. - - var compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR]; - var set = range.split(' ').map(function (comp) { - return parseComparator(comp, this.options); - }, this).join(' ').split(/\s+/); + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + lastArgs = arguments; + lastThis = this; + lastCallTime = time; - if (this.options.loose) { - // in loose mode, throw out any that are not valid comparators - set = set.filter(function (comp) { - return !!comp.match(compRe); - }); - } + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } - set = set.map(function (comp) { - return new Comparator(comp, this.options); - }, this); - return set; -}; + if (maxing) { + // Handle invocations in a tight loop. + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } -Range.prototype.intersects = function (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required'); + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + + return result; } - return this.set.some(function (thisComparators) { - return isSatisfiable(thisComparators, options) && range.set.some(function (rangeComparators) { - return isSatisfiable(rangeComparators, options) && thisComparators.every(function (thisComparator) { - return rangeComparators.every(function (rangeComparator) { - return thisComparator.intersects(rangeComparator, options); - }); - }); - }); - }); -}; // take a set of comparators and determine whether there -// exists a version which can satisfy it + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; +} +/** + * Creates a throttled function that only invokes `func` at most once per + * every `wait` milliseconds. The throttled function comes with a `cancel` + * method to cancel delayed `func` invocations and a `flush` method to + * immediately invoke them. Provide `options` to indicate whether `func` + * should be invoked on the leading and/or trailing edge of the `wait` + * timeout. The `func` is invoked with the last arguments provided to the + * throttled function. Subsequent calls to the throttled function return the + * result of the last `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the throttled function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.throttle` and `_.debounce`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to throttle. + * @param {number} [wait=0] The number of milliseconds to throttle invocations to. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=true] + * Specify invoking on the leading edge of the timeout. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new throttled function. + * @example + * + * // Avoid excessively updating the position while scrolling. + * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); + * + * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. + * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); + * jQuery(element).on('click', throttled); + * + * // Cancel the trailing throttled invocation. + * jQuery(window).on('popstate', throttled.cancel); + */ -function isSatisfiable(comparators, options) { - var result = true; - var remainingComparators = comparators.slice(); - var testComparator = remainingComparators.pop(); +function throttle(func, wait, options) { + var leading = true, + trailing = true; - while (result && remainingComparators.length) { - result = remainingComparators.every(function (otherComparator) { - return testComparator.intersects(otherComparator, options); - }); - testComparator = remainingComparators.pop(); + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); } - return result; -} // Mostly just for testing and legacy API reasons - - -exports.toComparators = toComparators; + if (isObject(options)) { + leading = 'leading' in options ? !!options.leading : leading; + trailing = 'trailing' in options ? !!options.trailing : trailing; + } -function toComparators(range, options) { - return new Range(range, options).set.map(function (comp) { - return comp.map(function (c) { - return c.value; - }).join(' ').trim().split(' '); + return debounce(func, wait, { + 'leading': leading, + 'maxWait': wait, + 'trailing': trailing }); -} // comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. +} +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ -function parseComparator(comp, options) { - debug('comp', comp, options); - comp = replaceCarets(comp, options); - debug('caret', comp); - comp = replaceTildes(comp, options); - debug('tildes', comp); - comp = replaceXRanges(comp, options); - debug('xrange', comp); - comp = replaceStars(comp, options); - debug('stars', comp); - return comp; +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); } - -function isX(id) { - return !id || id.toLowerCase() === 'x' || id === '*'; -} // ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ -function replaceTildes(comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceTilde(comp, options); - }).join(' '); +function isObjectLike(value) { + return !!value && typeof value == 'object'; } +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ -function replaceTilde(comp, options) { - var r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE]; - return comp.replace(r, function (_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr); - var ret; - if (isX(M)) { - ret = ''; - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0 - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; - } else if (pr) { - debug('replaceTilde pr', pr); - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0'; - } else { - // ~1.2.3 == >=1.2.3 <1.3.0 - ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0'; - } +function isSymbol(value) { + return typeof value == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag; +} +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ - debug('tilde return', ret); - return ret; - }); -} // ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2.0 --> >=1.2.0 <2.0.0 +function toNumber(value) { + if (typeof value == 'number') { + return value; + } -function replaceCarets(comp, options) { - return comp.trim().split(/\s+/).map(function (comp) { - return replaceCaret(comp, options); - }).join(' '); -} + if (isSymbol(value)) { + return NAN; + } -function replaceCaret(comp, options) { - debug('caret', comp, options); - var r = options.loose ? re[t.CARETLOOSE] : re[t.CARET]; - return comp.replace(r, function (_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr); - var ret; + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? other + '' : other; + } - if (isX(M)) { - ret = ''; - } else if (isX(m)) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - } else if (isX(p)) { - if (M === '0') { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; - } else { - ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; - } - } else if (pr) { - debug('replaceCaret pr', pr); + if (typeof value != 'string') { + return value === 0 ? value : +value; + } - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + m + '.' + (+p + 1); - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + M + '.' + (+m + 1) + '.0'; - } - } else { - ret = '>=' + M + '.' + m + '.' + p + '-' + pr + ' <' + (+M + 1) + '.0.0'; - } - } else { - debug('no pr'); + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; +} - if (M === '0') { - if (m === '0') { - ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + m + '.' + (+p + 1); - } else { - ret = '>=' + M + '.' + m + '.' + p + ' <' + M + '.' + (+m + 1) + '.0'; - } - } else { - ret = '>=' + M + '.' + m + '.' + p + ' <' + (+M + 1) + '.0.0'; - } - } +module.exports = throttle; +/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(19))) - debug('caret return', ret); - return ret; - }); -} +/***/ }), +/* 15 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { -function replaceXRanges(comp, options) { - debug('replaceXRanges', comp, options); - return comp.split(/\s+/).map(function (comp) { - return replaceXRange(comp, options); - }).join(' '); -} +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BRIDGE_PROTOCOL", function() { return BRIDGE_PROTOCOL; }); +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentBridgeProtocol", function() { return currentBridgeProtocol; }); +/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(13); +function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } -function replaceXRange(comp, options) { - comp = comp.trim(); - var r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE]; - return comp.replace(r, function (ret, gtlt, M, m, p, pr) { - debug('xRange', comp, ret, gtlt, M, m, p, pr); - var xM = isX(M); - var xm = xM || isX(m); - var xp = xm || isX(p); - var anyX = xp; +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ - if (gtlt === '=' && anyX) { - gtlt = ''; - } // if we're including prereleases in the match, then we need - // to fix this to -0, the lowest possible prerelease value +const BATCH_DURATION = 100; // This message specifies the version of the DevTools protocol currently supported by the backend, +// as well as the earliest NPM version (e.g. "4.13.0") that protocol is supported by on the frontend. +// This enables an older frontend to display an upgrade message to users for a newer, unsupported backend. + +// Bump protocol version whenever a backwards breaking change is made +// in the messages sent between BackendBridge and FrontendBridge. +// This mapping is embedded in both frontend and backend builds. +// +// The backend protocol will always be the latest entry in the BRIDGE_PROTOCOL array. +// +// When an older frontend connects to a newer backend, +// the backend can send the minNpmVersion and the frontend can display an NPM upgrade prompt. +// +// When a newer frontend connects with an older protocol version, +// the frontend can use the embedded minNpmVersion/maxNpmVersion values to display a downgrade prompt. +const BRIDGE_PROTOCOL = [// This version technically never existed, +// but a backwards breaking change was added in 4.11, +// so the safest guess to downgrade the frontend would be to version 4.10. +{ + version: 0, + minNpmVersion: '"<4.11.0"', + maxNpmVersion: '"<4.11.0"' +}, // Versions 4.11.x – 4.12.x contained the backwards breaking change, +// but we didn't add the "fix" of checking the protocol version until 4.13, +// so we don't recommend downgrading to 4.11 or 4.12. +{ + version: 1, + minNpmVersion: '4.13.0', + maxNpmVersion: '4.21.0' +}, // Version 2 adds a StrictMode-enabled and supports-StrictMode bits to add-root operation. +{ + version: 2, + minNpmVersion: '4.22.0', + maxNpmVersion: null +}]; +const currentBridgeProtocol = BRIDGE_PROTOCOL[BRIDGE_PROTOCOL.length - 1]; +class Bridge extends _events__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"] { + constructor(wall) { + super(); - pr = options.includePrerelease ? '-0' : ''; + _defineProperty(this, "_isShutdown", false); - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0-0'; - } else { - // nothing is forbidden - ret = '*'; - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0; - } + _defineProperty(this, "_messageQueue", []); - p = 0; + _defineProperty(this, "_timeoutID", null); - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - // >1.2.3 => >= 1.2.4 - gtlt = '>='; + _defineProperty(this, "_wallUnlisten", null); - if (xm) { - M = +M + 1; - m = 0; - p = 0; - } else { - m = +m + 1; - p = 0; - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<'; + _defineProperty(this, "_flush", () => { + // This method is used after the bridge is marked as destroyed in shutdown sequence, + // so we do not bail out if the bridge marked as destroyed. + // It is a private method that the bridge ensures is only called at the right times. + if (this._timeoutID !== null) { + clearTimeout(this._timeoutID); + this._timeoutID = null; + } - if (xm) { - M = +M + 1; - } else { - m = +m + 1; + if (this._messageQueue.length) { + for (let i = 0; i < this._messageQueue.length; i += 2) { + this._wall.send(this._messageQueue[i], ...this._messageQueue[i + 1]); } + + this._messageQueue.length = 0; // Check again for queued messages in BATCH_DURATION ms. This will keep + // flushing in a loop as long as messages continue to be added. Once no + // more are, the timer expires. + + this._timeoutID = setTimeout(this._flush, BATCH_DURATION); } + }); - ret = gtlt + M + '.' + m + '.' + p + pr; - } else if (xm) { - ret = '>=' + M + '.0.0' + pr + ' <' + (+M + 1) + '.0.0' + pr; - } else if (xp) { - ret = '>=' + M + '.' + m + '.0' + pr + ' <' + M + '.' + (+m + 1) + '.0' + pr; - } + _defineProperty(this, "overrideValueAtPath", ({ + id, + path, + rendererID, + type, + value + }) => { + switch (type) { + case 'context': + this.send('overrideContext', { + id, + path, + rendererID, + wasForwarded: true, + value + }); + break; - debug('xRange return', ret); - return ret; - }); -} // Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. + case 'hooks': + this.send('overrideHookState', { + id, + path, + rendererID, + wasForwarded: true, + value + }); + break; + case 'props': + this.send('overrideProps', { + id, + path, + rendererID, + wasForwarded: true, + value + }); + break; -function replaceStars(comp, options) { - debug('replaceStars', comp, options); // Looseness is ignored here. star is always as loose as it gets! + case 'state': + this.send('overrideState', { + id, + path, + rendererID, + wasForwarded: true, + value + }); + break; + } + }); - return comp.trim().replace(re[t.STAR], ''); -} // This function is passed to string.replace(re[t.HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0 + this._wall = wall; + this._wallUnlisten = wall.listen(message => { + if (message && message.event) { + this.emit(message.event, message.payload); + } + }) || null; // Temporarily support older standalone front-ends sending commands to newer embedded backends. + // We do this because React Native embeds the React DevTools backend, + // but cannot control which version of the frontend users use. + this.addListener('overrideValueAtPath', this.overrideValueAtPath); + } // Listening directly to the wall isn't advised. + // It can be used to listen for legacy (v3) messages (since they use a different format). -function hyphenReplace($0, from, fM, fm, fp, fpr, fb, to, tM, tm, tp, tpr, tb) { - if (isX(fM)) { - from = ''; - } else if (isX(fm)) { - from = '>=' + fM + '.0.0'; - } else if (isX(fp)) { - from = '>=' + fM + '.' + fm + '.0'; - } else { - from = '>=' + from; - } - if (isX(tM)) { - to = ''; - } else if (isX(tm)) { - to = '<' + (+tM + 1) + '.0.0'; - } else if (isX(tp)) { - to = '<' + tM + '.' + (+tm + 1) + '.0'; - } else if (tpr) { - to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; - } else { - to = '<=' + to; + get wall() { + return this._wall; } - return (from + ' ' + to).trim(); -} // if ANY of the sets match ALL of its comparators, then pass - + send(event, ...payload) { + if (this._isShutdown) { + console.warn(`Cannot send message "${event}" through a Bridge that has been shutdown.`); + return; + } // When we receive a message: + // - we add it to our queue of messages to be sent + // - if there hasn't been a message recently, we set a timer for 0 ms in + // the future, allowing all messages created in the same tick to be sent + // together + // - if there *has* been a message flushed in the last BATCH_DURATION ms + // (or we're waiting for our setTimeout-0 to fire), then _timeoutID will + // be set, and we'll simply add to the queue and wait for that -Range.prototype.test = function (version) { - if (!version) { - return false; - } - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options); - } catch (er) { - return false; - } - } + this._messageQueue.push(event, payload); - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true; + if (!this._timeoutID) { + this._timeoutID = setTimeout(this._flush, 0); } } - return false; -}; + shutdown() { + if (this._isShutdown) { + console.warn('Bridge was already shutdown.'); + return; + } // Queue the shutdown outgoing message for subscribers. -function testSet(set, version, options) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false; - } - } - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (i = 0; i < set.length; i++) { - debug(set[i].semver); + this.send('shutdown'); // Mark this bridge as destroyed, i.e. disable its public API. - if (set[i].semver === ANY) { - continue; - } + this._isShutdown = true; // Disable the API inherited from EventEmitter that can add more listeners and send more messages. + // $FlowFixMe This property is not writable. - if (set[i].semver.prerelease.length > 0) { - var allowed = set[i].semver; + this.addListener = function () {}; // $FlowFixMe This property is not writable. - if (allowed.major === version.major && allowed.minor === version.minor && allowed.patch === version.patch) { - return true; - } - } - } // Version has a -pre, but it's not one of the ones we like. + this.emit = function () {}; // NOTE: There's also EventEmitter API like `on` and `prependListener` that we didn't add to our Flow type of EventEmitter. + // Unsubscribe this bridge incoming message listeners to be sure, and so they don't have to do that. - return false; - } - return true; -} + this.removeAllListeners(); // Stop accepting and emitting incoming messages from the wall. -exports.satisfies = satisfies; + const wallUnlisten = this._wallUnlisten; -function satisfies(version, range, options) { - try { - range = new Range(range, options); - } catch (er) { - return false; - } + if (wallUnlisten) { + wallUnlisten(); + } // Synchronously flush all queued outgoing messages. + // At this step the subscribers' code may run in this call stack. - return range.test(version); -} -exports.maxSatisfying = maxSatisfying; + do { + this._flush(); + } while (this._messageQueue.length); // Make sure once again that there is no dangling timer. -function maxSatisfying(versions, range, options) { - var max = null; - var maxSV = null; - try { - var rangeObj = new Range(range, options); - } catch (er) { - return null; + if (this._timeoutID !== null) { + clearTimeout(this._timeoutID); + this._timeoutID = null; + } } - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v; - maxSV = new SemVer(max, options); - } - } - }); - return max; } -exports.minSatisfying = minSatisfying; +/* harmony default export */ __webpack_exports__["default"] = (Bridge); -function minSatisfying(versions, range, options) { - var min = null; - var minSV = null; +/***/ }), +/* 16 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { - try { - var rangeObj = new Range(range, options); - } catch (er) { - return null; - } +"use strict"; - versions.forEach(function (v) { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v; - minSV = new SemVer(min, options); - } - } - }); - return min; -} +// EXPORTS +__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ getInternalReactConstants; }); +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ attach; }); -exports.minVersion = minVersion; +// EXTERNAL MODULE: ../react-devtools-shared/node_modules/semver/semver.js +var semver = __webpack_require__(9); -function minVersion(range, loose) { - range = new Range(range, loose); - var minver = new SemVer('0.0.0'); +// EXTERNAL MODULE: ../react-devtools-shared/src/types.js +var types = __webpack_require__(0); - if (range.test(minver)) { - return minver; - } +// EXTERNAL MODULE: ../react-devtools-shared/src/utils.js +var utils = __webpack_require__(2); - minver = new SemVer('0.0.0-0'); +// EXTERNAL MODULE: ../react-devtools-shared/src/storage.js +var storage = __webpack_require__(5); - if (range.test(minver)) { - return minver; - } +// EXTERNAL MODULE: ../react-devtools-shared/src/backend/utils.js +var backend_utils = __webpack_require__(4); - minver = null; +// EXTERNAL MODULE: ../react-devtools-shared/src/constants.js +var constants = __webpack_require__(1); - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i]; - comparators.forEach(function (comparator) { - // Clone to avoid manipulating the comparator's semver object. - var compver = new SemVer(comparator.semver.version); +// EXTERNAL MODULE: /Users/bvaughn/Documents/git/facebook/react/build/oss-experimental/react-debug-tools/index.js +var react_debug_tools = __webpack_require__(23); - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++; - } else { - compver.prerelease.push(0); - } +// EXTERNAL MODULE: ../react-devtools-shared/src/backend/console.js +var backend_console = __webpack_require__(11); - compver.raw = compver.format(); +// EXTERNAL MODULE: ../react-devtools-shared/src/backend/ReactSymbols.js +var ReactSymbols = __webpack_require__(3); - /* fallthrough */ +// EXTERNAL MODULE: ../react-devtools-shared/src/config/DevToolsFeatureFlags.extension-oss.js +var DevToolsFeatureFlags_extension_oss = __webpack_require__(12); - case '': - case '>=': - if (!minver || gt(minver, compver)) { - minver = compver; - } +// CONCATENATED MODULE: ../shared/objectIs.js +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ - break; +/** + * inlined Object.is polyfill to avoid requiring consumers ship their own + * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is + */ +function is(x, y) { + return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare + ; +} + +const objectIs = typeof Object.is === 'function' ? Object.is : is; +/* harmony default export */ var shared_objectIs = (objectIs); +// CONCATENATED MODULE: ../shared/hasOwnProperty.js +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ +const hasOwnProperty_hasOwnProperty = Object.prototype.hasOwnProperty; +/* harmony default export */ var shared_hasOwnProperty = (hasOwnProperty_hasOwnProperty); +// EXTERNAL MODULE: ../react-devtools-shared/src/isArray.js +var isArray = __webpack_require__(6); + +// CONCATENATED MODULE: ../react-devtools-shared/src/backend/StyleX/utils.js +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ - case '<': - case '<=': - /* Ignore maximum versions */ - break; +const cachedStyleNameToValueMap = new Map(); +function getStyleXData(data) { + const sources = new Set(); + const resolvedStyles = {}; + crawlData(data, sources, resolvedStyles); + return { + sources: Array.from(sources).sort(), + resolvedStyles + }; +} +function crawlData(data, sources, resolvedStyles) { + if (data == null) { + return; + } - /* istanbul ignore next */ + if (Object(isArray["a" /* default */])(data)) { + data.forEach(entry => { + if (entry == null) { + return; + } - default: - throw new Error('Unexpected operation: ' + comparator.operator); + if (Object(isArray["a" /* default */])(entry)) { + crawlData(entry, sources, resolvedStyles); + } else { + crawlObjectProperties(entry, sources, resolvedStyles); } }); + } else { + crawlObjectProperties(data, sources, resolvedStyles); } - if (minver && range.test(minver)) { - return minver; - } - - return null; + resolvedStyles = Object.fromEntries(Object.entries(resolvedStyles).sort()); } -exports.validRange = validRange; +function crawlObjectProperties(entry, sources, resolvedStyles) { + const keys = Object.keys(entry); + keys.forEach(key => { + const value = entry[key]; -function validRange(range, options) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*'; - } catch (er) { - return null; - } -} // Determine if version is less than all the versions possible in the range + if (typeof value === 'string') { + if (key === value) { + // Special case; this key is the name of the style's source/file/module. + sources.add(key); + } else { + resolvedStyles[key] = getPropertyValueForStyleName(value); + } + } else { + const nestedStyle = {}; + resolvedStyles[key] = nestedStyle; + crawlData([value], sources, nestedStyle); + } + }); +} +function getPropertyValueForStyleName(styleName) { + if (cachedStyleNameToValueMap.has(styleName)) { + return cachedStyleNameToValueMap.get(styleName); + } -exports.ltr = ltr; + for (let styleSheetIndex = 0; styleSheetIndex < document.styleSheets.length; styleSheetIndex++) { + const styleSheet = document.styleSheets[styleSheetIndex]; // $FlowFixMe Flow doesn't konw about these properties -function ltr(version, range, options) { - return outside(version, range, '<', options); -} // Determine if version is greater than all the versions possible in the range. + const rules = styleSheet.rules || styleSheet.cssRules; + for (let ruleIndex = 0; ruleIndex < rules.length; ruleIndex++) { + const rule = rules[ruleIndex]; // $FlowFixMe Flow doesn't konw about these properties -exports.gtr = gtr; + const { + cssText, + selectorText, + style + } = rule; + + if (selectorText != null) { + if (selectorText.startsWith(`.${styleName}`)) { + const match = cssText.match(/{ *([a-z\-]+):/); + + if (match !== null) { + const property = match[1]; + const value = style.getPropertyValue(property); + cachedStyleNameToValueMap.set(styleName, value); + return value; + } else { + return null; + } + } + } + } + } -function gtr(version, range, options) { - return outside(version, range, '>', options); + return null; } +// EXTERNAL MODULE: ../shared/isArray.js +var shared_isArray = __webpack_require__(8); -exports.outside = outside; - -function outside(version, range, hilo, options) { - version = new SemVer(version, options); - range = new Range(range, options); - var gtfn, ltefn, ltfn, comp, ecomp; - - switch (hilo) { - case '>': - gtfn = gt; - ltefn = lte; - ltfn = lt; - comp = '>'; - ecomp = '>='; - break; - - case '<': - gtfn = lt; - ltefn = gte; - ltfn = gt; - comp = '<'; - ecomp = '<='; - break; - - default: - throw new TypeError('Must provide a hilo val of "<" or ">"'); - } // If it satisifes the range it is not outside - +// CONCATENATED MODULE: ../react-devtools-timeline/src/constants.js +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ - if (satisfies(version, range, options)) { - return false; - } // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. +const REACT_TOTAL_NUM_LANES = 31; // Increment this number any time a backwards breaking change is made to the profiler metadata. +const SCHEDULING_PROFILER_VERSION = 1; +const SNAPSHOT_MAX_HEIGHT = 60; +// CONCATENATED MODULE: ../react-devtools-shared/src/backend/profilingHooks.js +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i]; - var high = null; - var low = null; - comparators.forEach(function (comparator) { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0'); - } + // Add padding to the start/stop time of the profile. +// This makes the UI nicer to use. - high = high || comparator; - low = low || comparator; +const TIME_OFFSET = 10; +let performanceTarget = null; // If performance exists and supports the subset of the User Timing API that we require. - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator; - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator; - } - }); // If the edge version comparator has a operator then our version - // isn't outside it +let supportsUserTiming = typeof performance !== 'undefined' && typeof performance.mark === 'function' && typeof performance.clearMarks === 'function'; +let supportsUserTimingV3 = false; - if (high.operator === comp || high.operator === ecomp) { - return false; - } // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range +if (supportsUserTiming) { + const CHECK_V3_MARK = '__v3'; + const markOptions = {}; // $FlowFixMe: Ignore Flow complaining about needing a value + Object.defineProperty(markOptions, 'startTime', { + get: function () { + supportsUserTimingV3 = true; + return 0; + }, + set: function () {} + }); - if ((!low.operator || low.operator === comp) && ltefn(version, low.semver)) { - return false; - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false; - } + try { + // $FlowFixMe: Flow expects the User Timing level 2 API. + performance.mark(CHECK_V3_MARK, markOptions); + } catch (error) {// Ignore + } finally { + performance.clearMarks(CHECK_V3_MARK); } - - return true; } -exports.prerelease = prerelease; +if (supportsUserTimingV3) { + performanceTarget = performance; +} // Some environments (e.g. React Native / Hermes) don't support the performance API yet. -function prerelease(version, options) { - var parsed = parse(version, options); - return parsed && parsed.prerelease.length ? parsed.prerelease : null; -} -exports.intersects = intersects; +const getCurrentTime = typeof performance === 'object' && typeof performance.now === 'function' ? () => performance.now() : () => Date.now(); // Mocking the Performance Object (and User Timing APIs) for testing is fragile. +// This API allows tests to directly override the User Timing APIs. -function intersects(r1, r2, options) { - r1 = new Range(r1, options); - r2 = new Range(r2, options); - return r1.intersects(r2); +function setPerformanceMock_ONLY_FOR_TESTING(performanceMock) { + performanceTarget = performanceMock; + supportsUserTiming = performanceMock !== null; + supportsUserTimingV3 = performanceMock !== null; } +function createProfilingHooks({ + getDisplayNameForFiber, + getIsProfiling, + getLaneLabelMap, + reactVersion +}) { + let currentBatchUID = 0; + let currentReactComponentMeasure = null; + let currentReactMeasuresStack = []; + let currentTimelineData = null; + let isProfiling = false; + let nextRenderShouldStartNewBatch = false; -exports.coerce = coerce; + function getRelativeTime() { + const currentTime = getCurrentTime(); -function coerce(version, options) { - if (version instanceof SemVer) { - return version; - } + if (currentTimelineData) { + if (currentTimelineData.startTime === 0) { + currentTimelineData.startTime = currentTime - TIME_OFFSET; + } - if (typeof version === 'number') { - version = String(version); - } + return currentTime - currentTimelineData.startTime; + } - if (typeof version !== 'string') { - return null; + return 0; } - options = options || {}; - var match = null; + function getInternalModuleRanges() { + /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ + if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.getInternalModuleRanges === 'function') { + // Ask the DevTools hook for module ranges that may have been reported by the current renderer(s). + // Don't do this eagerly like the laneToLabelMap, + // because some modules might not yet have registered their boundaries when the renderer is injected. + const ranges = __REACT_DEVTOOLS_GLOBAL_HOOK__.getInternalModuleRanges(); // This check would not be required, + // except that it's possible for things to override __REACT_DEVTOOLS_GLOBAL_HOOK__. - if (!options.rtl) { - match = version.match(re[t.COERCE]); - } else { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - var next; - while ((next = re[t.COERCERTL].exec(version)) && (!match || match.index + match[0].length !== version.length)) { - if (!match || next.index + next[0].length !== match.index + match[0].length) { - match = next; + if (Object(shared_isArray["a" /* default */])(ranges)) { + return ranges; } + } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length; - } // leave it in a clean state - - - re[t.COERCERTL].lastIndex = -1; + return null; } - if (match === null) { - return null; + function getTimelineData() { + return currentTimelineData; } - return parse(match[2] + '.' + (match[3] || '0') + '.' + (match[4] || '0'), options); -} -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(22))) + function laneToLanesArray(lanes) { + const lanesArray = []; + let lane = 1; -/***/ }), -/* 12 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + for (let index = 0; index < REACT_TOTAL_NUM_LANES; index++) { + if (lane & lanes) { + lanesArray.push(lane); + } -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return EventEmitter; }); -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } + lane *= 2; + } -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ -class EventEmitter { - constructor() { - _defineProperty(this, "listenersMap", new Map()); + return lanesArray; } - addListener(event, listener) { - const listeners = this.listenersMap.get(event); + const laneToLabelMap = typeof getLaneLabelMap === 'function' ? getLaneLabelMap() : null; - if (listeners === undefined) { - this.listenersMap.set(event, [listener]); - } else { - const index = listeners.indexOf(listener); + function markMetadata() { + markAndClear(`--react-version-${reactVersion}`); + markAndClear(`--profiler-version-${SCHEDULING_PROFILER_VERSION}`); + const ranges = getInternalModuleRanges(); - if (index < 0) { - listeners.push(listener); + if (ranges) { + for (let i = 0; i < ranges.length; i++) { + const range = ranges[i]; + + if (Object(shared_isArray["a" /* default */])(range) && range.length === 2) { + const [startStackFrame, stopStackFrame] = ranges[i]; + markAndClear(`--react-internal-module-start-${startStackFrame}`); + markAndClear(`--react-internal-module-stop-${stopStackFrame}`); + } } } + + if (laneToLabelMap != null) { + const labels = Array.from(laneToLabelMap.values()).join(','); + markAndClear(`--react-lane-labels-${labels}`); + } } - emit(event, ...args) { - const listeners = this.listenersMap.get(event); + function markAndClear(markName) { + // This method won't be called unless these functions are defined, so we can skip the extra typeof check. + performanceTarget.mark(markName); + performanceTarget.clearMarks(markName); + } - if (listeners !== undefined) { - if (listeners.length === 1) { - // No need to clone or try/catch - const listener = listeners[0]; - listener.apply(null, args); - } else { - let didThrow = false; - let caughtError = null; - const clonedListeners = Array.from(listeners); + function recordReactMeasureStarted(type, lanes) { + // Decide what depth thi work should be rendered at, based on what's on the top of the stack. + // It's okay to render over top of "idle" work but everything else should be on its own row. + let depth = 0; - for (let i = 0; i < clonedListeners.length; i++) { - const listener = clonedListeners[i]; + if (currentReactMeasuresStack.length > 0) { + const top = currentReactMeasuresStack[currentReactMeasuresStack.length - 1]; + depth = top.type === 'render-idle' ? top.depth : top.depth + 1; + } - try { - listener.apply(null, args); - } catch (error) { - if (caughtError === null) { - didThrow = true; - caughtError = error; - } - } - } + const lanesArray = laneToLanesArray(lanes); + const reactMeasure = { + type, + batchUID: currentBatchUID, + depth, + lanes: lanesArray, + timestamp: getRelativeTime(), + duration: 0 + }; + currentReactMeasuresStack.push(reactMeasure); + + if (currentTimelineData) { + const { + batchUIDToMeasuresMap, + laneToReactMeasureMap + } = currentTimelineData; + let reactMeasures = batchUIDToMeasuresMap.get(currentBatchUID); - if (didThrow) { - throw caughtError; - } + if (reactMeasures != null) { + reactMeasures.push(reactMeasure); + } else { + batchUIDToMeasuresMap.set(currentBatchUID, [reactMeasure]); } + + lanesArray.forEach(lane => { + reactMeasures = laneToReactMeasureMap.get(lane); + + if (reactMeasures) { + reactMeasures.push(reactMeasure); + } + }); } } - removeAllListeners() { - this.listenersMap.clear(); - } + function recordReactMeasureCompleted(type) { + const currentTime = getRelativeTime(); - removeListener(event, listener) { - const listeners = this.listenersMap.get(event); + if (currentReactMeasuresStack.length === 0) { + console.error('Unexpected type "%s" completed at %sms while currentReactMeasuresStack is empty.', type, currentTime); // Ignore work "completion" user timing mark that doesn't complete anything - if (listeners !== undefined) { - const index = listeners.indexOf(listener); + return; + } - if (index >= 0) { - listeners.splice(index, 1); - } + const top = currentReactMeasuresStack.pop(); + + if (top.type !== type) { + console.error('Unexpected type "%s" completed at %sms before "%s" completed.', type, currentTime, top.type); + } // $FlowFixMe This property should not be writable outside of this function. + + + top.duration = currentTime - top.timestamp; + + if (currentTimelineData) { + currentTimelineData.duration = getRelativeTime() + TIME_OFFSET; } } -} + function markCommitStarted(lanes) { + if (isProfiling) { + recordReactMeasureStarted('commit', lanes); // TODO (timeline) Re-think this approach to "batching"; I don't think it works for Suspense or pre-rendering. + // This issue applies to the User Timing data also. -/***/ }), -/* 13 */ -/***/ (function(module, exports, __webpack_require__) { + nextRenderShouldStartNewBatch = true; + } -/* WEBPACK VAR INJECTION */(function(global) {/** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ + if (supportsUserTimingV3) { + markAndClear(`--commit-start-${lanes}`); // Some metadata only needs to be logged once per session, + // but if profiling information is being recorded via the Performance tab, + // DevTools has no way of knowing when the recording starts. + // Because of that, we log thie type of data periodically (once per commit). -/** Used as the `TypeError` message for "Functions" methods. */ -var FUNC_ERROR_TEXT = 'Expected a function'; -/** Used as references for various `Number` constants. */ + markMetadata(); + } + } -var NAN = 0 / 0; -/** `Object#toString` result references. */ + function markCommitStopped() { + if (isProfiling) { + recordReactMeasureCompleted('commit'); + recordReactMeasureCompleted('render-idle'); + } -var symbolTag = '[object Symbol]'; -/** Used to match leading and trailing whitespace. */ + if (supportsUserTimingV3) { + markAndClear('--commit-stop'); + } + } -var reTrim = /^\s+|\s+$/g; -/** Used to detect bad signed hexadecimal string values. */ + function markComponentRenderStarted(fiber) { + if (isProfiling || supportsUserTimingV3) { + const componentName = getDisplayNameForFiber(fiber) || 'Unknown'; -var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; -/** Used to detect binary string values. */ + if (isProfiling) { + // TODO (timeline) Record and cache component stack + if (isProfiling) { + currentReactComponentMeasure = { + componentName, + duration: 0, + timestamp: getRelativeTime(), + type: 'render', + warning: null + }; + } + } -var reIsBinary = /^0b[01]+$/i; -/** Used to detect octal string values. */ + if (supportsUserTimingV3) { + markAndClear(`--component-render-start-${componentName}`); + } + } + } -var reIsOctal = /^0o[0-7]+$/i; -/** Built-in method references without a dependency on `root`. */ + function markComponentRenderStopped() { + if (isProfiling) { + if (currentReactComponentMeasure) { + if (currentTimelineData) { + currentTimelineData.componentMeasures.push(currentReactComponentMeasure); + } -var freeParseInt = parseInt; -/** Detect free variable `global` from Node.js. */ + currentReactComponentMeasure.duration = getRelativeTime() - currentReactComponentMeasure.timestamp; + currentReactComponentMeasure = null; + } + } -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; -/** Detect free variable `self`. */ + if (supportsUserTimingV3) { + markAndClear('--component-render-stop'); + } + } -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; -/** Used as a reference to the global object. */ + function markComponentLayoutEffectMountStarted(fiber) { + if (isProfiling || supportsUserTimingV3) { + const componentName = getDisplayNameForFiber(fiber) || 'Unknown'; -var root = freeGlobal || freeSelf || Function('return this')(); -/** Used for built-in method references. */ + if (isProfiling) { + // TODO (timeline) Record and cache component stack + if (isProfiling) { + currentReactComponentMeasure = { + componentName, + duration: 0, + timestamp: getRelativeTime(), + type: 'layout-effect-mount', + warning: null + }; + } + } -var objectProto = Object.prototype; -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ + if (supportsUserTimingV3) { + markAndClear(`--component-layout-effect-mount-start-${componentName}`); + } + } + } -var objectToString = objectProto.toString; -/* Built-in method references for those with the same name as other `lodash` methods. */ + function markComponentLayoutEffectMountStopped() { + if (isProfiling) { + if (currentReactComponentMeasure) { + if (currentTimelineData) { + currentTimelineData.componentMeasures.push(currentReactComponentMeasure); + } -var nativeMax = Math.max, - nativeMin = Math.min; -/** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ + currentReactComponentMeasure.duration = getRelativeTime() - currentReactComponentMeasure.timestamp; + currentReactComponentMeasure = null; + } + } -var now = function () { - return root.Date.now(); -}; -/** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide `options` to indicate whether `func` should be invoked on the - * leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent - * calls to the debounced function return the result of the last `func` - * invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the debounced function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=false] - * Specify invoking on the leading edge of the timeout. - * @param {number} [options.maxWait] - * The maximum time `func` is allowed to be delayed before it's invoked. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // Avoid costly calculations while the window size is in flux. - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // Invoke `sendMail` when clicked, debouncing subsequent calls. - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // Cancel the trailing debounced invocation. - * jQuery(window).on('popstate', debounced.cancel); - */ + if (supportsUserTimingV3) { + markAndClear('--component-layout-effect-mount-stop'); + } + } + function markComponentLayoutEffectUnmountStarted(fiber) { + if (isProfiling || supportsUserTimingV3) { + const componentName = getDisplayNameForFiber(fiber) || 'Unknown'; -function debounce(func, wait, options) { - var lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime, - lastInvokeTime = 0, - leading = false, - maxing = false, - trailing = true; + if (isProfiling) { + // TODO (timeline) Record and cache component stack + if (isProfiling) { + currentReactComponentMeasure = { + componentName, + duration: 0, + timestamp: getRelativeTime(), + type: 'layout-effect-unmount', + warning: null + }; + } + } - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); + if (supportsUserTimingV3) { + markAndClear(`--component-layout-effect-unmount-start-${componentName}`); + } + } } - wait = toNumber(wait) || 0; + function markComponentLayoutEffectUnmountStopped() { + if (isProfiling) { + if (currentReactComponentMeasure) { + if (currentTimelineData) { + currentTimelineData.componentMeasures.push(currentReactComponentMeasure); + } - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; + currentReactComponentMeasure.duration = getRelativeTime() - currentReactComponentMeasure.timestamp; + currentReactComponentMeasure = null; + } + } + + if (supportsUserTimingV3) { + markAndClear('--component-layout-effect-unmount-stop'); + } } - function invokeFunc(time) { - var args = lastArgs, - thisArg = lastThis; - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; + function markComponentPassiveEffectMountStarted(fiber) { + if (isProfiling || supportsUserTimingV3) { + const componentName = getDisplayNameForFiber(fiber) || 'Unknown'; + + if (isProfiling) { + // TODO (timeline) Record and cache component stack + if (isProfiling) { + currentReactComponentMeasure = { + componentName, + duration: 0, + timestamp: getRelativeTime(), + type: 'passive-effect-mount', + warning: null + }; + } + } + + if (supportsUserTimingV3) { + markAndClear(`--component-passive-effect-mount-start-${componentName}`); + } + } } - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; // Start the timer for the trailing edge. + function markComponentPassiveEffectMountStopped() { + if (isProfiling) { + if (currentReactComponentMeasure) { + if (currentTimelineData) { + currentTimelineData.componentMeasures.push(currentReactComponentMeasure); + } - timerId = setTimeout(timerExpired, wait); // Invoke the leading edge. + currentReactComponentMeasure.duration = getRelativeTime() - currentReactComponentMeasure.timestamp; + currentReactComponentMeasure = null; + } + } - return leading ? invokeFunc(time) : result; + if (supportsUserTimingV3) { + markAndClear('--component-passive-effect-mount-stop'); + } } - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime, - result = wait - timeSinceLastCall; - return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; + function markComponentPassiveEffectUnmountStarted(fiber) { + if (isProfiling || supportsUserTimingV3) { + const componentName = getDisplayNameForFiber(fiber) || 'Unknown'; + + if (isProfiling) { + // TODO (timeline) Record and cache component stack + if (isProfiling) { + currentReactComponentMeasure = { + componentName, + duration: 0, + timestamp: getRelativeTime(), + type: 'passive-effect-unmount', + warning: null + }; + } + } + + if (supportsUserTimingV3) { + markAndClear(`--component-passive-effect-unmount-start-${componentName}`); + } + } } - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime; // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. + function markComponentPassiveEffectUnmountStopped() { + if (isProfiling) { + if (currentReactComponentMeasure) { + if (currentTimelineData) { + currentTimelineData.componentMeasures.push(currentReactComponentMeasure); + } + + currentReactComponentMeasure.duration = getRelativeTime() - currentReactComponentMeasure.timestamp; + currentReactComponentMeasure = null; + } + } - return lastCallTime === undefined || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait; + if (supportsUserTimingV3) { + markAndClear('--component-passive-effect-unmount-stop'); + } } - function timerExpired() { - var time = now(); + function markComponentErrored(fiber, thrownValue, lanes) { + if (isProfiling || supportsUserTimingV3) { + const componentName = getDisplayNameForFiber(fiber) || 'Unknown'; + const phase = fiber.alternate === null ? 'mount' : 'update'; + let message = ''; - if (shouldInvoke(time)) { - return trailingEdge(time); - } // Restart the timer. + if (thrownValue !== null && typeof thrownValue === 'object' && typeof thrownValue.message === 'string') { + message = thrownValue.message; + } else if (typeof thrownValue === 'string') { + message = thrownValue; + } + if (isProfiling) { + // TODO (timeline) Record and cache component stack + if (currentTimelineData) { + currentTimelineData.thrownErrors.push({ + componentName, + message, + phase, + timestamp: getRelativeTime(), + type: 'thrown-error' + }); + } + } - timerId = setTimeout(timerExpired, remainingWait(time)); + if (supportsUserTimingV3) { + markAndClear(`--error-${componentName}-${phase}-${message}`); + } + } } - function trailingEdge(time) { - timerId = undefined; // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - - if (trailing && lastArgs) { - return invokeFunc(time); - } + const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; // $FlowFixMe: Flow cannot handle polymorphic WeakMaps - lastArgs = lastThis = undefined; - return result; - } + const wakeableIDs = new PossiblyWeakMap(); + let wakeableID = 0; - function cancel() { - if (timerId !== undefined) { - clearTimeout(timerId); + function getWakeableID(wakeable) { + if (!wakeableIDs.has(wakeable)) { + wakeableIDs.set(wakeable, wakeableID++); } - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; + return wakeableIDs.get(wakeable); } - function flush() { - return timerId === undefined ? result : trailingEdge(now()); - } + function markComponentSuspended(fiber, wakeable, lanes) { + if (isProfiling || supportsUserTimingV3) { + const eventType = wakeableIDs.has(wakeable) ? 'resuspend' : 'suspend'; + const id = getWakeableID(wakeable); + const componentName = getDisplayNameForFiber(fiber) || 'Unknown'; + const phase = fiber.alternate === null ? 'mount' : 'update'; // Following the non-standard fn.displayName convention, + // frameworks like Relay may also annotate Promises with a displayName, + // describing what operation/data the thrown Promise is related to. + // When this is available we should pass it along to the Timeline. - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); - lastArgs = arguments; - lastThis = this; - lastCallTime = time; + const displayName = wakeable.displayName || ''; + let suspenseEvent = null; - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } + if (isProfiling) { + // TODO (timeline) Record and cache component stack + suspenseEvent = { + componentName, + depth: 0, + duration: 0, + id: `${id}`, + phase, + promiseName: displayName, + resolution: 'unresolved', + timestamp: getRelativeTime(), + type: 'suspense', + warning: null + }; - if (maxing) { - // Handle invocations in a tight loop. - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); + if (currentTimelineData) { + currentTimelineData.suspenseEvents.push(suspenseEvent); + } } - } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } + if (supportsUserTimingV3) { + markAndClear(`--suspense-${eventType}-${id}-${componentName}-${phase}-${lanes}-${displayName}`); + } - return result; - } + wakeable.then(() => { + if (suspenseEvent) { + suspenseEvent.duration = getRelativeTime() - suspenseEvent.timestamp; + suspenseEvent.resolution = 'resolved'; + } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; -} -/** - * Creates a throttled function that only invokes `func` at most once per - * every `wait` milliseconds. The throttled function comes with a `cancel` - * method to cancel delayed `func` invocations and a `flush` method to - * immediately invoke them. Provide `options` to indicate whether `func` - * should be invoked on the leading and/or trailing edge of the `wait` - * timeout. The `func` is invoked with the last arguments provided to the - * throttled function. Subsequent calls to the throttled function return the - * result of the last `func` invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is - * invoked on the trailing edge of the timeout only if the throttled function - * is invoked more than once during the `wait` timeout. - * - * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred - * until to the next tick, similar to `setTimeout` with a timeout of `0`. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.throttle` and `_.debounce`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to throttle. - * @param {number} [wait=0] The number of milliseconds to throttle invocations to. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=true] - * Specify invoking on the leading edge of the timeout. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new throttled function. - * @example - * - * // Avoid excessively updating the position while scrolling. - * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); - * - * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. - * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); - * jQuery(element).on('click', throttled); - * - * // Cancel the trailing throttled invocation. - * jQuery(window).on('popstate', throttled.cancel); - */ + if (supportsUserTimingV3) { + markAndClear(`--suspense-resolved-${id}-${componentName}`); + } + }, () => { + if (suspenseEvent) { + suspenseEvent.duration = getRelativeTime() - suspenseEvent.timestamp; + suspenseEvent.resolution = 'rejected'; + } + if (supportsUserTimingV3) { + markAndClear(`--suspense-rejected-${id}-${componentName}`); + } + }); + } + } -function throttle(func, wait, options) { - var leading = true, - trailing = true; + function markLayoutEffectsStarted(lanes) { + if (isProfiling) { + recordReactMeasureStarted('layout-effects', lanes); + } - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); + if (supportsUserTimingV3) { + markAndClear(`--layout-effects-start-${lanes}`); + } } - if (isObject(options)) { - leading = 'leading' in options ? !!options.leading : leading; - trailing = 'trailing' in options ? !!options.trailing : trailing; + function markLayoutEffectsStopped() { + if (isProfiling) { + recordReactMeasureCompleted('layout-effects'); + } + + if (supportsUserTimingV3) { + markAndClear('--layout-effects-stop'); + } } - return debounce(func, wait, { - 'leading': leading, - 'maxWait': wait, - 'trailing': trailing - }); -} -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ + function markPassiveEffectsStarted(lanes) { + if (isProfiling) { + recordReactMeasureStarted('passive-effects', lanes); + } + if (supportsUserTimingV3) { + markAndClear(`--passive-effects-start-${lanes}`); + } + } -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ + function markPassiveEffectsStopped() { + if (isProfiling) { + recordReactMeasureCompleted('passive-effects'); + } + if (supportsUserTimingV3) { + markAndClear('--passive-effects-stop'); + } + } -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ + function markRenderStarted(lanes) { + if (isProfiling) { + if (nextRenderShouldStartNewBatch) { + nextRenderShouldStartNewBatch = false; + currentBatchUID++; + } // If this is a new batch of work, wrap an "idle" measure around it. + // Log it before the "render" measure to preserve the stack ordering. -function isSymbol(value) { - return typeof value == 'symbol' || isObjectLike(value) && objectToString.call(value) == symbolTag; -} -/** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ + if (currentReactMeasuresStack.length === 0 || currentReactMeasuresStack[currentReactMeasuresStack.length - 1].type !== 'render-idle') { + recordReactMeasureStarted('render-idle', lanes); + } + recordReactMeasureStarted('render', lanes); + } -function toNumber(value) { - if (typeof value == 'number') { - return value; + if (supportsUserTimingV3) { + markAndClear(`--render-start-${lanes}`); + } } - if (isSymbol(value)) { - return NAN; - } + function markRenderYielded() { + if (isProfiling) { + recordReactMeasureCompleted('render'); + } - if (isObject(value)) { - var other = typeof value.valueOf == 'function' ? value.valueOf() : value; - value = isObject(other) ? other + '' : other; + if (supportsUserTimingV3) { + markAndClear('--render-yield'); + } } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } + function markRenderStopped() { + if (isProfiling) { + recordReactMeasureCompleted('render'); + } - value = value.replace(reTrim, ''); - var isBinary = reIsBinary.test(value); - return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value; -} + if (supportsUserTimingV3) { + markAndClear('--render-stop'); + } + } -module.exports = throttle; -/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(21))) + function markRenderScheduled(lane) { + if (isProfiling) { + if (currentTimelineData) { + currentTimelineData.schedulingEvents.push({ + lanes: laneToLanesArray(lane), + timestamp: getRelativeTime(), + type: 'schedule-render', + warning: null + }); + } + } -/***/ }), -/* 14 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { + if (supportsUserTimingV3) { + markAndClear(`--schedule-render-${lane}`); + } + } -"use strict"; + function markForceUpdateScheduled(fiber, lane) { + if (isProfiling || supportsUserTimingV3) { + const componentName = getDisplayNameForFiber(fiber) || 'Unknown'; -// EXPORTS -__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ getInternalReactConstants; }); -__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ attach; }); + if (isProfiling) { + // TODO (timeline) Record and cache component stack + if (currentTimelineData) { + currentTimelineData.schedulingEvents.push({ + componentName, + lanes: laneToLanesArray(lane), + timestamp: getRelativeTime(), + type: 'schedule-force-update', + warning: null + }); + } + } -// EXTERNAL MODULE: ../react-devtools-shared/node_modules/semver/semver.js -var semver = __webpack_require__(11); + if (supportsUserTimingV3) { + markAndClear(`--schedule-forced-update-${lane}-${componentName}`); + } + } + } -// EXTERNAL MODULE: ../react-devtools-shared/src/types.js -var types = __webpack_require__(0); + function markStateUpdateScheduled(fiber, lane) { + if (isProfiling || supportsUserTimingV3) { + const componentName = getDisplayNameForFiber(fiber) || 'Unknown'; -// EXTERNAL MODULE: ../react-devtools-shared/src/utils.js + 1 modules -var utils = __webpack_require__(1); + if (isProfiling) { + // TODO (timeline) Record and cache component stack + if (currentTimelineData) { + currentTimelineData.schedulingEvents.push({ + componentName, + lanes: laneToLanesArray(lane), + timestamp: getRelativeTime(), + type: 'schedule-state-update', + warning: null + }); + } + } -// EXTERNAL MODULE: ../react-devtools-shared/src/storage.js -var storage = __webpack_require__(5); + if (supportsUserTimingV3) { + markAndClear(`--schedule-state-update-${lane}-${componentName}`); + } + } + } -// EXTERNAL MODULE: ../react-devtools-shared/src/backend/utils.js -var backend_utils = __webpack_require__(4); + function toggleProfilingStatus(value) { + if (isProfiling !== value) { + isProfiling = value; -// EXTERNAL MODULE: ../react-devtools-shared/src/constants.js -var constants = __webpack_require__(2); + if (isProfiling) { + const internalModuleSourceToRanges = new Map(); -// EXTERNAL MODULE: /home/marvin/Misc/projects/replay/react/build/node_modules/react-debug-tools/index.js -var react_debug_tools = __webpack_require__(19); + if (supportsUserTimingV3) { + const ranges = getInternalModuleRanges(); -// EXTERNAL MODULE: ../react-devtools-shared/src/backend/console.js + 3 modules -var backend_console = __webpack_require__(10); + if (ranges) { + for (let i = 0; i < ranges.length; i++) { + const range = ranges[i]; -// EXTERNAL MODULE: ../react-devtools-shared/src/backend/ReactSymbols.js -var ReactSymbols = __webpack_require__(3); + if (Object(shared_isArray["a" /* default */])(range) && range.length === 2) { + const [startStackFrame, stopStackFrame] = ranges[i]; + markAndClear(`--react-internal-module-start-${startStackFrame}`); + markAndClear(`--react-internal-module-stop-${stopStackFrame}`); + } + } + } + } -// CONCATENATED MODULE: ../react-devtools-shared/src/config/DevToolsFeatureFlags.extension-oss.js -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ + const laneToReactMeasureMap = new Map(); + let lane = 1; -/************************************************************************ - * This file is forked between different DevTools implementations. - * It should never be imported directly! - * It should always be imported from "react-devtools-feature-flags". - ************************************************************************/ -const enableProfilerChangedHookIndices = true; -const isInternalFacebookBuild = false; -/************************************************************************ - * Do not edit the code below. - * It ensures this fork exports the same types as the default flags file. - ************************************************************************/ + for (let index = 0; index < REACT_TOTAL_NUM_LANES; index++) { + laneToReactMeasureMap.set(lane, []); + lane *= 2; + } -// eslint-disable-next-line no-unused-expressions -null; -// CONCATENATED MODULE: ../shared/objectIs.js -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ + currentBatchUID = 0; + currentReactComponentMeasure = null; + currentReactMeasuresStack = []; + currentTimelineData = { + // Session wide metadata; only collected once. + internalModuleSourceToRanges, + laneToLabelMap: laneToLabelMap || new Map(), + reactVersion, + // Data logged by React during profiling session. + componentMeasures: [], + schedulingEvents: [], + suspenseEvents: [], + thrownErrors: [], + // Data inferred based on what React logs. + batchUIDToMeasuresMap: new Map(), + duration: 0, + laneToReactMeasureMap, + startTime: 0, + // Data only available in Chrome profiles. + flamechart: [], + nativeEvents: [], + networkMeasures: [], + otherUserTimingMarks: [], + snapshots: [], + snapshotHeight: 0 + }; + nextRenderShouldStartNewBatch = true; + } + } + } -/** - * inlined Object.is polyfill to avoid requiring consumers ship their own - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is - */ -function is(x, y) { - return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare - ; + return { + getTimelineData, + profilingHooks: { + markCommitStarted, + markCommitStopped, + markComponentRenderStarted, + markComponentRenderStopped, + markComponentPassiveEffectMountStarted, + markComponentPassiveEffectMountStopped, + markComponentPassiveEffectUnmountStarted, + markComponentPassiveEffectUnmountStopped, + markComponentLayoutEffectMountStarted, + markComponentLayoutEffectMountStopped, + markComponentLayoutEffectUnmountStarted, + markComponentLayoutEffectUnmountStopped, + markComponentErrored, + markComponentSuspended, + markLayoutEffectsStarted, + markLayoutEffectsStopped, + markPassiveEffectsStarted, + markPassiveEffectsStopped, + markRenderStarted, + markRenderYielded, + markRenderStopped, + markRenderScheduled, + markForceUpdateScheduled, + markStateUpdateScheduled + }, + toggleProfilingStatus + }; } - -const objectIs = typeof Object.is === 'function' ? Object.is : is; -/* harmony default export */ var shared_objectIs = (objectIs); -// EXTERNAL MODULE: ../shared/isArray.js -var isArray = __webpack_require__(9); - // CONCATENATED MODULE: ../react-devtools-shared/src/backend/renderer.js /** * Copyright (c) Facebook, Inc. and its affiliates. @@ -5074,20 +5863,23 @@ var isArray = __webpack_require__(9); + + function getFiberFlags(fiber) { // The name of this field changed from "effectTag" to "flags" return fiber.flags !== undefined ? fiber.flags : fiber.effectTag; } // Some environments (e.g. React Native / Hermes) don't support the performance API yet. -const getCurrentTime = typeof performance === 'object' && typeof performance.now === 'function' ? () => performance.now() : () => Date.now(); +const renderer_getCurrentTime = typeof performance === 'object' && typeof performance.now === 'function' ? () => performance.now() : () => Date.now(); function getInternalReactConstants(version) { const ReactTypeOfSideEffect = { DidCapture: 0b10000000, NoFlags: 0b00, PerformedWork: 0b01, Placement: 0b10, - Incomplete: 0b10000000000000 + Incomplete: 0b10000000000000, + Hydrating: 0b1000000000000 }; // ********************************************************** // The section below is copied from files in React repo. // Keep it in sync, and add version guards if it changes. @@ -5116,6 +5908,19 @@ function getInternalReactConstants(version) { }; } + let StrictModeBits = 0; + + if (Object(semver["gte"])(version, '18.0.0-alpha')) { + // 18+ + StrictModeBits = 0b011000; + } else if (Object(semver["gte"])(version, '16.9.0')) { + // 16.9 - 17 + StrictModeBits = 0b1; + } else if (Object(semver["gte"])(version, '16.3.0')) { + // 16.3 - 16.8 + StrictModeBits = 0b10; + } + let ReactTypeOfWork = null; // ********************************************************** // The section below is copied from files in React repo. // Keep it in sync, and add version guards if it changes. @@ -5158,6 +5963,9 @@ function getInternalReactConstants(version) { SuspenseComponent: 13, SuspenseListComponent: 19, // Experimental + TracingMarkerComponent: 25, + // Experimental - This is technically in 18 but we don't + // want to fork again so we're adding it here instead YieldComponent: -1 // Removed }; @@ -5196,6 +6004,8 @@ function getInternalReactConstants(version) { SuspenseComponent: 13, SuspenseListComponent: 19, // Experimental + TracingMarkerComponent: -1, + // Doesn't exist yet YieldComponent: -1 // Removed }; @@ -5234,6 +6044,8 @@ function getInternalReactConstants(version) { SuspenseComponent: 13, SuspenseListComponent: 19, // Experimental + TracingMarkerComponent: -1, + // Doesn't exist yet YieldComponent: -1 // Removed }; @@ -5276,6 +6088,8 @@ function getInternalReactConstants(version) { SuspenseComponent: 16, SuspenseListComponent: -1, // Doesn't exist yet + TracingMarkerComponent: -1, + // Doesn't exist yet YieldComponent: -1 // Removed }; @@ -5316,6 +6130,8 @@ function getInternalReactConstants(version) { SuspenseComponent: 16, SuspenseListComponent: -1, // Doesn't exist yet + TracingMarkerComponent: -1, + // Doesn't exist yet YieldComponent: 9 }; } // ********************************************************** @@ -5349,7 +6165,8 @@ function getInternalReactConstants(version) { ScopeComponent, SimpleMemoComponent, SuspenseComponent, - SuspenseListComponent + SuspenseListComponent, + TracingMarkerComponent } = ReactTypeOfWork; function resolveFiberType(type) { @@ -5402,6 +6219,12 @@ function getInternalReactConstants(version) { return type && type.displayName || Object(utils["f" /* getDisplayName */])(resolvedType, 'Anonymous'); case HostRoot: + const fiberRoot = fiber.stateNode; + + if (fiberRoot != null && fiberRoot._debugRootType !== null) { + return fiberRoot._debugRootType; + } + return null; case HostComponent: @@ -5440,6 +6263,9 @@ function getInternalReactConstants(version) { case Profiler: return 'Profiler'; + case TracingMarkerComponent: + return 'TracingMarker'; + default: const typeSymbol = getTypeSymbol(type); @@ -5459,6 +6285,7 @@ function getInternalReactConstants(version) { case ReactSymbols["c" /* CONTEXT_NUMBER */]: case ReactSymbols["d" /* CONTEXT_SYMBOL_STRING */]: + case ReactSymbols["r" /* SERVER_CONTEXT_SYMBOL_STRING */]: // 16.3-16.5 read from "type" because the Consumer is the actual context object. // 16.6+ should read from "type._context" because Consumer can be different (in DEV). // NOTE Keep in sync with inspectElementRaw() @@ -5467,8 +6294,8 @@ function getInternalReactConstants(version) { return `${resolvedContext.displayName || 'Context'}.Consumer`; - case ReactSymbols["r" /* STRICT_MODE_NUMBER */]: - case ReactSymbols["s" /* STRICT_MODE_SYMBOL_STRING */]: + case ReactSymbols["s" /* STRICT_MODE_NUMBER */]: + case ReactSymbols["t" /* STRICT_MODE_SYMBOL_STRING */]: return null; case ReactSymbols["l" /* PROFILER_NUMBER */]: @@ -5493,9 +6320,19 @@ function getInternalReactConstants(version) { getTypeSymbol, ReactPriorityLevels, ReactTypeOfWork, - ReactTypeOfSideEffect + ReactTypeOfSideEffect, + StrictModeBits }; -} +} // Map of one or more Fibers in a pair to their unique id number. +// We track both Fibers to support Fast Refresh, +// which may forcefully replace one of the pair as part of hot reloading. +// In that case it's still important to be able to locate the previous ID during subsequent renders. + +const fiberToIDMap = new Map(); // Map of id to one (arbitrary) Fiber in a pair. +// This Map is used to e.g. get the display name for a Fiber or schedule an update, +// operations that should be the same whether the current and work-in-progress Fiber is used. + +const idToArbitraryFiberMap = new Map(); function attach(hook, rendererID, renderer, global) { // Newer versions of the reconciler package also specific reconciler version. // If that version number is present, use it. @@ -5507,11 +6344,12 @@ function attach(hook, rendererID, renderer, global) { getTypeSymbol, ReactPriorityLevels, ReactTypeOfWork, - ReactTypeOfSideEffect + ReactTypeOfSideEffect, + StrictModeBits } = getInternalReactConstants(version); const { DidCapture, - Incomplete, + Hydrating, NoFlags, PerformedWork, Placement @@ -5535,7 +6373,8 @@ function attach(hook, rendererID, renderer, global) { OffscreenComponent, SimpleMemoComponent, SuspenseComponent, - SuspenseListComponent + SuspenseListComponent, + TracingMarkerComponent } = ReactTypeOfWork; const { ImmediatePriority, @@ -5546,6 +6385,8 @@ function attach(hook, rendererID, renderer, global) { NoPriority } = ReactPriorityLevels; const { + getLaneLabelMap, + injectProfilingHooks, overrideHookState, overrideHookStateDeletePath, overrideHookStateRenamePath, @@ -5574,6 +6415,23 @@ function attach(hook, rendererID, renderer, global) { return scheduleRefresh(...args); } }; + } + + let getTimelineData = null; + let toggleProfilingStatus = null; + + if (typeof injectProfilingHooks === 'function') { + const response = createProfilingHooks({ + getDisplayNameForFiber, + getIsProfiling: () => isProfiling, + getLaneLabelMap, + reactVersion: version + }); // Pass the Profiling hooks to the reconciler for it to call during render. + + injectProfilingHooks(response.profilingHooks); // Hang onto this toggle so we can notify the external methods of profiling status changes. + + getTimelineData = response.getTimelineData; + toggleProfilingStatus = response.toggleProfilingStatus; } // Tracks Fibers with recently changed number of error/warning messages. // These collections store the Fiber rather than the ID, // in order to avoid generating an ID for Fibers that never get mounted @@ -5659,7 +6517,7 @@ function attach(hook, rendererID, renderer, global) { const message = Object(backend_utils["f" /* format */])(...args); - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { debug('onErrorOrWarning', fiber, null, `${type}: "${message}"`); } // Mark this Fiber as needed its warning/error count updated during the next flush. @@ -5691,25 +6549,26 @@ function attach(hook, rendererID, renderer, global) { if (true) { - Object(backend_console["b" /* registerRenderer */])(renderer, onErrorOrWarning); // The renderer interface can't read these preferences directly, + Object(backend_console["c" /* registerRenderer */])(renderer, onErrorOrWarning); // The renderer interface can't read these preferences directly, // because it is stored in localStorage within the context of the extension. // It relies on the extension to pass the preference through via the global. const appendComponentStack = window.__REACT_DEVTOOLS_APPEND_COMPONENT_STACK__ !== false; const breakOnConsoleErrors = window.__REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__ === true; const showInlineWarningsAndErrors = window.__REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__ !== false; - - if (appendComponentStack || breakOnConsoleErrors || showInlineWarningsAndErrors) { - Object(backend_console["a" /* patch */])({ - appendComponentStack, - breakOnConsoleErrors, - showInlineWarningsAndErrors - }); - } + const hideConsoleLogsInStrictMode = window.__REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__ === true; + const browserTheme = window.__REACT_DEVTOOLS_BROWSER_THEME__; + Object(backend_console["a" /* patch */])({ + appendComponentStack, + breakOnConsoleErrors, + showInlineWarningsAndErrors, + hideConsoleLogsInStrictMode, + browserTheme + }); } const debug = (name, fiber, parentFiber, extraString = '') => { - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { const displayName = fiber.tag + ':' + (getDisplayNameForFiber(fiber) || 'null'); const maybeID = getFiberIDUnsafe(fiber) || ''; const parentDisplayName = parentFiber ? parentFiber.tag + ':' + (getDisplayNameForFiber(parentFiber) || 'null') : ''; @@ -5798,7 +6657,7 @@ function attach(hook, rendererID, renderer, global) { // 1. It avoids sending unnecessary bridge traffic to clear a root. // 2. It preserves Fiber IDs when remounting (below) which in turn ID to error/warning mapping. - pushOperation(constants["j" /* TREE_OPERATION_REMOVE_ROOT */]); + pushOperation(constants["n" /* TREE_OPERATION_REMOVE_ROOT */]); flushPendingEvents(root); currentRootID = -1; }); @@ -5853,8 +6712,8 @@ function attach(hook, rendererID, renderer, global) { case ReactSymbols["a" /* CONCURRENT_MODE_NUMBER */]: case ReactSymbols["b" /* CONCURRENT_MODE_SYMBOL_STRING */]: case ReactSymbols["e" /* DEPRECATED_ASYNC_MODE_SYMBOL_STRING */]: - case ReactSymbols["r" /* STRICT_MODE_NUMBER */]: - case ReactSymbols["s" /* STRICT_MODE_SYMBOL_STRING */]: + case ReactSymbols["s" /* STRICT_MODE_NUMBER */]: + case ReactSymbols["t" /* STRICT_MODE_SYMBOL_STRING */]: return true; default: @@ -5937,6 +6796,9 @@ function attach(hook, rendererID, renderer, global) { case SuspenseListComponent: return types["o" /* ElementTypeSuspenseList */]; + case TracingMarkerComponent: + return types["p" /* ElementTypeTracingMarker */]; + default: const typeSymbol = getTypeSymbol(type); @@ -5954,8 +6816,8 @@ function attach(hook, rendererID, renderer, global) { case ReactSymbols["d" /* CONTEXT_SYMBOL_STRING */]: return types["f" /* ElementTypeContext */]; - case ReactSymbols["r" /* STRICT_MODE_NUMBER */]: - case ReactSymbols["s" /* STRICT_MODE_SYMBOL_STRING */]: + case ReactSymbols["s" /* STRICT_MODE_NUMBER */]: + case ReactSymbols["t" /* STRICT_MODE_SYMBOL_STRING */]: return types["k" /* ElementTypeOtherOrUnknown */]; case ReactSymbols["l" /* PROFILER_NUMBER */]: @@ -5967,21 +6829,12 @@ function attach(hook, rendererID, renderer, global) { } } - } // Map of one or more Fibers in a pair to their unique id number. - // We track both Fibers to support Fast Refresh, - // which may forcefully replace one of the pair as part of hot reloading. - // In that case it's still important to be able to locate the previous ID during subsequent renders. - - - const fiberToIDMap = new Map(); // Map of id to one (arbitrary) Fiber in a pair. - // This Map is used to e.g. get the display name for a Fiber or schedule an update, - // operations that should be the same whether the current and work-in-progress Fiber is used. - - const idToArbitraryFiberMap = new Map(); // When profiling is supported, we store the latest tree base durations for each Fiber. + } // When profiling is supported, we store the latest tree base durations for each Fiber. // This is so that we can quickly capture a snapshot of those values if profiling starts. // If we didn't store these values, we'd have to crawl the tree when profiling started, // and use a slow path to find each of the current Fibers. + const idToTreeBaseDurationMap = new Map(); // When profiling is supported, we store the latest tree base durations for each Fiber. // This map enables us to filter these times by root when sending them to the frontend. @@ -6033,7 +6886,7 @@ function attach(hook, rendererID, renderer, global) { } } - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { if (didGenerateID) { debug('getOrGenerateFiberID()', fiber, fiber.return, 'Generated a new UID'); } @@ -6074,7 +6927,7 @@ function attach(hook, rendererID, renderer, global) { function untrackFiberID(fiber) { - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { debug('untrackFiberID()', fiber, fiber.return, 'schedule after delay'); } // Untrack Fibers after a slight delay in order to support a Fast Refresh edge case: // 1. Component type is updated and Fast Refresh schedules an update+remount. @@ -6092,7 +6945,14 @@ function attach(hook, rendererID, renderer, global) { // and give React time to process the Fast Refresh delay. - untrackFibersSet.add(fiber); + untrackFibersSet.add(fiber); // React may detach alternate pointers during unmount; + // Since our untracking code is async, we should explicily track the pending alternate here as well. + + const alternate = fiber.alternate; + + if (alternate !== null) { + untrackFibersSet.add(alternate); + } if (untrackFibersTimeoutID === null) { untrackFibersTimeoutID = setTimeout(untrackFibers, 1000); @@ -6161,7 +7021,7 @@ function attach(hook, rendererID, renderer, global) { state: getChangedKeys(prevFiber.memoizedState, nextFiber.memoizedState) }; // Only traverse the hooks list once, depending on what info we're returning. - if (enableProfilerChangedHookIndices) { + if (DevToolsFeatureFlags_extension_oss["b" /* enableProfilerChangedHookIndices */]) { const indices = getChangedHooksIndices(prevFiber.memoizedState, nextFiber.memoizedState); data.hooks = indices; data.didHooksChange = indices !== null && indices.length > 0; @@ -6179,8 +7039,10 @@ function attach(hook, rendererID, renderer, global) { function updateContextsForFiber(fiber) { switch (getElementTypeForFiber(fiber)) { - case types["h" /* ElementTypeFunction */]: case types["e" /* ElementTypeClass */]: + case types["g" /* ElementTypeForwardRef */]: + case types["h" /* ElementTypeFunction */]: + case types["j" /* ElementTypeMemo */]: if (idToContextsMap !== null) { const id = getFiberIDThrows(fiber); const contexts = getContextsForFiber(fiber); @@ -6222,7 +7084,9 @@ function attach(hook, rendererID, renderer, global) { return [legacyContext, modernContext]; + case types["g" /* ElementTypeForwardRef */]: case types["h" /* ElementTypeFunction */]: + case types["j" /* ElementTypeMemo */]: const dependencies = fiber.dependencies; if (dependencies && dependencies.firstContext) { @@ -6240,12 +7104,18 @@ function attach(hook, rendererID, renderer, global) { function crawlToInitializeContextsMap(fiber) { - updateContextsForFiber(fiber); - let current = fiber.child; + const id = getFiberIDUnsafe(fiber); // Not all Fibers in the subtree have mounted yet. + // For example, Offscreen (hidden) or Suspense (suspended) subtrees won't yet be tracked. + // We can safely skip these subtrees. + + if (id !== null) { + updateContextsForFiber(fiber); + let current = fiber.child; - while (current !== null) { - crawlToInitializeContextsMap(current); - current = current.sibling; + while (current !== null) { + crawlToInitializeContextsMap(current); + current = current.sibling; + } } } @@ -6274,12 +7144,18 @@ function attach(hook, rendererID, renderer, global) { break; + case types["g" /* ElementTypeForwardRef */]: case types["h" /* ElementTypeFunction */]: + case types["j" /* ElementTypeMemo */]: if (nextModernContext !== NO_CONTEXT) { let prevContext = prevModernContext; let nextContext = nextModernContext; while (prevContext && nextContext) { + // Note this only works for versions of React that support this key (e.v. 18+) + // For older versions, there's no good way to read the current context value after render has completed. + // This is because React maintains a stack of context values during render, + // but by the time DevTools is called, render has finished and the stack is empty. if (!shared_objectIs(prevContext.memoizedValue, nextContext.memoizedValue)) { return true; } @@ -6301,43 +7177,33 @@ function attach(hook, rendererID, renderer, global) { return null; } - function areHookInputsEqual(nextDeps, prevDeps) { - if (prevDeps === null) { - return false; - } - - for (let i = 0; i < prevDeps.length && i < nextDeps.length; i++) { - if (shared_objectIs(nextDeps[i], prevDeps[i])) { - continue; - } + function isHookThatCanScheduleUpdate(hookObject) { + const queue = hookObject.queue; + if (!queue) { return false; } - return true; - } + const boundHasOwnProperty = shared_hasOwnProperty.bind(queue); // Detect the shape of useState() or useReducer() + // using the attributes that are unique to these hooks + // but also stable (e.g. not tied to current Lanes implementation) - function isEffect(memoizedState) { - if (memoizedState === null || typeof memoizedState !== 'object') { - return false; - } + const isStateOrReducer = boundHasOwnProperty('pending') && boundHasOwnProperty('dispatch') && typeof queue.dispatch === 'function'; // Detect useSyncExternalStore() - const { - deps - } = memoizedState; - const hasOwnProperty = Object.prototype.hasOwnProperty.bind(memoizedState); - return hasOwnProperty('create') && hasOwnProperty('destroy') && hasOwnProperty('deps') && hasOwnProperty('next') && hasOwnProperty('tag') && (deps === null || Object(isArray["a" /* default */])(deps)); + const isSyncExternalStore = boundHasOwnProperty('value') && boundHasOwnProperty('getSnapshot') && typeof queue.getSnapshot === 'function'; // These are the only types of hooks that can schedule an update. + + return isStateOrReducer || isSyncExternalStore; } - function didHookChange(prev, next) { + function didStatefulHookChange(prev, next) { const prevMemoizedState = prev.memoizedState; const nextMemoizedState = next.memoizedState; - if (isEffect(prevMemoizedState) && isEffect(nextMemoizedState)) { - return prevMemoizedState !== nextMemoizedState && !areHookInputsEqual(nextMemoizedState.deps, prevMemoizedState.deps); + if (isHookThatCanScheduleUpdate(prev)) { + return prevMemoizedState !== nextMemoizedState; } - return nextMemoizedState !== prevMemoizedState; + return false; } function didHooksChange(prev, next) { @@ -6348,7 +7214,7 @@ function attach(hook, rendererID, renderer, global) { if (next.hasOwnProperty('baseState') && next.hasOwnProperty('memoizedState') && next.hasOwnProperty('next') && next.hasOwnProperty('queue')) { while (next !== null) { - if (didHookChange(prev, next)) { + if (didStatefulHookChange(prev, next)) { return true; } else { next = next.next; @@ -6361,7 +7227,7 @@ function attach(hook, rendererID, renderer, global) { } function getChangedHooksIndices(prev, next) { - if (enableProfilerChangedHookIndices) { + if (DevToolsFeatureFlags_extension_oss["b" /* enableProfilerChangedHookIndices */]) { if (prev == null || next == null) { return null; } @@ -6371,7 +7237,7 @@ function attach(hook, rendererID, renderer, global) { if (next.hasOwnProperty('baseState') && next.hasOwnProperty('memoizedState') && next.hasOwnProperty('next') && next.hasOwnProperty('queue')) { while (next !== null) { - if (didHookChange(prev, next)) { + if (didStatefulHookChange(prev, next)) { indices.push(index); } @@ -6449,7 +7315,21 @@ function attach(hook, rendererID, renderer, global) { pendingOperations.push(op); } + function shouldBailoutWithPendingOperations() { + if (isProfiling) { + if (currentCommitProfilingMetadata != null && currentCommitProfilingMetadata.durations.length > 0) { + return false; + } + } + + return pendingOperations.length === 0 && pendingRealUnmountedIDs.length === 0 && pendingSimulatedUnmountedIDs.length === 0 && pendingUnmountedRootID === null; + } + function flushOrQueueOperations(operations) { + if (shouldBailoutWithPendingOperations()) { + return; + } + if (pendingOperationsQueue !== null) { pendingOperationsQueue.push(operations); } else { @@ -6479,7 +7359,7 @@ function attach(hook, rendererID, renderer, global) { recordPendingErrorsAndWarnings(); - if (pendingOperations.length === 0) { + if (shouldBailoutWithPendingOperations()) { // No warnings or errors to flush; we can bail out early here too. return; } // We can create a smaller operations array than flushPendingEvents() @@ -6560,7 +7440,7 @@ function attach(hook, rendererID, renderer, global) { } else { const errorCount = mergeMapsAndGetCountHelper(fiber, fiberID, pendingFiberToErrorsMap, fiberIDToErrorsMap); const warningCount = mergeMapsAndGetCountHelper(fiber, fiberID, pendingFiberToWarningsMap, fiberIDToWarningsMap); - pushOperation(constants["l" /* TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS */]); + pushOperation(constants["q" /* TREE_OPERATION_UPDATE_ERRORS_OR_WARNINGS */]); pushOperation(fiberID); pushOperation(errorCount); pushOperation(warningCount); @@ -6578,7 +7458,7 @@ function attach(hook, rendererID, renderer, global) { // We do this just before flushing, so we can ignore errors for no-longer-mounted Fibers. recordPendingErrorsAndWarnings(); - if (pendingOperations.length === 0 && pendingRealUnmountedIDs.length === 0 && pendingSimulatedUnmountedIDs.length === 0 && pendingUnmountedRootID === null) { + if (shouldBailoutWithPendingOperations()) { // If we aren't profiling, we can just bail out here. // No use sending an empty update over the bridge. // @@ -6587,9 +7467,7 @@ function attach(hook, rendererID, renderer, global) { // (2) the operations array for each commit // Because of this, it's important that the operations and metadata arrays align, // So it's important not to omit even empty operations while profiling is active. - if (!isProfiling) { - return; - } + return; } const numUnmountIDs = pendingRealUnmountedIDs.length + pendingSimulatedUnmountedIDs.length + (pendingUnmountedRootID === null ? 0 : 1); @@ -6611,20 +7489,23 @@ function attach(hook, rendererID, renderer, global) { // [stringTableLength, str1Length, ...str1, str2Length, ...str2, ...] operations[i++] = pendingStringTableLength; - pendingStringTable.forEach((value, key) => { - operations[i++] = key.length; - const encodedKey = Object(utils["m" /* utfEncodeString */])(key); + pendingStringTable.forEach((entry, stringKey) => { + const encodedString = entry.encodedString; // Don't use the string length. + // It won't work for multibyte characters (like emoji). - for (let j = 0; j < encodedKey.length; j++) { - operations[i + j] = encodedKey[j]; + const length = encodedString.length; + operations[i++] = length; + + for (let j = 0; j < length; j++) { + operations[i + j] = encodedString[j]; } - i += key.length; + i += length; }); if (numUnmountIDs > 0) { // All unmounts except roots are batched in a single message. - operations[i++] = constants["i" /* TREE_OPERATION_REMOVE */]; // The first number is how many unmounted IDs we're gonna send. + operations[i++] = constants["m" /* TREE_OPERATION_REMOVE */]; // The first number is how many unmounted IDs we're gonna send. operations[i++] = numUnmountIDs; // Fill in the real unmounts in the reverse order. // They were inserted parents-first by React, but we want children-first. @@ -6668,42 +7549,61 @@ function attach(hook, rendererID, renderer, global) { pendingStringTableLength = 0; } - function getStringID(str) { - if (str === null) { + function getStringID(string) { + if (string === null) { return 0; } - const existingID = pendingStringTable.get(str); + const existingEntry = pendingStringTable.get(string); - if (existingID !== undefined) { - return existingID; + if (existingEntry !== undefined) { + return existingEntry.id; } - const stringID = pendingStringTable.size + 1; - pendingStringTable.set(str, stringID); // The string table total length needs to account - // both for the string length, and for the array item - // that contains the length itself. Hence + 1. + const id = pendingStringTable.size + 1; + const encodedString = Object(utils["m" /* utfEncodeString */])(string); + pendingStringTable.set(string, { + encodedString, + id + }); // The string table total length needs to account both for the string length, + // and for the array item that contains the length itself. + // + // Don't use string length for this table. + // It won't work for multibyte characters (like emoji). - pendingStringTableLength += str.length + 1; - return stringID; + pendingStringTableLength += encodedString.length + 1; + return id; } function recordMount(fiber, parentFiber) { const isRoot = fiber.tag === HostRoot; const id = getOrGenerateFiberID(fiber); - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { debug('recordMount()', fiber, parentFiber); } const hasOwnerMetadata = fiber.hasOwnProperty('_debugOwner'); - const isProfilingSupported = fiber.hasOwnProperty('treeBaseDuration'); + const isProfilingSupported = fiber.hasOwnProperty('treeBaseDuration'); // Adding a new field here would require a bridge protocol version bump (a backwads breaking change). + // Instead let's re-purpose a pre-existing field to carry more information. + + let profilingFlags = 0; + + if (isProfilingSupported) { + profilingFlags = constants["g" /* PROFILING_FLAG_BASIC_SUPPORT */]; + + if (typeof injectProfilingHooks === 'function') { + profilingFlags |= constants["h" /* PROFILING_FLAG_TIMELINE_SUPPORT */]; + } + } if (isRoot) { - pushOperation(constants["h" /* TREE_OPERATION_ADD */]); + pushOperation(constants["l" /* TREE_OPERATION_ADD */]); pushOperation(id); pushOperation(types["m" /* ElementTypeRoot */]); - pushOperation(isProfilingSupported ? 1 : 0); + pushOperation((fiber.mode & StrictModeBits) !== 0 ? 1 : 0); + pushOperation(profilingFlags); + pushOperation(StrictModeBits !== 0 ? 1 : 0); pushOperation(hasOwnerMetadata ? 1 : 0); if (isProfiling) { @@ -6730,15 +7630,21 @@ function attach(hook, rendererID, renderer, global) { const displayNameStringID = getStringID(displayName); // This check is a guard to handle a React element that has been modified // in such a way as to bypass the default stringification of the "key" property. - const keyString = key === null ? null : '' + key; + const keyString = key === null ? null : String(key); const keyStringID = getStringID(keyString); - pushOperation(constants["h" /* TREE_OPERATION_ADD */]); + pushOperation(constants["l" /* TREE_OPERATION_ADD */]); pushOperation(id); pushOperation(elementType); pushOperation(parentID); pushOperation(ownerID); pushOperation(displayNameStringID); - pushOperation(keyStringID); + pushOperation(keyStringID); // If this subtree has a new mode, let the frontend know. + + if ((fiber.mode & StrictModeBits) !== 0 && (parentFiber.mode & StrictModeBits) === 0) { + pushOperation(constants["p" /* TREE_OPERATION_SET_SUBTREE_MODE */]); + pushOperation(id); + pushOperation(types["q" /* StrictMode */]); + } } if (isProfilingSupported) { @@ -6748,7 +7654,7 @@ function attach(hook, rendererID, renderer, global) { } function recordUnmount(fiber, isSimulated) { - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { debug('recordUnmount()', fiber, null, isSimulated ? 'unmount is simulated' : ''); } @@ -6813,7 +7719,7 @@ function attach(hook, rendererID, renderer, global) { // Generate an ID even for filtered Fibers, in case it's needed later (e.g. for Profiling). getOrGenerateFiberID(fiber); - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { debug('mountFiberRecursively()', fiber, parentFiber); } // If we have the tree selection from previous reload, try to match this Fiber. // Also remember whether to do the same for siblings. @@ -6885,7 +7791,7 @@ function attach(hook, rendererID, renderer, global) { function unmountFiberChildrenRecursively(fiber) { - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { debug('unmountFiberChildrenRecursively()', fiber); } // We might meet a nested Suspense on our way. @@ -6931,7 +7837,7 @@ function attach(hook, rendererID, renderer, global) { // Tree base duration updates are included in the operations typed array. // So we have to convert them from milliseconds to microseconds so we can send them as ints. const convertedTreeBaseDuration = Math.floor((treeBaseDuration || 0) * 1000); - pushOperation(constants["m" /* TREE_OPERATION_UPDATE_TREE_BASE_DURATION */]); + pushOperation(constants["r" /* TREE_OPERATION_UPDATE_TREE_BASE_DURATION */]); pushOperation(id); pushOperation(convertedTreeBaseDuration); } @@ -6977,7 +7883,7 @@ function attach(hook, rendererID, renderer, global) { } function recordResetChildren(fiber, childSet) { - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { debug('recordResetChildren()', childSet, fiber); } // The frontend only really cares about the displayName, key, and children. // The first two don't really change, so we are only concerned with the order of children here. @@ -7001,7 +7907,7 @@ function attach(hook, rendererID, renderer, global) { return; } - pushOperation(constants["k" /* TREE_OPERATION_REORDER_CHILDREN */]); + pushOperation(constants["o" /* TREE_OPERATION_REORDER_CHILDREN */]); pushOperation(getFiberIDThrows(fiber)); pushOperation(numChildren); @@ -7041,7 +7947,7 @@ function attach(hook, rendererID, renderer, global) { function updateFiberRecursively(nextFiber, prevFiber, parentFiber, traceNearestHostComponentUpdate) { const id = getOrGenerateFiberID(nextFiber); - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { debug('updateFiberRecursively()', nextFiber, parentFiber); } @@ -7265,7 +8171,7 @@ function attach(hook, rendererID, renderer, global) { currentCommitProfilingMetadata = { changeDescriptions: recordChangeDescriptions ? new Map() : null, durations: [], - commitTime: getCurrentTime() - profilingStartTime, + commitTime: renderer_getCurrentTime() - profilingStartTime, maxActualDuration: 0, priorityLevel: null, updaters: getUpdatersList(root), @@ -7282,7 +8188,7 @@ function attach(hook, rendererID, renderer, global) { } function getUpdatersList(root) { - return root.memoizedUpdaters != null ? Array.from(root.memoizedUpdaters).map(fiberToSerializedElement) : null; + return root.memoizedUpdaters != null ? Array.from(root.memoizedUpdaters).filter(fiber => getFiberIDUnsafe(fiber) !== null).map(fiberToSerializedElement) : null; } function handleCommitFiberUnmount(fiber) { @@ -7331,7 +8237,7 @@ function attach(hook, rendererID, renderer, global) { currentCommitProfilingMetadata = { changeDescriptions: recordChangeDescriptions ? new Map() : null, durations: [], - commitTime: getCurrentTime() - profilingStartTime, + commitTime: renderer_getCurrentTime() - profilingStartTime, maxActualDuration: 0, priorityLevel: priorityLevel == null ? null : formatPriorityLevel(priorityLevel), updaters: getUpdatersList(root), @@ -7344,8 +8250,10 @@ function attach(hook, rendererID, renderer, global) { if (alternate) { // TODO: relying on this seems a bit fishy. - const wasMounted = alternate.memoizedState != null && alternate.memoizedState.element != null; - const isMounted = current.memoizedState != null && current.memoizedState.element != null; + const wasMounted = alternate.memoizedState != null && alternate.memoizedState.element != null && // A dehydrated root is not considered mounted + alternate.memoizedState.isDehydrated !== true; + const isMounted = current.memoizedState != null && current.memoizedState.element != null && // A dehydrated root is not considered mounted + current.memoizedState.isDehydrated !== true; if (!wasMounted && isMounted) { // Mount a new root. @@ -7366,12 +8274,14 @@ function attach(hook, rendererID, renderer, global) { } if (isProfiling && isProfilingSupported) { - const commitProfilingMetadata = rootToCommitProfilingMetadataMap.get(currentRootID); + if (!shouldBailoutWithPendingOperations()) { + const commitProfilingMetadata = rootToCommitProfilingMetadataMap.get(currentRootID); - if (commitProfilingMetadata != null) { - commitProfilingMetadata.push(currentCommitProfilingMetadata); - } else { - rootToCommitProfilingMetadataMap.set(currentRootID, [currentCommitProfilingMetadata]); + if (commitProfilingMetadata != null) { + commitProfilingMetadata.push(currentCommitProfilingMetadata); + } else { + rootToCommitProfilingMetadataMap.set(currentRootID, [currentCommitProfilingMetadata]); + } } } // We're done here. @@ -7474,55 +8384,39 @@ function attach(hook, rendererID, renderer, global) { } return null; - } + } // This function is copied from React and should be kept in sync: + // https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberTreeReflection.js + - const MOUNTING = 1; - const MOUNTED = 2; - const UNMOUNTED = 3; // This function is copied from React and should be kept in sync: + function assertIsMounted(fiber) { + if (getNearestMountedFiber(fiber) !== fiber) { + throw new Error('Unable to find node on an unmounted component.'); + } + } // This function is copied from React and should be kept in sync: // https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberTreeReflection.js - function isFiberMountedImpl(fiber) { + + function getNearestMountedFiber(fiber) { let node = fiber; - let prevNode = null; + let nearestMounted = fiber; if (!fiber.alternate) { // If there is no alternate, this might be a new tree that isn't inserted // yet. If it is, then it will have a pending insertion effect on it. - if ((getFiberFlags(node) & Placement) !== NoFlags) { - return MOUNTING; - } // This indicates an error during render. - - - if ((getFiberFlags(node) & Incomplete) !== NoFlags) { - return UNMOUNTED; - } + let nextNode = node; - while (node.return) { - prevNode = node; - node = node.return; - - if ((getFiberFlags(node) & Placement) !== NoFlags) { - return MOUNTING; - } // This indicates an error during render. - - - if ((getFiberFlags(node) & Incomplete) !== NoFlags) { - return UNMOUNTED; - } // If this node is inside of a timed out suspense subtree, we should also ignore errors/warnings. - - - const isTimedOutSuspense = node.tag === SuspenseComponent && node.memoizedState !== null; - - if (isTimedOutSuspense) { - // Note that this does not include errors/warnings in the Fallback tree though! - const primaryChildFragment = node.child; - const fallbackChildFragment = primaryChildFragment ? primaryChildFragment.sibling : null; + do { + node = nextNode; - if (prevNode !== fallbackChildFragment) { - return UNMOUNTED; - } + if ((node.flags & (Placement | Hydrating)) !== NoFlags) { + // This is an insertion or in-progress hydration. The nearest possible + // mounted fiber is the parent but we need to continue to figure out + // if that one is still mounted. + nearestMounted = node.return; } - } + + nextNode = node.return; + } while (nextNode); } else { while (node.return) { node = node.return; @@ -7532,12 +8426,12 @@ function attach(hook, rendererID, renderer, global) { if (node.tag === HostRoot) { // TODO: Check if this was a nested HostRoot when used with // renderContainerIntoSubtree. - return MOUNTED; + return nearestMounted; } // If we didn't hit the root, that means that we're in an disconnected tree // that has been unmounted. - return UNMOUNTED; + return null; } // This function is copied from React and should be kept in sync: // https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberTreeReflection.js // It would be nice if we updated React to inject this function directly (vs just indirectly via findDOMNode). @@ -7556,13 +8450,13 @@ function attach(hook, rendererID, renderer, global) { if (!alternate) { // If there is no alternate, then we only need to check if it is mounted. - const state = isFiberMountedImpl(fiber); + const nearestMounted = getNearestMountedFiber(fiber); - if (state === UNMOUNTED) { - throw Error('Unable to find node on an unmounted component.'); + if (nearestMounted === null) { + throw new Error('Unable to find node on an unmounted component.'); } - if (state === MOUNTING) { + if (nearestMounted !== fiber) { return null; } @@ -7610,19 +8504,13 @@ function attach(hook, rendererID, renderer, global) { while (child) { if (child === a) { // We've determined that A is the current branch. - if (isFiberMountedImpl(parentA) !== MOUNTED) { - throw Error('Unable to find node on an unmounted component.'); - } - + assertIsMounted(parentA); return fiber; } if (child === b) { // We've determined that B is the current branch. - if (isFiberMountedImpl(parentA) !== MOUNTED) { - throw Error('Unable to find node on an unmounted component.'); - } - + assertIsMounted(parentA); return alternate; } @@ -7631,7 +8519,7 @@ function attach(hook, rendererID, renderer, global) { // way this could possibly happen is if this was unmounted, if at all. - throw Error('Unable to find node on an unmounted component.'); + throw new Error('Unable to find node on an unmounted component.'); } if (a.return !== b.return) { @@ -7691,20 +8579,20 @@ function attach(hook, rendererID, renderer, global) { } if (!didFindChild) { - throw Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.'); + throw new Error('Child was not found in either parent set. This indicates a bug ' + 'in React related to the return pointer. Please file an issue.'); } } } if (a.alternate !== b) { - throw Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); + throw new Error("Return fibers should always be each others' alternates. " + 'This error is likely caused by a bug in React. Please file an issue.'); } } // If the root is not a host container, we're in a disconnected tree. I.e. // unmounted. if (a.tag !== HostRoot) { - throw Error('Unable to find node on an unmounted component.'); + throw new Error('Unable to find node on an unmounted component.'); } if (a.stateNode.current === a) { @@ -7993,6 +8881,16 @@ function attach(hook, rendererID, renderer, global) { targetErrorBoundaryID = getNearestErrorBoundaryID(fiber); } + const plugins = { + stylex: null + }; + + if (DevToolsFeatureFlags_extension_oss["c" /* enableStyleXFeatures */]) { + if (memoizedProps.hasOwnProperty('xstyle')) { + plugins.stylex = getStyleXData(memoizedProps.xstyle); + } + } + return { id, // Does the current renderer support editable hooks and function props? @@ -8032,7 +8930,8 @@ function attach(hook, rendererID, renderer, global) { source: _debugSource || null, rootType, rendererPackageName: renderer.rendererPackageName, - rendererVersion: renderer.version + rendererVersion: renderer.version, + plugins }; } @@ -8184,12 +9083,12 @@ function attach(hook, rendererID, renderer, global) { } } - function inspectElement(requestID, id, path) { + function inspectElement(requestID, id, path, forceFullData) { if (path !== null) { mergeInspectedPaths(path); } - if (isMostRecentlyInspectedElement(id)) { + if (isMostRecentlyInspectedElement(id) && !forceFullData) { if (!hasElementUpdatedSinceLastInspected) { if (path !== null) { let secondaryCategory = null; @@ -8222,7 +9121,19 @@ function attach(hook, rendererID, renderer, global) { } hasElementUpdatedSinceLastInspected = false; - mostRecentlyInspectedElement = inspectElementRaw(id); + + try { + mostRecentlyInspectedElement = inspectElementRaw(id); + } catch (error) { + console.error('Error inspecting element.\n\n', error); + return { + type: 'error', + id, + responseID: requestID, + message: error.message, + stack: error.stack + }; + } if (mostRecentlyInspectedElement === null) { return { @@ -8557,9 +9468,36 @@ function attach(hook, rendererID, renderer, global) { rootID }); }); + let timelineData = null; + + if (typeof getTimelineData === 'function') { + const currentTimelineData = getTimelineData(); + + if (currentTimelineData) { + const { + batchUIDToMeasuresMap, + internalModuleSourceToRanges, + laneToLabelMap, + laneToReactMeasureMap, + ...rest + } = currentTimelineData; + timelineData = { ...rest, + // Most of the data is safe to parse as-is, + // but we need to convert the nested Arrays back to Maps. + // Most of the data is safe to serialize as-is, + // but we need to convert the Maps to nested Arrays. + batchUIDToMeasuresKeyValueArray: Array.from(batchUIDToMeasuresMap.entries()), + internalModuleSourceToRanges: Array.from(internalModuleSourceToRanges.entries()), + laneToLabelKeyValueArray: Array.from(laneToLabelMap.entries()), + laneToReactMeasureKeyValueArray: Array.from(laneToReactMeasureMap.entries()) + }; + } + } + return { dataForRoots, - rendererID + rendererID, + timelineData }; } @@ -8589,18 +9527,26 @@ function attach(hook, rendererID, renderer, global) { } }); isProfiling = true; - profilingStartTime = getCurrentTime(); + profilingStartTime = renderer_getCurrentTime(); rootToCommitProfilingMetadataMap = new Map(); + + if (toggleProfilingStatus !== null) { + toggleProfilingStatus(true); + } } function stopProfiling() { isProfiling = false; recordChangeDescriptions = false; + + if (toggleProfilingStatus !== null) { + toggleProfilingStatus(false); + } } // Automatically start profiling so that we don't miss timing info from initial "mount". - if (Object(storage["c" /* sessionStorageGetItem */])(constants["g" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */]) === 'true') { - startProfiling(Object(storage["c" /* sessionStorageGetItem */])(constants["f" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */]) === 'true'); + if (Object(storage["c" /* sessionStorageGetItem */])(constants["k" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */]) === 'true') { + startProfiling(Object(storage["c" /* sessionStorageGetItem */])(constants["j" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */]) === 'true'); } // React will switch between these implementations depending on whether // we have any manually suspended/errored-out Fibers or not. @@ -8993,6 +9939,7 @@ function attach(hook, rendererID, renderer, global) { handlePostCommitFiberRoot, inspectElement, logElementToConsole, + patchConsoleForStrictMode: backend_console["b" /* patchForStrictMode */], prepareViewAttributeSource, prepareViewElementSource, overrideError, @@ -9005,12 +9952,13 @@ function attach(hook, rendererID, renderer, global) { startProfiling, stopProfiling, storeAsGlobal, + unpatchConsoleForStrictMode: backend_console["d" /* unpatchForStrictMode */], updateComponentFilters }; } /***/ }), -/* 15 */ +/* 17 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -9021,19 +9969,19 @@ __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, "default", function() { return /* binding */ agent_Agent; }); // EXTERNAL MODULE: ../react-devtools-shared/src/events.js -var events = __webpack_require__(12); +var events = __webpack_require__(13); -// EXTERNAL MODULE: /home/marvin/Misc/projects/replay/react/node_modules/lodash.throttle/index.js -var lodash_throttle = __webpack_require__(13); +// EXTERNAL MODULE: /Users/bvaughn/Documents/git/facebook/react/node_modules/lodash.throttle/index.js +var lodash_throttle = __webpack_require__(14); var lodash_throttle_default = /*#__PURE__*/__webpack_require__.n(lodash_throttle); // EXTERNAL MODULE: ../react-devtools-shared/src/constants.js -var constants = __webpack_require__(2); +var constants = __webpack_require__(1); // EXTERNAL MODULE: ../react-devtools-shared/src/storage.js var storage = __webpack_require__(5); -// CONCATENATED MODULE: /home/marvin/Misc/projects/replay/react/node_modules/memoize-one/esm/index.js +// CONCATENATED MODULE: /Users/bvaughn/Documents/git/facebook/react/node_modules/memoize-one/esm/index.js var simpleIsEqual = function simpleIsEqual(a, b) { return a === b; }; @@ -9067,10 +10015,6 @@ var simpleIsEqual = function simpleIsEqual(a, b) { return result; }); -// EXTERNAL MODULE: /home/marvin/Misc/projects/replay/react/node_modules/object-assign/index.js -var object_assign = __webpack_require__(7); -var object_assign_default = /*#__PURE__*/__webpack_require__.n(object_assign); - // CONCATENATED MODULE: ../react-devtools-shared/src/backend/views/utils.js /** * Copyright (c) Facebook, Inc. and its affiliates. @@ -9112,7 +10056,7 @@ function getBoundingClientRectWithBorderOffset(node) { right: dimensions.borderRight, // This width and height won't get used by mergeRectOffsets (since this // is not the first rect in the array), but we set them so that this - // object typechecks as a ClientRect. + // object type checks as a ClientRect. width: 0, height: 0 }]); @@ -9194,12 +10138,12 @@ function getElementDimensions(domElement) { * */ - +const Overlay_assign = Object.assign; // Note that the Overlay components are not affected by the active Theme, // because they highlight elements in the main Chrome window (outside of devtools). // The colors below were chosen to roughly match those used by Chrome devtools. -class Overlay_OverlayRect { +class OverlayRect { constructor(doc, container) { this.node = doc.createElement('div'); this.border = doc.createElement('div'); @@ -9208,7 +10152,7 @@ class Overlay_OverlayRect { this.border.style.borderColor = overlayStyles.border; this.padding.style.borderColor = overlayStyles.padding; this.content.style.backgroundColor = overlayStyles.background; - object_assign_default()(this.node.style, { + Overlay_assign(this.node.style, { borderColor: overlayStyles.margin, pointerEvents: 'none', position: 'fixed' @@ -9230,11 +10174,11 @@ class Overlay_OverlayRect { boxWrap(dims, 'margin', this.node); boxWrap(dims, 'border', this.border); boxWrap(dims, 'padding', this.padding); - object_assign_default()(this.content.style, { + Overlay_assign(this.content.style, { height: box.height - dims.borderTop - dims.borderBottom - dims.paddingTop - dims.paddingBottom + 'px', width: box.width - dims.borderLeft - dims.borderRight - dims.paddingLeft - dims.paddingRight + 'px' }); - object_assign_default()(this.node.style, { + Overlay_assign(this.node.style, { top: box.top - dims.marginTop + 'px', left: box.left - dims.marginLeft + 'px' }); @@ -9242,10 +10186,10 @@ class Overlay_OverlayRect { } -class Overlay_OverlayTip { +class OverlayTip { constructor(doc, container) { this.tip = doc.createElement('div'); - object_assign_default()(this.tip.style, { + Overlay_assign(this.tip.style, { display: 'flex', flexFlow: 'row nowrap', backgroundColor: '#333740', @@ -9260,7 +10204,7 @@ class Overlay_OverlayTip { }); this.nameSpan = doc.createElement('span'); this.tip.appendChild(this.nameSpan); - object_assign_default()(this.nameSpan.style, { + Overlay_assign(this.nameSpan.style, { color: '#ee78e6', borderRight: '1px solid #aaaaaa', paddingRight: '0.5rem', @@ -9268,7 +10212,7 @@ class Overlay_OverlayTip { }); this.dimSpan = doc.createElement('span'); this.tip.appendChild(this.dimSpan); - object_assign_default()(this.dimSpan.style, { + Overlay_assign(this.dimSpan.style, { color: '#d7d7d7' }); this.tip.style.zIndex = '10000000'; @@ -9292,7 +10236,7 @@ class Overlay_OverlayTip { width: tipRect.width, height: tipRect.height }); - object_assign_default()(this.tip.style, tipPos.style); + Overlay_assign(this.tip.style, tipPos.style); } } @@ -9308,7 +10252,7 @@ class Overlay_Overlay { const doc = currentWindow.document; this.container = doc.createElement('div'); this.container.style.zIndex = '10000000'; - this.tip = new Overlay_OverlayTip(doc, this.container); + this.tip = new OverlayTip(doc, this.container); this.rects = []; doc.body.appendChild(this.container); } @@ -9340,7 +10284,7 @@ class Overlay_Overlay { } while (this.rects.length < elements.length) { - this.rects.push(new Overlay_OverlayRect(this.window.document, this.container)); + this.rects.push(new OverlayRect(this.window.document, this.container)); } const outerBox = { @@ -9443,7 +10387,7 @@ function findTipPos(dims, bounds, tipSize) { } function boxWrap(dims, what, node) { - object_assign_default()(node.style, { + Overlay_assign(node.style, { borderTopWidth: dims[what + 'Top'] + 'px', borderLeftWidth: dims[what + 'Left'] + 'px', borderRightWidth: dims[what + 'Right'] + 'px', @@ -9873,11 +10817,11 @@ function measureNode(node) { const currentWindow = window.__REACT_DEVTOOLS_TARGET_WINDOW__ || window; return getNestedBoundingClientRect(node, currentWindow); } -// EXTERNAL MODULE: ../react-devtools-shared/src/backend/console.js + 3 modules -var backend_console = __webpack_require__(10); +// EXTERNAL MODULE: ../react-devtools-shared/src/backend/console.js +var backend_console = __webpack_require__(11); // EXTERNAL MODULE: ../react-devtools-shared/src/bridge.js -var src_bridge = __webpack_require__(16); +var src_bridge = __webpack_require__(15); // EXTERNAL MODULE: ../react-devtools-shared/src/backend/utils.js var utils = __webpack_require__(4); @@ -9904,7 +10848,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope const debug = (methodName, ...args) => { - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { console.log(`%cAgent %c${methodName}`, 'color: purple; font-weight: bold;', 'font-weight: bold;', ...args); } }; @@ -9993,6 +10937,14 @@ class agent_Agent extends events["a" /* default */] { } }); + _defineProperty(this, "getBackendVersion", () => { + const version = "4.24.3-adb8ebc92"; + + if (version) { + this._bridge.send('backendVersion', version); + } + }); + _defineProperty(this, "getBridgeProtocol", () => { this._bridge.send('bridgeProtocol', src_bridge["currentBridgeProtocol"]); }); @@ -10032,6 +10984,7 @@ class agent_Agent extends events["a" /* default */] { }); _defineProperty(this, "inspectElement", ({ + forceFullData, id, path, rendererID, @@ -10042,7 +10995,7 @@ class agent_Agent extends events["a" /* default */] { if (renderer == null) { console.warn(`Invalid renderer id "${rendererID}" for element "${id}"`); } else { - this._bridge.send('inspectedElement', renderer.inspectElement(requestID, id, path)); // When user selects an element, stop trying to restore the selection, + this._bridge.send('inspectedElement', renderer.inspectElement(requestID, id, path, forceFullData)); // When user selects an element, stop trying to restore the selection, // and instead remember the current selection for the next reload. @@ -10201,8 +11154,8 @@ class agent_Agent extends events["a" /* default */] { }); _defineProperty(this, "reloadAndProfile", recordChangeDescriptions => { - Object(storage["e" /* sessionStorageSetItem */])(constants["g" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */], 'true'); - Object(storage["e" /* sessionStorageSetItem */])(constants["f" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */], recordChangeDescriptions ? 'true' : 'false'); // This code path should only be hit if the shell has explicitly told the Store that it supports profiling. + Object(storage["e" /* sessionStorageSetItem */])(constants["k" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */], 'true'); + Object(storage["e" /* sessionStorageSetItem */])(constants["j" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */], recordChangeDescriptions ? 'true' : 'false'); // This code path should only be hit if the shell has explicitly told the Store that it supports profiling. // In that case, the shell must also listen for this specific message to know when it needs to reload the app. // The agent can't do this in a way that is renderer agnostic. @@ -10293,21 +11246,21 @@ class agent_Agent extends events["a" /* default */] { _defineProperty(this, "updateConsolePatchSettings", ({ appendComponentStack, breakOnConsoleErrors, - showInlineWarningsAndErrors + showInlineWarningsAndErrors, + hideConsoleLogsInStrictMode, + browserTheme }) => { // If the frontend preference has change, // or in the case of React Native- if the backend is just finding out the preference- - // then install or uninstall the console overrides. + // then reinstall the console overrides. // It's safe to call these methods multiple times, so we don't need to worry about that. - if (appendComponentStack || breakOnConsoleErrors || showInlineWarningsAndErrors) { - Object(backend_console["a" /* patch */])({ - appendComponentStack, - breakOnConsoleErrors, - showInlineWarningsAndErrors - }); - } else { - Object(backend_console["c" /* unpatch */])(); - } + Object(backend_console["a" /* patch */])({ + appendComponentStack, + breakOnConsoleErrors, + showInlineWarningsAndErrors, + hideConsoleLogsInStrictMode, + browserTheme + }); }); _defineProperty(this, "updateComponentFilters", componentFilters => { @@ -10349,7 +11302,7 @@ class agent_Agent extends events["a" /* default */] { }); _defineProperty(this, "onFastRefreshScheduled", () => { - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { debug('onFastRefreshScheduled'); } @@ -10357,7 +11310,7 @@ class agent_Agent extends events["a" /* default */] { }); _defineProperty(this, "onHookOperations", operations => { - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { debug('onHookOperations', `(${operations.length}) [${operations.join(', ')}]`); } // TODO: // The chrome.runtime does not currently support transferables; it forces JSON serialization. @@ -10426,23 +11379,23 @@ class agent_Agent extends events["a" /* default */] { const path = renderer != null ? renderer.getPathForElement(id) : null; if (path !== null) { - Object(storage["e" /* sessionStorageSetItem */])(constants["e" /* SESSION_STORAGE_LAST_SELECTION_KEY */], JSON.stringify({ + Object(storage["e" /* sessionStorageSetItem */])(constants["i" /* SESSION_STORAGE_LAST_SELECTION_KEY */], JSON.stringify({ rendererID, path })); } else { - Object(storage["d" /* sessionStorageRemoveItem */])(constants["e" /* SESSION_STORAGE_LAST_SELECTION_KEY */]); + Object(storage["d" /* sessionStorageRemoveItem */])(constants["i" /* SESSION_STORAGE_LAST_SELECTION_KEY */]); } }, 1000)); - if (Object(storage["c" /* sessionStorageGetItem */])(constants["g" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */]) === 'true') { - this._recordChangeDescriptions = Object(storage["c" /* sessionStorageGetItem */])(constants["f" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */]) === 'true'; + if (Object(storage["c" /* sessionStorageGetItem */])(constants["k" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */]) === 'true') { + this._recordChangeDescriptions = Object(storage["c" /* sessionStorageGetItem */])(constants["j" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */]) === 'true'; this._isProfiling = true; - Object(storage["d" /* sessionStorageRemoveItem */])(constants["f" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */]); - Object(storage["d" /* sessionStorageRemoveItem */])(constants["g" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */]); + Object(storage["d" /* sessionStorageRemoveItem */])(constants["j" /* SESSION_STORAGE_RECORD_CHANGE_DESCRIPTIONS_KEY */]); + Object(storage["d" /* sessionStorageRemoveItem */])(constants["k" /* SESSION_STORAGE_RELOAD_AND_PROFILE_KEY */]); } - const persistedSelectionString = Object(storage["c" /* sessionStorageGetItem */])(constants["e" /* SESSION_STORAGE_LAST_SELECTION_KEY */]); + const persistedSelectionString = Object(storage["c" /* sessionStorageGetItem */])(constants["i" /* SESSION_STORAGE_LAST_SELECTION_KEY */]); if (persistedSelectionString != null) { this._persistedSelection = JSON.parse(persistedSelectionString); @@ -10454,6 +11407,7 @@ class agent_Agent extends events["a" /* default */] { bridge.addListener('clearWarningsForFiberID', this.clearWarningsForFiberID); bridge.addListener('copyElementPath', this.copyElementPath); bridge.addListener('deletePath', this.deletePath); + bridge.addListener('getBackendVersion', this.getBackendVersion); bridge.addListener('getBridgeProtocol', this.getBridgeProtocol); bridge.addListener('getProfilingData', this.getProfilingData); bridge.addListener('getProfilingStatus', this.getProfilingStatus); @@ -10485,7 +11439,17 @@ class agent_Agent extends events["a" /* default */] { if (this._isProfiling) { bridge.send('profilingStatus', true); - } // Notify the frontend if the backend supports the Storage API (e.g. localStorage). + } // Send the Bridge protocol and backend versions, after initialization, in case the frontend has already requested it. + // The Store may be instantiated beore the agent. + + + const _version = "4.24.3-adb8ebc92"; + + if (_version) { + this._bridge.send('backendVersion', _version); + } + + this._bridge.send('bridgeProtocol', src_bridge["currentBridgeProtocol"]); // Notify the frontend if the backend supports the Storage API (e.g. localStorage). // If not, features like reload-and-profile will not work correctly and must be disabled. @@ -10532,278 +11496,688 @@ class agent_Agent extends events["a" /* default */] { return renderer.getInstanceAndStyle(id); } - getIDForNode(node) { - for (const rendererID in this._rendererInterfaces) { - const renderer = this._rendererInterfaces[rendererID]; + getIDForNode(node) { + for (const rendererID in this._rendererInterfaces) { + const renderer = this._rendererInterfaces[rendererID]; + + try { + const id = renderer.getFiberIDForNative(node, true); + + if (id !== null) { + return id; + } + } catch (error) {// Some old React versions might throw if they can't find a match. + // If so we should ignore it... + } + } + + return null; + } + + selectNode(target) { + const id = this.getIDForNode(target); + + if (id !== null) { + this._bridge.send('selectFiber', id); + } + } + + setRendererInterface(rendererID, rendererInterface) { + this._rendererInterfaces[rendererID] = rendererInterface; + + if (this._isProfiling) { + rendererInterface.startProfiling(this._recordChangeDescriptions); + } + + rendererInterface.setTraceUpdatesEnabled(this._traceUpdatesEnabled); // When the renderer is attached, we need to tell it whether + // we remember the previous selection that we'd like to restore. + // It'll start tracking mounts for matches to the last selection path. + + const selection = this._persistedSelection; + + if (selection !== null && selection.rendererID === rendererID) { + rendererInterface.setTrackedPath(selection.path); + } + } + + onUnsupportedRenderer(rendererID) { + this._bridge.send('unsupportedRendererVersion', rendererID); + } + +} + +/***/ }), +/* 18 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { + +"use strict"; +/* unused harmony export REACT_ELEMENT_TYPE */ +/* unused harmony export REACT_PORTAL_TYPE */ +/* unused harmony export REACT_FRAGMENT_TYPE */ +/* unused harmony export REACT_STRICT_MODE_TYPE */ +/* unused harmony export REACT_PROFILER_TYPE */ +/* unused harmony export REACT_PROVIDER_TYPE */ +/* unused harmony export REACT_CONTEXT_TYPE */ +/* unused harmony export REACT_SERVER_CONTEXT_TYPE */ +/* unused harmony export REACT_FORWARD_REF_TYPE */ +/* unused harmony export REACT_SUSPENSE_TYPE */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return REACT_SUSPENSE_LIST_TYPE; }); +/* unused harmony export REACT_MEMO_TYPE */ +/* unused harmony export REACT_LAZY_TYPE */ +/* unused harmony export REACT_SCOPE_TYPE */ +/* unused harmony export REACT_DEBUG_TRACING_MODE_TYPE */ +/* unused harmony export REACT_OFFSCREEN_TYPE */ +/* unused harmony export REACT_LEGACY_HIDDEN_TYPE */ +/* unused harmony export REACT_CACHE_TYPE */ +/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return REACT_TRACING_MARKER_TYPE; }); +/* unused harmony export REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED */ +/* unused harmony export getIteratorFn */ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ +// ATTENTION +// When adding new symbols to this file, +// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' +// The Symbol used to tag the ReactElement-like types. +const REACT_ELEMENT_TYPE = Symbol.for('react.element'); +const REACT_PORTAL_TYPE = Symbol.for('react.portal'); +const REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); +const REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); +const REACT_PROFILER_TYPE = Symbol.for('react.profiler'); +const REACT_PROVIDER_TYPE = Symbol.for('react.provider'); +const REACT_CONTEXT_TYPE = Symbol.for('react.context'); +const REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context'); +const REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); +const REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); +const REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); +const REACT_MEMO_TYPE = Symbol.for('react.memo'); +const REACT_LAZY_TYPE = Symbol.for('react.lazy'); +const REACT_SCOPE_TYPE = Symbol.for('react.scope'); +const REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for('react.debug_trace_mode'); +const REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); +const REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden'); +const REACT_CACHE_TYPE = Symbol.for('react.cache'); +const REACT_TRACING_MARKER_TYPE = Symbol.for('react.tracing_marker'); +const REACT_SERVER_CONTEXT_DEFAULT_VALUE_NOT_LOADED = Symbol.for('react.default_value'); +const MAYBE_ITERATOR_SYMBOL = Symbol.iterator; +const FAUX_ITERATOR_SYMBOL = '@@iterator'; +function getIteratorFn(maybeIterable) { + if (maybeIterable === null || typeof maybeIterable !== 'object') { + return null; + } + + const maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; + + if (typeof maybeIterator === 'function') { + return maybeIterator; + } + + return null; +} + +/***/ }), +/* 19 */ +/***/ (function(module, exports) { + +var g; // This works in non-strict mode + +g = function () { + return this; +}(); + +try { + // This works if eval is allowed (see CSP) + g = g || new Function("return this")(); +} catch (e) { + // This works if the window reference is available + if (typeof window === "object") g = window; +} // g can still be undefined, but nothing to do about it... +// We return undefined, instead of nothing here, so it's +// easier to handle this case. if(!global) { ...} + + +module.exports = g; + +/***/ }), +/* 20 */ +/***/ (function(module, exports) { + +// shim for using process in browser +var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} + +function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); +} + +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +})(); + +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } // if setTimeout wasn't available but was latter defined + + + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } +} + +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } // if clearTimeout wasn't available but was latter defined + + + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } +} + +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + + draining = false; + + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; - try { - const id = renderer.getFiberIDForNative(node, true); + while (len) { + currentQueue = queue; + queue = []; - if (id !== null) { - return id; - } - } catch (error) {// Some old React versions might throw if they can't find a match. - // If so we should ignore it... + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); } } - return null; + queueIndex = -1; + len = queue.length; } - selectNode(target) { - const id = this.getIDForNode(target); + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} - if (id !== null) { - this._bridge.send('selectFiber', id); +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; } } - setRendererInterface(rendererID, rendererInterface) { - this._rendererInterfaces[rendererID] = rendererInterface; + queue.push(new Item(fun, args)); - if (this._isProfiling) { - rendererInterface.startProfiling(this._recordChangeDescriptions); - } + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; // v8 likes predictible objects - rendererInterface.setTraceUpdatesEnabled(this._traceUpdatesEnabled); // When the renderer is attached, we need to tell it whether - // we remember the previous selection that we'd like to restore. - // It'll start tracking mounts for matches to the last selection path. - const selection = this._persistedSelection; +function Item(fun, array) { + this.fun = fun; + this.array = array; +} - if (selection !== null && selection.rendererID === rendererID) { - rendererInterface.setTrackedPath(selection.path); - } - } +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; - onUnsupportedRenderer(rendererID) { - this._bridge.send('unsupportedRendererVersion', rendererID); - } +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues -} +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { + return []; +}; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { + return '/'; +}; + +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; + +process.umask = function () { + return 0; +}; /***/ }), -/* 16 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/* 21 */ +/***/ (function(module, exports, __webpack_require__) { -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BRIDGE_PROTOCOL", function() { return BRIDGE_PROTOCOL; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currentBridgeProtocol", function() { return currentBridgeProtocol; }); -/* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12); -function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +// Import support https://stackoverflow.com/questions/13673346/supporting-both-commonjs-and-amd +(function (name, definition) { + if (true) { + module.exports = definition(); + } else {} +})("clipboard", function () { + if (typeof document === 'undefined' || !document.addEventListener) { + return null; + } -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * - */ + var clipboard = {}; -const BATCH_DURATION = 100; // This message specifies the version of the DevTools protocol currently supported by the backend, -// as well as the earliest NPM version (e.g. "4.13.0") that protocol is supported by on the frontend. -// This enables an older frontend to display an upgrade message to users for a newer, unsupported backend. + clipboard.copy = function () { + var _intercept = false; + var _data = null; // Map from data type (e.g. "text/html") to value. -// Bump protocol version whenever a backwards breaking change is made -// in the messages sent between BackendBridge and FrontendBridge. -// This mapping is embedded in both frontend and backend builds. -// -// The backend protocol will always be the latest entry in the BRIDGE_PROTOCOL array. -// -// When an older frontend connects to a newer backend, -// the backend can send the minNpmVersion and the frontend can display an NPM upgrade prompt. -// -// When a newer frontend connects with an older protocol version, -// the frontend can use the embedded minNpmVersion/maxNpmVersion values to display a downgrade prompt. -const BRIDGE_PROTOCOL = [// This version technically never existed, -// but a backwards breaking change was added in 4.11, -// so the safest guess to downgrade the frontend would be to version 4.10. -{ - version: 0, - minNpmVersion: '"<4.11.0"', - maxNpmVersion: '"<4.11.0"' -}, { - version: 1, - minNpmVersion: '4.13.0', - maxNpmVersion: null -}]; -const currentBridgeProtocol = BRIDGE_PROTOCOL[BRIDGE_PROTOCOL.length - 1]; + var _bogusSelection = false; -class Bridge extends _events__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"] { - constructor(wall) { - super(); + function cleanup() { + _intercept = false; + _data = null; - _defineProperty(this, "_isShutdown", false); + if (_bogusSelection) { + window.getSelection().removeAllRanges(); + } - _defineProperty(this, "_messageQueue", []); + _bogusSelection = false; + } - _defineProperty(this, "_timeoutID", null); + document.addEventListener("copy", function (e) { + if (_intercept) { + for (var key in _data) { + e.clipboardData.setData(key, _data[key]); + } - _defineProperty(this, "_wallUnlisten", null); + e.preventDefault(); + } + }); // Workaround for Safari: https://bugs.webkit.org/show_bug.cgi?id=156529 - _defineProperty(this, "_flush", () => { - // This method is used after the bridge is marked as destroyed in shutdown sequence, - // so we do not bail out if the bridge marked as destroyed. - // It is a private method that the bridge ensures is only called at the right times. - if (this._timeoutID !== null) { - clearTimeout(this._timeoutID); - this._timeoutID = null; + function bogusSelect() { + var sel = document.getSelection(); // If "nothing" is selected... + + if (!document.queryCommandEnabled("copy") && sel.isCollapsed) { + // ... temporarily select the entire body. + // + // We select the entire body because: + // - it's guaranteed to exist, + // - it works (unlike, say, document.head, or phantom element that is + // not inserted into the DOM), + // - it doesn't seem to flicker (due to the synchronous copy event), and + // - it avoids modifying the DOM (can trigger mutation observers). + // + // Because we can't do proper feature detection (we already checked + // document.queryCommandEnabled("copy") , which actually gives a false + // negative for Blink when nothing is selected) and UA sniffing is not + // reliable (a lot of UA strings contain "Safari"), this will also + // happen for some browsers other than Safari. :-() + var range = document.createRange(); + range.selectNodeContents(document.body); + sel.removeAllRanges(); + sel.addRange(range); + _bogusSelection = true; } + } - if (this._messageQueue.length) { - for (let i = 0; i < this._messageQueue.length; i += 2) { - this._wall.send(this._messageQueue[i], ...this._messageQueue[i + 1]); + ; + return function (data) { + return new Promise(function (resolve, reject) { + _intercept = true; + + if (typeof data === "string") { + _data = { + "text/plain": data + }; + } else if (data instanceof Node) { + _data = { + "text/html": new XMLSerializer().serializeToString(data) + }; + } else if (data instanceof Object) { + _data = data; + } else { + reject("Invalid data type. Must be string, DOM node, or an object mapping MIME types to strings."); + } + + function triggerCopy(tryBogusSelect) { + try { + if (document.execCommand("copy")) { + // document.execCommand is synchronous: http://www.w3.org/TR/2015/WD-clipboard-apis-20150421/#integration-with-rich-text-editing-apis + // So we can call resolve() back here. + cleanup(); + resolve(); + } else { + if (!tryBogusSelect) { + bogusSelect(); + triggerCopy(true); + } else { + cleanup(); + throw new Error("Unable to copy. Perhaps it's not available in your browser?"); + } + } + } catch (e) { + cleanup(); + reject(e); + } } - this._messageQueue.length = 0; // Check again for queued messages in BATCH_DURATION ms. This will keep - // flushing in a loop as long as messages continue to be added. Once no - // more are, the timer expires. + triggerCopy(false); + }); + }; + }(); - this._timeoutID = setTimeout(this._flush, BATCH_DURATION); + clipboard.paste = function () { + var _intercept = false; + + var _resolve; + + var _dataType; + + document.addEventListener("paste", function (e) { + if (_intercept) { + _intercept = false; + e.preventDefault(); + var resolve = _resolve; + _resolve = null; + resolve(e.clipboardData.getData(_dataType)); } }); + return function (dataType) { + return new Promise(function (resolve, reject) { + _intercept = true; + _resolve = resolve; + _dataType = dataType || "text/plain"; - _defineProperty(this, "overrideValueAtPath", ({ - id, - path, - rendererID, - type, - value - }) => { - switch (type) { - case 'context': - this.send('overrideContext', { - id, - path, - rendererID, - wasForwarded: true, - value - }); - break; - - case 'hooks': - this.send('overrideHookState', { - id, - path, - rendererID, - wasForwarded: true, - value - }); - break; + try { + if (!document.execCommand("paste")) { + _intercept = false; + reject(new Error("Unable to paste. Pasting only works in Internet Explorer at the moment.")); + } + } catch (e) { + _intercept = false; + reject(new Error(e)); + } + }); + }; + }(); // Handle IE behaviour. - case 'props': - this.send('overrideProps', { - id, - path, - rendererID, - wasForwarded: true, - value - }); - break; - case 'state': - this.send('overrideState', { - id, - path, - rendererID, - wasForwarded: true, - value - }); - break; + if (typeof ClipboardEvent === "undefined" && typeof window.clipboardData !== "undefined" && typeof window.clipboardData.setData !== "undefined") { + /*! promise-polyfill 2.0.1 */ + (function (a) { + function b(a, b) { + return function () { + a.apply(b, arguments); + }; } - }); - this._wall = wall; - this._wallUnlisten = wall.listen(message => { - this.emit(message.event, message.payload); - }) || null; // Temporarily support older standalone front-ends sending commands to newer embedded backends. - // We do this because React Native embeds the React DevTools backend, - // but cannot control which version of the frontend users use. + function c(a) { + if ("object" != typeof this) throw new TypeError("Promises must be constructed via new"); + if ("function" != typeof a) throw new TypeError("not a function"); + this._state = null, this._value = null, this._deferreds = [], i(a, b(e, this), b(f, this)); + } - this.addListener('overrideValueAtPath', this.overrideValueAtPath); - } // Listening directly to the wall isn't advised. - // It can be used to listen for legacy (v3) messages (since they use a different format). + function d(a) { + var b = this; + return null === this._state ? void this._deferreds.push(a) : void j(function () { + var c = b._state ? a.onFulfilled : a.onRejected; + if (null === c) return void (b._state ? a.resolve : a.reject)(b._value); + var d; + try { + d = c(b._value); + } catch (e) { + return void a.reject(e); + } - get wall() { - return this._wall; - } + a.resolve(d); + }); + } - send(event, ...payload) { - if (this._isShutdown) { - console.warn(`Cannot send message "${event}" through a Bridge that has been shutdown.`); - return; - } // When we receive a message: - // - we add it to our queue of messages to be sent - // - if there hasn't been a message recently, we set a timer for 0 ms in - // the future, allowing all messages created in the same tick to be sent - // together - // - if there *has* been a message flushed in the last BATCH_DURATION ms - // (or we're waiting for our setTimeout-0 to fire), then _timeoutID will - // be set, and we'll simply add to the queue and wait for that + function e(a) { + try { + if (a === this) throw new TypeError("A promise cannot be resolved with itself."); + if (a && ("object" == typeof a || "function" == typeof a)) { + var c = a.then; + if ("function" == typeof c) return void i(b(c, a), b(e, this), b(f, this)); + } - this._messageQueue.push(event, payload); + this._state = !0, this._value = a, g.call(this); + } catch (d) { + f.call(this, d); + } + } - if (!this._timeoutID) { - this._timeoutID = setTimeout(this._flush, 0); - } - } + function f(a) { + this._state = !1, this._value = a, g.call(this); + } - shutdown() { - if (this._isShutdown) { - console.warn('Bridge was already shutdown.'); - return; - } // Queue the shutdown outgoing message for subscribers. + function g() { + for (var a = 0, b = this._deferreds.length; b > a; a++) d.call(this, this._deferreds[a]); + this._deferreds = null; + } - this.send('shutdown'); // Mark this bridge as destroyed, i.e. disable its public API. + function h(a, b, c, d) { + this.onFulfilled = "function" == typeof a ? a : null, this.onRejected = "function" == typeof b ? b : null, this.resolve = c, this.reject = d; + } - this._isShutdown = true; // Disable the API inherited from EventEmitter that can add more listeners and send more messages. - // $FlowFixMe This property is not writable. + function i(a, b, c) { + var d = !1; - this.addListener = function () {}; // $FlowFixMe This property is not writable. + try { + a(function (a) { + d || (d = !0, b(a)); + }, function (a) { + d || (d = !0, c(a)); + }); + } catch (e) { + if (d) return; + d = !0, c(e); + } + } + var j = c.immediateFn || "function" == typeof setImmediate && setImmediate || function (a) { + setTimeout(a, 1); + }, + k = Array.isArray || function (a) { + return "[object Array]" === Object.prototype.toString.call(a); + }; - this.emit = function () {}; // NOTE: There's also EventEmitter API like `on` and `prependListener` that we didn't add to our Flow type of EventEmitter. - // Unsubscribe this bridge incoming message listeners to be sure, and so they don't have to do that. + c.prototype["catch"] = function (a) { + return this.then(null, a); + }, c.prototype.then = function (a, b) { + var e = this; + return new c(function (c, f) { + d.call(e, new h(a, b, c, f)); + }); + }, c.all = function () { + var a = Array.prototype.slice.call(1 === arguments.length && k(arguments[0]) ? arguments[0] : arguments); + return new c(function (b, c) { + function d(f, g) { + try { + if (g && ("object" == typeof g || "function" == typeof g)) { + var h = g.then; + if ("function" == typeof h) return void h.call(g, function (a) { + d(f, a); + }, c); + } + a[f] = g, 0 === --e && b(a); + } catch (i) { + c(i); + } + } - this.removeAllListeners(); // Stop accepting and emitting incoming messages from the wall. + if (0 === a.length) return b([]); - const wallUnlisten = this._wallUnlisten; + for (var e = a.length, f = 0; f < a.length; f++) d(f, a[f]); + }); + }, c.resolve = function (a) { + return a && "object" == typeof a && a.constructor === c ? a : new c(function (b) { + b(a); + }); + }, c.reject = function (a) { + return new c(function (b, c) { + c(a); + }); + }, c.race = function (a) { + return new c(function (b, c) { + for (var d = 0, e = a.length; e > d; d++) a[d].then(b, c); + }); + }, true && module.exports ? module.exports = c : a.Promise || (a.Promise = c); + })(this); - if (wallUnlisten) { - wallUnlisten(); - } // Synchronously flush all queued outgoing messages. - // At this step the subscribers' code may run in this call stack. + clipboard.copy = function (data) { + return new Promise(function (resolve, reject) { + // IE supports string and URL types: https://msdn.microsoft.com/en-us/library/ms536744(v=vs.85).aspx + // We only support the string type for now. + if (typeof data !== "string" && !("text/plain" in data)) { + throw new Error("You must provide a text/plain type."); + } + var strData = typeof data === "string" ? data : data["text/plain"]; + var copySucceeded = window.clipboardData.setData("Text", strData); - do { - this._flush(); - } while (this._messageQueue.length); // Make sure once again that there is no dangling timer. + if (copySucceeded) { + resolve(); + } else { + reject(new Error("Copying was rejected.")); + } + }); + }; + clipboard.paste = function () { + return new Promise(function (resolve, reject) { + var strData = window.clipboardData.getData("Text"); - if (this._timeoutID !== null) { - clearTimeout(this._timeoutID); - this._timeoutID = null; - } + if (strData) { + resolve(strData); + } else { + // The user rejected the paste request. + reject(new Error("Pasting was rejected.")); + } + }); + }; } -} - -/* harmony default export */ __webpack_exports__["default"] = (Bridge); + return clipboard; +}); /***/ }), -/* 17 */ +/* 22 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // A linked list to keep track of recently-used-ness -const Yallist = __webpack_require__(23); +const Yallist = __webpack_require__(26); const MAX = Symbol('max'); const LENGTH = Symbol('length'); @@ -10834,932 +12208,840 @@ class LRUCache { if (!options) options = {}; if (options.max && (typeof options.max !== 'number' || options.max < 0)) throw new TypeError('max must be a non-negative number'); // Kind of weird to have a default max of Infinity, but oh well. - const max = this[MAX] = options.max || Infinity; - const lc = options.length || naiveLength; - this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc; - this[ALLOW_STALE] = options.stale || false; - if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number'); - this[MAX_AGE] = options.maxAge || 0; - this[DISPOSE] = options.dispose; - this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false; - this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false; - this.reset(); - } // resize the cache when the max changes. - - - set max(mL) { - if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number'); - this[MAX] = mL || Infinity; - trim(this); - } - - get max() { - return this[MAX]; - } - - set allowStale(allowStale) { - this[ALLOW_STALE] = !!allowStale; - } - - get allowStale() { - return this[ALLOW_STALE]; - } - - set maxAge(mA) { - if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number'); - this[MAX_AGE] = mA; - trim(this); - } - - get maxAge() { - return this[MAX_AGE]; - } // resize the cache when the lengthCalculator changes. - - - set lengthCalculator(lC) { - if (typeof lC !== 'function') lC = naiveLength; - - if (lC !== this[LENGTH_CALCULATOR]) { - this[LENGTH_CALCULATOR] = lC; - this[LENGTH] = 0; - this[LRU_LIST].forEach(hit => { - hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key); - this[LENGTH] += hit.length; - }); - } - - trim(this); - } - - get lengthCalculator() { - return this[LENGTH_CALCULATOR]; - } - - get length() { - return this[LENGTH]; - } - - get itemCount() { - return this[LRU_LIST].length; - } - - rforEach(fn, thisp) { - thisp = thisp || this; - - for (let walker = this[LRU_LIST].tail; walker !== null;) { - const prev = walker.prev; - forEachStep(this, fn, walker, thisp); - walker = prev; - } - } - - forEach(fn, thisp) { - thisp = thisp || this; - - for (let walker = this[LRU_LIST].head; walker !== null;) { - const next = walker.next; - forEachStep(this, fn, walker, thisp); - walker = next; - } - } - - keys() { - return this[LRU_LIST].toArray().map(k => k.key); - } - - values() { - return this[LRU_LIST].toArray().map(k => k.value); - } - - reset() { - if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) { - this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)); - } - - this[CACHE] = new Map(); // hash of items by key - - this[LRU_LIST] = new Yallist(); // list of items in order of use recency - - this[LENGTH] = 0; // length of items in the list - } - - dump() { - return this[LRU_LIST].map(hit => isStale(this, hit) ? false : { - k: hit.key, - v: hit.value, - e: hit.now + (hit.maxAge || 0) - }).toArray().filter(h => h); - } - - dumpLru() { - return this[LRU_LIST]; - } - - set(key, value, maxAge) { - maxAge = maxAge || this[MAX_AGE]; - if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number'); - const now = maxAge ? Date.now() : 0; - const len = this[LENGTH_CALCULATOR](value, key); - - if (this[CACHE].has(key)) { - if (len > this[MAX]) { - del(this, this[CACHE].get(key)); - return false; - } - - const node = this[CACHE].get(key); - const item = node.value; // dispose of the old one before overwriting - // split out into 2 ifs for better coverage tracking - - if (this[DISPOSE]) { - if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value); - } - - item.now = now; - item.maxAge = maxAge; - item.value = value; - this[LENGTH] += len - item.length; - item.length = len; - this.get(key); - trim(this); - return true; - } - - const hit = new Entry(key, value, len, now, maxAge); // oversized objects fall out of cache automatically. - - if (hit.length > this[MAX]) { - if (this[DISPOSE]) this[DISPOSE](key, value); - return false; - } - - this[LENGTH] += hit.length; - this[LRU_LIST].unshift(hit); - this[CACHE].set(key, this[LRU_LIST].head); - trim(this); - return true; - } - - has(key) { - if (!this[CACHE].has(key)) return false; - const hit = this[CACHE].get(key).value; - return !isStale(this, hit); - } - - get(key) { - return get(this, key, true); - } - - peek(key) { - return get(this, key, false); - } - - pop() { - const node = this[LRU_LIST].tail; - if (!node) return null; - del(this, node); - return node.value; - } - - del(key) { - del(this, this[CACHE].get(key)); - } - - load(arr) { - // reset the cache - this.reset(); - const now = Date.now(); // A previous serialized cache has the most recent items first - - for (let l = arr.length - 1; l >= 0; l--) { - const hit = arr[l]; - const expiresAt = hit.e || 0; - if (expiresAt === 0) // the item was created without expiration in a non aged cache - this.set(hit.k, hit.v);else { - const maxAge = expiresAt - now; // dont add already expired items - - if (maxAge > 0) { - this.set(hit.k, hit.v, maxAge); - } - } - } - } - - prune() { - this[CACHE].forEach((value, key) => get(this, key, false)); - } - -} - -const get = (self, key, doUse) => { - const node = self[CACHE].get(key); - - if (node) { - const hit = node.value; - - if (isStale(self, hit)) { - del(self, node); - if (!self[ALLOW_STALE]) return undefined; - } else { - if (doUse) { - if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now(); - self[LRU_LIST].unshiftNode(node); - } - } - - return hit.value; - } -}; + const max = this[MAX] = options.max || Infinity; + const lc = options.length || naiveLength; + this[LENGTH_CALCULATOR] = typeof lc !== 'function' ? naiveLength : lc; + this[ALLOW_STALE] = options.stale || false; + if (options.maxAge && typeof options.maxAge !== 'number') throw new TypeError('maxAge must be a number'); + this[MAX_AGE] = options.maxAge || 0; + this[DISPOSE] = options.dispose; + this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false; + this[UPDATE_AGE_ON_GET] = options.updateAgeOnGet || false; + this.reset(); + } // resize the cache when the max changes. -const isStale = (self, hit) => { - if (!hit || !hit.maxAge && !self[MAX_AGE]) return false; - const diff = Date.now() - hit.now; - return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE]; -}; -const trim = self => { - if (self[LENGTH] > self[MAX]) { - for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) { - // We know that we're about to delete this one, and also - // what the next least recently used key will be, so just - // go ahead and set it now. - const prev = walker.prev; - del(self, walker); - walker = prev; - } + set max(mL) { + if (typeof mL !== 'number' || mL < 0) throw new TypeError('max must be a non-negative number'); + this[MAX] = mL || Infinity; + trim(this); } -}; -const del = (self, node) => { - if (node) { - const hit = node.value; - if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value); - self[LENGTH] -= hit.length; - self[CACHE].delete(hit.key); - self[LRU_LIST].removeNode(node); + get max() { + return this[MAX]; } -}; -class Entry { - constructor(key, value, length, now, maxAge) { - this.key = key; - this.value = value; - this.length = length; - this.now = now; - this.maxAge = maxAge || 0; + set allowStale(allowStale) { + this[ALLOW_STALE] = !!allowStale; } -} - -const forEachStep = (self, fn, node, thisp) => { - let hit = node.value; - - if (isStale(self, hit)) { - del(self, node); - if (!self[ALLOW_STALE]) hit = undefined; + get allowStale() { + return this[ALLOW_STALE]; } - if (hit) fn.call(thisp, hit.value, hit.key, self); -}; - -module.exports = LRUCache; - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -// Import support https://stackoverflow.com/questions/13673346/supporting-both-commonjs-and-amd -(function (name, definition) { - if (true) { - module.exports = definition(); - } else {} -})("clipboard", function () { - if (typeof document === 'undefined' || !document.addEventListener) { - return null; + set maxAge(mA) { + if (typeof mA !== 'number') throw new TypeError('maxAge must be a non-negative number'); + this[MAX_AGE] = mA; + trim(this); } - var clipboard = {}; + get maxAge() { + return this[MAX_AGE]; + } // resize the cache when the lengthCalculator changes. - clipboard.copy = function () { - var _intercept = false; - var _data = null; // Map from data type (e.g. "text/html") to value. - var _bogusSelection = false; + set lengthCalculator(lC) { + if (typeof lC !== 'function') lC = naiveLength; - function cleanup() { - _intercept = false; - _data = null; + if (lC !== this[LENGTH_CALCULATOR]) { + this[LENGTH_CALCULATOR] = lC; + this[LENGTH] = 0; + this[LRU_LIST].forEach(hit => { + hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key); + this[LENGTH] += hit.length; + }); + } - if (_bogusSelection) { - window.getSelection().removeAllRanges(); - } + trim(this); + } - _bogusSelection = false; - } + get lengthCalculator() { + return this[LENGTH_CALCULATOR]; + } - document.addEventListener("copy", function (e) { - if (_intercept) { - for (var key in _data) { - e.clipboardData.setData(key, _data[key]); - } + get length() { + return this[LENGTH]; + } - e.preventDefault(); - } - }); // Workaround for Safari: https://bugs.webkit.org/show_bug.cgi?id=156529 + get itemCount() { + return this[LRU_LIST].length; + } - function bogusSelect() { - var sel = document.getSelection(); // If "nothing" is selected... + rforEach(fn, thisp) { + thisp = thisp || this; - if (!document.queryCommandEnabled("copy") && sel.isCollapsed) { - // ... temporarily select the entire body. - // - // We select the entire body because: - // - it's guaranteed to exist, - // - it works (unlike, say, document.head, or phantom element that is - // not inserted into the DOM), - // - it doesn't seem to flicker (due to the synchronous copy event), and - // - it avoids modifying the DOM (can trigger mutation observers). - // - // Because we can't do proper feature detection (we already checked - // document.queryCommandEnabled("copy") , which actually gives a false - // negative for Blink when nothing is selected) and UA sniffing is not - // reliable (a lot of UA strings contain "Safari"), this will also - // happen for some browsers other than Safari. :-() - var range = document.createRange(); - range.selectNodeContents(document.body); - sel.removeAllRanges(); - sel.addRange(range); - _bogusSelection = true; - } + for (let walker = this[LRU_LIST].tail; walker !== null;) { + const prev = walker.prev; + forEachStep(this, fn, walker, thisp); + walker = prev; } + } - ; - return function (data) { - return new Promise(function (resolve, reject) { - _intercept = true; + forEach(fn, thisp) { + thisp = thisp || this; - if (typeof data === "string") { - _data = { - "text/plain": data - }; - } else if (data instanceof Node) { - _data = { - "text/html": new XMLSerializer().serializeToString(data) - }; - } else if (data instanceof Object) { - _data = data; - } else { - reject("Invalid data type. Must be string, DOM node, or an object mapping MIME types to strings."); - } + for (let walker = this[LRU_LIST].head; walker !== null;) { + const next = walker.next; + forEachStep(this, fn, walker, thisp); + walker = next; + } + } - function triggerCopy(tryBogusSelect) { - try { - if (document.execCommand("copy")) { - // document.execCommand is synchronous: http://www.w3.org/TR/2015/WD-clipboard-apis-20150421/#integration-with-rich-text-editing-apis - // So we can call resolve() back here. - cleanup(); - resolve(); - } else { - if (!tryBogusSelect) { - bogusSelect(); - triggerCopy(true); - } else { - cleanup(); - throw new Error("Unable to copy. Perhaps it's not available in your browser?"); - } - } - } catch (e) { - cleanup(); - reject(e); - } - } + keys() { + return this[LRU_LIST].toArray().map(k => k.key); + } - triggerCopy(false); - }); - }; - }(); + values() { + return this[LRU_LIST].toArray().map(k => k.value); + } - clipboard.paste = function () { - var _intercept = false; + reset() { + if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) { + this[LRU_LIST].forEach(hit => this[DISPOSE](hit.key, hit.value)); + } - var _resolve; + this[CACHE] = new Map(); // hash of items by key - var _dataType; + this[LRU_LIST] = new Yallist(); // list of items in order of use recency - document.addEventListener("paste", function (e) { - if (_intercept) { - _intercept = false; - e.preventDefault(); - var resolve = _resolve; - _resolve = null; - resolve(e.clipboardData.getData(_dataType)); - } - }); - return function (dataType) { - return new Promise(function (resolve, reject) { - _intercept = true; - _resolve = resolve; - _dataType = dataType || "text/plain"; + this[LENGTH] = 0; // length of items in the list + } - try { - if (!document.execCommand("paste")) { - _intercept = false; - reject(new Error("Unable to paste. Pasting only works in Internet Explorer at the moment.")); - } - } catch (e) { - _intercept = false; - reject(new Error(e)); - } - }); - }; - }(); // Handle IE behaviour. + dump() { + return this[LRU_LIST].map(hit => isStale(this, hit) ? false : { + k: hit.key, + v: hit.value, + e: hit.now + (hit.maxAge || 0) + }).toArray().filter(h => h); + } + dumpLru() { + return this[LRU_LIST]; + } - if (typeof ClipboardEvent === "undefined" && typeof window.clipboardData !== "undefined" && typeof window.clipboardData.setData !== "undefined") { - /*! promise-polyfill 2.0.1 */ - (function (a) { - function b(a, b) { - return function () { - a.apply(b, arguments); - }; + set(key, value, maxAge) { + maxAge = maxAge || this[MAX_AGE]; + if (maxAge && typeof maxAge !== 'number') throw new TypeError('maxAge must be a number'); + const now = maxAge ? Date.now() : 0; + const len = this[LENGTH_CALCULATOR](value, key); + + if (this[CACHE].has(key)) { + if (len > this[MAX]) { + del(this, this[CACHE].get(key)); + return false; } - function c(a) { - if ("object" != typeof this) throw new TypeError("Promises must be constructed via new"); - if ("function" != typeof a) throw new TypeError("not a function"); - this._state = null, this._value = null, this._deferreds = [], i(a, b(e, this), b(f, this)); + const node = this[CACHE].get(key); + const item = node.value; // dispose of the old one before overwriting + // split out into 2 ifs for better coverage tracking + + if (this[DISPOSE]) { + if (!this[NO_DISPOSE_ON_SET]) this[DISPOSE](key, item.value); } - function d(a) { - var b = this; - return null === this._state ? void this._deferreds.push(a) : void j(function () { - var c = b._state ? a.onFulfilled : a.onRejected; - if (null === c) return void (b._state ? a.resolve : a.reject)(b._value); - var d; + item.now = now; + item.maxAge = maxAge; + item.value = value; + this[LENGTH] += len - item.length; + item.length = len; + this.get(key); + trim(this); + return true; + } - try { - d = c(b._value); - } catch (e) { - return void a.reject(e); - } + const hit = new Entry(key, value, len, now, maxAge); // oversized objects fall out of cache automatically. - a.resolve(d); - }); - } + if (hit.length > this[MAX]) { + if (this[DISPOSE]) this[DISPOSE](key, value); + return false; + } - function e(a) { - try { - if (a === this) throw new TypeError("A promise cannot be resolved with itself."); + this[LENGTH] += hit.length; + this[LRU_LIST].unshift(hit); + this[CACHE].set(key, this[LRU_LIST].head); + trim(this); + return true; + } - if (a && ("object" == typeof a || "function" == typeof a)) { - var c = a.then; - if ("function" == typeof c) return void i(b(c, a), b(e, this), b(f, this)); - } + has(key) { + if (!this[CACHE].has(key)) return false; + const hit = this[CACHE].get(key).value; + return !isStale(this, hit); + } - this._state = !0, this._value = a, g.call(this); - } catch (d) { - f.call(this, d); - } - } + get(key) { + return get(this, key, true); + } - function f(a) { - this._state = !1, this._value = a, g.call(this); - } + peek(key) { + return get(this, key, false); + } - function g() { - for (var a = 0, b = this._deferreds.length; b > a; a++) d.call(this, this._deferreds[a]); + pop() { + const node = this[LRU_LIST].tail; + if (!node) return null; + del(this, node); + return node.value; + } - this._deferreds = null; - } + del(key) { + del(this, this[CACHE].get(key)); + } - function h(a, b, c, d) { - this.onFulfilled = "function" == typeof a ? a : null, this.onRejected = "function" == typeof b ? b : null, this.resolve = c, this.reject = d; - } + load(arr) { + // reset the cache + this.reset(); + const now = Date.now(); // A previous serialized cache has the most recent items first - function i(a, b, c) { - var d = !1; + for (let l = arr.length - 1; l >= 0; l--) { + const hit = arr[l]; + const expiresAt = hit.e || 0; + if (expiresAt === 0) // the item was created without expiration in a non aged cache + this.set(hit.k, hit.v);else { + const maxAge = expiresAt - now; // dont add already expired items - try { - a(function (a) { - d || (d = !0, b(a)); - }, function (a) { - d || (d = !0, c(a)); - }); - } catch (e) { - if (d) return; - d = !0, c(e); + if (maxAge > 0) { + this.set(hit.k, hit.v, maxAge); } } + } + } - var j = c.immediateFn || "function" == typeof setImmediate && setImmediate || function (a) { - setTimeout(a, 1); - }, - k = Array.isArray || function (a) { - return "[object Array]" === Object.prototype.toString.call(a); - }; + prune() { + this[CACHE].forEach((value, key) => get(this, key, false)); + } - c.prototype["catch"] = function (a) { - return this.then(null, a); - }, c.prototype.then = function (a, b) { - var e = this; - return new c(function (c, f) { - d.call(e, new h(a, b, c, f)); - }); - }, c.all = function () { - var a = Array.prototype.slice.call(1 === arguments.length && k(arguments[0]) ? arguments[0] : arguments); - return new c(function (b, c) { - function d(f, g) { - try { - if (g && ("object" == typeof g || "function" == typeof g)) { - var h = g.then; - if ("function" == typeof h) return void h.call(g, function (a) { - d(f, a); - }, c); - } +} - a[f] = g, 0 === --e && b(a); - } catch (i) { - c(i); - } - } +const get = (self, key, doUse) => { + const node = self[CACHE].get(key); - if (0 === a.length) return b([]); + if (node) { + const hit = node.value; - for (var e = a.length, f = 0; f < a.length; f++) d(f, a[f]); - }); - }, c.resolve = function (a) { - return a && "object" == typeof a && a.constructor === c ? a : new c(function (b) { - b(a); - }); - }, c.reject = function (a) { - return new c(function (b, c) { - c(a); - }); - }, c.race = function (a) { - return new c(function (b, c) { - for (var d = 0, e = a.length; e > d; d++) a[d].then(b, c); - }); - }, true && module.exports ? module.exports = c : a.Promise || (a.Promise = c); - })(this); + if (isStale(self, hit)) { + del(self, node); + if (!self[ALLOW_STALE]) return undefined; + } else { + if (doUse) { + if (self[UPDATE_AGE_ON_GET]) node.value.now = Date.now(); + self[LRU_LIST].unshiftNode(node); + } + } - clipboard.copy = function (data) { - return new Promise(function (resolve, reject) { - // IE supports string and URL types: https://msdn.microsoft.com/en-us/library/ms536744(v=vs.85).aspx - // We only support the string type for now. - if (typeof data !== "string" && !("text/plain" in data)) { - throw new Error("You must provide a text/plain type."); - } + return hit.value; + } +}; - var strData = typeof data === "string" ? data : data["text/plain"]; - var copySucceeded = window.clipboardData.setData("Text", strData); +const isStale = (self, hit) => { + if (!hit || !hit.maxAge && !self[MAX_AGE]) return false; + const diff = Date.now() - hit.now; + return hit.maxAge ? diff > hit.maxAge : self[MAX_AGE] && diff > self[MAX_AGE]; +}; - if (copySucceeded) { - resolve(); - } else { - reject(new Error("Copying was rejected.")); - } - }); - }; +const trim = self => { + if (self[LENGTH] > self[MAX]) { + for (let walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null;) { + // We know that we're about to delete this one, and also + // what the next least recently used key will be, so just + // go ahead and set it now. + const prev = walker.prev; + del(self, walker); + walker = prev; + } + } +}; - clipboard.paste = function () { - return new Promise(function (resolve, reject) { - var strData = window.clipboardData.getData("Text"); +const del = (self, node) => { + if (node) { + const hit = node.value; + if (self[DISPOSE]) self[DISPOSE](hit.key, hit.value); + self[LENGTH] -= hit.length; + self[CACHE].delete(hit.key); + self[LRU_LIST].removeNode(node); + } +}; + +class Entry { + constructor(key, value, length, now, maxAge) { + this.key = key; + this.value = value; + this.length = length; + this.now = now; + this.maxAge = maxAge || 0; + } + +} - if (strData) { - resolve(strData); - } else { - // The user rejected the paste request. - reject(new Error("Pasting was rejected.")); - } - }); - }; +const forEachStep = (self, fn, node, thisp) => { + let hit = node.value; + + if (isStale(self, hit)) { + del(self, node); + if (!self[ALLOW_STALE]) hit = undefined; } - return clipboard; -}); + if (hit) fn.call(thisp, hit.value, hit.key, self); +}; + +module.exports = LRUCache; /***/ }), -/* 19 */ +/* 23 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; if (true) { - module.exports = __webpack_require__(26); + module.exports = __webpack_require__(29); } else {} /***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { +/* 24 */ +/***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -// Do not use imports or top-level requires here! -// Running module factories is intentionally delayed until we know the hook exists. -// This is to avoid issues like: https://github.com/facebook/react-devtools/issues/1039 +// EXPORTS +__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ getStackByFiberInDevAndProd; }); -function welcome(event) { - if (event.data.source !== 'react-devtools-content-script') { - return; +// EXTERNAL MODULE: ../react-devtools-shared/src/backend/ReactSymbols.js +var ReactSymbols = __webpack_require__(3); + +// CONCATENATED MODULE: ../react-devtools-shared/src/backend/DevToolsConsolePatching.js +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ +// This is a DevTools fork of shared/ConsolePatchingDev. +// The shared console patching code is DEV-only. +// We can't use it since DevTools only ships production builds. +// Helpers to patch console.logs to avoid logging during side-effect free +// replaying on render function. This currently only patches the object +// lazily which won't cover if the log function was extracted eagerly. +// We could also eagerly patch the method. +let disabledDepth = 0; +let prevLog; +let prevInfo; +let prevWarn; +let prevError; +let prevGroup; +let prevGroupCollapsed; +let prevGroupEnd; + +function disabledLog() {} + +disabledLog.__reactDisabledLog = true; +function disableLogs() { + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + prevLog = console.log; + prevInfo = console.info; + prevWarn = console.warn; + prevError = console.error; + prevGroup = console.group; + prevGroupCollapsed = console.groupCollapsed; + prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 + + const props = { + configurable: true, + enumerable: true, + value: disabledLog, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. + + Object.defineProperties(console, { + info: props, + log: props, + warn: props, + error: props, + group: props, + groupCollapsed: props, + groupEnd: props + }); + /* eslint-enable react-internal/no-production-logging */ } - window.removeEventListener('message', welcome); - setup(window.__REACT_DEVTOOLS_GLOBAL_HOOK__); + disabledDepth++; } +function reenableLogs() { + disabledDepth--; -window.addEventListener('message', welcome); + if (disabledDepth === 0) { + /* eslint-disable react-internal/no-production-logging */ + const props = { + configurable: true, + enumerable: true, + writable: true + }; // $FlowFixMe Flow thinks console is immutable. -function setup(hook) { - if (hook == null) { - // DevTools didn't get injected into this page (maybe b'c of the contentType). - return; + Object.defineProperties(console, { + log: { ...props, + value: prevLog + }, + info: { ...props, + value: prevInfo + }, + warn: { ...props, + value: prevWarn + }, + error: { ...props, + value: prevError + }, + group: { ...props, + value: prevGroup + }, + groupCollapsed: { ...props, + value: prevGroupCollapsed + }, + groupEnd: { ...props, + value: prevGroupEnd + } + }); + /* eslint-enable react-internal/no-production-logging */ } - const Agent = __webpack_require__(15).default; + if (disabledDepth < 0) { + console.error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); + } +} +// CONCATENATED MODULE: ../react-devtools-shared/src/backend/DevToolsComponentStackFrame.js +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ +// This is a DevTools fork of ReactComponentStackFrame. +// This fork enables DevTools to use the same "native" component stack format, +// while still maintaining support for multiple renderer versions +// (which use different values for ReactTypeOfWork). + // The shared console patching code is DEV-only. +// We can't use it since DevTools only ships production builds. - const Bridge = __webpack_require__(16).default; - const { - initBackend - } = __webpack_require__(31); +let prefix; +function describeBuiltInComponentFrame(name, source, ownerFn) { + if (prefix === undefined) { + // Extract the VM specific prefix used by each line. + try { + throw Error(); + } catch (x) { + const match = x.stack.trim().match(/\n( *(at )?)/); + prefix = match && match[1] || ''; + } + } // We use the prefix to ensure our stacks line up with native stack frames. - const setupNativeStyleEditor = __webpack_require__(32).default; - const bridge = new Bridge({ - listen(fn) { - const listener = event => { - if (event.source !== window || !event.data || event.data.source !== 'react-devtools-content-script' || !event.data.payload) { - return; - } + return '\n' + prefix + name; +} +let reentry = false; +let componentFrameCache; - fn(event.data.payload); - }; +if (true) { + const PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; + componentFrameCache = new PossiblyWeakMap(); +} - window.addEventListener('message', listener); - return () => { - window.removeEventListener('message', listener); - }; - }, +function describeNativeComponentFrame(fn, construct, currentDispatcherRef) { + // If something asked for a stack inside a fake render, it should get ignored. + if (!fn || reentry) { + return ''; + } - send(event, payload, transferable) { - // Synchronously notify the record/replay driver. - window.__RECORD_REPLAY_REACT_DEVTOOLS_SEND_BRIDGE__(event, payload); + if (true) { + const frame = componentFrameCache.get(fn); + + if (frame !== undefined) { + return frame; } + } - }); - const agent = new Agent(bridge); - agent.addListener('shutdown', () => { - // If we received 'shutdown' from `agent`, we assume the `bridge` is already shutting down, - // and that caused the 'shutdown' event on the `agent`, so we don't need to call `bridge.shutdown()` here. - hook.emit('shutdown'); - }); - initBackend(hook, agent, window); // Let the frontend know that the backend has attached listeners and is ready for messages. - // This covers the case of syncing saved values after reloading/navigating while DevTools remain open. + let control; + const previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. + + Error.prepareStackTrace = undefined; + reentry = true; // Override the dispatcher so effects scheduled by this shallow render are thrown away. + // + // Note that unlike the code this was forked from (in ReactComponentStackFrame) + // DevTools should override the dispatcher even when DevTools is compiled in production mode, + // because the app itself may be in development mode and log errors/warnings. + + const previousDispatcher = currentDispatcherRef.current; + currentDispatcherRef.current = null; + disableLogs(); + + try { + // This should throw. + if (construct) { + // Something should be setting the props in the constructor. + const Fake = function () { + throw Error(); + }; // $FlowFixMe + + + Object.defineProperty(Fake.prototype, 'props', { + set: function () { + // We use a throwing setter instead of frozen or non-writable props + // because that won't throw in a non-strict mode function. + throw Error(); + } + }); + + if (typeof Reflect === 'object' && Reflect.construct) { + // We construct a different control for this case to include any extra + // frames added by the construct call. + try { + Reflect.construct(Fake, []); + } catch (x) { + control = x; + } + + Reflect.construct(fn, [], Fake); + } else { + try { + Fake.call(); + } catch (x) { + control = x; + } - bridge.send('extensionBackendInitialized'); // Setup React Native style editor if a renderer like react-native-web has injected it. + fn.call(Fake.prototype); + } + } else { + try { + throw Error(); + } catch (x) { + control = x; + } - if (hook.resolveRNStyle) { - setupNativeStyleEditor(bridge, agent, hook.resolveRNStyle, hook.nativeStyleEditorValidAttributes); - } -} + fn(); + } + } catch (sample) { + // This is inlined manually because closure doesn't do it for us. + if (sample && control && typeof sample.stack === 'string') { + // This extracts the first frame from the sample that isn't also in the control. + // Skipping one frame that we assume is the frame that calls the two. + const sampleLines = sample.stack.split('\n'); + const controlLines = control.stack.split('\n'); + let s = sampleLines.length - 1; + let c = controlLines.length - 1; -/***/ }), -/* 21 */ -/***/ (function(module, exports) { + while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { + // We expect at least one stack frame to be shared. + // Typically this will be the root most one. However, stack frames may be + // cut off due to maximum stack limits. In this case, one maybe cut off + // earlier than the other. We assume that the sample is longer or the same + // and there for cut off earlier. So we should find the root most frame in + // the sample somewhere in the control. + c--; + } -var g; // This works in non-strict mode + for (; s >= 1 && c >= 0; s--, c--) { + // Next we find the first one that isn't the same which should be the + // frame that called our sample function and the control. + if (sampleLines[s] !== controlLines[c]) { + // In V8, the first line is describing the message but other VMs don't. + // If we're about to return the first line, and the control is also on the same + // line, that's a pretty good indicator that our sample threw at same line as + // the control. I.e. before we entered the sample frame. So we ignore this result. + // This can happen if you passed a class to function component, or non-function. + if (s !== 1 || c !== 1) { + do { + s--; + c--; // We may still have similar intermediate frames from the construct call. + // The next one that isn't the same should be our match though. -g = function () { - return this; -}(); + if (c < 0 || sampleLines[s] !== controlLines[c]) { + // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. + const frame = '\n' + sampleLines[s].replace(' at new ', ' at '); -try { - // This works if eval is allowed (see CSP) - g = g || new Function("return this")(); -} catch (e) { - // This works if the window reference is available - if (typeof window === "object") g = window; -} // g can still be undefined, but nothing to do about it... -// We return undefined, instead of nothing here, so it's -// easier to handle this case. if(!global) { ...} + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, frame); + } + } // Return the line we found. -module.exports = g; + return frame; + } + } while (s >= 1 && c >= 0); + } -/***/ }), -/* 22 */ -/***/ (function(module, exports) { + break; + } + } + } + } finally { + reentry = false; + Error.prepareStackTrace = previousPrepareStackTrace; + currentDispatcherRef.current = previousDispatcher; + reenableLogs(); + } // Fallback to just using the name if we couldn't make it throw. -// shim for using process in browser -var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. -var cachedSetTimeout; -var cachedClearTimeout; + const name = fn ? fn.displayName || fn.name : ''; + const syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); + if (true) { + if (typeof fn === 'function') { + componentFrameCache.set(fn, syntheticFrame); + } + } + + return syntheticFrame; +} +function describeClassComponentFrame(ctor, source, ownerFn, currentDispatcherRef) { + return describeNativeComponentFrame(ctor, true, currentDispatcherRef); +} +function describeFunctionComponentFrame(fn, source, ownerFn, currentDispatcherRef) { + return describeNativeComponentFrame(fn, false, currentDispatcherRef); } -function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); +function shouldConstruct(Component) { + const prototype = Component.prototype; + return !!(prototype && prototype.isReactComponent); } -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; +function describeUnknownElementTypeFrameInDEV(type, source, ownerFn, currentDispatcherRef) { + if (false) {} + + if (type == null) { + return ''; } - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; + if (typeof type === 'function') { + return describeNativeComponentFrame(type, shouldConstruct(type), currentDispatcherRef); } -})(); -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } // if setTimeout wasn't available but was latter defined + if (typeof type === 'string') { + return describeBuiltInComponentFrame(type, source, ownerFn); + } + switch (type) { + case ReactSymbols["w" /* SUSPENSE_NUMBER */]: + case ReactSymbols["x" /* SUSPENSE_SYMBOL_STRING */]: + return describeBuiltInComponentFrame('Suspense', source, ownerFn); - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); + case ReactSymbols["u" /* SUSPENSE_LIST_NUMBER */]: + case ReactSymbols["v" /* SUSPENSE_LIST_SYMBOL_STRING */]: + return describeBuiltInComponentFrame('SuspenseList', source, ownerFn); } - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); + if (typeof type === 'object') { + switch (type.$$typeof) { + case ReactSymbols["f" /* FORWARD_REF_NUMBER */]: + case ReactSymbols["g" /* FORWARD_REF_SYMBOL_STRING */]: + return describeFunctionComponentFrame(type.render, source, ownerFn, currentDispatcherRef); + + case ReactSymbols["j" /* MEMO_NUMBER */]: + case ReactSymbols["k" /* MEMO_SYMBOL_STRING */]: + // Memo may contain any component type so we recursively resolve it. + return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn, currentDispatcherRef); + + case ReactSymbols["h" /* LAZY_NUMBER */]: + case ReactSymbols["i" /* LAZY_SYMBOL_STRING */]: + { + const lazyComponent = type; + const payload = lazyComponent._payload; + const init = lazyComponent._init; + + try { + // Lazy may contain any component type so we recursively resolve it. + return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn, currentDispatcherRef); + } catch (x) {} + } } } + + return ''; } +// CONCATENATED MODULE: ../react-devtools-shared/src/backend/DevToolsFiberComponentStack.js +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * + */ +// This is a DevTools fork of ReactFiberComponentStack. +// This fork enables DevTools to use the same "native" component stack format, +// while still maintaining support for multiple renderer versions +// (which use different values for ReactTypeOfWork). -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } // if clearTimeout wasn't available but was latter defined +function describeFiber(workTagMap, workInProgress, currentDispatcherRef) { + const { + HostComponent, + LazyComponent, + SuspenseComponent, + SuspenseListComponent, + FunctionComponent, + IndeterminateComponent, + SimpleMemoComponent, + ForwardRef, + ClassComponent + } = workTagMap; + const owner = true ? workInProgress._debugOwner ? workInProgress._debugOwner.type : null : undefined; + const source = true ? workInProgress._debugSource : undefined; + + switch (workInProgress.tag) { + case HostComponent: + return describeBuiltInComponentFrame(workInProgress.type, source, owner); - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } + case LazyComponent: + return describeBuiltInComponentFrame('Lazy', source, owner); - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } -} + case SuspenseComponent: + return describeBuiltInComponentFrame('Suspense', source, owner); -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; + case SuspenseListComponent: + return describeBuiltInComponentFrame('SuspenseList', source, owner); -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } + case FunctionComponent: + case IndeterminateComponent: + case SimpleMemoComponent: + return describeFunctionComponentFrame(workInProgress.type, source, owner, currentDispatcherRef); - draining = false; + case ForwardRef: + return describeFunctionComponentFrame(workInProgress.type.render, source, owner, currentDispatcherRef); - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } + case ClassComponent: + return describeClassComponentFrame(workInProgress.type, source, owner, currentDispatcherRef); - if (queue.length) { - drainQueue(); + default: + return ''; } } -function drainQueue() { - if (draining) { - return; +function getStackByFiberInDevAndProd(workTagMap, workInProgress, currentDispatcherRef) { + try { + let info = ''; + let node = workInProgress; + + do { + info += describeFiber(workTagMap, node, currentDispatcherRef); + node = node.return; + } while (node); + + return info; + } catch (x) { + return '\nError generating stack: ' + x.message + '\n' + x.stack; } +} - var timeout = runTimeout(cleanUpNextTick); - draining = true; - var len = queue.length; +/***/ }), +/* 25 */ +/***/ (function(module, exports, __webpack_require__) { - while (len) { - currentQueue = queue; - queue = []; +"use strict"; +// Do not use imports or top-level requires here! +// Running module factories is intentionally delayed until we know the hook exists. +// This is to avoid issues like: https://github.com/facebook/react-devtools/issues/1039 - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } - } - queueIndex = -1; - len = queue.length; - } +let welcomeHasInitialized = false; - currentQueue = null; - draining = false; - runClearTimeout(timeout); -} +function welcome(event) { + if (event.data.source !== 'react-devtools-content-script') { + return; + } // In some circumstances, this method is called more than once for a single welcome message. + // The exact circumstances of this are unclear, though it seems related to 3rd party event batching code. + // + // Regardless, call this method multiple times can cause DevTools to add duplicate elements to the Store + // (and throw an error) or worse yet, choke up entirely and freeze the browser. + // + // The simplest solution is to ignore the duplicate events. + // To be clear, this SHOULD NOT BE NECESSARY, since we remove the event handler below. + // + // See https://github.com/facebook/react/issues/24162 -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; - } + if (welcomeHasInitialized) { + console.warn('React DevTools detected duplicate welcome "message" events from the content script.'); + return; } - queue.push(new Item(fun, args)); + welcomeHasInitialized = true; + window.removeEventListener('message', welcome); + setup(window.__REACT_DEVTOOLS_GLOBAL_HOOK__); +} - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; // v8 likes predictible objects +window.addEventListener('message', welcome); +function setup(hook) { + if (hook == null) { + // DevTools didn't get injected into this page (maybe b'c of the contentType). + return; + } -function Item(fun, array) { - this.fun = fun; - this.array = array; -} + const Agent = __webpack_require__(17).default; -Item.prototype.run = function () { - this.fun.apply(null, this.array); -}; + const Bridge = __webpack_require__(15).default; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues + const { + initBackend + } = __webpack_require__(34); -process.versions = {}; + const setupNativeStyleEditor = __webpack_require__(35).default; -function noop() {} + const bridge = new Bridge({ + listen(fn) { + const listener = event => { + if (event.source !== window || !event.data || event.data.source !== 'react-devtools-content-script' || !event.data.payload) { + return; + } -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; + fn(event.data.payload); + }; -process.listeners = function (name) { - return []; -}; + window.addEventListener('message', listener); + return () => { + window.removeEventListener('message', listener); + }; + }, -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; + send(event, payload, transferable) { + // Synchronously notify the record/replay driver. + window.__RECORD_REPLAY_REACT_DEVTOOLS_SEND_BRIDGE__(event, payload); + } -process.cwd = function () { - return '/'; -}; + }); + const agent = new Agent(bridge); + agent.addListener('shutdown', () => { + // If we received 'shutdown' from `agent`, we assume the `bridge` is already shutting down, + // and that caused the 'shutdown' event on the `agent`, so we don't need to call `bridge.shutdown()` here. + hook.emit('shutdown'); + }); + initBackend(hook, agent, window); // Let the frontend know that the backend has attached listeners and is ready for messages. + // This covers the case of syncing saved values after reloading/navigating while DevTools remain open. -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; + bridge.send('extensionBackendInitialized'); // Setup React Native style editor if a renderer like react-native-web has injected it. -process.umask = function () { - return 0; -}; + if (hook.resolveRNStyle) { + setupNativeStyleEditor(bridge, agent, hook.resolveRNStyle, hook.nativeStyleEditorValidAttributes); + } +} /***/ }), -/* 23 */ +/* 26 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12244,11 +13526,11 @@ function Node(value, prev, next, list) { try { // add if support for Symbol.iterator is present - __webpack_require__(24)(Yallist); + __webpack_require__(27)(Yallist); } catch (er) {} /***/ }), -/* 24 */ +/* 27 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -12263,11 +13545,12 @@ module.exports = function (Yallist) { }; /***/ }), -/* 25 */ +/* 28 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -/** @license React vundefined +/** + * @license React * react-is.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -12277,104 +13560,71 @@ module.exports = function (Yallist) { */ -var b = 60103, - c = 60106, - d = 60107, - e = 60108, - f = 60114, - g = 60109, - h = 60110, - k = 60112, - l = 60113, - m = 60120, - n = 60115, - p = 60116, - q = 60129, - r = 60130, - u = 60131, - v = 60132; - -if ("function" === typeof Symbol && Symbol.for) { - var w = Symbol.for; - b = w("react.element"); - c = w("react.portal"); - d = w("react.fragment"); - e = w("react.strict_mode"); - f = w("react.profiler"); - g = w("react.provider"); - h = w("react.context"); - k = w("react.forward_ref"); - l = w("react.suspense"); - m = w("react.suspense_list"); - n = w("react.memo"); - p = w("react.lazy"); - q = w("react.debug_trace_mode"); - r = w("react.offscreen"); - u = w("react.legacy_hidden"); - v = w("react.cache"); -} - -var x = 0; -"function" === typeof Symbol && (x = Symbol.for("react.module.reference")); - -function y(a) { +var b = Symbol.for("react.element"), + c = Symbol.for("react.portal"), + d = Symbol.for("react.fragment"), + e = Symbol.for("react.strict_mode"), + f = Symbol.for("react.profiler"), + g = Symbol.for("react.provider"), + h = Symbol.for("react.context"), + k = Symbol.for("react.server_context"), + l = Symbol.for("react.forward_ref"), + m = Symbol.for("react.suspense"), + n = Symbol.for("react.suspense_list"), + p = Symbol.for("react.memo"), + q = Symbol.for("react.lazy"), + t = Symbol.for("react.offscreen"), + u = Symbol.for("react.cache"), + v = Symbol.for("react.module.reference"); + +function w(a) { if ("object" === typeof a && null !== a) { - var t = a.$$typeof; + var r = a.$$typeof; - switch (t) { + switch (r) { case b: switch (a = a.type, a) { case d: case f: case e: - case l: case m: + case n: return a; default: switch (a = a && a.$$typeof, a) { - case h: case k: + case h: + case l: + case q: case p: - case n: case g: return a; default: - return t; + return r; } } case c: - return t; + return r; } } } -var z = g, - A = b, - B = k, - C = d, - D = p, - E = n, - F = c, - G = f, - H = e, - I = l, - J = m; exports.ContextConsumer = h; -exports.ContextProvider = z; -exports.Element = A; -exports.ForwardRef = B; -exports.Fragment = C; -exports.Lazy = D; -exports.Memo = E; -exports.Portal = F; -exports.Profiler = G; -exports.StrictMode = H; -exports.Suspense = I; -exports.SuspenseList = J; +exports.ContextProvider = g; +exports.Element = b; +exports.ForwardRef = l; +exports.Fragment = d; +exports.Lazy = q; +exports.Memo = p; +exports.Portal = c; +exports.Profiler = f; +exports.StrictMode = e; +exports.Suspense = m; +exports.SuspenseList = n; exports.isAsyncMode = function () { return !1; @@ -12385,11 +13635,11 @@ exports.isConcurrentMode = function () { }; exports.isContextConsumer = function (a) { - return y(a) === h; + return w(a) === h; }; exports.isContextProvider = function (a) { - return y(a) === g; + return w(a) === g; }; exports.isElement = function (a) { @@ -12397,53 +13647,54 @@ exports.isElement = function (a) { }; exports.isForwardRef = function (a) { - return y(a) === k; + return w(a) === l; }; exports.isFragment = function (a) { - return y(a) === d; + return w(a) === d; }; exports.isLazy = function (a) { - return y(a) === p; + return w(a) === q; }; exports.isMemo = function (a) { - return y(a) === n; + return w(a) === p; }; exports.isPortal = function (a) { - return y(a) === c; + return w(a) === c; }; exports.isProfiler = function (a) { - return y(a) === f; + return w(a) === f; }; exports.isStrictMode = function (a) { - return y(a) === e; + return w(a) === e; }; exports.isSuspense = function (a) { - return y(a) === l; + return w(a) === m; }; exports.isSuspenseList = function (a) { - return y(a) === m; + return w(a) === n; }; exports.isValidElementType = function (a) { - return "string" === typeof a || "function" === typeof a || a === d || a === f || a === q || a === e || a === l || a === m || a === u || a === r || a === v || "object" === typeof a && null !== a && (a.$$typeof === p || a.$$typeof === n || a.$$typeof === g || a.$$typeof === h || a.$$typeof === k || a.$$typeof === x || void 0 !== a.getModuleId) ? !0 : !1; + return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || a === u || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === v || void 0 !== a.getModuleId) ? !0 : !1; }; -exports.typeOf = y; +exports.typeOf = w; /***/ }), -/* 26 */ +/* 29 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -/** @license React vundefined +/** + * @license React * react-debug-tools.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -12453,75 +13704,61 @@ exports.typeOf = y; */ -var k = __webpack_require__(7), - p = __webpack_require__(27); - -function r(a) { - for (var b = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, e = 1; e < arguments.length; e++) b += "&args[]=" + encodeURIComponent(arguments[e]); +var h = __webpack_require__(30), + l = __webpack_require__(32), + r = Object.assign, + w = l.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, + x = [], + y = null; - return "Minified React error #" + a + "; visit " + b + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."; -} - -var w = __webpack_require__(29).__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, - x = 60128; - -if ("function" === typeof Symbol && Symbol.for) { - var y = Symbol.for; - x = y("react.opaque.id"); -} - -var z = [], - A = null, - B = null; - -function C() { - if (null === A) { +function z() { + if (null === y) { var a = new Map(); try { - D.useContext({ + A.useContext({ _currentValue: null - }), D.useState(null), D.useReducer(function (a) { + }), A.useState(null), A.useReducer(function (a) { return a; - }, null), D.useRef(null), "function" === typeof D.useCacheRefresh && D.useCacheRefresh(), D.useLayoutEffect(function () {}), D.useEffect(function () {}), D.useImperativeHandle(void 0, function () { + }, null), A.useRef(null), "function" === typeof A.useCacheRefresh && A.useCacheRefresh(), A.useLayoutEffect(function () {}), A.useInsertionEffect(function () {}), A.useEffect(function () {}), A.useImperativeHandle(void 0, function () { return null; - }), D.useDebugValue(null), D.useCallback(function () {}), D.useMemo(function () { + }), A.useDebugValue(null), A.useCallback(function () {}), A.useMemo(function () { return null; }); } finally { - var b = z; - z = []; + var b = x; + x = []; } for (var e = 0; e < b.length; e++) { - var f = b[e]; - a.set(f.primitive, p.parse(f.stackError)); + var g = b[e]; + a.set(g.primitive, h.parse(g.stackError)); } - A = a; + y = a; } - return A; + return y; } -var E = null; +var B = null; -function F() { - var a = E; - null !== a && (E = a.next); +function C() { + var a = B; + null !== a && (B = a.next); return a; } -var D = { +var A = { getCacheForType: function () { - throw Error(r(248)); + throw Error("Not implemented."); }, readContext: function (a) { return a._currentValue; }, useCacheRefresh: function () { - var a = F(); - z.push({ + var a = C(); + x.push({ primitive: "CacheRefresh", stackError: Error(), value: null !== a ? a.memoizedState : function () {} @@ -12529,8 +13766,8 @@ var D = { return function () {}; }, useCallback: function (a) { - var b = F(); - z.push({ + var b = C(); + x.push({ primitive: "Callback", stackError: Error(), value: null !== b ? b.memoizedState[0] : a @@ -12538,7 +13775,7 @@ var D = { return a; }, useContext: function (a) { - z.push({ + x.push({ primitive: "Context", stackError: Error(), value: a._currentValue @@ -12546,42 +13783,50 @@ var D = { return a._currentValue; }, useEffect: function (a) { - F(); - z.push({ + C(); + x.push({ primitive: "Effect", stackError: Error(), value: a }); }, useImperativeHandle: function (a) { - F(); + C(); var b = void 0; null !== a && "object" === typeof a && (b = a.current); - z.push({ + x.push({ primitive: "ImperativeHandle", stackError: Error(), value: b }); }, useDebugValue: function (a, b) { - z.push({ + x.push({ primitive: "DebugValue", stackError: Error(), value: "function" === typeof b ? b(a) : a }); }, useLayoutEffect: function (a) { - F(); - z.push({ + C(); + x.push({ primitive: "LayoutEffect", stackError: Error(), value: a }); }, + useInsertionEffect: function (a) { + C(); + x.push({ + primitive: "InsertionEffect", + stackError: Error(), + value: a + }); + }, useMemo: function (a) { - var b = F(); + var b = C(); a = null !== b ? b.memoizedState[0] : a(); - z.push({ + x.push({ primitive: "Memo", stackError: Error(), value: a @@ -12589,9 +13834,9 @@ var D = { return a; }, useReducer: function (a, b, e) { - a = F(); + a = C(); b = null !== a ? a.memoizedState : void 0 !== e ? e(b) : b; - z.push({ + x.push({ primitive: "Reducer", stackError: Error(), value: b @@ -12599,11 +13844,11 @@ var D = { return [b, function () {}]; }, useRef: function (a) { - var b = F(); + var b = C(); a = null !== b ? b.memoizedState : { current: a }; - z.push({ + x.push({ primitive: "Ref", stackError: Error(), value: a.current @@ -12611,9 +13856,9 @@ var D = { return a; }, useState: function (a) { - var b = F(); + var b = C(); a = null !== b ? b.memoizedState : "function" === typeof a ? a() : a; - z.push({ + x.push({ primitive: "State", stackError: Error(), value: a @@ -12621,9 +13866,9 @@ var D = { return [a, function () {}]; }, useTransition: function () { - F(); - F(); - z.push({ + C(); + C(); + x.push({ primitive: "Transition", stackError: Error(), value: void 0 @@ -12631,48 +13876,66 @@ var D = { return [!1, function () {}]; }, useMutableSource: function (a, b) { - F(); - F(); - F(); - F(); + C(); + C(); + C(); + C(); a = b(a._source); - z.push({ + x.push({ primitive: "MutableSource", stackError: Error(), value: a }); return a; }, + useSyncExternalStore: function (a, b) { + C(); + C(); + a = b(); + x.push({ + primitive: "SyncExternalStore", + stackError: Error(), + value: a + }); + return a; + }, useDeferredValue: function (a) { - F(); - F(); - z.push({ + C(); + C(); + x.push({ primitive: "DeferredValue", stackError: Error(), value: a }); return a; }, - useOpaqueIdentifier: function () { - var a = F(); - B && 0 === B.mode && F(); - (a = null === a ? void 0 : a.memoizedState) && a.$$typeof === x && (a = void 0); - z.push({ - primitive: "OpaqueIdentifier", + useId: function () { + var a = C(); + a = null !== a ? a.memoizedState : ""; + x.push({ + primitive: "Id", stackError: Error(), value: a }); return a; } }, - G = 0; - -function H(a, b, e) { - var f = b[e].source, + D = new Proxy(A, { + get: function (a, b) { + if (a.hasOwnProperty(b)) return a[b]; + a = Error("Missing method in Dispatcher: " + b); + a.name = "ReactDebugToolsUnsupportedHookError"; + throw a; + } +}), + E = 0; + +function F(a, b, e) { + var g = b[e].source, c = 0; - a: for (; c < a.length; c++) if (a[c].source === f) { - for (var l = e + 1, q = c + 1; l < b.length && q < a.length; l++, q++) if (a[q].source !== b[l].source) continue a; + a: for (; c < a.length; c++) if (a[c].source === g) { + for (var m = e + 1, q = c + 1; m < b.length && q < a.length; m++, q++) if (a[q].source !== b[m].source) continue a; return c; } @@ -12680,25 +13943,25 @@ function H(a, b, e) { return -1; } -function I(a, b) { +function G(a, b) { if (!a) return !1; b = "use" + b; return a.length < b.length ? !1 : a.lastIndexOf(b) === a.length - b.length; } -function J(a, b, e) { - for (var f = [], c = null, l = f, q = 0, t = [], v = 0; v < b.length; v++) { +function H(a, b, e) { + for (var g = [], c = null, m = g, q = 0, t = [], v = 0; v < b.length; v++) { var u = b[v]; var d = a; - var h = p.parse(u.stackError); + var k = h.parse(u.stackError); b: { - var m = h, - n = H(m, d, G); - if (-1 !== n) d = n;else { - for (var g = 0; g < d.length && 5 > g; g++) if (n = H(m, d, g), -1 !== n) { - G = g; - d = n; + var n = k, + p = F(n, d, E); + if (-1 !== p) d = p;else { + for (var f = 0; f < d.length && 5 > f; f++) if (p = F(n, d, f), -1 !== p) { + E = f; + d = p; break b; } @@ -12707,42 +13970,42 @@ function J(a, b, e) { } b: { - m = h; - n = C().get(u.primitive); - if (void 0 !== n) for (g = 0; g < n.length && g < m.length; g++) if (n[g].source !== m[g].source) { - g < m.length - 1 && I(m[g].functionName, u.primitive) && g++; - g < m.length - 1 && I(m[g].functionName, u.primitive) && g++; - m = g; + n = k; + p = z().get(u.primitive); + if (void 0 !== p) for (f = 0; f < p.length && f < n.length; f++) if (p[f].source !== n[f].source) { + f < n.length - 1 && G(n[f].functionName, u.primitive) && f++; + f < n.length - 1 && G(n[f].functionName, u.primitive) && f++; + n = f; break b; } - m = -1; + n = -1; } - h = -1 === d || -1 === m || 2 > d - m ? null : h.slice(m, d - 1); + k = -1 === d || -1 === n || 2 > d - n ? null : k.slice(n, d - 1); - if (null !== h) { + if (null !== k) { d = 0; if (null !== c) { - for (; d < h.length && d < c.length && h[h.length - d - 1].source === c[c.length - d - 1].source;) d++; + for (; d < k.length && d < c.length && k[k.length - d - 1].source === c[c.length - d - 1].source;) d++; - for (c = c.length - 1; c > d; c--) l = t.pop(); + for (c = c.length - 1; c > d; c--) m = t.pop(); } - for (c = h.length - d - 1; 1 <= c; c--) d = [], m = h[c], (n = h[c - 1].functionName) ? (g = n.lastIndexOf("."), -1 === g && (g = 0), "use" === n.substr(g, 3) && (g += 3), n = n.substr(g)) : n = "", n = { + for (c = k.length - d - 1; 1 <= c; c--) d = [], n = k[c], (p = k[c - 1].functionName) ? (f = p.lastIndexOf("."), -1 === f && (f = 0), "use" === p.substr(f, 3) && (f += 3), p = p.substr(f)) : p = "", p = { id: null, isStateEditable: !1, - name: n, + name: p, value: void 0, subHooks: d - }, e && (n.hookSource = { - lineNumber: m.lineNumber, - columnNumber: m.columnNumber, - functionName: m.functionName, - fileName: m.fileName - }), l.push(n), t.push(l), l = d; + }, e && (p.hookSource = { + lineNumber: n.lineNumber, + columnNumber: n.columnNumber, + functionName: n.functionName, + fileName: n.fileName + }), m.push(p), t.push(m), m = d; - c = h; + c = k; } d = u.primitive; @@ -12758,18 +14021,18 @@ function J(a, b, e) { functionName: null, fileName: null, columnNumber: null - }, h && 1 <= h.length && (h = h[0], d.lineNumber = h.lineNumber, d.functionName = h.functionName, d.fileName = h.fileName, d.columnNumber = h.columnNumber), u.hookSource = d); - l.push(u); + }, k && 1 <= k.length && (k = k[0], d.lineNumber = k.lineNumber, d.functionName = k.functionName, d.fileName = k.fileName, d.columnNumber = k.columnNumber), u.hookSource = d); + m.push(u); } - K(f, null); - return f; + I(g, null); + return g; } -function K(a, b) { - for (var e = [], f = 0; f < a.length; f++) { - var c = a[f]; - "DebugValue" === c.name && 0 === c.subHooks.length ? (a.splice(f, 1), f--, e.push(c)) : K(c.subHooks, c); +function I(a, b) { + for (var e = [], g = 0; g < a.length; g++) { + var c = a[g]; + "DebugValue" === c.name && 0 === c.subHooks.length ? (a.splice(g, 1), g--, e.push(c)) : I(c.subHooks, c); } null !== b && (1 === e.length ? b.value = e[0].value : 1 < e.length && (b.value = e.map(function (a) { @@ -12777,91 +14040,104 @@ function K(a, b) { }))); } -function L(a, b, e) { - var f = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : !1; +function J(a) { + if (a instanceof Error && "ReactDebugToolsUnsupportedHookError" === a.name) throw a; + var b = Error("Error rendering inspected component", { + cause: a + }); + b.name = "ReactDebugToolsRenderError"; + b.cause = a; + throw b; +} + +function K(a, b, e) { + var g = 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : !1; null == e && (e = w.ReactCurrentDispatcher); var c = e.current; e.current = D; try { - var l = Error(); + var m = Error(); a(b); + } catch (t) { + J(t); } finally { - var q = z; - z = []; + var q = x; + x = []; e.current = c; } - c = p.parse(l); - return J(c, q, f); + c = h.parse(m); + return H(c, q, g); } -function M(a) { +function L(a) { a.forEach(function (a, e) { return e._currentValue = a; }); } -exports.inspectHooks = L; +exports.inspectHooks = K; exports.inspectHooksOfFiber = function (a, b) { var e = 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : !1; null == b && (b = w.ReactCurrentDispatcher); - B = a; if (0 !== a.tag && 15 !== a.tag && 11 !== a.tag) throw Error("Unknown Fiber. Needs to be a function component to inspect hooks."); - C(); - var f = a.type, + z(); + var g = a.type, c = a.memoizedProps; - if (f !== a.elementType && f && f.defaultProps) { - c = k({}, c); - var l = f.defaultProps; + if (g !== a.elementType && g && g.defaultProps) { + c = r({}, c); + var m = g.defaultProps; - for (q in l) void 0 === c[q] && (c[q] = l[q]); + for (q in m) void 0 === c[q] && (c[q] = m[q]); } - E = a.memoizedState; + B = a.memoizedState; var q = new Map(); try { - for (l = a; l;) { - if (10 === l.tag) { - var t = l.type._context; - q.has(t) || (q.set(t, t._currentValue), t._currentValue = l.memoizedProps.value); + for (m = a; m;) { + if (10 === m.tag) { + var t = m.type._context; + q.has(t) || (q.set(t, t._currentValue), t._currentValue = m.memoizedProps.value); } - l = l.return; + m = m.return; } if (11 === a.tag) { - var v = f.render; - f = c; + var v = g.render; + g = c; var u = a.ref; t = b; var d = t.current; t.current = D; try { - var h = Error(); - v(f, u); + var k = Error(); + v(g, u); + } catch (f) { + J(f); } finally { - var m = z; - z = []; + var n = x; + x = []; t.current = d; } - var n = p.parse(h); - return J(n, m, e); + var p = h.parse(k); + return H(p, n, e); } - return L(f, c, b, e); + return K(g, c, b, e); } finally { - E = null, M(q); + B = null, L(q); } }; /***/ }), -/* 27 */ +/* 30 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) { @@ -12870,10 +14146,10 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ /* istanbul ignore next */ if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(28)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(31)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} })(this, function ErrorStackParser(StackFrame) { 'use strict'; @@ -13049,7 +14325,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }); /***/ }), -/* 28 */ +/* 31 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory) { @@ -13059,9 +14335,9 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), - __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? - (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), - __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? + (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), + __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else {} })(this, function () { 'use strict'; @@ -13202,22 +14478,23 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ }); /***/ }), -/* 29 */ +/* 32 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; if (true) { - module.exports = __webpack_require__(30); + module.exports = __webpack_require__(33); } else {} /***/ }), -/* 30 */ +/* 33 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -/** @license React vundefined +/** + * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. @@ -13227,60 +14504,32 @@ if (true) { */ -var l = __webpack_require__(7), - m = 60103, - p = 60106; - -exports.Fragment = 60107; -exports.StrictMode = 60108; -exports.Profiler = 60114; -var q = 60109, - r = 60110, - t = 60112; -exports.Suspense = 60113; -exports.SuspenseList = 60120; -var u = 60115, - v = 60116; -exports.unstable_DebugTracingMode = 60129; -exports.unstable_Offscreen = 60130; -exports.unstable_LegacyHidden = 60131; -exports.unstable_Cache = 60132; - -if ("function" === typeof Symbol && Symbol.for) { - var w = Symbol.for; - m = w("react.element"); - p = w("react.portal"); - exports.Fragment = w("react.fragment"); - exports.StrictMode = w("react.strict_mode"); - exports.Profiler = w("react.profiler"); - q = w("react.provider"); - r = w("react.context"); - t = w("react.forward_ref"); - exports.Suspense = w("react.suspense"); - exports.SuspenseList = w("react.suspense_list"); - u = w("react.memo"); - v = w("react.lazy"); - exports.unstable_DebugTracingMode = w("react.debug_trace_mode"); - exports.unstable_Offscreen = w("react.offscreen"); - exports.unstable_LegacyHidden = w("react.legacy_hidden"); - exports.unstable_Cache = w("react.cache"); -} - -var x = "function" === typeof Symbol && Symbol.iterator; - -function y(a) { +var l = Symbol.for("react.element"), + n = Symbol.for("react.portal"), + p = Symbol.for("react.fragment"), + q = Symbol.for("react.strict_mode"), + r = Symbol.for("react.profiler"), + t = Symbol.for("react.provider"), + u = Symbol.for("react.context"), + v = Symbol.for("react.server_context"), + w = Symbol.for("react.forward_ref"), + x = Symbol.for("react.suspense"), + y = Symbol.for("react.suspense_list"), + z = Symbol.for("react.memo"), + A = Symbol.for("react.lazy"), + B = Symbol.for("react.debug_trace_mode"), + C = Symbol.for("react.offscreen"), + aa = Symbol.for("react.cache"), + D = Symbol.for("react.default_value"), + E = Symbol.iterator; + +function ba(a) { if (null === a || "object" !== typeof a) return null; - a = x && a[x] || a["@@iterator"]; + a = E && a[E] || a["@@iterator"]; return "function" === typeof a ? a : null; } -function z(a) { - for (var b = "https://reactjs.org/docs/error-decoder.html?invariant=" + a, c = 1; c < arguments.length; c++) b += "&args[]=" + encodeURIComponent(arguments[c]); - - return "Minified React error #" + a + "; visit " + b + " for the full message or use the non-minified dev environment for full errors and additional helpful warnings."; -} - -var A = { +var F = { isMounted: function () { return !1; }, @@ -13288,79 +14537,80 @@ var A = { enqueueReplaceState: function () {}, enqueueSetState: function () {} }, - B = {}; + G = Object.assign, + H = {}; -function C(a, b, c) { +function I(a, b, d) { this.props = a; this.context = b; - this.refs = B; - this.updater = c || A; + this.refs = H; + this.updater = d || F; } -C.prototype.isReactComponent = {}; +I.prototype.isReactComponent = {}; -C.prototype.setState = function (a, b) { - if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error(z(85)); +I.prototype.setState = function (a, b) { + if ("object" !== typeof a && "function" !== typeof a && null != a) throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables."); this.updater.enqueueSetState(this, a, b, "setState"); }; -C.prototype.forceUpdate = function (a) { +I.prototype.forceUpdate = function (a) { this.updater.enqueueForceUpdate(this, a, "forceUpdate"); }; -function D() {} +function J() {} -D.prototype = C.prototype; +J.prototype = I.prototype; -function E(a, b, c) { +function K(a, b, d) { this.props = a; this.context = b; - this.refs = B; - this.updater = c || A; + this.refs = H; + this.updater = d || F; } -var F = E.prototype = new D(); -F.constructor = E; -l(F, C.prototype); -F.isPureReactComponent = !0; -var G = Array.isArray, - H = Object.prototype.hasOwnProperty, - I = { +var L = K.prototype = new J(); +L.constructor = K; +G(L, I.prototype); +L.isPureReactComponent = !0; +var M = Array.isArray, + N = Object.prototype.hasOwnProperty, + O = { current: null }, - J = { + P = { key: !0, ref: !0, __self: !0, __source: !0 }; -function K(a, b, c) { - var e, - d = {}, +function Q(a, b, d) { + var c, + e = {}, k = null, h = null; - if (null != b) for (e in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b) H.call(b, e) && !J.hasOwnProperty(e) && (d[e] = b[e]); + if (null != b) for (c in void 0 !== b.ref && (h = b.ref), void 0 !== b.key && (k = "" + b.key), b) N.call(b, c) && !P.hasOwnProperty(c) && (e[c] = b[c]); var g = arguments.length - 2; - if (1 === g) d.children = c;else if (1 < g) { - for (var f = Array(g), n = 0; n < g; n++) f[n] = arguments[n + 2]; + if (1 === g) e.children = d;else if (1 < g) { + for (var f = Array(g), m = 0; m < g; m++) f[m] = arguments[m + 2]; - d.children = f; + e.children = f; } - if (a && a.defaultProps) for (e in g = a.defaultProps, g) void 0 === d[e] && (d[e] = g[e]); + if (a && a.defaultProps) for (c in g = a.defaultProps, g) void 0 === e[c] && (e[c] = g[c]); return { - $$typeof: m, + $$typeof: l, type: a, key: k, ref: h, - props: d, - _owner: I.current + props: e, + _owner: O.current }; } -function L(a, b) { +function ca(a, b) { return { - $$typeof: m, + $$typeof: l, type: a.type, key: b, ref: a.ref, @@ -13369,8 +14619,8 @@ function L(a, b) { }; } -function M(a) { - return "object" === typeof a && null !== a && a.$$typeof === m; +function R(a) { + return "object" === typeof a && null !== a && a.$$typeof === l; } function escape(a) { @@ -13383,13 +14633,13 @@ function escape(a) { }); } -var N = /\/+/g; +var S = /\/+/g; -function O(a, b) { +function T(a, b) { return "object" === typeof a && null !== a && null != a.key ? escape("" + a.key) : b.toString(36); } -function P(a, b, c, e, d) { +function U(a, b, d, c, e) { var k = typeof a; if ("undefined" === k || "boolean" === k) a = null; var h = !1; @@ -13401,36 +14651,36 @@ function P(a, b, c, e, d) { case "object": switch (a.$$typeof) { - case m: - case p: + case l: + case n: h = !0; } } - if (h) return h = a, d = d(h), a = "" === e ? "." + O(h, 0) : e, G(d) ? (c = "", null != a && (c = a.replace(N, "$&/") + "/"), P(d, b, c, "", function (a) { + if (h) return h = a, e = e(h), a = "" === c ? "." + T(h, 0) : c, M(e) ? (d = "", null != a && (d = a.replace(S, "$&/") + "/"), U(e, b, d, "", function (a) { return a; - })) : null != d && (M(d) && (d = L(d, c + (!d.key || h && h.key === d.key ? "" : ("" + d.key).replace(N, "$&/") + "/") + a)), b.push(d)), 1; + })) : null != e && (R(e) && (e = ca(e, d + (!e.key || h && h.key === e.key ? "" : ("" + e.key).replace(S, "$&/") + "/") + a)), b.push(e)), 1; h = 0; - e = "" === e ? "." : e + ":"; - if (G(a)) for (var g = 0; g < a.length; g++) { + c = "" === c ? "." : c + ":"; + if (M(a)) for (var g = 0; g < a.length; g++) { k = a[g]; - var f = e + O(k, g); - h += P(k, b, c, f, d); - } else if (f = y(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done;) k = k.value, f = e + O(k, g++), h += P(k, b, c, f, d);else if ("object" === k) throw b = "" + a, Error(z(31, "[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b)); + var f = c + T(k, g); + h += U(k, b, d, f, e); + } else if (f = ba(a), "function" === typeof f) for (a = f.call(a), g = 0; !(k = a.next()).done;) k = k.value, f = c + T(k, g++), h += U(k, b, d, f, e);else if ("object" === k) throw b = String(a), Error("Objects are not valid as a React child (found: " + ("[object Object]" === b ? "object with keys {" + Object.keys(a).join(", ") + "}" : b) + "). If you meant to render a collection of children, use an array instead."); return h; } -function Q(a, b, c) { +function V(a, b, d) { if (null == a) return a; - var e = [], - d = 0; - P(a, e, "", "", function (a) { - return b.call(c, a, d++); + var c = [], + e = 0; + U(a, c, "", "", function (a) { + return b.call(d, a, e++); }); - return e; + return c; } -function R(a) { +function da(a) { if (-1 === a._status) { var b = a._result; b = b(); @@ -13446,99 +14696,107 @@ function R(a) { throw a._result; } -var S = { +var W = { current: null }, - T = { - transition: 0 + X = { + transition: null }, - U = { - ReactCurrentDispatcher: S, - ReactCurrentBatchConfig: T, - ReactCurrentOwner: I, - assign: l -}; + Y = { + ReactCurrentDispatcher: W, + ReactCurrentBatchConfig: X, + ReactCurrentOwner: O, + ContextRegistry: {} +}, + Z = Y.ContextRegistry; exports.Children = { - map: Q, - forEach: function (a, b, c) { - Q(a, function () { + map: V, + forEach: function (a, b, d) { + V(a, function () { b.apply(this, arguments); - }, c); + }, d); }, count: function (a) { var b = 0; - Q(a, function () { + V(a, function () { b++; }); return b; }, toArray: function (a) { - return Q(a, function (a) { + return V(a, function (a) { return a; }) || []; }, only: function (a) { - if (!M(a)) throw Error(z(143)); + if (!R(a)) throw Error("React.Children.only expected to receive a single React element child."); return a; } }; -exports.Component = C; -exports.PureComponent = E; -exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = U; - -exports.cloneElement = function (a, b, c) { - if (null === a || void 0 === a) throw Error(z(267, a)); - var e = l({}, a.props), - d = a.key, +exports.Component = I; +exports.Fragment = p; +exports.Profiler = r; +exports.PureComponent = K; +exports.StrictMode = q; +exports.Suspense = x; +exports.SuspenseList = y; +exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Y; + +exports.cloneElement = function (a, b, d) { + if (null === a || void 0 === a) throw Error("React.cloneElement(...): The argument must be a React element, but you passed " + a + "."); + var c = G({}, a.props), + e = a.key, k = a.ref, h = a._owner; if (null != b) { - void 0 !== b.ref && (k = b.ref, h = I.current); - void 0 !== b.key && (d = "" + b.key); + void 0 !== b.ref && (k = b.ref, h = O.current); + void 0 !== b.key && (e = "" + b.key); if (a.type && a.type.defaultProps) var g = a.type.defaultProps; - for (f in b) H.call(b, f) && !J.hasOwnProperty(f) && (e[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]); + for (f in b) N.call(b, f) && !P.hasOwnProperty(f) && (c[f] = void 0 === b[f] && void 0 !== g ? g[f] : b[f]); } var f = arguments.length - 2; - if (1 === f) e.children = c;else if (1 < f) { + if (1 === f) c.children = d;else if (1 < f) { g = Array(f); - for (var n = 0; n < f; n++) g[n] = arguments[n + 2]; + for (var m = 0; m < f; m++) g[m] = arguments[m + 2]; - e.children = g; + c.children = g; } return { - $$typeof: m, + $$typeof: l, type: a.type, - key: d, + key: e, ref: k, - props: e, + props: c, _owner: h }; }; exports.createContext = function (a) { a = { - $$typeof: r, + $$typeof: u, _currentValue: a, _currentValue2: a, _threadCount: 0, Provider: null, - Consumer: null + Consumer: null, + _defaultValue: null, + _globalName: null }; a.Provider = { - $$typeof: q, + $$typeof: t, _context: a }; return a.Consumer = a; }; -exports.createElement = K; +exports.createElement = Q; exports.createFactory = function (a) { - var b = K.bind(null, a); + var b = Q.bind(null, a); b.type = a; return b; }; @@ -13549,124 +14807,154 @@ exports.createRef = function () { }; }; +exports.createServerContext = function (a, b) { + var d = !0; + + if (!Z[a]) { + d = !1; + var c = { + $$typeof: v, + _currentValue: b, + _currentValue2: b, + _defaultValue: b, + _threadCount: 0, + Provider: null, + Consumer: null, + _globalName: a + }; + c.Provider = { + $$typeof: t, + _context: c + }; + Z[a] = c; + } + + c = Z[a]; + if (c._defaultValue === D) c._defaultValue = b, c._currentValue === D && (c._currentValue = b), c._currentValue2 === D && (c._currentValue2 = b);else if (d) throw Error("ServerContext: " + a + " already defined"); + return c; +}; + exports.forwardRef = function (a) { return { - $$typeof: t, + $$typeof: w, render: a }; }; -exports.isValidElement = M; +exports.isValidElement = R; exports.lazy = function (a) { return { - $$typeof: v, + $$typeof: A, _payload: { _status: -1, _result: a }, - _init: R + _init: da }; }; exports.memo = function (a, b) { return { - $$typeof: u, + $$typeof: z, type: a, compare: void 0 === b ? null : b }; }; exports.startTransition = function (a) { - var b = T.transition; - T.transition = 1; + var b = X.transition; + X.transition = {}; try { a(); } finally { - T.transition = b; + X.transition = b; } }; -exports.unstable_act = function () { - throw Error(z(406)); -}; +exports.unstable_Cache = aa; +exports.unstable_DebugTracingMode = B; +exports.unstable_Offscreen = C; -exports.unstable_createMutableSource = function (a, b) { - return { - _getVersion: b, - _source: a, - _workInProgressVersionPrimary: null, - _workInProgressVersionSecondary: null - }; +exports.unstable_act = function () { + throw Error("act(...) is not supported in production builds of React."); }; exports.unstable_getCacheForType = function (a) { - return S.current.getCacheForType(a); + return W.current.getCacheForType(a); }; -exports.unstable_useCacheRefresh = function () { - return S.current.useCacheRefresh(); -}; - -exports.unstable_useMutableSource = function (a, b, c) { - return S.current.useMutableSource(a, b, c); +exports.unstable_getCacheSignal = function () { + return W.current.getCacheSignal(); }; -exports.unstable_useOpaqueIdentifier = function () { - return S.current.useOpaqueIdentifier(); +exports.unstable_useCacheRefresh = function () { + return W.current.useCacheRefresh(); }; exports.useCallback = function (a, b) { - return S.current.useCallback(a, b); + return W.current.useCallback(a, b); }; exports.useContext = function (a) { - return S.current.useContext(a); + return W.current.useContext(a); }; exports.useDebugValue = function () {}; exports.useDeferredValue = function (a) { - return S.current.useDeferredValue(a); + return W.current.useDeferredValue(a); }; exports.useEffect = function (a, b) { - return S.current.useEffect(a, b); + return W.current.useEffect(a, b); }; -exports.useImperativeHandle = function (a, b, c) { - return S.current.useImperativeHandle(a, b, c); +exports.useId = function () { + return W.current.useId(); +}; + +exports.useImperativeHandle = function (a, b, d) { + return W.current.useImperativeHandle(a, b, d); +}; + +exports.useInsertionEffect = function (a, b) { + return W.current.useInsertionEffect(a, b); }; exports.useLayoutEffect = function (a, b) { - return S.current.useLayoutEffect(a, b); + return W.current.useLayoutEffect(a, b); }; exports.useMemo = function (a, b) { - return S.current.useMemo(a, b); + return W.current.useMemo(a, b); }; -exports.useReducer = function (a, b, c) { - return S.current.useReducer(a, b, c); +exports.useReducer = function (a, b, d) { + return W.current.useReducer(a, b, d); }; exports.useRef = function (a) { - return S.current.useRef(a); + return W.current.useRef(a); }; exports.useState = function (a) { - return S.current.useState(a); + return W.current.useState(a); +}; + +exports.useSyncExternalStore = function (a, b, d) { + return W.current.useSyncExternalStore(a, b, d); }; exports.useTransition = function () { - return S.current.useTransition(); + return W.current.useTransition(); }; -exports.version = "17.0.3"; +exports.version = "18.1.0-experimental-af730436c-20220405"; /***/ }), -/* 31 */ +/* 34 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -13677,22 +14965,22 @@ __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, "initBackend", function() { return /* binding */ initBackend; }); // EXTERNAL MODULE: ../react-devtools-shared/src/backend/agent.js + 7 modules -var backend_agent = __webpack_require__(15); +var backend_agent = __webpack_require__(17); -// EXTERNAL MODULE: ../react-devtools-shared/src/backend/renderer.js + 2 modules -var backend_renderer = __webpack_require__(14); +// EXTERNAL MODULE: ../react-devtools-shared/src/backend/renderer.js + 5 modules +var backend_renderer = __webpack_require__(16); // EXTERNAL MODULE: ../react-devtools-shared/src/types.js var types = __webpack_require__(0); -// EXTERNAL MODULE: ../react-devtools-shared/src/utils.js + 1 modules -var utils = __webpack_require__(1); +// EXTERNAL MODULE: ../react-devtools-shared/src/utils.js +var utils = __webpack_require__(2); // EXTERNAL MODULE: ../react-devtools-shared/src/backend/utils.js var backend_utils = __webpack_require__(4); // EXTERNAL MODULE: ../react-devtools-shared/src/constants.js -var constants = __webpack_require__(2); +var constants = __webpack_require__(1); // CONCATENATED MODULE: ../react-devtools-shared/src/backend/legacy/utils.js /** @@ -13755,7 +15043,7 @@ function getData(internalInstance) { if (internalInstance._currentElement != null) { if (internalInstance._currentElement.key) { - key = '' + internalInstance._currentElement.key; + key = String(internalInstance._currentElement.key); } const elementType = internalInstance._currentElement.type; @@ -14060,17 +15348,21 @@ function attach(hook, rendererID, renderer, global) { function recordMount(internalInstance, id, parentID) { const isRoot = parentID === 0; - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { console.log('%crecordMount()', 'color: green; font-weight: bold;', id, getData(internalInstance).displayName); } if (isRoot) { // TODO Is this right? For all versions? const hasOwnerMetadata = internalInstance._currentElement != null && internalInstance._currentElement._owner != null; - pushOperation(constants["h" /* TREE_OPERATION_ADD */]); + pushOperation(constants["l" /* TREE_OPERATION_ADD */]); pushOperation(id); pushOperation(types["m" /* ElementTypeRoot */]); - pushOperation(0); // isProfilingSupported? + pushOperation(0); // StrictMode compliant? + + pushOperation(0); // Profiling flag + + pushOperation(0); // StrictMode supported? pushOperation(hasOwnerMetadata ? 1 : 0); } else { @@ -14082,7 +15374,7 @@ function attach(hook, rendererID, renderer, global) { const ownerID = internalInstance._currentElement != null && internalInstance._currentElement._owner != null ? getID(internalInstance._currentElement._owner) : 0; const displayNameStringID = getStringID(displayName); const keyStringID = getStringID(key); - pushOperation(constants["h" /* TREE_OPERATION_ADD */]); + pushOperation(constants["l" /* TREE_OPERATION_ADD */]); pushOperation(id); pushOperation(type); pushOperation(parentID); @@ -14093,7 +15385,7 @@ function attach(hook, rendererID, renderer, global) { } function recordReorder(internalInstance, id, nextChildren) { - pushOperation(constants["k" /* TREE_OPERATION_REORDER_CHILDREN */]); + pushOperation(constants["o" /* TREE_OPERATION_REORDER_CHILDREN */]); pushOperation(id); const nextChildIDs = nextChildren.map(getID); pushOperation(nextChildIDs.length); @@ -14109,7 +15401,7 @@ function attach(hook, rendererID, renderer, global) { } function crawlAndRecordInitialMounts(id, parentID, rootID) { - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { console.group('crawlAndRecordInitialMounts() id:', id); } @@ -14121,7 +15413,7 @@ function attach(hook, rendererID, renderer, global) { getChildren(internalInstance).forEach(child => crawlAndRecordInitialMounts(getID(child), id, rootID)); } - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { console.groupEnd(); } } @@ -14181,7 +15473,7 @@ function attach(hook, rendererID, renderer, global) { if (numUnmountIDs > 0) { // All unmounts except roots are batched in a single message. - operations[i++] = constants["i" /* TREE_OPERATION_REMOVE */]; // The first number is how many unmounted IDs we're gonna send. + operations[i++] = constants["m" /* TREE_OPERATION_REMOVE */]; // The first number is how many unmounted IDs we're gonna send. operations[i++] = numUnmountIDs; // Fill in the unmounts @@ -14203,7 +15495,7 @@ function attach(hook, rendererID, renderer, global) { i += pendingOperations.length; - if (constants["n" /* __DEBUG__ */]) { + if (constants["s" /* __DEBUG__ */]) { Object(utils["j" /* printOperationsArray */])(operations); } // If we've already connected to the frontend, just pass the operations through. @@ -14357,8 +15649,8 @@ function attach(hook, rendererID, renderer, global) { } } - function inspectElement(requestID, id, path) { - if (currentlyInspectedElementID !== id) { + function inspectElement(requestID, id, path, forceFullData) { + if (forceFullData || currentlyInspectedElementID !== id) { currentlyInspectedElementID = id; currentlyInspectedPaths = {}; } @@ -14377,7 +15669,7 @@ function attach(hook, rendererID, renderer, global) { mergeInspectedPaths(path); } // Any time an inspected element has an update, // we should update the selected $r value as wel. - // Do this before dehyration (cleanForBridge). + // Do this before dehydration (cleanForBridge). updateSelectedElement(id); @@ -14480,7 +15772,10 @@ function attach(hook, rendererID, renderer, global) { source, rootType: null, rendererPackageName: null, - rendererVersion: null + rendererVersion: null, + plugins: { + stylex: null + } }; } @@ -14715,6 +16010,10 @@ function attach(hook, rendererID, renderer, global) { function clearWarningsForFiberID(id) {// Not implemented } + function patchConsoleForStrictMode() {} + + function unpatchConsoleForStrictMode() {} + return { clearErrorsAndWarnings, clearErrorsForFiberID, @@ -14743,6 +16042,7 @@ function attach(hook, rendererID, renderer, global) { overrideSuspense, overrideValueAtPath, renamePath, + patchConsoleForStrictMode, prepareViewAttributeSource, prepareViewElementSource, renderer, @@ -14751,6 +16051,7 @@ function attach(hook, rendererID, renderer, global) { startProfiling, stopProfiling, storeAsGlobal, + unpatchConsoleForStrictMode, updateComponentFilters }; } @@ -14849,7 +16150,7 @@ function initBackend(hook, agent, global) { } /***/ }), -/* 32 */ +/* 35 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; @@ -14860,7 +16161,7 @@ __webpack_require__.r(__webpack_exports__); __webpack_require__.d(__webpack_exports__, "default", function() { return /* binding */ setupNativeStyleEditor; }); // EXTERNAL MODULE: ../react-devtools-shared/src/backend/agent.js + 7 modules -var backend_agent = __webpack_require__(15); +var backend_agent = __webpack_require__(17); // CONCATENATED MODULE: ../react-devtools-shared/src/backend/NativeStyleEditor/resolveBoxStyle.js /** @@ -14961,6 +16262,9 @@ function resolveBoxStyle(prefix, style) { return hasParts ? result : null; } +// EXTERNAL MODULE: ../react-devtools-shared/src/isArray.js +var isArray = __webpack_require__(6); + // CONCATENATED MODULE: ../react-devtools-shared/src/backend/NativeStyleEditor/setupNativeStyleEditor.js /** * Copyright (c) Facebook, Inc. and its affiliates. @@ -14972,6 +16276,7 @@ function resolveBoxStyle(prefix, style) { */ + function setupNativeStyleEditor(bridge, agent, resolveNativeStyle, validAttributes) { bridge.addListener('NativeStyleEditor_measure', ({ id, @@ -15126,10 +16431,10 @@ function renameStyle(agent, id, rendererID, oldName, newName, value) { instance.setNativeProps({ style: newStyle }); - } else if (Array.isArray(style)) { + } else if (Object(isArray["a" /* default */])(style)) { const lastIndex = style.length - 1; - if (typeof style[lastIndex] === 'object' && !Array.isArray(style[lastIndex])) { + if (typeof style[lastIndex] === 'object' && !Object(isArray["a" /* default */])(style[lastIndex])) { customStyle = shallowClone(style[lastIndex]); delete customStyle[oldName]; @@ -15218,10 +16523,10 @@ function setStyle(agent, id, rendererID, name, value) { instance.setNativeProps({ style: newStyle }); - } else if (Array.isArray(style)) { + } else if (Object(isArray["a" /* default */])(style)) { const lastLength = style.length - 1; - if (typeof style[lastLength] === 'object' && !Array.isArray(style[lastLength])) { + if (typeof style[lastLength] === 'object' && !Object(isArray["a" /* default */])(style[lastLength])) { agent.overrideValueAtPath({ type: 'props', id, @@ -15256,4 +16561,4 @@ function setStyle(agent, id, rendererID, name, value) { } -exports.reactDevtoolsBackend = reactDevtoolsBackend; +exports.reactDevtoolsBackend = reactDevtoolsBackend; \ No newline at end of file From 5f41313fe85793e76707bb3157a6f8852c15c3fe Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Wed, 6 Apr 2022 10:42:23 -0400 Subject: [PATCH 2/3] Re-added missing export to hook.js --- devtools/server/actors/replay/react-devtools/hook.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devtools/server/actors/replay/react-devtools/hook.js b/devtools/server/actors/replay/react-devtools/hook.js index 7829dde861d43..63936d47ae248 100644 --- a/devtools/server/actors/replay/react-devtools/hook.js +++ b/devtools/server/actors/replay/react-devtools/hook.js @@ -536,4 +536,6 @@ function installHook(target) { }); return hook; -} \ No newline at end of file +} + +exports.installHook = installHook; \ No newline at end of file From 6ff66de84437ae5fded9d4951ddf0036f7b3fc15 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Thu, 7 Apr 2022 10:50:42 -0400 Subject: [PATCH 3/3] Empty commit to trigger CI