1(function webpackUniversalModuleDefinition(root, factory) { 2 if(typeof exports === 'object' && typeof module === 'object') 3 module.exports = factory(require("_")); 4 else if(typeof define === 'function' && define.amd) 5 define(["_"], factory); 6 else if(typeof exports === 'object') 7 exports["Library"] = factory(require("_")); 8 else 9 root["Library"] = factory(root["_"]); 10})(self, (__WEBPACK_EXTERNAL_MODULE_lodash__) => { 11return /******/ (() => { // webpackBootstrap 12/******/ var __webpack_modules__ = ({ 13
vendor: 30,071 bytes, lines 14-506
14/***/ "./node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.esm.js": 15/*!*******************************************************************************!*\ 16 !*** ./node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.esm.js ***! 17 \*******************************************************************************/ 18/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 19 20"use strict"; 21__webpack_require__.r(__webpack_exports__); 22/* harmony export */ __webpack_require__.d(__webpack_exports__, { 23/* harmony export */ ApiProvider: () => (/* binding */ ApiProvider), 24/* harmony export */ QueryStatus: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.QueryStatus), 25/* harmony export */ buildCreateApi: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.buildCreateApi), 26/* harmony export */ copyWithStructuralSharing: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.copyWithStructuralSharing), 27/* harmony export */ coreModule: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.coreModule), 28/* harmony export */ coreModuleName: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.coreModuleName), 29/* harmony export */ createApi: () => (/* binding */ createApi), 30/* harmony export */ defaultSerializeQueryArgs: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.defaultSerializeQueryArgs), 31/* harmony export */ fakeBaseQuery: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.fakeBaseQuery), 32/* harmony export */ fetchBaseQuery: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.fetchBaseQuery), 33/* harmony export */ reactHooksModule: () => (/* binding */ reactHooksModule), 34/* harmony export */ reactHooksModuleName: () => (/* binding */ reactHooksModuleName), 35/* harmony export */ retry: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.retry), 36/* harmony export */ setupListeners: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.setupListeners), 37/* harmony export */ skipSelector: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.skipSelector), 38/* harmony export */ skipToken: () => (/* reexport safe */ _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.skipToken) 39/* harmony export */ }); 40/* harmony import */ var _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @reduxjs/toolkit/query */ "./node_modules/@reduxjs/toolkit/dist/query/rtk-query.esm.js"); 41/* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @reduxjs/toolkit */ "./node_modules/reselect/es/index.js"); 42/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 43/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 44/* harmony import */ var react_redux__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/es/index.js"); 45/* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @reduxjs/toolkit */ "./node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js"); 46var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) { 47 for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) 48 to[j] = from[i]; 49 return to; 50}; 51var __defProp = Object.defineProperty; 52var __defProps = Object.defineProperties; 53var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 54var __getOwnPropSymbols = Object.getOwnPropertySymbols; 55var __hasOwnProp = Object.prototype.hasOwnProperty; 56var __propIsEnum = Object.prototype.propertyIsEnumerable; 57var __defNormalProp = function (obj, key, value) { return key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value }) : obj[key] = value; }; 58var __spreadValues = function (a, b) { 59 for (var prop in b || (b = {})) 60 if (__hasOwnProp.call(b, prop)) 61 __defNormalProp(a, prop, b[prop]); 62 if (__getOwnPropSymbols) 63 for (var _i = 0, _c = __getOwnPropSymbols(b); _i < _c.length; _i++) { 64 var prop = _c[_i]; 65 if (__propIsEnum.call(b, prop)) 66 __defNormalProp(a, prop, b[prop]); 67 } 68 return a; 69}; 70var __spreadProps = function (a, b) { return __defProps(a, __getOwnPropDescs(b)); }; 71// src/query/react/index.ts 72 73// src/query/react/buildHooks.ts 74 75 76 77 78// src/query/react/useSerializedStableValue.ts 79 80function useStableQueryArgs(queryArgs, serialize, endpointDefinition, endpointName) { 81 var incoming = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return ({ 82 queryArgs: queryArgs, 83 serialized: typeof queryArgs == "object" ? serialize({ queryArgs: queryArgs, endpointDefinition: endpointDefinition, endpointName: endpointName }) : queryArgs 84 }); }, [queryArgs, serialize, endpointDefinition, endpointName]); 85 var cache2 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(incoming); 86 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { 87 if (cache2.current.serialized !== incoming.serialized) { 88 cache2.current = incoming; 89 } 90 }, [incoming]); 91 return cache2.current.serialized === incoming.serialized ? cache2.current.queryArgs : queryArgs; 92} 93// src/query/react/constants.ts 94var UNINITIALIZED_VALUE = Symbol(); 95// src/query/react/useShallowStableValue.ts 96 97 98function useShallowStableValue(value) { 99 var cache2 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(value); 100 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { 101 if (!(0,react_redux__WEBPACK_IMPORTED_MODULE_1__.shallowEqual)(cache2.current, value)) { 102 cache2.current = value; 103 } 104 }, [value]); 105 return (0,react_redux__WEBPACK_IMPORTED_MODULE_1__.shallowEqual)(cache2.current, value) ? cache2.current : value; 106} 107// src/query/defaultSerializeQueryArgs.ts 108 109var cache = WeakMap ? new WeakMap() : void 0; 110var defaultSerializeQueryArgs = function (_c) { 111 var endpointName = _c.endpointName, queryArgs = _c.queryArgs; 112 var serialized = ""; 113 var cached = cache == null ? void 0 : cache.get(queryArgs); 114 if (typeof cached === "string") { 115 serialized = cached; 116 } 117 else { 118 var stringified = JSON.stringify(queryArgs, function (key, value) { return (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(value) ? Object.keys(value).sort().reduce(function (acc, key2) { 119 acc[key2] = value[key2]; 120 return acc; 121 }, {}) : value; }); 122 if ((0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_2__.isPlainObject)(queryArgs)) { 123 cache == null ? void 0 : cache.set(queryArgs, stringified); 124 } 125 serialized = stringified; 126 } 127 return endpointName + "(" + serialized + ")"; 128}; 129// src/query/react/buildHooks.ts 130var useIsomorphicLayoutEffect = typeof window !== "undefined" && !!window.document && !!window.document.createElement ? react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_0__.useEffect; 131var defaultMutationStateSelector = function (x) { return x; }; 132var noPendingQueryStateSelector = function (selected) { 133 if (selected.isUninitialized) { 134 return __spreadProps(__spreadValues({}, selected), { 135 isUninitialized: false, 136 isFetching: true, 137 isLoading: selected.data !== void 0 ? false : true, 138 status: _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.QueryStatus.pending 139 }); 140 } 141 return selected; 142}; 143function buildHooks(_c) { 144 var api = _c.api, _d = _c.moduleOptions, batch = _d.batch, useDispatch = _d.useDispatch, useSelector = _d.useSelector, useStore = _d.useStore, unstable__sideEffectsInRender = _d.unstable__sideEffectsInRender, serializeQueryArgs = _c.serializeQueryArgs, context = _c.context; 145 var usePossiblyImmediateEffect = unstable__sideEffectsInRender ? function (cb) { return cb(); } : react__WEBPACK_IMPORTED_MODULE_0__.useEffect; 146 return { buildQueryHooks: buildQueryHooks, buildMutationHook: buildMutationHook, usePrefetch: usePrefetch }; 147 function queryStatePreSelector(currentState, lastResult, queryArgs) { 148 if ((lastResult == null ? void 0 : lastResult.endpointName) && currentState.isUninitialized) { 149 var endpointName = lastResult.endpointName; 150 var endpointDefinition = context.endpointDefinitions[endpointName]; 151 if (serializeQueryArgs({ 152 queryArgs: lastResult.originalArgs, 153 endpointDefinition: endpointDefinition, 154 endpointName: endpointName 155 }) === serializeQueryArgs({ 156 queryArgs: queryArgs, 157 endpointDefinition: endpointDefinition, 158 endpointName: endpointName 159 })) 160 lastResult = void 0; 161 } 162 var data = currentState.isSuccess ? currentState.data : lastResult == null ? void 0 : lastResult.data; 163 if (data === void 0) 164 data = currentState.data; 165 var hasData = data !== void 0; 166 var isFetching = currentState.isLoading; 167 var isLoading = !hasData && isFetching; 168 var isSuccess = currentState.isSuccess || isFetching && hasData; 169 return __spreadProps(__spreadValues({}, currentState), { 170 data: data, 171 currentData: currentState.data, 172 isFetching: isFetching, 173 isLoading: isLoading, 174 isSuccess: isSuccess 175 }); 176 } 177 function usePrefetch(endpointName, defaultOptions) { 178 var dispatch = useDispatch(); 179 var stableDefaultOptions = useShallowStableValue(defaultOptions); 180 return (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (arg, options) { return dispatch(api.util.prefetch(endpointName, arg, __spreadValues(__spreadValues({}, stableDefaultOptions), options))); }, [endpointName, dispatch, stableDefaultOptions]); 181 } 182 function buildQueryHooks(name) { 183 var useQuerySubscription = function (arg, _c) { 184 var _d = _c === void 0 ? {} : _c, refetchOnReconnect = _d.refetchOnReconnect, refetchOnFocus = _d.refetchOnFocus, refetchOnMountOrArgChange = _d.refetchOnMountOrArgChange, _e = _d.skip, skip = _e === void 0 ? false : _e, _f = _d.pollingInterval, pollingInterval = _f === void 0 ? 0 : _f; 185 var initiate = api.endpoints[name].initiate; 186 var dispatch = useDispatch(); 187 var stableArg = useStableQueryArgs(skip ? _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.skipToken : arg, defaultSerializeQueryArgs, context.endpointDefinitions[name], name); 188 var stableSubscriptionOptions = useShallowStableValue({ 189 refetchOnReconnect: refetchOnReconnect, 190 refetchOnFocus: refetchOnFocus, 191 pollingInterval: pollingInterval 192 }); 193 var lastRenderHadSubscription = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); 194 var promiseRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); 195 var _g = promiseRef.current || {}, queryCacheKey = _g.queryCacheKey, requestId = _g.requestId; 196 var currentRenderHasSubscription = false; 197 if (queryCacheKey && requestId) { 198 var returnedValue = dispatch(api.internalActions.internal_probeSubscription({ 199 queryCacheKey: queryCacheKey, 200 requestId: requestId 201 })); 202 if (true) { 203 if (typeof returnedValue !== "boolean") { 204 throw new Error("Warning: Middleware for RTK-Query API at reducerPath \"" + api.reducerPath + "\" has not been added to the store.\n You must add the middleware for RTK-Query to function correctly!"); 205 } 206 } 207 currentRenderHasSubscription = !!returnedValue; 208 } 209 var subscriptionRemoved = !currentRenderHasSubscription && lastRenderHadSubscription.current; 210 usePossiblyImmediateEffect(function () { 211 lastRenderHadSubscription.current = currentRenderHasSubscription; 212 }); 213 usePossiblyImmediateEffect(function () { 214 if (subscriptionRemoved) { 215 promiseRef.current = void 0; 216 } 217 }, [subscriptionRemoved]); 218 usePossiblyImmediateEffect(function () { 219 var _a; 220 var lastPromise = promiseRef.current; 221 if (typeof process !== "undefined" && "development" === "removeMeOnCompilation") {} 222 if (stableArg === _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.skipToken) { 223 lastPromise == null ? void 0 : lastPromise.unsubscribe(); 224 promiseRef.current = void 0; 225 return; 226 } 227 var lastSubscriptionOptions = (_a = promiseRef.current) == null ? void 0 : _a.subscriptionOptions; 228 if (!lastPromise || lastPromise.arg !== stableArg) { 229 lastPromise == null ? void 0 : lastPromise.unsubscribe(); 230 var promise = dispatch(initiate(stableArg, { 231 subscriptionOptions: stableSubscriptionOptions, 232 forceRefetch: refetchOnMountOrArgChange 233 })); 234 promiseRef.current = promise; 235 } 236 else if (stableSubscriptionOptions !== lastSubscriptionOptions) { 237 lastPromise.updateSubscriptionOptions(stableSubscriptionOptions); 238 } 239 }, [ 240 dispatch, 241 initiate, 242 refetchOnMountOrArgChange, 243 stableArg, 244 stableSubscriptionOptions, 245 subscriptionRemoved 246 ]); 247 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { 248 return function () { 249 var _a; 250 (_a = promiseRef.current) == null ? void 0 : _a.unsubscribe(); 251 promiseRef.current = void 0; 252 }; 253 }, []); 254 return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return ({ 255 refetch: function () { 256 var _a; 257 if (!promiseRef.current) 258 throw new Error("Cannot refetch a query that has not been started yet."); 259 return (_a = promiseRef.current) == null ? void 0 : _a.refetch(); 260 } 261 }); }, []); 262 }; 263 var useLazyQuerySubscription = function (_c) { 264 var _d = _c === void 0 ? {} : _c, refetchOnReconnect = _d.refetchOnReconnect, refetchOnFocus = _d.refetchOnFocus, _e = _d.pollingInterval, pollingInterval = _e === void 0 ? 0 : _e; 265 var initiate = api.endpoints[name].initiate; 266 var dispatch = useDispatch(); 267 var _f = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(UNINITIALIZED_VALUE), arg = _f[0], setArg = _f[1]; 268 var promiseRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); 269 var stableSubscriptionOptions = useShallowStableValue({ 270 refetchOnReconnect: refetchOnReconnect, 271 refetchOnFocus: refetchOnFocus, 272 pollingInterval: pollingInterval 273 }); 274 usePossiblyImmediateEffect(function () { 275 var _a, _b; 276 var lastSubscriptionOptions = (_a = promiseRef.current) == null ? void 0 : _a.subscriptionOptions; 277 if (stableSubscriptionOptions !== lastSubscriptionOptions) { 278 (_b = promiseRef.current) == null ? void 0 : _b.updateSubscriptionOptions(stableSubscriptionOptions); 279 } 280 }, [stableSubscriptionOptions]); 281 var subscriptionOptionsRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(stableSubscriptionOptions); 282 usePossiblyImmediateEffect(function () { 283 subscriptionOptionsRef.current = stableSubscriptionOptions; 284 }, [stableSubscriptionOptions]); 285 var trigger = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (arg2, preferCacheValue) { 286 if (preferCacheValue === void 0) { preferCacheValue = false; } 287 var promise; 288 batch(function () { 289 var _a; 290 (_a = promiseRef.current) == null ? void 0 : _a.unsubscribe(); 291 promiseRef.current = promise = dispatch(initiate(arg2, { 292 subscriptionOptions: subscriptionOptionsRef.current, 293 forceRefetch: !preferCacheValue 294 })); 295 setArg(arg2); 296 }); 297 return promise; 298 }, [dispatch, initiate]); 299 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { 300 return function () { 301 var _a; 302 (_a = promiseRef == null ? void 0 : promiseRef.current) == null ? void 0 : _a.unsubscribe(); 303 }; 304 }, []); 305 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { 306 if (arg !== UNINITIALIZED_VALUE && !promiseRef.current) { 307 trigger(arg, true); 308 } 309 }, [arg, trigger]); 310 return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return [trigger, arg]; }, [trigger, arg]); 311 }; 312 var useQueryState = function (arg, _c) { 313 var _d = _c === void 0 ? {} : _c, _e = _d.skip, skip = _e === void 0 ? false : _e, selectFromResult = _d.selectFromResult; 314 var select = api.endpoints[name].select; 315 var stableArg = useStableQueryArgs(skip ? _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.skipToken : arg, serializeQueryArgs, context.endpointDefinitions[name], name); 316 var lastValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(); 317 var selectDefaultResult = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_4__.createSelector)([ 318 select(stableArg), 319 function (_, lastResult) { return lastResult; }, 320 function (_) { return stableArg; } 321 ], queryStatePreSelector); }, [select, stableArg]); 322 var querySelector = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return selectFromResult ? (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_4__.createSelector)([selectDefaultResult], selectFromResult) : selectDefaultResult; }, [selectDefaultResult, selectFromResult]); 323 var currentState = useSelector(function (state) { return querySelector(state, lastValue.current); }, react_redux__WEBPACK_IMPORTED_MODULE_1__.shallowEqual); 324 var store = useStore(); 325 var newLastValue = selectDefaultResult(store.getState(), lastValue.current); 326 useIsomorphicLayoutEffect(function () { 327 lastValue.current = newLastValue; 328 }, [newLastValue]); 329 return currentState; 330 }; 331 return { 332 useQueryState: useQueryState, 333 useQuerySubscription: useQuerySubscription, 334 useLazyQuerySubscription: useLazyQuerySubscription, 335 useLazyQuery: function (options) { 336 var _c = useLazyQuerySubscription(options), trigger = _c[0], arg = _c[1]; 337 var queryStateResults = useQueryState(arg, __spreadProps(__spreadValues({}, options), { 338 skip: arg === UNINITIALIZED_VALUE 339 })); 340 var info = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return ({ lastArg: arg }); }, [arg]); 341 return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return [trigger, queryStateResults, info]; }, [trigger, queryStateResults, info]); 342 }, 343 useQuery: function (arg, options) { 344 var querySubscriptionResults = useQuerySubscription(arg, options); 345 var queryStateResults = useQueryState(arg, __spreadValues({ 346 selectFromResult: arg === _reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.skipToken || (options == null ? void 0 : options.skip) ? void 0 : noPendingQueryStateSelector 347 }, options)); 348 var data = queryStateResults.data, status = queryStateResults.status, isLoading = queryStateResults.isLoading, isSuccess = queryStateResults.isSuccess, isError = queryStateResults.isError, error = queryStateResults.error; 349 (0,react__WEBPACK_IMPORTED_MODULE_0__.useDebugValue)({ data: data, status: status, isLoading: isLoading, isSuccess: isSuccess, isError: isError, error: error }); 350 return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return __spreadValues(__spreadValues({}, queryStateResults), querySubscriptionResults); }, [queryStateResults, querySubscriptionResults]); 351 } 352 }; 353 } 354 function buildMutationHook(name) { 355 return function (_c) { 356 var _d = _c === void 0 ? {} : _c, _e = _d.selectFromResult, selectFromResult = _e === void 0 ? defaultMutationStateSelector : _e, fixedCacheKey = _d.fixedCacheKey; 357 var _f = api.endpoints[name], select = _f.select, initiate = _f.initiate; 358 var dispatch = useDispatch(); 359 var _g = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(), promise = _g[0], setPromise = _g[1]; 360 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { return function () { 361 if (!(promise == null ? void 0 : promise.arg.fixedCacheKey)) { 362 promise == null ? void 0 : promise.reset(); 363 } 364 }; }, [promise]); 365 var triggerMutation = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function (arg) { 366 var promise2 = dispatch(initiate(arg, { fixedCacheKey: fixedCacheKey })); 367 setPromise(promise2); 368 return promise2; 369 }, [dispatch, initiate, fixedCacheKey]); 370 var requestId = (promise || {}).requestId; 371 var mutationSelector = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_4__.createSelector)([select({ fixedCacheKey: fixedCacheKey, requestId: promise == null ? void 0 : promise.requestId })], selectFromResult); }, [select, promise, selectFromResult, fixedCacheKey]); 372 var currentState = useSelector(mutationSelector, react_redux__WEBPACK_IMPORTED_MODULE_1__.shallowEqual); 373 var originalArgs = fixedCacheKey == null ? promise == null ? void 0 : promise.arg.originalArgs : void 0; 374 var reset = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)(function () { 375 batch(function () { 376 if (promise) { 377 setPromise(void 0); 378 } 379 if (fixedCacheKey) { 380 dispatch(api.internalActions.removeMutationResult({ 381 requestId: requestId, 382 fixedCacheKey: fixedCacheKey 383 })); 384 } 385 }); 386 }, [dispatch, fixedCacheKey, promise, requestId]); 387 var endpointName = currentState.endpointName, data = currentState.data, status = currentState.status, isLoading = currentState.isLoading, isSuccess = currentState.isSuccess, isError = currentState.isError, error = currentState.error; 388 (0,react__WEBPACK_IMPORTED_MODULE_0__.useDebugValue)({ 389 endpointName: endpointName, 390 data: data, 391 status: status, 392 isLoading: isLoading, 393 isSuccess: isSuccess, 394 isError: isError, 395 error: error 396 }); 397 var finalState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return __spreadProps(__spreadValues({}, currentState), { originalArgs: originalArgs, reset: reset }); }, [currentState, originalArgs, reset]); 398 return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(function () { return [triggerMutation, finalState]; }, [triggerMutation, finalState]); 399 }; 400 } 401} 402// src/query/endpointDefinitions.ts 403var DefinitionType; 404(function (DefinitionType2) { 405 DefinitionType2["query"] = "query"; 406 DefinitionType2["mutation"] = "mutation"; 407})(DefinitionType || (DefinitionType = {})); 408function isQueryDefinition(e) { 409 return e.type === DefinitionType.query; 410} 411function isMutationDefinition(e) { 412 return e.type === DefinitionType.mutation; 413} 414// src/query/utils/capitalize.ts 415function capitalize(str) { 416 return str.replace(str[0], str[0].toUpperCase()); 417} 418// src/query/tsHelpers.ts 419function safeAssign(target) { 420 var args = []; 421 for (var _i = 1; _i < arguments.length; _i++) { 422 args[_i - 1] = arguments[_i]; 423 } 424 Object.assign.apply(Object, __spreadArray([target], args)); 425} 426// src/query/react/module.ts 427 428var reactHooksModuleName = /* @__PURE__ */ Symbol(); 429var reactHooksModule = function (_c) { 430 var _d = _c === void 0 ? {} : _c, _e = _d.batch, batch = _e === void 0 ? react_redux__WEBPACK_IMPORTED_MODULE_1__.batch : _e, _f = _d.useDispatch, useDispatch = _f === void 0 ? react_redux__WEBPACK_IMPORTED_MODULE_1__.useDispatch : _f, _g = _d.useSelector, useSelector = _g === void 0 ? react_redux__WEBPACK_IMPORTED_MODULE_1__.useSelector : _g, _h = _d.useStore, useStore = _h === void 0 ? react_redux__WEBPACK_IMPORTED_MODULE_1__.useStore : _h, _j = _d.unstable__sideEffectsInRender, unstable__sideEffectsInRender = _j === void 0 ? false : _j; 431 return ({ 432 name: reactHooksModuleName, 433 init: function (api, _c, context) { 434 var serializeQueryArgs = _c.serializeQueryArgs; 435 var anyApi = api; 436 var _d = buildHooks({ 437 api: api, 438 moduleOptions: { 439 batch: batch, 440 useDispatch: useDispatch, 441 useSelector: useSelector, 442 useStore: useStore, 443 unstable__sideEffectsInRender: unstable__sideEffectsInRender 444 }, 445 serializeQueryArgs: serializeQueryArgs, 446 context: context 447 }), buildQueryHooks = _d.buildQueryHooks, buildMutationHook = _d.buildMutationHook, usePrefetch = _d.usePrefetch; 448 safeAssign(anyApi, { usePrefetch: usePrefetch }); 449 safeAssign(context, { batch: batch }); 450 return { 451 injectEndpoint: function (endpointName, definition) { 452 if (isQueryDefinition(definition)) { 453 var _c = buildQueryHooks(endpointName), useQuery = _c.useQuery, useLazyQuery = _c.useLazyQuery, useLazyQuerySubscription = _c.useLazyQuerySubscription, useQueryState = _c.useQueryState, useQuerySubscription = _c.useQuerySubscription; 454 safeAssign(anyApi.endpoints[endpointName], { 455 useQuery: useQuery, 456 useLazyQuery: useLazyQuery, 457 useLazyQuerySubscription: useLazyQuerySubscription, 458 useQueryState: useQueryState, 459 useQuerySubscription: useQuerySubscription 460 }); 461 api["use" + capitalize(endpointName) + "Query"] = useQuery; 462 api["useLazy" + capitalize(endpointName) + "Query"] = useLazyQuery; 463 } 464 else if (isMutationDefinition(definition)) { 465 var useMutation = buildMutationHook(endpointName); 466 safeAssign(anyApi.endpoints[endpointName], { 467 useMutation: useMutation 468 }); 469 api["use" + capitalize(endpointName) + "Mutation"] = useMutation; 470 } 471 } 472 }; 473 } 474 }); 475}; 476// src/query/react/index.ts 477 478// src/query/react/ApiProvider.tsx 479 480 481 482 483 484function ApiProvider(props) { 485 var store = react__WEBPACK_IMPORTED_MODULE_0___default().useState(function () { 486 var _c; 487 return (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_2__.configureStore)({ 488 reducer: (_c = {}, 489 _c[props.api.reducerPath] = props.api.reducer, 490 _c), 491 middleware: function (gDM) { return gDM().concat(props.api.middleware); } 492 }); 493 })[0]; 494 (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () { return props.setupListeners === false ? void 0 : (0,_reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.setupListeners)(store.dispatch, props.setupListeners); }, [props.setupListeners, store.dispatch]); 495 return /* @__PURE__ */ react__WEBPACK_IMPORTED_MODULE_0___default().createElement(react_redux__WEBPACK_IMPORTED_MODULE_1__.Provider, { 496 store: store, 497 context: props.context 498 }, props.children); 499} 500// src/query/react/index.ts 501var createApi = /* @__PURE__ */ (0,_reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.buildCreateApi)((0,_reduxjs_toolkit_query__WEBPACK_IMPORTED_MODULE_3__.coreModule)(), reactHooksModule()); 502 503//# sourceMappingURL=rtk-query-react.esm.js.map 504 505/***/ }), 506
vendor: 116,319 bytes, lines 507-2750
507/***/ "./node_modules/@reduxjs/toolkit/dist/query/rtk-query.esm.js": 508/*!*******************************************************************!*\ 509 !*** ./node_modules/@reduxjs/toolkit/dist/query/rtk-query.esm.js ***! 510 \*******************************************************************/ 511/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 512 513"use strict"; 514__webpack_require__.r(__webpack_exports__); 515/* harmony export */ __webpack_require__.d(__webpack_exports__, { 516/* harmony export */ QueryStatus: () => (/* binding */ QueryStatus), 517/* harmony export */ buildCreateApi: () => (/* binding */ buildCreateApi), 518/* harmony export */ copyWithStructuralSharing: () => (/* binding */ copyWithStructuralSharing), 519/* harmony export */ coreModule: () => (/* binding */ coreModule), 520/* harmony export */ coreModuleName: () => (/* binding */ coreModuleName), 521/* harmony export */ createApi: () => (/* binding */ createApi), 522/* harmony export */ defaultSerializeQueryArgs: () => (/* binding */ defaultSerializeQueryArgs), 523/* harmony export */ fakeBaseQuery: () => (/* binding */ fakeBaseQuery), 524/* harmony export */ fetchBaseQuery: () => (/* binding */ fetchBaseQuery), 525/* harmony export */ retry: () => (/* binding */ retry), 526/* harmony export */ setupListeners: () => (/* binding */ setupListeners), 527/* harmony export */ skipSelector: () => (/* binding */ skipSelector), 528/* harmony export */ skipToken: () => (/* binding */ skipToken) 529/* harmony export */ }); 530/* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @reduxjs/toolkit */ "./node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js"); 531/* harmony import */ var immer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! immer */ "./node_modules/immer/dist/immer.esm.mjs"); 532/* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @reduxjs/toolkit */ "./node_modules/reselect/es/index.js"); 533/* harmony import */ var _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @reduxjs/toolkit */ "./node_modules/redux/es/redux.js"); 534/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! reselect */ "./node_modules/reselect/es/defaultMemoize.js"); 535/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 536var __generator = (undefined && undefined.__generator) || function (thisArg, body) { 537 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; 538 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 539 function verb(n) { return function (v) { return step([n, v]); }; } 540 function step(op) { 541 if (f) throw new TypeError("Generator is already executing."); 542 while (_) try { 543 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 544 if (y = 0, t) op = [op[0] & 2, t.value]; 545 switch (op[0]) { 546 case 0: case 1: t = op; break; 547 case 4: _.label++; return { value: op[1], done: false }; 548 case 5: _.label++; y = op[1]; op = [0]; continue; 549 case 7: op = _.ops.pop(); _.trys.pop(); continue; 550 default: 551 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 552 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 553 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 554 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 555 if (t[2]) _.ops.pop(); 556 _.trys.pop(); continue; 557 } 558 op = body.call(thisArg, _); 559 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 560 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 561 } 562}; 563var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) { 564 for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) 565 to[j] = from[i]; 566 return to; 567}; 568var __defProp = Object.defineProperty; 569var __defProps = Object.defineProperties; 570var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 571var __getOwnPropSymbols = Object.getOwnPropertySymbols; 572var __hasOwnProp = Object.prototype.hasOwnProperty; 573var __propIsEnum = Object.prototype.propertyIsEnumerable; 574var __defNormalProp = function (obj, key, value) { return key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value }) : obj[key] = value; }; 575var __spreadValues = function (a, b) { 576 for (var prop in b || (b = {})) 577 if (__hasOwnProp.call(b, prop)) 578 __defNormalProp(a, prop, b[prop]); 579 if (__getOwnPropSymbols) 580 for (var _j = 0, _k = __getOwnPropSymbols(b); _j < _k.length; _j++) { 581 var prop = _k[_j]; 582 if (__propIsEnum.call(b, prop)) 583 __defNormalProp(a, prop, b[prop]); 584 } 585 return a; 586}; 587var __spreadProps = function (a, b) { return __defProps(a, __getOwnPropDescs(b)); }; 588var __objRest = function (source, exclude) { 589 var target = {}; 590 for (var prop in source) 591 if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) 592 target[prop] = source[prop]; 593 if (source != null && __getOwnPropSymbols) 594 for (var _j = 0, _k = __getOwnPropSymbols(source); _j < _k.length; _j++) { 595 var prop = _k[_j]; 596 if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) 597 target[prop] = source[prop]; 598 } 599 return target; 600}; 601var __async = function (__this, __arguments, generator) { 602 return new Promise(function (resolve, reject) { 603 var fulfilled = function (value) { 604 try { 605 step(generator.next(value)); 606 } 607 catch (e) { 608 reject(e); 609 } 610 }; 611 var rejected = function (value) { 612 try { 613 step(generator.throw(value)); 614 } 615 catch (e) { 616 reject(e); 617 } 618 }; 619 var step = function (x) { return x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); }; 620 step((generator = generator.apply(__this, __arguments)).next()); 621 }); 622}; 623// src/query/core/apiState.ts 624var QueryStatus; 625(function (QueryStatus2) { 626 QueryStatus2["uninitialized"] = "uninitialized"; 627 QueryStatus2["pending"] = "pending"; 628 QueryStatus2["fulfilled"] = "fulfilled"; 629 QueryStatus2["rejected"] = "rejected"; 630})(QueryStatus || (QueryStatus = {})); 631function getRequestStatusFlags(status) { 632 return { 633 status: status, 634 isUninitialized: status === QueryStatus.uninitialized, 635 isLoading: status === QueryStatus.pending, 636 isSuccess: status === QueryStatus.fulfilled, 637 isError: status === QueryStatus.rejected 638 }; 639} 640// src/query/utils/isAbsoluteUrl.ts 641function isAbsoluteUrl(url) { 642 return new RegExp("(^|:)//").test(url); 643} 644// src/query/utils/joinUrls.ts 645var withoutTrailingSlash = function (url) { return url.replace(/\/$/, ""); }; 646var withoutLeadingSlash = function (url) { return url.replace(/^\//, ""); }; 647function joinUrls(base, url) { 648 if (!base) { 649 return url; 650 } 651 if (!url) { 652 return base; 653 } 654 if (isAbsoluteUrl(url)) { 655 return url; 656 } 657 var delimiter = base.endsWith("/") || !url.startsWith("?") ? "/" : ""; 658 base = withoutTrailingSlash(base); 659 url = withoutLeadingSlash(url); 660 return "" + base + delimiter + url; 661} 662// src/query/utils/flatten.ts 663var flatten = function (arr) { return [].concat.apply([], arr); }; 664// src/query/utils/isOnline.ts 665function isOnline() { 666 return typeof navigator === "undefined" ? true : navigator.onLine === void 0 ? true : navigator.onLine; 667} 668// src/query/utils/isDocumentVisible.ts 669function isDocumentVisible() { 670 if (typeof document === "undefined") { 671 return true; 672 } 673 return document.visibilityState !== "hidden"; 674} 675// src/query/utils/copyWithStructuralSharing.ts 676 677var isPlainObject = _reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isPlainObject; 678function copyWithStructuralSharing(oldObj, newObj) { 679 if (oldObj === newObj || !(isPlainObject(oldObj) && isPlainObject(newObj) || Array.isArray(oldObj) && Array.isArray(newObj))) { 680 return newObj; 681 } 682 var newKeys = Object.keys(newObj); 683 var oldKeys = Object.keys(oldObj); 684 var isSameObject = newKeys.length === oldKeys.length; 685 var mergeObj = Array.isArray(newObj) ? [] : {}; 686 for (var _j = 0, newKeys_1 = newKeys; _j < newKeys_1.length; _j++) { 687 var key = newKeys_1[_j]; 688 mergeObj[key] = copyWithStructuralSharing(oldObj[key], newObj[key]); 689 if (isSameObject) 690 isSameObject = oldObj[key] === mergeObj[key]; 691 } 692 return isSameObject ? oldObj : mergeObj; 693} 694// src/query/fetchBaseQuery.ts 695 696var defaultFetchFn = function () { 697 var args = []; 698 for (var _j = 0; _j < arguments.length; _j++) { 699 args[_j] = arguments[_j]; 700 } 701 return fetch.apply(void 0, args); 702}; 703var defaultValidateStatus = function (response) { return response.status >= 200 && response.status <= 299; }; 704var defaultIsJsonContentType = function (headers) { return /ion\/(vnd\.api\+)?json/.test(headers.get("content-type") || ""); }; 705function stripUndefined(obj) { 706 if (!(0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(obj)) { 707 return obj; 708 } 709 var copy = __spreadValues({}, obj); 710 for (var _j = 0, _k = Object.entries(copy); _j < _k.length; _j++) { 711 var _l = _k[_j], k = _l[0], v = _l[1]; 712 if (v === void 0) 713 delete copy[k]; 714 } 715 return copy; 716} 717function fetchBaseQuery(_a) { 718 var _this = this; 719 if (_a === void 0) { _a = {}; } 720 var _b = _a, baseUrl = _b.baseUrl, _j = _b.prepareHeaders, prepareHeaders = _j === void 0 ? function (x) { return x; } : _j, _k = _b.fetchFn, fetchFn = _k === void 0 ? defaultFetchFn : _k, paramsSerializer = _b.paramsSerializer, _l = _b.isJsonContentType, isJsonContentType = _l === void 0 ? defaultIsJsonContentType : _l, _m = _b.jsonContentType, jsonContentType = _m === void 0 ? "application/json" : _m, jsonReplacer = _b.jsonReplacer, defaultTimeout = _b.timeout, globalResponseHandler = _b.responseHandler, globalValidateStatus = _b.validateStatus, baseFetchOptions = __objRest(_b, [ 721 "baseUrl", 722 "prepareHeaders", 723 "fetchFn", 724 "paramsSerializer", 725 "isJsonContentType", 726 "jsonContentType", 727 "jsonReplacer", 728 "timeout", 729 "responseHandler", 730 "validateStatus" 731 ]); 732 if (typeof fetch === "undefined" && fetchFn === defaultFetchFn) { 733 console.warn("Warning: `fetch` is not available. Please supply a custom `fetchFn` property to use `fetchBaseQuery` on SSR environments."); 734 } 735 return function (arg, api) { return __async(_this, null, function () { 736 var signal, getState, extra, endpoint, forced, type, meta, _a2, url, _j, headers, _k, params, _l, responseHandler, _m, validateStatus, _o, timeout, rest, config, _p, isJsonifiable, divider, query, request, requestClone, response, timedOut, timeoutId, e_1, responseClone, resultData, responseText, handleResponseError_1, e_2; 737 return __generator(this, function (_q) { 738 switch (_q.label) { 739 case 0: 740 signal = api.signal, getState = api.getState, extra = api.extra, endpoint = api.endpoint, forced = api.forced, type = api.type; 741 _a2 = typeof arg == "string" ? { url: arg } : arg, url = _a2.url, _j = _a2.headers, headers = _j === void 0 ? new Headers(baseFetchOptions.headers) : _j, _k = _a2.params, params = _k === void 0 ? void 0 : _k, _l = _a2.responseHandler, responseHandler = _l === void 0 ? globalResponseHandler != null ? globalResponseHandler : "json" : _l, _m = _a2.validateStatus, validateStatus = _m === void 0 ? globalValidateStatus != null ? globalValidateStatus : defaultValidateStatus : _m, _o = _a2.timeout, timeout = _o === void 0 ? defaultTimeout : _o, rest = __objRest(_a2, [ 742 "url", 743 "headers", 744 "params", 745 "responseHandler", 746 "validateStatus", 747 "timeout" 748 ]); 749 config = __spreadValues(__spreadProps(__spreadValues({}, baseFetchOptions), { 750 signal: signal 751 }), rest); 752 headers = new Headers(stripUndefined(headers)); 753 _p = config; 754 return [4 /*yield*/, prepareHeaders(headers, { 755 getState: getState, 756 extra: extra, 757 endpoint: endpoint, 758 forced: forced, 759 type: type 760 })]; 761 case 1: 762 _p.headers = (_q.sent()) || headers; 763 isJsonifiable = function (body) { return typeof body === "object" && ((0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(body) || Array.isArray(body) || typeof body.toJSON === "function"); }; 764 if (!config.headers.has("content-type") && isJsonifiable(config.body)) { 765 config.headers.set("content-type", jsonContentType); 766 } 767 if (isJsonifiable(config.body) && isJsonContentType(config.headers)) { 768 config.body = JSON.stringify(config.body, jsonReplacer); 769 } 770 if (params) { 771 divider = ~url.indexOf("?") ? "&" : "?"; 772 query = paramsSerializer ? paramsSerializer(params) : new URLSearchParams(stripUndefined(params)); 773 url += divider + query; 774 } 775 url = joinUrls(baseUrl, url); 776 request = new Request(url, config); 777 requestClone = new Request(url, config); 778 meta = { request: requestClone }; 779 timedOut = false, timeoutId = timeout && setTimeout(function () { 780 timedOut = true; 781 api.abort(); 782 }, timeout); 783 _q.label = 2; 784 case 2: 785 _q.trys.push([2, 4, 5, 6]); 786 return [4 /*yield*/, fetchFn(request)]; 787 case 3: 788 response = _q.sent(); 789 return [3 /*break*/, 6]; 790 case 4: 791 e_1 = _q.sent(); 792 return [2 /*return*/, { 793 error: { 794 status: timedOut ? "TIMEOUT_ERROR" : "FETCH_ERROR", 795 error: String(e_1) 796 }, 797 meta: meta 798 }]; 799 case 5: 800 if (timeoutId) 801 clearTimeout(timeoutId); 802 return [7 /*endfinally*/]; 803 case 6: 804 responseClone = response.clone(); 805 meta.response = responseClone; 806 responseText = ""; 807 _q.label = 7; 808 case 7: 809 _q.trys.push([7, 9, , 10]); 810 return [4 /*yield*/, Promise.all([ 811 handleResponse(response, responseHandler).then(function (r) { return resultData = r; }, function (e) { return handleResponseError_1 = e; }), 812 responseClone.text().then(function (r) { return responseText = r; }, function () { 813 }) 814 ])]; 815 case 8: 816 _q.sent(); 817 if (handleResponseError_1) 818 throw handleResponseError_1; 819 return [3 /*break*/, 10]; 820 case 9: 821 e_2 = _q.sent(); 822 return [2 /*return*/, { 823 error: { 824 status: "PARSING_ERROR", 825 originalStatus: response.status, 826 data: responseText, 827 error: String(e_2) 828 }, 829 meta: meta 830 }]; 831 case 10: return [2 /*return*/, validateStatus(response, resultData) ? { 832 data: resultData, 833 meta: meta 834 } : { 835 error: { 836 status: response.status, 837 data: resultData 838 }, 839 meta: meta 840 }]; 841 } 842 }); 843 }); }; 844 function handleResponse(response, responseHandler) { 845 return __async(this, null, function () { 846 var text; 847 return __generator(this, function (_j) { 848 switch (_j.label) { 849 case 0: 850 if (typeof responseHandler === "function") { 851 return [2 /*return*/, responseHandler(response)]; 852 } 853 if (responseHandler === "content-type") { 854 responseHandler = isJsonContentType(response.headers) ? "json" : "text"; 855 } 856 if (!(responseHandler === "json")) return [3 /*break*/, 2]; 857 return [4 /*yield*/, response.text()]; 858 case 1: 859 text = _j.sent(); 860 return [2 /*return*/, text.length ? JSON.parse(text) : null]; 861 case 2: return [2 /*return*/, response.text()]; 862 } 863 }); 864 }); 865 } 866} 867// src/query/HandledError.ts 868var HandledError = /** @class */ (function () { 869 function HandledError(value, meta) { 870 if (meta === void 0) { meta = void 0; } 871 this.value = value; 872 this.meta = meta; 873 } 874 return HandledError; 875}()); 876// src/query/retry.ts 877function defaultBackoff(attempt, maxRetries) { 878 if (attempt === void 0) { attempt = 0; } 879 if (maxRetries === void 0) { maxRetries = 5; } 880 return __async(this, null, function () { 881 var attempts, timeout; 882 return __generator(this, function (_j) { 883 switch (_j.label) { 884 case 0: 885 attempts = Math.min(attempt, maxRetries); 886 timeout = ~~((Math.random() + 0.4) * (300 << attempts)); 887 return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(function (res) { return resolve(res); }, timeout); })]; 888 case 1: 889 _j.sent(); 890 return [2 /*return*/]; 891 } 892 }); 893 }); 894} 895function fail(e) { 896 throw Object.assign(new HandledError({ error: e }), { 897 throwImmediately: true 898 }); 899} 900var EMPTY_OPTIONS = {}; 901var retryWithBackoff = function (baseQuery, defaultOptions) { return function (args, api, extraOptions) { return __async(void 0, null, function () { 902 var possibleMaxRetries, maxRetries, defaultRetryCondition, options, retry2, result, e_3; 903 return __generator(this, function (_j) { 904 switch (_j.label) { 905 case 0: 906 possibleMaxRetries = [ 907 5, 908 (defaultOptions || EMPTY_OPTIONS).maxRetries, 909 (extraOptions || EMPTY_OPTIONS).maxRetries 910 ].filter(function (x) { return x !== void 0; }); 911 maxRetries = possibleMaxRetries.slice(-1)[0]; 912 defaultRetryCondition = function (_, __, _j) { 913 var attempt = _j.attempt; 914 return attempt <= maxRetries; 915 }; 916 options = __spreadValues(__spreadValues({ 917 maxRetries: maxRetries, 918 backoff: defaultBackoff, 919 retryCondition: defaultRetryCondition 920 }, defaultOptions), extraOptions); 921 retry2 = 0; 922 _j.label = 1; 923 case 1: 924 if (false) {} 925 _j.label = 2; 926 case 2: 927 _j.trys.push([2, 4, , 6]); 928 return [4 /*yield*/, baseQuery(args, api, extraOptions)]; 929 case 3: 930 result = _j.sent(); 931 if (result.error) { 932 throw new HandledError(result); 933 } 934 return [2 /*return*/, result]; 935 case 4: 936 e_3 = _j.sent(); 937 retry2++; 938 if (e_3.throwImmediately) { 939 if (e_3 instanceof HandledError) { 940 return [2 /*return*/, e_3.value]; 941 } 942 throw e_3; 943 } 944 if (e_3 instanceof HandledError && !options.retryCondition(e_3.value.error, args, { 945 attempt: retry2, 946 baseQueryApi: api, 947 extraOptions: extraOptions 948 })) { 949 return [2 /*return*/, e_3.value]; 950 } 951 return [4 /*yield*/, options.backoff(retry2, options.maxRetries)]; 952 case 5: 953 _j.sent(); 954 return [3 /*break*/, 6]; 955 case 6: return [3 /*break*/, 1]; 956 case 7: return [2 /*return*/]; 957 } 958 }); 959}); }; }; 960var retry = /* @__PURE__ */ Object.assign(retryWithBackoff, { fail: fail }); 961// src/query/core/setupListeners.ts 962 963var onFocus = /* @__PURE__ */ (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createAction)("__rtkq/focused"); 964var onFocusLost = /* @__PURE__ */ (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createAction)("__rtkq/unfocused"); 965var onOnline = /* @__PURE__ */ (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createAction)("__rtkq/online"); 966var onOffline = /* @__PURE__ */ (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createAction)("__rtkq/offline"); 967var initialized = false; 968function setupListeners(dispatch, customHandler) { 969 function defaultHandler() { 970 var handleFocus = function () { return dispatch(onFocus()); }; 971 var handleFocusLost = function () { return dispatch(onFocusLost()); }; 972 var handleOnline = function () { return dispatch(onOnline()); }; 973 var handleOffline = function () { return dispatch(onOffline()); }; 974 var handleVisibilityChange = function () { 975 if (window.document.visibilityState === "visible") { 976 handleFocus(); 977 } 978 else { 979 handleFocusLost(); 980 } 981 }; 982 if (!initialized) { 983 if (typeof window !== "undefined" && window.addEventListener) { 984 window.addEventListener("visibilitychange", handleVisibilityChange, false); 985 window.addEventListener("focus", handleFocus, false); 986 window.addEventListener("online", handleOnline, false); 987 window.addEventListener("offline", handleOffline, false); 988 initialized = true; 989 } 990 } 991 var unsubscribe = function () { 992 window.removeEventListener("focus", handleFocus); 993 window.removeEventListener("visibilitychange", handleVisibilityChange); 994 window.removeEventListener("online", handleOnline); 995 window.removeEventListener("offline", handleOffline); 996 initialized = false; 997 }; 998 return unsubscribe; 999 } 1000 return customHandler ? customHandler(dispatch, { onFocus: onFocus, onFocusLost: onFocusLost, onOffline: onOffline, onOnline: onOnline }) : defaultHandler(); 1001} 1002// src/query/core/buildSelectors.ts 1003 1004// src/query/endpointDefinitions.ts 1005var DefinitionType; 1006(function (DefinitionType2) { 1007 DefinitionType2["query"] = "query"; 1008 DefinitionType2["mutation"] = "mutation"; 1009})(DefinitionType || (DefinitionType = {})); 1010function isQueryDefinition(e) { 1011 return e.type === DefinitionType.query; 1012} 1013function isMutationDefinition(e) { 1014 return e.type === DefinitionType.mutation; 1015} 1016function calculateProvidedBy(description, result, error, queryArg, meta, assertTagTypes) { 1017 if (isFunction(description)) { 1018 return description(result, error, queryArg, meta).map(expandTagDescription).map(assertTagTypes); 1019 } 1020 if (Array.isArray(description)) { 1021 return description.map(expandTagDescription).map(assertTagTypes); 1022 } 1023 return []; 1024} 1025function isFunction(t) { 1026 return typeof t === "function"; 1027} 1028function expandTagDescription(description) { 1029 return typeof description === "string" ? { type: description } : description; 1030} 1031// src/query/core/buildSlice.ts 1032 1033// src/query/utils/isNotNullish.ts 1034function isNotNullish(v) { 1035 return v != null; 1036} 1037// src/query/core/buildInitiate.ts 1038var forceQueryFnSymbol = Symbol("forceQueryFn"); 1039var isUpsertQuery = function (arg) { return typeof arg[forceQueryFnSymbol] === "function"; }; 1040function buildInitiate(_j) { 1041 var serializeQueryArgs = _j.serializeQueryArgs, queryThunk = _j.queryThunk, mutationThunk = _j.mutationThunk, api = _j.api, context = _j.context; 1042 var runningQueries = new Map(); 1043 var runningMutations = new Map(); 1044 var _k = api.internalActions, unsubscribeQueryResult = _k.unsubscribeQueryResult, removeMutationResult = _k.removeMutationResult, updateSubscriptionOptions = _k.updateSubscriptionOptions; 1045 return { 1046 buildInitiateQuery: buildInitiateQuery, 1047 buildInitiateMutation: buildInitiateMutation, 1048 getRunningQueryThunk: getRunningQueryThunk, 1049 getRunningMutationThunk: getRunningMutationThunk, 1050 getRunningQueriesThunk: getRunningQueriesThunk, 1051 getRunningMutationsThunk: getRunningMutationsThunk, 1052 getRunningOperationPromises: getRunningOperationPromises, 1053 removalWarning: removalWarning 1054 }; 1055 function removalWarning() { 1056 throw new Error("This method had to be removed due to a conceptual bug in RTK.\n Please see https://github.com/reduxjs/redux-toolkit/pull/2481 for details.\n See https://redux-toolkit.js.org/rtk-query/usage/server-side-rendering for new guidance on SSR."); 1057 } 1058 function getRunningOperationPromises() { 1059 if (typeof process !== "undefined" && "development" === "development") { 1060 removalWarning(); 1061 } 1062 else { 1063 var extract = function (v) { return Array.from(v.values()).flatMap(function (queriesForStore) { return queriesForStore ? Object.values(queriesForStore) : []; }); }; 1064 return __spreadArray(__spreadArray([], extract(runningQueries)), extract(runningMutations)).filter(isNotNullish); 1065 } 1066 } 1067 function getRunningQueryThunk(endpointName, queryArgs) { 1068 return function (dispatch) { 1069 var _a; 1070 var endpointDefinition = context.endpointDefinitions[endpointName]; 1071 var queryCacheKey = serializeQueryArgs({ 1072 queryArgs: queryArgs, 1073 endpointDefinition: endpointDefinition, 1074 endpointName: endpointName 1075 }); 1076 return (_a = runningQueries.get(dispatch)) == null ? void 0 : _a[queryCacheKey]; 1077 }; 1078 } 1079 function getRunningMutationThunk(_endpointName, fixedCacheKeyOrRequestId) { 1080 return function (dispatch) { 1081 var _a; 1082 return (_a = runningMutations.get(dispatch)) == null ? void 0 : _a[fixedCacheKeyOrRequestId]; 1083 }; 1084 } 1085 function getRunningQueriesThunk() { 1086 return function (dispatch) { return Object.values(runningQueries.get(dispatch) || {}).filter(isNotNullish); }; 1087 } 1088 function getRunningMutationsThunk() { 1089 return function (dispatch) { return Object.values(runningMutations.get(dispatch) || {}).filter(isNotNullish); }; 1090 } 1091 function middlewareWarning(dispatch) { 1092 if (true) { 1093 if (middlewareWarning.triggered) 1094 return; 1095 var registered = dispatch(api.internalActions.internal_probeSubscription({ 1096 queryCacheKey: "DOES_NOT_EXIST", 1097 requestId: "DUMMY_REQUEST_ID" 1098 })); 1099 middlewareWarning.triggered = true; 1100 if (typeof registered !== "boolean") { 1101 throw new Error("Warning: Middleware for RTK-Query API at reducerPath \"" + api.reducerPath + "\" has not been added to the store.\nYou must add the middleware for RTK-Query to function correctly!"); 1102 } 1103 } 1104 } 1105 function buildInitiateQuery(endpointName, endpointDefinition) { 1106 var queryAction = function (arg, _j) { 1107 var _k = _j === void 0 ? {} : _j, _l = _k.subscribe, subscribe = _l === void 0 ? true : _l, forceRefetch = _k.forceRefetch, subscriptionOptions = _k.subscriptionOptions, _m = forceQueryFnSymbol, forceQueryFn = _k[_m]; 1108 return function (dispatch, getState) { 1109 var _j; 1110 var _a; 1111 var queryCacheKey = serializeQueryArgs({ 1112 queryArgs: arg, 1113 endpointDefinition: endpointDefinition, 1114 endpointName: endpointName 1115 }); 1116 var thunk = queryThunk((_j = { 1117 type: "query", 1118 subscribe: subscribe, 1119 forceRefetch: forceRefetch, 1120 subscriptionOptions: subscriptionOptions, 1121 endpointName: endpointName, 1122 originalArgs: arg, 1123 queryCacheKey: queryCacheKey 1124 }, 1125 _j[forceQueryFnSymbol] = forceQueryFn, 1126 _j)); 1127 var selector = api.endpoints[endpointName].select(arg); 1128 var thunkResult = dispatch(thunk); 1129 var stateAfter = selector(getState()); 1130 middlewareWarning(dispatch); 1131 var requestId = thunkResult.requestId, abort = thunkResult.abort; 1132 var skippedSynchronously = stateAfter.requestId !== requestId; 1133 var runningQuery = (_a = runningQueries.get(dispatch)) == null ? void 0 : _a[queryCacheKey]; 1134 var selectFromState = function () { return selector(getState()); }; 1135 var statePromise = Object.assign(forceQueryFn ? thunkResult.then(selectFromState) : skippedSynchronously && !runningQuery ? Promise.resolve(stateAfter) : Promise.all([runningQuery, thunkResult]).then(selectFromState), { 1136 arg: arg, 1137 requestId: requestId, 1138 subscriptionOptions: subscriptionOptions, 1139 queryCacheKey: queryCacheKey, 1140 abort: abort, 1141 unwrap: function () { 1142 return __async(this, null, function () { 1143 var result; 1144 return __generator(this, function (_j) { 1145 switch (_j.label) { 1146 case 0: return [4 /*yield*/, statePromise]; 1147 case 1: 1148 result = _j.sent(); 1149 if (result.isError) { 1150 throw result.error; 1151 } 1152 return [2 /*return*/, result.data]; 1153 } 1154 }); 1155 }); 1156 }, 1157 refetch: function () { return dispatch(queryAction(arg, { subscribe: false, forceRefetch: true })); }, 1158 unsubscribe: function () { 1159 if (subscribe) 1160 dispatch(unsubscribeQueryResult({ 1161 queryCacheKey: queryCacheKey, 1162 requestId: requestId 1163 })); 1164 }, 1165 updateSubscriptionOptions: function (options) { 1166 statePromise.subscriptionOptions = options; 1167 dispatch(updateSubscriptionOptions({ 1168 endpointName: endpointName, 1169 requestId: requestId, 1170 queryCacheKey: queryCacheKey, 1171 options: options 1172 })); 1173 } 1174 }); 1175 if (!runningQuery && !skippedSynchronously && !forceQueryFn) { 1176 var running_1 = runningQueries.get(dispatch) || {}; 1177 running_1[queryCacheKey] = statePromise; 1178 runningQueries.set(dispatch, running_1); 1179 statePromise.then(function () { 1180 delete running_1[queryCacheKey]; 1181 if (!Object.keys(running_1).length) { 1182 runningQueries.delete(dispatch); 1183 } 1184 }); 1185 } 1186 return statePromise; 1187 }; 1188 }; 1189 return queryAction; 1190 } 1191 function buildInitiateMutation(endpointName) { 1192 return function (arg, _j) { 1193 var _k = _j === void 0 ? {} : _j, _l = _k.track, track = _l === void 0 ? true : _l, fixedCacheKey = _k.fixedCacheKey; 1194 return function (dispatch, getState) { 1195 var thunk = mutationThunk({ 1196 type: "mutation", 1197 endpointName: endpointName, 1198 originalArgs: arg, 1199 track: track, 1200 fixedCacheKey: fixedCacheKey 1201 }); 1202 var thunkResult = dispatch(thunk); 1203 middlewareWarning(dispatch); 1204 var requestId = thunkResult.requestId, abort = thunkResult.abort, unwrap = thunkResult.unwrap; 1205 var returnValuePromise = thunkResult.unwrap().then(function (data) { return ({ data: data }); }).catch(function (error) { return ({ error: error }); }); 1206 var reset = function () { 1207 dispatch(removeMutationResult({ requestId: requestId, fixedCacheKey: fixedCacheKey })); 1208 }; 1209 var ret = Object.assign(returnValuePromise, { 1210 arg: thunkResult.arg, 1211 requestId: requestId, 1212 abort: abort, 1213 unwrap: unwrap, 1214 unsubscribe: reset, 1215 reset: reset 1216 }); 1217 var running = runningMutations.get(dispatch) || {}; 1218 runningMutations.set(dispatch, running); 1219 running[requestId] = ret; 1220 ret.then(function () { 1221 delete running[requestId]; 1222 if (!Object.keys(running).length) { 1223 runningMutations.delete(dispatch); 1224 } 1225 }); 1226 if (fixedCacheKey) { 1227 running[fixedCacheKey] = ret; 1228 ret.then(function () { 1229 if (running[fixedCacheKey] === ret) { 1230 delete running[fixedCacheKey]; 1231 if (!Object.keys(running).length) { 1232 runningMutations.delete(dispatch); 1233 } 1234 } 1235 }); 1236 } 1237 return ret; 1238 }; 1239 }; 1240 } 1241} 1242// src/query/core/buildThunks.ts 1243 1244 1245 1246function defaultTransformResponse(baseQueryReturnValue) { 1247 return baseQueryReturnValue; 1248} 1249function buildThunks(_j) { 1250 var _this = this; 1251 var reducerPath = _j.reducerPath, baseQuery = _j.baseQuery, endpointDefinitions = _j.context.endpointDefinitions, serializeQueryArgs = _j.serializeQueryArgs, api = _j.api, assertTagType = _j.assertTagType; 1252 var patchQueryData = function (endpointName, args, patches, updateProvided) { return function (dispatch, getState) { 1253 var endpointDefinition = endpointDefinitions[endpointName]; 1254 var queryCacheKey = serializeQueryArgs({ 1255 queryArgs: args, 1256 endpointDefinition: endpointDefinition, 1257 endpointName: endpointName 1258 }); 1259 dispatch(api.internalActions.queryResultPatched({ queryCacheKey: queryCacheKey, patches: patches })); 1260 if (!updateProvided) { 1261 return; 1262 } 1263 var newValue = api.endpoints[endpointName].select(args)(getState()); 1264 var providedTags = calculateProvidedBy(endpointDefinition.providesTags, newValue.data, void 0, args, {}, assertTagType); 1265 dispatch(api.internalActions.updateProvidedBy({ queryCacheKey: queryCacheKey, providedTags: providedTags })); 1266 }; }; 1267 var updateQueryData = function (endpointName, args, updateRecipe, updateProvided) { 1268 if (updateProvided === void 0) { updateProvided = true; } 1269 return function (dispatch, getState) { 1270 var _j, _k; 1271 var endpointDefinition = api.endpoints[endpointName]; 1272 var currentState = endpointDefinition.select(args)(getState()); 1273 var ret = { 1274 patches: [], 1275 inversePatches: [], 1276 undo: function () { return dispatch(api.util.patchQueryData(endpointName, args, ret.inversePatches, updateProvided)); } 1277 }; 1278 if (currentState.status === QueryStatus.uninitialized) { 1279 return ret; 1280 } 1281 var newValue; 1282 if ("data" in currentState) { 1283 if ((0,immer__WEBPACK_IMPORTED_MODULE_1__.isDraftable)(currentState.data)) { 1284 var _l = (0,immer__WEBPACK_IMPORTED_MODULE_1__.produceWithPatches)(currentState.data, updateRecipe), value = _l[0], patches = _l[1], inversePatches = _l[2]; 1285 (_j = ret.patches).push.apply(_j, patches); 1286 (_k = ret.inversePatches).push.apply(_k, inversePatches); 1287 newValue = value; 1288 } 1289 else { 1290 newValue = updateRecipe(currentState.data); 1291 ret.patches.push({ op: "replace", path: [], value: newValue }); 1292 ret.inversePatches.push({ 1293 op: "replace", 1294 path: [], 1295 value: currentState.data 1296 }); 1297 } 1298 } 1299 dispatch(api.util.patchQueryData(endpointName, args, ret.patches, updateProvided)); 1300 return ret; 1301 }; 1302 }; 1303 var upsertQueryData = function (endpointName, args, value) { return function (dispatch) { 1304 var _j; 1305 return dispatch(api.endpoints[endpointName].initiate(args, (_j = { 1306 subscribe: false, 1307 forceRefetch: true 1308 }, 1309 _j[forceQueryFnSymbol] = function () { return ({ 1310 data: value 1311 }); }, 1312 _j))); 1313 }; }; 1314 var executeEndpoint = function (_0, _1) { return __async(_this, [_0, _1], function (arg, _j) { 1315 var endpointDefinition, transformResponse, result, baseQueryApi_1, forceQueryFn, what, err, _k, _l, key, _m, error_1, catchedError, transformErrorResponse, _o, e_4; 1316 var _p, _q; 1317 var signal = _j.signal, abort = _j.abort, rejectWithValue = _j.rejectWithValue, fulfillWithValue = _j.fulfillWithValue, dispatch = _j.dispatch, getState = _j.getState, extra = _j.extra; 1318 return __generator(this, function (_r) { 1319 switch (_r.label) { 1320 case 0: 1321 endpointDefinition = endpointDefinitions[arg.endpointName]; 1322 _r.label = 1; 1323 case 1: 1324 _r.trys.push([1, 8, , 13]); 1325 transformResponse = defaultTransformResponse; 1326 result = void 0; 1327 baseQueryApi_1 = { 1328 signal: signal, 1329 abort: abort, 1330 dispatch: dispatch, 1331 getState: getState, 1332 extra: extra, 1333 endpoint: arg.endpointName, 1334 type: arg.type, 1335 forced: arg.type === "query" ? isForcedQuery(arg, getState()) : void 0 1336 }; 1337 forceQueryFn = arg.type === "query" ? arg[forceQueryFnSymbol] : void 0; 1338 if (!forceQueryFn) return [3 /*break*/, 2]; 1339 result = forceQueryFn(); 1340 return [3 /*break*/, 6]; 1341 case 2: 1342 if (!endpointDefinition.query) return [3 /*break*/, 4]; 1343 return [4 /*yield*/, baseQuery(endpointDefinition.query(arg.originalArgs), baseQueryApi_1, endpointDefinition.extraOptions)]; 1344 case 3: 1345 result = _r.sent(); 1346 if (endpointDefinition.transformResponse) { 1347 transformResponse = endpointDefinition.transformResponse; 1348 } 1349 return [3 /*break*/, 6]; 1350 case 4: return [4 /*yield*/, endpointDefinition.queryFn(arg.originalArgs, baseQueryApi_1, endpointDefinition.extraOptions, function (arg2) { return baseQuery(arg2, baseQueryApi_1, endpointDefinition.extraOptions); })]; 1351 case 5: 1352 result = _r.sent(); 1353 _r.label = 6; 1354 case 6: 1355 if (typeof process !== "undefined" && "development" === "development") { 1356 what = endpointDefinition.query ? "`baseQuery`" : "`queryFn`"; 1357 err = void 0; 1358 if (!result) { 1359 err = what + " did not return anything."; 1360 } 1361 else if (typeof result !== "object") { 1362 err = what + " did not return an object."; 1363 } 1364 else if (result.error && result.data) { 1365 err = what + " returned an object containing both `error` and `result`."; 1366 } 1367 else if (result.error === void 0 && result.data === void 0) { 1368 err = what + " returned an object containing neither a valid `error` and `result`. At least one of them should not be `undefined`"; 1369 } 1370 else { 1371 for (_k = 0, _l = Object.keys(result); _k < _l.length; _k++) { 1372 key = _l[_k]; 1373 if (key !== "error" && key !== "data" && key !== "meta") { 1374 err = "The object returned by " + what + " has the unknown property " + key + "."; 1375 break; 1376 } 1377 } 1378 } 1379 if (err) { 1380 console.error("Error encountered handling the endpoint " + arg.endpointName + ".\n " + err + "\n It needs to return an object with either the shape `{ data: <value> }` or `{ error: <value> }` that may contain an optional `meta` property.\n Object returned was:", result); 1381 } 1382 } 1383 if (result.error) 1384 throw new HandledError(result.error, result.meta); 1385 _m = fulfillWithValue; 1386 return [4 /*yield*/, transformResponse(result.data, result.meta, arg.originalArgs)]; 1387 case 7: return [2 /*return*/, _m.apply(void 0, [_r.sent(), (_p = { 1388 fulfilledTimeStamp: Date.now(), 1389 baseQueryMeta: result.meta 1390 }, 1391 _p[_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.SHOULD_AUTOBATCH] = true, 1392 _p)])]; 1393 case 8: 1394 error_1 = _r.sent(); 1395 catchedError = error_1; 1396 if (!(catchedError instanceof HandledError)) return [3 /*break*/, 12]; 1397 transformErrorResponse = defaultTransformResponse; 1398 if (endpointDefinition.query && endpointDefinition.transformErrorResponse) { 1399 transformErrorResponse = endpointDefinition.transformErrorResponse; 1400 } 1401 _r.label = 9; 1402 case 9: 1403 _r.trys.push([9, 11, , 12]); 1404 _o = rejectWithValue; 1405 return [4 /*yield*/, transformErrorResponse(catchedError.value, catchedError.meta, arg.originalArgs)]; 1406 case 10: return [2 /*return*/, _o.apply(void 0, [_r.sent(), (_q = { baseQueryMeta: catchedError.meta }, _q[_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.SHOULD_AUTOBATCH] = true, _q)])]; 1407 case 11: 1408 e_4 = _r.sent(); 1409 catchedError = e_4; 1410 return [3 /*break*/, 12]; 1411 case 12: 1412 if (typeof process !== "undefined" && "development" !== "production") { 1413 console.error("An unhandled error occurred processing a request for the endpoint \"" + arg.endpointName + "\".\nIn the case of an unhandled error, no tags will be \"provided\" or \"invalidated\".", catchedError); 1414 } 1415 else { 1416 console.error(catchedError); 1417 } 1418 throw catchedError; 1419 case 13: return [2 /*return*/]; 1420 } 1421 }); 1422 }); }; 1423 function isForcedQuery(arg, state) { 1424 var _a, _b, _c, _d; 1425 var requestState = (_b = (_a = state[reducerPath]) == null ? void 0 : _a.queries) == null ? void 0 : _b[arg.queryCacheKey]; 1426 var baseFetchOnMountOrArgChange = (_c = state[reducerPath]) == null ? void 0 : _c.config.refetchOnMountOrArgChange; 1427 var fulfilledVal = requestState == null ? void 0 : requestState.fulfilledTimeStamp; 1428 var refetchVal = (_d = arg.forceRefetch) != null ? _d : arg.subscribe && baseFetchOnMountOrArgChange; 1429 if (refetchVal) { 1430 return refetchVal === true || (Number(new Date()) - Number(fulfilledVal)) / 1e3 >= refetchVal; 1431 } 1432 return false; 1433 } 1434 var queryThunk = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createAsyncThunk)(reducerPath + "/executeQuery", executeEndpoint, { 1435 getPendingMeta: function () { 1436 var _j; 1437 return _j = { startedTimeStamp: Date.now() }, _j[_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.SHOULD_AUTOBATCH] = true, _j; 1438 }, 1439 condition: function (queryThunkArgs, _j) { 1440 var getState = _j.getState; 1441 var _a, _b, _c; 1442 var state = getState(); 1443 var requestState = (_b = (_a = state[reducerPath]) == null ? void 0 : _a.queries) == null ? void 0 : _b[queryThunkArgs.queryCacheKey]; 1444 var fulfilledVal = requestState == null ? void 0 : requestState.fulfilledTimeStamp; 1445 var currentArg = queryThunkArgs.originalArgs; 1446 var previousArg = requestState == null ? void 0 : requestState.originalArgs; 1447 var endpointDefinition = endpointDefinitions[queryThunkArgs.endpointName]; 1448 if (isUpsertQuery(queryThunkArgs)) { 1449 return true; 1450 } 1451 if ((requestState == null ? void 0 : requestState.status) === "pending") { 1452 return false; 1453 } 1454 if (isForcedQuery(queryThunkArgs, state)) { 1455 return true; 1456 } 1457 if (isQueryDefinition(endpointDefinition) && ((_c = endpointDefinition == null ? void 0 : endpointDefinition.forceRefetch) == null ? void 0 : _c.call(endpointDefinition, { 1458 currentArg: currentArg, 1459 previousArg: previousArg, 1460 endpointState: requestState, 1461 state: state 1462 }))) { 1463 return true; 1464 } 1465 if (fulfilledVal) { 1466 return false; 1467 } 1468 return true; 1469 }, 1470 dispatchConditionRejection: true 1471 }); 1472 var mutationThunk = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createAsyncThunk)(reducerPath + "/executeMutation", executeEndpoint, { 1473 getPendingMeta: function () { 1474 var _j; 1475 return _j = { startedTimeStamp: Date.now() }, _j[_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.SHOULD_AUTOBATCH] = true, _j; 1476 } 1477 }); 1478 var hasTheForce = function (options) { return "force" in options; }; 1479 var hasMaxAge = function (options) { return "ifOlderThan" in options; }; 1480 var prefetch = function (endpointName, arg, options) { return function (dispatch, getState) { 1481 var force = hasTheForce(options) && options.force; 1482 var maxAge = hasMaxAge(options) && options.ifOlderThan; 1483 var queryAction = function (force2) { 1484 if (force2 === void 0) { force2 = true; } 1485 return api.endpoints[endpointName].initiate(arg, { forceRefetch: force2 }); 1486 }; 1487 var latestStateValue = api.endpoints[endpointName].select(arg)(getState()); 1488 if (force) { 1489 dispatch(queryAction()); 1490 } 1491 else if (maxAge) { 1492 var lastFulfilledTs = latestStateValue == null ? void 0 : latestStateValue.fulfilledTimeStamp; 1493 if (!lastFulfilledTs) { 1494 dispatch(queryAction()); 1495 return; 1496 } 1497 var shouldRetrigger = (Number(new Date()) - Number(new Date(lastFulfilledTs))) / 1e3 >= maxAge; 1498 if (shouldRetrigger) { 1499 dispatch(queryAction()); 1500 } 1501 } 1502 else { 1503 dispatch(queryAction(false)); 1504 } 1505 }; }; 1506 function matchesEndpoint(endpointName) { 1507 return function (action) { 1508 var _a, _b; 1509 return ((_b = (_a = action == null ? void 0 : action.meta) == null ? void 0 : _a.arg) == null ? void 0 : _b.endpointName) === endpointName; 1510 }; 1511 } 1512 function buildMatchThunkActions(thunk, endpointName) { 1513 return { 1514 matchPending: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isAllOf)((0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isPending)(thunk), matchesEndpoint(endpointName)), 1515 matchFulfilled: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isAllOf)((0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isFulfilled)(thunk), matchesEndpoint(endpointName)), 1516 matchRejected: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isAllOf)((0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isRejected)(thunk), matchesEndpoint(endpointName)) 1517 }; 1518 } 1519 return { 1520 queryThunk: queryThunk, 1521 mutationThunk: mutationThunk, 1522 prefetch: prefetch, 1523 updateQueryData: updateQueryData, 1524 upsertQueryData: upsertQueryData, 1525 patchQueryData: patchQueryData, 1526 buildMatchThunkActions: buildMatchThunkActions 1527 }; 1528} 1529function calculateProvidedByThunk(action, type, endpointDefinitions, assertTagType) { 1530 return calculateProvidedBy(endpointDefinitions[action.meta.arg.endpointName][type], (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isFulfilled)(action) ? action.payload : void 0, (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isRejectedWithValue)(action) ? action.payload : void 0, action.meta.arg.originalArgs, "baseQueryMeta" in action.meta ? action.meta.baseQueryMeta : void 0, assertTagType); 1531} 1532// src/query/core/buildSlice.ts 1533 1534 1535function updateQuerySubstateIfExists(state, queryCacheKey, update) { 1536 var substate = state[queryCacheKey]; 1537 if (substate) { 1538 update(substate); 1539 } 1540} 1541function getMutationCacheKey(id) { 1542 var _a; 1543 return (_a = "arg" in id ? id.arg.fixedCacheKey : id.fixedCacheKey) != null ? _a : id.requestId; 1544} 1545function updateMutationSubstateIfExists(state, id, update) { 1546 var substate = state[getMutationCacheKey(id)]; 1547 if (substate) { 1548 update(substate); 1549 } 1550} 1551var initialState = {}; 1552function buildSlice(_j) { 1553 var reducerPath = _j.reducerPath, queryThunk = _j.queryThunk, mutationThunk = _j.mutationThunk, _k = _j.context, definitions = _k.endpointDefinitions, apiUid = _k.apiUid, extractRehydrationInfo = _k.extractRehydrationInfo, hasRehydrationInfo = _k.hasRehydrationInfo, assertTagType = _j.assertTagType, config = _j.config; 1554 var resetApiState = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createAction)(reducerPath + "/resetApiState"); 1555 var querySlice = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createSlice)({ 1556 name: reducerPath + "/queries", 1557 initialState: initialState, 1558 reducers: { 1559 removeQueryResult: { 1560 reducer: function (draft, _j) { 1561 var queryCacheKey = _j.payload.queryCacheKey; 1562 delete draft[queryCacheKey]; 1563 }, 1564 prepare: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.prepareAutoBatched)() 1565 }, 1566 queryResultPatched: { 1567 reducer: function (draft, _j) { 1568 var _k = _j.payload, queryCacheKey = _k.queryCacheKey, patches = _k.patches; 1569 updateQuerySubstateIfExists(draft, queryCacheKey, function (substate) { 1570 substate.data = (0,immer__WEBPACK_IMPORTED_MODULE_1__.applyPatches)(substate.data, patches.concat()); 1571 }); 1572 }, 1573 prepare: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.prepareAutoBatched)() 1574 } 1575 }, 1576 extraReducers: function (builder) { 1577 builder.addCase(queryThunk.pending, function (draft, _j) { 1578 var meta = _j.meta, arg = _j.meta.arg; 1579 var _a, _b; 1580 var upserting = isUpsertQuery(arg); 1581 if (arg.subscribe || upserting) { 1582 (_b = draft[_a = arg.queryCacheKey]) != null ? _b : draft[_a] = { 1583 status: QueryStatus.uninitialized, 1584 endpointName: arg.endpointName 1585 }; 1586 } 1587 updateQuerySubstateIfExists(draft, arg.queryCacheKey, function (substate) { 1588 substate.status = QueryStatus.pending; 1589 substate.requestId = upserting && substate.requestId ? substate.requestId : meta.requestId; 1590 if (arg.originalArgs !== void 0) { 1591 substate.originalArgs = arg.originalArgs; 1592 } 1593 substate.startedTimeStamp = meta.startedTimeStamp; 1594 }); 1595 }).addCase(queryThunk.fulfilled, function (draft, _j) { 1596 var meta = _j.meta, payload = _j.payload; 1597 updateQuerySubstateIfExists(draft, meta.arg.queryCacheKey, function (substate) { 1598 var _a; 1599 if (substate.requestId !== meta.requestId && !isUpsertQuery(meta.arg)) 1600 return; 1601 var merge = definitions[meta.arg.endpointName].merge; 1602 substate.status = QueryStatus.fulfilled; 1603 if (merge) { 1604 if (substate.data !== void 0) { 1605 var fulfilledTimeStamp_1 = meta.fulfilledTimeStamp, arg_1 = meta.arg, baseQueryMeta_1 = meta.baseQueryMeta, requestId_1 = meta.requestId; 1606 var newData = (0,immer__WEBPACK_IMPORTED_MODULE_1__["default"])(substate.data, function (draftSubstateData) { 1607 return merge(draftSubstateData, payload, { 1608 arg: arg_1.originalArgs, 1609 baseQueryMeta: baseQueryMeta_1, 1610 fulfilledTimeStamp: fulfilledTimeStamp_1, 1611 requestId: requestId_1 1612 }); 1613 }); 1614 substate.data = newData; 1615 } 1616 else { 1617 substate.data = payload; 1618 } 1619 } 1620 else { 1621 substate.data = ((_a = definitions[meta.arg.endpointName].structuralSharing) != null ? _a : true) ? copyWithStructuralSharing((0,immer__WEBPACK_IMPORTED_MODULE_1__.isDraft)(substate.data) ? (0,immer__WEBPACK_IMPORTED_MODULE_1__.original)(substate.data) : substate.data, payload) : payload; 1622 } 1623 delete substate.error; 1624 substate.fulfilledTimeStamp = meta.fulfilledTimeStamp; 1625 }); 1626 }).addCase(queryThunk.rejected, function (draft, _j) { 1627 var _k = _j.meta, condition = _k.condition, arg = _k.arg, requestId = _k.requestId, error = _j.error, payload = _j.payload; 1628 updateQuerySubstateIfExists(draft, arg.queryCacheKey, function (substate) { 1629 if (condition) { 1630 } 1631 else { 1632 if (substate.requestId !== requestId) 1633 return; 1634 substate.status = QueryStatus.rejected; 1635 substate.error = payload != null ? payload : error; 1636 } 1637 }); 1638 }).addMatcher(hasRehydrationInfo, function (draft, action) { 1639 var queries = extractRehydrationInfo(action).queries; 1640 for (var _j = 0, _k = Object.entries(queries); _j < _k.length; _j++) { 1641 var _l = _k[_j], key = _l[0], entry = _l[1]; 1642 if ((entry == null ? void 0 : entry.status) === QueryStatus.fulfilled || (entry == null ? void 0 : entry.status) === QueryStatus.rejected) { 1643 draft[key] = entry; 1644 } 1645 } 1646 }); 1647 } 1648 }); 1649 var mutationSlice = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createSlice)({ 1650 name: reducerPath + "/mutations", 1651 initialState: initialState, 1652 reducers: { 1653 removeMutationResult: { 1654 reducer: function (draft, _j) { 1655 var payload = _j.payload; 1656 var cacheKey = getMutationCacheKey(payload); 1657 if (cacheKey in draft) { 1658 delete draft[cacheKey]; 1659 } 1660 }, 1661 prepare: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.prepareAutoBatched)() 1662 } 1663 }, 1664 extraReducers: function (builder) { 1665 builder.addCase(mutationThunk.pending, function (draft, _j) { 1666 var meta = _j.meta, _k = _j.meta, requestId = _k.requestId, arg = _k.arg, startedTimeStamp = _k.startedTimeStamp; 1667 if (!arg.track) 1668 return; 1669 draft[getMutationCacheKey(meta)] = { 1670 requestId: requestId, 1671 status: QueryStatus.pending, 1672 endpointName: arg.endpointName, 1673 startedTimeStamp: startedTimeStamp 1674 }; 1675 }).addCase(mutationThunk.fulfilled, function (draft, _j) { 1676 var payload = _j.payload, meta = _j.meta; 1677 if (!meta.arg.track) 1678 return; 1679 updateMutationSubstateIfExists(draft, meta, function (substate) { 1680 if (substate.requestId !== meta.requestId) 1681 return; 1682 substate.status = QueryStatus.fulfilled; 1683 substate.data = payload; 1684 substate.fulfilledTimeStamp = meta.fulfilledTimeStamp; 1685 }); 1686 }).addCase(mutationThunk.rejected, function (draft, _j) { 1687 var payload = _j.payload, error = _j.error, meta = _j.meta; 1688 if (!meta.arg.track) 1689 return; 1690 updateMutationSubstateIfExists(draft, meta, function (substate) { 1691 if (substate.requestId !== meta.requestId) 1692 return; 1693 substate.status = QueryStatus.rejected; 1694 substate.error = payload != null ? payload : error; 1695 }); 1696 }).addMatcher(hasRehydrationInfo, function (draft, action) { 1697 var mutations = extractRehydrationInfo(action).mutations; 1698 for (var _j = 0, _k = Object.entries(mutations); _j < _k.length; _j++) { 1699 var _l = _k[_j], key = _l[0], entry = _l[1]; 1700 if (((entry == null ? void 0 : entry.status) === QueryStatus.fulfilled || (entry == null ? void 0 : entry.status) === QueryStatus.rejected) && key !== (entry == null ? void 0 : entry.requestId)) { 1701 draft[key] = entry; 1702 } 1703 } 1704 }); 1705 } 1706 }); 1707 var invalidationSlice = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createSlice)({ 1708 name: reducerPath + "/invalidation", 1709 initialState: initialState, 1710 reducers: { 1711 updateProvidedBy: { 1712 reducer: function (draft, action) { 1713 var _a, _b, _c, _d; 1714 var _j = action.payload, queryCacheKey = _j.queryCacheKey, providedTags = _j.providedTags; 1715 for (var _k = 0, _l = Object.values(draft); _k < _l.length; _k++) { 1716 var tagTypeSubscriptions = _l[_k]; 1717 for (var _m = 0, _o = Object.values(tagTypeSubscriptions); _m < _o.length; _m++) { 1718 var idSubscriptions = _o[_m]; 1719 var foundAt = idSubscriptions.indexOf(queryCacheKey); 1720 if (foundAt !== -1) { 1721 idSubscriptions.splice(foundAt, 1); 1722 } 1723 } 1724 } 1725 for (var _p = 0, providedTags_1 = providedTags; _p < providedTags_1.length; _p++) { 1726 var _q = providedTags_1[_p], type = _q.type, id = _q.id; 1727 var subscribedQueries = (_d = (_b = (_a = draft[type]) != null ? _a : draft[type] = {})[_c = id || "__internal_without_id"]) != null ? _d : _b[_c] = []; 1728 var alreadySubscribed = subscribedQueries.includes(queryCacheKey); 1729 if (!alreadySubscribed) { 1730 subscribedQueries.push(queryCacheKey); 1731 } 1732 } 1733 }, 1734 prepare: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.prepareAutoBatched)() 1735 } 1736 }, 1737 extraReducers: function (builder) { 1738 builder.addCase(querySlice.actions.removeQueryResult, function (draft, _j) { 1739 var queryCacheKey = _j.payload.queryCacheKey; 1740 for (var _k = 0, _l = Object.values(draft); _k < _l.length; _k++) { 1741 var tagTypeSubscriptions = _l[_k]; 1742 for (var _m = 0, _o = Object.values(tagTypeSubscriptions); _m < _o.length; _m++) { 1743 var idSubscriptions = _o[_m]; 1744 var foundAt = idSubscriptions.indexOf(queryCacheKey); 1745 if (foundAt !== -1) { 1746 idSubscriptions.splice(foundAt, 1); 1747 } 1748 } 1749 } 1750 }).addMatcher(hasRehydrationInfo, function (draft, action) { 1751 var _a, _b, _c, _d; 1752 var provided = extractRehydrationInfo(action).provided; 1753 for (var _j = 0, _k = Object.entries(provided); _j < _k.length; _j++) { 1754 var _l = _k[_j], type = _l[0], incomingTags = _l[1]; 1755 for (var _m = 0, _o = Object.entries(incomingTags); _m < _o.length; _m++) { 1756 var _p = _o[_m], id = _p[0], cacheKeys = _p[1]; 1757 var subscribedQueries = (_d = (_b = (_a = draft[type]) != null ? _a : draft[type] = {})[_c = id || "__internal_without_id"]) != null ? _d : _b[_c] = []; 1758 for (var _q = 0, cacheKeys_1 = cacheKeys; _q < cacheKeys_1.length; _q++) { 1759 var queryCacheKey = cacheKeys_1[_q]; 1760 var alreadySubscribed = subscribedQueries.includes(queryCacheKey); 1761 if (!alreadySubscribed) { 1762 subscribedQueries.push(queryCacheKey); 1763 } 1764 } 1765 } 1766 } 1767 }).addMatcher((0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isAnyOf)((0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isFulfilled)(queryThunk), (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isRejectedWithValue)(queryThunk)), function (draft, action) { 1768 var providedTags = calculateProvidedByThunk(action, "providesTags", definitions, assertTagType); 1769 var queryCacheKey = action.meta.arg.queryCacheKey; 1770 invalidationSlice.caseReducers.updateProvidedBy(draft, invalidationSlice.actions.updateProvidedBy({ 1771 queryCacheKey: queryCacheKey, 1772 providedTags: providedTags 1773 })); 1774 }); 1775 } 1776 }); 1777 var subscriptionSlice = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createSlice)({ 1778 name: reducerPath + "/subscriptions", 1779 initialState: initialState, 1780 reducers: { 1781 updateSubscriptionOptions: function (d, a) { 1782 }, 1783 unsubscribeQueryResult: function (d, a) { 1784 }, 1785 internal_probeSubscription: function (d, a) { 1786 } 1787 } 1788 }); 1789 var internalSubscriptionsSlice = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createSlice)({ 1790 name: reducerPath + "/internalSubscriptions", 1791 initialState: initialState, 1792 reducers: { 1793 subscriptionsUpdated: { 1794 reducer: function (state, action) { 1795 return (0,immer__WEBPACK_IMPORTED_MODULE_1__.applyPatches)(state, action.payload); 1796 }, 1797 prepare: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.prepareAutoBatched)() 1798 } 1799 } 1800 }); 1801 var configSlice = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createSlice)({ 1802 name: reducerPath + "/config", 1803 initialState: __spreadValues({ 1804 online: isOnline(), 1805 focused: isDocumentVisible(), 1806 middlewareRegistered: false 1807 }, config), 1808 reducers: { 1809 middlewareRegistered: function (state, _j) { 1810 var payload = _j.payload; 1811 state.middlewareRegistered = state.middlewareRegistered === "conflict" || apiUid !== payload ? "conflict" : true; 1812 } 1813 }, 1814 extraReducers: function (builder) { 1815 builder.addCase(onOnline, function (state) { 1816 state.online = true; 1817 }).addCase(onOffline, function (state) { 1818 state.online = false; 1819 }).addCase(onFocus, function (state) { 1820 state.focused = true; 1821 }).addCase(onFocusLost, function (state) { 1822 state.focused = false; 1823 }).addMatcher(hasRehydrationInfo, function (draft) { return __spreadValues({}, draft); }); 1824 } 1825 }); 1826 var combinedReducer = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_2__.combineReducers)({ 1827 queries: querySlice.reducer, 1828 mutations: mutationSlice.reducer, 1829 provided: invalidationSlice.reducer, 1830 subscriptions: internalSubscriptionsSlice.reducer, 1831 config: configSlice.reducer 1832 }); 1833 var reducer = function (state, action) { return combinedReducer(resetApiState.match(action) ? void 0 : state, action); }; 1834 var actions = __spreadProps(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({}, configSlice.actions), querySlice.actions), subscriptionSlice.actions), internalSubscriptionsSlice.actions), mutationSlice.actions), invalidationSlice.actions), { 1835 unsubscribeMutationResult: mutationSlice.actions.removeMutationResult, 1836 resetApiState: resetApiState 1837 }); 1838 return { reducer: reducer, actions: actions }; 1839} 1840// src/query/core/buildSelectors.ts 1841var skipToken = /* @__PURE__ */ Symbol.for("RTKQ/skipToken"); 1842var skipSelector = skipToken; 1843var initialSubState = { 1844 status: QueryStatus.uninitialized 1845}; 1846var defaultQuerySubState = /* @__PURE__ */ (0,immer__WEBPACK_IMPORTED_MODULE_1__["default"])(initialSubState, function () { 1847}); 1848var defaultMutationSubState = /* @__PURE__ */ (0,immer__WEBPACK_IMPORTED_MODULE_1__["default"])(initialSubState, function () { 1849}); 1850function buildSelectors(_j) { 1851 var serializeQueryArgs = _j.serializeQueryArgs, reducerPath = _j.reducerPath; 1852 var selectSkippedQuery = function (state) { return defaultQuerySubState; }; 1853 var selectSkippedMutation = function (state) { return defaultMutationSubState; }; 1854 return { buildQuerySelector: buildQuerySelector, buildMutationSelector: buildMutationSelector, selectInvalidatedBy: selectInvalidatedBy }; 1855 function withRequestFlags(substate) { 1856 return __spreadValues(__spreadValues({}, substate), getRequestStatusFlags(substate.status)); 1857 } 1858 function selectInternalState(rootState) { 1859 var state = rootState[reducerPath]; 1860 if (true) { 1861 if (!state) { 1862 if (selectInternalState.triggered) 1863 return state; 1864 selectInternalState.triggered = true; 1865 console.error("Error: No data found at `state." + reducerPath + "`. Did you forget to add the reducer to the store?"); 1866 } 1867 } 1868 return state; 1869 } 1870 function buildQuerySelector(endpointName, endpointDefinition) { 1871 return function (queryArgs) { 1872 var serializedArgs = serializeQueryArgs({ 1873 queryArgs: queryArgs, 1874 endpointDefinition: endpointDefinition, 1875 endpointName: endpointName 1876 }); 1877 var selectQuerySubstate = function (state) { 1878 var _a, _b, _c; 1879 return (_c = (_b = (_a = selectInternalState(state)) == null ? void 0 : _a.queries) == null ? void 0 : _b[serializedArgs]) != null ? _c : defaultQuerySubState; 1880 }; 1881 var finalSelectQuerySubState = queryArgs === skipToken ? selectSkippedQuery : selectQuerySubstate; 1882 return (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_3__.createSelector)(finalSelectQuerySubState, withRequestFlags); 1883 }; 1884 } 1885 function buildMutationSelector() { 1886 return function (id) { 1887 var _a; 1888 var mutationId; 1889 if (typeof id === "object") { 1890 mutationId = (_a = getMutationCacheKey(id)) != null ? _a : skipToken; 1891 } 1892 else { 1893 mutationId = id; 1894 } 1895 var selectMutationSubstate = function (state) { 1896 var _a2, _b, _c; 1897 return (_c = (_b = (_a2 = selectInternalState(state)) == null ? void 0 : _a2.mutations) == null ? void 0 : _b[mutationId]) != null ? _c : defaultMutationSubState; 1898 }; 1899 var finalSelectMutationSubstate = mutationId === skipToken ? selectSkippedMutation : selectMutationSubstate; 1900 return (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_3__.createSelector)(finalSelectMutationSubstate, withRequestFlags); 1901 }; 1902 } 1903 function selectInvalidatedBy(state, tags) { 1904 var _a; 1905 var apiState = state[reducerPath]; 1906 var toInvalidate = new Set(); 1907 for (var _j = 0, _k = tags.map(expandTagDescription); _j < _k.length; _j++) { 1908 var tag = _k[_j]; 1909 var provided = apiState.provided[tag.type]; 1910 if (!provided) { 1911 continue; 1912 } 1913 var invalidateSubscriptions = (_a = tag.id !== void 0 ? provided[tag.id] : flatten(Object.values(provided))) != null ? _a : []; 1914 for (var _l = 0, invalidateSubscriptions_1 = invalidateSubscriptions; _l < invalidateSubscriptions_1.length; _l++) { 1915 var invalidate = invalidateSubscriptions_1[_l]; 1916 toInvalidate.add(invalidate); 1917 } 1918 } 1919 return flatten(Array.from(toInvalidate.values()).map(function (queryCacheKey) { 1920 var querySubState = apiState.queries[queryCacheKey]; 1921 return querySubState ? [ 1922 { 1923 queryCacheKey: queryCacheKey, 1924 endpointName: querySubState.endpointName, 1925 originalArgs: querySubState.originalArgs 1926 } 1927 ] : []; 1928 })); 1929 } 1930} 1931// src/query/defaultSerializeQueryArgs.ts 1932 1933var cache = WeakMap ? new WeakMap() : void 0; 1934var defaultSerializeQueryArgs = function (_j) { 1935 var endpointName = _j.endpointName, queryArgs = _j.queryArgs; 1936 var serialized = ""; 1937 var cached = cache == null ? void 0 : cache.get(queryArgs); 1938 if (typeof cached === "string") { 1939 serialized = cached; 1940 } 1941 else { 1942 var stringified = JSON.stringify(queryArgs, function (key, value) { return (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(value) ? Object.keys(value).sort().reduce(function (acc, key2) { 1943 acc[key2] = value[key2]; 1944 return acc; 1945 }, {}) : value; }); 1946 if ((0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isPlainObject)(queryArgs)) { 1947 cache == null ? void 0 : cache.set(queryArgs, stringified); 1948 } 1949 serialized = stringified; 1950 } 1951 return endpointName + "(" + serialized + ")"; 1952}; 1953// src/query/createApi.ts 1954 1955 1956function buildCreateApi() { 1957 var modules = []; 1958 for (var _j = 0; _j < arguments.length; _j++) { 1959 modules[_j] = arguments[_j]; 1960 } 1961 return function baseCreateApi(options) { 1962 var extractRehydrationInfo = (0,reselect__WEBPACK_IMPORTED_MODULE_4__.defaultMemoize)(function (action) { 1963 var _a, _b; 1964 return (_b = options.extractRehydrationInfo) == null ? void 0 : _b.call(options, action, { 1965 reducerPath: (_a = options.reducerPath) != null ? _a : "api" 1966 }); 1967 }); 1968 var optionsWithDefaults = __spreadProps(__spreadValues({ 1969 reducerPath: "api", 1970 keepUnusedDataFor: 60, 1971 refetchOnMountOrArgChange: false, 1972 refetchOnFocus: false, 1973 refetchOnReconnect: false 1974 }, options), { 1975 extractRehydrationInfo: extractRehydrationInfo, 1976 serializeQueryArgs: function (queryArgsApi) { 1977 var finalSerializeQueryArgs = defaultSerializeQueryArgs; 1978 if ("serializeQueryArgs" in queryArgsApi.endpointDefinition) { 1979 var endpointSQA_1 = queryArgsApi.endpointDefinition.serializeQueryArgs; 1980 finalSerializeQueryArgs = function (queryArgsApi2) { 1981 var initialResult = endpointSQA_1(queryArgsApi2); 1982 if (typeof initialResult === "string") { 1983 return initialResult; 1984 } 1985 else { 1986 return defaultSerializeQueryArgs(__spreadProps(__spreadValues({}, queryArgsApi2), { 1987 queryArgs: initialResult 1988 })); 1989 } 1990 }; 1991 } 1992 else if (options.serializeQueryArgs) { 1993 finalSerializeQueryArgs = options.serializeQueryArgs; 1994 } 1995 return finalSerializeQueryArgs(queryArgsApi); 1996 }, 1997 tagTypes: __spreadArray([], options.tagTypes || []) 1998 }); 1999 var context = { 2000 endpointDefinitions: {}, 2001 batch: function (fn) { 2002 fn(); 2003 }, 2004 apiUid: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.nanoid)(), 2005 extractRehydrationInfo: extractRehydrationInfo, 2006 hasRehydrationInfo: (0,reselect__WEBPACK_IMPORTED_MODULE_4__.defaultMemoize)(function (action) { return extractRehydrationInfo(action) != null; }) 2007 }; 2008 var api = { 2009 injectEndpoints: injectEndpoints, 2010 enhanceEndpoints: function (_j) { 2011 var addTagTypes = _j.addTagTypes, endpoints = _j.endpoints; 2012 if (addTagTypes) { 2013 for (var _k = 0, addTagTypes_1 = addTagTypes; _k < addTagTypes_1.length; _k++) { 2014 var eT = addTagTypes_1[_k]; 2015 if (!optionsWithDefaults.tagTypes.includes(eT)) { 2016 ; 2017 optionsWithDefaults.tagTypes.push(eT); 2018 } 2019 } 2020 } 2021 if (endpoints) { 2022 for (var _l = 0, _m = Object.entries(endpoints); _l < _m.length; _l++) { 2023 var _o = _m[_l], endpointName = _o[0], partialDefinition = _o[1]; 2024 if (typeof partialDefinition === "function") { 2025 partialDefinition(context.endpointDefinitions[endpointName]); 2026 } 2027 else { 2028 Object.assign(context.endpointDefinitions[endpointName] || {}, partialDefinition); 2029 } 2030 } 2031 } 2032 return api; 2033 } 2034 }; 2035 var initializedModules = modules.map(function (m) { return m.init(api, optionsWithDefaults, context); }); 2036 function injectEndpoints(inject) { 2037 var evaluatedEndpoints = inject.endpoints({ 2038 query: function (x) { return __spreadProps(__spreadValues({}, x), { type: DefinitionType.query }); }, 2039 mutation: function (x) { return __spreadProps(__spreadValues({}, x), { type: DefinitionType.mutation }); } 2040 }); 2041 for (var _j = 0, _k = Object.entries(evaluatedEndpoints); _j < _k.length; _j++) { 2042 var _l = _k[_j], endpointName = _l[0], definition = _l[1]; 2043 if (!inject.overrideExisting && endpointName in context.endpointDefinitions) { 2044 if (typeof process !== "undefined" && "development" === "development") { 2045 console.error("called `injectEndpoints` to override already-existing endpointName " + endpointName + " without specifying `overrideExisting: true`"); 2046 } 2047 continue; 2048 } 2049 context.endpointDefinitions[endpointName] = definition; 2050 for (var _m = 0, initializedModules_1 = initializedModules; _m < initializedModules_1.length; _m++) { 2051 var m = initializedModules_1[_m]; 2052 m.injectEndpoint(endpointName, definition); 2053 } 2054 } 2055 return api; 2056 } 2057 return api.injectEndpoints({ endpoints: options.endpoints }); 2058 }; 2059} 2060// src/query/fakeBaseQuery.ts 2061function fakeBaseQuery() { 2062 return function () { 2063 throw new Error("When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax."); 2064 }; 2065} 2066// src/query/core/buildMiddleware/index.ts 2067 2068// src/query/core/buildMiddleware/cacheCollection.ts 2069function isObjectEmpty(obj) { 2070 for (var k in obj) { 2071 return false; 2072 } 2073 return true; 2074} 2075var THIRTY_TWO_BIT_MAX_TIMER_SECONDS = 2147483647 / 1e3 - 1; 2076var buildCacheCollectionHandler = function (_j) { 2077 var reducerPath = _j.reducerPath, api = _j.api, context = _j.context, internalState = _j.internalState; 2078 var _k = api.internalActions, removeQueryResult = _k.removeQueryResult, unsubscribeQueryResult = _k.unsubscribeQueryResult; 2079 function anySubscriptionsRemainingForKey(queryCacheKey) { 2080 var subscriptions = internalState.currentSubscriptions[queryCacheKey]; 2081 return !!subscriptions && !isObjectEmpty(subscriptions); 2082 } 2083 var currentRemovalTimeouts = {}; 2084 var handler = function (action, mwApi, internalState2) { 2085 var _a; 2086 if (unsubscribeQueryResult.match(action)) { 2087 var state = mwApi.getState()[reducerPath]; 2088 var queryCacheKey = action.payload.queryCacheKey; 2089 handleUnsubscribe(queryCacheKey, (_a = state.queries[queryCacheKey]) == null ? void 0 : _a.endpointName, mwApi, state.config); 2090 } 2091 if (api.util.resetApiState.match(action)) { 2092 for (var _j = 0, _k = Object.entries(currentRemovalTimeouts); _j < _k.length; _j++) { 2093 var _l = _k[_j], key = _l[0], timeout = _l[1]; 2094 if (timeout) 2095 clearTimeout(timeout); 2096 delete currentRemovalTimeouts[key]; 2097 } 2098 } 2099 if (context.hasRehydrationInfo(action)) { 2100 var state = mwApi.getState()[reducerPath]; 2101 var queries = context.extractRehydrationInfo(action).queries; 2102 for (var _m = 0, _o = Object.entries(queries); _m < _o.length; _m++) { 2103 var _p = _o[_m], queryCacheKey = _p[0], queryState = _p[1]; 2104 handleUnsubscribe(queryCacheKey, queryState == null ? void 0 : queryState.endpointName, mwApi, state.config); 2105 } 2106 } 2107 }; 2108 function handleUnsubscribe(queryCacheKey, endpointName, api2, config) { 2109 var _a; 2110 var endpointDefinition = context.endpointDefinitions[endpointName]; 2111 var keepUnusedDataFor = (_a = endpointDefinition == null ? void 0 : endpointDefinition.keepUnusedDataFor) != null ? _a : config.keepUnusedDataFor; 2112 if (keepUnusedDataFor === Infinity) { 2113 return; 2114 } 2115 var finalKeepUnusedDataFor = Math.max(0, Math.min(keepUnusedDataFor, THIRTY_TWO_BIT_MAX_TIMER_SECONDS)); 2116 if (!anySubscriptionsRemainingForKey(queryCacheKey)) { 2117 var currentTimeout = currentRemovalTimeouts[queryCacheKey]; 2118 if (currentTimeout) { 2119 clearTimeout(currentTimeout); 2120 } 2121 currentRemovalTimeouts[queryCacheKey] = setTimeout(function () { 2122 if (!anySubscriptionsRemainingForKey(queryCacheKey)) { 2123 api2.dispatch(removeQueryResult({ queryCacheKey: queryCacheKey })); 2124 } 2125 delete currentRemovalTimeouts[queryCacheKey]; 2126 }, finalKeepUnusedDataFor * 1e3); 2127 } 2128 } 2129 return handler; 2130}; 2131// src/query/core/buildMiddleware/invalidationByTags.ts 2132 2133var buildInvalidationByTagsHandler = function (_j) { 2134 var reducerPath = _j.reducerPath, context = _j.context, endpointDefinitions = _j.context.endpointDefinitions, mutationThunk = _j.mutationThunk, api = _j.api, assertTagType = _j.assertTagType, refetchQuery = _j.refetchQuery; 2135 var removeQueryResult = api.internalActions.removeQueryResult; 2136 var isThunkActionWithTags = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isAnyOf)((0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isFulfilled)(mutationThunk), (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isRejectedWithValue)(mutationThunk)); 2137 var handler = function (action, mwApi) { 2138 if (isThunkActionWithTags(action)) { 2139 invalidateTags(calculateProvidedByThunk(action, "invalidatesTags", endpointDefinitions, assertTagType), mwApi); 2140 } 2141 if (api.util.invalidateTags.match(action)) { 2142 invalidateTags(calculateProvidedBy(action.payload, void 0, void 0, void 0, void 0, assertTagType), mwApi); 2143 } 2144 }; 2145 function invalidateTags(tags, mwApi) { 2146 var rootState = mwApi.getState(); 2147 var state = rootState[reducerPath]; 2148 var toInvalidate = api.util.selectInvalidatedBy(rootState, tags); 2149 context.batch(function () { 2150 var _a; 2151 var valuesArray = Array.from(toInvalidate.values()); 2152 for (var _j = 0, valuesArray_1 = valuesArray; _j < valuesArray_1.length; _j++) { 2153 var queryCacheKey = valuesArray_1[_j].queryCacheKey; 2154 var querySubState = state.queries[queryCacheKey]; 2155 var subscriptionSubState = (_a = state.subscriptions[queryCacheKey]) != null ? _a : {}; 2156 if (querySubState) { 2157 if (Object.keys(subscriptionSubState).length === 0) { 2158 mwApi.dispatch(removeQueryResult({ 2159 queryCacheKey: queryCacheKey 2160 })); 2161 } 2162 else if (querySubState.status !== QueryStatus.uninitialized) { 2163 mwApi.dispatch(refetchQuery(querySubState, queryCacheKey)); 2164 } 2165 } 2166 } 2167 }); 2168 } 2169 return handler; 2170}; 2171// src/query/core/buildMiddleware/polling.ts 2172var buildPollingHandler = function (_j) { 2173 var reducerPath = _j.reducerPath, queryThunk = _j.queryThunk, api = _j.api, refetchQuery = _j.refetchQuery, internalState = _j.internalState; 2174 var currentPolls = {}; 2175 var handler = function (action, mwApi) { 2176 if (api.internalActions.updateSubscriptionOptions.match(action) || api.internalActions.unsubscribeQueryResult.match(action)) { 2177 updatePollingInterval(action.payload, mwApi); 2178 } 2179 if (queryThunk.pending.match(action) || queryThunk.rejected.match(action) && action.meta.condition) { 2180 updatePollingInterval(action.meta.arg, mwApi); 2181 } 2182 if (queryThunk.fulfilled.match(action) || queryThunk.rejected.match(action) && !action.meta.condition) { 2183 startNextPoll(action.meta.arg, mwApi); 2184 } 2185 if (api.util.resetApiState.match(action)) { 2186 clearPolls(); 2187 } 2188 }; 2189 function startNextPoll(_j, api2) { 2190 var queryCacheKey = _j.queryCacheKey; 2191 var state = api2.getState()[reducerPath]; 2192 var querySubState = state.queries[queryCacheKey]; 2193 var subscriptions = internalState.currentSubscriptions[queryCacheKey]; 2194 if (!querySubState || querySubState.status === QueryStatus.uninitialized) 2195 return; 2196 var lowestPollingInterval = findLowestPollingInterval(subscriptions); 2197 if (!Number.isFinite(lowestPollingInterval)) 2198 return; 2199 var currentPoll = currentPolls[queryCacheKey]; 2200 if (currentPoll == null ? void 0 : currentPoll.timeout) { 2201 clearTimeout(currentPoll.timeout); 2202 currentPoll.timeout = void 0; 2203 } 2204 var nextPollTimestamp = Date.now() + lowestPollingInterval; 2205 var currentInterval = currentPolls[queryCacheKey] = { 2206 nextPollTimestamp: nextPollTimestamp, 2207 pollingInterval: lowestPollingInterval, 2208 timeout: setTimeout(function () { 2209 currentInterval.timeout = void 0; 2210 api2.dispatch(refetchQuery(querySubState, queryCacheKey)); 2211 }, lowestPollingInterval) 2212 }; 2213 } 2214 function updatePollingInterval(_j, api2) { 2215 var queryCacheKey = _j.queryCacheKey; 2216 var state = api2.getState()[reducerPath]; 2217 var querySubState = state.queries[queryCacheKey]; 2218 var subscriptions = internalState.currentSubscriptions[queryCacheKey]; 2219 if (!querySubState || querySubState.status === QueryStatus.uninitialized) { 2220 return; 2221 } 2222 var lowestPollingInterval = findLowestPollingInterval(subscriptions); 2223 if (!Number.isFinite(lowestPollingInterval)) { 2224 cleanupPollForKey(queryCacheKey); 2225 return; 2226 } 2227 var currentPoll = currentPolls[queryCacheKey]; 2228 var nextPollTimestamp = Date.now() + lowestPollingInterval; 2229 if (!currentPoll || nextPollTimestamp < currentPoll.nextPollTimestamp) { 2230 startNextPoll({ queryCacheKey: queryCacheKey }, api2); 2231 } 2232 } 2233 function cleanupPollForKey(key) { 2234 var existingPoll = currentPolls[key]; 2235 if (existingPoll == null ? void 0 : existingPoll.timeout) { 2236 clearTimeout(existingPoll.timeout); 2237 } 2238 delete currentPolls[key]; 2239 } 2240 function clearPolls() { 2241 for (var _j = 0, _k = Object.keys(currentPolls); _j < _k.length; _j++) { 2242 var key = _k[_j]; 2243 cleanupPollForKey(key); 2244 } 2245 } 2246 function findLowestPollingInterval(subscribers) { 2247 if (subscribers === void 0) { subscribers = {}; } 2248 var lowestPollingInterval = Number.POSITIVE_INFINITY; 2249 for (var key in subscribers) { 2250 if (!!subscribers[key].pollingInterval) { 2251 lowestPollingInterval = Math.min(subscribers[key].pollingInterval, lowestPollingInterval); 2252 } 2253 } 2254 return lowestPollingInterval; 2255 } 2256 return handler; 2257}; 2258// src/query/core/buildMiddleware/windowEventHandling.ts 2259var buildWindowEventHandler = function (_j) { 2260 var reducerPath = _j.reducerPath, context = _j.context, api = _j.api, refetchQuery = _j.refetchQuery, internalState = _j.internalState; 2261 var removeQueryResult = api.internalActions.removeQueryResult; 2262 var handler = function (action, mwApi) { 2263 if (onFocus.match(action)) { 2264 refetchValidQueries(mwApi, "refetchOnFocus"); 2265 } 2266 if (onOnline.match(action)) { 2267 refetchValidQueries(mwApi, "refetchOnReconnect"); 2268 } 2269 }; 2270 function refetchValidQueries(api2, type) { 2271 var state = api2.getState()[reducerPath]; 2272 var queries = state.queries; 2273 var subscriptions = internalState.currentSubscriptions; 2274 context.batch(function () { 2275 for (var _j = 0, _k = Object.keys(subscriptions); _j < _k.length; _j++) { 2276 var queryCacheKey = _k[_j]; 2277 var querySubState = queries[queryCacheKey]; 2278 var subscriptionSubState = subscriptions[queryCacheKey]; 2279 if (!subscriptionSubState || !querySubState) 2280 continue; 2281 var shouldRefetch = Object.values(subscriptionSubState).some(function (sub) { return sub[type] === true; }) || Object.values(subscriptionSubState).every(function (sub) { return sub[type] === void 0; }) && state.config[type]; 2282 if (shouldRefetch) { 2283 if (Object.keys(subscriptionSubState).length === 0) { 2284 api2.dispatch(removeQueryResult({ 2285 queryCacheKey: queryCacheKey 2286 })); 2287 } 2288 else if (querySubState.status !== QueryStatus.uninitialized) { 2289 api2.dispatch(refetchQuery(querySubState, queryCacheKey)); 2290 } 2291 } 2292 } 2293 }); 2294 } 2295 return handler; 2296}; 2297// src/query/core/buildMiddleware/cacheLifecycle.ts 2298 2299var neverResolvedError = new Error("Promise never resolved before cacheEntryRemoved."); 2300var buildCacheLifecycleHandler = function (_j) { 2301 var api = _j.api, reducerPath = _j.reducerPath, context = _j.context, queryThunk = _j.queryThunk, mutationThunk = _j.mutationThunk, internalState = _j.internalState; 2302 var isQueryThunk = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isAsyncThunkAction)(queryThunk); 2303 var isMutationThunk = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isAsyncThunkAction)(mutationThunk); 2304 var isFulfilledThunk = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isFulfilled)(queryThunk, mutationThunk); 2305 var lifecycleMap = {}; 2306 var handler = function (action, mwApi, stateBefore) { 2307 var cacheKey = getCacheKey(action); 2308 if (queryThunk.pending.match(action)) { 2309 var oldState = stateBefore[reducerPath].queries[cacheKey]; 2310 var state = mwApi.getState()[reducerPath].queries[cacheKey]; 2311 if (!oldState && state) { 2312 handleNewKey(action.meta.arg.endpointName, action.meta.arg.originalArgs, cacheKey, mwApi, action.meta.requestId); 2313 } 2314 } 2315 else if (mutationThunk.pending.match(action)) { 2316 var state = mwApi.getState()[reducerPath].mutations[cacheKey]; 2317 if (state) { 2318 handleNewKey(action.meta.arg.endpointName, action.meta.arg.originalArgs, cacheKey, mwApi, action.meta.requestId); 2319 } 2320 } 2321 else if (isFulfilledThunk(action)) { 2322 var lifecycle = lifecycleMap[cacheKey]; 2323 if (lifecycle == null ? void 0 : lifecycle.valueResolved) { 2324 lifecycle.valueResolved({ 2325 data: action.payload, 2326 meta: action.meta.baseQueryMeta 2327 }); 2328 delete lifecycle.valueResolved; 2329 } 2330 } 2331 else if (api.internalActions.removeQueryResult.match(action) || api.internalActions.removeMutationResult.match(action)) { 2332 var lifecycle = lifecycleMap[cacheKey]; 2333 if (lifecycle) { 2334 delete lifecycleMap[cacheKey]; 2335 lifecycle.cacheEntryRemoved(); 2336 } 2337 } 2338 else if (api.util.resetApiState.match(action)) { 2339 for (var _j = 0, _k = Object.entries(lifecycleMap); _j < _k.length; _j++) { 2340 var _l = _k[_j], cacheKey2 = _l[0], lifecycle = _l[1]; 2341 delete lifecycleMap[cacheKey2]; 2342 lifecycle.cacheEntryRemoved(); 2343 } 2344 } 2345 }; 2346 function getCacheKey(action) { 2347 if (isQueryThunk(action)) 2348 return action.meta.arg.queryCacheKey; 2349 if (isMutationThunk(action)) 2350 return action.meta.requestId; 2351 if (api.internalActions.removeQueryResult.match(action)) 2352 return action.payload.queryCacheKey; 2353 if (api.internalActions.removeMutationResult.match(action)) 2354 return getMutationCacheKey(action.payload); 2355 return ""; 2356 } 2357 function handleNewKey(endpointName, originalArgs, queryCacheKey, mwApi, requestId) { 2358 var endpointDefinition = context.endpointDefinitions[endpointName]; 2359 var onCacheEntryAdded = endpointDefinition == null ? void 0 : endpointDefinition.onCacheEntryAdded; 2360 if (!onCacheEntryAdded) 2361 return; 2362 var lifecycle = {}; 2363 var cacheEntryRemoved = new Promise(function (resolve) { 2364 lifecycle.cacheEntryRemoved = resolve; 2365 }); 2366 var cacheDataLoaded = Promise.race([ 2367 new Promise(function (resolve) { 2368 lifecycle.valueResolved = resolve; 2369 }), 2370 cacheEntryRemoved.then(function () { 2371 throw neverResolvedError; 2372 }) 2373 ]); 2374 cacheDataLoaded.catch(function () { 2375 }); 2376 lifecycleMap[queryCacheKey] = lifecycle; 2377 var selector = api.endpoints[endpointName].select(endpointDefinition.type === DefinitionType.query ? originalArgs : queryCacheKey); 2378 var extra = mwApi.dispatch(function (_, __, extra2) { return extra2; }); 2379 var lifecycleApi = __spreadProps(__spreadValues({}, mwApi), { 2380 getCacheEntry: function () { return selector(mwApi.getState()); }, 2381 requestId: requestId, 2382 extra: extra, 2383 updateCachedData: endpointDefinition.type === DefinitionType.query ? function (updateRecipe) { return mwApi.dispatch(api.util.updateQueryData(endpointName, originalArgs, updateRecipe)); } : void 0, 2384 cacheDataLoaded: cacheDataLoaded, 2385 cacheEntryRemoved: cacheEntryRemoved 2386 }); 2387 var runningHandler = onCacheEntryAdded(originalArgs, lifecycleApi); 2388 Promise.resolve(runningHandler).catch(function (e) { 2389 if (e === neverResolvedError) 2390 return; 2391 throw e; 2392 }); 2393 } 2394 return handler; 2395}; 2396// src/query/core/buildMiddleware/queryLifecycle.ts 2397 2398var buildQueryLifecycleHandler = function (_j) { 2399 var api = _j.api, context = _j.context, queryThunk = _j.queryThunk, mutationThunk = _j.mutationThunk; 2400 var isPendingThunk = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isPending)(queryThunk, mutationThunk); 2401 var isRejectedThunk = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isRejected)(queryThunk, mutationThunk); 2402 var isFullfilledThunk = (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.isFulfilled)(queryThunk, mutationThunk); 2403 var lifecycleMap = {}; 2404 var handler = function (action, mwApi) { 2405 var _a, _b, _c; 2406 if (isPendingThunk(action)) { 2407 var _j = action.meta, requestId = _j.requestId, _k = _j.arg, endpointName_1 = _k.endpointName, originalArgs_1 = _k.originalArgs; 2408 var endpointDefinition = context.endpointDefinitions[endpointName_1]; 2409 var onQueryStarted = endpointDefinition == null ? void 0 : endpointDefinition.onQueryStarted; 2410 if (onQueryStarted) { 2411 var lifecycle_1 = {}; 2412 var queryFulfilled = new Promise(function (resolve, reject) { 2413 lifecycle_1.resolve = resolve; 2414 lifecycle_1.reject = reject; 2415 }); 2416 queryFulfilled.catch(function () { 2417 }); 2418 lifecycleMap[requestId] = lifecycle_1; 2419 var selector_1 = api.endpoints[endpointName_1].select(endpointDefinition.type === DefinitionType.query ? originalArgs_1 : requestId); 2420 var extra = mwApi.dispatch(function (_, __, extra2) { return extra2; }); 2421 var lifecycleApi = __spreadProps(__spreadValues({}, mwApi), { 2422 getCacheEntry: function () { return selector_1(mwApi.getState()); }, 2423 requestId: requestId, 2424 extra: extra, 2425 updateCachedData: endpointDefinition.type === DefinitionType.query ? function (updateRecipe) { return mwApi.dispatch(api.util.updateQueryData(endpointName_1, originalArgs_1, updateRecipe)); } : void 0, 2426 queryFulfilled: queryFulfilled 2427 }); 2428 onQueryStarted(originalArgs_1, lifecycleApi); 2429 } 2430 } 2431 else if (isFullfilledThunk(action)) { 2432 var _l = action.meta, requestId = _l.requestId, baseQueryMeta = _l.baseQueryMeta; 2433 (_a = lifecycleMap[requestId]) == null ? void 0 : _a.resolve({ 2434 data: action.payload, 2435 meta: baseQueryMeta 2436 }); 2437 delete lifecycleMap[requestId]; 2438 } 2439 else if (isRejectedThunk(action)) { 2440 var _m = action.meta, requestId = _m.requestId, rejectedWithValue = _m.rejectedWithValue, baseQueryMeta = _m.baseQueryMeta; 2441 (_c = lifecycleMap[requestId]) == null ? void 0 : _c.reject({ 2442 error: (_b = action.payload) != null ? _b : action.error, 2443 isUnhandledError: !rejectedWithValue, 2444 meta: baseQueryMeta 2445 }); 2446 delete lifecycleMap[requestId]; 2447 } 2448 }; 2449 return handler; 2450}; 2451// src/query/core/buildMiddleware/devMiddleware.ts 2452var buildDevCheckHandler = function (_j) { 2453 var api = _j.api, apiUid = _j.context.apiUid, reducerPath = _j.reducerPath; 2454 return function (action, mwApi) { 2455 var _a, _b; 2456 if (api.util.resetApiState.match(action)) { 2457 mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid)); 2458 } 2459 if (typeof process !== "undefined" && "development" === "development") { 2460 if (api.internalActions.middlewareRegistered.match(action) && action.payload === apiUid && ((_b = (_a = mwApi.getState()[reducerPath]) == null ? void 0 : _a.config) == null ? void 0 : _b.middlewareRegistered) === "conflict") { 2461 console.warn("There is a mismatch between slice and middleware for the reducerPath \"" + reducerPath + "\".\nYou can only have one api per reducer path, this will lead to crashes in various situations!" + (reducerPath === "api" ? "\nIf you have multiple apis, you *have* to specify the reducerPath option when using createApi!" : "")); 2462 } 2463 } 2464 }; 2465}; 2466// src/query/core/buildMiddleware/batchActions.ts 2467 2468var promise; 2469var queueMicrotaskShim = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : globalThis) : function (cb) { return (promise || (promise = Promise.resolve())).then(cb).catch(function (err) { return setTimeout(function () { 2470 throw err; 2471}, 0); }); }; 2472var buildBatchedActionsHandler = function (_j) { 2473 var api = _j.api, queryThunk = _j.queryThunk, internalState = _j.internalState; 2474 var subscriptionsPrefix = api.reducerPath + "/subscriptions"; 2475 var previousSubscriptions = null; 2476 var dispatchQueued = false; 2477 var _k = api.internalActions, updateSubscriptionOptions = _k.updateSubscriptionOptions, unsubscribeQueryResult = _k.unsubscribeQueryResult; 2478 var actuallyMutateSubscriptions = function (mutableState, action) { 2479 var _a, _b, _c, _d, _e, _f, _g, _h, _i; 2480 if (updateSubscriptionOptions.match(action)) { 2481 var _j = action.payload, queryCacheKey = _j.queryCacheKey, requestId = _j.requestId, options = _j.options; 2482 if ((_a = mutableState == null ? void 0 : mutableState[queryCacheKey]) == null ? void 0 : _a[requestId]) { 2483 mutableState[queryCacheKey][requestId] = options; 2484 } 2485 return true; 2486 } 2487 if (unsubscribeQueryResult.match(action)) { 2488 var _k = action.payload, queryCacheKey = _k.queryCacheKey, requestId = _k.requestId; 2489 if (mutableState[queryCacheKey]) { 2490 delete mutableState[queryCacheKey][requestId]; 2491 } 2492 return true; 2493 } 2494 if (api.internalActions.removeQueryResult.match(action)) { 2495 delete mutableState[action.payload.queryCacheKey]; 2496 return true; 2497 } 2498 if (queryThunk.pending.match(action)) { 2499 var _l = action.meta, arg = _l.arg, requestId = _l.requestId; 2500 if (arg.subscribe) { 2501 var substate = (_c = mutableState[_b = arg.queryCacheKey]) != null ? _c : mutableState[_b] = {}; 2502 substate[requestId] = (_e = (_d = arg.subscriptionOptions) != null ? _d : substate[requestId]) != null ? _e : {}; 2503 return true; 2504 } 2505 } 2506 if (queryThunk.rejected.match(action)) { 2507 var _m = action.meta, condition = _m.condition, arg = _m.arg, requestId = _m.requestId; 2508 if (condition && arg.subscribe) { 2509 var substate = (_g = mutableState[_f = arg.queryCacheKey]) != null ? _g : mutableState[_f] = {}; 2510 substate[requestId] = (_i = (_h = arg.subscriptionOptions) != null ? _h : substate[requestId]) != null ? _i : {}; 2511 return true; 2512 } 2513 } 2514 return false; 2515 }; 2516 return function (action, mwApi) { 2517 var _a, _b; 2518 if (!previousSubscriptions) { 2519 previousSubscriptions = JSON.parse(JSON.stringify(internalState.currentSubscriptions)); 2520 } 2521 if (api.util.resetApiState.match(action)) { 2522 previousSubscriptions = internalState.currentSubscriptions = {}; 2523 return [true, false]; 2524 } 2525 if (api.internalActions.internal_probeSubscription.match(action)) { 2526 var _j = action.payload, queryCacheKey = _j.queryCacheKey, requestId = _j.requestId; 2527 var hasSubscription = !!((_a = internalState.currentSubscriptions[queryCacheKey]) == null ? void 0 : _a[requestId]); 2528 return [false, hasSubscription]; 2529 } 2530 var didMutate = actuallyMutateSubscriptions(internalState.currentSubscriptions, action); 2531 if (didMutate) { 2532 if (!dispatchQueued) { 2533 queueMicrotaskShim(function () { 2534 var newSubscriptions = JSON.parse(JSON.stringify(internalState.currentSubscriptions)); 2535 var _j = (0,immer__WEBPACK_IMPORTED_MODULE_1__.produceWithPatches)(previousSubscriptions, function () { return newSubscriptions; }), patches = _j[1]; 2536 mwApi.next(api.internalActions.subscriptionsUpdated(patches)); 2537 previousSubscriptions = newSubscriptions; 2538 dispatchQueued = false; 2539 }); 2540 dispatchQueued = true; 2541 } 2542 var isSubscriptionSliceAction = !!((_b = action.type) == null ? void 0 : _b.startsWith(subscriptionsPrefix)); 2543 var isAdditionalSubscriptionAction = queryThunk.rejected.match(action) && action.meta.condition && !!action.meta.arg.subscribe; 2544 var actionShouldContinue = !isSubscriptionSliceAction && !isAdditionalSubscriptionAction; 2545 return [actionShouldContinue, false]; 2546 } 2547 return [true, false]; 2548 }; 2549}; 2550// src/query/core/buildMiddleware/index.ts 2551function buildMiddleware(input) { 2552 var reducerPath = input.reducerPath, queryThunk = input.queryThunk, api = input.api, context = input.context; 2553 var apiUid = context.apiUid; 2554 var actions = { 2555 invalidateTags: (0,_reduxjs_toolkit__WEBPACK_IMPORTED_MODULE_0__.createAction)(reducerPath + "/invalidateTags") 2556 }; 2557 var isThisApiSliceAction = function (action) { 2558 return !!action && typeof action.type === "string" && action.type.startsWith(reducerPath + "/"); 2559 }; 2560 var handlerBuilders = [ 2561 buildDevCheckHandler, 2562 buildCacheCollectionHandler, 2563 buildInvalidationByTagsHandler, 2564 buildPollingHandler, 2565 buildCacheLifecycleHandler, 2566 buildQueryLifecycleHandler 2567 ]; 2568 var middleware = function (mwApi) { 2569 var initialized2 = false; 2570 var internalState = { 2571 currentSubscriptions: {} 2572 }; 2573 var builderArgs = __spreadProps(__spreadValues({}, input), { 2574 internalState: internalState, 2575 refetchQuery: refetchQuery 2576 }); 2577 var handlers = handlerBuilders.map(function (build) { return build(builderArgs); }); 2578 var batchedActionsHandler = buildBatchedActionsHandler(builderArgs); 2579 var windowEventsHandler = buildWindowEventHandler(builderArgs); 2580 return function (next) { 2581 return function (action) { 2582 if (!initialized2) { 2583 initialized2 = true; 2584 mwApi.dispatch(api.internalActions.middlewareRegistered(apiUid)); 2585 } 2586 var mwApiWithNext = __spreadProps(__spreadValues({}, mwApi), { next: next }); 2587 var stateBefore = mwApi.getState(); 2588 var _j = batchedActionsHandler(action, mwApiWithNext, stateBefore), actionShouldContinue = _j[0], hasSubscription = _j[1]; 2589 var res; 2590 if (actionShouldContinue) { 2591 res = next(action); 2592 } 2593 else { 2594 res = hasSubscription; 2595 } 2596 if (!!mwApi.getState()[reducerPath]) { 2597 windowEventsHandler(action, mwApiWithNext, stateBefore); 2598 if (isThisApiSliceAction(action) || context.hasRehydrationInfo(action)) { 2599 for (var _k = 0, handlers_1 = handlers; _k < handlers_1.length; _k++) { 2600 var handler = handlers_1[_k]; 2601 handler(action, mwApiWithNext, stateBefore); 2602 } 2603 } 2604 } 2605 return res; 2606 }; 2607 }; 2608 }; 2609 return { middleware: middleware, actions: actions }; 2610 function refetchQuery(querySubState, queryCacheKey, override) { 2611 if (override === void 0) { override = {}; } 2612 return queryThunk(__spreadValues({ 2613 type: "query", 2614 endpointName: querySubState.endpointName, 2615 originalArgs: querySubState.originalArgs, 2616 subscribe: false, 2617 forceRefetch: true, 2618 queryCacheKey: queryCacheKey 2619 }, override)); 2620 } 2621} 2622// src/query/tsHelpers.ts 2623function assertCast(v) { 2624} 2625function safeAssign(target) { 2626 var args = []; 2627 for (var _j = 1; _j < arguments.length; _j++) { 2628 args[_j - 1] = arguments[_j]; 2629 } 2630 Object.assign.apply(Object, __spreadArray([target], args)); 2631} 2632// src/query/core/module.ts 2633 2634var coreModuleName = /* @__PURE__ */ Symbol(); 2635var coreModule = function () { return ({ 2636 name: coreModuleName, 2637 init: function (api, _j, context) { 2638 var baseQuery = _j.baseQuery, tagTypes = _j.tagTypes, reducerPath = _j.reducerPath, serializeQueryArgs = _j.serializeQueryArgs, keepUnusedDataFor = _j.keepUnusedDataFor, refetchOnMountOrArgChange = _j.refetchOnMountOrArgChange, refetchOnFocus = _j.refetchOnFocus, refetchOnReconnect = _j.refetchOnReconnect; 2639 (0,immer__WEBPACK_IMPORTED_MODULE_1__.enablePatches)(); 2640 assertCast(serializeQueryArgs); 2641 var assertTagType = function (tag) { 2642 if (typeof process !== "undefined" && "development" === "development") { 2643 if (!tagTypes.includes(tag.type)) { 2644 console.error("Tag type '" + tag.type + "' was used, but not specified in `tagTypes`!"); 2645 } 2646 } 2647 return tag; 2648 }; 2649 Object.assign(api, { 2650 reducerPath: reducerPath, 2651 endpoints: {}, 2652 internalActions: { 2653 onOnline: onOnline, 2654 onOffline: onOffline, 2655 onFocus: onFocus, 2656 onFocusLost: onFocusLost 2657 }, 2658 util: {} 2659 }); 2660 var _k = buildThunks({ 2661 baseQuery: baseQuery, 2662 reducerPath: reducerPath, 2663 context: context, 2664 api: api, 2665 serializeQueryArgs: serializeQueryArgs, 2666 assertTagType: assertTagType 2667 }), queryThunk = _k.queryThunk, mutationThunk = _k.mutationThunk, patchQueryData = _k.patchQueryData, updateQueryData = _k.updateQueryData, upsertQueryData = _k.upsertQueryData, prefetch = _k.prefetch, buildMatchThunkActions = _k.buildMatchThunkActions; 2668 var _l = buildSlice({ 2669 context: context, 2670 queryThunk: queryThunk, 2671 mutationThunk: mutationThunk, 2672 reducerPath: reducerPath, 2673 assertTagType: assertTagType, 2674 config: { 2675 refetchOnFocus: refetchOnFocus, 2676 refetchOnReconnect: refetchOnReconnect, 2677 refetchOnMountOrArgChange: refetchOnMountOrArgChange, 2678 keepUnusedDataFor: keepUnusedDataFor, 2679 reducerPath: reducerPath 2680 } 2681 }), reducer = _l.reducer, sliceActions = _l.actions; 2682 safeAssign(api.util, { 2683 patchQueryData: patchQueryData, 2684 updateQueryData: updateQueryData, 2685 upsertQueryData: upsertQueryData, 2686 prefetch: prefetch, 2687 resetApiState: sliceActions.resetApiState 2688 }); 2689 safeAssign(api.internalActions, sliceActions); 2690 var _m = buildMiddleware({ 2691 reducerPath: reducerPath, 2692 context: context, 2693 queryThunk: queryThunk, 2694 mutationThunk: mutationThunk, 2695 api: api, 2696 assertTagType: assertTagType 2697 }), middleware = _m.middleware, middlewareActions = _m.actions; 2698 safeAssign(api.util, middlewareActions); 2699 safeAssign(api, { reducer: reducer, middleware: middleware }); 2700 var _o = buildSelectors({ 2701 serializeQueryArgs: serializeQueryArgs, 2702 reducerPath: reducerPath 2703 }), buildQuerySelector = _o.buildQuerySelector, buildMutationSelector = _o.buildMutationSelector, selectInvalidatedBy = _o.selectInvalidatedBy; 2704 safeAssign(api.util, { selectInvalidatedBy: selectInvalidatedBy }); 2705 var _p = buildInitiate({ 2706 queryThunk: queryThunk, 2707 mutationThunk: mutationThunk, 2708 api: api, 2709 serializeQueryArgs: serializeQueryArgs, 2710 context: context 2711 }), buildInitiateQuery = _p.buildInitiateQuery, buildInitiateMutation = _p.buildInitiateMutation, getRunningMutationThunk = _p.getRunningMutationThunk, getRunningMutationsThunk = _p.getRunningMutationsThunk, getRunningQueriesThunk = _p.getRunningQueriesThunk, getRunningQueryThunk = _p.getRunningQueryThunk, getRunningOperationPromises = _p.getRunningOperationPromises, removalWarning = _p.removalWarning; 2712 safeAssign(api.util, { 2713 getRunningOperationPromises: getRunningOperationPromises, 2714 getRunningOperationPromise: removalWarning, 2715 getRunningMutationThunk: getRunningMutationThunk, 2716 getRunningMutationsThunk: getRunningMutationsThunk, 2717 getRunningQueryThunk: getRunningQueryThunk, 2718 getRunningQueriesThunk: getRunningQueriesThunk 2719 }); 2720 return { 2721 name: coreModuleName, 2722 injectEndpoint: function (endpointName, definition) { 2723 var _a, _b; 2724 var anyApi = api; 2725 (_b = (_a = anyApi.endpoints)[endpointName]) != null ? _b : _a[endpointName] = {}; 2726 if (isQueryDefinition(definition)) { 2727 safeAssign(anyApi.endpoints[endpointName], { 2728 name: endpointName, 2729 select: buildQuerySelector(endpointName, definition), 2730 initiate: buildInitiateQuery(endpointName, definition) 2731 }, buildMatchThunkActions(queryThunk, endpointName)); 2732 } 2733 else if (isMutationDefinition(definition)) { 2734 safeAssign(anyApi.endpoints[endpointName], { 2735 name: endpointName, 2736 select: buildMutationSelector(), 2737 initiate: buildInitiateMutation(endpointName) 2738 }, buildMatchThunkActions(mutationThunk, endpointName)); 2739 } 2740 } 2741 }; 2742 } 2743}); }; 2744// src/query/core/index.ts 2745var createApi = /* @__PURE__ */ buildCreateApi(coreModule()); 2746 2747//# sourceMappingURL=rtk-query.esm.js.map 2748 2749/***/ }), 2750
vendor: 93,086 bytes, lines 2751-4833
2751/***/ "./node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js": 2752/*!*****************************************************************!*\ 2753 !*** ./node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js ***! 2754 \*****************************************************************/ 2755/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 2756 2757"use strict"; 2758__webpack_require__.r(__webpack_exports__); 2759/* harmony export */ __webpack_require__.d(__webpack_exports__, { 2760/* harmony export */ EnhancerArray: () => (/* binding */ EnhancerArray), 2761/* harmony export */ MiddlewareArray: () => (/* binding */ MiddlewareArray), 2762/* harmony export */ SHOULD_AUTOBATCH: () => (/* binding */ SHOULD_AUTOBATCH), 2763/* harmony export */ TaskAbortError: () => (/* binding */ TaskAbortError), 2764/* harmony export */ __DO_NOT_USE__ActionTypes: () => (/* reexport safe */ redux__WEBPACK_IMPORTED_MODULE_0__.__DO_NOT_USE__ActionTypes), 2765/* harmony export */ addListener: () => (/* binding */ addListener), 2766/* harmony export */ applyMiddleware: () => (/* reexport safe */ redux__WEBPACK_IMPORTED_MODULE_0__.applyMiddleware), 2767/* harmony export */ autoBatchEnhancer: () => (/* binding */ autoBatchEnhancer), 2768/* harmony export */ bindActionCreators: () => (/* reexport safe */ redux__WEBPACK_IMPORTED_MODULE_0__.bindActionCreators), 2769/* harmony export */ clearAllListeners: () => (/* binding */ clearAllListeners), 2770/* harmony export */ combineReducers: () => (/* reexport safe */ redux__WEBPACK_IMPORTED_MODULE_0__.combineReducers), 2771/* harmony export */ compose: () => (/* reexport safe */ redux__WEBPACK_IMPORTED_MODULE_0__.compose), 2772/* harmony export */ configureStore: () => (/* binding */ configureStore), 2773/* harmony export */ createAction: () => (/* binding */ createAction), 2774/* harmony export */ createActionCreatorInvariantMiddleware: () => (/* binding */ createActionCreatorInvariantMiddleware), 2775/* harmony export */ createAsyncThunk: () => (/* binding */ createAsyncThunk), 2776/* harmony export */ createDraftSafeSelector: () => (/* binding */ createDraftSafeSelector), 2777/* harmony export */ createEntityAdapter: () => (/* binding */ createEntityAdapter), 2778/* harmony export */ createImmutableStateInvariantMiddleware: () => (/* binding */ createImmutableStateInvariantMiddleware), 2779/* harmony export */ createListenerMiddleware: () => (/* binding */ createListenerMiddleware), 2780/* harmony export */ createNextState: () => (/* reexport safe */ immer__WEBPACK_IMPORTED_MODULE_2__["default"]), 2781/* harmony export */ createReducer: () => (/* binding */ createReducer), 2782/* harmony export */ createSelector: () => (/* reexport safe */ reselect__WEBPACK_IMPORTED_MODULE_1__.createSelector), 2783/* harmony export */ createSerializableStateInvariantMiddleware: () => (/* binding */ createSerializableStateInvariantMiddleware), 2784/* harmony export */ createSlice: () => (/* binding */ createSlice), 2785/* harmony export */ createStore: () => (/* reexport safe */ redux__WEBPACK_IMPORTED_MODULE_0__.createStore), 2786/* harmony export */ current: () => (/* reexport safe */ immer__WEBPACK_IMPORTED_MODULE_2__.current), 2787/* harmony export */ findNonSerializableValue: () => (/* binding */ findNonSerializableValue), 2788/* harmony export */ freeze: () => (/* reexport safe */ immer__WEBPACK_IMPORTED_MODULE_2__.freeze), 2789/* harmony export */ getDefaultMiddleware: () => (/* binding */ getDefaultMiddleware), 2790/* harmony export */ getType: () => (/* binding */ getType), 2791/* harmony export */ isAction: () => (/* binding */ isAction), 2792/* harmony export */ isActionCreator: () => (/* binding */ isActionCreator), 2793/* harmony export */ isAllOf: () => (/* binding */ isAllOf), 2794/* harmony export */ isAnyOf: () => (/* binding */ isAnyOf), 2795/* harmony export */ isAsyncThunkAction: () => (/* binding */ isAsyncThunkAction), 2796/* harmony export */ isDraft: () => (/* reexport safe */ immer__WEBPACK_IMPORTED_MODULE_2__.isDraft), 2797/* harmony export */ isFluxStandardAction: () => (/* binding */ isFSA), 2798/* harmony export */ isFulfilled: () => (/* binding */ isFulfilled), 2799/* harmony export */ isImmutableDefault: () => (/* binding */ isImmutableDefault), 2800/* harmony export */ isPending: () => (/* binding */ isPending), 2801/* harmony export */ isPlain: () => (/* binding */ isPlain), 2802/* harmony export */ isPlainObject: () => (/* binding */ isPlainObject), 2803/* harmony export */ isRejected: () => (/* binding */ isRejected), 2804/* harmony export */ isRejectedWithValue: () => (/* binding */ isRejectedWithValue), 2805/* harmony export */ legacy_createStore: () => (/* reexport safe */ redux__WEBPACK_IMPORTED_MODULE_0__.legacy_createStore), 2806/* harmony export */ miniSerializeError: () => (/* binding */ miniSerializeError), 2807/* harmony export */ nanoid: () => (/* binding */ nanoid), 2808/* harmony export */ original: () => (/* reexport safe */ immer__WEBPACK_IMPORTED_MODULE_2__.original), 2809/* harmony export */ prepareAutoBatched: () => (/* binding */ prepareAutoBatched), 2810/* harmony export */ removeListener: () => (/* binding */ removeListener), 2811/* harmony export */ unwrapResult: () => (/* binding */ unwrapResult) 2812/* harmony export */ }); 2813/* harmony import */ var immer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! immer */ "./node_modules/immer/dist/immer.esm.mjs"); 2814/* harmony import */ var redux__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! redux */ "./node_modules/redux/es/redux.js"); 2815/* harmony import */ var reselect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! reselect */ "./node_modules/reselect/es/index.js"); 2816/* harmony import */ var redux_thunk__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! redux-thunk */ "./node_modules/redux-thunk/es/index.js"); 2817/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 2818var __extends = (undefined && undefined.__extends) || (function () { 2819 var extendStatics = function (d, b) { 2820 extendStatics = Object.setPrototypeOf || 2821 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 2822 function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; 2823 return extendStatics(d, b); 2824 }; 2825 return function (d, b) { 2826 if (typeof b !== "function" && b !== null) 2827 throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 2828 extendStatics(d, b); 2829 function __() { this.constructor = d; } 2830 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 2831 }; 2832})(); 2833var __generator = (undefined && undefined.__generator) || function (thisArg, body) { 2834 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; 2835 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 2836 function verb(n) { return function (v) { return step([n, v]); }; } 2837 function step(op) { 2838 if (f) throw new TypeError("Generator is already executing."); 2839 while (_) try { 2840 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 2841 if (y = 0, t) op = [op[0] & 2, t.value]; 2842 switch (op[0]) { 2843 case 0: case 1: t = op; break; 2844 case 4: _.label++; return { value: op[1], done: false }; 2845 case 5: _.label++; y = op[1]; op = [0]; continue; 2846 case 7: op = _.ops.pop(); _.trys.pop(); continue; 2847 default: 2848 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 2849 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 2850 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 2851 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 2852 if (t[2]) _.ops.pop(); 2853 _.trys.pop(); continue; 2854 } 2855 op = body.call(thisArg, _); 2856 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 2857 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 2858 } 2859}; 2860var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from) { 2861 for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) 2862 to[j] = from[i]; 2863 return to; 2864}; 2865var __defProp = Object.defineProperty; 2866var __defProps = Object.defineProperties; 2867var __getOwnPropDescs = Object.getOwnPropertyDescriptors; 2868var __getOwnPropSymbols = Object.getOwnPropertySymbols; 2869var __hasOwnProp = Object.prototype.hasOwnProperty; 2870var __propIsEnum = Object.prototype.propertyIsEnumerable; 2871var __defNormalProp = function (obj, key, value) { return key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value: value }) : obj[key] = value; }; 2872var __spreadValues = function (a, b) { 2873 for (var prop in b || (b = {})) 2874 if (__hasOwnProp.call(b, prop)) 2875 __defNormalProp(a, prop, b[prop]); 2876 if (__getOwnPropSymbols) 2877 for (var _i = 0, _c = __getOwnPropSymbols(b); _i < _c.length; _i++) { 2878 var prop = _c[_i]; 2879 if (__propIsEnum.call(b, prop)) 2880 __defNormalProp(a, prop, b[prop]); 2881 } 2882 return a; 2883}; 2884var __spreadProps = function (a, b) { return __defProps(a, __getOwnPropDescs(b)); }; 2885var __async = function (__this, __arguments, generator) { 2886 return new Promise(function (resolve, reject) { 2887 var fulfilled = function (value) { 2888 try { 2889 step(generator.next(value)); 2890 } 2891 catch (e) { 2892 reject(e); 2893 } 2894 }; 2895 var rejected = function (value) { 2896 try { 2897 step(generator.throw(value)); 2898 } 2899 catch (e) { 2900 reject(e); 2901 } 2902 }; 2903 var step = function (x) { return x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected); }; 2904 step((generator = generator.apply(__this, __arguments)).next()); 2905 }); 2906}; 2907// src/index.ts 2908 2909 2910 2911 2912// src/createDraftSafeSelector.ts 2913 2914 2915var createDraftSafeSelector = function () { 2916 var args = []; 2917 for (var _i = 0; _i < arguments.length; _i++) { 2918 args[_i] = arguments[_i]; 2919 } 2920 var selector = reselect__WEBPACK_IMPORTED_MODULE_1__.createSelector.apply(void 0, args); 2921 var wrappedSelector = function (value) { 2922 var rest = []; 2923 for (var _i = 1; _i < arguments.length; _i++) { 2924 rest[_i - 1] = arguments[_i]; 2925 } 2926 return selector.apply(void 0, __spreadArray([(0,immer__WEBPACK_IMPORTED_MODULE_2__.isDraft)(value) ? (0,immer__WEBPACK_IMPORTED_MODULE_2__.current)(value) : value], rest)); 2927 }; 2928 return wrappedSelector; 2929}; 2930// src/configureStore.ts 2931 2932// src/devtoolsExtension.ts 2933 2934var composeWithDevTools = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ ? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ : function () { 2935 if (arguments.length === 0) 2936 return void 0; 2937 if (typeof arguments[0] === "object") 2938 return redux__WEBPACK_IMPORTED_MODULE_0__.compose; 2939 return redux__WEBPACK_IMPORTED_MODULE_0__.compose.apply(null, arguments); 2940}; 2941var devToolsEnhancer = typeof window !== "undefined" && window.__REDUX_DEVTOOLS_EXTENSION__ ? window.__REDUX_DEVTOOLS_EXTENSION__ : function () { 2942 return function (noop2) { 2943 return noop2; 2944 }; 2945}; 2946// src/isPlainObject.ts 2947function isPlainObject(value) { 2948 if (typeof value !== "object" || value === null) 2949 return false; 2950 var proto = Object.getPrototypeOf(value); 2951 if (proto === null) 2952 return true; 2953 var baseProto = proto; 2954 while (Object.getPrototypeOf(baseProto) !== null) { 2955 baseProto = Object.getPrototypeOf(baseProto); 2956 } 2957 return proto === baseProto; 2958} 2959// src/getDefaultMiddleware.ts 2960 2961// src/tsHelpers.ts 2962var hasMatchFunction = function (v) { 2963 return v && typeof v.match === "function"; 2964}; 2965// src/createAction.ts 2966function createAction(type, prepareAction) { 2967 function actionCreator() { 2968 var args = []; 2969 for (var _i = 0; _i < arguments.length; _i++) { 2970 args[_i] = arguments[_i]; 2971 } 2972 if (prepareAction) { 2973 var prepared = prepareAction.apply(void 0, args); 2974 if (!prepared) { 2975 throw new Error("prepareAction did not return an object"); 2976 } 2977 return __spreadValues(__spreadValues({ 2978 type: type, 2979 payload: prepared.payload 2980 }, "meta" in prepared && { meta: prepared.meta }), "error" in prepared && { error: prepared.error }); 2981 } 2982 return { type: type, payload: args[0] }; 2983 } 2984 actionCreator.toString = function () { return "" + type; }; 2985 actionCreator.type = type; 2986 actionCreator.match = function (action) { return action.type === type; }; 2987 return actionCreator; 2988} 2989function isAction(action) { 2990 return isPlainObject(action) && "type" in action; 2991} 2992function isActionCreator(action) { 2993 return typeof action === "function" && "type" in action && hasMatchFunction(action); 2994} 2995function isFSA(action) { 2996 return isAction(action) && typeof action.type === "string" && Object.keys(action).every(isValidKey); 2997} 2998function isValidKey(key) { 2999 return ["type", "payload", "error", "meta"].indexOf(key) > -1; 3000} 3001function getType(actionCreator) { 3002 return "" + actionCreator; 3003} 3004// src/actionCreatorInvariantMiddleware.ts 3005function getMessage(type) { 3006 var splitType = type ? ("" + type).split("/") : []; 3007 var actionName = splitType[splitType.length - 1] || "actionCreator"; 3008 return "Detected an action creator with type \"" + (type || "unknown") + "\" being dispatched. \nMake sure you're calling the action creator before dispatching, i.e. `dispatch(" + actionName + "())` instead of `dispatch(" + actionName + ")`. This is necessary even if the action has no payload."; 3009} 3010function createActionCreatorInvariantMiddleware(options) { 3011 if (options === void 0) { options = {}; } 3012 if (false) {} 3013 var _c = options.isActionCreator, isActionCreator2 = _c === void 0 ? isActionCreator : _c; 3014 return function () { return function (next) { return function (action) { 3015 if (isActionCreator2(action)) { 3016 console.warn(getMessage(action.type)); 3017 } 3018 return next(action); 3019 }; }; }; 3020} 3021// src/utils.ts 3022 3023function getTimeMeasureUtils(maxDelay, fnName) { 3024 var elapsed = 0; 3025 return { 3026 measureTime: function (fn) { 3027 var started = Date.now(); 3028 try { 3029 return fn(); 3030 } 3031 finally { 3032 var finished = Date.now(); 3033 elapsed += finished - started; 3034 } 3035 }, 3036 warnIfExceeded: function () { 3037 if (elapsed > maxDelay) { 3038 console.warn(fnName + " took " + elapsed + "ms, which is more than the warning threshold of " + maxDelay + "ms. \nIf your state or actions are very large, you may want to disable the middleware as it might cause too much of a slowdown in development mode. See https://redux-toolkit.js.org/api/getDefaultMiddleware for instructions.\nIt is disabled in production builds, so you don't need to worry about that."); 3039 } 3040 } 3041 }; 3042} 3043var MiddlewareArray = /** @class */ (function (_super) { 3044 __extends(MiddlewareArray, _super); 3045 function MiddlewareArray() { 3046 var args = []; 3047 for (var _i = 0; _i < arguments.length; _i++) { 3048 args[_i] = arguments[_i]; 3049 } 3050 var _this = _super.apply(this, args) || this; 3051 Object.setPrototypeOf(_this, MiddlewareArray.prototype); 3052 return _this; 3053 } 3054 Object.defineProperty(MiddlewareArray, Symbol.species, { 3055 get: function () { 3056 return MiddlewareArray; 3057 }, 3058 enumerable: false, 3059 configurable: true 3060 }); 3061 MiddlewareArray.prototype.concat = function () { 3062 var arr = []; 3063 for (var _i = 0; _i < arguments.length; _i++) { 3064 arr[_i] = arguments[_i]; 3065 } 3066 return _super.prototype.concat.apply(this, arr); 3067 }; 3068 MiddlewareArray.prototype.prepend = function () { 3069 var arr = []; 3070 for (var _i = 0; _i < arguments.length; _i++) { 3071 arr[_i] = arguments[_i]; 3072 } 3073 if (arr.length === 1 && Array.isArray(arr[0])) { 3074 return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr[0].concat(this))))(); 3075 } 3076 return new (MiddlewareArray.bind.apply(MiddlewareArray, __spreadArray([void 0], arr.concat(this))))(); 3077 }; 3078 return MiddlewareArray; 3079}(Array)); 3080var EnhancerArray = /** @class */ (function (_super) { 3081 __extends(EnhancerArray, _super); 3082 function EnhancerArray() { 3083 var args = []; 3084 for (var _i = 0; _i < arguments.length; _i++) { 3085 args[_i] = arguments[_i]; 3086 } 3087 var _this = _super.apply(this, args) || this; 3088 Object.setPrototypeOf(_this, EnhancerArray.prototype); 3089 return _this; 3090 } 3091 Object.defineProperty(EnhancerArray, Symbol.species, { 3092 get: function () { 3093 return EnhancerArray; 3094 }, 3095 enumerable: false, 3096 configurable: true 3097 }); 3098 EnhancerArray.prototype.concat = function () { 3099 var arr = []; 3100 for (var _i = 0; _i < arguments.length; _i++) { 3101 arr[_i] = arguments[_i]; 3102 } 3103 return _super.prototype.concat.apply(this, arr); 3104 }; 3105 EnhancerArray.prototype.prepend = function () { 3106 var arr = []; 3107 for (var _i = 0; _i < arguments.length; _i++) { 3108 arr[_i] = arguments[_i]; 3109 } 3110 if (arr.length === 1 && Array.isArray(arr[0])) { 3111 return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr[0].concat(this))))(); 3112 } 3113 return new (EnhancerArray.bind.apply(EnhancerArray, __spreadArray([void 0], arr.concat(this))))(); 3114 }; 3115 return EnhancerArray; 3116}(Array)); 3117function freezeDraftable(val) { 3118 return (0,immer__WEBPACK_IMPORTED_MODULE_2__.isDraftable)(val) ? (0,immer__WEBPACK_IMPORTED_MODULE_2__["default"])(val, function () { 3119 }) : val; 3120} 3121// src/immutableStateInvariantMiddleware.ts 3122var isProduction = "development" === "production"; 3123var prefix = "Invariant failed"; 3124function invariant(condition, message) { 3125 if (condition) { 3126 return; 3127 } 3128 if (isProduction) { 3129 throw new Error(prefix); 3130 } 3131 throw new Error(prefix + ": " + (message || "")); 3132} 3133function stringify(obj, serializer, indent, decycler) { 3134 return JSON.stringify(obj, getSerialize(serializer, decycler), indent); 3135} 3136function getSerialize(serializer, decycler) { 3137 var stack = [], keys = []; 3138 if (!decycler) 3139 decycler = function (_, value) { 3140 if (stack[0] === value) 3141 return "[Circular ~]"; 3142 return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"; 3143 }; 3144 return function (key, value) { 3145 if (stack.length > 0) { 3146 var thisPos = stack.indexOf(this); 3147 ~thisPos ? stack.splice(thisPos + 1) : stack.push(this); 3148 ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key); 3149 if (~stack.indexOf(value)) 3150 value = decycler.call(this, key, value); 3151 } 3152 else 3153 stack.push(value); 3154 return serializer == null ? value : serializer.call(this, key, value); 3155 }; 3156} 3157function isImmutableDefault(value) { 3158 return typeof value !== "object" || value == null || Object.isFrozen(value); 3159} 3160function trackForMutations(isImmutable, ignorePaths, obj) { 3161 var trackedProperties = trackProperties(isImmutable, ignorePaths, obj); 3162 return { 3163 detectMutations: function () { 3164 return detectMutations(isImmutable, ignorePaths, trackedProperties, obj); 3165 } 3166 }; 3167} 3168function trackProperties(isImmutable, ignorePaths, obj, path, checkedObjects) { 3169 if (ignorePaths === void 0) { ignorePaths = []; } 3170 if (path === void 0) { path = ""; } 3171 if (checkedObjects === void 0) { checkedObjects = new Set(); } 3172 var tracked = { value: obj }; 3173 if (!isImmutable(obj) && !checkedObjects.has(obj)) { 3174 checkedObjects.add(obj); 3175 tracked.children = {}; 3176 for (var key in obj) { 3177 var childPath = path ? path + "." + key : key; 3178 if (ignorePaths.length && ignorePaths.indexOf(childPath) !== -1) { 3179 continue; 3180 } 3181 tracked.children[key] = trackProperties(isImmutable, ignorePaths, obj[key], childPath); 3182 } 3183 } 3184 return tracked; 3185} 3186function detectMutations(isImmutable, ignoredPaths, trackedProperty, obj, sameParentRef, path) { 3187 if (ignoredPaths === void 0) { ignoredPaths = []; } 3188 if (sameParentRef === void 0) { sameParentRef = false; } 3189 if (path === void 0) { path = ""; } 3190 var prevObj = trackedProperty ? trackedProperty.value : void 0; 3191 var sameRef = prevObj === obj; 3192 if (sameParentRef && !sameRef && !Number.isNaN(obj)) { 3193 return { wasMutated: true, path: path }; 3194 } 3195 if (isImmutable(prevObj) || isImmutable(obj)) { 3196 return { wasMutated: false }; 3197 } 3198 var keysToDetect = {}; 3199 for (var key in trackedProperty.children) { 3200 keysToDetect[key] = true; 3201 } 3202 for (var key in obj) { 3203 keysToDetect[key] = true; 3204 } 3205 var hasIgnoredPaths = ignoredPaths.length > 0; 3206 var _loop_1 = function (key) { 3207 var nestedPath = path ? path + "." + key : key; 3208 if (hasIgnoredPaths) { 3209 var hasMatches = ignoredPaths.some(function (ignored) { 3210 if (ignored instanceof RegExp) { 3211 return ignored.test(nestedPath); 3212 } 3213 return nestedPath === ignored; 3214 }); 3215 if (hasMatches) { 3216 return "continue"; 3217 } 3218 } 3219 var result = detectMutations(isImmutable, ignoredPaths, trackedProperty.children[key], obj[key], sameRef, nestedPath); 3220 if (result.wasMutated) { 3221 return { value: result }; 3222 } 3223 }; 3224 for (var key in keysToDetect) { 3225 var state_1 = _loop_1(key); 3226 if (typeof state_1 === "object") 3227 return state_1.value; 3228 } 3229 return { wasMutated: false }; 3230} 3231function createImmutableStateInvariantMiddleware(options) { 3232 if (options === void 0) { options = {}; } 3233 if (false) {} 3234 var _c = options.isImmutable, isImmutable = _c === void 0 ? isImmutableDefault : _c, ignoredPaths = options.ignoredPaths, _d = options.warnAfter, warnAfter = _d === void 0 ? 32 : _d, ignore = options.ignore; 3235 ignoredPaths = ignoredPaths || ignore; 3236 var track = trackForMutations.bind(null, isImmutable, ignoredPaths); 3237 return function (_c) { 3238 var getState = _c.getState; 3239 var state = getState(); 3240 var tracker = track(state); 3241 var result; 3242 return function (next) { return function (action) { 3243 var measureUtils = getTimeMeasureUtils(warnAfter, "ImmutableStateInvariantMiddleware"); 3244 measureUtils.measureTime(function () { 3245 state = getState(); 3246 result = tracker.detectMutations(); 3247 tracker = track(state); 3248 invariant(!result.wasMutated, "A state mutation was detected between dispatches, in the path '" + (result.path || "") + "'. This may cause incorrect behavior. (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)"); 3249 }); 3250 var dispatchedAction = next(action); 3251 measureUtils.measureTime(function () { 3252 state = getState(); 3253 result = tracker.detectMutations(); 3254 tracker = track(state); 3255 result.wasMutated && invariant(!result.wasMutated, "A state mutation was detected inside a dispatch, in the path: " + (result.path || "") + ". Take a look at the reducer(s) handling the action " + stringify(action) + ". (https://redux.js.org/style-guide/style-guide#do-not-mutate-state)"); 3256 }); 3257 measureUtils.warnIfExceeded(); 3258 return dispatchedAction; 3259 }; }; 3260 }; 3261} 3262// src/serializableStateInvariantMiddleware.ts 3263function isPlain(val) { 3264 var type = typeof val; 3265 return val == null || type === "string" || type === "boolean" || type === "number" || Array.isArray(val) || isPlainObject(val); 3266} 3267function findNonSerializableValue(value, path, isSerializable, getEntries, ignoredPaths, cache) { 3268 if (path === void 0) { path = ""; } 3269 if (isSerializable === void 0) { isSerializable = isPlain; } 3270 if (ignoredPaths === void 0) { ignoredPaths = []; } 3271 var foundNestedSerializable; 3272 if (!isSerializable(value)) { 3273 return { 3274 keyPath: path || "<root>", 3275 value: value 3276 }; 3277 } 3278 if (typeof value !== "object" || value === null) { 3279 return false; 3280 } 3281 if (cache == null ? void 0 : cache.has(value)) 3282 return false; 3283 var entries = getEntries != null ? getEntries(value) : Object.entries(value); 3284 var hasIgnoredPaths = ignoredPaths.length > 0; 3285 var _loop_2 = function (key, nestedValue) { 3286 var nestedPath = path ? path + "." + key : key; 3287 if (hasIgnoredPaths) { 3288 var hasMatches = ignoredPaths.some(function (ignored) { 3289 if (ignored instanceof RegExp) { 3290 return ignored.test(nestedPath); 3291 } 3292 return nestedPath === ignored; 3293 }); 3294 if (hasMatches) { 3295 return "continue"; 3296 } 3297 } 3298 if (!isSerializable(nestedValue)) { 3299 return { value: { 3300 keyPath: nestedPath, 3301 value: nestedValue 3302 } }; 3303 } 3304 if (typeof nestedValue === "object") { 3305 foundNestedSerializable = findNonSerializableValue(nestedValue, nestedPath, isSerializable, getEntries, ignoredPaths, cache); 3306 if (foundNestedSerializable) { 3307 return { value: foundNestedSerializable }; 3308 } 3309 } 3310 }; 3311 for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) { 3312 var _c = entries_1[_i], key = _c[0], nestedValue = _c[1]; 3313 var state_2 = _loop_2(key, nestedValue); 3314 if (typeof state_2 === "object") 3315 return state_2.value; 3316 } 3317 if (cache && isNestedFrozen(value)) 3318 cache.add(value); 3319 return false; 3320} 3321function isNestedFrozen(value) { 3322 if (!Object.isFrozen(value)) 3323 return false; 3324 for (var _i = 0, _c = Object.values(value); _i < _c.length; _i++) { 3325 var nestedValue = _c[_i]; 3326 if (typeof nestedValue !== "object" || nestedValue === null) 3327 continue; 3328 if (!isNestedFrozen(nestedValue)) 3329 return false; 3330 } 3331 return true; 3332} 3333function createSerializableStateInvariantMiddleware(options) { 3334 if (options === void 0) { options = {}; } 3335 if (false) {} 3336 var _c = options.isSerializable, isSerializable = _c === void 0 ? isPlain : _c, getEntries = options.getEntries, _d = options.ignoredActions, ignoredActions = _d === void 0 ? [] : _d, _e = options.ignoredActionPaths, ignoredActionPaths = _e === void 0 ? ["meta.arg", "meta.baseQueryMeta"] : _e, _f = options.ignoredPaths, ignoredPaths = _f === void 0 ? [] : _f, _g = options.warnAfter, warnAfter = _g === void 0 ? 32 : _g, _h = options.ignoreState, ignoreState = _h === void 0 ? false : _h, _j = options.ignoreActions, ignoreActions = _j === void 0 ? false : _j, _k = options.disableCache, disableCache = _k === void 0 ? false : _k; 3337 var cache = !disableCache && WeakSet ? new WeakSet() : void 0; 3338 return function (storeAPI) { return function (next) { return function (action) { 3339 var result = next(action); 3340 var measureUtils = getTimeMeasureUtils(warnAfter, "SerializableStateInvariantMiddleware"); 3341 if (!ignoreActions && !(ignoredActions.length && ignoredActions.indexOf(action.type) !== -1)) { 3342 measureUtils.measureTime(function () { 3343 var foundActionNonSerializableValue = findNonSerializableValue(action, "", isSerializable, getEntries, ignoredActionPaths, cache); 3344 if (foundActionNonSerializableValue) { 3345 var keyPath = foundActionNonSerializableValue.keyPath, value = foundActionNonSerializableValue.value; 3346 console.error("A non-serializable value was detected in an action, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the logic that dispatched this action: ", action, "\n(See https://redux.js.org/faq/actions#why-should-type-be-a-string-or-at-least-serializable-why-should-my-action-types-be-constants)", "\n(To allow non-serializable values see: https://redux-toolkit.js.org/usage/usage-guide#working-with-non-serializable-data)"); 3347 } 3348 }); 3349 } 3350 if (!ignoreState) { 3351 measureUtils.measureTime(function () { 3352 var state = storeAPI.getState(); 3353 var foundStateNonSerializableValue = findNonSerializableValue(state, "", isSerializable, getEntries, ignoredPaths, cache); 3354 if (foundStateNonSerializableValue) { 3355 var keyPath = foundStateNonSerializableValue.keyPath, value = foundStateNonSerializableValue.value; 3356 console.error("A non-serializable value was detected in the state, in the path: `" + keyPath + "`. Value:", value, "\nTake a look at the reducer(s) handling this action type: " + action.type + ".\n(See https://redux.js.org/faq/organizing-state#can-i-put-functions-promises-or-other-non-serializable-items-in-my-store-state)"); 3357 } 3358 }); 3359 measureUtils.warnIfExceeded(); 3360 } 3361 return result; 3362 }; }; }; 3363} 3364// src/getDefaultMiddleware.ts 3365function isBoolean(x) { 3366 return typeof x === "boolean"; 3367} 3368function curryGetDefaultMiddleware() { 3369 return function curriedGetDefaultMiddleware(options) { 3370 return getDefaultMiddleware(options); 3371 }; 3372} 3373function getDefaultMiddleware(options) { 3374 if (options === void 0) { options = {}; } 3375 var _c = options.thunk, thunk = _c === void 0 ? true : _c, _d = options.immutableCheck, immutableCheck = _d === void 0 ? true : _d, _e = options.serializableCheck, serializableCheck = _e === void 0 ? true : _e, _f = options.actionCreatorCheck, actionCreatorCheck = _f === void 0 ? true : _f; 3376 var middlewareArray = new MiddlewareArray(); 3377 if (thunk) { 3378 if (isBoolean(thunk)) { 3379 middlewareArray.push(redux_thunk__WEBPACK_IMPORTED_MODULE_3__["default"]); 3380 } 3381 else { 3382 middlewareArray.push(redux_thunk__WEBPACK_IMPORTED_MODULE_3__["default"].withExtraArgument(thunk.extraArgument)); 3383 } 3384 } 3385 if (true) { 3386 if (immutableCheck) { 3387 var immutableOptions = {}; 3388 if (!isBoolean(immutableCheck)) { 3389 immutableOptions = immutableCheck; 3390 } 3391 middlewareArray.unshift(createImmutableStateInvariantMiddleware(immutableOptions)); 3392 } 3393 if (serializableCheck) { 3394 var serializableOptions = {}; 3395 if (!isBoolean(serializableCheck)) { 3396 serializableOptions = serializableCheck; 3397 } 3398 middlewareArray.push(createSerializableStateInvariantMiddleware(serializableOptions)); 3399 } 3400 if (actionCreatorCheck) { 3401 var actionCreatorOptions = {}; 3402 if (!isBoolean(actionCreatorCheck)) { 3403 actionCreatorOptions = actionCreatorCheck; 3404 } 3405 middlewareArray.unshift(createActionCreatorInvariantMiddleware(actionCreatorOptions)); 3406 } 3407 } 3408 return middlewareArray; 3409} 3410// src/configureStore.ts 3411var IS_PRODUCTION = "development" === "production"; 3412function configureStore(options) { 3413 var curriedGetDefaultMiddleware = curryGetDefaultMiddleware(); 3414 var _c = options || {}, _d = _c.reducer, reducer = _d === void 0 ? void 0 : _d, _e = _c.middleware, middleware = _e === void 0 ? curriedGetDefaultMiddleware() : _e, _f = _c.devTools, devTools = _f === void 0 ? true : _f, _g = _c.preloadedState, preloadedState = _g === void 0 ? void 0 : _g, _h = _c.enhancers, enhancers = _h === void 0 ? void 0 : _h; 3415 var rootReducer; 3416 if (typeof reducer === "function") { 3417 rootReducer = reducer; 3418 } 3419 else if (isPlainObject(reducer)) { 3420 rootReducer = (0,redux__WEBPACK_IMPORTED_MODULE_0__.combineReducers)(reducer); 3421 } 3422 else { 3423 throw new Error('"reducer" is a required argument, and must be a function or an object of functions that can be passed to combineReducers'); 3424 } 3425 var finalMiddleware = middleware; 3426 if (typeof finalMiddleware === "function") { 3427 finalMiddleware = finalMiddleware(curriedGetDefaultMiddleware); 3428 if (!IS_PRODUCTION && !Array.isArray(finalMiddleware)) { 3429 throw new Error("when using a middleware builder function, an array of middleware must be returned"); 3430 } 3431 } 3432 if (!IS_PRODUCTION && finalMiddleware.some(function (item) { return typeof item !== "function"; })) { 3433 throw new Error("each middleware provided to configureStore must be a function"); 3434 } 3435 var middlewareEnhancer = redux__WEBPACK_IMPORTED_MODULE_0__.applyMiddleware.apply(void 0, finalMiddleware); 3436 var finalCompose = redux__WEBPACK_IMPORTED_MODULE_0__.compose; 3437 if (devTools) { 3438 finalCompose = composeWithDevTools(__spreadValues({ 3439 trace: !IS_PRODUCTION 3440 }, typeof devTools === "object" && devTools)); 3441 } 3442 var defaultEnhancers = new EnhancerArray(middlewareEnhancer); 3443 var storeEnhancers = defaultEnhancers; 3444 if (Array.isArray(enhancers)) { 3445 storeEnhancers = __spreadArray([middlewareEnhancer], enhancers); 3446 } 3447 else if (typeof enhancers === "function") { 3448 storeEnhancers = enhancers(defaultEnhancers); 3449 } 3450 var composedEnhancer = finalCompose.apply(void 0, storeEnhancers); 3451 return (0,redux__WEBPACK_IMPORTED_MODULE_0__.createStore)(rootReducer, preloadedState, composedEnhancer); 3452} 3453// src/createReducer.ts 3454 3455// src/mapBuilders.ts 3456function executeReducerBuilderCallback(builderCallback) { 3457 var actionsMap = {}; 3458 var actionMatchers = []; 3459 var defaultCaseReducer; 3460 var builder = { 3461 addCase: function (typeOrActionCreator, reducer) { 3462 if (true) { 3463 if (actionMatchers.length > 0) { 3464 throw new Error("`builder.addCase` should only be called before calling `builder.addMatcher`"); 3465 } 3466 if (defaultCaseReducer) { 3467 throw new Error("`builder.addCase` should only be called before calling `builder.addDefaultCase`"); 3468 } 3469 } 3470 var type = typeof typeOrActionCreator === "string" ? typeOrActionCreator : typeOrActionCreator.type; 3471 if (!type) { 3472 throw new Error("`builder.addCase` cannot be called with an empty action type"); 3473 } 3474 if (type in actionsMap) { 3475 throw new Error("`builder.addCase` cannot be called with two reducers for the same action type"); 3476 } 3477 actionsMap[type] = reducer; 3478 return builder; 3479 }, 3480 addMatcher: function (matcher, reducer) { 3481 if (true) { 3482 if (defaultCaseReducer) { 3483 throw new Error("`builder.addMatcher` should only be called before calling `builder.addDefaultCase`"); 3484 } 3485 } 3486 actionMatchers.push({ matcher: matcher, reducer: reducer }); 3487 return builder; 3488 }, 3489 addDefaultCase: function (reducer) { 3490 if (true) { 3491 if (defaultCaseReducer) { 3492 throw new Error("`builder.addDefaultCase` can only be called once"); 3493 } 3494 } 3495 defaultCaseReducer = reducer; 3496 return builder; 3497 } 3498 }; 3499 builderCallback(builder); 3500 return [actionsMap, actionMatchers, defaultCaseReducer]; 3501} 3502// src/createReducer.ts 3503function isStateFunction(x) { 3504 return typeof x === "function"; 3505} 3506var hasWarnedAboutObjectNotation = false; 3507function createReducer(initialState, mapOrBuilderCallback, actionMatchers, defaultCaseReducer) { 3508 if (actionMatchers === void 0) { actionMatchers = []; } 3509 if (true) { 3510 if (typeof mapOrBuilderCallback === "object") { 3511 if (!hasWarnedAboutObjectNotation) { 3512 hasWarnedAboutObjectNotation = true; 3513 console.warn("The object notation for `createReducer` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createReducer"); 3514 } 3515 } 3516 } 3517 var _c = typeof mapOrBuilderCallback === "function" ? executeReducerBuilderCallback(mapOrBuilderCallback) : [mapOrBuilderCallback, actionMatchers, defaultCaseReducer], actionsMap = _c[0], finalActionMatchers = _c[1], finalDefaultCaseReducer = _c[2]; 3518 var getInitialState; 3519 if (isStateFunction(initialState)) { 3520 getInitialState = function () { return freezeDraftable(initialState()); }; 3521 } 3522 else { 3523 var frozenInitialState_1 = freezeDraftable(initialState); 3524 getInitialState = function () { return frozenInitialState_1; }; 3525 } 3526 function reducer(state, action) { 3527 if (state === void 0) { state = getInitialState(); } 3528 var caseReducers = __spreadArray([ 3529 actionsMap[action.type] 3530 ], finalActionMatchers.filter(function (_c) { 3531 var matcher = _c.matcher; 3532 return matcher(action); 3533 }).map(function (_c) { 3534 var reducer2 = _c.reducer; 3535 return reducer2; 3536 })); 3537 if (caseReducers.filter(function (cr) { return !!cr; }).length === 0) { 3538 caseReducers = [finalDefaultCaseReducer]; 3539 } 3540 return caseReducers.reduce(function (previousState, caseReducer) { 3541 if (caseReducer) { 3542 if ((0,immer__WEBPACK_IMPORTED_MODULE_2__.isDraft)(previousState)) { 3543 var draft = previousState; 3544 var result = caseReducer(draft, action); 3545 if (result === void 0) { 3546 return previousState; 3547 } 3548 return result; 3549 } 3550 else if (!(0,immer__WEBPACK_IMPORTED_MODULE_2__.isDraftable)(previousState)) { 3551 var result = caseReducer(previousState, action); 3552 if (result === void 0) { 3553 if (previousState === null) { 3554 return previousState; 3555 } 3556 throw Error("A case reducer on a non-draftable value must not return undefined"); 3557 } 3558 return result; 3559 } 3560 else { 3561 return (0,immer__WEBPACK_IMPORTED_MODULE_2__["default"])(previousState, function (draft) { 3562 return caseReducer(draft, action); 3563 }); 3564 } 3565 } 3566 return previousState; 3567 }, state); 3568 } 3569 reducer.getInitialState = getInitialState; 3570 return reducer; 3571} 3572// src/createSlice.ts 3573var hasWarnedAboutObjectNotation2 = false; 3574function getType2(slice, actionKey) { 3575 return slice + "/" + actionKey; 3576} 3577function createSlice(options) { 3578 var name = options.name; 3579 if (!name) { 3580 throw new Error("`name` is a required option for createSlice"); 3581 } 3582 if (typeof process !== "undefined" && "development" === "development") { 3583 if (options.initialState === void 0) { 3584 console.error("You must provide an `initialState` value that is not `undefined`. You may have misspelled `initialState`"); 3585 } 3586 } 3587 var initialState = typeof options.initialState == "function" ? options.initialState : freezeDraftable(options.initialState); 3588 var reducers = options.reducers || {}; 3589 var reducerNames = Object.keys(reducers); 3590 var sliceCaseReducersByName = {}; 3591 var sliceCaseReducersByType = {}; 3592 var actionCreators = {}; 3593 reducerNames.forEach(function (reducerName) { 3594 var maybeReducerWithPrepare = reducers[reducerName]; 3595 var type = getType2(name, reducerName); 3596 var caseReducer; 3597 var prepareCallback; 3598 if ("reducer" in maybeReducerWithPrepare) { 3599 caseReducer = maybeReducerWithPrepare.reducer; 3600 prepareCallback = maybeReducerWithPrepare.prepare; 3601 } 3602 else { 3603 caseReducer = maybeReducerWithPrepare; 3604 } 3605 sliceCaseReducersByName[reducerName] = caseReducer; 3606 sliceCaseReducersByType[type] = caseReducer; 3607 actionCreators[reducerName] = prepareCallback ? createAction(type, prepareCallback) : createAction(type); 3608 }); 3609 function buildReducer() { 3610 if (true) { 3611 if (typeof options.extraReducers === "object") { 3612 if (!hasWarnedAboutObjectNotation2) { 3613 hasWarnedAboutObjectNotation2 = true; 3614 console.warn("The object notation for `createSlice.extraReducers` is deprecated, and will be removed in RTK 2.0. Please use the 'builder callback' notation instead: https://redux-toolkit.js.org/api/createSlice"); 3615 } 3616 } 3617 } 3618 var _c = typeof options.extraReducers === "function" ? executeReducerBuilderCallback(options.extraReducers) : [options.extraReducers], _d = _c[0], extraReducers = _d === void 0 ? {} : _d, _e = _c[1], actionMatchers = _e === void 0 ? [] : _e, _f = _c[2], defaultCaseReducer = _f === void 0 ? void 0 : _f; 3619 var finalCaseReducers = __spreadValues(__spreadValues({}, extraReducers), sliceCaseReducersByType); 3620 return createReducer(initialState, function (builder) { 3621 for (var key in finalCaseReducers) { 3622 builder.addCase(key, finalCaseReducers[key]); 3623 } 3624 for (var _i = 0, actionMatchers_1 = actionMatchers; _i < actionMatchers_1.length; _i++) { 3625 var m = actionMatchers_1[_i]; 3626 builder.addMatcher(m.matcher, m.reducer); 3627 } 3628 if (defaultCaseReducer) { 3629 builder.addDefaultCase(defaultCaseReducer); 3630 } 3631 }); 3632 } 3633 var _reducer; 3634 return { 3635 name: name, 3636 reducer: function (state, action) { 3637 if (!_reducer) 3638 _reducer = buildReducer(); 3639 return _reducer(state, action); 3640 }, 3641 actions: actionCreators, 3642 caseReducers: sliceCaseReducersByName, 3643 getInitialState: function () { 3644 if (!_reducer) 3645 _reducer = buildReducer(); 3646 return _reducer.getInitialState(); 3647 } 3648 }; 3649} 3650// src/entities/entity_state.ts 3651function getInitialEntityState() { 3652 return { 3653 ids: [], 3654 entities: {} 3655 }; 3656} 3657function createInitialStateFactory() { 3658 function getInitialState(additionalState) { 3659 if (additionalState === void 0) { additionalState = {}; } 3660 return Object.assign(getInitialEntityState(), additionalState); 3661 } 3662 return { getInitialState: getInitialState }; 3663} 3664// src/entities/state_selectors.ts 3665function createSelectorsFactory() { 3666 function getSelectors(selectState) { 3667 var selectIds = function (state) { return state.ids; }; 3668 var selectEntities = function (state) { return state.entities; }; 3669 var selectAll = createDraftSafeSelector(selectIds, selectEntities, function (ids, entities) { return ids.map(function (id) { return entities[id]; }); }); 3670 var selectId = function (_, id) { return id; }; 3671 var selectById = function (entities, id) { return entities[id]; }; 3672 var selectTotal = createDraftSafeSelector(selectIds, function (ids) { return ids.length; }); 3673 if (!selectState) { 3674 return { 3675 selectIds: selectIds, 3676 selectEntities: selectEntities, 3677 selectAll: selectAll, 3678 selectTotal: selectTotal, 3679 selectById: createDraftSafeSelector(selectEntities, selectId, selectById) 3680 }; 3681 } 3682 var selectGlobalizedEntities = createDraftSafeSelector(selectState, selectEntities); 3683 return { 3684 selectIds: createDraftSafeSelector(selectState, selectIds), 3685 selectEntities: selectGlobalizedEntities, 3686 selectAll: createDraftSafeSelector(selectState, selectAll), 3687 selectTotal: createDraftSafeSelector(selectState, selectTotal), 3688 selectById: createDraftSafeSelector(selectGlobalizedEntities, selectId, selectById) 3689 }; 3690 } 3691 return { getSelectors: getSelectors }; 3692} 3693// src/entities/state_adapter.ts 3694 3695function createSingleArgumentStateOperator(mutator) { 3696 var operator = createStateOperator(function (_, state) { return mutator(state); }); 3697 return function operation(state) { 3698 return operator(state, void 0); 3699 }; 3700} 3701function createStateOperator(mutator) { 3702 return function operation(state, arg) { 3703 function isPayloadActionArgument(arg2) { 3704 return isFSA(arg2); 3705 } 3706 var runMutator = function (draft) { 3707 if (isPayloadActionArgument(arg)) { 3708 mutator(arg.payload, draft); 3709 } 3710 else { 3711 mutator(arg, draft); 3712 } 3713 }; 3714 if ((0,immer__WEBPACK_IMPORTED_MODULE_2__.isDraft)(state)) { 3715 runMutator(state); 3716 return state; 3717 } 3718 else { 3719 return (0,immer__WEBPACK_IMPORTED_MODULE_2__["default"])(state, runMutator); 3720 } 3721 }; 3722} 3723// src/entities/utils.ts 3724function selectIdValue(entity, selectId) { 3725 var key = selectId(entity); 3726 if ( true && key === void 0) { 3727 console.warn("The entity passed to the `selectId` implementation returned undefined.", "You should probably provide your own `selectId` implementation.", "The entity that was passed:", entity, "The `selectId` implementation:", selectId.toString()); 3728 } 3729 return key; 3730} 3731function ensureEntitiesArray(entities) { 3732 if (!Array.isArray(entities)) { 3733 entities = Object.values(entities); 3734 } 3735 return entities; 3736} 3737function splitAddedUpdatedEntities(newEntities, selectId, state) { 3738 newEntities = ensureEntitiesArray(newEntities); 3739 var added = []; 3740 var updated = []; 3741 for (var _i = 0, newEntities_1 = newEntities; _i < newEntities_1.length; _i++) { 3742 var entity = newEntities_1[_i]; 3743 var id = selectIdValue(entity, selectId); 3744 if (id in state.entities) { 3745 updated.push({ id: id, changes: entity }); 3746 } 3747 else { 3748 added.push(entity); 3749 } 3750 } 3751 return [added, updated]; 3752} 3753// src/entities/unsorted_state_adapter.ts 3754function createUnsortedStateAdapter(selectId) { 3755 function addOneMutably(entity, state) { 3756 var key = selectIdValue(entity, selectId); 3757 if (key in state.entities) { 3758 return; 3759 } 3760 state.ids.push(key); 3761 state.entities[key] = entity; 3762 } 3763 function addManyMutably(newEntities, state) { 3764 newEntities = ensureEntitiesArray(newEntities); 3765 for (var _i = 0, newEntities_2 = newEntities; _i < newEntities_2.length; _i++) { 3766 var entity = newEntities_2[_i]; 3767 addOneMutably(entity, state); 3768 } 3769 } 3770 function setOneMutably(entity, state) { 3771 var key = selectIdValue(entity, selectId); 3772 if (!(key in state.entities)) { 3773 state.ids.push(key); 3774 } 3775 state.entities[key] = entity; 3776 } 3777 function setManyMutably(newEntities, state) { 3778 newEntities = ensureEntitiesArray(newEntities); 3779 for (var _i = 0, newEntities_3 = newEntities; _i < newEntities_3.length; _i++) { 3780 var entity = newEntities_3[_i]; 3781 setOneMutably(entity, state); 3782 } 3783 } 3784 function setAllMutably(newEntities, state) { 3785 newEntities = ensureEntitiesArray(newEntities); 3786 state.ids = []; 3787 state.entities = {}; 3788 addManyMutably(newEntities, state); 3789 } 3790 function removeOneMutably(key, state) { 3791 return removeManyMutably([key], state); 3792 } 3793 function removeManyMutably(keys, state) { 3794 var didMutate = false; 3795 keys.forEach(function (key) { 3796 if (key in state.entities) { 3797 delete state.entities[key]; 3798 didMutate = true; 3799 } 3800 }); 3801 if (didMutate) { 3802 state.ids = state.ids.filter(function (id) { return id in state.entities; }); 3803 } 3804 } 3805 function removeAllMutably(state) { 3806 Object.assign(state, { 3807 ids: [], 3808 entities: {} 3809 }); 3810 } 3811 function takeNewKey(keys, update, state) { 3812 var original2 = state.entities[update.id]; 3813 var updated = Object.assign({}, original2, update.changes); 3814 var newKey = selectIdValue(updated, selectId); 3815 var hasNewKey = newKey !== update.id; 3816 if (hasNewKey) { 3817 keys[update.id] = newKey; 3818 delete state.entities[update.id]; 3819 } 3820 state.entities[newKey] = updated; 3821 return hasNewKey; 3822 } 3823 function updateOneMutably(update, state) { 3824 return updateManyMutably([update], state); 3825 } 3826 function updateManyMutably(updates, state) { 3827 var newKeys = {}; 3828 var updatesPerEntity = {}; 3829 updates.forEach(function (update) { 3830 if (update.id in state.entities) { 3831 updatesPerEntity[update.id] = { 3832 id: update.id, 3833 changes: __spreadValues(__spreadValues({}, updatesPerEntity[update.id] ? updatesPerEntity[update.id].changes : null), update.changes) 3834 }; 3835 } 3836 }); 3837 updates = Object.values(updatesPerEntity); 3838 var didMutateEntities = updates.length > 0; 3839 if (didMutateEntities) { 3840 var didMutateIds = updates.filter(function (update) { return takeNewKey(newKeys, update, state); }).length > 0; 3841 if (didMutateIds) { 3842 state.ids = Object.keys(state.entities); 3843 } 3844 } 3845 } 3846 function upsertOneMutably(entity, state) { 3847 return upsertManyMutably([entity], state); 3848 } 3849 function upsertManyMutably(newEntities, state) { 3850 var _c = splitAddedUpdatedEntities(newEntities, selectId, state), added = _c[0], updated = _c[1]; 3851 updateManyMutably(updated, state); 3852 addManyMutably(added, state); 3853 } 3854 return { 3855 removeAll: createSingleArgumentStateOperator(removeAllMutably), 3856 addOne: createStateOperator(addOneMutably), 3857 addMany: createStateOperator(addManyMutably), 3858 setOne: createStateOperator(setOneMutably), 3859 setMany: createStateOperator(setManyMutably), 3860 setAll: createStateOperator(setAllMutably), 3861 updateOne: createStateOperator(updateOneMutably), 3862 updateMany: createStateOperator(updateManyMutably), 3863 upsertOne: createStateOperator(upsertOneMutably), 3864 upsertMany: createStateOperator(upsertManyMutably), 3865 removeOne: createStateOperator(removeOneMutably), 3866 removeMany: createStateOperator(removeManyMutably) 3867 }; 3868} 3869// src/entities/sorted_state_adapter.ts 3870function createSortedStateAdapter(selectId, sort) { 3871 var _c = createUnsortedStateAdapter(selectId), removeOne = _c.removeOne, removeMany = _c.removeMany, removeAll = _c.removeAll; 3872 function addOneMutably(entity, state) { 3873 return addManyMutably([entity], state); 3874 } 3875 function addManyMutably(newEntities, state) { 3876 newEntities = ensureEntitiesArray(newEntities); 3877 var models = newEntities.filter(function (model) { return !(selectIdValue(model, selectId) in state.entities); }); 3878 if (models.length !== 0) { 3879 merge(models, state); 3880 } 3881 } 3882 function setOneMutably(entity, state) { 3883 return setManyMutably([entity], state); 3884 } 3885 function setManyMutably(newEntities, state) { 3886 newEntities = ensureEntitiesArray(newEntities); 3887 if (newEntities.length !== 0) { 3888 merge(newEntities, state); 3889 } 3890 } 3891 function setAllMutably(newEntities, state) { 3892 newEntities = ensureEntitiesArray(newEntities); 3893 state.entities = {}; 3894 state.ids = []; 3895 addManyMutably(newEntities, state); 3896 } 3897 function updateOneMutably(update, state) { 3898 return updateManyMutably([update], state); 3899 } 3900 function updateManyMutably(updates, state) { 3901 var appliedUpdates = false; 3902 for (var _i = 0, updates_1 = updates; _i < updates_1.length; _i++) { 3903 var update = updates_1[_i]; 3904 var entity = state.entities[update.id]; 3905 if (!entity) { 3906 continue; 3907 } 3908 appliedUpdates = true; 3909 Object.assign(entity, update.changes); 3910 var newId = selectId(entity); 3911 if (update.id !== newId) { 3912 delete state.entities[update.id]; 3913 state.entities[newId] = entity; 3914 } 3915 } 3916 if (appliedUpdates) { 3917 resortEntities(state); 3918 } 3919 } 3920 function upsertOneMutably(entity, state) { 3921 return upsertManyMutably([entity], state); 3922 } 3923 function upsertManyMutably(newEntities, state) { 3924 var _c = splitAddedUpdatedEntities(newEntities, selectId, state), added = _c[0], updated = _c[1]; 3925 updateManyMutably(updated, state); 3926 addManyMutably(added, state); 3927 } 3928 function areArraysEqual(a, b) { 3929 if (a.length !== b.length) { 3930 return false; 3931 } 3932 for (var i = 0; i < a.length && i < b.length; i++) { 3933 if (a[i] === b[i]) { 3934 continue; 3935 } 3936 return false; 3937 } 3938 return true; 3939 } 3940 function merge(models, state) { 3941 models.forEach(function (model) { 3942 state.entities[selectId(model)] = model; 3943 }); 3944 resortEntities(state); 3945 } 3946 function resortEntities(state) { 3947 var allEntities = Object.values(state.entities); 3948 allEntities.sort(sort); 3949 var newSortedIds = allEntities.map(selectId); 3950 var ids = state.ids; 3951 if (!areArraysEqual(ids, newSortedIds)) { 3952 state.ids = newSortedIds; 3953 } 3954 } 3955 return { 3956 removeOne: removeOne, 3957 removeMany: removeMany, 3958 removeAll: removeAll, 3959 addOne: createStateOperator(addOneMutably), 3960 updateOne: createStateOperator(updateOneMutably), 3961 upsertOne: createStateOperator(upsertOneMutably), 3962 setOne: createStateOperator(setOneMutably), 3963 setMany: createStateOperator(setManyMutably), 3964 setAll: createStateOperator(setAllMutably), 3965 addMany: createStateOperator(addManyMutably), 3966 updateMany: createStateOperator(updateManyMutably), 3967 upsertMany: createStateOperator(upsertManyMutably) 3968 }; 3969} 3970// src/entities/create_adapter.ts 3971function createEntityAdapter(options) { 3972 if (options === void 0) { options = {}; } 3973 var _c = __spreadValues({ 3974 sortComparer: false, 3975 selectId: function (instance) { return instance.id; } 3976 }, options), selectId = _c.selectId, sortComparer = _c.sortComparer; 3977 var stateFactory = createInitialStateFactory(); 3978 var selectorsFactory = createSelectorsFactory(); 3979 var stateAdapter = sortComparer ? createSortedStateAdapter(selectId, sortComparer) : createUnsortedStateAdapter(selectId); 3980 return __spreadValues(__spreadValues(__spreadValues({ 3981 selectId: selectId, 3982 sortComparer: sortComparer 3983 }, stateFactory), selectorsFactory), stateAdapter); 3984} 3985// src/nanoid.ts 3986var urlAlphabet = "ModuleSymbhasOwnPr-0123456789ABCDEFGHNRVfgctiUvz_KqYTJkLxpZXIjQW"; 3987var nanoid = function (size) { 3988 if (size === void 0) { size = 21; } 3989 var id = ""; 3990 var i = size; 3991 while (i--) { 3992 id += urlAlphabet[Math.random() * 64 | 0]; 3993 } 3994 return id; 3995}; 3996// src/createAsyncThunk.ts 3997var commonProperties = [ 3998 "name", 3999 "message", 4000 "stack", 4001 "code" 4002]; 4003var RejectWithValue = /** @class */ (function () { 4004 function RejectWithValue(payload, meta) { 4005 this.payload = payload; 4006 this.meta = meta; 4007 } 4008 return RejectWithValue; 4009}()); 4010var FulfillWithMeta = /** @class */ (function () { 4011 function FulfillWithMeta(payload, meta) { 4012 this.payload = payload; 4013 this.meta = meta; 4014 } 4015 return FulfillWithMeta; 4016}()); 4017var miniSerializeError = function (value) { 4018 if (typeof value === "object" && value !== null) { 4019 var simpleError = {}; 4020 for (var _i = 0, commonProperties_1 = commonProperties; _i < commonProperties_1.length; _i++) { 4021 var property = commonProperties_1[_i]; 4022 if (typeof value[property] === "string") { 4023 simpleError[property] = value[property]; 4024 } 4025 } 4026 return simpleError; 4027 } 4028 return { message: String(value) }; 4029}; 4030var createAsyncThunk = (function () { 4031 function createAsyncThunk2(typePrefix, payloadCreator, options) { 4032 var fulfilled = createAction(typePrefix + "/fulfilled", function (payload, requestId, arg, meta) { return ({ 4033 payload: payload, 4034 meta: __spreadProps(__spreadValues({}, meta || {}), { 4035 arg: arg, 4036 requestId: requestId, 4037 requestStatus: "fulfilled" 4038 }) 4039 }); }); 4040 var pending = createAction(typePrefix + "/pending", function (requestId, arg, meta) { return ({ 4041 payload: void 0, 4042 meta: __spreadProps(__spreadValues({}, meta || {}), { 4043 arg: arg, 4044 requestId: requestId, 4045 requestStatus: "pending" 4046 }) 4047 }); }); 4048 var rejected = createAction(typePrefix + "/rejected", function (error, requestId, arg, payload, meta) { return ({ 4049 payload: payload, 4050 error: (options && options.serializeError || miniSerializeError)(error || "Rejected"), 4051 meta: __spreadProps(__spreadValues({}, meta || {}), { 4052 arg: arg, 4053 requestId: requestId, 4054 rejectedWithValue: !!payload, 4055 requestStatus: "rejected", 4056 aborted: (error == null ? void 0 : error.name) === "AbortError", 4057 condition: (error == null ? void 0 : error.name) === "ConditionError" 4058 }) 4059 }); }); 4060 var displayedWarning = false; 4061 var AC = typeof AbortController !== "undefined" ? AbortController : /** @class */ (function () { 4062 function class_1() { 4063 this.signal = { 4064 aborted: false, 4065 addEventListener: function () { 4066 }, 4067 dispatchEvent: function () { 4068 return false; 4069 }, 4070 onabort: function () { 4071 }, 4072 removeEventListener: function () { 4073 }, 4074 reason: void 0, 4075 throwIfAborted: function () { 4076 } 4077 }; 4078 } 4079 class_1.prototype.abort = function () { 4080 if (true) { 4081 if (!displayedWarning) { 4082 displayedWarning = true; 4083 console.info("This platform does not implement AbortController. \nIf you want to use the AbortController to react to `abort` events, please consider importing a polyfill like 'abortcontroller-polyfill/dist/abortcontroller-polyfill-only'."); 4084 } 4085 } 4086 }; 4087 return class_1; 4088 }()); 4089 function actionCreator(arg) { 4090 return function (dispatch, getState, extra) { 4091 var requestId = (options == null ? void 0 : options.idGenerator) ? options.idGenerator(arg) : nanoid(); 4092 var abortController = new AC(); 4093 var abortReason; 4094 var started = false; 4095 function abort(reason) { 4096 abortReason = reason; 4097 abortController.abort(); 4098 } 4099 var promise2 = function () { 4100 return __async(this, null, function () { 4101 var _a, _b, finalAction, conditionResult, abortedPromise, err_1, skipDispatch; 4102 return __generator(this, function (_c) { 4103 switch (_c.label) { 4104 case 0: 4105 _c.trys.push([0, 4, , 5]); 4106 conditionResult = (_a = options == null ? void 0 : options.condition) == null ? void 0 : _a.call(options, arg, { getState: getState, extra: extra }); 4107 if (!isThenable(conditionResult)) return [3 /*break*/, 2]; 4108 return [4 /*yield*/, conditionResult]; 4109 case 1: 4110 conditionResult = _c.sent(); 4111 _c.label = 2; 4112 case 2: 4113 if (conditionResult === false || abortController.signal.aborted) { 4114 throw { 4115 name: "ConditionError", 4116 message: "Aborted due to condition callback returning false." 4117 }; 4118 } 4119 started = true; 4120 abortedPromise = new Promise(function (_, reject) { return abortController.signal.addEventListener("abort", function () { return reject({ 4121 name: "AbortError", 4122 message: abortReason || "Aborted" 4123 }); }); }); 4124 dispatch(pending(requestId, arg, (_b = options == null ? void 0 : options.getPendingMeta) == null ? void 0 : _b.call(options, { requestId: requestId, arg: arg }, { getState: getState, extra: extra }))); 4125 return [4 /*yield*/, Promise.race([ 4126 abortedPromise, 4127 Promise.resolve(payloadCreator(arg, { 4128 dispatch: dispatch, 4129 getState: getState, 4130 extra: extra, 4131 requestId: requestId, 4132 signal: abortController.signal, 4133 abort: abort, 4134 rejectWithValue: function (value, meta) { 4135 return new RejectWithValue(value, meta); 4136 }, 4137 fulfillWithValue: function (value, meta) { 4138 return new FulfillWithMeta(value, meta); 4139 } 4140 })).then(function (result) { 4141 if (result instanceof RejectWithValue) { 4142 throw result; 4143 } 4144 if (result instanceof FulfillWithMeta) { 4145 return fulfilled(result.payload, requestId, arg, result.meta); 4146 } 4147 return fulfilled(result, requestId, arg); 4148 }) 4149 ])]; 4150 case 3: 4151 finalAction = _c.sent(); 4152 return [3 /*break*/, 5]; 4153 case 4: 4154 err_1 = _c.sent(); 4155 finalAction = err_1 instanceof RejectWithValue ? rejected(null, requestId, arg, err_1.payload, err_1.meta) : rejected(err_1, requestId, arg); 4156 return [3 /*break*/, 5]; 4157 case 5: 4158 skipDispatch = options && !options.dispatchConditionRejection && rejected.match(finalAction) && finalAction.meta.condition; 4159 if (!skipDispatch) { 4160 dispatch(finalAction); 4161 } 4162 return [2 /*return*/, finalAction]; 4163 } 4164 }); 4165 }); 4166 }(); 4167 return Object.assign(promise2, { 4168 abort: abort, 4169 requestId: requestId, 4170 arg: arg, 4171 unwrap: function () { 4172 return promise2.then(unwrapResult); 4173 } 4174 }); 4175 }; 4176 } 4177 return Object.assign(actionCreator, { 4178 pending: pending, 4179 rejected: rejected, 4180 fulfilled: fulfilled, 4181 typePrefix: typePrefix 4182 }); 4183 } 4184 createAsyncThunk2.withTypes = function () { return createAsyncThunk2; }; 4185 return createAsyncThunk2; 4186})(); 4187function unwrapResult(action) { 4188 if (action.meta && action.meta.rejectedWithValue) { 4189 throw action.payload; 4190 } 4191 if (action.error) { 4192 throw action.error; 4193 } 4194 return action.payload; 4195} 4196function isThenable(value) { 4197 return value !== null && typeof value === "object" && typeof value.then === "function"; 4198} 4199// src/matchers.ts 4200var matches = function (matcher, action) { 4201 if (hasMatchFunction(matcher)) { 4202 return matcher.match(action); 4203 } 4204 else { 4205 return matcher(action); 4206 } 4207}; 4208function isAnyOf() { 4209 var matchers = []; 4210 for (var _i = 0; _i < arguments.length; _i++) { 4211 matchers[_i] = arguments[_i]; 4212 } 4213 return function (action) { 4214 return matchers.some(function (matcher) { return matches(matcher, action); }); 4215 }; 4216} 4217function isAllOf() { 4218 var matchers = []; 4219 for (var _i = 0; _i < arguments.length; _i++) { 4220 matchers[_i] = arguments[_i]; 4221 } 4222 return function (action) { 4223 return matchers.every(function (matcher) { return matches(matcher, action); }); 4224 }; 4225} 4226function hasExpectedRequestMetadata(action, validStatus) { 4227 if (!action || !action.meta) 4228 return false; 4229 var hasValidRequestId = typeof action.meta.requestId === "string"; 4230 var hasValidRequestStatus = validStatus.indexOf(action.meta.requestStatus) > -1; 4231 return hasValidRequestId && hasValidRequestStatus; 4232} 4233function isAsyncThunkArray(a) { 4234 return typeof a[0] === "function" && "pending" in a[0] && "fulfilled" in a[0] && "rejected" in a[0]; 4235} 4236function isPending() { 4237 var asyncThunks = []; 4238 for (var _i = 0; _i < arguments.length; _i++) { 4239 asyncThunks[_i] = arguments[_i]; 4240 } 4241 if (asyncThunks.length === 0) { 4242 return function (action) { return hasExpectedRequestMetadata(action, ["pending"]); }; 4243 } 4244 if (!isAsyncThunkArray(asyncThunks)) { 4245 return isPending()(asyncThunks[0]); 4246 } 4247 return function (action) { 4248 var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.pending; }); 4249 var combinedMatcher = isAnyOf.apply(void 0, matchers); 4250 return combinedMatcher(action); 4251 }; 4252} 4253function isRejected() { 4254 var asyncThunks = []; 4255 for (var _i = 0; _i < arguments.length; _i++) { 4256 asyncThunks[_i] = arguments[_i]; 4257 } 4258 if (asyncThunks.length === 0) { 4259 return function (action) { return hasExpectedRequestMetadata(action, ["rejected"]); }; 4260 } 4261 if (!isAsyncThunkArray(asyncThunks)) { 4262 return isRejected()(asyncThunks[0]); 4263 } 4264 return function (action) { 4265 var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.rejected; }); 4266 var combinedMatcher = isAnyOf.apply(void 0, matchers); 4267 return combinedMatcher(action); 4268 }; 4269} 4270function isRejectedWithValue() { 4271 var asyncThunks = []; 4272 for (var _i = 0; _i < arguments.length; _i++) { 4273 asyncThunks[_i] = arguments[_i]; 4274 } 4275 var hasFlag = function (action) { 4276 return action && action.meta && action.meta.rejectedWithValue; 4277 }; 4278 if (asyncThunks.length === 0) { 4279 return function (action) { 4280 var combinedMatcher = isAllOf(isRejected.apply(void 0, asyncThunks), hasFlag); 4281 return combinedMatcher(action); 4282 }; 4283 } 4284 if (!isAsyncThunkArray(asyncThunks)) { 4285 return isRejectedWithValue()(asyncThunks[0]); 4286 } 4287 return function (action) { 4288 var combinedMatcher = isAllOf(isRejected.apply(void 0, asyncThunks), hasFlag); 4289 return combinedMatcher(action); 4290 }; 4291} 4292function isFulfilled() { 4293 var asyncThunks = []; 4294 for (var _i = 0; _i < arguments.length; _i++) { 4295 asyncThunks[_i] = arguments[_i]; 4296 } 4297 if (asyncThunks.length === 0) { 4298 return function (action) { return hasExpectedRequestMetadata(action, ["fulfilled"]); }; 4299 } 4300 if (!isAsyncThunkArray(asyncThunks)) { 4301 return isFulfilled()(asyncThunks[0]); 4302 } 4303 return function (action) { 4304 var matchers = asyncThunks.map(function (asyncThunk) { return asyncThunk.fulfilled; }); 4305 var combinedMatcher = isAnyOf.apply(void 0, matchers); 4306 return combinedMatcher(action); 4307 }; 4308} 4309function isAsyncThunkAction() { 4310 var asyncThunks = []; 4311 for (var _i = 0; _i < arguments.length; _i++) { 4312 asyncThunks[_i] = arguments[_i]; 4313 } 4314 if (asyncThunks.length === 0) { 4315 return function (action) { return hasExpectedRequestMetadata(action, ["pending", "fulfilled", "rejected"]); }; 4316 } 4317 if (!isAsyncThunkArray(asyncThunks)) { 4318 return isAsyncThunkAction()(asyncThunks[0]); 4319 } 4320 return function (action) { 4321 var matchers = []; 4322 for (var _i = 0, asyncThunks_1 = asyncThunks; _i < asyncThunks_1.length; _i++) { 4323 var asyncThunk = asyncThunks_1[_i]; 4324 matchers.push(asyncThunk.pending, asyncThunk.rejected, asyncThunk.fulfilled); 4325 } 4326 var combinedMatcher = isAnyOf.apply(void 0, matchers); 4327 return combinedMatcher(action); 4328 }; 4329} 4330// src/listenerMiddleware/utils.ts 4331var assertFunction = function (func, expected) { 4332 if (typeof func !== "function") { 4333 throw new TypeError(expected + " is not a function"); 4334 } 4335}; 4336var noop = function () { 4337}; 4338var catchRejection = function (promise2, onError) { 4339 if (onError === void 0) { onError = noop; } 4340 promise2.catch(onError); 4341 return promise2; 4342}; 4343var addAbortSignalListener = function (abortSignal, callback) { 4344 abortSignal.addEventListener("abort", callback, { once: true }); 4345 return function () { return abortSignal.removeEventListener("abort", callback); }; 4346}; 4347var abortControllerWithReason = function (abortController, reason) { 4348 var signal = abortController.signal; 4349 if (signal.aborted) { 4350 return; 4351 } 4352 if (!("reason" in signal)) { 4353 Object.defineProperty(signal, "reason", { 4354 enumerable: true, 4355 value: reason, 4356 configurable: true, 4357 writable: true 4358 }); 4359 } 4360 ; 4361 abortController.abort(reason); 4362}; 4363// src/listenerMiddleware/exceptions.ts 4364var task = "task"; 4365var listener = "listener"; 4366var completed = "completed"; 4367var cancelled = "cancelled"; 4368var taskCancelled = "task-" + cancelled; 4369var taskCompleted = "task-" + completed; 4370var listenerCancelled = listener + "-" + cancelled; 4371var listenerCompleted = listener + "-" + completed; 4372var TaskAbortError = /** @class */ (function () { 4373 function TaskAbortError(code) { 4374 this.code = code; 4375 this.name = "TaskAbortError"; 4376 this.message = task + " " + cancelled + " (reason: " + code + ")"; 4377 } 4378 return TaskAbortError; 4379}()); 4380// src/listenerMiddleware/task.ts 4381var validateActive = function (signal) { 4382 if (signal.aborted) { 4383 throw new TaskAbortError(signal.reason); 4384 } 4385}; 4386function raceWithSignal(signal, promise2) { 4387 var cleanup = noop; 4388 return new Promise(function (resolve, reject) { 4389 var notifyRejection = function () { return reject(new TaskAbortError(signal.reason)); }; 4390 if (signal.aborted) { 4391 notifyRejection(); 4392 return; 4393 } 4394 cleanup = addAbortSignalListener(signal, notifyRejection); 4395 promise2.finally(function () { return cleanup(); }).then(resolve, reject); 4396 }).finally(function () { 4397 cleanup = noop; 4398 }); 4399} 4400var runTask = function (task2, cleanUp) { return __async(void 0, null, function () { 4401 var value, error_1; 4402 return __generator(this, function (_c) { 4403 switch (_c.label) { 4404 case 0: 4405 _c.trys.push([0, 3, 4, 5]); 4406 return [4 /*yield*/, Promise.resolve()]; 4407 case 1: 4408 _c.sent(); 4409 return [4 /*yield*/, task2()]; 4410 case 2: 4411 value = _c.sent(); 4412 return [2 /*return*/, { 4413 status: "ok", 4414 value: value 4415 }]; 4416 case 3: 4417 error_1 = _c.sent(); 4418 return [2 /*return*/, { 4419 status: error_1 instanceof TaskAbortError ? "cancelled" : "rejected", 4420 error: error_1 4421 }]; 4422 case 4: 4423 cleanUp == null ? void 0 : cleanUp(); 4424 return [7 /*endfinally*/]; 4425 case 5: return [2 /*return*/]; 4426 } 4427 }); 4428}); }; 4429var createPause = function (signal) { 4430 return function (promise2) { 4431 return catchRejection(raceWithSignal(signal, promise2).then(function (output) { 4432 validateActive(signal); 4433 return output; 4434 })); 4435 }; 4436}; 4437var createDelay = function (signal) { 4438 var pause = createPause(signal); 4439 return function (timeoutMs) { 4440 return pause(new Promise(function (resolve) { return setTimeout(resolve, timeoutMs); })); 4441 }; 4442}; 4443// src/listenerMiddleware/index.ts 4444var assign = Object.assign; 4445var INTERNAL_NIL_TOKEN = {}; 4446var alm = "listenerMiddleware"; 4447var createFork = function (parentAbortSignal, parentBlockingPromises) { 4448 var linkControllers = function (controller) { return addAbortSignalListener(parentAbortSignal, function () { return abortControllerWithReason(controller, parentAbortSignal.reason); }); }; 4449 return function (taskExecutor, opts) { 4450 assertFunction(taskExecutor, "taskExecutor"); 4451 var childAbortController = new AbortController(); 4452 linkControllers(childAbortController); 4453 var result = runTask(function () { return __async(void 0, null, function () { 4454 var result2; 4455 return __generator(this, function (_c) { 4456 switch (_c.label) { 4457 case 0: 4458 validateActive(parentAbortSignal); 4459 validateActive(childAbortController.signal); 4460 return [4 /*yield*/, taskExecutor({ 4461 pause: createPause(childAbortController.signal), 4462 delay: createDelay(childAbortController.signal), 4463 signal: childAbortController.signal 4464 })]; 4465 case 1: 4466 result2 = _c.sent(); 4467 validateActive(childAbortController.signal); 4468 return [2 /*return*/, result2]; 4469 } 4470 }); 4471 }); }, function () { return abortControllerWithReason(childAbortController, taskCompleted); }); 4472 if (opts == null ? void 0 : opts.autoJoin) { 4473 parentBlockingPromises.push(result); 4474 } 4475 return { 4476 result: createPause(parentAbortSignal)(result), 4477 cancel: function () { 4478 abortControllerWithReason(childAbortController, taskCancelled); 4479 } 4480 }; 4481 }; 4482}; 4483var createTakePattern = function (startListening, signal) { 4484 var take = function (predicate, timeout) { return __async(void 0, null, function () { 4485 var unsubscribe, tuplePromise, promises, output; 4486 return __generator(this, function (_c) { 4487 switch (_c.label) { 4488 case 0: 4489 validateActive(signal); 4490 unsubscribe = function () { 4491 }; 4492 tuplePromise = new Promise(function (resolve, reject) { 4493 var stopListening = startListening({ 4494 predicate: predicate, 4495 effect: function (action, listenerApi) { 4496 listenerApi.unsubscribe(); 4497 resolve([ 4498 action, 4499 listenerApi.getState(), 4500 listenerApi.getOriginalState() 4501 ]); 4502 } 4503 }); 4504 unsubscribe = function () { 4505 stopListening(); 4506 reject(); 4507 }; 4508 }); 4509 promises = [ 4510 tuplePromise 4511 ]; 4512 if (timeout != null) { 4513 promises.push(new Promise(function (resolve) { return setTimeout(resolve, timeout, null); })); 4514 } 4515 _c.label = 1; 4516 case 1: 4517 _c.trys.push([1, , 3, 4]); 4518 return [4 /*yield*/, raceWithSignal(signal, Promise.race(promises))]; 4519 case 2: 4520 output = _c.sent(); 4521 validateActive(signal); 4522 return [2 /*return*/, output]; 4523 case 3: 4524 unsubscribe(); 4525 return [7 /*endfinally*/]; 4526 case 4: return [2 /*return*/]; 4527 } 4528 }); 4529 }); }; 4530 return function (predicate, timeout) { return catchRejection(take(predicate, timeout)); }; 4531}; 4532var getListenerEntryPropsFrom = function (options) { 4533 var type = options.type, actionCreator = options.actionCreator, matcher = options.matcher, predicate = options.predicate, effect = options.effect; 4534 if (type) { 4535 predicate = createAction(type).match; 4536 } 4537 else if (actionCreator) { 4538 type = actionCreator.type; 4539 predicate = actionCreator.match; 4540 } 4541 else if (matcher) { 4542 predicate = matcher; 4543 } 4544 else if (predicate) { 4545 } 4546 else { 4547 throw new Error("Creating or removing a listener requires one of the known fields for matching an action"); 4548 } 4549 assertFunction(effect, "options.listener"); 4550 return { predicate: predicate, type: type, effect: effect }; 4551}; 4552var createListenerEntry = function (options) { 4553 var _c = getListenerEntryPropsFrom(options), type = _c.type, predicate = _c.predicate, effect = _c.effect; 4554 var id = nanoid(); 4555 var entry = { 4556 id: id, 4557 effect: effect, 4558 type: type, 4559 predicate: predicate, 4560 pending: new Set(), 4561 unsubscribe: function () { 4562 throw new Error("Unsubscribe not initialized"); 4563 } 4564 }; 4565 return entry; 4566}; 4567var cancelActiveListeners = function (entry) { 4568 entry.pending.forEach(function (controller) { 4569 abortControllerWithReason(controller, listenerCancelled); 4570 }); 4571}; 4572var createClearListenerMiddleware = function (listenerMap) { 4573 return function () { 4574 listenerMap.forEach(cancelActiveListeners); 4575 listenerMap.clear(); 4576 }; 4577}; 4578var safelyNotifyError = function (errorHandler, errorToNotify, errorInfo) { 4579 try { 4580 errorHandler(errorToNotify, errorInfo); 4581 } 4582 catch (errorHandlerError) { 4583 setTimeout(function () { 4584 throw errorHandlerError; 4585 }, 0); 4586 } 4587}; 4588var addListener = createAction(alm + "/add"); 4589var clearAllListeners = createAction(alm + "/removeAll"); 4590var removeListener = createAction(alm + "/remove"); 4591var defaultErrorHandler = function () { 4592 var args = []; 4593 for (var _i = 0; _i < arguments.length; _i++) { 4594 args[_i] = arguments[_i]; 4595 } 4596 console.error.apply(console, __spreadArray([alm + "/error"], args)); 4597}; 4598function createListenerMiddleware(middlewareOptions) { 4599 var _this = this; 4600 if (middlewareOptions === void 0) { middlewareOptions = {}; } 4601 var listenerMap = new Map(); 4602 var extra = middlewareOptions.extra, _c = middlewareOptions.onError, onError = _c === void 0 ? defaultErrorHandler : _c; 4603 assertFunction(onError, "onError"); 4604 var insertEntry = function (entry) { 4605 entry.unsubscribe = function () { return listenerMap.delete(entry.id); }; 4606 listenerMap.set(entry.id, entry); 4607 return function (cancelOptions) { 4608 entry.unsubscribe(); 4609 if (cancelOptions == null ? void 0 : cancelOptions.cancelActive) { 4610 cancelActiveListeners(entry); 4611 } 4612 }; 4613 }; 4614 var findListenerEntry = function (comparator) { 4615 for (var _i = 0, _c = Array.from(listenerMap.values()); _i < _c.length; _i++) { 4616 var entry = _c[_i]; 4617 if (comparator(entry)) { 4618 return entry; 4619 } 4620 } 4621 return void 0; 4622 }; 4623 var startListening = function (options) { 4624 var entry = findListenerEntry(function (existingEntry) { return existingEntry.effect === options.effect; }); 4625 if (!entry) { 4626 entry = createListenerEntry(options); 4627 } 4628 return insertEntry(entry); 4629 }; 4630 var stopListening = function (options) { 4631 var _c = getListenerEntryPropsFrom(options), type = _c.type, effect = _c.effect, predicate = _c.predicate; 4632 var entry = findListenerEntry(function (entry2) { 4633 var matchPredicateOrType = typeof type === "string" ? entry2.type === type : entry2.predicate === predicate; 4634 return matchPredicateOrType && entry2.effect === effect; 4635 }); 4636 if (entry) { 4637 entry.unsubscribe(); 4638 if (options.cancelActive) { 4639 cancelActiveListeners(entry); 4640 } 4641 } 4642 return !!entry; 4643 }; 4644 var notifyListener = function (entry, action, api, getOriginalState) { return __async(_this, null, function () { 4645 var internalTaskController, take, autoJoinPromises, listenerError_1; 4646 return __generator(this, function (_c) { 4647 switch (_c.label) { 4648 case 0: 4649 internalTaskController = new AbortController(); 4650 take = createTakePattern(startListening, internalTaskController.signal); 4651 autoJoinPromises = []; 4652 _c.label = 1; 4653 case 1: 4654 _c.trys.push([1, 3, 4, 6]); 4655 entry.pending.add(internalTaskController); 4656 return [4 /*yield*/, Promise.resolve(entry.effect(action, assign({}, api, { 4657 getOriginalState: getOriginalState, 4658 condition: function (predicate, timeout) { return take(predicate, timeout).then(Boolean); }, 4659 take: take, 4660 delay: createDelay(internalTaskController.signal), 4661 pause: createPause(internalTaskController.signal), 4662 extra: extra, 4663 signal: internalTaskController.signal, 4664 fork: createFork(internalTaskController.signal, autoJoinPromises), 4665 unsubscribe: entry.unsubscribe, 4666 subscribe: function () { 4667 listenerMap.set(entry.id, entry); 4668 }, 4669 cancelActiveListeners: function () { 4670 entry.pending.forEach(function (controller, _, set) { 4671 if (controller !== internalTaskController) { 4672 abortControllerWithReason(controller, listenerCancelled); 4673 set.delete(controller); 4674 } 4675 }); 4676 } 4677 })))]; 4678 case 2: 4679 _c.sent(); 4680 return [3 /*break*/, 6]; 4681 case 3: 4682 listenerError_1 = _c.sent(); 4683 if (!(listenerError_1 instanceof TaskAbortError)) { 4684 safelyNotifyError(onError, listenerError_1, { 4685 raisedBy: "effect" 4686 }); 4687 } 4688 return [3 /*break*/, 6]; 4689 case 4: return [4 /*yield*/, Promise.allSettled(autoJoinPromises)]; 4690 case 5: 4691 _c.sent(); 4692 abortControllerWithReason(internalTaskController, listenerCompleted); 4693 entry.pending.delete(internalTaskController); 4694 return [7 /*endfinally*/]; 4695 case 6: return [2 /*return*/]; 4696 } 4697 }); 4698 }); }; 4699 var clearListenerMiddleware = createClearListenerMiddleware(listenerMap); 4700 var middleware = function (api) { return function (next) { return function (action) { 4701 if (!isAction(action)) { 4702 return next(action); 4703 } 4704 if (addListener.match(action)) { 4705 return startListening(action.payload); 4706 } 4707 if (clearAllListeners.match(action)) { 4708 clearListenerMiddleware(); 4709 return; 4710 } 4711 if (removeListener.match(action)) { 4712 return stopListening(action.payload); 4713 } 4714 var originalState = api.getState(); 4715 var getOriginalState = function () { 4716 if (originalState === INTERNAL_NIL_TOKEN) { 4717 throw new Error(alm + ": getOriginalState can only be called synchronously"); 4718 } 4719 return originalState; 4720 }; 4721 var result; 4722 try { 4723 result = next(action); 4724 if (listenerMap.size > 0) { 4725 var currentState = api.getState(); 4726 var listenerEntries = Array.from(listenerMap.values()); 4727 for (var _i = 0, listenerEntries_1 = listenerEntries; _i < listenerEntries_1.length; _i++) { 4728 var entry = listenerEntries_1[_i]; 4729 var runListener = false; 4730 try { 4731 runListener = entry.predicate(action, currentState, originalState); 4732 } 4733 catch (predicateError) { 4734 runListener = false; 4735 safelyNotifyError(onError, predicateError, { 4736 raisedBy: "predicate" 4737 }); 4738 } 4739 if (!runListener) { 4740 continue; 4741 } 4742 notifyListener(entry, action, api, getOriginalState); 4743 } 4744 } 4745 } 4746 finally { 4747 originalState = INTERNAL_NIL_TOKEN; 4748 } 4749 return result; 4750 }; }; }; 4751 return { 4752 middleware: middleware, 4753 startListening: startListening, 4754 stopListening: stopListening, 4755 clearListeners: clearListenerMiddleware 4756 }; 4757} 4758// src/autoBatchEnhancer.ts 4759var SHOULD_AUTOBATCH = "RTK_autoBatch"; 4760var prepareAutoBatched = function () { return function (payload) { 4761 var _c; 4762 return ({ 4763 payload: payload, 4764 meta: (_c = {}, _c[SHOULD_AUTOBATCH] = true, _c) 4765 }); 4766}; }; 4767var promise; 4768var queueMicrotaskShim = typeof queueMicrotask === "function" ? queueMicrotask.bind(typeof window !== "undefined" ? window : typeof __webpack_require__.g !== "undefined" ? __webpack_require__.g : globalThis) : function (cb) { return (promise || (promise = Promise.resolve())).then(cb).catch(function (err) { return setTimeout(function () { 4769 throw err; 4770}, 0); }); }; 4771var createQueueWithTimer = function (timeout) { 4772 return function (notify) { 4773 setTimeout(notify, timeout); 4774 }; 4775}; 4776var rAF = typeof window !== "undefined" && window.requestAnimationFrame ? window.requestAnimationFrame : createQueueWithTimer(10); 4777var autoBatchEnhancer = function (options) { 4778 if (options === void 0) { options = { type: "raf" }; } 4779 return function (next) { return function () { 4780 var args = []; 4781 for (var _i = 0; _i < arguments.length; _i++) { 4782 args[_i] = arguments[_i]; 4783 } 4784 var store = next.apply(void 0, args); 4785 var notifying = true; 4786 var shouldNotifyAtEndOfTick = false; 4787 var notificationQueued = false; 4788 var listeners = new Set(); 4789 var queueCallback = options.type === "tick" ? queueMicrotaskShim : options.type === "raf" ? rAF : options.type === "callback" ? options.queueNotification : createQueueWithTimer(options.timeout); 4790 var notifyListeners = function () { 4791 notificationQueued = false; 4792 if (shouldNotifyAtEndOfTick) { 4793 shouldNotifyAtEndOfTick = false; 4794 listeners.forEach(function (l) { return l(); }); 4795 } 4796 }; 4797 return Object.assign({}, store, { 4798 subscribe: function (listener2) { 4799 var wrappedListener = function () { return notifying && listener2(); }; 4800 var unsubscribe = store.subscribe(wrappedListener); 4801 listeners.add(listener2); 4802 return function () { 4803 unsubscribe(); 4804 listeners.delete(listener2); 4805 }; 4806 }, 4807 dispatch: function (action) { 4808 var _a; 4809 try { 4810 notifying = !((_a = action == null ? void 0 : action.meta) == null ? void 0 : _a[SHOULD_AUTOBATCH]); 4811 shouldNotifyAtEndOfTick = !notifying; 4812 if (shouldNotifyAtEndOfTick) { 4813 if (!notificationQueued) { 4814 notificationQueued = true; 4815 queueCallback(notifyListeners); 4816 } 4817 } 4818 return store.dispatch(action); 4819 } 4820 finally { 4821 notifying = true; 4822 } 4823 } 4824 }); 4825 }; }; 4826}; 4827// src/index.ts 4828(0,immer__WEBPACK_IMPORTED_MODULE_2__.enableES5)(); 4829 4830//# sourceMappingURL=redux-toolkit.esm.js.map 4831 4832/***/ }), 4833
vendor: 94,914 bytes, lines 4834-8349
4834/***/ "./node_modules/@splidejs/splide-extension-video/dist/js/splide-extension-video.esm.js": 4835/*!*********************************************************************************************!*\ 4836 !*** ./node_modules/@splidejs/splide-extension-video/dist/js/splide-extension-video.esm.js ***! 4837 \*********************************************************************************************/ 4838/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 4839 4840"use strict"; 4841__webpack_require__.r(__webpack_exports__); 4842/* harmony export */ __webpack_require__.d(__webpack_exports__, { 4843/* harmony export */ Video: () => (/* binding */ Video) 4844/* harmony export */ }); 4845/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 4846/*! 4847 * Splide.js 4848 * Version : 0.8.0 4849 * License : MIT 4850 * Copyright: 2022 Naotoshi Fujita 4851 */ 4852function empty(array) { 4853 array.length = 0; 4854} 4855 4856function slice$1(arrayLike, start, end) { 4857 return Array.prototype.slice.call(arrayLike, start, end); 4858} 4859 4860function apply$1(func) { 4861 return func.bind.apply(func, [null].concat(slice$1(arguments, 1))); 4862} 4863 4864function typeOf$1(type, subject) { 4865 return typeof subject === type; 4866} 4867 4868var isArray$1 = Array.isArray; 4869apply$1(typeOf$1, "function"); 4870apply$1(typeOf$1, "string"); 4871apply$1(typeOf$1, "undefined"); 4872 4873function toArray$1(value) { 4874 return isArray$1(value) ? value : [value]; 4875} 4876 4877function forEach$1(values, iteratee) { 4878 toArray$1(values).forEach(iteratee); 4879} 4880 4881function includes(array, value) { 4882 return array.indexOf(value) > -1; 4883} 4884 4885var ownKeys$1 = Object.keys; 4886 4887function forOwn$1(object, iteratee, right) { 4888 if (object) { 4889 var keys = ownKeys$1(object); 4890 keys = right ? keys.reverse() : keys; 4891 4892 for (var i = 0; i < keys.length; i++) { 4893 var key = keys[i]; 4894 4895 if (key !== "__proto__") { 4896 if (iteratee(object[key], key) === false) { 4897 break; 4898 } 4899 } 4900 } 4901 } 4902 4903 return object; 4904} 4905 4906function assign$1(object) { 4907 slice$1(arguments, 1).forEach(function (source) { 4908 forOwn$1(source, function (value, key) { 4909 object[key] = source[key]; 4910 }); 4911 }); 4912 return object; 4913} 4914 4915var PROJECT_CODE$1 = "splide"; 4916 4917function EventBinder() { 4918 var listeners = []; 4919 4920 function bind(targets, events, callback, options) { 4921 forEachEvent(targets, events, function (target, event, namespace) { 4922 var isEventTarget = ("addEventListener" in target); 4923 var remover = isEventTarget ? target.removeEventListener.bind(target, event, callback, options) : target["removeListener"].bind(target, callback); 4924 isEventTarget ? target.addEventListener(event, callback, options) : target["addListener"](callback); 4925 listeners.push([target, event, namespace, callback, remover]); 4926 }); 4927 } 4928 4929 function unbind(targets, events, callback) { 4930 forEachEvent(targets, events, function (target, event, namespace) { 4931 listeners = listeners.filter(function (listener) { 4932 if (listener[0] === target && listener[1] === event && listener[2] === namespace && (!callback || listener[3] === callback)) { 4933 listener[4](); 4934 return false; 4935 } 4936 4937 return true; 4938 }); 4939 }); 4940 } 4941 4942 function dispatch(target, type, detail) { 4943 var e; 4944 var bubbles = true; 4945 4946 if (typeof CustomEvent === "function") { 4947 e = new CustomEvent(type, { 4948 bubbles: bubbles, 4949 detail: detail 4950 }); 4951 } else { 4952 e = document.createEvent("CustomEvent"); 4953 e.initCustomEvent(type, bubbles, false, detail); 4954 } 4955 4956 target.dispatchEvent(e); 4957 return e; 4958 } 4959 4960 function forEachEvent(targets, events, iteratee) { 4961 forEach$1(targets, function (target) { 4962 target && forEach$1(events, function (events2) { 4963 events2.split(" ").forEach(function (eventNS) { 4964 var fragment = eventNS.split("."); 4965 iteratee(target, fragment[0], fragment[1]); 4966 }); 4967 }); 4968 }); 4969 } 4970 4971 function destroy() { 4972 listeners.forEach(function (data) { 4973 data[4](); 4974 }); 4975 empty(listeners); 4976 } 4977 4978 return { 4979 bind: bind, 4980 unbind: unbind, 4981 dispatch: dispatch, 4982 destroy: destroy 4983 }; 4984} 4985 4986var EVENT_MOUNTED = "mounted"; 4987var EVENT_MOVE = "move"; 4988var EVENT_MOVED = "moved"; 4989var EVENT_DRAG = "drag"; 4990var EVENT_DRAGGING = "dragging"; 4991var EVENT_SCROLL = "scroll"; 4992var EVENT_SCROLLED = "scrolled"; 4993var EVENT_DESTROY = "destroy"; 4994 4995function EventInterface(Splide2) { 4996 var bus = Splide2 ? Splide2.event.bus : document.createDocumentFragment(); 4997 var binder = EventBinder(); 4998 4999 function on(events, callback) { 5000 binder.bind(bus, toArray$1(events).join(" "), function (e) { 5001 callback.apply(callback, isArray$1(e.detail) ? e.detail : []); 5002 }); 5003 } 5004 5005 function emit(event) { 5006 binder.dispatch(bus, event, slice$1(arguments, 1)); 5007 } 5008 5009 if (Splide2) { 5010 Splide2.event.on(EVENT_DESTROY, binder.destroy); 5011 } 5012 5013 return assign$1(binder, { 5014 bus: bus, 5015 on: on, 5016 off: apply$1(binder.unbind, bus), 5017 emit: emit 5018 }); 5019} 5020 5021function State(initialState) { 5022 var state = initialState; 5023 5024 function set(value) { 5025 state = value; 5026 } 5027 5028 function is(states) { 5029 return includes(toArray$1(states), state); 5030 } 5031 5032 return { 5033 set: set, 5034 is: is 5035 }; 5036} 5037var CLASS_SLIDE = PROJECT_CODE$1 + "__slide"; 5038var CLASS_CONTAINER = CLASS_SLIDE + "__container"; 5039 5040function slice(arrayLike, start, end) { 5041 return Array.prototype.slice.call(arrayLike, start, end); 5042} 5043 5044function find(arrayLike, predicate) { 5045 return slice(arrayLike).filter(predicate)[0]; 5046} 5047 5048function apply(func) { 5049 return func.bind(null, ...slice(arguments, 1)); 5050} 5051 5052function typeOf(type, subject) { 5053 return typeof subject === type; 5054} 5055function isObject(subject) { 5056 return !isNull(subject) && typeOf("object", subject); 5057} 5058const isArray = Array.isArray; 5059const isFunction = apply(typeOf, "function"); 5060const isString = apply(typeOf, "string"); 5061const isUndefined = apply(typeOf, "undefined"); 5062function isNull(subject) { 5063 return subject === null; 5064} 5065function isHTMLElement(subject) { 5066 return subject instanceof HTMLElement; 5067} 5068 5069function toArray(value) { 5070 return isArray(value) ? value : [value]; 5071} 5072 5073function forEach(values, iteratee) { 5074 toArray(values).forEach(iteratee); 5075} 5076 5077function toggleClass(elm, classes, add) { 5078 if (elm) { 5079 forEach(classes, (name) => { 5080 if (name) { 5081 elm.classList[add ? "add" : "remove"](name); 5082 } 5083 }); 5084 } 5085} 5086 5087function addClass(elm, classes) { 5088 toggleClass(elm, isString(classes) ? classes.split(" ") : classes, true); 5089} 5090 5091function append(parent, children) { 5092 forEach(children, parent.appendChild.bind(parent)); 5093} 5094 5095function matches(elm, selector) { 5096 return isHTMLElement(elm) && (elm["msMatchesSelector"] || elm.matches).call(elm, selector); 5097} 5098 5099function children(parent, selector) { 5100 const children2 = parent ? slice(parent.children) : []; 5101 return selector ? children2.filter((child) => matches(child, selector)) : children2; 5102} 5103 5104function child(parent, selector) { 5105 return selector ? children(parent, selector)[0] : parent.firstElementChild; 5106} 5107 5108const ownKeys = Object.keys; 5109 5110function forOwn(object, iteratee, right) { 5111 if (object) { 5112 let keys = ownKeys(object); 5113 keys = right ? keys.reverse() : keys; 5114 for (let i = 0; i < keys.length; i++) { 5115 const key = keys[i]; 5116 if (key !== "__proto__") { 5117 if (iteratee(object[key], key) === false) { 5118 break; 5119 } 5120 } 5121 } 5122 } 5123 return object; 5124} 5125 5126function assign(object) { 5127 slice(arguments, 1).forEach((source) => { 5128 forOwn(source, (value, key) => { 5129 object[key] = source[key]; 5130 }); 5131 }); 5132 return object; 5133} 5134 5135function merge(object) { 5136 slice(arguments, 1).forEach((source) => { 5137 forOwn(source, (value, key) => { 5138 if (isArray(value)) { 5139 object[key] = value.slice(); 5140 } else if (isObject(value)) { 5141 object[key] = merge({}, isObject(object[key]) ? object[key] : {}, value); 5142 } else { 5143 object[key] = value; 5144 } 5145 }); 5146 }); 5147 return object; 5148} 5149 5150function removeAttribute(elms, attrs) { 5151 forEach(elms, (elm) => { 5152 forEach(attrs, (attr) => { 5153 elm && elm.removeAttribute(attr); 5154 }); 5155 }); 5156} 5157 5158function setAttribute(elms, attrs, value) { 5159 if (isObject(attrs)) { 5160 forOwn(attrs, (value2, name) => { 5161 setAttribute(elms, name, value2); 5162 }); 5163 } else { 5164 forEach(elms, (elm) => { 5165 isNull(value) || value === "" ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value)); 5166 }); 5167 } 5168} 5169 5170function create(tag, attrs, parent) { 5171 const elm = document.createElement(tag); 5172 if (attrs) { 5173 isString(attrs) ? addClass(elm, attrs) : setAttribute(elm, attrs); 5174 } 5175 parent && append(parent, elm); 5176 return elm; 5177} 5178 5179function style(elm, prop, value) { 5180 if (isUndefined(value)) { 5181 return getComputedStyle(elm)[prop]; 5182 } 5183 if (!isNull(value)) { 5184 elm.style[prop] = `${value}`; 5185 } 5186} 5187 5188function display(elm, display2) { 5189 style(elm, "display", display2); 5190} 5191 5192function getAttribute(elm, attr) { 5193 return elm.getAttribute(attr); 5194} 5195 5196function hasClass(elm, className) { 5197 return elm && elm.classList.contains(className); 5198} 5199 5200function remove(nodes) { 5201 forEach(nodes, (node) => { 5202 if (node && node.parentNode) { 5203 node.parentNode.removeChild(node); 5204 } 5205 }); 5206} 5207 5208function queryAll(parent, selector) { 5209 return selector ? slice(parent.querySelectorAll(selector)) : []; 5210} 5211 5212function removeClass(elm, classes) { 5213 toggleClass(elm, classes, false); 5214} 5215 5216const PROJECT_CODE = "splide"; 5217 5218function error(message) { 5219 console.error(`[${PROJECT_CODE}] ${message}`); 5220} 5221 5222const { min, max, floor, ceil, abs } = Math; 5223 5224function clamp(number, x, y) { 5225 const minimum = min(x, y); 5226 const maximum = max(x, y); 5227 return min(max(minimum, number), maximum); 5228} 5229 5230const CLASS_VIDEO = "splide__video"; 5231const CLASS_VIDEO_WRAPPER = `${CLASS_VIDEO}__wrapper`; 5232const CLASS_VIDEO_PLAY_BUTTON = `${CLASS_VIDEO}__play`; 5233const CLASS_PLAYING = "is-playing"; 5234const CLASS_ERROR = "is-error"; 5235const CLASS_VIDEO_DISABLED = "is-video-disabled"; 5236const MODIFIER_HAS_VIDEO = "--has-video"; 5237 5238const YOUTUBE_DATA_ATTRIBUTE = "data-splide-youtube"; 5239const VIMEO_DATA_ATTRIBUTE = "data-splide-vimeo"; 5240const HTML_VIDEO__DATA_ATTRIBUTE = "data-splide-html-video"; 5241 5242const DEFAULTS = { 5243 hideControls: false, 5244 loop: false, 5245 mute: false, 5246 volume: 0.2 5247}; 5248 5249const EVENT_VIDEO_PLAY = "video:play"; 5250const EVENT_VIDEO_PAUSE = "video:pause"; 5251const EVENT_VIDEO_ENDED = "video:ended"; 5252const EVENT_VIDEO_ERROR = "video:error"; 5253const EVENT_VIDEO_CLICK = "video:click"; 5254 5255const NOT_INITIALIZED = 1; 5256const INITIALIZING = 2; 5257const INITIALIZED = 3; 5258const PENDING_PLAY = 4; 5259const IDLE = 5; 5260const LOADING = 6; 5261const PLAY_REQUEST_ABORTED = 7; 5262const PLAYING = 8; 5263const ERROR = 9; 5264 5265class AbstractVideoPlayer { 5266 constructor(target, videoId, options) { 5267 this.state = State(NOT_INITIALIZED); 5268 this.event = EventInterface(); 5269 this.target = target; 5270 this.videoId = videoId; 5271 this.options = options || {}; 5272 this.onPlay = this.onPlay.bind(this); 5273 this.onPause = this.onPause.bind(this); 5274 this.onEnded = this.onEnded.bind(this); 5275 this.onPlayerReady = this.onPlayerReady.bind(this); 5276 this.onError = this.onError.bind(this); 5277 } 5278 on(events, callback) { 5279 this.event.on(events, callback); 5280 } 5281 play() { 5282 const { state } = this; 5283 if (state.is(ERROR)) { 5284 error("Can not play this video."); 5285 return; 5286 } 5287 this.event.emit("play"); 5288 if (state.is(INITIALIZING)) { 5289 return state.set(PENDING_PLAY); 5290 } 5291 if (state.is(INITIALIZED)) { 5292 this.player = this.createPlayer(this.videoId); 5293 return state.set(PENDING_PLAY); 5294 } 5295 if (state.is([PENDING_PLAY, PLAYING])) { 5296 return; 5297 } 5298 if (state.is(IDLE)) { 5299 state.set(LOADING); 5300 this.playVideo(); 5301 } 5302 } 5303 pause() { 5304 const { state } = this; 5305 if (state.is(ERROR)) { 5306 return; 5307 } 5308 this.event.emit("pause"); 5309 if (state.is(PENDING_PLAY)) { 5310 return state.set(INITIALIZING); 5311 } 5312 if (state.is(LOADING)) { 5313 return state.set(PLAY_REQUEST_ABORTED); 5314 } 5315 if (state.is(PLAYING)) { 5316 this.pauseVideo(); 5317 this.state.set(IDLE); 5318 } 5319 } 5320 isPaused() { 5321 return !this.state.is(PLAYING); 5322 } 5323 destroy() { 5324 this.event.destroy(); 5325 } 5326 onPlayerReady() { 5327 const { state } = this; 5328 const isPending = state.is(PENDING_PLAY); 5329 state.set(IDLE); 5330 if (isPending) { 5331 this.play(); 5332 } 5333 } 5334 onPlay() { 5335 const { state } = this; 5336 const aborted = state.is(PLAY_REQUEST_ABORTED); 5337 state.set(PLAYING); 5338 if (aborted) { 5339 this.pause(); 5340 } else { 5341 this.event.emit("played"); 5342 } 5343 } 5344 onPause() { 5345 this.state.set(IDLE); 5346 this.event.emit("paused"); 5347 } 5348 onEnded() { 5349 this.state.set(IDLE); 5350 this.event.emit("ended"); 5351 } 5352 onError() { 5353 this.state.set(ERROR); 5354 this.event.emit("error"); 5355 } 5356} 5357 5358class HTMLVideoPlayer extends AbstractVideoPlayer { 5359 constructor(target, videoId, options = {}) { 5360 super(target, videoId, options); 5361 this.state.set(INITIALIZED); 5362 } 5363 createPlayer(videoId) { 5364 const { options, options: { playerOptions = {} } } = this; 5365 const player = create("video", { src: videoId }, this.target); 5366 const on = player.addEventListener.bind(player); 5367 assign(player, { 5368 controls: !options.hideControls, 5369 loop: options.loop, 5370 volume: clamp(options.volume, 0, 1), 5371 muted: options.mute 5372 }, playerOptions.htmlVideo || {}); 5373 on("play", this.onPlay); 5374 on("pause", this.onPause); 5375 on("ended", this.onEnded); 5376 on("loadeddata", this.onPlayerReady); 5377 on("error", this.onError); 5378 return player; 5379 } 5380 playVideo() { 5381 const promise = this.player.play(); 5382 promise && promise.catch(this.onError.bind(this)); 5383 } 5384 pauseVideo() { 5385 this.player.pause(); 5386 } 5387 onError() { 5388 if (this.state.is(PLAY_REQUEST_ABORTED)) { 5389 this.state.set(IDLE); 5390 } else { 5391 super.onError(); 5392 } 5393 } 5394 destroy() { 5395 super.destroy(); 5396 const { player } = this; 5397 const off = player.addEventListener.bind(player); 5398 off("play", this.onPlay); 5399 off("pause", this.onPause); 5400 off("ended", this.onEnded); 5401 off("loadeddata", this.onPlayerReady); 5402 } 5403} 5404 5405/*! @vimeo/player v2.17.1 | (c) 2022 Vimeo | MIT License | https://github.com/vimeo/player.js */ 5406function _classCallCheck(instance, Constructor) { 5407 if (!(instance instanceof Constructor)) { 5408 throw new TypeError("Cannot call a class as a function"); 5409 } 5410} 5411 5412function _defineProperties(target, props) { 5413 for (var i = 0; i < props.length; i++) { 5414 var descriptor = props[i]; 5415 descriptor.enumerable = descriptor.enumerable || false; 5416 descriptor.configurable = true; 5417 if ("value" in descriptor) descriptor.writable = true; 5418 Object.defineProperty(target, descriptor.key, descriptor); 5419 } 5420} 5421 5422function _createClass(Constructor, protoProps, staticProps) { 5423 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 5424 if (staticProps) _defineProperties(Constructor, staticProps); 5425 return Constructor; 5426} 5427 5428/** 5429 * @module lib/functions 5430 */ 5431 5432/** 5433 * Check to see this is a node environment. 5434 * @type {Boolean} 5435 */ 5436 5437/* global global */ 5438var isNode = typeof __webpack_require__.g !== 'undefined' && {}.toString.call(__webpack_require__.g) === '[object global]'; 5439/** 5440 * Get the name of the method for a given getter or setter. 5441 * 5442 * @param {string} prop The name of the property. 5443 * @param {string} type Either âgetâ or âsetâ. 5444 * @return {string} 5445 */ 5446 5447function getMethodName(prop, type) { 5448 if (prop.indexOf(type.toLowerCase()) === 0) { 5449 return prop; 5450 } 5451 5452 return "".concat(type.toLowerCase()).concat(prop.substr(0, 1).toUpperCase()).concat(prop.substr(1)); 5453} 5454/** 5455 * Check to see if the object is a DOM Element. 5456 * 5457 * @param {*} element The object to check. 5458 * @return {boolean} 5459 */ 5460 5461function isDomElement(element) { 5462 return Boolean(element && element.nodeType === 1 && 'nodeName' in element && element.ownerDocument && element.ownerDocument.defaultView); 5463} 5464/** 5465 * Check to see whether the value is a number. 5466 * 5467 * @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html 5468 * @param {*} value The value to check. 5469 * @param {boolean} integer Check if the value is an integer. 5470 * @return {boolean} 5471 */ 5472 5473function isInteger(value) { 5474 // eslint-disable-next-line eqeqeq 5475 return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value; 5476} 5477/** 5478 * Check to see if the URL is a Vimeo url. 5479 * 5480 * @param {string} url The url string. 5481 * @return {boolean} 5482 */ 5483 5484function isVimeoUrl(url) { 5485 return /^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(url); 5486} 5487/** 5488 * Check to see if the URL is for a Vimeo embed. 5489 * 5490 * @param {string} url The url string. 5491 * @return {boolean} 5492 */ 5493 5494function isVimeoEmbed(url) { 5495 var expr = /^https:\/\/player\.vimeo\.com\/video\/\d+/; 5496 return expr.test(url); 5497} 5498/** 5499 * Get the Vimeo URL from an element. 5500 * The element must have either a data-vimeo-id or data-vimeo-url attribute. 5501 * 5502 * @param {object} oEmbedParameters The oEmbed parameters. 5503 * @return {string} 5504 */ 5505 5506function getVimeoUrl() { 5507 var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 5508 var id = oEmbedParameters.id; 5509 var url = oEmbedParameters.url; 5510 var idOrUrl = id || url; 5511 5512 if (!idOrUrl) { 5513 throw new Error('An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.'); 5514 } 5515 5516 if (isInteger(idOrUrl)) { 5517 return "https://vimeo.com/".concat(idOrUrl); 5518 } 5519 5520 if (isVimeoUrl(idOrUrl)) { 5521 return idOrUrl.replace('http:', 'https:'); 5522 } 5523 5524 if (id) { 5525 throw new TypeError("\u201C".concat(id, "\u201D is not a valid video id.")); 5526 } 5527 5528 throw new TypeError("\u201C".concat(idOrUrl, "\u201D is not a vimeo.com url.")); 5529} 5530 5531var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined'; 5532var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined'; 5533 5534if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) { 5535 throw new Error('Sorry, the Vimeo Player API is not available in this browser.'); 5536} 5537 5538var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; 5539 5540function createCommonjsModule(fn, module) { 5541 return module = { exports: {} }, fn(module, module.exports), module.exports; 5542} 5543 5544/*! 5545 * weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill 5546 * https://github.com/polygonplanet/weakmap-polyfill 5547 * Copyright (c) 2015-2021 polygonplanet <[email protected]> 5548 * @license MIT 5549 */ 5550(function (self) { 5551 5552 if (self.WeakMap) { 5553 return; 5554 } 5555 5556 var hasOwnProperty = Object.prototype.hasOwnProperty; 5557 5558 var hasDefine = Object.defineProperty && function () { 5559 try { 5560 // Avoid IE8's broken Object.defineProperty 5561 return Object.defineProperty({}, 'x', { 5562 value: 1 5563 }).x === 1; 5564 } catch (e) {} 5565 }(); 5566 5567 var defineProperty = function (object, name, value) { 5568 if (hasDefine) { 5569 Object.defineProperty(object, name, { 5570 configurable: true, 5571 writable: true, 5572 value: value 5573 }); 5574 } else { 5575 object[name] = value; 5576 } 5577 }; 5578 5579 self.WeakMap = function () { 5580 // ECMA-262 23.3 WeakMap Objects 5581 function WeakMap() { 5582 if (this === void 0) { 5583 throw new TypeError("Constructor WeakMap requires 'new'"); 5584 } 5585 5586 defineProperty(this, '_id', genId('_WeakMap')); // ECMA-262 23.3.1.1 WeakMap([iterable]) 5587 5588 if (arguments.length > 0) { 5589 // Currently, WeakMap `iterable` argument is not supported 5590 throw new TypeError('WeakMap iterable is not supported'); 5591 } 5592 } // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key) 5593 5594 5595 defineProperty(WeakMap.prototype, 'delete', function (key) { 5596 checkInstance(this, 'delete'); 5597 5598 if (!isObject(key)) { 5599 return false; 5600 } 5601 5602 var entry = key[this._id]; 5603 5604 if (entry && entry[0] === key) { 5605 delete key[this._id]; 5606 return true; 5607 } 5608 5609 return false; 5610 }); // ECMA-262 23.3.3.3 WeakMap.prototype.get(key) 5611 5612 defineProperty(WeakMap.prototype, 'get', function (key) { 5613 checkInstance(this, 'get'); 5614 5615 if (!isObject(key)) { 5616 return void 0; 5617 } 5618 5619 var entry = key[this._id]; 5620 5621 if (entry && entry[0] === key) { 5622 return entry[1]; 5623 } 5624 5625 return void 0; 5626 }); // ECMA-262 23.3.3.4 WeakMap.prototype.has(key) 5627 5628 defineProperty(WeakMap.prototype, 'has', function (key) { 5629 checkInstance(this, 'has'); 5630 5631 if (!isObject(key)) { 5632 return false; 5633 } 5634 5635 var entry = key[this._id]; 5636 5637 if (entry && entry[0] === key) { 5638 return true; 5639 } 5640 5641 return false; 5642 }); // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value) 5643 5644 defineProperty(WeakMap.prototype, 'set', function (key, value) { 5645 checkInstance(this, 'set'); 5646 5647 if (!isObject(key)) { 5648 throw new TypeError('Invalid value used as weak map key'); 5649 } 5650 5651 var entry = key[this._id]; 5652 5653 if (entry && entry[0] === key) { 5654 entry[1] = value; 5655 return this; 5656 } 5657 5658 defineProperty(key, this._id, [key, value]); 5659 return this; 5660 }); 5661 5662 function checkInstance(x, methodName) { 5663 if (!isObject(x) || !hasOwnProperty.call(x, '_id')) { 5664 throw new TypeError(methodName + ' method called on incompatible receiver ' + typeof x); 5665 } 5666 } 5667 5668 function genId(prefix) { 5669 return prefix + '_' + rand() + '.' + rand(); 5670 } 5671 5672 function rand() { 5673 return Math.random().toString().substring(2); 5674 } 5675 5676 defineProperty(WeakMap, '_polyfill', true); 5677 return WeakMap; 5678 }(); 5679 5680 function isObject(x) { 5681 return Object(x) === x; 5682 } 5683})(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal); 5684 5685var npo_src = createCommonjsModule(function (module) { 5686/*! Native Promise Only 5687 v0.8.1 (c) Kyle Simpson 5688 MIT License: http://getify.mit-license.org 5689*/ 5690(function UMD(name, context, definition) { 5691 // special form of UMD for polyfilling across evironments 5692 context[name] = context[name] || definition(); 5693 5694 if ( module.exports) { 5695 module.exports = context[name]; 5696 } 5697})("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() { 5698 5699 var builtInProp, 5700 cycle, 5701 scheduling_queue, 5702 ToString = Object.prototype.toString, 5703 timer = typeof setImmediate != "undefined" ? function timer(fn) { 5704 return setImmediate(fn); 5705 } : setTimeout; // dammit, IE8. 5706 5707 try { 5708 Object.defineProperty({}, "x", {}); 5709 5710 builtInProp = function builtInProp(obj, name, val, config) { 5711 return Object.defineProperty(obj, name, { 5712 value: val, 5713 writable: true, 5714 configurable: config !== false 5715 }); 5716 }; 5717 } catch (err) { 5718 builtInProp = function builtInProp(obj, name, val) { 5719 obj[name] = val; 5720 return obj; 5721 }; 5722 } // Note: using a queue instead of array for efficiency 5723 5724 5725 scheduling_queue = function Queue() { 5726 var first, last, item; 5727 5728 function Item(fn, self) { 5729 this.fn = fn; 5730 this.self = self; 5731 this.next = void 0; 5732 } 5733 5734 return { 5735 add: function add(fn, self) { 5736 item = new Item(fn, self); 5737 5738 if (last) { 5739 last.next = item; 5740 } else { 5741 first = item; 5742 } 5743 5744 last = item; 5745 item = void 0; 5746 }, 5747 drain: function drain() { 5748 var f = first; 5749 first = last = cycle = void 0; 5750 5751 while (f) { 5752 f.fn.call(f.self); 5753 f = f.next; 5754 } 5755 } 5756 }; 5757 }(); 5758 5759 function schedule(fn, self) { 5760 scheduling_queue.add(fn, self); 5761 5762 if (!cycle) { 5763 cycle = timer(scheduling_queue.drain); 5764 } 5765 } // promise duck typing 5766 5767 5768 function isThenable(o) { 5769 var _then, 5770 o_type = typeof o; 5771 5772 if (o != null && (o_type == "object" || o_type == "function")) { 5773 _then = o.then; 5774 } 5775 5776 return typeof _then == "function" ? _then : false; 5777 } 5778 5779 function notify() { 5780 for (var i = 0; i < this.chain.length; i++) { 5781 notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]); 5782 } 5783 5784 this.chain.length = 0; 5785 } // NOTE: This is a separate function to isolate 5786 // the `try..catch` so that other code can be 5787 // optimized better 5788 5789 5790 function notifyIsolated(self, cb, chain) { 5791 var ret, _then; 5792 5793 try { 5794 if (cb === false) { 5795 chain.reject(self.msg); 5796 } else { 5797 if (cb === true) { 5798 ret = self.msg; 5799 } else { 5800 ret = cb.call(void 0, self.msg); 5801 } 5802 5803 if (ret === chain.promise) { 5804 chain.reject(TypeError("Promise-chain cycle")); 5805 } else if (_then = isThenable(ret)) { 5806 _then.call(ret, chain.resolve, chain.reject); 5807 } else { 5808 chain.resolve(ret); 5809 } 5810 } 5811 } catch (err) { 5812 chain.reject(err); 5813 } 5814 } 5815 5816 function resolve(msg) { 5817 var _then, 5818 self = this; // already triggered? 5819 5820 5821 if (self.triggered) { 5822 return; 5823 } 5824 5825 self.triggered = true; // unwrap 5826 5827 if (self.def) { 5828 self = self.def; 5829 } 5830 5831 try { 5832 if (_then = isThenable(msg)) { 5833 schedule(function () { 5834 var def_wrapper = new MakeDefWrapper(self); 5835 5836 try { 5837 _then.call(msg, function $resolve$() { 5838 resolve.apply(def_wrapper, arguments); 5839 }, function $reject$() { 5840 reject.apply(def_wrapper, arguments); 5841 }); 5842 } catch (err) { 5843 reject.call(def_wrapper, err); 5844 } 5845 }); 5846 } else { 5847 self.msg = msg; 5848 self.state = 1; 5849 5850 if (self.chain.length > 0) { 5851 schedule(notify, self); 5852 } 5853 } 5854 } catch (err) { 5855 reject.call(new MakeDefWrapper(self), err); 5856 } 5857 } 5858 5859 function reject(msg) { 5860 var self = this; // already triggered? 5861 5862 if (self.triggered) { 5863 return; 5864 } 5865 5866 self.triggered = true; // unwrap 5867 5868 if (self.def) { 5869 self = self.def; 5870 } 5871 5872 self.msg = msg; 5873 self.state = 2; 5874 5875 if (self.chain.length > 0) { 5876 schedule(notify, self); 5877 } 5878 } 5879 5880 function iteratePromises(Constructor, arr, resolver, rejecter) { 5881 for (var idx = 0; idx < arr.length; idx++) { 5882 (function IIFE(idx) { 5883 Constructor.resolve(arr[idx]).then(function $resolver$(msg) { 5884 resolver(idx, msg); 5885 }, rejecter); 5886 })(idx); 5887 } 5888 } 5889 5890 function MakeDefWrapper(self) { 5891 this.def = self; 5892 this.triggered = false; 5893 } 5894 5895 function MakeDef(self) { 5896 this.promise = self; 5897 this.state = 0; 5898 this.triggered = false; 5899 this.chain = []; 5900 this.msg = void 0; 5901 } 5902 5903 function Promise(executor) { 5904 if (typeof executor != "function") { 5905 throw TypeError("Not a function"); 5906 } 5907 5908 if (this.__NPO__ !== 0) { 5909 throw TypeError("Not a promise"); 5910 } // instance shadowing the inherited "brand" 5911 // to signal an already "initialized" promise 5912 5913 5914 this.__NPO__ = 1; 5915 var def = new MakeDef(this); 5916 5917 this["then"] = function then(success, failure) { 5918 var o = { 5919 success: typeof success == "function" ? success : true, 5920 failure: typeof failure == "function" ? failure : false 5921 }; // Note: `then(..)` itself can be borrowed to be used against 5922 // a different promise constructor for making the chained promise, 5923 // by substituting a different `this` binding. 5924 5925 o.promise = new this.constructor(function extractChain(resolve, reject) { 5926 if (typeof resolve != "function" || typeof reject != "function") { 5927 throw TypeError("Not a function"); 5928 } 5929 5930 o.resolve = resolve; 5931 o.reject = reject; 5932 }); 5933 def.chain.push(o); 5934 5935 if (def.state !== 0) { 5936 schedule(notify, def); 5937 } 5938 5939 return o.promise; 5940 }; 5941 5942 this["catch"] = function $catch$(failure) { 5943 return this.then(void 0, failure); 5944 }; 5945 5946 try { 5947 executor.call(void 0, function publicResolve(msg) { 5948 resolve.call(def, msg); 5949 }, function publicReject(msg) { 5950 reject.call(def, msg); 5951 }); 5952 } catch (err) { 5953 reject.call(def, err); 5954 } 5955 } 5956 5957 var PromisePrototype = builtInProp({}, "constructor", Promise, 5958 /*configurable=*/ 5959 false); // Note: Android 4 cannot use `Object.defineProperty(..)` here 5960 5961 Promise.prototype = PromisePrototype; // built-in "brand" to signal an "uninitialized" promise 5962 5963 builtInProp(PromisePrototype, "__NPO__", 0, 5964 /*configurable=*/ 5965 false); 5966 builtInProp(Promise, "resolve", function Promise$resolve(msg) { 5967 var Constructor = this; // spec mandated checks 5968 // note: best "isPromise" check that's practical for now 5969 5970 if (msg && typeof msg == "object" && msg.__NPO__ === 1) { 5971 return msg; 5972 } 5973 5974 return new Constructor(function executor(resolve, reject) { 5975 if (typeof resolve != "function" || typeof reject != "function") { 5976 throw TypeError("Not a function"); 5977 } 5978 5979 resolve(msg); 5980 }); 5981 }); 5982 builtInProp(Promise, "reject", function Promise$reject(msg) { 5983 return new this(function executor(resolve, reject) { 5984 if (typeof resolve != "function" || typeof reject != "function") { 5985 throw TypeError("Not a function"); 5986 } 5987 5988 reject(msg); 5989 }); 5990 }); 5991 builtInProp(Promise, "all", function Promise$all(arr) { 5992 var Constructor = this; // spec mandated checks 5993 5994 if (ToString.call(arr) != "[object Array]") { 5995 return Constructor.reject(TypeError("Not an array")); 5996 } 5997 5998 if (arr.length === 0) { 5999 return Constructor.resolve([]); 6000 } 6001 6002 return new Constructor(function executor(resolve, reject) { 6003 if (typeof resolve != "function" || typeof reject != "function") { 6004 throw TypeError("Not a function"); 6005 } 6006 6007 var len = arr.length, 6008 msgs = Array(len), 6009 count = 0; 6010 iteratePromises(Constructor, arr, function resolver(idx, msg) { 6011 msgs[idx] = msg; 6012 6013 if (++count === len) { 6014 resolve(msgs); 6015 } 6016 }, reject); 6017 }); 6018 }); 6019 builtInProp(Promise, "race", function Promise$race(arr) { 6020 var Constructor = this; // spec mandated checks 6021 6022 if (ToString.call(arr) != "[object Array]") { 6023 return Constructor.reject(TypeError("Not an array")); 6024 } 6025 6026 return new Constructor(function executor(resolve, reject) { 6027 if (typeof resolve != "function" || typeof reject != "function") { 6028 throw TypeError("Not a function"); 6029 } 6030 6031 iteratePromises(Constructor, arr, function resolver(idx, msg) { 6032 resolve(msg); 6033 }, reject); 6034 }); 6035 }); 6036 return Promise; 6037}); 6038}); 6039 6040/** 6041 * @module lib/callbacks 6042 */ 6043var callbackMap = new WeakMap(); 6044/** 6045 * Store a callback for a method or event for a player. 6046 * 6047 * @param {Player} player The player object. 6048 * @param {string} name The method or event name. 6049 * @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback 6050 * The callback to call or an object with resolve and reject functions for a promise. 6051 * @return {void} 6052 */ 6053 6054function storeCallback(player, name, callback) { 6055 var playerCallbacks = callbackMap.get(player.element) || {}; 6056 6057 if (!(name in playerCallbacks)) { 6058 playerCallbacks[name] = []; 6059 } 6060 6061 playerCallbacks[name].push(callback); 6062 callbackMap.set(player.element, playerCallbacks); 6063} 6064/** 6065 * Get the callbacks for a player and event or method. 6066 * 6067 * @param {Player} player The player object. 6068 * @param {string} name The method or event name 6069 * @return {function[]} 6070 */ 6071 6072function getCallbacks(player, name) { 6073 var playerCallbacks = callbackMap.get(player.element) || {}; 6074 return playerCallbacks[name] || []; 6075} 6076/** 6077 * Remove a stored callback for a method or event for a player. 6078 * 6079 * @param {Player} player The player object. 6080 * @param {string} name The method or event name 6081 * @param {function} [callback] The specific callback to remove. 6082 * @return {boolean} Was this the last callback? 6083 */ 6084 6085function removeCallback(player, name, callback) { 6086 var playerCallbacks = callbackMap.get(player.element) || {}; 6087 6088 if (!playerCallbacks[name]) { 6089 return true; 6090 } // If no callback is passed, remove all callbacks for the event 6091 6092 6093 if (!callback) { 6094 playerCallbacks[name] = []; 6095 callbackMap.set(player.element, playerCallbacks); 6096 return true; 6097 } 6098 6099 var index = playerCallbacks[name].indexOf(callback); 6100 6101 if (index !== -1) { 6102 playerCallbacks[name].splice(index, 1); 6103 } 6104 6105 callbackMap.set(player.element, playerCallbacks); 6106 return playerCallbacks[name] && playerCallbacks[name].length === 0; 6107} 6108/** 6109 * Return the first stored callback for a player and event or method. 6110 * 6111 * @param {Player} player The player object. 6112 * @param {string} name The method or event name. 6113 * @return {function} The callback, or false if there were none 6114 */ 6115 6116function shiftCallbacks(player, name) { 6117 var playerCallbacks = getCallbacks(player, name); 6118 6119 if (playerCallbacks.length < 1) { 6120 return false; 6121 } 6122 6123 var callback = playerCallbacks.shift(); 6124 removeCallback(player, name, callback); 6125 return callback; 6126} 6127/** 6128 * Move callbacks associated with an element to another element. 6129 * 6130 * @param {HTMLElement} oldElement The old element. 6131 * @param {HTMLElement} newElement The new element. 6132 * @return {void} 6133 */ 6134 6135function swapCallbacks(oldElement, newElement) { 6136 var playerCallbacks = callbackMap.get(oldElement); 6137 callbackMap.set(newElement, playerCallbacks); 6138 callbackMap.delete(oldElement); 6139} 6140 6141/** 6142 * @module lib/postmessage 6143 */ 6144/** 6145 * Parse a message received from postMessage. 6146 * 6147 * @param {*} data The data received from postMessage. 6148 * @return {object} 6149 */ 6150 6151function parseMessageData(data) { 6152 if (typeof data === 'string') { 6153 try { 6154 data = JSON.parse(data); 6155 } catch (error) { 6156 // If the message cannot be parsed, throw the error as a warning 6157 console.warn(error); 6158 return {}; 6159 } 6160 } 6161 6162 return data; 6163} 6164/** 6165 * Post a message to the specified target. 6166 * 6167 * @param {Player} player The player object to use. 6168 * @param {string} method The API method to call. 6169 * @param {object} params The parameters to send to the player. 6170 * @return {void} 6171 */ 6172 6173function postMessage(player, method, params) { 6174 if (!player.element.contentWindow || !player.element.contentWindow.postMessage) { 6175 return; 6176 } 6177 6178 var message = { 6179 method: method 6180 }; 6181 6182 if (params !== undefined) { 6183 message.value = params; 6184 } // IE 8 and 9 do not support passing messages, so stringify them 6185 6186 6187 var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1')); 6188 6189 if (ieVersion >= 8 && ieVersion < 10) { 6190 message = JSON.stringify(message); 6191 } 6192 6193 player.element.contentWindow.postMessage(message, player.origin); 6194} 6195/** 6196 * Parse the data received from a message event. 6197 * 6198 * @param {Player} player The player that received the message. 6199 * @param {(Object|string)} data The message data. Strings will be parsed into JSON. 6200 * @return {void} 6201 */ 6202 6203function processData(player, data) { 6204 data = parseMessageData(data); 6205 var callbacks = []; 6206 var param; 6207 6208 if (data.event) { 6209 if (data.event === 'error') { 6210 var promises = getCallbacks(player, data.data.method); 6211 promises.forEach(function (promise) { 6212 var error = new Error(data.data.message); 6213 error.name = data.data.name; 6214 promise.reject(error); 6215 removeCallback(player, data.data.method, promise); 6216 }); 6217 } 6218 6219 callbacks = getCallbacks(player, "event:".concat(data.event)); 6220 param = data.data; 6221 } else if (data.method) { 6222 var callback = shiftCallbacks(player, data.method); 6223 6224 if (callback) { 6225 callbacks.push(callback); 6226 param = data.value; 6227 } 6228 } 6229 6230 callbacks.forEach(function (callback) { 6231 try { 6232 if (typeof callback === 'function') { 6233 callback.call(player, param); 6234 return; 6235 } 6236 6237 callback.resolve(param); 6238 } catch (e) {// empty 6239 } 6240 }); 6241} 6242 6243/** 6244 * @module lib/embed 6245 */ 6246var oEmbedParameters = ['autopause', 'autoplay', 'background', 'byline', 'color', 'controls', 'dnt', 'height', 'id', 'interactive_params', 'keyboard', 'loop', 'maxheight', 'maxwidth', 'muted', 'playsinline', 'portrait', 'responsive', 'speed', 'texttrack', 'title', 'transparent', 'url', 'width']; 6247/** 6248 * Get the 'data-vimeo'-prefixed attributes from an element as an object. 6249 * 6250 * @param {HTMLElement} element The element. 6251 * @param {Object} [defaults={}] The default values to use. 6252 * @return {Object<string, string>} 6253 */ 6254 6255function getOEmbedParameters(element) { 6256 var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 6257 return oEmbedParameters.reduce(function (params, param) { 6258 var value = element.getAttribute("data-vimeo-".concat(param)); 6259 6260 if (value || value === '') { 6261 params[param] = value === '' ? 1 : value; 6262 } 6263 6264 return params; 6265 }, defaults); 6266} 6267/** 6268 * Create an embed from oEmbed data inside an element. 6269 * 6270 * @param {object} data The oEmbed data. 6271 * @param {HTMLElement} element The element to put the iframe in. 6272 * @return {HTMLIFrameElement} The iframe embed. 6273 */ 6274 6275function createEmbed(_ref, element) { 6276 var html = _ref.html; 6277 6278 if (!element) { 6279 throw new TypeError('An element must be provided'); 6280 } 6281 6282 if (element.getAttribute('data-vimeo-initialized') !== null) { 6283 return element.querySelector('iframe'); 6284 } 6285 6286 var div = document.createElement('div'); 6287 div.innerHTML = html; 6288 element.appendChild(div.firstChild); 6289 element.setAttribute('data-vimeo-initialized', 'true'); 6290 return element.querySelector('iframe'); 6291} 6292/** 6293 * Make an oEmbed call for the specified URL. 6294 * 6295 * @param {string} videoUrl The vimeo.com url for the video. 6296 * @param {Object} [params] Parameters to pass to oEmbed. 6297 * @param {HTMLElement} element The element. 6298 * @return {Promise} 6299 */ 6300 6301function getOEmbedData(videoUrl) { 6302 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 6303 var element = arguments.length > 2 ? arguments[2] : undefined; 6304 return new Promise(function (resolve, reject) { 6305 if (!isVimeoUrl(videoUrl)) { 6306 throw new TypeError("\u201C".concat(videoUrl, "\u201D is not a vimeo.com url.")); 6307 } 6308 6309 var url = "https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(videoUrl)); 6310 6311 for (var param in params) { 6312 if (params.hasOwnProperty(param)) { 6313 url += "&".concat(param, "=").concat(encodeURIComponent(params[param])); 6314 } 6315 } 6316 6317 var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest(); 6318 xhr.open('GET', url, true); 6319 6320 xhr.onload = function () { 6321 if (xhr.status === 404) { 6322 reject(new Error("\u201C".concat(videoUrl, "\u201D was not found."))); 6323 return; 6324 } 6325 6326 if (xhr.status === 403) { 6327 reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); 6328 return; 6329 } 6330 6331 try { 6332 var json = JSON.parse(xhr.responseText); // Check api response for 403 on oembed 6333 6334 if (json.domain_status_code === 403) { 6335 // We still want to create the embed to give users visual feedback 6336 createEmbed(json, element); 6337 reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); 6338 return; 6339 } 6340 6341 resolve(json); 6342 } catch (error) { 6343 reject(error); 6344 } 6345 }; 6346 6347 xhr.onerror = function () { 6348 var status = xhr.status ? " (".concat(xhr.status, ")") : ''; 6349 reject(new Error("There was an error fetching the embed code from Vimeo".concat(status, "."))); 6350 }; 6351 6352 xhr.send(); 6353 }); 6354} 6355/** 6356 * Initialize all embeds within a specific element 6357 * 6358 * @param {HTMLElement} [parent=document] The parent element. 6359 * @return {void} 6360 */ 6361 6362function initializeEmbeds() { 6363 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 6364 var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]')); 6365 6366 var handleError = function handleError(error) { 6367 if ('console' in window && console.error) { 6368 console.error("There was an error creating an embed: ".concat(error)); 6369 } 6370 }; 6371 6372 elements.forEach(function (element) { 6373 try { 6374 // Skip any that have data-vimeo-defer 6375 if (element.getAttribute('data-vimeo-defer') !== null) { 6376 return; 6377 } 6378 6379 var params = getOEmbedParameters(element); 6380 var url = getVimeoUrl(params); 6381 getOEmbedData(url, params, element).then(function (data) { 6382 return createEmbed(data, element); 6383 }).catch(handleError); 6384 } catch (error) { 6385 handleError(error); 6386 } 6387 }); 6388} 6389/** 6390 * Resize embeds when messaged by the player. 6391 * 6392 * @param {HTMLElement} [parent=document] The parent element. 6393 * @return {void} 6394 */ 6395 6396function resizeEmbeds() { 6397 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 6398 6399 // Prevent execution if users include the player.js script multiple times. 6400 if (window.VimeoPlayerResizeEmbeds_) { 6401 return; 6402 } 6403 6404 window.VimeoPlayerResizeEmbeds_ = true; 6405 6406 var onMessage = function onMessage(event) { 6407 if (!isVimeoUrl(event.origin)) { 6408 return; 6409 } // 'spacechange' is fired only on embeds with cards 6410 6411 6412 if (!event.data || event.data.event !== 'spacechange') { 6413 return; 6414 } 6415 6416 var iframes = parent.querySelectorAll('iframe'); 6417 6418 for (var i = 0; i < iframes.length; i++) { 6419 if (iframes[i].contentWindow !== event.source) { 6420 continue; 6421 } // Change padding-bottom of the enclosing div to accommodate 6422 // card carousel without distorting aspect ratio 6423 6424 6425 var space = iframes[i].parentElement; 6426 space.style.paddingBottom = "".concat(event.data.data[0].bottom, "px"); 6427 break; 6428 } 6429 }; 6430 6431 window.addEventListener('message', onMessage); 6432} 6433/** 6434 * Add chapters to existing metadata for Google SEO 6435 * 6436 * @param {HTMLElement} [parent=document] The parent element. 6437 * @return {void} 6438 */ 6439 6440function initAppendVideoMetadata() { 6441 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 6442 6443 // Prevent execution if users include the player.js script multiple times. 6444 if (window.VimeoSeoMetadataAppended) { 6445 return; 6446 } 6447 6448 window.VimeoSeoMetadataAppended = true; 6449 6450 var onMessage = function onMessage(event) { 6451 if (!isVimeoUrl(event.origin)) { 6452 return; 6453 } 6454 6455 var data = parseMessageData(event.data); 6456 6457 if (!data || data.event !== 'ready') { 6458 return; 6459 } 6460 6461 var iframes = parent.querySelectorAll('iframe'); 6462 6463 for (var i = 0; i < iframes.length; i++) { 6464 var iframe = iframes[i]; // Initiate appendVideoMetadata if iframe is a Vimeo embed 6465 6466 var isValidMessageSource = iframe.contentWindow === event.source; 6467 6468 if (isVimeoEmbed(iframe.src) && isValidMessageSource) { 6469 var player = new Player$1(iframe); 6470 player.callMethod('appendVideoMetadata', window.location.href); 6471 } 6472 } 6473 }; 6474 6475 window.addEventListener('message', onMessage); 6476} 6477 6478/* MIT License 6479 6480Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com) 6481 6482Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6483 6484The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6485 6486THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 6487Terms */ 6488function initializeScreenfull() { 6489 var fn = function () { 6490 var val; 6491 var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'], // New WebKit 6492 ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'], // Old WebKit 6493 ['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']]; 6494 var i = 0; 6495 var l = fnMap.length; 6496 var ret = {}; 6497 6498 for (; i < l; i++) { 6499 val = fnMap[i]; 6500 6501 if (val && val[1] in document) { 6502 for (i = 0; i < val.length; i++) { 6503 ret[fnMap[0][i]] = val[i]; 6504 } 6505 6506 return ret; 6507 } 6508 } 6509 6510 return false; 6511 }(); 6512 6513 var eventNameMap = { 6514 fullscreenchange: fn.fullscreenchange, 6515 fullscreenerror: fn.fullscreenerror 6516 }; 6517 var screenfull = { 6518 request: function request(element) { 6519 return new Promise(function (resolve, reject) { 6520 var onFullScreenEntered = function onFullScreenEntered() { 6521 screenfull.off('fullscreenchange', onFullScreenEntered); 6522 resolve(); 6523 }; 6524 6525 screenfull.on('fullscreenchange', onFullScreenEntered); 6526 element = element || document.documentElement; 6527 var returnPromise = element[fn.requestFullscreen](); 6528 6529 if (returnPromise instanceof Promise) { 6530 returnPromise.then(onFullScreenEntered).catch(reject); 6531 } 6532 }); 6533 }, 6534 exit: function exit() { 6535 return new Promise(function (resolve, reject) { 6536 if (!screenfull.isFullscreen) { 6537 resolve(); 6538 return; 6539 } 6540 6541 var onFullScreenExit = function onFullScreenExit() { 6542 screenfull.off('fullscreenchange', onFullScreenExit); 6543 resolve(); 6544 }; 6545 6546 screenfull.on('fullscreenchange', onFullScreenExit); 6547 var returnPromise = document[fn.exitFullscreen](); 6548 6549 if (returnPromise instanceof Promise) { 6550 returnPromise.then(onFullScreenExit).catch(reject); 6551 } 6552 }); 6553 }, 6554 on: function on(event, callback) { 6555 var eventName = eventNameMap[event]; 6556 6557 if (eventName) { 6558 document.addEventListener(eventName, callback); 6559 } 6560 }, 6561 off: function off(event, callback) { 6562 var eventName = eventNameMap[event]; 6563 6564 if (eventName) { 6565 document.removeEventListener(eventName, callback); 6566 } 6567 } 6568 }; 6569 Object.defineProperties(screenfull, { 6570 isFullscreen: { 6571 get: function get() { 6572 return Boolean(document[fn.fullscreenElement]); 6573 } 6574 }, 6575 element: { 6576 enumerable: true, 6577 get: function get() { 6578 return document[fn.fullscreenElement]; 6579 } 6580 }, 6581 isEnabled: { 6582 enumerable: true, 6583 get: function get() { 6584 // Coerce to boolean in case of old WebKit 6585 return Boolean(document[fn.fullscreenEnabled]); 6586 } 6587 } 6588 }); 6589 return screenfull; 6590} 6591 6592var playerMap = new WeakMap(); 6593var readyMap = new WeakMap(); 6594var screenfull = {}; 6595 6596var Player$1 = /*#__PURE__*/function () { 6597 /** 6598 * Create a Player. 6599 * 6600 * @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo 6601 * player iframe, and id, or a jQuery object. 6602 * @param {object} [options] oEmbed parameters to use when creating an embed in the element. 6603 * @return {Player} 6604 */ 6605 function Player(element) { 6606 var _this = this; 6607 6608 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 6609 6610 _classCallCheck(this, Player); 6611 6612 /* global jQuery */ 6613 if (window.jQuery && element instanceof jQuery) { 6614 if (element.length > 1 && window.console && console.warn) { 6615 console.warn('A jQuery object with multiple elements was passed, using the first element.'); 6616 } 6617 6618 element = element[0]; 6619 } // Find an element by ID 6620 6621 6622 if (typeof document !== 'undefined' && typeof element === 'string') { 6623 element = document.getElementById(element); 6624 } // Not an element! 6625 6626 6627 if (!isDomElement(element)) { 6628 throw new TypeError('You must pass either a valid element or a valid id.'); 6629 } // Already initialized an embed in this div, so grab the iframe 6630 6631 6632 if (element.nodeName !== 'IFRAME') { 6633 var iframe = element.querySelector('iframe'); 6634 6635 if (iframe) { 6636 element = iframe; 6637 } 6638 } // iframe url is not a Vimeo url 6639 6640 6641 if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) { 6642 throw new Error('The player element passed isnât a Vimeo embed.'); 6643 } // If there is already a player object in the map, return that 6644 6645 6646 if (playerMap.has(element)) { 6647 return playerMap.get(element); 6648 } 6649 6650 this._window = element.ownerDocument.defaultView; 6651 this.element = element; 6652 this.origin = '*'; 6653 var readyPromise = new npo_src(function (resolve, reject) { 6654 _this._onMessage = function (event) { 6655 if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) { 6656 return; 6657 } 6658 6659 if (_this.origin === '*') { 6660 _this.origin = event.origin; 6661 } 6662 6663 var data = parseMessageData(event.data); 6664 var isError = data && data.event === 'error'; 6665 var isReadyError = isError && data.data && data.data.method === 'ready'; 6666 6667 if (isReadyError) { 6668 var error = new Error(data.data.message); 6669 error.name = data.data.name; 6670 reject(error); 6671 return; 6672 } 6673 6674 var isReadyEvent = data && data.event === 'ready'; 6675 var isPingResponse = data && data.method === 'ping'; 6676 6677 if (isReadyEvent || isPingResponse) { 6678 _this.element.setAttribute('data-ready', 'true'); 6679 6680 resolve(); 6681 return; 6682 } 6683 6684 processData(_this, data); 6685 }; 6686 6687 _this._window.addEventListener('message', _this._onMessage); 6688 6689 if (_this.element.nodeName !== 'IFRAME') { 6690 var params = getOEmbedParameters(element, options); 6691 var url = getVimeoUrl(params); 6692 getOEmbedData(url, params, element).then(function (data) { 6693 var iframe = createEmbed(data, element); // Overwrite element with the new iframe, 6694 // but store reference to the original element 6695 6696 _this.element = iframe; 6697 _this._originalElement = element; 6698 swapCallbacks(element, iframe); 6699 playerMap.set(_this.element, _this); 6700 return data; 6701 }).catch(reject); 6702 } 6703 }); // Store a copy of this Player in the map 6704 6705 readyMap.set(this, readyPromise); 6706 playerMap.set(this.element, this); // Send a ping to the iframe so the ready promise will be resolved if 6707 // the player is already ready. 6708 6709 if (this.element.nodeName === 'IFRAME') { 6710 postMessage(this, 'ping'); 6711 } 6712 6713 if (screenfull.isEnabled) { 6714 var exitFullscreen = function exitFullscreen() { 6715 return screenfull.exit(); 6716 }; 6717 6718 this.fullscreenchangeHandler = function () { 6719 if (screenfull.isFullscreen) { 6720 storeCallback(_this, 'event:exitFullscreen', exitFullscreen); 6721 } else { 6722 removeCallback(_this, 'event:exitFullscreen', exitFullscreen); 6723 } // eslint-disable-next-line 6724 6725 6726 _this.ready().then(function () { 6727 postMessage(_this, 'fullscreenchange', screenfull.isFullscreen); 6728 }); 6729 }; 6730 6731 screenfull.on('fullscreenchange', this.fullscreenchangeHandler); 6732 } 6733 6734 return this; 6735 } 6736 /** 6737 * Get a promise for a method. 6738 * 6739 * @param {string} name The API method to call. 6740 * @param {Object} [args={}] Arguments to send via postMessage. 6741 * @return {Promise} 6742 */ 6743 6744 6745 _createClass(Player, [{ 6746 key: "callMethod", 6747 value: function callMethod(name) { 6748 var _this2 = this; 6749 6750 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 6751 return new npo_src(function (resolve, reject) { 6752 // We are storing the resolve/reject handlers to call later, so we 6753 // canât return here. 6754 // eslint-disable-next-line promise/always-return 6755 return _this2.ready().then(function () { 6756 storeCallback(_this2, name, { 6757 resolve: resolve, 6758 reject: reject 6759 }); 6760 postMessage(_this2, name, args); 6761 }).catch(reject); 6762 }); 6763 } 6764 /** 6765 * Get a promise for the value of a player property. 6766 * 6767 * @param {string} name The property name 6768 * @return {Promise} 6769 */ 6770 6771 }, { 6772 key: "get", 6773 value: function get(name) { 6774 var _this3 = this; 6775 6776 return new npo_src(function (resolve, reject) { 6777 name = getMethodName(name, 'get'); // We are storing the resolve/reject handlers to call later, so we 6778 // canât return here. 6779 // eslint-disable-next-line promise/always-return 6780 6781 return _this3.ready().then(function () { 6782 storeCallback(_this3, name, { 6783 resolve: resolve, 6784 reject: reject 6785 }); 6786 postMessage(_this3, name); 6787 }).catch(reject); 6788 }); 6789 } 6790 /** 6791 * Get a promise for setting the value of a player property. 6792 * 6793 * @param {string} name The API method to call. 6794 * @param {mixed} value The value to set. 6795 * @return {Promise} 6796 */ 6797 6798 }, { 6799 key: "set", 6800 value: function set(name, value) { 6801 var _this4 = this; 6802 6803 return new npo_src(function (resolve, reject) { 6804 name = getMethodName(name, 'set'); 6805 6806 if (value === undefined || value === null) { 6807 throw new TypeError('There must be a value to set.'); 6808 } // We are storing the resolve/reject handlers to call later, so we 6809 // canât return here. 6810 // eslint-disable-next-line promise/always-return 6811 6812 6813 return _this4.ready().then(function () { 6814 storeCallback(_this4, name, { 6815 resolve: resolve, 6816 reject: reject 6817 }); 6818 postMessage(_this4, name, value); 6819 }).catch(reject); 6820 }); 6821 } 6822 /** 6823 * Add an event listener for the specified event. Will call the 6824 * callback with a single parameter, `data`, that contains the data for 6825 * that event. 6826 * 6827 * @param {string} eventName The name of the event. 6828 * @param {function(*)} callback The function to call when the event fires. 6829 * @return {void} 6830 */ 6831 6832 }, { 6833 key: "on", 6834 value: function on(eventName, callback) { 6835 if (!eventName) { 6836 throw new TypeError('You must pass an event name.'); 6837 } 6838 6839 if (!callback) { 6840 throw new TypeError('You must pass a callback function.'); 6841 } 6842 6843 if (typeof callback !== 'function') { 6844 throw new TypeError('The callback must be a function.'); 6845 } 6846 6847 var callbacks = getCallbacks(this, "event:".concat(eventName)); 6848 6849 if (callbacks.length === 0) { 6850 this.callMethod('addEventListener', eventName).catch(function () {// Ignore the error. There will be an error event fired that 6851 // will trigger the error callback if they are listening. 6852 }); 6853 } 6854 6855 storeCallback(this, "event:".concat(eventName), callback); 6856 } 6857 /** 6858 * Remove an event listener for the specified event. Will remove all 6859 * listeners for that event if a `callback` isnât passed, or only that 6860 * specific callback if it is passed. 6861 * 6862 * @param {string} eventName The name of the event. 6863 * @param {function} [callback] The specific callback to remove. 6864 * @return {void} 6865 */ 6866 6867 }, { 6868 key: "off", 6869 value: function off(eventName, callback) { 6870 if (!eventName) { 6871 throw new TypeError('You must pass an event name.'); 6872 } 6873 6874 if (callback && typeof callback !== 'function') { 6875 throw new TypeError('The callback must be a function.'); 6876 } 6877 6878 var lastCallback = removeCallback(this, "event:".concat(eventName), callback); // If there are no callbacks left, remove the listener 6879 6880 if (lastCallback) { 6881 this.callMethod('removeEventListener', eventName).catch(function (e) {// Ignore the error. There will be an error event fired that 6882 // will trigger the error callback if they are listening. 6883 }); 6884 } 6885 } 6886 /** 6887 * A promise to load a new video. 6888 * 6889 * @promise LoadVideoPromise 6890 * @fulfill {number} The video with this id or url successfully loaded. 6891 * @reject {TypeError} The id was not a number. 6892 */ 6893 6894 /** 6895 * Load a new video into this embed. The promise will be resolved if 6896 * the video is successfully loaded, or it will be rejected if it could 6897 * not be loaded. 6898 * 6899 * @param {number|string|object} options The id of the video, the url of the video, or an object with embed options. 6900 * @return {LoadVideoPromise} 6901 */ 6902 6903 }, { 6904 key: "loadVideo", 6905 value: function loadVideo(options) { 6906 return this.callMethod('loadVideo', options); 6907 } 6908 /** 6909 * A promise to perform an action when the Player is ready. 6910 * 6911 * @todo document errors 6912 * @promise LoadVideoPromise 6913 * @fulfill {void} 6914 */ 6915 6916 /** 6917 * Trigger a function when the player iframe has initialized. You do not 6918 * need to wait for `ready` to trigger to begin adding event listeners 6919 * or calling other methods. 6920 * 6921 * @return {ReadyPromise} 6922 */ 6923 6924 }, { 6925 key: "ready", 6926 value: function ready() { 6927 var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) { 6928 reject(new Error('Unknown player. Probably unloaded.')); 6929 }); 6930 return npo_src.resolve(readyPromise); 6931 } 6932 /** 6933 * A promise to add a cue point to the player. 6934 * 6935 * @promise AddCuePointPromise 6936 * @fulfill {string} The id of the cue point to use for removeCuePoint. 6937 * @reject {RangeError} the time was less than 0 or greater than the 6938 * videoâs duration. 6939 * @reject {UnsupportedError} Cue points are not supported with the current 6940 * player or browser. 6941 */ 6942 6943 /** 6944 * Add a cue point to the player. 6945 * 6946 * @param {number} time The time for the cue point. 6947 * @param {object} [data] Arbitrary data to be returned with the cue point. 6948 * @return {AddCuePointPromise} 6949 */ 6950 6951 }, { 6952 key: "addCuePoint", 6953 value: function addCuePoint(time) { 6954 var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 6955 return this.callMethod('addCuePoint', { 6956 time: time, 6957 data: data 6958 }); 6959 } 6960 /** 6961 * A promise to remove a cue point from the player. 6962 * 6963 * @promise AddCuePointPromise 6964 * @fulfill {string} The id of the cue point that was removed. 6965 * @reject {InvalidCuePoint} The cue point with the specified id was not 6966 * found. 6967 * @reject {UnsupportedError} Cue points are not supported with the current 6968 * player or browser. 6969 */ 6970 6971 /** 6972 * Remove a cue point from the video. 6973 * 6974 * @param {string} id The id of the cue point to remove. 6975 * @return {RemoveCuePointPromise} 6976 */ 6977 6978 }, { 6979 key: "removeCuePoint", 6980 value: function removeCuePoint(id) { 6981 return this.callMethod('removeCuePoint', id); 6982 } 6983 /** 6984 * A representation of a text track on a video. 6985 * 6986 * @typedef {Object} VimeoTextTrack 6987 * @property {string} language The ISO language code. 6988 * @property {string} kind The kind of track it is (captions or subtitles). 6989 * @property {string} label The humanâreadable label for the track. 6990 */ 6991 6992 /** 6993 * A promise to enable a text track. 6994 * 6995 * @promise EnableTextTrackPromise 6996 * @fulfill {VimeoTextTrack} The text track that was enabled. 6997 * @reject {InvalidTrackLanguageError} No track was available with the 6998 * specified language. 6999 * @reject {InvalidTrackError} No track was available with the specified 7000 * language and kind. 7001 */ 7002 7003 /** 7004 * Enable the text track with the specified language, and optionally the 7005 * specified kind (captions or subtitles). 7006 * 7007 * When set via the API, the track language will not change the viewerâs 7008 * stored preference. 7009 * 7010 * @param {string} language The twoâletter language code. 7011 * @param {string} [kind] The kind of track to enable (captions or subtitles). 7012 * @return {EnableTextTrackPromise} 7013 */ 7014 7015 }, { 7016 key: "enableTextTrack", 7017 value: function enableTextTrack(language, kind) { 7018 if (!language) { 7019 throw new TypeError('You must pass a language.'); 7020 } 7021 7022 return this.callMethod('enableTextTrack', { 7023 language: language, 7024 kind: kind 7025 }); 7026 } 7027 /** 7028 * A promise to disable the active text track. 7029 * 7030 * @promise DisableTextTrackPromise 7031 * @fulfill {void} The track was disabled. 7032 */ 7033 7034 /** 7035 * Disable the currently-active text track. 7036 * 7037 * @return {DisableTextTrackPromise} 7038 */ 7039 7040 }, { 7041 key: "disableTextTrack", 7042 value: function disableTextTrack() { 7043 return this.callMethod('disableTextTrack'); 7044 } 7045 /** 7046 * A promise to pause the video. 7047 * 7048 * @promise PausePromise 7049 * @fulfill {void} The video was paused. 7050 */ 7051 7052 /** 7053 * Pause the video if itâs playing. 7054 * 7055 * @return {PausePromise} 7056 */ 7057 7058 }, { 7059 key: "pause", 7060 value: function pause() { 7061 return this.callMethod('pause'); 7062 } 7063 /** 7064 * A promise to play the video. 7065 * 7066 * @promise PlayPromise 7067 * @fulfill {void} The video was played. 7068 */ 7069 7070 /** 7071 * Play the video if itâs paused. **Note:** on iOS and some other 7072 * mobile devices, you cannot programmatically trigger play. Once the 7073 * viewer has tapped on the play button in the player, however, you 7074 * will be able to use this function. 7075 * 7076 * @return {PlayPromise} 7077 */ 7078 7079 }, { 7080 key: "play", 7081 value: function play() { 7082 return this.callMethod('play'); 7083 } 7084 /** 7085 * Request that the player enters fullscreen. 7086 * @return {Promise} 7087 */ 7088 7089 }, { 7090 key: "requestFullscreen", 7091 value: function requestFullscreen() { 7092 if (screenfull.isEnabled) { 7093 return screenfull.request(this.element); 7094 } 7095 7096 return this.callMethod('requestFullscreen'); 7097 } 7098 /** 7099 * Request that the player exits fullscreen. 7100 * @return {Promise} 7101 */ 7102 7103 }, { 7104 key: "exitFullscreen", 7105 value: function exitFullscreen() { 7106 if (screenfull.isEnabled) { 7107 return screenfull.exit(); 7108 } 7109 7110 return this.callMethod('exitFullscreen'); 7111 } 7112 /** 7113 * Returns true if the player is currently fullscreen. 7114 * @return {Promise} 7115 */ 7116 7117 }, { 7118 key: "getFullscreen", 7119 value: function getFullscreen() { 7120 if (screenfull.isEnabled) { 7121 return npo_src.resolve(screenfull.isFullscreen); 7122 } 7123 7124 return this.get('fullscreen'); 7125 } 7126 /** 7127 * Request that the player enters picture-in-picture. 7128 * @return {Promise} 7129 */ 7130 7131 }, { 7132 key: "requestPictureInPicture", 7133 value: function requestPictureInPicture() { 7134 return this.callMethod('requestPictureInPicture'); 7135 } 7136 /** 7137 * Request that the player exits picture-in-picture. 7138 * @return {Promise} 7139 */ 7140 7141 }, { 7142 key: "exitPictureInPicture", 7143 value: function exitPictureInPicture() { 7144 return this.callMethod('exitPictureInPicture'); 7145 } 7146 /** 7147 * Returns true if the player is currently picture-in-picture. 7148 * @return {Promise} 7149 */ 7150 7151 }, { 7152 key: "getPictureInPicture", 7153 value: function getPictureInPicture() { 7154 return this.get('pictureInPicture'); 7155 } 7156 /** 7157 * A promise to unload the video. 7158 * 7159 * @promise UnloadPromise 7160 * @fulfill {void} The video was unloaded. 7161 */ 7162 7163 /** 7164 * Return the player to its initial state. 7165 * 7166 * @return {UnloadPromise} 7167 */ 7168 7169 }, { 7170 key: "unload", 7171 value: function unload() { 7172 return this.callMethod('unload'); 7173 } 7174 /** 7175 * Cleanup the player and remove it from the DOM 7176 * 7177 * It won't be usable and a new one should be constructed 7178 * in order to do any operations. 7179 * 7180 * @return {Promise} 7181 */ 7182 7183 }, { 7184 key: "destroy", 7185 value: function destroy() { 7186 var _this5 = this; 7187 7188 return new npo_src(function (resolve) { 7189 readyMap.delete(_this5); 7190 playerMap.delete(_this5.element); 7191 7192 if (_this5._originalElement) { 7193 playerMap.delete(_this5._originalElement); 7194 7195 _this5._originalElement.removeAttribute('data-vimeo-initialized'); 7196 } 7197 7198 if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) { 7199 // If we've added an additional wrapper div, remove that from the DOM. 7200 // If not, just remove the iframe element. 7201 if (_this5.element.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== _this5.element.parentNode) { 7202 _this5.element.parentNode.parentNode.removeChild(_this5.element.parentNode); 7203 } else { 7204 _this5.element.parentNode.removeChild(_this5.element); 7205 } 7206 } // If the clip is private there is a case where the element stays the 7207 // div element. Destroy should reset the div and remove the iframe child. 7208 7209 7210 if (_this5.element && _this5.element.nodeName === 'DIV' && _this5.element.parentNode) { 7211 _this5.element.removeAttribute('data-vimeo-initialized'); 7212 7213 var iframe = _this5.element.querySelector('iframe'); 7214 7215 if (iframe && iframe.parentNode) { 7216 // If we've added an additional wrapper div, remove that from the DOM. 7217 // If not, just remove the iframe element. 7218 if (iframe.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== iframe.parentNode) { 7219 iframe.parentNode.parentNode.removeChild(iframe.parentNode); 7220 } else { 7221 iframe.parentNode.removeChild(iframe); 7222 } 7223 } 7224 } 7225 7226 _this5._window.removeEventListener('message', _this5._onMessage); 7227 7228 if (screenfull.isEnabled) { 7229 screenfull.off('fullscreenchange', _this5.fullscreenchangeHandler); 7230 } 7231 7232 resolve(); 7233 }); 7234 } 7235 /** 7236 * A promise to get the autopause behavior of the video. 7237 * 7238 * @promise GetAutopausePromise 7239 * @fulfill {boolean} Whether autopause is turned on or off. 7240 * @reject {UnsupportedError} Autopause is not supported with the current 7241 * player or browser. 7242 */ 7243 7244 /** 7245 * Get the autopause behavior for this player. 7246 * 7247 * @return {GetAutopausePromise} 7248 */ 7249 7250 }, { 7251 key: "getAutopause", 7252 value: function getAutopause() { 7253 return this.get('autopause'); 7254 } 7255 /** 7256 * A promise to set the autopause behavior of the video. 7257 * 7258 * @promise SetAutopausePromise 7259 * @fulfill {boolean} Whether autopause is turned on or off. 7260 * @reject {UnsupportedError} Autopause is not supported with the current 7261 * player or browser. 7262 */ 7263 7264 /** 7265 * Enable or disable the autopause behavior of this player. 7266 * 7267 * By default, when another video is played in the same browser, this 7268 * player will automatically pause. Unless you have a specific reason 7269 * for doing so, we recommend that you leave autopause set to the 7270 * default (`true`). 7271 * 7272 * @param {boolean} autopause 7273 * @return {SetAutopausePromise} 7274 */ 7275 7276 }, { 7277 key: "setAutopause", 7278 value: function setAutopause(autopause) { 7279 return this.set('autopause', autopause); 7280 } 7281 /** 7282 * A promise to get the buffered property of the video. 7283 * 7284 * @promise GetBufferedPromise 7285 * @fulfill {Array} Buffered Timeranges converted to an Array. 7286 */ 7287 7288 /** 7289 * Get the buffered property of the video. 7290 * 7291 * @return {GetBufferedPromise} 7292 */ 7293 7294 }, { 7295 key: "getBuffered", 7296 value: function getBuffered() { 7297 return this.get('buffered'); 7298 } 7299 /** 7300 * @typedef {Object} CameraProperties 7301 * @prop {number} props.yaw - Number between 0 and 360. 7302 * @prop {number} props.pitch - Number between -90 and 90. 7303 * @prop {number} props.roll - Number between -180 and 180. 7304 * @prop {number} props.fov - The field of view in degrees. 7305 */ 7306 7307 /** 7308 * A promise to get the camera properties of the player. 7309 * 7310 * @promise GetCameraPromise 7311 * @fulfill {CameraProperties} The camera properties. 7312 */ 7313 7314 /** 7315 * For 360° videos get the camera properties for this player. 7316 * 7317 * @return {GetCameraPromise} 7318 */ 7319 7320 }, { 7321 key: "getCameraProps", 7322 value: function getCameraProps() { 7323 return this.get('cameraProps'); 7324 } 7325 /** 7326 * A promise to set the camera properties of the player. 7327 * 7328 * @promise SetCameraPromise 7329 * @fulfill {Object} The camera was successfully set. 7330 * @reject {RangeError} The range was out of bounds. 7331 */ 7332 7333 /** 7334 * For 360° videos set the camera properties for this player. 7335 * 7336 * @param {CameraProperties} camera The camera properties 7337 * @return {SetCameraPromise} 7338 */ 7339 7340 }, { 7341 key: "setCameraProps", 7342 value: function setCameraProps(camera) { 7343 return this.set('cameraProps', camera); 7344 } 7345 /** 7346 * A representation of a chapter. 7347 * 7348 * @typedef {Object} VimeoChapter 7349 * @property {number} startTime The start time of the chapter. 7350 * @property {object} title The title of the chapter. 7351 * @property {number} index The place in the order of Chapters. Starts at 1. 7352 */ 7353 7354 /** 7355 * A promise to get chapters for the video. 7356 * 7357 * @promise GetChaptersPromise 7358 * @fulfill {VimeoChapter[]} The chapters for the video. 7359 */ 7360 7361 /** 7362 * Get an array of all the chapters for the video. 7363 * 7364 * @return {GetChaptersPromise} 7365 */ 7366 7367 }, { 7368 key: "getChapters", 7369 value: function getChapters() { 7370 return this.get('chapters'); 7371 } 7372 /** 7373 * A promise to get the currently active chapter. 7374 * 7375 * @promise GetCurrentChaptersPromise 7376 * @fulfill {VimeoChapter|undefined} The current chapter for the video. 7377 */ 7378 7379 /** 7380 * Get the currently active chapter for the video. 7381 * 7382 * @return {GetCurrentChaptersPromise} 7383 */ 7384 7385 }, { 7386 key: "getCurrentChapter", 7387 value: function getCurrentChapter() { 7388 return this.get('currentChapter'); 7389 } 7390 /** 7391 * A promise to get the color of the player. 7392 * 7393 * @promise GetColorPromise 7394 * @fulfill {string} The hex color of the player. 7395 */ 7396 7397 /** 7398 * Get the color for this player. 7399 * 7400 * @return {GetColorPromise} 7401 */ 7402 7403 }, { 7404 key: "getColor", 7405 value: function getColor() { 7406 return this.get('color'); 7407 } 7408 /** 7409 * A promise to set the color of the player. 7410 * 7411 * @promise SetColorPromise 7412 * @fulfill {string} The color was successfully set. 7413 * @reject {TypeError} The string was not a valid hex or rgb color. 7414 * @reject {ContrastError} The color was set, but the contrast is 7415 * outside of the acceptable range. 7416 * @reject {EmbedSettingsError} The owner of the player has chosen to 7417 * use a specific color. 7418 */ 7419 7420 /** 7421 * Set the color of this player to a hex or rgb string. Setting the 7422 * color may fail if the owner of the video has set their embed 7423 * preferences to force a specific color. 7424 * 7425 * @param {string} color The hex or rgb color string to set. 7426 * @return {SetColorPromise} 7427 */ 7428 7429 }, { 7430 key: "setColor", 7431 value: function setColor(color) { 7432 return this.set('color', color); 7433 } 7434 /** 7435 * A representation of a cue point. 7436 * 7437 * @typedef {Object} VimeoCuePoint 7438 * @property {number} time The time of the cue point. 7439 * @property {object} data The data passed when adding the cue point. 7440 * @property {string} id The unique id for use with removeCuePoint. 7441 */ 7442 7443 /** 7444 * A promise to get the cue points of a video. 7445 * 7446 * @promise GetCuePointsPromise 7447 * @fulfill {VimeoCuePoint[]} The cue points added to the video. 7448 * @reject {UnsupportedError} Cue points are not supported with the current 7449 * player or browser. 7450 */ 7451 7452 /** 7453 * Get an array of the cue points added to the video. 7454 * 7455 * @return {GetCuePointsPromise} 7456 */ 7457 7458 }, { 7459 key: "getCuePoints", 7460 value: function getCuePoints() { 7461 return this.get('cuePoints'); 7462 } 7463 /** 7464 * A promise to get the current time of the video. 7465 * 7466 * @promise GetCurrentTimePromise 7467 * @fulfill {number} The current time in seconds. 7468 */ 7469 7470 /** 7471 * Get the current playback position in seconds. 7472 * 7473 * @return {GetCurrentTimePromise} 7474 */ 7475 7476 }, { 7477 key: "getCurrentTime", 7478 value: function getCurrentTime() { 7479 return this.get('currentTime'); 7480 } 7481 /** 7482 * A promise to set the current time of the video. 7483 * 7484 * @promise SetCurrentTimePromise 7485 * @fulfill {number} The actual current time that was set. 7486 * @reject {RangeError} the time was less than 0 or greater than the 7487 * videoâs duration. 7488 */ 7489 7490 /** 7491 * Set the current playback position in seconds. If the player was 7492 * paused, it will remain paused. Likewise, if the player was playing, 7493 * it will resume playing once the video has buffered. 7494 * 7495 * You can provide an accurate time and the player will attempt to seek 7496 * to as close to that time as possible. The exact time will be the 7497 * fulfilled value of the promise. 7498 * 7499 * @param {number} currentTime 7500 * @return {SetCurrentTimePromise} 7501 */ 7502 7503 }, { 7504 key: "setCurrentTime", 7505 value: function setCurrentTime(currentTime) { 7506 return this.set('currentTime', currentTime); 7507 } 7508 /** 7509 * A promise to get the duration of the video. 7510 * 7511 * @promise GetDurationPromise 7512 * @fulfill {number} The duration in seconds. 7513 */ 7514 7515 /** 7516 * Get the duration of the video in seconds. It will be rounded to the 7517 * nearest second before playback begins, and to the nearest thousandth 7518 * of a second after playback begins. 7519 * 7520 * @return {GetDurationPromise} 7521 */ 7522 7523 }, { 7524 key: "getDuration", 7525 value: function getDuration() { 7526 return this.get('duration'); 7527 } 7528 /** 7529 * A promise to get the ended state of the video. 7530 * 7531 * @promise GetEndedPromise 7532 * @fulfill {boolean} Whether or not the video has ended. 7533 */ 7534 7535 /** 7536 * Get the ended state of the video. The video has ended if 7537 * `currentTime === duration`. 7538 * 7539 * @return {GetEndedPromise} 7540 */ 7541 7542 }, { 7543 key: "getEnded", 7544 value: function getEnded() { 7545 return this.get('ended'); 7546 } 7547 /** 7548 * A promise to get the loop state of the player. 7549 * 7550 * @promise GetLoopPromise 7551 * @fulfill {boolean} Whether or not the player is set to loop. 7552 */ 7553 7554 /** 7555 * Get the loop state of the player. 7556 * 7557 * @return {GetLoopPromise} 7558 */ 7559 7560 }, { 7561 key: "getLoop", 7562 value: function getLoop() { 7563 return this.get('loop'); 7564 } 7565 /** 7566 * A promise to set the loop state of the player. 7567 * 7568 * @promise SetLoopPromise 7569 * @fulfill {boolean} The loop state that was set. 7570 */ 7571 7572 /** 7573 * Set the loop state of the player. When set to `true`, the player 7574 * will start over immediately once playback ends. 7575 * 7576 * @param {boolean} loop 7577 * @return {SetLoopPromise} 7578 */ 7579 7580 }, { 7581 key: "setLoop", 7582 value: function setLoop(loop) { 7583 return this.set('loop', loop); 7584 } 7585 /** 7586 * A promise to set the muted state of the player. 7587 * 7588 * @promise SetMutedPromise 7589 * @fulfill {boolean} The muted state that was set. 7590 */ 7591 7592 /** 7593 * Set the muted state of the player. When set to `true`, the player 7594 * volume will be muted. 7595 * 7596 * @param {boolean} muted 7597 * @return {SetMutedPromise} 7598 */ 7599 7600 }, { 7601 key: "setMuted", 7602 value: function setMuted(muted) { 7603 return this.set('muted', muted); 7604 } 7605 /** 7606 * A promise to get the muted state of the player. 7607 * 7608 * @promise GetMutedPromise 7609 * @fulfill {boolean} Whether or not the player is muted. 7610 */ 7611 7612 /** 7613 * Get the muted state of the player. 7614 * 7615 * @return {GetMutedPromise} 7616 */ 7617 7618 }, { 7619 key: "getMuted", 7620 value: function getMuted() { 7621 return this.get('muted'); 7622 } 7623 /** 7624 * A promise to get the paused state of the player. 7625 * 7626 * @promise GetLoopPromise 7627 * @fulfill {boolean} Whether or not the video is paused. 7628 */ 7629 7630 /** 7631 * Get the paused state of the player. 7632 * 7633 * @return {GetLoopPromise} 7634 */ 7635 7636 }, { 7637 key: "getPaused", 7638 value: function getPaused() { 7639 return this.get('paused'); 7640 } 7641 /** 7642 * A promise to get the playback rate of the player. 7643 * 7644 * @promise GetPlaybackRatePromise 7645 * @fulfill {number} The playback rate of the player on a scale from 0.5 to 2. 7646 */ 7647 7648 /** 7649 * Get the playback rate of the player on a scale from `0.5` to `2`. 7650 * 7651 * @return {GetPlaybackRatePromise} 7652 */ 7653 7654 }, { 7655 key: "getPlaybackRate", 7656 value: function getPlaybackRate() { 7657 return this.get('playbackRate'); 7658 } 7659 /** 7660 * A promise to set the playbackrate of the player. 7661 * 7662 * @promise SetPlaybackRatePromise 7663 * @fulfill {number} The playback rate was set. 7664 * @reject {RangeError} The playback rate was less than 0.5 or greater than 2. 7665 */ 7666 7667 /** 7668 * Set the playback rate of the player on a scale from `0.5` to `2`. When set 7669 * via the API, the playback rate will not be synchronized to other 7670 * players or stored as the viewer's preference. 7671 * 7672 * @param {number} playbackRate 7673 * @return {SetPlaybackRatePromise} 7674 */ 7675 7676 }, { 7677 key: "setPlaybackRate", 7678 value: function setPlaybackRate(playbackRate) { 7679 return this.set('playbackRate', playbackRate); 7680 } 7681 /** 7682 * A promise to get the played property of the video. 7683 * 7684 * @promise GetPlayedPromise 7685 * @fulfill {Array} Played Timeranges converted to an Array. 7686 */ 7687 7688 /** 7689 * Get the played property of the video. 7690 * 7691 * @return {GetPlayedPromise} 7692 */ 7693 7694 }, { 7695 key: "getPlayed", 7696 value: function getPlayed() { 7697 return this.get('played'); 7698 } 7699 /** 7700 * A promise to get the qualities available of the current video. 7701 * 7702 * @promise GetQualitiesPromise 7703 * @fulfill {Array} The qualities of the video. 7704 */ 7705 7706 /** 7707 * Get the qualities of the current video. 7708 * 7709 * @return {GetQualitiesPromise} 7710 */ 7711 7712 }, { 7713 key: "getQualities", 7714 value: function getQualities() { 7715 return this.get('qualities'); 7716 } 7717 /** 7718 * A promise to get the current set quality of the video. 7719 * 7720 * @promise GetQualityPromise 7721 * @fulfill {string} The current set quality. 7722 */ 7723 7724 /** 7725 * Get the current set quality of the video. 7726 * 7727 * @return {GetQualityPromise} 7728 */ 7729 7730 }, { 7731 key: "getQuality", 7732 value: function getQuality() { 7733 return this.get('quality'); 7734 } 7735 /** 7736 * A promise to set the video quality. 7737 * 7738 * @promise SetQualityPromise 7739 * @fulfill {number} The quality was set. 7740 * @reject {RangeError} The quality is not available. 7741 */ 7742 7743 /** 7744 * Set a video quality. 7745 * 7746 * @param {string} quality 7747 * @return {SetQualityPromise} 7748 */ 7749 7750 }, { 7751 key: "setQuality", 7752 value: function setQuality(quality) { 7753 return this.set('quality', quality); 7754 } 7755 /** 7756 * A promise to get the seekable property of the video. 7757 * 7758 * @promise GetSeekablePromise 7759 * @fulfill {Array} Seekable Timeranges converted to an Array. 7760 */ 7761 7762 /** 7763 * Get the seekable property of the video. 7764 * 7765 * @return {GetSeekablePromise} 7766 */ 7767 7768 }, { 7769 key: "getSeekable", 7770 value: function getSeekable() { 7771 return this.get('seekable'); 7772 } 7773 /** 7774 * A promise to get the seeking property of the player. 7775 * 7776 * @promise GetSeekingPromise 7777 * @fulfill {boolean} Whether or not the player is currently seeking. 7778 */ 7779 7780 /** 7781 * Get if the player is currently seeking. 7782 * 7783 * @return {GetSeekingPromise} 7784 */ 7785 7786 }, { 7787 key: "getSeeking", 7788 value: function getSeeking() { 7789 return this.get('seeking'); 7790 } 7791 /** 7792 * A promise to get the text tracks of a video. 7793 * 7794 * @promise GetTextTracksPromise 7795 * @fulfill {VimeoTextTrack[]} The text tracks associated with the video. 7796 */ 7797 7798 /** 7799 * Get an array of the text tracks that exist for the video. 7800 * 7801 * @return {GetTextTracksPromise} 7802 */ 7803 7804 }, { 7805 key: "getTextTracks", 7806 value: function getTextTracks() { 7807 return this.get('textTracks'); 7808 } 7809 /** 7810 * A promise to get the embed code for the video. 7811 * 7812 * @promise GetVideoEmbedCodePromise 7813 * @fulfill {string} The `<iframe>` embed code for the video. 7814 */ 7815 7816 /** 7817 * Get the `<iframe>` embed code for the video. 7818 * 7819 * @return {GetVideoEmbedCodePromise} 7820 */ 7821 7822 }, { 7823 key: "getVideoEmbedCode", 7824 value: function getVideoEmbedCode() { 7825 return this.get('videoEmbedCode'); 7826 } 7827 /** 7828 * A promise to get the id of the video. 7829 * 7830 * @promise GetVideoIdPromise 7831 * @fulfill {number} The id of the video. 7832 */ 7833 7834 /** 7835 * Get the id of the video. 7836 * 7837 * @return {GetVideoIdPromise} 7838 */ 7839 7840 }, { 7841 key: "getVideoId", 7842 value: function getVideoId() { 7843 return this.get('videoId'); 7844 } 7845 /** 7846 * A promise to get the title of the video. 7847 * 7848 * @promise GetVideoTitlePromise 7849 * @fulfill {number} The title of the video. 7850 */ 7851 7852 /** 7853 * Get the title of the video. 7854 * 7855 * @return {GetVideoTitlePromise} 7856 */ 7857 7858 }, { 7859 key: "getVideoTitle", 7860 value: function getVideoTitle() { 7861 return this.get('videoTitle'); 7862 } 7863 /** 7864 * A promise to get the native width of the video. 7865 * 7866 * @promise GetVideoWidthPromise 7867 * @fulfill {number} The native width of the video. 7868 */ 7869 7870 /** 7871 * Get the native width of the currentlyâplaying video. The width of 7872 * the highestâresolution available will be used before playback begins. 7873 * 7874 * @return {GetVideoWidthPromise} 7875 */ 7876 7877 }, { 7878 key: "getVideoWidth", 7879 value: function getVideoWidth() { 7880 return this.get('videoWidth'); 7881 } 7882 /** 7883 * A promise to get the native height of the video. 7884 * 7885 * @promise GetVideoHeightPromise 7886 * @fulfill {number} The native height of the video. 7887 */ 7888 7889 /** 7890 * Get the native height of the currentlyâplaying video. The height of 7891 * the highestâresolution available will be used before playback begins. 7892 * 7893 * @return {GetVideoHeightPromise} 7894 */ 7895 7896 }, { 7897 key: "getVideoHeight", 7898 value: function getVideoHeight() { 7899 return this.get('videoHeight'); 7900 } 7901 /** 7902 * A promise to get the vimeo.com url for the video. 7903 * 7904 * @promise GetVideoUrlPromise 7905 * @fulfill {number} The vimeo.com url for the video. 7906 * @reject {PrivacyError} The url isnât available because of the videoâs privacy setting. 7907 */ 7908 7909 /** 7910 * Get the vimeo.com url for the video. 7911 * 7912 * @return {GetVideoUrlPromise} 7913 */ 7914 7915 }, { 7916 key: "getVideoUrl", 7917 value: function getVideoUrl() { 7918 return this.get('videoUrl'); 7919 } 7920 /** 7921 * A promise to get the volume level of the player. 7922 * 7923 * @promise GetVolumePromise 7924 * @fulfill {number} The volume level of the player on a scale from 0 to 1. 7925 */ 7926 7927 /** 7928 * Get the current volume level of the player on a scale from `0` to `1`. 7929 * 7930 * Most mobile devices do not support an independent volume from the 7931 * system volume. In those cases, this method will always return `1`. 7932 * 7933 * @return {GetVolumePromise} 7934 */ 7935 7936 }, { 7937 key: "getVolume", 7938 value: function getVolume() { 7939 return this.get('volume'); 7940 } 7941 /** 7942 * A promise to set the volume level of the player. 7943 * 7944 * @promise SetVolumePromise 7945 * @fulfill {number} The volume was set. 7946 * @reject {RangeError} The volume was less than 0 or greater than 1. 7947 */ 7948 7949 /** 7950 * Set the volume of the player on a scale from `0` to `1`. When set 7951 * via the API, the volume level will not be synchronized to other 7952 * players or stored as the viewerâs preference. 7953 * 7954 * Most mobile devices do not support setting the volume. An error will 7955 * *not* be triggered in that situation. 7956 * 7957 * @param {number} volume 7958 * @return {SetVolumePromise} 7959 */ 7960 7961 }, { 7962 key: "setVolume", 7963 value: function setVolume(volume) { 7964 return this.set('volume', volume); 7965 } 7966 }]); 7967 7968 return Player; 7969}(); // Setup embed only if this is not a node environment 7970 7971 7972if (!isNode) { 7973 screenfull = initializeScreenfull(); 7974 initializeEmbeds(); 7975 resizeEmbeds(); 7976 initAppendVideoMetadata(); 7977} 7978 7979class VimeoPlayer extends AbstractVideoPlayer { 7980 constructor(target, videoId, options = {}) { 7981 super(target, videoId, options); 7982 this.state.set(INITIALIZED); 7983 } 7984 createPlayer(videoId) { 7985 const { options, options: { playerOptions = {} } } = this; 7986 const vimeoOptions = videoId.indexOf("http") === 0 ? { url: videoId } : { id: +videoId }; 7987 const player = new Player$1(this.target, assign(vimeoOptions, { 7988 controls: !options.hideControls, 7989 loop: options.loop, 7990 muted: options.mute 7991 }, playerOptions.vimeo || {})); 7992 player.on("play", this.onPlay); 7993 player.on("pause", this.onPause); 7994 player.on("ended", this.onEnded); 7995 player.ready().then(this.onPlayerReady, this.onError); 7996 if (!player.getMuted()) { 7997 player.setVolume(clamp(options.volume, 0, 1)); 7998 } 7999 return player; 8000 } 8001 playVideo() { 8002 this.player.play().catch(() => { 8003 if (this.state.is(PLAY_REQUEST_ABORTED)) { 8004 this.state.set(IDLE); 8005 } 8006 }); 8007 } 8008 pauseVideo() { 8009 this.player.pause(); 8010 } 8011} 8012 8013const YOUTUBE_API_SRC = "//www.youtube.com/player_api"; 8014class YouTubeIframeAPILoader { 8015 load(callback) { 8016 if (window.YT && isFunction(window.YT.Player)) { 8017 return callback(); 8018 } 8019 this.attachCallback(callback); 8020 if (this.shouldLoad()) { 8021 create("script", { src: `${location.protocol}${YOUTUBE_API_SRC}` }, document.head); 8022 } 8023 } 8024 shouldLoad() { 8025 return !queryAll(document, "script").some((script) => script.src.replace(/^https?:/, "") === YOUTUBE_API_SRC); 8026 } 8027 attachCallback(callback) { 8028 let oldCallback; 8029 if (!isUndefined(window.onYouTubeIframeAPIReady)) { 8030 oldCallback = window.onYouTubeIframeAPIReady; 8031 } 8032 window.onYouTubeIframeAPIReady = () => { 8033 oldCallback && oldCallback(); 8034 callback(); 8035 }; 8036 } 8037} 8038 8039class YouTubePlayer extends AbstractVideoPlayer { 8040 constructor(target, videoId, options = {}) { 8041 super(target, videoId, options); 8042 this.videoId = this.parseVideoId(videoId); 8043 if (this.videoId) { 8044 this.state.set(INITIALIZING); 8045 new YouTubeIframeAPILoader().load(this.onAPIReady.bind(this)); 8046 } 8047 } 8048 onAPIReady() { 8049 const { state } = this; 8050 const isPending = state.is(PENDING_PLAY); 8051 state.set(INITIALIZED); 8052 if (isPending) { 8053 this.play(); 8054 } 8055 } 8056 createPlayer(videoId) { 8057 const { options, options: { playerOptions = {} } } = this; 8058 return new YT.Player(this.target, { 8059 videoId, 8060 host: options.host, 8061 playerVars: assign({ 8062 controls: options.hideControls ? 0 : 1, 8063 iv_load_policy: 3, 8064 loop: options.loop ? 1 : 0, 8065 playlist: options.loop ? videoId : void 0, 8066 rel: 0, 8067 autoplay: 0, 8068 mute: options.mute ? 1 : 0 8069 }, playerOptions.youtube || {}), 8070 events: { 8071 onReady: this.onPlayerReady.bind(this), 8072 onStateChange: this.onPlayerStateChange.bind(this), 8073 onError: this.onError.bind(this) 8074 } 8075 }); 8076 } 8077 onPlayerReady() { 8078 super.onPlayerReady(); 8079 this.player.setVolume(clamp(this.options.volume, 0, 1) * 100); 8080 } 8081 onPlayerStateChange(e) { 8082 const { PLAYING, PAUSED, ENDED } = YT.PlayerState; 8083 switch (true) { 8084 case e.data === PLAYING: 8085 this.onPlay(); 8086 break; 8087 case e.data === PAUSED: 8088 this.onPause(); 8089 break; 8090 case e.data === ENDED: 8091 this.onEnded(); 8092 break; 8093 } 8094 } 8095 playVideo() { 8096 this.player.playVideo(); 8097 } 8098 pauseVideo() { 8099 this.player.pauseVideo(); 8100 } 8101 parseVideoId(id) { 8102 return id.indexOf("http") === 0 ? this.parseUrl(id) : id; 8103 } 8104 parseUrl(url) { 8105 const [, search] = url.split(/[#?]/); 8106 const query = find(search.split("&"), (query2) => query2.indexOf("v=") === 0); 8107 return query && query.replace("v=", ""); 8108 } 8109} 8110 8111const I18N = { 8112 playVideo: "Play Video" 8113}; 8114 8115class PlayerUI { 8116 constructor(Splide2, slide) { 8117 this.event = EventInterface(); 8118 this.Splide = Splide2; 8119 this.slide = slide; 8120 this.container = child(this.slide, `.${CLASS_CONTAINER}`); 8121 this.parent = this.container || this.slide; 8122 this.init(); 8123 this.create(); 8124 this.show(); 8125 this.listen(); 8126 } 8127 init() { 8128 addClass(this.slide, `${CLASS_SLIDE}${MODIFIER_HAS_VIDEO}`); 8129 addClass(this.container, `${CLASS_CONTAINER}${MODIFIER_HAS_VIDEO}`); 8130 } 8131 create() { 8132 this.video = create("div", CLASS_VIDEO, this.parent); 8133 this.playButton = create("button", { 8134 class: CLASS_VIDEO_PLAY_BUTTON, 8135 type: "button", 8136 "aria-label": this.Splide.options.i18n.playVideo || I18N.playVideo 8137 }, this.video); 8138 this.wrapper = create("div", CLASS_VIDEO_WRAPPER, this.video); 8139 this.placeholder = create("div", null, this.wrapper); 8140 } 8141 listen() { 8142 this.parent.addEventListener("click", () => { 8143 this.event.emit("click"); 8144 }); 8145 } 8146 toggleButton(show) { 8147 display(this.playButton, show ? "" : "none"); 8148 } 8149 toggleWrapper(show) { 8150 display(this.wrapper, show ? "" : "none"); 8151 } 8152 getPlaceholder() { 8153 return this.placeholder; 8154 } 8155 hide() { 8156 this.toggleButton(false); 8157 this.toggleWrapper(true); 8158 } 8159 show() { 8160 if (!this.disabled) { 8161 this.toggleButton(true); 8162 } 8163 this.toggleWrapper(false); 8164 } 8165 disable(disabled) { 8166 this.disabled = disabled; 8167 if (disabled) { 8168 this.toggleButton(false); 8169 } 8170 } 8171 on(events, callback) { 8172 this.event.on(events, callback); 8173 } 8174 destroy() { 8175 removeClass(this.slide, `${CLASS_SLIDE}${MODIFIER_HAS_VIDEO}`); 8176 removeClass(this.container, `${CLASS_CONTAINER}${MODIFIER_HAS_VIDEO}`); 8177 remove(this.video); 8178 this.event.destroy(); 8179 } 8180} 8181 8182const VIDEO_PLAYER_MAP = [ 8183 [YOUTUBE_DATA_ATTRIBUTE, YouTubePlayer], 8184 [VIMEO_DATA_ATTRIBUTE, VimeoPlayer], 8185 [HTML_VIDEO__DATA_ATTRIBUTE, HTMLVideoPlayer] 8186]; 8187class Player { 8188 constructor(Splide2, slide) { 8189 this.Splide = Splide2; 8190 this.slide = slide; 8191 this.event = EventInterface(Splide2); 8192 this.options = merge(merge({}, DEFAULTS), this.Splide.options.video); 8193 this.createPlayer(slide); 8194 if (this.player) { 8195 this.listen(); 8196 } 8197 } 8198 createPlayer(slide) { 8199 VIDEO_PLAYER_MAP.forEach(([attr, Constructor]) => { 8200 const id = getAttribute(slide, attr); 8201 if (id) { 8202 this.ui = new PlayerUI(this.Splide, slide); 8203 this.player = new Constructor(this.ui.getPlaceholder(), id, this.options); 8204 this.ui.disable(this.options.disableOverlayUI); 8205 } 8206 }); 8207 } 8208 listen() { 8209 const { player, event } = this; 8210 this.ui.on("click", this.onClick.bind(this)); 8211 player.on("play", this.onPlay.bind(this)); 8212 player.on("played", this.onPlayed.bind(this)); 8213 player.on("pause", this.onPause.bind(this)); 8214 player.on("paused", this.onPaused.bind(this)); 8215 player.on("ended", this.onEnded.bind(this)); 8216 player.on("error", this.onError.bind(this)); 8217 event.on([EVENT_MOVE, EVENT_SCROLL], this.pause.bind(this)); 8218 event.on(EVENT_VIDEO_CLICK, this.onVideoClick.bind(this)); 8219 event.on(EVENT_DRAG, () => { 8220 event.off(EVENT_DRAGGING); 8221 event.on(EVENT_DRAGGING, () => { 8222 this.pause(); 8223 event.off(EVENT_DRAGGING); 8224 }); 8225 }); 8226 if (this.options.autoplay) { 8227 event.on([EVENT_MOUNTED, EVENT_MOVED, EVENT_SCROLLED], this.onAutoplayRequested.bind(this)); 8228 } 8229 } 8230 onClick() { 8231 this.isPaused() ? this.play() : this.pause(); 8232 this.event.emit(EVENT_VIDEO_CLICK, this); 8233 } 8234 onVideoClick(player) { 8235 if (this !== player) { 8236 this.pause(); 8237 } 8238 } 8239 onPlay() { 8240 this.ui.hide(); 8241 } 8242 onPlayed() { 8243 this.ui.hide(); 8244 this.togglePlaying(true); 8245 this.event.emit(EVENT_VIDEO_PLAY, this); 8246 } 8247 onPause() { 8248 this.ui.show(); 8249 } 8250 onPaused() { 8251 this.togglePlaying(false); 8252 this.event.emit(EVENT_VIDEO_PAUSE, this); 8253 } 8254 onEnded() { 8255 this.togglePlaying(false); 8256 this.event.emit(EVENT_VIDEO_ENDED, this); 8257 } 8258 onError() { 8259 addClass(this.slide, CLASS_ERROR); 8260 this.ui.show(); 8261 this.event.emit(EVENT_VIDEO_ERROR, this); 8262 } 8263 onAutoplayRequested() { 8264 const activeSlide = this.Splide.Components.Slides.getAt(this.Splide.index); 8265 if (activeSlide.slide === this.slide) { 8266 this.play(); 8267 } 8268 } 8269 togglePlaying(add) { 8270 toggleClass(this.Splide.root, CLASS_PLAYING, add); 8271 } 8272 play() { 8273 if (this.player && !this.disabled) { 8274 this.player.play(); 8275 } 8276 } 8277 pause() { 8278 if (this.player && !this.disabled) { 8279 this.player.pause(); 8280 } 8281 } 8282 destroy() { 8283 if (this.player) { 8284 this.ui.destroy(); 8285 this.player.destroy(); 8286 } 8287 this.disable(false); 8288 } 8289 disable(disabled) { 8290 this.disabled = disabled; 8291 toggleClass(this.Splide.root, CLASS_VIDEO_DISABLED, disabled); 8292 } 8293 isPaused() { 8294 return this.player.isPaused(); 8295 } 8296} 8297 8298function Video(Splide2, Components2) { 8299 const { on } = EventInterface(Splide2); 8300 const { Slides } = Components2; 8301 const players = {}; 8302 function mount() { 8303 create(); 8304 on("refresh", create); 8305 } 8306 function create() { 8307 Slides.forEach((Slide) => { 8308 const { slide } = Slide; 8309 if (!hasClass(slide, `${CLASS_SLIDE}${MODIFIER_HAS_VIDEO}`)) { 8310 players[Slide.index] = new Player(Splide2, slide); 8311 } 8312 }); 8313 Slides.update(); 8314 } 8315 function destroy() { 8316 forOwn(players, (player) => { 8317 player.destroy(); 8318 }); 8319 } 8320 function play(index = Splide2.index) { 8321 const player = players[index]; 8322 if (player) { 8323 player.play(); 8324 } 8325 } 8326 function pause() { 8327 forOwn(players, (player) => { 8328 player.pause(); 8329 }); 8330 } 8331 function disable(disabled) { 8332 forOwn(players, (player) => { 8333 player.disable(disabled); 8334 }); 8335 } 8336 return { 8337 mount, 8338 destroy, 8339 play, 8340 pause, 8341 disable 8342 }; 8343} 8344 8345 8346 8347 8348/***/ }), 8349
vendor: 99,226 bytes, lines 8350-12116
8350/***/ "./node_modules/@splidejs/splide/dist/js/splide.cjs.js": 8351/*!*************************************************************!*\ 8352 !*** ./node_modules/@splidejs/splide/dist/js/splide.cjs.js ***! 8353 \*************************************************************/ 8354/***/ ((__unused_webpack_module, exports) => { 8355 8356"use strict"; 8357/*! 8358 * Splide.js 8359 * Version : 4.1.4 8360 * License : MIT 8361 * Copyright: 2022 Naotoshi Fujita 8362 */ 8363 8364 8365function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 8366 8367function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 8368 8369Object.defineProperty(exports, "__esModule", ({ 8370 value: true 8371})); 8372var MEDIA_PREFERS_REDUCED_MOTION = "(prefers-reduced-motion: reduce)"; 8373var CREATED = 1; 8374var MOUNTED = 2; 8375var IDLE = 3; 8376var MOVING = 4; 8377var SCROLLING = 5; 8378var DRAGGING = 6; 8379var DESTROYED = 7; 8380var STATES = { 8381 CREATED: CREATED, 8382 MOUNTED: MOUNTED, 8383 IDLE: IDLE, 8384 MOVING: MOVING, 8385 SCROLLING: SCROLLING, 8386 DRAGGING: DRAGGING, 8387 DESTROYED: DESTROYED 8388}; 8389 8390function empty(array) { 8391 array.length = 0; 8392} 8393 8394function slice(arrayLike, start, end) { 8395 return Array.prototype.slice.call(arrayLike, start, end); 8396} 8397 8398function apply(func) { 8399 return func.bind.apply(func, [null].concat(slice(arguments, 1))); 8400} 8401 8402var nextTick = setTimeout; 8403 8404var noop = function noop() {}; 8405 8406function raf(func) { 8407 return requestAnimationFrame(func); 8408} 8409 8410function typeOf(type, subject) { 8411 return typeof subject === type; 8412} 8413 8414function isObject(subject) { 8415 return !isNull(subject) && typeOf("object", subject); 8416} 8417 8418var isArray = Array.isArray; 8419var isFunction = apply(typeOf, "function"); 8420var isString = apply(typeOf, "string"); 8421var isUndefined = apply(typeOf, "undefined"); 8422 8423function isNull(subject) { 8424 return subject === null; 8425} 8426 8427function isHTMLElement(subject) { 8428 try { 8429 return subject instanceof (subject.ownerDocument.defaultView || window).HTMLElement; 8430 } catch (e) { 8431 return false; 8432 } 8433} 8434 8435function toArray(value) { 8436 return isArray(value) ? value : [value]; 8437} 8438 8439function forEach(values, iteratee) { 8440 toArray(values).forEach(iteratee); 8441} 8442 8443function includes(array, value) { 8444 return array.indexOf(value) > -1; 8445} 8446 8447function push(array, items) { 8448 array.push.apply(array, toArray(items)); 8449 return array; 8450} 8451 8452function toggleClass(elm, classes, add) { 8453 if (elm) { 8454 forEach(classes, function (name) { 8455 if (name) { 8456 elm.classList[add ? "add" : "remove"](name); 8457 } 8458 }); 8459 } 8460} 8461 8462function addClass(elm, classes) { 8463 toggleClass(elm, isString(classes) ? classes.split(" ") : classes, true); 8464} 8465 8466function append(parent, children) { 8467 forEach(children, parent.appendChild.bind(parent)); 8468} 8469 8470function before(nodes, ref) { 8471 forEach(nodes, function (node) { 8472 var parent = (ref || node).parentNode; 8473 8474 if (parent) { 8475 parent.insertBefore(node, ref); 8476 } 8477 }); 8478} 8479 8480function matches(elm, selector) { 8481 return isHTMLElement(elm) && (elm["msMatchesSelector"] || elm.matches).call(elm, selector); 8482} 8483 8484function children(parent, selector) { 8485 var children2 = parent ? slice(parent.children) : []; 8486 return selector ? children2.filter(function (child) { 8487 return matches(child, selector); 8488 }) : children2; 8489} 8490 8491function child(parent, selector) { 8492 return selector ? children(parent, selector)[0] : parent.firstElementChild; 8493} 8494 8495var ownKeys = Object.keys; 8496 8497function forOwn(object, iteratee, right) { 8498 if (object) { 8499 (right ? ownKeys(object).reverse() : ownKeys(object)).forEach(function (key) { 8500 key !== "__proto__" && iteratee(object[key], key); 8501 }); 8502 } 8503 8504 return object; 8505} 8506 8507function assign(object) { 8508 slice(arguments, 1).forEach(function (source) { 8509 forOwn(source, function (value, key) { 8510 object[key] = source[key]; 8511 }); 8512 }); 8513 return object; 8514} 8515 8516function merge(object) { 8517 slice(arguments, 1).forEach(function (source) { 8518 forOwn(source, function (value, key) { 8519 if (isArray(value)) { 8520 object[key] = value.slice(); 8521 } else if (isObject(value)) { 8522 object[key] = merge({}, isObject(object[key]) ? object[key] : {}, value); 8523 } else { 8524 object[key] = value; 8525 } 8526 }); 8527 }); 8528 return object; 8529} 8530 8531function omit(object, keys) { 8532 forEach(keys || ownKeys(object), function (key) { 8533 delete object[key]; 8534 }); 8535} 8536 8537function removeAttribute(elms, attrs) { 8538 forEach(elms, function (elm) { 8539 forEach(attrs, function (attr) { 8540 elm && elm.removeAttribute(attr); 8541 }); 8542 }); 8543} 8544 8545function setAttribute(elms, attrs, value) { 8546 if (isObject(attrs)) { 8547 forOwn(attrs, function (value2, name) { 8548 setAttribute(elms, name, value2); 8549 }); 8550 } else { 8551 forEach(elms, function (elm) { 8552 isNull(value) || value === "" ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value)); 8553 }); 8554 } 8555} 8556 8557function create(tag, attrs, parent) { 8558 var elm = document.createElement(tag); 8559 8560 if (attrs) { 8561 isString(attrs) ? addClass(elm, attrs) : setAttribute(elm, attrs); 8562 } 8563 8564 parent && append(parent, elm); 8565 return elm; 8566} 8567 8568function style(elm, prop, value) { 8569 if (isUndefined(value)) { 8570 return getComputedStyle(elm)[prop]; 8571 } 8572 8573 if (!isNull(value)) { 8574 elm.style[prop] = "" + value; 8575 } 8576} 8577 8578function display(elm, display2) { 8579 style(elm, "display", display2); 8580} 8581 8582function focus(elm) { 8583 elm["setActive"] && elm["setActive"]() || elm.focus({ 8584 preventScroll: true 8585 }); 8586} 8587 8588function getAttribute(elm, attr) { 8589 return elm.getAttribute(attr); 8590} 8591 8592function hasClass(elm, className) { 8593 return elm && elm.classList.contains(className); 8594} 8595 8596function rect(target) { 8597 return target.getBoundingClientRect(); 8598} 8599 8600function remove(nodes) { 8601 forEach(nodes, function (node) { 8602 if (node && node.parentNode) { 8603 node.parentNode.removeChild(node); 8604 } 8605 }); 8606} 8607 8608function parseHtml(html) { 8609 return child(new DOMParser().parseFromString(html, "text/html").body); 8610} 8611 8612function prevent(e, stopPropagation) { 8613 e.preventDefault(); 8614 8615 if (stopPropagation) { 8616 e.stopPropagation(); 8617 e.stopImmediatePropagation(); 8618 } 8619} 8620 8621function query(parent, selector) { 8622 return parent && parent.querySelector(selector); 8623} 8624 8625function queryAll(parent, selector) { 8626 return selector ? slice(parent.querySelectorAll(selector)) : []; 8627} 8628 8629function removeClass(elm, classes) { 8630 toggleClass(elm, classes, false); 8631} 8632 8633function timeOf(e) { 8634 return e.timeStamp; 8635} 8636 8637function unit(value) { 8638 return isString(value) ? value : value ? value + "px" : ""; 8639} 8640 8641var PROJECT_CODE = "splide"; 8642var DATA_ATTRIBUTE = "data-" + PROJECT_CODE; 8643 8644function assert(condition, message) { 8645 if (!condition) { 8646 throw new Error("[" + PROJECT_CODE + "] " + (message || "")); 8647 } 8648} 8649 8650var min = Math.min, 8651 max = Math.max, 8652 floor = Math.floor, 8653 ceil = Math.ceil, 8654 abs = Math.abs; 8655 8656function approximatelyEqual(x, y, epsilon) { 8657 return abs(x - y) < epsilon; 8658} 8659 8660function between(number, x, y, exclusive) { 8661 var minimum = min(x, y); 8662 var maximum = max(x, y); 8663 return exclusive ? minimum < number && number < maximum : minimum <= number && number <= maximum; 8664} 8665 8666function clamp(number, x, y) { 8667 var minimum = min(x, y); 8668 var maximum = max(x, y); 8669 return min(max(minimum, number), maximum); 8670} 8671 8672function sign(x) { 8673 return +(x > 0) - +(x < 0); 8674} 8675 8676function camelToKebab(string) { 8677 return string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(); 8678} 8679 8680function format(string, replacements) { 8681 forEach(replacements, function (replacement) { 8682 string = string.replace("%s", "" + replacement); 8683 }); 8684 return string; 8685} 8686 8687function pad(number) { 8688 return number < 10 ? "0" + number : "" + number; 8689} 8690 8691var ids = {}; 8692 8693function uniqueId(prefix) { 8694 return "" + prefix + pad(ids[prefix] = (ids[prefix] || 0) + 1); 8695} 8696 8697function EventBinder() { 8698 var listeners = []; 8699 8700 function bind(targets, events, callback, options) { 8701 forEachEvent(targets, events, function (target, event, namespace) { 8702 var isEventTarget = ("addEventListener" in target); 8703 var remover = isEventTarget ? target.removeEventListener.bind(target, event, callback, options) : target["removeListener"].bind(target, callback); 8704 isEventTarget ? target.addEventListener(event, callback, options) : target["addListener"](callback); 8705 listeners.push([target, event, namespace, callback, remover]); 8706 }); 8707 } 8708 8709 function unbind(targets, events, callback) { 8710 forEachEvent(targets, events, function (target, event, namespace) { 8711 listeners = listeners.filter(function (listener) { 8712 if (listener[0] === target && listener[1] === event && listener[2] === namespace && (!callback || listener[3] === callback)) { 8713 listener[4](); 8714 return false; 8715 } 8716 8717 return true; 8718 }); 8719 }); 8720 } 8721 8722 function dispatch(target, type, detail) { 8723 var e; 8724 var bubbles = true; 8725 8726 if (typeof CustomEvent === "function") { 8727 e = new CustomEvent(type, { 8728 bubbles: bubbles, 8729 detail: detail 8730 }); 8731 } else { 8732 e = document.createEvent("CustomEvent"); 8733 e.initCustomEvent(type, bubbles, false, detail); 8734 } 8735 8736 target.dispatchEvent(e); 8737 return e; 8738 } 8739 8740 function forEachEvent(targets, events, iteratee) { 8741 forEach(targets, function (target) { 8742 target && forEach(events, function (events2) { 8743 events2.split(" ").forEach(function (eventNS) { 8744 var fragment = eventNS.split("."); 8745 iteratee(target, fragment[0], fragment[1]); 8746 }); 8747 }); 8748 }); 8749 } 8750 8751 function destroy() { 8752 listeners.forEach(function (data) { 8753 data[4](); 8754 }); 8755 empty(listeners); 8756 } 8757 8758 return { 8759 bind: bind, 8760 unbind: unbind, 8761 dispatch: dispatch, 8762 destroy: destroy 8763 }; 8764} 8765 8766var EVENT_MOUNTED = "mounted"; 8767var EVENT_READY = "ready"; 8768var EVENT_MOVE = "move"; 8769var EVENT_MOVED = "moved"; 8770var EVENT_CLICK = "click"; 8771var EVENT_ACTIVE = "active"; 8772var EVENT_INACTIVE = "inactive"; 8773var EVENT_VISIBLE = "visible"; 8774var EVENT_HIDDEN = "hidden"; 8775var EVENT_REFRESH = "refresh"; 8776var EVENT_UPDATED = "updated"; 8777var EVENT_RESIZE = "resize"; 8778var EVENT_RESIZED = "resized"; 8779var EVENT_DRAG = "drag"; 8780var EVENT_DRAGGING = "dragging"; 8781var EVENT_DRAGGED = "dragged"; 8782var EVENT_SCROLL = "scroll"; 8783var EVENT_SCROLLED = "scrolled"; 8784var EVENT_OVERFLOW = "overflow"; 8785var EVENT_DESTROY = "destroy"; 8786var EVENT_ARROWS_MOUNTED = "arrows:mounted"; 8787var EVENT_ARROWS_UPDATED = "arrows:updated"; 8788var EVENT_PAGINATION_MOUNTED = "pagination:mounted"; 8789var EVENT_PAGINATION_UPDATED = "pagination:updated"; 8790var EVENT_NAVIGATION_MOUNTED = "navigation:mounted"; 8791var EVENT_AUTOPLAY_PLAY = "autoplay:play"; 8792var EVENT_AUTOPLAY_PLAYING = "autoplay:playing"; 8793var EVENT_AUTOPLAY_PAUSE = "autoplay:pause"; 8794var EVENT_LAZYLOAD_LOADED = "lazyload:loaded"; 8795var EVENT_SLIDE_KEYDOWN = "sk"; 8796var EVENT_SHIFTED = "sh"; 8797var EVENT_END_INDEX_CHANGED = "ei"; 8798 8799function EventInterface(Splide2) { 8800 var bus = Splide2 ? Splide2.event.bus : document.createDocumentFragment(); 8801 var binder = EventBinder(); 8802 8803 function on(events, callback) { 8804 binder.bind(bus, toArray(events).join(" "), function (e) { 8805 callback.apply(callback, isArray(e.detail) ? e.detail : []); 8806 }); 8807 } 8808 8809 function emit(event) { 8810 binder.dispatch(bus, event, slice(arguments, 1)); 8811 } 8812 8813 if (Splide2) { 8814 Splide2.event.on(EVENT_DESTROY, binder.destroy); 8815 } 8816 8817 return assign(binder, { 8818 bus: bus, 8819 on: on, 8820 off: apply(binder.unbind, bus), 8821 emit: emit 8822 }); 8823} 8824 8825function RequestInterval(interval, onInterval, onUpdate, limit) { 8826 var now = Date.now; 8827 var startTime; 8828 var rate = 0; 8829 var id; 8830 var paused = true; 8831 var count = 0; 8832 8833 function update() { 8834 if (!paused) { 8835 rate = interval ? min((now() - startTime) / interval, 1) : 1; 8836 onUpdate && onUpdate(rate); 8837 8838 if (rate >= 1) { 8839 onInterval(); 8840 startTime = now(); 8841 8842 if (limit && ++count >= limit) { 8843 return pause(); 8844 } 8845 } 8846 8847 id = raf(update); 8848 } 8849 } 8850 8851 function start(resume) { 8852 resume || cancel(); 8853 startTime = now() - (resume ? rate * interval : 0); 8854 paused = false; 8855 id = raf(update); 8856 } 8857 8858 function pause() { 8859 paused = true; 8860 } 8861 8862 function rewind() { 8863 startTime = now(); 8864 rate = 0; 8865 8866 if (onUpdate) { 8867 onUpdate(rate); 8868 } 8869 } 8870 8871 function cancel() { 8872 id && cancelAnimationFrame(id); 8873 rate = 0; 8874 id = 0; 8875 paused = true; 8876 } 8877 8878 function set(time) { 8879 interval = time; 8880 } 8881 8882 function isPaused() { 8883 return paused; 8884 } 8885 8886 return { 8887 start: start, 8888 rewind: rewind, 8889 pause: pause, 8890 cancel: cancel, 8891 set: set, 8892 isPaused: isPaused 8893 }; 8894} 8895 8896function State(initialState) { 8897 var state = initialState; 8898 8899 function set(value) { 8900 state = value; 8901 } 8902 8903 function is(states) { 8904 return includes(toArray(states), state); 8905 } 8906 8907 return { 8908 set: set, 8909 is: is 8910 }; 8911} 8912 8913function Throttle(func, duration) { 8914 var interval = RequestInterval(duration || 0, func, null, 1); 8915 return function () { 8916 interval.isPaused() && interval.start(); 8917 }; 8918} 8919 8920function Media(Splide2, Components2, options) { 8921 var state = Splide2.state; 8922 var breakpoints = options.breakpoints || {}; 8923 var reducedMotion = options.reducedMotion || {}; 8924 var binder = EventBinder(); 8925 var queries = []; 8926 8927 function setup() { 8928 var isMin = options.mediaQuery === "min"; 8929 ownKeys(breakpoints).sort(function (n, m) { 8930 return isMin ? +n - +m : +m - +n; 8931 }).forEach(function (key) { 8932 register(breakpoints[key], "(" + (isMin ? "min" : "max") + "-width:" + key + "px)"); 8933 }); 8934 register(reducedMotion, MEDIA_PREFERS_REDUCED_MOTION); 8935 update(); 8936 } 8937 8938 function destroy(completely) { 8939 if (completely) { 8940 binder.destroy(); 8941 } 8942 } 8943 8944 function register(options2, query) { 8945 var queryList = matchMedia(query); 8946 binder.bind(queryList, "change", update); 8947 queries.push([options2, queryList]); 8948 } 8949 8950 function update() { 8951 var destroyed = state.is(DESTROYED); 8952 var direction = options.direction; 8953 var merged = queries.reduce(function (merged2, entry) { 8954 return merge(merged2, entry[1].matches ? entry[0] : {}); 8955 }, {}); 8956 omit(options); 8957 set(merged); 8958 8959 if (options.destroy) { 8960 Splide2.destroy(options.destroy === "completely"); 8961 } else if (destroyed) { 8962 destroy(true); 8963 Splide2.mount(); 8964 } else { 8965 direction !== options.direction && Splide2.refresh(); 8966 } 8967 } 8968 8969 function reduce(enable) { 8970 if (matchMedia(MEDIA_PREFERS_REDUCED_MOTION).matches) { 8971 enable ? merge(options, reducedMotion) : omit(options, ownKeys(reducedMotion)); 8972 } 8973 } 8974 8975 function set(opts, base, notify) { 8976 merge(options, opts); 8977 base && merge(Object.getPrototypeOf(options), opts); 8978 8979 if (notify || !state.is(CREATED)) { 8980 Splide2.emit(EVENT_UPDATED, options); 8981 } 8982 } 8983 8984 return { 8985 setup: setup, 8986 destroy: destroy, 8987 reduce: reduce, 8988 set: set 8989 }; 8990} 8991 8992var ARROW = "Arrow"; 8993var ARROW_LEFT = ARROW + "Left"; 8994var ARROW_RIGHT = ARROW + "Right"; 8995var ARROW_UP = ARROW + "Up"; 8996var ARROW_DOWN = ARROW + "Down"; 8997var LTR = "ltr"; 8998var RTL = "rtl"; 8999var TTB = "ttb"; 9000var ORIENTATION_MAP = { 9001 width: ["height"], 9002 left: ["top", "right"], 9003 right: ["bottom", "left"], 9004 x: ["y"], 9005 X: ["Y"], 9006 Y: ["X"], 9007 ArrowLeft: [ARROW_UP, ARROW_RIGHT], 9008 ArrowRight: [ARROW_DOWN, ARROW_LEFT] 9009}; 9010 9011function Direction(Splide2, Components2, options) { 9012 function resolve(prop, axisOnly, direction) { 9013 direction = direction || options.direction; 9014 var index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1; 9015 return ORIENTATION_MAP[prop] && ORIENTATION_MAP[prop][index] || prop.replace(/width|left|right/i, function (match, offset) { 9016 var replacement = ORIENTATION_MAP[match.toLowerCase()][index] || match; 9017 return offset > 0 ? replacement.charAt(0).toUpperCase() + replacement.slice(1) : replacement; 9018 }); 9019 } 9020 9021 function orient(value) { 9022 return value * (options.direction === RTL ? 1 : -1); 9023 } 9024 9025 return { 9026 resolve: resolve, 9027 orient: orient 9028 }; 9029} 9030 9031var ROLE = "role"; 9032var TAB_INDEX = "tabindex"; 9033var DISABLED = "disabled"; 9034var ARIA_PREFIX = "aria-"; 9035var ARIA_CONTROLS = ARIA_PREFIX + "controls"; 9036var ARIA_CURRENT = ARIA_PREFIX + "current"; 9037var ARIA_SELECTED = ARIA_PREFIX + "selected"; 9038var ARIA_LABEL = ARIA_PREFIX + "label"; 9039var ARIA_LABELLEDBY = ARIA_PREFIX + "labelledby"; 9040var ARIA_HIDDEN = ARIA_PREFIX + "hidden"; 9041var ARIA_ORIENTATION = ARIA_PREFIX + "orientation"; 9042var ARIA_ROLEDESCRIPTION = ARIA_PREFIX + "roledescription"; 9043var ARIA_LIVE = ARIA_PREFIX + "live"; 9044var ARIA_BUSY = ARIA_PREFIX + "busy"; 9045var ARIA_ATOMIC = ARIA_PREFIX + "atomic"; 9046var ALL_ATTRIBUTES = [ROLE, TAB_INDEX, DISABLED, ARIA_CONTROLS, ARIA_CURRENT, ARIA_LABEL, ARIA_LABELLEDBY, ARIA_HIDDEN, ARIA_ORIENTATION, ARIA_ROLEDESCRIPTION]; 9047var CLASS_PREFIX = PROJECT_CODE + "__"; 9048var STATUS_CLASS_PREFIX = "is-"; 9049var CLASS_ROOT = PROJECT_CODE; 9050var CLASS_TRACK = CLASS_PREFIX + "track"; 9051var CLASS_LIST = CLASS_PREFIX + "list"; 9052var CLASS_SLIDE = CLASS_PREFIX + "slide"; 9053var CLASS_CLONE = CLASS_SLIDE + "--clone"; 9054var CLASS_CONTAINER = CLASS_SLIDE + "__container"; 9055var CLASS_ARROWS = CLASS_PREFIX + "arrows"; 9056var CLASS_ARROW = CLASS_PREFIX + "arrow"; 9057var CLASS_ARROW_PREV = CLASS_ARROW + "--prev"; 9058var CLASS_ARROW_NEXT = CLASS_ARROW + "--next"; 9059var CLASS_PAGINATION = CLASS_PREFIX + "pagination"; 9060var CLASS_PAGINATION_PAGE = CLASS_PAGINATION + "__page"; 9061var CLASS_PROGRESS = CLASS_PREFIX + "progress"; 9062var CLASS_PROGRESS_BAR = CLASS_PROGRESS + "__bar"; 9063var CLASS_TOGGLE = CLASS_PREFIX + "toggle"; 9064var CLASS_TOGGLE_PLAY = CLASS_TOGGLE + "__play"; 9065var CLASS_TOGGLE_PAUSE = CLASS_TOGGLE + "__pause"; 9066var CLASS_SPINNER = CLASS_PREFIX + "spinner"; 9067var CLASS_SR = CLASS_PREFIX + "sr"; 9068var CLASS_INITIALIZED = STATUS_CLASS_PREFIX + "initialized"; 9069var CLASS_ACTIVE = STATUS_CLASS_PREFIX + "active"; 9070var CLASS_PREV = STATUS_CLASS_PREFIX + "prev"; 9071var CLASS_NEXT = STATUS_CLASS_PREFIX + "next"; 9072var CLASS_VISIBLE = STATUS_CLASS_PREFIX + "visible"; 9073var CLASS_LOADING = STATUS_CLASS_PREFIX + "loading"; 9074var CLASS_FOCUS_IN = STATUS_CLASS_PREFIX + "focus-in"; 9075var CLASS_OVERFLOW = STATUS_CLASS_PREFIX + "overflow"; 9076var STATUS_CLASSES = [CLASS_ACTIVE, CLASS_VISIBLE, CLASS_PREV, CLASS_NEXT, CLASS_LOADING, CLASS_FOCUS_IN, CLASS_OVERFLOW]; 9077var CLASSES = { 9078 slide: CLASS_SLIDE, 9079 clone: CLASS_CLONE, 9080 arrows: CLASS_ARROWS, 9081 arrow: CLASS_ARROW, 9082 prev: CLASS_ARROW_PREV, 9083 next: CLASS_ARROW_NEXT, 9084 pagination: CLASS_PAGINATION, 9085 page: CLASS_PAGINATION_PAGE, 9086 spinner: CLASS_SPINNER 9087}; 9088 9089function closest(from, selector) { 9090 if (isFunction(from.closest)) { 9091 return from.closest(selector); 9092 } 9093 9094 var elm = from; 9095 9096 while (elm && elm.nodeType === 1) { 9097 if (matches(elm, selector)) { 9098 break; 9099 } 9100 9101 elm = elm.parentElement; 9102 } 9103 9104 return elm; 9105} 9106 9107var FRICTION = 5; 9108var LOG_INTERVAL = 200; 9109var POINTER_DOWN_EVENTS = "touchstart mousedown"; 9110var POINTER_MOVE_EVENTS = "touchmove mousemove"; 9111var POINTER_UP_EVENTS = "touchend touchcancel mouseup click"; 9112 9113function Elements(Splide2, Components2, options) { 9114 var _EventInterface = EventInterface(Splide2), 9115 on = _EventInterface.on, 9116 bind = _EventInterface.bind; 9117 9118 var root = Splide2.root; 9119 var i18n = options.i18n; 9120 var elements = {}; 9121 var slides = []; 9122 var rootClasses = []; 9123 var trackClasses = []; 9124 var track; 9125 var list; 9126 var isUsingKey; 9127 9128 function setup() { 9129 collect(); 9130 init(); 9131 update(); 9132 } 9133 9134 function mount() { 9135 on(EVENT_REFRESH, destroy); 9136 on(EVENT_REFRESH, setup); 9137 on(EVENT_UPDATED, update); 9138 bind(document, POINTER_DOWN_EVENTS + " keydown", function (e) { 9139 isUsingKey = e.type === "keydown"; 9140 }, { 9141 capture: true 9142 }); 9143 bind(root, "focusin", function () { 9144 toggleClass(root, CLASS_FOCUS_IN, !!isUsingKey); 9145 }); 9146 } 9147 9148 function destroy(completely) { 9149 var attrs = ALL_ATTRIBUTES.concat("style"); 9150 empty(slides); 9151 removeClass(root, rootClasses); 9152 removeClass(track, trackClasses); 9153 removeAttribute([track, list], attrs); 9154 removeAttribute(root, completely ? attrs : ["style", ARIA_ROLEDESCRIPTION]); 9155 } 9156 9157 function update() { 9158 removeClass(root, rootClasses); 9159 removeClass(track, trackClasses); 9160 rootClasses = getClasses(CLASS_ROOT); 9161 trackClasses = getClasses(CLASS_TRACK); 9162 addClass(root, rootClasses); 9163 addClass(track, trackClasses); 9164 setAttribute(root, ARIA_LABEL, options.label); 9165 setAttribute(root, ARIA_LABELLEDBY, options.labelledby); 9166 } 9167 9168 function collect() { 9169 track = find("." + CLASS_TRACK); 9170 list = child(track, "." + CLASS_LIST); 9171 assert(track && list, "A track/list element is missing."); 9172 push(slides, children(list, "." + CLASS_SLIDE + ":not(." + CLASS_CLONE + ")")); 9173 forOwn({ 9174 arrows: CLASS_ARROWS, 9175 pagination: CLASS_PAGINATION, 9176 prev: CLASS_ARROW_PREV, 9177 next: CLASS_ARROW_NEXT, 9178 bar: CLASS_PROGRESS_BAR, 9179 toggle: CLASS_TOGGLE 9180 }, function (className, key) { 9181 elements[key] = find("." + className); 9182 }); 9183 assign(elements, { 9184 root: root, 9185 track: track, 9186 list: list, 9187 slides: slides 9188 }); 9189 } 9190 9191 function init() { 9192 var id = root.id || uniqueId(PROJECT_CODE); 9193 var role = options.role; 9194 root.id = id; 9195 track.id = track.id || id + "-track"; 9196 list.id = list.id || id + "-list"; 9197 9198 if (!getAttribute(root, ROLE) && root.tagName !== "SECTION" && role) { 9199 setAttribute(root, ROLE, role); 9200 } 9201 9202 setAttribute(root, ARIA_ROLEDESCRIPTION, i18n.carousel); 9203 setAttribute(list, ROLE, "presentation"); 9204 } 9205 9206 function find(selector) { 9207 var elm = query(root, selector); 9208 return elm && closest(elm, "." + CLASS_ROOT) === root ? elm : void 0; 9209 } 9210 9211 function getClasses(base) { 9212 return [base + "--" + options.type, base + "--" + options.direction, options.drag && base + "--draggable", options.isNavigation && base + "--nav", base === CLASS_ROOT && CLASS_ACTIVE]; 9213 } 9214 9215 return assign(elements, { 9216 setup: setup, 9217 mount: mount, 9218 destroy: destroy 9219 }); 9220} 9221 9222var SLIDE = "slide"; 9223var LOOP = "loop"; 9224var FADE = "fade"; 9225 9226function Slide$1(Splide2, index, slideIndex, slide) { 9227 var event = EventInterface(Splide2); 9228 var on = event.on, 9229 emit = event.emit, 9230 bind = event.bind; 9231 var Components = Splide2.Components, 9232 root = Splide2.root, 9233 options = Splide2.options; 9234 var isNavigation = options.isNavigation, 9235 updateOnMove = options.updateOnMove, 9236 i18n = options.i18n, 9237 pagination = options.pagination, 9238 slideFocus = options.slideFocus; 9239 var resolve = Components.Direction.resolve; 9240 var styles = getAttribute(slide, "style"); 9241 var label = getAttribute(slide, ARIA_LABEL); 9242 var isClone = slideIndex > -1; 9243 var container = child(slide, "." + CLASS_CONTAINER); 9244 var destroyed; 9245 9246 function mount() { 9247 if (!isClone) { 9248 slide.id = root.id + "-slide" + pad(index + 1); 9249 setAttribute(slide, ROLE, pagination ? "tabpanel" : "group"); 9250 setAttribute(slide, ARIA_ROLEDESCRIPTION, i18n.slide); 9251 setAttribute(slide, ARIA_LABEL, label || format(i18n.slideLabel, [index + 1, Splide2.length])); 9252 } 9253 9254 listen(); 9255 } 9256 9257 function listen() { 9258 bind(slide, "click", apply(emit, EVENT_CLICK, self)); 9259 bind(slide, "keydown", apply(emit, EVENT_SLIDE_KEYDOWN, self)); 9260 on([EVENT_MOVED, EVENT_SHIFTED, EVENT_SCROLLED], update); 9261 on(EVENT_NAVIGATION_MOUNTED, initNavigation); 9262 9263 if (updateOnMove) { 9264 on(EVENT_MOVE, onMove); 9265 } 9266 } 9267 9268 function destroy() { 9269 destroyed = true; 9270 event.destroy(); 9271 removeClass(slide, STATUS_CLASSES); 9272 removeAttribute(slide, ALL_ATTRIBUTES); 9273 setAttribute(slide, "style", styles); 9274 setAttribute(slide, ARIA_LABEL, label || ""); 9275 } 9276 9277 function initNavigation() { 9278 var controls = Splide2.splides.map(function (target) { 9279 var Slide2 = target.splide.Components.Slides.getAt(index); 9280 return Slide2 ? Slide2.slide.id : ""; 9281 }).join(" "); 9282 setAttribute(slide, ARIA_LABEL, format(i18n.slideX, (isClone ? slideIndex : index) + 1)); 9283 setAttribute(slide, ARIA_CONTROLS, controls); 9284 setAttribute(slide, ROLE, slideFocus ? "button" : ""); 9285 slideFocus && removeAttribute(slide, ARIA_ROLEDESCRIPTION); 9286 } 9287 9288 function onMove() { 9289 if (!destroyed) { 9290 update(); 9291 } 9292 } 9293 9294 function update() { 9295 if (!destroyed) { 9296 var curr = Splide2.index; 9297 updateActivity(); 9298 updateVisibility(); 9299 toggleClass(slide, CLASS_PREV, index === curr - 1); 9300 toggleClass(slide, CLASS_NEXT, index === curr + 1); 9301 } 9302 } 9303 9304 function updateActivity() { 9305 var active = isActive(); 9306 9307 if (active !== hasClass(slide, CLASS_ACTIVE)) { 9308 toggleClass(slide, CLASS_ACTIVE, active); 9309 setAttribute(slide, ARIA_CURRENT, isNavigation && active || ""); 9310 emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, self); 9311 } 9312 } 9313 9314 function updateVisibility() { 9315 var visible = isVisible(); 9316 var hidden = !visible && (!isActive() || isClone); 9317 9318 if (!Splide2.state.is([MOVING, SCROLLING])) { 9319 setAttribute(slide, ARIA_HIDDEN, hidden || ""); 9320 } 9321 9322 setAttribute(queryAll(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : ""); 9323 9324 if (slideFocus) { 9325 setAttribute(slide, TAB_INDEX, hidden ? -1 : 0); 9326 } 9327 9328 if (visible !== hasClass(slide, CLASS_VISIBLE)) { 9329 toggleClass(slide, CLASS_VISIBLE, visible); 9330 emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, self); 9331 } 9332 9333 if (!visible && document.activeElement === slide) { 9334 var Slide2 = Components.Slides.getAt(Splide2.index); 9335 Slide2 && focus(Slide2.slide); 9336 } 9337 } 9338 9339 function style$1(prop, value, useContainer) { 9340 style(useContainer && container || slide, prop, value); 9341 } 9342 9343 function isActive() { 9344 var curr = Splide2.index; 9345 return curr === index || options.cloneStatus && curr === slideIndex; 9346 } 9347 9348 function isVisible() { 9349 if (Splide2.is(FADE)) { 9350 return isActive(); 9351 } 9352 9353 var trackRect = rect(Components.Elements.track); 9354 var slideRect = rect(slide); 9355 var left = resolve("left", true); 9356 var right = resolve("right", true); 9357 return floor(trackRect[left]) <= ceil(slideRect[left]) && floor(slideRect[right]) <= ceil(trackRect[right]); 9358 } 9359 9360 function isWithin(from, distance) { 9361 var diff = abs(from - index); 9362 9363 if (!isClone && (options.rewind || Splide2.is(LOOP))) { 9364 diff = min(diff, Splide2.length - diff); 9365 } 9366 9367 return diff <= distance; 9368 } 9369 9370 var self = { 9371 index: index, 9372 slideIndex: slideIndex, 9373 slide: slide, 9374 container: container, 9375 isClone: isClone, 9376 mount: mount, 9377 destroy: destroy, 9378 update: update, 9379 style: style$1, 9380 isWithin: isWithin 9381 }; 9382 return self; 9383} 9384 9385function Slides(Splide2, Components2, options) { 9386 var _EventInterface2 = EventInterface(Splide2), 9387 on = _EventInterface2.on, 9388 emit = _EventInterface2.emit, 9389 bind = _EventInterface2.bind; 9390 9391 var _Components2$Elements = Components2.Elements, 9392 slides = _Components2$Elements.slides, 9393 list = _Components2$Elements.list; 9394 var Slides2 = []; 9395 9396 function mount() { 9397 init(); 9398 on(EVENT_REFRESH, destroy); 9399 on(EVENT_REFRESH, init); 9400 } 9401 9402 function init() { 9403 slides.forEach(function (slide, index) { 9404 register(slide, index, -1); 9405 }); 9406 } 9407 9408 function destroy() { 9409 forEach$1(function (Slide2) { 9410 Slide2.destroy(); 9411 }); 9412 empty(Slides2); 9413 } 9414 9415 function update() { 9416 forEach$1(function (Slide2) { 9417 Slide2.update(); 9418 }); 9419 } 9420 9421 function register(slide, index, slideIndex) { 9422 var object = Slide$1(Splide2, index, slideIndex, slide); 9423 object.mount(); 9424 Slides2.push(object); 9425 Slides2.sort(function (Slide1, Slide2) { 9426 return Slide1.index - Slide2.index; 9427 }); 9428 } 9429 9430 function get(excludeClones) { 9431 return excludeClones ? filter(function (Slide2) { 9432 return !Slide2.isClone; 9433 }) : Slides2; 9434 } 9435 9436 function getIn(page) { 9437 var Controller = Components2.Controller; 9438 var index = Controller.toIndex(page); 9439 var max = Controller.hasFocus() ? 1 : options.perPage; 9440 return filter(function (Slide2) { 9441 return between(Slide2.index, index, index + max - 1); 9442 }); 9443 } 9444 9445 function getAt(index) { 9446 return filter(index)[0]; 9447 } 9448 9449 function add(items, index) { 9450 forEach(items, function (slide) { 9451 if (isString(slide)) { 9452 slide = parseHtml(slide); 9453 } 9454 9455 if (isHTMLElement(slide)) { 9456 var ref = slides[index]; 9457 ref ? before(slide, ref) : append(list, slide); 9458 addClass(slide, options.classes.slide); 9459 observeImages(slide, apply(emit, EVENT_RESIZE)); 9460 } 9461 }); 9462 emit(EVENT_REFRESH); 9463 } 9464 9465 function remove$1(matcher) { 9466 remove(filter(matcher).map(function (Slide2) { 9467 return Slide2.slide; 9468 })); 9469 emit(EVENT_REFRESH); 9470 } 9471 9472 function forEach$1(iteratee, excludeClones) { 9473 get(excludeClones).forEach(iteratee); 9474 } 9475 9476 function filter(matcher) { 9477 return Slides2.filter(isFunction(matcher) ? matcher : function (Slide2) { 9478 return isString(matcher) ? matches(Slide2.slide, matcher) : includes(toArray(matcher), Slide2.index); 9479 }); 9480 } 9481 9482 function style(prop, value, useContainer) { 9483 forEach$1(function (Slide2) { 9484 Slide2.style(prop, value, useContainer); 9485 }); 9486 } 9487 9488 function observeImages(elm, callback) { 9489 var images = queryAll(elm, "img"); 9490 var length = images.length; 9491 9492 if (length) { 9493 images.forEach(function (img) { 9494 bind(img, "load error", function () { 9495 if (! --length) { 9496 callback(); 9497 } 9498 }); 9499 }); 9500 } else { 9501 callback(); 9502 } 9503 } 9504 9505 function getLength(excludeClones) { 9506 return excludeClones ? slides.length : Slides2.length; 9507 } 9508 9509 function isEnough() { 9510 return Slides2.length > options.perPage; 9511 } 9512 9513 return { 9514 mount: mount, 9515 destroy: destroy, 9516 update: update, 9517 register: register, 9518 get: get, 9519 getIn: getIn, 9520 getAt: getAt, 9521 add: add, 9522 remove: remove$1, 9523 forEach: forEach$1, 9524 filter: filter, 9525 style: style, 9526 getLength: getLength, 9527 isEnough: isEnough 9528 }; 9529} 9530 9531function Layout(Splide2, Components2, options) { 9532 var _EventInterface3 = EventInterface(Splide2), 9533 on = _EventInterface3.on, 9534 bind = _EventInterface3.bind, 9535 emit = _EventInterface3.emit; 9536 9537 var Slides = Components2.Slides; 9538 var resolve = Components2.Direction.resolve; 9539 var _Components2$Elements2 = Components2.Elements, 9540 root = _Components2$Elements2.root, 9541 track = _Components2$Elements2.track, 9542 list = _Components2$Elements2.list; 9543 var getAt = Slides.getAt, 9544 styleSlides = Slides.style; 9545 var vertical; 9546 var rootRect; 9547 var overflow; 9548 9549 function mount() { 9550 init(); 9551 bind(window, "resize load", Throttle(apply(emit, EVENT_RESIZE))); 9552 on([EVENT_UPDATED, EVENT_REFRESH], init); 9553 on(EVENT_RESIZE, resize); 9554 } 9555 9556 function init() { 9557 vertical = options.direction === TTB; 9558 style(root, "maxWidth", unit(options.width)); 9559 style(track, resolve("paddingLeft"), cssPadding(false)); 9560 style(track, resolve("paddingRight"), cssPadding(true)); 9561 resize(true); 9562 } 9563 9564 function resize(force) { 9565 var newRect = rect(root); 9566 9567 if (force || rootRect.width !== newRect.width || rootRect.height !== newRect.height) { 9568 style(track, "height", cssTrackHeight()); 9569 styleSlides(resolve("marginRight"), unit(options.gap)); 9570 styleSlides("width", cssSlideWidth()); 9571 styleSlides("height", cssSlideHeight(), true); 9572 rootRect = newRect; 9573 emit(EVENT_RESIZED); 9574 9575 if (overflow !== (overflow = isOverflow())) { 9576 toggleClass(root, CLASS_OVERFLOW, overflow); 9577 emit(EVENT_OVERFLOW, overflow); 9578 } 9579 } 9580 } 9581 9582 function cssPadding(right) { 9583 var padding = options.padding; 9584 var prop = resolve(right ? "right" : "left"); 9585 return padding && unit(padding[prop] || (isObject(padding) ? 0 : padding)) || "0px"; 9586 } 9587 9588 function cssTrackHeight() { 9589 var height = ""; 9590 9591 if (vertical) { 9592 height = cssHeight(); 9593 assert(height, "height or heightRatio is missing."); 9594 height = "calc(" + height + " - " + cssPadding(false) + " - " + cssPadding(true) + ")"; 9595 } 9596 9597 return height; 9598 } 9599 9600 function cssHeight() { 9601 return unit(options.height || rect(list).width * options.heightRatio); 9602 } 9603 9604 function cssSlideWidth() { 9605 return options.autoWidth ? null : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize()); 9606 } 9607 9608 function cssSlideHeight() { 9609 return unit(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight()); 9610 } 9611 9612 function cssSlideSize() { 9613 var gap = unit(options.gap); 9614 return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")"; 9615 } 9616 9617 function listSize() { 9618 return rect(list)[resolve("width")]; 9619 } 9620 9621 function slideSize(index, withoutGap) { 9622 var Slide = getAt(index || 0); 9623 return Slide ? rect(Slide.slide)[resolve("width")] + (withoutGap ? 0 : getGap()) : 0; 9624 } 9625 9626 function totalSize(index, withoutGap) { 9627 var Slide = getAt(index); 9628 9629 if (Slide) { 9630 var right = rect(Slide.slide)[resolve("right")]; 9631 var left = rect(list)[resolve("left")]; 9632 return abs(right - left) + (withoutGap ? 0 : getGap()); 9633 } 9634 9635 return 0; 9636 } 9637 9638 function sliderSize(withoutGap) { 9639 return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0, withoutGap); 9640 } 9641 9642 function getGap() { 9643 var Slide = getAt(0); 9644 return Slide && parseFloat(style(Slide.slide, resolve("marginRight"))) || 0; 9645 } 9646 9647 function getPadding(right) { 9648 return parseFloat(style(track, resolve("padding" + (right ? "Right" : "Left")))) || 0; 9649 } 9650 9651 function isOverflow() { 9652 return Splide2.is(FADE) || sliderSize(true) > listSize(); 9653 } 9654 9655 return { 9656 mount: mount, 9657 resize: resize, 9658 listSize: listSize, 9659 slideSize: slideSize, 9660 sliderSize: sliderSize, 9661 totalSize: totalSize, 9662 getPadding: getPadding, 9663 isOverflow: isOverflow 9664 }; 9665} 9666 9667var MULTIPLIER = 2; 9668 9669function Clones(Splide2, Components2, options) { 9670 var event = EventInterface(Splide2); 9671 var on = event.on; 9672 var Elements = Components2.Elements, 9673 Slides = Components2.Slides; 9674 var resolve = Components2.Direction.resolve; 9675 var clones = []; 9676 var cloneCount; 9677 9678 function mount() { 9679 on(EVENT_REFRESH, remount); 9680 on([EVENT_UPDATED, EVENT_RESIZE], observe); 9681 9682 if (cloneCount = computeCloneCount()) { 9683 generate(cloneCount); 9684 Components2.Layout.resize(true); 9685 } 9686 } 9687 9688 function remount() { 9689 destroy(); 9690 mount(); 9691 } 9692 9693 function destroy() { 9694 remove(clones); 9695 empty(clones); 9696 event.destroy(); 9697 } 9698 9699 function observe() { 9700 var count = computeCloneCount(); 9701 9702 if (cloneCount !== count) { 9703 if (cloneCount < count || !count) { 9704 event.emit(EVENT_REFRESH); 9705 } 9706 } 9707 } 9708 9709 function generate(count) { 9710 var slides = Slides.get().slice(); 9711 var length = slides.length; 9712 9713 if (length) { 9714 while (slides.length < count) { 9715 push(slides, slides); 9716 } 9717 9718 push(slides.slice(-count), slides.slice(0, count)).forEach(function (Slide, index) { 9719 var isHead = index < count; 9720 var clone = cloneDeep(Slide.slide, index); 9721 isHead ? before(clone, slides[0].slide) : append(Elements.list, clone); 9722 push(clones, clone); 9723 Slides.register(clone, index - count + (isHead ? 0 : length), Slide.index); 9724 }); 9725 } 9726 } 9727 9728 function cloneDeep(elm, index) { 9729 var clone = elm.cloneNode(true); 9730 addClass(clone, options.classes.clone); 9731 clone.id = Splide2.root.id + "-clone" + pad(index + 1); 9732 return clone; 9733 } 9734 9735 function computeCloneCount() { 9736 var clones2 = options.clones; 9737 9738 if (!Splide2.is(LOOP)) { 9739 clones2 = 0; 9740 } else if (isUndefined(clones2)) { 9741 var fixedSize = options[resolve("fixedWidth")] && Components2.Layout.slideSize(0); 9742 var fixedCount = fixedSize && ceil(rect(Elements.track)[resolve("width")] / fixedSize); 9743 clones2 = fixedCount || options[resolve("autoWidth")] && Splide2.length || options.perPage * MULTIPLIER; 9744 } 9745 9746 return clones2; 9747 } 9748 9749 return { 9750 mount: mount, 9751 destroy: destroy 9752 }; 9753} 9754 9755function Move(Splide2, Components2, options) { 9756 var _EventInterface4 = EventInterface(Splide2), 9757 on = _EventInterface4.on, 9758 emit = _EventInterface4.emit; 9759 9760 var set = Splide2.state.set; 9761 var _Components2$Layout = Components2.Layout, 9762 slideSize = _Components2$Layout.slideSize, 9763 getPadding = _Components2$Layout.getPadding, 9764 totalSize = _Components2$Layout.totalSize, 9765 listSize = _Components2$Layout.listSize, 9766 sliderSize = _Components2$Layout.sliderSize; 9767 var _Components2$Directio = Components2.Direction, 9768 resolve = _Components2$Directio.resolve, 9769 orient = _Components2$Directio.orient; 9770 var _Components2$Elements3 = Components2.Elements, 9771 list = _Components2$Elements3.list, 9772 track = _Components2$Elements3.track; 9773 var Transition; 9774 9775 function mount() { 9776 Transition = Components2.Transition; 9777 on([EVENT_MOUNTED, EVENT_RESIZED, EVENT_UPDATED, EVENT_REFRESH], reposition); 9778 } 9779 9780 function reposition() { 9781 if (!Components2.Controller.isBusy()) { 9782 Components2.Scroll.cancel(); 9783 jump(Splide2.index); 9784 Components2.Slides.update(); 9785 } 9786 } 9787 9788 function move(dest, index, prev, callback) { 9789 if (dest !== index && canShift(dest > prev)) { 9790 cancel(); 9791 translate(shift(getPosition(), dest > prev), true); 9792 } 9793 9794 set(MOVING); 9795 emit(EVENT_MOVE, index, prev, dest); 9796 Transition.start(index, function () { 9797 set(IDLE); 9798 emit(EVENT_MOVED, index, prev, dest); 9799 callback && callback(); 9800 }); 9801 } 9802 9803 function jump(index) { 9804 translate(toPosition(index, true)); 9805 } 9806 9807 function translate(position, preventLoop) { 9808 if (!Splide2.is(FADE)) { 9809 var destination = preventLoop ? position : loop(position); 9810 style(list, "transform", "translate" + resolve("X") + "(" + destination + "px)"); 9811 position !== destination && emit(EVENT_SHIFTED); 9812 } 9813 } 9814 9815 function loop(position) { 9816 if (Splide2.is(LOOP)) { 9817 var index = toIndex(position); 9818 var exceededMax = index > Components2.Controller.getEnd(); 9819 var exceededMin = index < 0; 9820 9821 if (exceededMin || exceededMax) { 9822 position = shift(position, exceededMax); 9823 } 9824 } 9825 9826 return position; 9827 } 9828 9829 function shift(position, backwards) { 9830 var excess = position - getLimit(backwards); 9831 var size = sliderSize(); 9832 position -= orient(size * (ceil(abs(excess) / size) || 1)) * (backwards ? 1 : -1); 9833 return position; 9834 } 9835 9836 function cancel() { 9837 translate(getPosition(), true); 9838 Transition.cancel(); 9839 } 9840 9841 function toIndex(position) { 9842 var Slides = Components2.Slides.get(); 9843 var index = 0; 9844 var minDistance = Infinity; 9845 9846 for (var i = 0; i < Slides.length; i++) { 9847 var slideIndex = Slides[i].index; 9848 var distance = abs(toPosition(slideIndex, true) - position); 9849 9850 if (distance <= minDistance) { 9851 minDistance = distance; 9852 index = slideIndex; 9853 } else { 9854 break; 9855 } 9856 } 9857 9858 return index; 9859 } 9860 9861 function toPosition(index, trimming) { 9862 var position = orient(totalSize(index - 1) - offset(index)); 9863 return trimming ? trim(position) : position; 9864 } 9865 9866 function getPosition() { 9867 var left = resolve("left"); 9868 return rect(list)[left] - rect(track)[left] + orient(getPadding(false)); 9869 } 9870 9871 function trim(position) { 9872 if (options.trimSpace && Splide2.is(SLIDE)) { 9873 position = clamp(position, 0, orient(sliderSize(true) - listSize())); 9874 } 9875 9876 return position; 9877 } 9878 9879 function offset(index) { 9880 var focus = options.focus; 9881 return focus === "center" ? (listSize() - slideSize(index, true)) / 2 : +focus * slideSize(index) || 0; 9882 } 9883 9884 function getLimit(max) { 9885 return toPosition(max ? Components2.Controller.getEnd() : 0, !!options.trimSpace); 9886 } 9887 9888 function canShift(backwards) { 9889 var shifted = orient(shift(getPosition(), backwards)); 9890 return backwards ? shifted >= 0 : shifted <= list[resolve("scrollWidth")] - rect(track)[resolve("width")]; 9891 } 9892 9893 function exceededLimit(max, position) { 9894 position = isUndefined(position) ? getPosition() : position; 9895 var exceededMin = max !== true && orient(position) < orient(getLimit(false)); 9896 var exceededMax = max !== false && orient(position) > orient(getLimit(true)); 9897 return exceededMin || exceededMax; 9898 } 9899 9900 return { 9901 mount: mount, 9902 move: move, 9903 jump: jump, 9904 translate: translate, 9905 shift: shift, 9906 cancel: cancel, 9907 toIndex: toIndex, 9908 toPosition: toPosition, 9909 getPosition: getPosition, 9910 getLimit: getLimit, 9911 exceededLimit: exceededLimit, 9912 reposition: reposition 9913 }; 9914} 9915 9916function Controller(Splide2, Components2, options) { 9917 var _EventInterface5 = EventInterface(Splide2), 9918 on = _EventInterface5.on, 9919 emit = _EventInterface5.emit; 9920 9921 var Move = Components2.Move; 9922 var getPosition = Move.getPosition, 9923 getLimit = Move.getLimit, 9924 toPosition = Move.toPosition; 9925 var _Components2$Slides = Components2.Slides, 9926 isEnough = _Components2$Slides.isEnough, 9927 getLength = _Components2$Slides.getLength; 9928 var omitEnd = options.omitEnd; 9929 var isLoop = Splide2.is(LOOP); 9930 var isSlide = Splide2.is(SLIDE); 9931 var getNext = apply(getAdjacent, false); 9932 var getPrev = apply(getAdjacent, true); 9933 var currIndex = options.start || 0; 9934 var endIndex; 9935 var prevIndex = currIndex; 9936 var slideCount; 9937 var perMove; 9938 var perPage; 9939 9940 function mount() { 9941 init(); 9942 on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], init); 9943 on(EVENT_RESIZED, onResized); 9944 } 9945 9946 function init() { 9947 slideCount = getLength(true); 9948 perMove = options.perMove; 9949 perPage = options.perPage; 9950 endIndex = getEnd(); 9951 var index = clamp(currIndex, 0, omitEnd ? endIndex : slideCount - 1); 9952 9953 if (index !== currIndex) { 9954 currIndex = index; 9955 Move.reposition(); 9956 } 9957 } 9958 9959 function onResized() { 9960 if (endIndex !== getEnd()) { 9961 emit(EVENT_END_INDEX_CHANGED); 9962 } 9963 } 9964 9965 function go(control, allowSameIndex, callback) { 9966 if (!isBusy()) { 9967 var dest = parse(control); 9968 var index = loop(dest); 9969 9970 if (index > -1 && (allowSameIndex || index !== currIndex)) { 9971 setIndex(index); 9972 Move.move(dest, index, prevIndex, callback); 9973 } 9974 } 9975 } 9976 9977 function scroll(destination, duration, snap, callback) { 9978 Components2.Scroll.scroll(destination, duration, snap, function () { 9979 var index = loop(Move.toIndex(getPosition())); 9980 setIndex(omitEnd ? min(index, endIndex) : index); 9981 callback && callback(); 9982 }); 9983 } 9984 9985 function parse(control) { 9986 var index = currIndex; 9987 9988 if (isString(control)) { 9989 var _ref = control.match(/([+\-<>])(\d+)?/) || [], 9990 indicator = _ref[1], 9991 number = _ref[2]; 9992 9993 if (indicator === "+" || indicator === "-") { 9994 index = computeDestIndex(currIndex + +("" + indicator + (+number || 1)), currIndex); 9995 } else if (indicator === ">") { 9996 index = number ? toIndex(+number) : getNext(true); 9997 } else if (indicator === "<") { 9998 index = getPrev(true); 9999 } 10000 } else { 10001 index = isLoop ? control : clamp(control, 0, endIndex); 10002 } 10003 10004 return index; 10005 } 10006 10007 function getAdjacent(prev, destination) { 10008 var number = perMove || (hasFocus() ? 1 : perPage); 10009 var dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex, !(perMove || hasFocus())); 10010 10011 if (dest === -1 && isSlide) { 10012 if (!approximatelyEqual(getPosition(), getLimit(!prev), 1)) { 10013 return prev ? 0 : endIndex; 10014 } 10015 } 10016 10017 return destination ? dest : loop(dest); 10018 } 10019 10020 function computeDestIndex(dest, from, snapPage) { 10021 if (isEnough() || hasFocus()) { 10022 var index = computeMovableDestIndex(dest); 10023 10024 if (index !== dest) { 10025 from = dest; 10026 dest = index; 10027 snapPage = false; 10028 } 10029 10030 if (dest < 0 || dest > endIndex) { 10031 if (!perMove && (between(0, dest, from, true) || between(endIndex, from, dest, true))) { 10032 dest = toIndex(toPage(dest)); 10033 } else { 10034 if (isLoop) { 10035 dest = snapPage ? dest < 0 ? -(slideCount % perPage || perPage) : slideCount : dest; 10036 } else if (options.rewind) { 10037 dest = dest < 0 ? endIndex : 0; 10038 } else { 10039 dest = -1; 10040 } 10041 } 10042 } else { 10043 if (snapPage && dest !== from) { 10044 dest = toIndex(toPage(from) + (dest < from ? -1 : 1)); 10045 } 10046 } 10047 } else { 10048 dest = -1; 10049 } 10050 10051 return dest; 10052 } 10053 10054 function computeMovableDestIndex(dest) { 10055 if (isSlide && options.trimSpace === "move" && dest !== currIndex) { 10056 var position = getPosition(); 10057 10058 while (position === toPosition(dest, true) && between(dest, 0, Splide2.length - 1, !options.rewind)) { 10059 dest < currIndex ? --dest : ++dest; 10060 } 10061 } 10062 10063 return dest; 10064 } 10065 10066 function loop(index) { 10067 return isLoop ? (index + slideCount) % slideCount || 0 : index; 10068 } 10069 10070 function getEnd() { 10071 var end = slideCount - (hasFocus() || isLoop && perMove ? 1 : perPage); 10072 10073 while (omitEnd && end-- > 0) { 10074 if (toPosition(slideCount - 1, true) !== toPosition(end, true)) { 10075 end++; 10076 break; 10077 } 10078 } 10079 10080 return clamp(end, 0, slideCount - 1); 10081 } 10082 10083 function toIndex(page) { 10084 return clamp(hasFocus() ? page : perPage * page, 0, endIndex); 10085 } 10086 10087 function toPage(index) { 10088 return hasFocus() ? min(index, endIndex) : floor((index >= endIndex ? slideCount - 1 : index) / perPage); 10089 } 10090 10091 function toDest(destination) { 10092 var closest = Move.toIndex(destination); 10093 return isSlide ? clamp(closest, 0, endIndex) : closest; 10094 } 10095 10096 function setIndex(index) { 10097 if (index !== currIndex) { 10098 prevIndex = currIndex; 10099 currIndex = index; 10100 } 10101 } 10102 10103 function getIndex(prev) { 10104 return prev ? prevIndex : currIndex; 10105 } 10106 10107 function hasFocus() { 10108 return !isUndefined(options.focus) || options.isNavigation; 10109 } 10110 10111 function isBusy() { 10112 return Splide2.state.is([MOVING, SCROLLING]) && !!options.waitForTransition; 10113 } 10114 10115 return { 10116 mount: mount, 10117 go: go, 10118 scroll: scroll, 10119 getNext: getNext, 10120 getPrev: getPrev, 10121 getAdjacent: getAdjacent, 10122 getEnd: getEnd, 10123 setIndex: setIndex, 10124 getIndex: getIndex, 10125 toIndex: toIndex, 10126 toPage: toPage, 10127 toDest: toDest, 10128 hasFocus: hasFocus, 10129 isBusy: isBusy 10130 }; 10131} 10132 10133var XML_NAME_SPACE = "http://www.w3.org/2000/svg"; 10134var PATH = "m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z"; 10135var SIZE = 40; 10136 10137function Arrows(Splide2, Components2, options) { 10138 var event = EventInterface(Splide2); 10139 var on = event.on, 10140 bind = event.bind, 10141 emit = event.emit; 10142 var classes = options.classes, 10143 i18n = options.i18n; 10144 var Elements = Components2.Elements, 10145 Controller = Components2.Controller; 10146 var placeholder = Elements.arrows, 10147 track = Elements.track; 10148 var wrapper = placeholder; 10149 var prev = Elements.prev; 10150 var next = Elements.next; 10151 var created; 10152 var wrapperClasses; 10153 var arrows = {}; 10154 10155 function mount() { 10156 init(); 10157 on(EVENT_UPDATED, remount); 10158 } 10159 10160 function remount() { 10161 destroy(); 10162 mount(); 10163 } 10164 10165 function init() { 10166 var enabled = options.arrows; 10167 10168 if (enabled && !(prev && next)) { 10169 createArrows(); 10170 } 10171 10172 if (prev && next) { 10173 assign(arrows, { 10174 prev: prev, 10175 next: next 10176 }); 10177 display(wrapper, enabled ? "" : "none"); 10178 addClass(wrapper, wrapperClasses = CLASS_ARROWS + "--" + options.direction); 10179 10180 if (enabled) { 10181 listen(); 10182 update(); 10183 setAttribute([prev, next], ARIA_CONTROLS, track.id); 10184 emit(EVENT_ARROWS_MOUNTED, prev, next); 10185 } 10186 } 10187 } 10188 10189 function destroy() { 10190 event.destroy(); 10191 removeClass(wrapper, wrapperClasses); 10192 10193 if (created) { 10194 remove(placeholder ? [prev, next] : wrapper); 10195 prev = next = null; 10196 } else { 10197 removeAttribute([prev, next], ALL_ATTRIBUTES); 10198 } 10199 } 10200 10201 function listen() { 10202 on([EVENT_MOUNTED, EVENT_MOVED, EVENT_REFRESH, EVENT_SCROLLED, EVENT_END_INDEX_CHANGED], update); 10203 bind(next, "click", apply(go, ">")); 10204 bind(prev, "click", apply(go, "<")); 10205 } 10206 10207 function go(control) { 10208 Controller.go(control, true); 10209 } 10210 10211 function createArrows() { 10212 wrapper = placeholder || create("div", classes.arrows); 10213 prev = createArrow(true); 10214 next = createArrow(false); 10215 created = true; 10216 append(wrapper, [prev, next]); 10217 !placeholder && before(wrapper, track); 10218 } 10219 10220 function createArrow(prev2) { 10221 var arrow = "<button class=\"" + classes.arrow + " " + (prev2 ? classes.prev : classes.next) + "\" type=\"button\"><svg xmlns=\"" + XML_NAME_SPACE + "\" viewBox=\"0 0 " + SIZE + " " + SIZE + "\" width=\"" + SIZE + "\" height=\"" + SIZE + "\" focusable=\"false\"><path d=\"" + (options.arrowPath || PATH) + "\" />"; 10222 return parseHtml(arrow); 10223 } 10224 10225 function update() { 10226 if (prev && next) { 10227 var index = Splide2.index; 10228 var prevIndex = Controller.getPrev(); 10229 var nextIndex = Controller.getNext(); 10230 var prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev; 10231 var nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next; 10232 prev.disabled = prevIndex < 0; 10233 next.disabled = nextIndex < 0; 10234 setAttribute(prev, ARIA_LABEL, prevLabel); 10235 setAttribute(next, ARIA_LABEL, nextLabel); 10236 emit(EVENT_ARROWS_UPDATED, prev, next, prevIndex, nextIndex); 10237 } 10238 } 10239 10240 return { 10241 arrows: arrows, 10242 mount: mount, 10243 destroy: destroy, 10244 update: update 10245 }; 10246} 10247 10248var INTERVAL_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-interval"; 10249 10250function Autoplay(Splide2, Components2, options) { 10251 var _EventInterface6 = EventInterface(Splide2), 10252 on = _EventInterface6.on, 10253 bind = _EventInterface6.bind, 10254 emit = _EventInterface6.emit; 10255 10256 var interval = RequestInterval(options.interval, Splide2.go.bind(Splide2, ">"), onAnimationFrame); 10257 var isPaused = interval.isPaused; 10258 var Elements = Components2.Elements, 10259 _Components2$Elements4 = Components2.Elements, 10260 root = _Components2$Elements4.root, 10261 toggle = _Components2$Elements4.toggle; 10262 var autoplay = options.autoplay; 10263 var hovered; 10264 var focused; 10265 var stopped = autoplay === "pause"; 10266 10267 function mount() { 10268 if (autoplay) { 10269 listen(); 10270 toggle && setAttribute(toggle, ARIA_CONTROLS, Elements.track.id); 10271 stopped || play(); 10272 update(); 10273 } 10274 } 10275 10276 function listen() { 10277 if (options.pauseOnHover) { 10278 bind(root, "mouseenter mouseleave", function (e) { 10279 hovered = e.type === "mouseenter"; 10280 autoToggle(); 10281 }); 10282 } 10283 10284 if (options.pauseOnFocus) { 10285 bind(root, "focusin focusout", function (e) { 10286 focused = e.type === "focusin"; 10287 autoToggle(); 10288 }); 10289 } 10290 10291 if (toggle) { 10292 bind(toggle, "click", function () { 10293 stopped ? play() : pause(true); 10294 }); 10295 } 10296 10297 on([EVENT_MOVE, EVENT_SCROLL, EVENT_REFRESH], interval.rewind); 10298 on(EVENT_MOVE, onMove); 10299 } 10300 10301 function play() { 10302 if (isPaused() && Components2.Slides.isEnough()) { 10303 interval.start(!options.resetProgress); 10304 focused = hovered = stopped = false; 10305 update(); 10306 emit(EVENT_AUTOPLAY_PLAY); 10307 } 10308 } 10309 10310 function pause(stop) { 10311 if (stop === void 0) { 10312 stop = true; 10313 } 10314 10315 stopped = !!stop; 10316 update(); 10317 10318 if (!isPaused()) { 10319 interval.pause(); 10320 emit(EVENT_AUTOPLAY_PAUSE); 10321 } 10322 } 10323 10324 function autoToggle() { 10325 if (!stopped) { 10326 hovered || focused ? pause(false) : play(); 10327 } 10328 } 10329 10330 function update() { 10331 if (toggle) { 10332 toggleClass(toggle, CLASS_ACTIVE, !stopped); 10333 setAttribute(toggle, ARIA_LABEL, options.i18n[stopped ? "play" : "pause"]); 10334 } 10335 } 10336 10337 function onAnimationFrame(rate) { 10338 var bar = Elements.bar; 10339 bar && style(bar, "width", rate * 100 + "%"); 10340 emit(EVENT_AUTOPLAY_PLAYING, rate); 10341 } 10342 10343 function onMove(index) { 10344 var Slide = Components2.Slides.getAt(index); 10345 interval.set(Slide && +getAttribute(Slide.slide, INTERVAL_DATA_ATTRIBUTE) || options.interval); 10346 } 10347 10348 return { 10349 mount: mount, 10350 destroy: interval.cancel, 10351 play: play, 10352 pause: pause, 10353 isPaused: isPaused 10354 }; 10355} 10356 10357function Cover(Splide2, Components2, options) { 10358 var _EventInterface7 = EventInterface(Splide2), 10359 on = _EventInterface7.on; 10360 10361 function mount() { 10362 if (options.cover) { 10363 on(EVENT_LAZYLOAD_LOADED, apply(toggle, true)); 10364 on([EVENT_MOUNTED, EVENT_UPDATED, EVENT_REFRESH], apply(cover, true)); 10365 } 10366 } 10367 10368 function cover(cover2) { 10369 Components2.Slides.forEach(function (Slide) { 10370 var img = child(Slide.container || Slide.slide, "img"); 10371 10372 if (img && img.src) { 10373 toggle(cover2, img, Slide); 10374 } 10375 }); 10376 } 10377 10378 function toggle(cover2, img, Slide) { 10379 Slide.style("background", cover2 ? "center/cover no-repeat url(\"" + img.src + "\")" : "", true); 10380 display(img, cover2 ? "none" : ""); 10381 } 10382 10383 return { 10384 mount: mount, 10385 destroy: apply(cover, false) 10386 }; 10387} 10388 10389var BOUNCE_DIFF_THRESHOLD = 10; 10390var BOUNCE_DURATION = 600; 10391var FRICTION_FACTOR = 0.6; 10392var BASE_VELOCITY = 1.5; 10393var MIN_DURATION = 800; 10394 10395function Scroll(Splide2, Components2, options) { 10396 var _EventInterface8 = EventInterface(Splide2), 10397 on = _EventInterface8.on, 10398 emit = _EventInterface8.emit; 10399 10400 var set = Splide2.state.set; 10401 var Move = Components2.Move; 10402 var getPosition = Move.getPosition, 10403 getLimit = Move.getLimit, 10404 exceededLimit = Move.exceededLimit, 10405 translate = Move.translate; 10406 var isSlide = Splide2.is(SLIDE); 10407 var interval; 10408 var callback; 10409 var friction = 1; 10410 10411 function mount() { 10412 on(EVENT_MOVE, clear); 10413 on([EVENT_UPDATED, EVENT_REFRESH], cancel); 10414 } 10415 10416 function scroll(destination, duration, snap, onScrolled, noConstrain) { 10417 var from = getPosition(); 10418 clear(); 10419 10420 if (snap && (!isSlide || !exceededLimit())) { 10421 var size = Components2.Layout.sliderSize(); 10422 var offset = sign(destination) * size * floor(abs(destination) / size) || 0; 10423 destination = Move.toPosition(Components2.Controller.toDest(destination % size)) + offset; 10424 } 10425 10426 var noDistance = approximatelyEqual(from, destination, 1); 10427 friction = 1; 10428 duration = noDistance ? 0 : duration || max(abs(destination - from) / BASE_VELOCITY, MIN_DURATION); 10429 callback = onScrolled; 10430 interval = RequestInterval(duration, onEnd, apply(update, from, destination, noConstrain), 1); 10431 set(SCROLLING); 10432 emit(EVENT_SCROLL); 10433 interval.start(); 10434 } 10435 10436 function onEnd() { 10437 set(IDLE); 10438 callback && callback(); 10439 emit(EVENT_SCROLLED); 10440 } 10441 10442 function update(from, to, noConstrain, rate) { 10443 var position = getPosition(); 10444 var target = from + (to - from) * easing(rate); 10445 var diff = (target - position) * friction; 10446 translate(position + diff); 10447 10448 if (isSlide && !noConstrain && exceededLimit()) { 10449 friction *= FRICTION_FACTOR; 10450 10451 if (abs(diff) < BOUNCE_DIFF_THRESHOLD) { 10452 scroll(getLimit(exceededLimit(true)), BOUNCE_DURATION, false, callback, true); 10453 } 10454 } 10455 } 10456 10457 function clear() { 10458 if (interval) { 10459 interval.cancel(); 10460 } 10461 } 10462 10463 function cancel() { 10464 if (interval && !interval.isPaused()) { 10465 clear(); 10466 onEnd(); 10467 } 10468 } 10469 10470 function easing(t) { 10471 var easingFunc = options.easingFunc; 10472 return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4); 10473 } 10474 10475 return { 10476 mount: mount, 10477 destroy: clear, 10478 scroll: scroll, 10479 cancel: cancel 10480 }; 10481} 10482 10483var SCROLL_LISTENER_OPTIONS = { 10484 passive: false, 10485 capture: true 10486}; 10487 10488function Drag(Splide2, Components2, options) { 10489 var _EventInterface9 = EventInterface(Splide2), 10490 on = _EventInterface9.on, 10491 emit = _EventInterface9.emit, 10492 bind = _EventInterface9.bind, 10493 unbind = _EventInterface9.unbind; 10494 10495 var state = Splide2.state; 10496 var Move = Components2.Move, 10497 Scroll = Components2.Scroll, 10498 Controller = Components2.Controller, 10499 track = Components2.Elements.track, 10500 reduce = Components2.Media.reduce; 10501 var _Components2$Directio2 = Components2.Direction, 10502 resolve = _Components2$Directio2.resolve, 10503 orient = _Components2$Directio2.orient; 10504 var getPosition = Move.getPosition, 10505 exceededLimit = Move.exceededLimit; 10506 var basePosition; 10507 var baseEvent; 10508 var prevBaseEvent; 10509 var isFree; 10510 var dragging; 10511 var exceeded = false; 10512 var clickPrevented; 10513 var disabled; 10514 var target; 10515 10516 function mount() { 10517 bind(track, POINTER_MOVE_EVENTS, noop, SCROLL_LISTENER_OPTIONS); 10518 bind(track, POINTER_UP_EVENTS, noop, SCROLL_LISTENER_OPTIONS); 10519 bind(track, POINTER_DOWN_EVENTS, onPointerDown, SCROLL_LISTENER_OPTIONS); 10520 bind(track, "click", onClick, { 10521 capture: true 10522 }); 10523 bind(track, "dragstart", prevent); 10524 on([EVENT_MOUNTED, EVENT_UPDATED], init); 10525 } 10526 10527 function init() { 10528 var drag = options.drag; 10529 disable(!drag); 10530 isFree = drag === "free"; 10531 } 10532 10533 function onPointerDown(e) { 10534 clickPrevented = false; 10535 10536 if (!disabled) { 10537 var isTouch = isTouchEvent(e); 10538 10539 if (isDraggable(e.target) && (isTouch || !e.button)) { 10540 if (!Controller.isBusy()) { 10541 target = isTouch ? track : window; 10542 dragging = state.is([MOVING, SCROLLING]); 10543 prevBaseEvent = null; 10544 bind(target, POINTER_MOVE_EVENTS, onPointerMove, SCROLL_LISTENER_OPTIONS); 10545 bind(target, POINTER_UP_EVENTS, onPointerUp, SCROLL_LISTENER_OPTIONS); 10546 Move.cancel(); 10547 Scroll.cancel(); 10548 save(e); 10549 } else { 10550 prevent(e, true); 10551 } 10552 } 10553 } 10554 } 10555 10556 function onPointerMove(e) { 10557 if (!state.is(DRAGGING)) { 10558 state.set(DRAGGING); 10559 emit(EVENT_DRAG); 10560 } 10561 10562 if (e.cancelable) { 10563 if (dragging) { 10564 Move.translate(basePosition + constrain(diffCoord(e))); 10565 var expired = diffTime(e) > LOG_INTERVAL; 10566 var hasExceeded = exceeded !== (exceeded = exceededLimit()); 10567 10568 if (expired || hasExceeded) { 10569 save(e); 10570 } 10571 10572 clickPrevented = true; 10573 emit(EVENT_DRAGGING); 10574 prevent(e); 10575 } else if (isSliderDirection(e)) { 10576 dragging = shouldStart(e); 10577 prevent(e); 10578 } 10579 } 10580 } 10581 10582 function onPointerUp(e) { 10583 if (state.is(DRAGGING)) { 10584 state.set(IDLE); 10585 emit(EVENT_DRAGGED); 10586 } 10587 10588 if (dragging) { 10589 move(e); 10590 prevent(e); 10591 } 10592 10593 unbind(target, POINTER_MOVE_EVENTS, onPointerMove); 10594 unbind(target, POINTER_UP_EVENTS, onPointerUp); 10595 dragging = false; 10596 } 10597 10598 function onClick(e) { 10599 if (!disabled && clickPrevented) { 10600 prevent(e, true); 10601 } 10602 } 10603 10604 function save(e) { 10605 prevBaseEvent = baseEvent; 10606 baseEvent = e; 10607 basePosition = getPosition(); 10608 } 10609 10610 function move(e) { 10611 var velocity = computeVelocity(e); 10612 var destination = computeDestination(velocity); 10613 var rewind = options.rewind && options.rewindByDrag; 10614 reduce(false); 10615 10616 if (isFree) { 10617 Controller.scroll(destination, 0, options.snap); 10618 } else if (Splide2.is(FADE)) { 10619 Controller.go(orient(sign(velocity)) < 0 ? rewind ? "<" : "-" : rewind ? ">" : "+"); 10620 } else if (Splide2.is(SLIDE) && exceeded && rewind) { 10621 Controller.go(exceededLimit(true) ? ">" : "<"); 10622 } else { 10623 Controller.go(Controller.toDest(destination), true); 10624 } 10625 10626 reduce(true); 10627 } 10628 10629 function shouldStart(e) { 10630 var thresholds = options.dragMinThreshold; 10631 var isObj = isObject(thresholds); 10632 var mouse = isObj && thresholds.mouse || 0; 10633 var touch = (isObj ? thresholds.touch : +thresholds) || 10; 10634 return abs(diffCoord(e)) > (isTouchEvent(e) ? touch : mouse); 10635 } 10636 10637 function isSliderDirection(e) { 10638 return abs(diffCoord(e)) > abs(diffCoord(e, true)); 10639 } 10640 10641 function computeVelocity(e) { 10642 if (Splide2.is(LOOP) || !exceeded) { 10643 var time = diffTime(e); 10644 10645 if (time && time < LOG_INTERVAL) { 10646 return diffCoord(e) / time; 10647 } 10648 } 10649 10650 return 0; 10651 } 10652 10653 function computeDestination(velocity) { 10654 return getPosition() + sign(velocity) * min(abs(velocity) * (options.flickPower || 600), isFree ? Infinity : Components2.Layout.listSize() * (options.flickMaxPages || 1)); 10655 } 10656 10657 function diffCoord(e, orthogonal) { 10658 return coordOf(e, orthogonal) - coordOf(getBaseEvent(e), orthogonal); 10659 } 10660 10661 function diffTime(e) { 10662 return timeOf(e) - timeOf(getBaseEvent(e)); 10663 } 10664 10665 function getBaseEvent(e) { 10666 return baseEvent === e && prevBaseEvent || baseEvent; 10667 } 10668 10669 function coordOf(e, orthogonal) { 10670 return (isTouchEvent(e) ? e.changedTouches[0] : e)["page" + resolve(orthogonal ? "Y" : "X")]; 10671 } 10672 10673 function constrain(diff) { 10674 return diff / (exceeded && Splide2.is(SLIDE) ? FRICTION : 1); 10675 } 10676 10677 function isDraggable(target2) { 10678 var noDrag = options.noDrag; 10679 return !matches(target2, "." + CLASS_PAGINATION_PAGE + ", ." + CLASS_ARROW) && (!noDrag || !matches(target2, noDrag)); 10680 } 10681 10682 function isTouchEvent(e) { 10683 return typeof TouchEvent !== "undefined" && e instanceof TouchEvent; 10684 } 10685 10686 function isDragging() { 10687 return dragging; 10688 } 10689 10690 function disable(value) { 10691 disabled = value; 10692 } 10693 10694 return { 10695 mount: mount, 10696 disable: disable, 10697 isDragging: isDragging 10698 }; 10699} 10700 10701var NORMALIZATION_MAP = { 10702 Spacebar: " ", 10703 Right: ARROW_RIGHT, 10704 Left: ARROW_LEFT, 10705 Up: ARROW_UP, 10706 Down: ARROW_DOWN 10707}; 10708 10709function normalizeKey(key) { 10710 key = isString(key) ? key : key.key; 10711 return NORMALIZATION_MAP[key] || key; 10712} 10713 10714var KEYBOARD_EVENT = "keydown"; 10715 10716function Keyboard(Splide2, Components2, options) { 10717 var _EventInterface10 = EventInterface(Splide2), 10718 on = _EventInterface10.on, 10719 bind = _EventInterface10.bind, 10720 unbind = _EventInterface10.unbind; 10721 10722 var root = Splide2.root; 10723 var resolve = Components2.Direction.resolve; 10724 var target; 10725 var disabled; 10726 10727 function mount() { 10728 init(); 10729 on(EVENT_UPDATED, destroy); 10730 on(EVENT_UPDATED, init); 10731 on(EVENT_MOVE, onMove); 10732 } 10733 10734 function init() { 10735 var keyboard = options.keyboard; 10736 10737 if (keyboard) { 10738 target = keyboard === "global" ? window : root; 10739 bind(target, KEYBOARD_EVENT, onKeydown); 10740 } 10741 } 10742 10743 function destroy() { 10744 unbind(target, KEYBOARD_EVENT); 10745 } 10746 10747 function disable(value) { 10748 disabled = value; 10749 } 10750 10751 function onMove() { 10752 var _disabled = disabled; 10753 disabled = true; 10754 nextTick(function () { 10755 disabled = _disabled; 10756 }); 10757 } 10758 10759 function onKeydown(e) { 10760 if (!disabled) { 10761 var key = normalizeKey(e); 10762 10763 if (key === resolve(ARROW_LEFT)) { 10764 Splide2.go("<"); 10765 } else if (key === resolve(ARROW_RIGHT)) { 10766 Splide2.go(">"); 10767 } 10768 } 10769 } 10770 10771 return { 10772 mount: mount, 10773 destroy: destroy, 10774 disable: disable 10775 }; 10776} 10777 10778var SRC_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-lazy"; 10779var SRCSET_DATA_ATTRIBUTE = SRC_DATA_ATTRIBUTE + "-srcset"; 10780var IMAGE_SELECTOR = "[" + SRC_DATA_ATTRIBUTE + "], [" + SRCSET_DATA_ATTRIBUTE + "]"; 10781 10782function LazyLoad(Splide2, Components2, options) { 10783 var _EventInterface11 = EventInterface(Splide2), 10784 on = _EventInterface11.on, 10785 off = _EventInterface11.off, 10786 bind = _EventInterface11.bind, 10787 emit = _EventInterface11.emit; 10788 10789 var isSequential = options.lazyLoad === "sequential"; 10790 var events = [EVENT_MOVED, EVENT_SCROLLED]; 10791 var entries = []; 10792 10793 function mount() { 10794 if (options.lazyLoad) { 10795 init(); 10796 on(EVENT_REFRESH, init); 10797 } 10798 } 10799 10800 function init() { 10801 empty(entries); 10802 register(); 10803 10804 if (isSequential) { 10805 loadNext(); 10806 } else { 10807 off(events); 10808 on(events, check); 10809 check(); 10810 } 10811 } 10812 10813 function register() { 10814 Components2.Slides.forEach(function (Slide) { 10815 queryAll(Slide.slide, IMAGE_SELECTOR).forEach(function (img) { 10816 var src = getAttribute(img, SRC_DATA_ATTRIBUTE); 10817 var srcset = getAttribute(img, SRCSET_DATA_ATTRIBUTE); 10818 10819 if (src !== img.src || srcset !== img.srcset) { 10820 var className = options.classes.spinner; 10821 var parent = img.parentElement; 10822 var spinner = child(parent, "." + className) || create("span", className, parent); 10823 entries.push([img, Slide, spinner]); 10824 img.src || display(img, "none"); 10825 } 10826 }); 10827 }); 10828 } 10829 10830 function check() { 10831 entries = entries.filter(function (data) { 10832 var distance = options.perPage * ((options.preloadPages || 1) + 1) - 1; 10833 return data[1].isWithin(Splide2.index, distance) ? load(data) : true; 10834 }); 10835 entries.length || off(events); 10836 } 10837 10838 function load(data) { 10839 var img = data[0]; 10840 addClass(data[1].slide, CLASS_LOADING); 10841 bind(img, "load error", apply(onLoad, data)); 10842 setAttribute(img, "src", getAttribute(img, SRC_DATA_ATTRIBUTE)); 10843 setAttribute(img, "srcset", getAttribute(img, SRCSET_DATA_ATTRIBUTE)); 10844 removeAttribute(img, SRC_DATA_ATTRIBUTE); 10845 removeAttribute(img, SRCSET_DATA_ATTRIBUTE); 10846 } 10847 10848 function onLoad(data, e) { 10849 var img = data[0], 10850 Slide = data[1]; 10851 removeClass(Slide.slide, CLASS_LOADING); 10852 10853 if (e.type !== "error") { 10854 remove(data[2]); 10855 display(img, ""); 10856 emit(EVENT_LAZYLOAD_LOADED, img, Slide); 10857 emit(EVENT_RESIZE); 10858 } 10859 10860 isSequential && loadNext(); 10861 } 10862 10863 function loadNext() { 10864 entries.length && load(entries.shift()); 10865 } 10866 10867 return { 10868 mount: mount, 10869 destroy: apply(empty, entries), 10870 check: check 10871 }; 10872} 10873 10874function Pagination(Splide2, Components2, options) { 10875 var event = EventInterface(Splide2); 10876 var on = event.on, 10877 emit = event.emit, 10878 bind = event.bind; 10879 var Slides = Components2.Slides, 10880 Elements = Components2.Elements, 10881 Controller = Components2.Controller; 10882 var hasFocus = Controller.hasFocus, 10883 getIndex = Controller.getIndex, 10884 go = Controller.go; 10885 var resolve = Components2.Direction.resolve; 10886 var placeholder = Elements.pagination; 10887 var items = []; 10888 var list; 10889 var paginationClasses; 10890 10891 function mount() { 10892 destroy(); 10893 on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], mount); 10894 var enabled = options.pagination; 10895 placeholder && display(placeholder, enabled ? "" : "none"); 10896 10897 if (enabled) { 10898 on([EVENT_MOVE, EVENT_SCROLL, EVENT_SCROLLED], update); 10899 createPagination(); 10900 update(); 10901 emit(EVENT_PAGINATION_MOUNTED, { 10902 list: list, 10903 items: items 10904 }, getAt(Splide2.index)); 10905 } 10906 } 10907 10908 function destroy() { 10909 if (list) { 10910 remove(placeholder ? slice(list.children) : list); 10911 removeClass(list, paginationClasses); 10912 empty(items); 10913 list = null; 10914 } 10915 10916 event.destroy(); 10917 } 10918 10919 function createPagination() { 10920 var length = Splide2.length; 10921 var classes = options.classes, 10922 i18n = options.i18n, 10923 perPage = options.perPage; 10924 var max = hasFocus() ? Controller.getEnd() + 1 : ceil(length / perPage); 10925 list = placeholder || create("ul", classes.pagination, Elements.track.parentElement); 10926 addClass(list, paginationClasses = CLASS_PAGINATION + "--" + getDirection()); 10927 setAttribute(list, ROLE, "tablist"); 10928 setAttribute(list, ARIA_LABEL, i18n.select); 10929 setAttribute(list, ARIA_ORIENTATION, getDirection() === TTB ? "vertical" : ""); 10930 10931 for (var i = 0; i < max; i++) { 10932 var li = create("li", null, list); 10933 var button = create("button", { 10934 class: classes.page, 10935 type: "button" 10936 }, li); 10937 var controls = Slides.getIn(i).map(function (Slide) { 10938 return Slide.slide.id; 10939 }); 10940 var text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX; 10941 bind(button, "click", apply(onClick, i)); 10942 10943 if (options.paginationKeyboard) { 10944 bind(button, "keydown", apply(onKeydown, i)); 10945 } 10946 10947 setAttribute(li, ROLE, "presentation"); 10948 setAttribute(button, ROLE, "tab"); 10949 setAttribute(button, ARIA_CONTROLS, controls.join(" ")); 10950 setAttribute(button, ARIA_LABEL, format(text, i + 1)); 10951 setAttribute(button, TAB_INDEX, -1); 10952 items.push({ 10953 li: li, 10954 button: button, 10955 page: i 10956 }); 10957 } 10958 } 10959 10960 function onClick(page) { 10961 go(">" + page, true); 10962 } 10963 10964 function onKeydown(page, e) { 10965 var length = items.length; 10966 var key = normalizeKey(e); 10967 var dir = getDirection(); 10968 var nextPage = -1; 10969 10970 if (key === resolve(ARROW_RIGHT, false, dir)) { 10971 nextPage = ++page % length; 10972 } else if (key === resolve(ARROW_LEFT, false, dir)) { 10973 nextPage = (--page + length) % length; 10974 } else if (key === "Home") { 10975 nextPage = 0; 10976 } else if (key === "End") { 10977 nextPage = length - 1; 10978 } 10979 10980 var item = items[nextPage]; 10981 10982 if (item) { 10983 focus(item.button); 10984 go(">" + nextPage); 10985 prevent(e, true); 10986 } 10987 } 10988 10989 function getDirection() { 10990 return options.paginationDirection || options.direction; 10991 } 10992 10993 function getAt(index) { 10994 return items[Controller.toPage(index)]; 10995 } 10996 10997 function update() { 10998 var prev = getAt(getIndex(true)); 10999 var curr = getAt(getIndex()); 11000 11001 if (prev) { 11002 var button = prev.button; 11003 removeClass(button, CLASS_ACTIVE); 11004 removeAttribute(button, ARIA_SELECTED); 11005 setAttribute(button, TAB_INDEX, -1); 11006 } 11007 11008 if (curr) { 11009 var _button = curr.button; 11010 addClass(_button, CLASS_ACTIVE); 11011 setAttribute(_button, ARIA_SELECTED, true); 11012 setAttribute(_button, TAB_INDEX, ""); 11013 } 11014 11015 emit(EVENT_PAGINATION_UPDATED, { 11016 list: list, 11017 items: items 11018 }, prev, curr); 11019 } 11020 11021 return { 11022 items: items, 11023 mount: mount, 11024 destroy: destroy, 11025 getAt: getAt, 11026 update: update 11027 }; 11028} 11029 11030var TRIGGER_KEYS = [" ", "Enter"]; 11031 11032function Sync(Splide2, Components2, options) { 11033 var isNavigation = options.isNavigation, 11034 slideFocus = options.slideFocus; 11035 var events = []; 11036 11037 function mount() { 11038 Splide2.splides.forEach(function (target) { 11039 if (!target.isParent) { 11040 sync(Splide2, target.splide); 11041 sync(target.splide, Splide2); 11042 } 11043 }); 11044 11045 if (isNavigation) { 11046 navigate(); 11047 } 11048 } 11049 11050 function destroy() { 11051 events.forEach(function (event) { 11052 event.destroy(); 11053 }); 11054 empty(events); 11055 } 11056 11057 function remount() { 11058 destroy(); 11059 mount(); 11060 } 11061 11062 function sync(splide, target) { 11063 var event = EventInterface(splide); 11064 event.on(EVENT_MOVE, function (index, prev, dest) { 11065 target.go(target.is(LOOP) ? dest : index); 11066 }); 11067 events.push(event); 11068 } 11069 11070 function navigate() { 11071 var event = EventInterface(Splide2); 11072 var on = event.on; 11073 on(EVENT_CLICK, onClick); 11074 on(EVENT_SLIDE_KEYDOWN, onKeydown); 11075 on([EVENT_MOUNTED, EVENT_UPDATED], update); 11076 events.push(event); 11077 event.emit(EVENT_NAVIGATION_MOUNTED, Splide2.splides); 11078 } 11079 11080 function update() { 11081 setAttribute(Components2.Elements.list, ARIA_ORIENTATION, options.direction === TTB ? "vertical" : ""); 11082 } 11083 11084 function onClick(Slide) { 11085 Splide2.go(Slide.index); 11086 } 11087 11088 function onKeydown(Slide, e) { 11089 if (includes(TRIGGER_KEYS, normalizeKey(e))) { 11090 onClick(Slide); 11091 prevent(e); 11092 } 11093 } 11094 11095 return { 11096 setup: apply(Components2.Media.set, { 11097 slideFocus: isUndefined(slideFocus) ? isNavigation : slideFocus 11098 }, true), 11099 mount: mount, 11100 destroy: destroy, 11101 remount: remount 11102 }; 11103} 11104 11105function Wheel(Splide2, Components2, options) { 11106 var _EventInterface12 = EventInterface(Splide2), 11107 bind = _EventInterface12.bind; 11108 11109 var lastTime = 0; 11110 11111 function mount() { 11112 if (options.wheel) { 11113 bind(Components2.Elements.track, "wheel", onWheel, SCROLL_LISTENER_OPTIONS); 11114 } 11115 } 11116 11117 function onWheel(e) { 11118 if (e.cancelable) { 11119 var deltaY = e.deltaY; 11120 var backwards = deltaY < 0; 11121 var timeStamp = timeOf(e); 11122 11123 var _min = options.wheelMinThreshold || 0; 11124 11125 var sleep = options.wheelSleep || 0; 11126 11127 if (abs(deltaY) > _min && timeStamp - lastTime > sleep) { 11128 Splide2.go(backwards ? "<" : ">"); 11129 lastTime = timeStamp; 11130 } 11131 11132 shouldPrevent(backwards) && prevent(e); 11133 } 11134 } 11135 11136 function shouldPrevent(backwards) { 11137 return !options.releaseWheel || Splide2.state.is(MOVING) || Components2.Controller.getAdjacent(backwards) !== -1; 11138 } 11139 11140 return { 11141 mount: mount 11142 }; 11143} 11144 11145var SR_REMOVAL_DELAY = 90; 11146 11147function Live(Splide2, Components2, options) { 11148 var _EventInterface13 = EventInterface(Splide2), 11149 on = _EventInterface13.on; 11150 11151 var track = Components2.Elements.track; 11152 var enabled = options.live && !options.isNavigation; 11153 var sr = create("span", CLASS_SR); 11154 var interval = RequestInterval(SR_REMOVAL_DELAY, apply(toggle, false)); 11155 11156 function mount() { 11157 if (enabled) { 11158 disable(!Components2.Autoplay.isPaused()); 11159 setAttribute(track, ARIA_ATOMIC, true); 11160 sr.textContent = "\u2026"; 11161 on(EVENT_AUTOPLAY_PLAY, apply(disable, true)); 11162 on(EVENT_AUTOPLAY_PAUSE, apply(disable, false)); 11163 on([EVENT_MOVED, EVENT_SCROLLED], apply(toggle, true)); 11164 } 11165 } 11166 11167 function toggle(active) { 11168 setAttribute(track, ARIA_BUSY, active); 11169 11170 if (active) { 11171 append(track, sr); 11172 interval.start(); 11173 } else { 11174 remove(sr); 11175 interval.cancel(); 11176 } 11177 } 11178 11179 function destroy() { 11180 removeAttribute(track, [ARIA_LIVE, ARIA_ATOMIC, ARIA_BUSY]); 11181 remove(sr); 11182 } 11183 11184 function disable(disabled) { 11185 if (enabled) { 11186 setAttribute(track, ARIA_LIVE, disabled ? "off" : "polite"); 11187 } 11188 } 11189 11190 return { 11191 mount: mount, 11192 disable: disable, 11193 destroy: destroy 11194 }; 11195} 11196 11197var ComponentConstructors = /*#__PURE__*/Object.freeze({ 11198 __proto__: null, 11199 Media: Media, 11200 Direction: Direction, 11201 Elements: Elements, 11202 Slides: Slides, 11203 Layout: Layout, 11204 Clones: Clones, 11205 Move: Move, 11206 Controller: Controller, 11207 Arrows: Arrows, 11208 Autoplay: Autoplay, 11209 Cover: Cover, 11210 Scroll: Scroll, 11211 Drag: Drag, 11212 Keyboard: Keyboard, 11213 LazyLoad: LazyLoad, 11214 Pagination: Pagination, 11215 Sync: Sync, 11216 Wheel: Wheel, 11217 Live: Live 11218}); 11219var I18N = { 11220 prev: "Previous slide", 11221 next: "Next slide", 11222 first: "Go to first slide", 11223 last: "Go to last slide", 11224 slideX: "Go to slide %s", 11225 pageX: "Go to page %s", 11226 play: "Start autoplay", 11227 pause: "Pause autoplay", 11228 carousel: "carousel", 11229 slide: "slide", 11230 select: "Select a slide to show", 11231 slideLabel: "%s of %s" 11232}; 11233var DEFAULTS = { 11234 type: "slide", 11235 role: "region", 11236 speed: 400, 11237 perPage: 1, 11238 cloneStatus: true, 11239 arrows: true, 11240 pagination: true, 11241 paginationKeyboard: true, 11242 interval: 5e3, 11243 pauseOnHover: true, 11244 pauseOnFocus: true, 11245 resetProgress: true, 11246 easing: "cubic-bezier(0.25, 1, 0.5, 1)", 11247 drag: true, 11248 direction: "ltr", 11249 trimSpace: true, 11250 focusableNodes: "a, button, textarea, input, select, iframe", 11251 live: true, 11252 classes: CLASSES, 11253 i18n: I18N, 11254 reducedMotion: { 11255 speed: 0, 11256 rewindSpeed: 0, 11257 autoplay: "pause" 11258 } 11259}; 11260 11261function Fade(Splide2, Components2, options) { 11262 var Slides = Components2.Slides; 11263 11264 function mount() { 11265 EventInterface(Splide2).on([EVENT_MOUNTED, EVENT_REFRESH], init); 11266 } 11267 11268 function init() { 11269 Slides.forEach(function (Slide) { 11270 Slide.style("transform", "translateX(-" + 100 * Slide.index + "%)"); 11271 }); 11272 } 11273 11274 function start(index, done) { 11275 Slides.style("transition", "opacity " + options.speed + "ms " + options.easing); 11276 nextTick(done); 11277 } 11278 11279 return { 11280 mount: mount, 11281 start: start, 11282 cancel: noop 11283 }; 11284} 11285 11286function Slide(Splide2, Components2, options) { 11287 var Move = Components2.Move, 11288 Controller = Components2.Controller, 11289 Scroll = Components2.Scroll; 11290 var list = Components2.Elements.list; 11291 var transition = apply(style, list, "transition"); 11292 var endCallback; 11293 11294 function mount() { 11295 EventInterface(Splide2).bind(list, "transitionend", function (e) { 11296 if (e.target === list && endCallback) { 11297 cancel(); 11298 endCallback(); 11299 } 11300 }); 11301 } 11302 11303 function start(index, done) { 11304 var destination = Move.toPosition(index, true); 11305 var position = Move.getPosition(); 11306 var speed = getSpeed(index); 11307 11308 if (abs(destination - position) >= 1 && speed >= 1) { 11309 if (options.useScroll) { 11310 Scroll.scroll(destination, speed, false, done); 11311 } else { 11312 transition("transform " + speed + "ms " + options.easing); 11313 Move.translate(destination, true); 11314 endCallback = done; 11315 } 11316 } else { 11317 Move.jump(index); 11318 done(); 11319 } 11320 } 11321 11322 function cancel() { 11323 transition(""); 11324 Scroll.cancel(); 11325 } 11326 11327 function getSpeed(index) { 11328 var rewindSpeed = options.rewindSpeed; 11329 11330 if (Splide2.is(SLIDE) && rewindSpeed) { 11331 var prev = Controller.getIndex(true); 11332 var end = Controller.getEnd(); 11333 11334 if (prev === 0 && index >= end || prev >= end && index === 0) { 11335 return rewindSpeed; 11336 } 11337 } 11338 11339 return options.speed; 11340 } 11341 11342 return { 11343 mount: mount, 11344 start: start, 11345 cancel: cancel 11346 }; 11347} 11348 11349var _Splide = /*#__PURE__*/function () { 11350 function _Splide(target, options) { 11351 this.event = EventInterface(); 11352 this.Components = {}; 11353 this.state = State(CREATED); 11354 this.splides = []; 11355 this._o = {}; 11356 this._E = {}; 11357 var root = isString(target) ? query(document, target) : target; 11358 assert(root, root + " is invalid."); 11359 this.root = root; 11360 options = merge({ 11361 label: getAttribute(root, ARIA_LABEL) || "", 11362 labelledby: getAttribute(root, ARIA_LABELLEDBY) || "" 11363 }, DEFAULTS, _Splide.defaults, options || {}); 11364 11365 try { 11366 merge(options, JSON.parse(getAttribute(root, DATA_ATTRIBUTE))); 11367 } catch (e) { 11368 assert(false, "Invalid JSON"); 11369 } 11370 11371 this._o = Object.create(merge({}, options)); 11372 } 11373 11374 var _proto = _Splide.prototype; 11375 11376 _proto.mount = function mount(Extensions, Transition) { 11377 var _this = this; 11378 11379 var state = this.state, 11380 Components2 = this.Components; 11381 assert(state.is([CREATED, DESTROYED]), "Already mounted!"); 11382 state.set(CREATED); 11383 this._C = Components2; 11384 this._T = Transition || this._T || (this.is(FADE) ? Fade : Slide); 11385 this._E = Extensions || this._E; 11386 var Constructors = assign({}, ComponentConstructors, this._E, { 11387 Transition: this._T 11388 }); 11389 forOwn(Constructors, function (Component, key) { 11390 var component = Component(_this, Components2, _this._o); 11391 Components2[key] = component; 11392 component.setup && component.setup(); 11393 }); 11394 forOwn(Components2, function (component) { 11395 component.mount && component.mount(); 11396 }); 11397 this.emit(EVENT_MOUNTED); 11398 addClass(this.root, CLASS_INITIALIZED); 11399 state.set(IDLE); 11400 this.emit(EVENT_READY); 11401 return this; 11402 }; 11403 11404 _proto.sync = function sync(splide) { 11405 this.splides.push({ 11406 splide: splide 11407 }); 11408 splide.splides.push({ 11409 splide: this, 11410 isParent: true 11411 }); 11412 11413 if (this.state.is(IDLE)) { 11414 this._C.Sync.remount(); 11415 11416 splide.Components.Sync.remount(); 11417 } 11418 11419 return this; 11420 }; 11421 11422 _proto.go = function go(control) { 11423 this._C.Controller.go(control); 11424 11425 return this; 11426 }; 11427 11428 _proto.on = function on(events, callback) { 11429 this.event.on(events, callback); 11430 return this; 11431 }; 11432 11433 _proto.off = function off(events) { 11434 this.event.off(events); 11435 return this; 11436 }; 11437 11438 _proto.emit = function emit(event) { 11439 var _this$event; 11440 11441 (_this$event = this.event).emit.apply(_this$event, [event].concat(slice(arguments, 1))); 11442 11443 return this; 11444 }; 11445 11446 _proto.add = function add(slides, index) { 11447 this._C.Slides.add(slides, index); 11448 11449 return this; 11450 }; 11451 11452 _proto.remove = function remove(matcher) { 11453 this._C.Slides.remove(matcher); 11454 11455 return this; 11456 }; 11457 11458 _proto.is = function is(type) { 11459 return this._o.type === type; 11460 }; 11461 11462 _proto.refresh = function refresh() { 11463 this.emit(EVENT_REFRESH); 11464 return this; 11465 }; 11466 11467 _proto.destroy = function destroy(completely) { 11468 if (completely === void 0) { 11469 completely = true; 11470 } 11471 11472 var event = this.event, 11473 state = this.state; 11474 11475 if (state.is(CREATED)) { 11476 EventInterface(this).on(EVENT_READY, this.destroy.bind(this, completely)); 11477 } else { 11478 forOwn(this._C, function (component) { 11479 component.destroy && component.destroy(completely); 11480 }, true); 11481 event.emit(EVENT_DESTROY); 11482 event.destroy(); 11483 completely && empty(this.splides); 11484 state.set(DESTROYED); 11485 } 11486 11487 return this; 11488 }; 11489 11490 _createClass(_Splide, [{ 11491 key: "options", 11492 get: function get() { 11493 return this._o; 11494 }, 11495 set: function set(options) { 11496 this._C.Media.set(options, true, true); 11497 } 11498 }, { 11499 key: "length", 11500 get: function get() { 11501 return this._C.Slides.getLength(true); 11502 } 11503 }, { 11504 key: "index", 11505 get: function get() { 11506 return this._C.Controller.getIndex(); 11507 } 11508 }]); 11509 11510 return _Splide; 11511}(); 11512 11513var Splide = _Splide; 11514Splide.defaults = {}; 11515Splide.STATES = STATES; 11516var CLASS_RENDERED = "is-rendered"; 11517var RENDERER_DEFAULT_CONFIG = { 11518 listTag: "ul", 11519 slideTag: "li" 11520}; 11521 11522var Style = /*#__PURE__*/function () { 11523 function Style(id, options) { 11524 this.styles = {}; 11525 this.id = id; 11526 this.options = options; 11527 } 11528 11529 var _proto2 = Style.prototype; 11530 11531 _proto2.rule = function rule(selector, prop, value, breakpoint) { 11532 breakpoint = breakpoint || "default"; 11533 var selectors = this.styles[breakpoint] = this.styles[breakpoint] || {}; 11534 var styles = selectors[selector] = selectors[selector] || {}; 11535 styles[prop] = value; 11536 }; 11537 11538 _proto2.build = function build() { 11539 var _this2 = this; 11540 11541 var css = ""; 11542 11543 if (this.styles.default) { 11544 css += this.buildSelectors(this.styles.default); 11545 } 11546 11547 Object.keys(this.styles).sort(function (n, m) { 11548 return _this2.options.mediaQuery === "min" ? +n - +m : +m - +n; 11549 }).forEach(function (breakpoint) { 11550 if (breakpoint !== "default") { 11551 css += "@media screen and (max-width: " + breakpoint + "px) {"; 11552 css += _this2.buildSelectors(_this2.styles[breakpoint]); 11553 css += "}"; 11554 } 11555 }); 11556 return css; 11557 }; 11558 11559 _proto2.buildSelectors = function buildSelectors(selectors) { 11560 var _this3 = this; 11561 11562 var css = ""; 11563 forOwn(selectors, function (styles, selector) { 11564 selector = ("#" + _this3.id + " " + selector).trim(); 11565 css += selector + " {"; 11566 forOwn(styles, function (value, prop) { 11567 if (value || value === 0) { 11568 css += prop + ": " + value + ";"; 11569 } 11570 }); 11571 css += "}"; 11572 }); 11573 return css; 11574 }; 11575 11576 return Style; 11577}(); 11578 11579var SplideRenderer = /*#__PURE__*/function () { 11580 function SplideRenderer(contents, options, config, defaults) { 11581 this.slides = []; 11582 this.options = {}; 11583 this.breakpoints = []; 11584 merge(DEFAULTS, defaults || {}); 11585 merge(merge(this.options, DEFAULTS), options || {}); 11586 this.contents = contents; 11587 this.config = assign({}, RENDERER_DEFAULT_CONFIG, config || {}); 11588 this.id = this.config.id || uniqueId("splide"); 11589 this.Style = new Style(this.id, this.options); 11590 this.Direction = Direction(null, null, this.options); 11591 assert(this.contents.length, "Provide at least 1 content."); 11592 this.init(); 11593 } 11594 11595 SplideRenderer.clean = function clean(splide) { 11596 var _EventInterface14 = EventInterface(splide), 11597 on = _EventInterface14.on; 11598 11599 var root = splide.root; 11600 var clones = queryAll(root, "." + CLASS_CLONE); 11601 on(EVENT_MOUNTED, function () { 11602 remove(child(root, "style")); 11603 }); 11604 remove(clones); 11605 }; 11606 11607 var _proto3 = SplideRenderer.prototype; 11608 11609 _proto3.init = function init() { 11610 this.parseBreakpoints(); 11611 this.initSlides(); 11612 this.registerRootStyles(); 11613 this.registerTrackStyles(); 11614 this.registerSlideStyles(); 11615 this.registerListStyles(); 11616 }; 11617 11618 _proto3.initSlides = function initSlides() { 11619 var _this4 = this; 11620 11621 push(this.slides, this.contents.map(function (content, index) { 11622 content = isString(content) ? { 11623 html: content 11624 } : content; 11625 content.styles = content.styles || {}; 11626 content.attrs = content.attrs || {}; 11627 11628 _this4.cover(content); 11629 11630 var classes = _this4.options.classes.slide + " " + (index === 0 ? CLASS_ACTIVE : ""); 11631 assign(content.attrs, { 11632 class: (classes + " " + (content.attrs.class || "")).trim(), 11633 style: _this4.buildStyles(content.styles) 11634 }); 11635 return content; 11636 })); 11637 11638 if (this.isLoop()) { 11639 this.generateClones(this.slides); 11640 } 11641 }; 11642 11643 _proto3.registerRootStyles = function registerRootStyles() { 11644 var _this5 = this; 11645 11646 this.breakpoints.forEach(function (_ref2) { 11647 var width = _ref2[0], 11648 options = _ref2[1]; 11649 11650 _this5.Style.rule(" ", "max-width", unit(options.width), width); 11651 }); 11652 }; 11653 11654 _proto3.registerTrackStyles = function registerTrackStyles() { 11655 var _this6 = this; 11656 11657 var Style2 = this.Style; 11658 var selector = "." + CLASS_TRACK; 11659 this.breakpoints.forEach(function (_ref3) { 11660 var width = _ref3[0], 11661 options = _ref3[1]; 11662 Style2.rule(selector, _this6.resolve("paddingLeft"), _this6.cssPadding(options, false), width); 11663 Style2.rule(selector, _this6.resolve("paddingRight"), _this6.cssPadding(options, true), width); 11664 Style2.rule(selector, "height", _this6.cssTrackHeight(options), width); 11665 }); 11666 }; 11667 11668 _proto3.registerListStyles = function registerListStyles() { 11669 var _this7 = this; 11670 11671 var Style2 = this.Style; 11672 var selector = "." + CLASS_LIST; 11673 this.breakpoints.forEach(function (_ref4) { 11674 var width = _ref4[0], 11675 options = _ref4[1]; 11676 Style2.rule(selector, "transform", _this7.buildTranslate(options), width); 11677 11678 if (!_this7.cssSlideHeight(options)) { 11679 Style2.rule(selector, "aspect-ratio", _this7.cssAspectRatio(options), width); 11680 } 11681 }); 11682 }; 11683 11684 _proto3.registerSlideStyles = function registerSlideStyles() { 11685 var _this8 = this; 11686 11687 var Style2 = this.Style; 11688 var selector = "." + CLASS_SLIDE; 11689 this.breakpoints.forEach(function (_ref5) { 11690 var width = _ref5[0], 11691 options = _ref5[1]; 11692 Style2.rule(selector, "width", _this8.cssSlideWidth(options), width); 11693 Style2.rule(selector, "height", _this8.cssSlideHeight(options) || "100%", width); 11694 Style2.rule(selector, _this8.resolve("marginRight"), unit(options.gap) || "0px", width); 11695 Style2.rule(selector + " > img", "display", options.cover ? "none" : "inline", width); 11696 }); 11697 }; 11698 11699 _proto3.buildTranslate = function buildTranslate(options) { 11700 var _this$Direction = this.Direction, 11701 resolve = _this$Direction.resolve, 11702 orient = _this$Direction.orient; 11703 var values = []; 11704 values.push(this.cssOffsetClones(options)); 11705 values.push(this.cssOffsetGaps(options)); 11706 11707 if (this.isCenter(options)) { 11708 values.push(this.buildCssValue(orient(-50), "%")); 11709 values.push.apply(values, this.cssOffsetCenter(options)); 11710 } 11711 11712 return values.filter(Boolean).map(function (value) { 11713 return "translate" + resolve("X") + "(" + value + ")"; 11714 }).join(" "); 11715 }; 11716 11717 _proto3.cssOffsetClones = function cssOffsetClones(options) { 11718 var _this$Direction2 = this.Direction, 11719 resolve = _this$Direction2.resolve, 11720 orient = _this$Direction2.orient; 11721 var cloneCount = this.getCloneCount(); 11722 11723 if (this.isFixedWidth(options)) { 11724 var _this$parseCssValue = this.parseCssValue(options[resolve("fixedWidth")]), 11725 value = _this$parseCssValue.value, 11726 unit2 = _this$parseCssValue.unit; 11727 11728 return this.buildCssValue(orient(value) * cloneCount, unit2); 11729 } 11730 11731 var percent = 100 * cloneCount / options.perPage; 11732 return orient(percent) + "%"; 11733 }; 11734 11735 _proto3.cssOffsetCenter = function cssOffsetCenter(options) { 11736 var _this$Direction3 = this.Direction, 11737 resolve = _this$Direction3.resolve, 11738 orient = _this$Direction3.orient; 11739 11740 if (this.isFixedWidth(options)) { 11741 var _this$parseCssValue2 = this.parseCssValue(options[resolve("fixedWidth")]), 11742 value = _this$parseCssValue2.value, 11743 unit2 = _this$parseCssValue2.unit; 11744 11745 return [this.buildCssValue(orient(value / 2), unit2)]; 11746 } 11747 11748 var values = []; 11749 var perPage = options.perPage, 11750 gap = options.gap; 11751 values.push(orient(50 / perPage) + "%"); 11752 11753 if (gap) { 11754 var _this$parseCssValue3 = this.parseCssValue(gap), 11755 _value = _this$parseCssValue3.value, 11756 _unit = _this$parseCssValue3.unit; 11757 11758 var gapOffset = (_value / perPage - _value) / 2; 11759 values.push(this.buildCssValue(orient(gapOffset), _unit)); 11760 } 11761 11762 return values; 11763 }; 11764 11765 _proto3.cssOffsetGaps = function cssOffsetGaps(options) { 11766 var cloneCount = this.getCloneCount(); 11767 11768 if (cloneCount && options.gap) { 11769 var orient = this.Direction.orient; 11770 11771 var _this$parseCssValue4 = this.parseCssValue(options.gap), 11772 value = _this$parseCssValue4.value, 11773 unit2 = _this$parseCssValue4.unit; 11774 11775 if (this.isFixedWidth(options)) { 11776 return this.buildCssValue(orient(value * cloneCount), unit2); 11777 } 11778 11779 var perPage = options.perPage; 11780 var gaps = cloneCount / perPage; 11781 return this.buildCssValue(orient(gaps * value), unit2); 11782 } 11783 11784 return ""; 11785 }; 11786 11787 _proto3.resolve = function resolve(prop) { 11788 return camelToKebab(this.Direction.resolve(prop)); 11789 }; 11790 11791 _proto3.cssPadding = function cssPadding(options, right) { 11792 var padding = options.padding; 11793 var prop = this.Direction.resolve(right ? "right" : "left", true); 11794 return padding && unit(padding[prop] || (isObject(padding) ? 0 : padding)) || "0px"; 11795 }; 11796 11797 _proto3.cssTrackHeight = function cssTrackHeight(options) { 11798 var height = ""; 11799 11800 if (this.isVertical()) { 11801 height = this.cssHeight(options); 11802 assert(height, '"height" is missing.'); 11803 height = "calc(" + height + " - " + this.cssPadding(options, false) + " - " + this.cssPadding(options, true) + ")"; 11804 } 11805 11806 return height; 11807 }; 11808 11809 _proto3.cssHeight = function cssHeight(options) { 11810 return unit(options.height); 11811 }; 11812 11813 _proto3.cssSlideWidth = function cssSlideWidth(options) { 11814 return options.autoWidth ? "" : unit(options.fixedWidth) || (this.isVertical() ? "" : this.cssSlideSize(options)); 11815 }; 11816 11817 _proto3.cssSlideHeight = function cssSlideHeight(options) { 11818 return unit(options.fixedHeight) || (this.isVertical() ? options.autoHeight ? "" : this.cssSlideSize(options) : this.cssHeight(options)); 11819 }; 11820 11821 _proto3.cssSlideSize = function cssSlideSize(options) { 11822 var gap = unit(options.gap); 11823 return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")"; 11824 }; 11825 11826 _proto3.cssAspectRatio = function cssAspectRatio(options) { 11827 var heightRatio = options.heightRatio; 11828 return heightRatio ? "" + 1 / heightRatio : ""; 11829 }; 11830 11831 _proto3.buildCssValue = function buildCssValue(value, unit2) { 11832 return "" + value + unit2; 11833 }; 11834 11835 _proto3.parseCssValue = function parseCssValue(value) { 11836 if (isString(value)) { 11837 var number = parseFloat(value) || 0; 11838 var unit2 = value.replace(/\d*(\.\d*)?/, "") || "px"; 11839 return { 11840 value: number, 11841 unit: unit2 11842 }; 11843 } 11844 11845 return { 11846 value: value, 11847 unit: "px" 11848 }; 11849 }; 11850 11851 _proto3.parseBreakpoints = function parseBreakpoints() { 11852 var _this9 = this; 11853 11854 var breakpoints = this.options.breakpoints; 11855 this.breakpoints.push(["default", this.options]); 11856 11857 if (breakpoints) { 11858 forOwn(breakpoints, function (options, width) { 11859 _this9.breakpoints.push([width, merge(merge({}, _this9.options), options)]); 11860 }); 11861 } 11862 }; 11863 11864 _proto3.isFixedWidth = function isFixedWidth(options) { 11865 return !!options[this.Direction.resolve("fixedWidth")]; 11866 }; 11867 11868 _proto3.isLoop = function isLoop() { 11869 return this.options.type === LOOP; 11870 }; 11871 11872 _proto3.isCenter = function isCenter(options) { 11873 if (options.focus === "center") { 11874 if (this.isLoop()) { 11875 return true; 11876 } 11877 11878 if (this.options.type === SLIDE) { 11879 return !this.options.trimSpace; 11880 } 11881 } 11882 11883 return false; 11884 }; 11885 11886 _proto3.isVertical = function isVertical() { 11887 return this.options.direction === TTB; 11888 }; 11889 11890 _proto3.buildClasses = function buildClasses() { 11891 var options = this.options; 11892 return [CLASS_ROOT, CLASS_ROOT + "--" + options.type, CLASS_ROOT + "--" + options.direction, options.drag && CLASS_ROOT + "--draggable", options.isNavigation && CLASS_ROOT + "--nav", CLASS_ACTIVE, !this.config.hidden && CLASS_RENDERED].filter(Boolean).join(" "); 11893 }; 11894 11895 _proto3.buildAttrs = function buildAttrs(attrs) { 11896 var attr = ""; 11897 forOwn(attrs, function (value, key) { 11898 attr += value ? " " + camelToKebab(key) + "=\"" + value + "\"" : ""; 11899 }); 11900 return attr.trim(); 11901 }; 11902 11903 _proto3.buildStyles = function buildStyles(styles) { 11904 var style = ""; 11905 forOwn(styles, function (value, key) { 11906 style += " " + camelToKebab(key) + ":" + value + ";"; 11907 }); 11908 return style.trim(); 11909 }; 11910 11911 _proto3.renderSlides = function renderSlides() { 11912 var _this10 = this; 11913 11914 var tag = this.config.slideTag; 11915 return this.slides.map(function (content) { 11916 return "<" + tag + " " + _this10.buildAttrs(content.attrs) + ">" + (content.html || "") + "</" + tag + ">"; 11917 }).join(""); 11918 }; 11919 11920 _proto3.cover = function cover(content) { 11921 var styles = content.styles, 11922 _content$html = content.html, 11923 html = _content$html === void 0 ? "" : _content$html; 11924 11925 if (this.options.cover && !this.options.lazyLoad) { 11926 var src = html.match(/<img.*?src\s*=\s*(['"])(.+?)\1.*?>/); 11927 11928 if (src && src[2]) { 11929 styles.background = "center/cover no-repeat url('" + src[2] + "')"; 11930 } 11931 } 11932 }; 11933 11934 _proto3.generateClones = function generateClones(contents) { 11935 var classes = this.options.classes; 11936 var count = this.getCloneCount(); 11937 var slides = contents.slice(); 11938 11939 while (slides.length < count) { 11940 push(slides, slides); 11941 } 11942 11943 push(slides.slice(-count).reverse(), slides.slice(0, count)).forEach(function (content, index) { 11944 var attrs = assign({}, content.attrs, { 11945 class: content.attrs.class + " " + classes.clone 11946 }); 11947 var clone = assign({}, content, { 11948 attrs: attrs 11949 }); 11950 index < count ? contents.unshift(clone) : contents.push(clone); 11951 }); 11952 }; 11953 11954 _proto3.getCloneCount = function getCloneCount() { 11955 if (this.isLoop()) { 11956 var options = this.options; 11957 11958 if (options.clones) { 11959 return options.clones; 11960 } 11961 11962 var perPage = max.apply(void 0, this.breakpoints.map(function (_ref6) { 11963 var options2 = _ref6[1]; 11964 return options2.perPage; 11965 })); 11966 return perPage * ((options.flickMaxPages || 1) + 1); 11967 } 11968 11969 return 0; 11970 }; 11971 11972 _proto3.renderArrows = function renderArrows() { 11973 var html = ""; 11974 html += "<div class=\"" + this.options.classes.arrows + "\">"; 11975 html += this.renderArrow(true); 11976 html += this.renderArrow(false); 11977 html += "</div>"; 11978 return html; 11979 }; 11980 11981 _proto3.renderArrow = function renderArrow(prev) { 11982 var _this$options = this.options, 11983 classes = _this$options.classes, 11984 i18n = _this$options.i18n; 11985 var attrs = { 11986 class: classes.arrow + " " + (prev ? classes.prev : classes.next), 11987 type: "button", 11988 ariaLabel: prev ? i18n.prev : i18n.next 11989 }; 11990 return "<button " + this.buildAttrs(attrs) + "><svg xmlns=\"" + XML_NAME_SPACE + "\" viewBox=\"0 0 " + SIZE + " " + SIZE + "\" width=\"" + SIZE + "\" height=\"" + SIZE + "\"><path d=\"" + (this.options.arrowPath || PATH) + "\" /></svg></button>"; 11991 }; 11992 11993 _proto3.html = function html() { 11994 var _this$config = this.config, 11995 rootClass = _this$config.rootClass, 11996 listTag = _this$config.listTag, 11997 arrows = _this$config.arrows, 11998 beforeTrack = _this$config.beforeTrack, 11999 afterTrack = _this$config.afterTrack, 12000 slider = _this$config.slider, 12001 beforeSlider = _this$config.beforeSlider, 12002 afterSlider = _this$config.afterSlider; 12003 var html = ""; 12004 html += "<div id=\"" + this.id + "\" class=\"" + this.buildClasses() + " " + (rootClass || "") + "\">"; 12005 html += "<style>" + this.Style.build() + "</style>"; 12006 12007 if (slider) { 12008 html += beforeSlider || ""; 12009 html += "<div class=\"splide__slider\">"; 12010 } 12011 12012 html += beforeTrack || ""; 12013 12014 if (arrows) { 12015 html += this.renderArrows(); 12016 } 12017 12018 html += "<div class=\"splide__track\">"; 12019 html += "<" + listTag + " class=\"splide__list\">"; 12020 html += this.renderSlides(); 12021 html += "</" + listTag + ">"; 12022 html += "</div>"; 12023 html += afterTrack || ""; 12024 12025 if (slider) { 12026 html += "</div>"; 12027 html += afterSlider || ""; 12028 } 12029 12030 html += "</div>"; 12031 return html; 12032 }; 12033 12034 return SplideRenderer; 12035}(); 12036 12037exports.CLASSES = CLASSES; 12038exports.CLASS_ACTIVE = CLASS_ACTIVE; 12039exports.CLASS_ARROW = CLASS_ARROW; 12040exports.CLASS_ARROWS = CLASS_ARROWS; 12041exports.CLASS_ARROW_NEXT = CLASS_ARROW_NEXT; 12042exports.CLASS_ARROW_PREV = CLASS_ARROW_PREV; 12043exports.CLASS_CLONE = CLASS_CLONE; 12044exports.CLASS_CONTAINER = CLASS_CONTAINER; 12045exports.CLASS_FOCUS_IN = CLASS_FOCUS_IN; 12046exports.CLASS_INITIALIZED = CLASS_INITIALIZED; 12047exports.CLASS_LIST = CLASS_LIST; 12048exports.CLASS_LOADING = CLASS_LOADING; 12049exports.CLASS_NEXT = CLASS_NEXT; 12050exports.CLASS_OVERFLOW = CLASS_OVERFLOW; 12051exports.CLASS_PAGINATION = CLASS_PAGINATION; 12052exports.CLASS_PAGINATION_PAGE = CLASS_PAGINATION_PAGE; 12053exports.CLASS_PREV = CLASS_PREV; 12054exports.CLASS_PROGRESS = CLASS_PROGRESS; 12055exports.CLASS_PROGRESS_BAR = CLASS_PROGRESS_BAR; 12056exports.CLASS_ROOT = CLASS_ROOT; 12057exports.CLASS_SLIDE = CLASS_SLIDE; 12058exports.CLASS_SPINNER = CLASS_SPINNER; 12059exports.CLASS_SR = CLASS_SR; 12060exports.CLASS_TOGGLE = CLASS_TOGGLE; 12061exports.CLASS_TOGGLE_PAUSE = CLASS_TOGGLE_PAUSE; 12062exports.CLASS_TOGGLE_PLAY = CLASS_TOGGLE_PLAY; 12063exports.CLASS_TRACK = CLASS_TRACK; 12064exports.CLASS_VISIBLE = CLASS_VISIBLE; 12065exports.DEFAULTS = DEFAULTS; 12066exports.EVENT_ACTIVE = EVENT_ACTIVE; 12067exports.EVENT_ARROWS_MOUNTED = EVENT_ARROWS_MOUNTED; 12068exports.EVENT_ARROWS_UPDATED = EVENT_ARROWS_UPDATED; 12069exports.EVENT_AUTOPLAY_PAUSE = EVENT_AUTOPLAY_PAUSE; 12070exports.EVENT_AUTOPLAY_PLAY = EVENT_AUTOPLAY_PLAY; 12071exports.EVENT_AUTOPLAY_PLAYING = EVENT_AUTOPLAY_PLAYING; 12072exports.EVENT_CLICK = EVENT_CLICK; 12073exports.EVENT_DESTROY = EVENT_DESTROY; 12074exports.EVENT_DRAG = EVENT_DRAG; 12075exports.EVENT_DRAGGED = EVENT_DRAGGED; 12076exports.EVENT_DRAGGING = EVENT_DRAGGING; 12077exports.EVENT_END_INDEX_CHANGED = EVENT_END_INDEX_CHANGED; 12078exports.EVENT_HIDDEN = EVENT_HIDDEN; 12079exports.EVENT_INACTIVE = EVENT_INACTIVE; 12080exports.EVENT_LAZYLOAD_LOADED = EVENT_LAZYLOAD_LOADED; 12081exports.EVENT_MOUNTED = EVENT_MOUNTED; 12082exports.EVENT_MOVE = EVENT_MOVE; 12083exports.EVENT_MOVED = EVENT_MOVED; 12084exports.EVENT_NAVIGATION_MOUNTED = EVENT_NAVIGATION_MOUNTED; 12085exports.EVENT_OVERFLOW = EVENT_OVERFLOW; 12086exports.EVENT_PAGINATION_MOUNTED = EVENT_PAGINATION_MOUNTED; 12087exports.EVENT_PAGINATION_UPDATED = EVENT_PAGINATION_UPDATED; 12088exports.EVENT_READY = EVENT_READY; 12089exports.EVENT_REFRESH = EVENT_REFRESH; 12090exports.EVENT_RESIZE = EVENT_RESIZE; 12091exports.EVENT_RESIZED = EVENT_RESIZED; 12092exports.EVENT_SCROLL = EVENT_SCROLL; 12093exports.EVENT_SCROLLED = EVENT_SCROLLED; 12094exports.EVENT_SHIFTED = EVENT_SHIFTED; 12095exports.EVENT_SLIDE_KEYDOWN = EVENT_SLIDE_KEYDOWN; 12096exports.EVENT_UPDATED = EVENT_UPDATED; 12097exports.EVENT_VISIBLE = EVENT_VISIBLE; 12098exports.EventBinder = EventBinder; 12099exports.EventInterface = EventInterface; 12100exports.FADE = FADE; 12101exports.LOOP = LOOP; 12102exports.LTR = LTR; 12103exports.RTL = RTL; 12104exports.RequestInterval = RequestInterval; 12105exports.SLIDE = SLIDE; 12106exports.STATUS_CLASSES = STATUS_CLASSES; 12107exports.Splide = Splide; 12108exports.SplideRenderer = SplideRenderer; 12109exports.State = State; 12110exports.TTB = TTB; 12111exports.Throttle = Throttle; 12112exports["default"] = Splide; 12113 12114 12115/***/ }), 12116
vendor: 117,446 bytes, lines 12117-15663
12117/***/ "./node_modules/@vimeo/player/dist/player.es.js": 12118/*!******************************************************!*\ 12119 !*** ./node_modules/@vimeo/player/dist/player.es.js ***! 12120 \******************************************************/ 12121/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 12122 12123"use strict"; 12124__webpack_require__.r(__webpack_exports__); 12125/* harmony export */ __webpack_require__.d(__webpack_exports__, { 12126/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 12127/* harmony export */ }); 12128/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 12129/*! @vimeo/player v2.20.1 | (c) 2023 Vimeo | MIT License | https://github.com/vimeo/player.js */ 12130function ownKeys(object, enumerableOnly) { 12131 var keys = Object.keys(object); 12132 if (Object.getOwnPropertySymbols) { 12133 var symbols = Object.getOwnPropertySymbols(object); 12134 enumerableOnly && (symbols = symbols.filter(function (sym) { 12135 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 12136 })), keys.push.apply(keys, symbols); 12137 } 12138 return keys; 12139} 12140function _objectSpread2(target) { 12141 for (var i = 1; i < arguments.length; i++) { 12142 var source = null != arguments[i] ? arguments[i] : {}; 12143 i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { 12144 _defineProperty(target, key, source[key]); 12145 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { 12146 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 12147 }); 12148 } 12149 return target; 12150} 12151function _regeneratorRuntime() { 12152 _regeneratorRuntime = function () { 12153 return exports; 12154 }; 12155 var exports = {}, 12156 Op = Object.prototype, 12157 hasOwn = Op.hasOwnProperty, 12158 defineProperty = Object.defineProperty || function (obj, key, desc) { 12159 obj[key] = desc.value; 12160 }, 12161 $Symbol = "function" == typeof Symbol ? Symbol : {}, 12162 iteratorSymbol = $Symbol.iterator || "@@iterator", 12163 asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", 12164 toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; 12165 function define(obj, key, value) { 12166 return Object.defineProperty(obj, key, { 12167 value: value, 12168 enumerable: !0, 12169 configurable: !0, 12170 writable: !0 12171 }), obj[key]; 12172 } 12173 try { 12174 define({}, ""); 12175 } catch (err) { 12176 define = function (obj, key, value) { 12177 return obj[key] = value; 12178 }; 12179 } 12180 function wrap(innerFn, outerFn, self, tryLocsList) { 12181 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, 12182 generator = Object.create(protoGenerator.prototype), 12183 context = new Context(tryLocsList || []); 12184 return defineProperty(generator, "_invoke", { 12185 value: makeInvokeMethod(innerFn, self, context) 12186 }), generator; 12187 } 12188 function tryCatch(fn, obj, arg) { 12189 try { 12190 return { 12191 type: "normal", 12192 arg: fn.call(obj, arg) 12193 }; 12194 } catch (err) { 12195 return { 12196 type: "throw", 12197 arg: err 12198 }; 12199 } 12200 } 12201 exports.wrap = wrap; 12202 var ContinueSentinel = {}; 12203 function Generator() {} 12204 function GeneratorFunction() {} 12205 function GeneratorFunctionPrototype() {} 12206 var IteratorPrototype = {}; 12207 define(IteratorPrototype, iteratorSymbol, function () { 12208 return this; 12209 }); 12210 var getProto = Object.getPrototypeOf, 12211 NativeIteratorPrototype = getProto && getProto(getProto(values([]))); 12212 NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); 12213 var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); 12214 function defineIteratorMethods(prototype) { 12215 ["next", "throw", "return"].forEach(function (method) { 12216 define(prototype, method, function (arg) { 12217 return this._invoke(method, arg); 12218 }); 12219 }); 12220 } 12221 function AsyncIterator(generator, PromiseImpl) { 12222 function invoke(method, arg, resolve, reject) { 12223 var record = tryCatch(generator[method], generator, arg); 12224 if ("throw" !== record.type) { 12225 var result = record.arg, 12226 value = result.value; 12227 return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { 12228 invoke("next", value, resolve, reject); 12229 }, function (err) { 12230 invoke("throw", err, resolve, reject); 12231 }) : PromiseImpl.resolve(value).then(function (unwrapped) { 12232 result.value = unwrapped, resolve(result); 12233 }, function (error) { 12234 return invoke("throw", error, resolve, reject); 12235 }); 12236 } 12237 reject(record.arg); 12238 } 12239 var previousPromise; 12240 defineProperty(this, "_invoke", { 12241 value: function (method, arg) { 12242 function callInvokeWithMethodAndArg() { 12243 return new PromiseImpl(function (resolve, reject) { 12244 invoke(method, arg, resolve, reject); 12245 }); 12246 } 12247 return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); 12248 } 12249 }); 12250 } 12251 function makeInvokeMethod(innerFn, self, context) { 12252 var state = "suspendedStart"; 12253 return function (method, arg) { 12254 if ("executing" === state) throw new Error("Generator is already running"); 12255 if ("completed" === state) { 12256 if ("throw" === method) throw arg; 12257 return doneResult(); 12258 } 12259 for (context.method = method, context.arg = arg;;) { 12260 var delegate = context.delegate; 12261 if (delegate) { 12262 var delegateResult = maybeInvokeDelegate(delegate, context); 12263 if (delegateResult) { 12264 if (delegateResult === ContinueSentinel) continue; 12265 return delegateResult; 12266 } 12267 } 12268 if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { 12269 if ("suspendedStart" === state) throw state = "completed", context.arg; 12270 context.dispatchException(context.arg); 12271 } else "return" === context.method && context.abrupt("return", context.arg); 12272 state = "executing"; 12273 var record = tryCatch(innerFn, self, context); 12274 if ("normal" === record.type) { 12275 if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; 12276 return { 12277 value: record.arg, 12278 done: context.done 12279 }; 12280 } 12281 "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); 12282 } 12283 }; 12284 } 12285 function maybeInvokeDelegate(delegate, context) { 12286 var methodName = context.method, 12287 method = delegate.iterator[methodName]; 12288 if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; 12289 var record = tryCatch(method, delegate.iterator, context.arg); 12290 if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; 12291 var info = record.arg; 12292 return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); 12293 } 12294 function pushTryEntry(locs) { 12295 var entry = { 12296 tryLoc: locs[0] 12297 }; 12298 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); 12299 } 12300 function resetTryEntry(entry) { 12301 var record = entry.completion || {}; 12302 record.type = "normal", delete record.arg, entry.completion = record; 12303 } 12304 function Context(tryLocsList) { 12305 this.tryEntries = [{ 12306 tryLoc: "root" 12307 }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); 12308 } 12309 function values(iterable) { 12310 if (iterable) { 12311 var iteratorMethod = iterable[iteratorSymbol]; 12312 if (iteratorMethod) return iteratorMethod.call(iterable); 12313 if ("function" == typeof iterable.next) return iterable; 12314 if (!isNaN(iterable.length)) { 12315 var i = -1, 12316 next = function next() { 12317 for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; 12318 return next.value = undefined, next.done = !0, next; 12319 }; 12320 return next.next = next; 12321 } 12322 } 12323 return { 12324 next: doneResult 12325 }; 12326 } 12327 function doneResult() { 12328 return { 12329 value: undefined, 12330 done: !0 12331 }; 12332 } 12333 return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { 12334 value: GeneratorFunctionPrototype, 12335 configurable: !0 12336 }), defineProperty(GeneratorFunctionPrototype, "constructor", { 12337 value: GeneratorFunction, 12338 configurable: !0 12339 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { 12340 var ctor = "function" == typeof genFun && genFun.constructor; 12341 return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); 12342 }, exports.mark = function (genFun) { 12343 return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; 12344 }, exports.awrap = function (arg) { 12345 return { 12346 __await: arg 12347 }; 12348 }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { 12349 return this; 12350 }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { 12351 void 0 === PromiseImpl && (PromiseImpl = Promise); 12352 var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); 12353 return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { 12354 return result.done ? result.value : iter.next(); 12355 }); 12356 }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { 12357 return this; 12358 }), define(Gp, "toString", function () { 12359 return "[object Generator]"; 12360 }), exports.keys = function (val) { 12361 var object = Object(val), 12362 keys = []; 12363 for (var key in object) keys.push(key); 12364 return keys.reverse(), function next() { 12365 for (; keys.length;) { 12366 var key = keys.pop(); 12367 if (key in object) return next.value = key, next.done = !1, next; 12368 } 12369 return next.done = !0, next; 12370 }; 12371 }, exports.values = values, Context.prototype = { 12372 constructor: Context, 12373 reset: function (skipTempReset) { 12374 if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); 12375 }, 12376 stop: function () { 12377 this.done = !0; 12378 var rootRecord = this.tryEntries[0].completion; 12379 if ("throw" === rootRecord.type) throw rootRecord.arg; 12380 return this.rval; 12381 }, 12382 dispatchException: function (exception) { 12383 if (this.done) throw exception; 12384 var context = this; 12385 function handle(loc, caught) { 12386 return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; 12387 } 12388 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 12389 var entry = this.tryEntries[i], 12390 record = entry.completion; 12391 if ("root" === entry.tryLoc) return handle("end"); 12392 if (entry.tryLoc <= this.prev) { 12393 var hasCatch = hasOwn.call(entry, "catchLoc"), 12394 hasFinally = hasOwn.call(entry, "finallyLoc"); 12395 if (hasCatch && hasFinally) { 12396 if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); 12397 if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); 12398 } else if (hasCatch) { 12399 if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); 12400 } else { 12401 if (!hasFinally) throw new Error("try statement without catch or finally"); 12402 if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); 12403 } 12404 } 12405 } 12406 }, 12407 abrupt: function (type, arg) { 12408 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 12409 var entry = this.tryEntries[i]; 12410 if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { 12411 var finallyEntry = entry; 12412 break; 12413 } 12414 } 12415 finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); 12416 var record = finallyEntry ? finallyEntry.completion : {}; 12417 return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); 12418 }, 12419 complete: function (record, afterLoc) { 12420 if ("throw" === record.type) throw record.arg; 12421 return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; 12422 }, 12423 finish: function (finallyLoc) { 12424 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 12425 var entry = this.tryEntries[i]; 12426 if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; 12427 } 12428 }, 12429 catch: function (tryLoc) { 12430 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 12431 var entry = this.tryEntries[i]; 12432 if (entry.tryLoc === tryLoc) { 12433 var record = entry.completion; 12434 if ("throw" === record.type) { 12435 var thrown = record.arg; 12436 resetTryEntry(entry); 12437 } 12438 return thrown; 12439 } 12440 } 12441 throw new Error("illegal catch attempt"); 12442 }, 12443 delegateYield: function (iterable, resultName, nextLoc) { 12444 return this.delegate = { 12445 iterator: values(iterable), 12446 resultName: resultName, 12447 nextLoc: nextLoc 12448 }, "next" === this.method && (this.arg = undefined), ContinueSentinel; 12449 } 12450 }, exports; 12451} 12452function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { 12453 try { 12454 var info = gen[key](arg); 12455 var value = info.value; 12456 } catch (error) { 12457 reject(error); 12458 return; 12459 } 12460 if (info.done) { 12461 resolve(value); 12462 } else { 12463 Promise.resolve(value).then(_next, _throw); 12464 } 12465} 12466function _asyncToGenerator(fn) { 12467 return function () { 12468 var self = this, 12469 args = arguments; 12470 return new Promise(function (resolve, reject) { 12471 var gen = fn.apply(self, args); 12472 function _next(value) { 12473 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); 12474 } 12475 function _throw(err) { 12476 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); 12477 } 12478 _next(undefined); 12479 }); 12480 }; 12481} 12482function _classCallCheck(instance, Constructor) { 12483 if (!(instance instanceof Constructor)) { 12484 throw new TypeError("Cannot call a class as a function"); 12485 } 12486} 12487function _defineProperties(target, props) { 12488 for (var i = 0; i < props.length; i++) { 12489 var descriptor = props[i]; 12490 descriptor.enumerable = descriptor.enumerable || false; 12491 descriptor.configurable = true; 12492 if ("value" in descriptor) descriptor.writable = true; 12493 Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); 12494 } 12495} 12496function _createClass(Constructor, protoProps, staticProps) { 12497 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 12498 if (staticProps) _defineProperties(Constructor, staticProps); 12499 Object.defineProperty(Constructor, "prototype", { 12500 writable: false 12501 }); 12502 return Constructor; 12503} 12504function _defineProperty(obj, key, value) { 12505 key = _toPropertyKey(key); 12506 if (key in obj) { 12507 Object.defineProperty(obj, key, { 12508 value: value, 12509 enumerable: true, 12510 configurable: true, 12511 writable: true 12512 }); 12513 } else { 12514 obj[key] = value; 12515 } 12516 return obj; 12517} 12518function _inherits(subClass, superClass) { 12519 if (typeof superClass !== "function" && superClass !== null) { 12520 throw new TypeError("Super expression must either be null or a function"); 12521 } 12522 subClass.prototype = Object.create(superClass && superClass.prototype, { 12523 constructor: { 12524 value: subClass, 12525 writable: true, 12526 configurable: true 12527 } 12528 }); 12529 Object.defineProperty(subClass, "prototype", { 12530 writable: false 12531 }); 12532 if (superClass) _setPrototypeOf(subClass, superClass); 12533} 12534function _getPrototypeOf(o) { 12535 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { 12536 return o.__proto__ || Object.getPrototypeOf(o); 12537 }; 12538 return _getPrototypeOf(o); 12539} 12540function _setPrototypeOf(o, p) { 12541 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { 12542 o.__proto__ = p; 12543 return o; 12544 }; 12545 return _setPrototypeOf(o, p); 12546} 12547function _isNativeReflectConstruct() { 12548 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 12549 if (Reflect.construct.sham) return false; 12550 if (typeof Proxy === "function") return true; 12551 try { 12552 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); 12553 return true; 12554 } catch (e) { 12555 return false; 12556 } 12557} 12558function _construct(Parent, args, Class) { 12559 if (_isNativeReflectConstruct()) { 12560 _construct = Reflect.construct.bind(); 12561 } else { 12562 _construct = function _construct(Parent, args, Class) { 12563 var a = [null]; 12564 a.push.apply(a, args); 12565 var Constructor = Function.bind.apply(Parent, a); 12566 var instance = new Constructor(); 12567 if (Class) _setPrototypeOf(instance, Class.prototype); 12568 return instance; 12569 }; 12570 } 12571 return _construct.apply(null, arguments); 12572} 12573function _isNativeFunction(fn) { 12574 return Function.toString.call(fn).indexOf("[native code]") !== -1; 12575} 12576function _wrapNativeSuper(Class) { 12577 var _cache = typeof Map === "function" ? new Map() : undefined; 12578 _wrapNativeSuper = function _wrapNativeSuper(Class) { 12579 if (Class === null || !_isNativeFunction(Class)) return Class; 12580 if (typeof Class !== "function") { 12581 throw new TypeError("Super expression must either be null or a function"); 12582 } 12583 if (typeof _cache !== "undefined") { 12584 if (_cache.has(Class)) return _cache.get(Class); 12585 _cache.set(Class, Wrapper); 12586 } 12587 function Wrapper() { 12588 return _construct(Class, arguments, _getPrototypeOf(this).constructor); 12589 } 12590 Wrapper.prototype = Object.create(Class.prototype, { 12591 constructor: { 12592 value: Wrapper, 12593 enumerable: false, 12594 writable: true, 12595 configurable: true 12596 } 12597 }); 12598 return _setPrototypeOf(Wrapper, Class); 12599 }; 12600 return _wrapNativeSuper(Class); 12601} 12602function _assertThisInitialized(self) { 12603 if (self === void 0) { 12604 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 12605 } 12606 return self; 12607} 12608function _possibleConstructorReturn(self, call) { 12609 if (call && (typeof call === "object" || typeof call === "function")) { 12610 return call; 12611 } else if (call !== void 0) { 12612 throw new TypeError("Derived constructors may only return object or undefined"); 12613 } 12614 return _assertThisInitialized(self); 12615} 12616function _createSuper(Derived) { 12617 var hasNativeReflectConstruct = _isNativeReflectConstruct(); 12618 return function _createSuperInternal() { 12619 var Super = _getPrototypeOf(Derived), 12620 result; 12621 if (hasNativeReflectConstruct) { 12622 var NewTarget = _getPrototypeOf(this).constructor; 12623 result = Reflect.construct(Super, arguments, NewTarget); 12624 } else { 12625 result = Super.apply(this, arguments); 12626 } 12627 return _possibleConstructorReturn(this, result); 12628 }; 12629} 12630function _toPrimitive(input, hint) { 12631 if (typeof input !== "object" || input === null) return input; 12632 var prim = input[Symbol.toPrimitive]; 12633 if (prim !== undefined) { 12634 var res = prim.call(input, hint || "default"); 12635 if (typeof res !== "object") return res; 12636 throw new TypeError("@@toPrimitive must return a primitive value."); 12637 } 12638 return (hint === "string" ? String : Number)(input); 12639} 12640function _toPropertyKey(arg) { 12641 var key = _toPrimitive(arg, "string"); 12642 return typeof key === "symbol" ? key : String(key); 12643} 12644 12645/** 12646 * @module lib/functions 12647 */ 12648 12649/** 12650 * Check to see this is a node environment. 12651 * @type {Boolean} 12652 */ 12653/* global global */ 12654var isNode = typeof __webpack_require__.g !== 'undefined' && {}.toString.call(__webpack_require__.g) === '[object global]'; 12655 12656/** 12657 * Get the name of the method for a given getter or setter. 12658 * 12659 * @param {string} prop The name of the property. 12660 * @param {string} type Either âgetâ or âsetâ. 12661 * @return {string} 12662 */ 12663function getMethodName(prop, type) { 12664 if (prop.indexOf(type.toLowerCase()) === 0) { 12665 return prop; 12666 } 12667 return "".concat(type.toLowerCase()).concat(prop.substr(0, 1).toUpperCase()).concat(prop.substr(1)); 12668} 12669 12670/** 12671 * Check to see if the object is a DOM Element. 12672 * 12673 * @param {*} element The object to check. 12674 * @return {boolean} 12675 */ 12676function isDomElement(element) { 12677 return Boolean(element && element.nodeType === 1 && 'nodeName' in element && element.ownerDocument && element.ownerDocument.defaultView); 12678} 12679 12680/** 12681 * Check to see whether the value is a number. 12682 * 12683 * @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html 12684 * @param {*} value The value to check. 12685 * @param {boolean} integer Check if the value is an integer. 12686 * @return {boolean} 12687 */ 12688function isInteger(value) { 12689 // eslint-disable-next-line eqeqeq 12690 return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value; 12691} 12692 12693/** 12694 * Check to see if the URL is a Vimeo url. 12695 * 12696 * @param {string} url The url string. 12697 * @return {boolean} 12698 */ 12699function isVimeoUrl(url) { 12700 return /^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(url); 12701} 12702 12703/** 12704 * Check to see if the URL is for a Vimeo embed. 12705 * 12706 * @param {string} url The url string. 12707 * @return {boolean} 12708 */ 12709function isVimeoEmbed(url) { 12710 var expr = /^https:\/\/player\.vimeo\.com\/video\/\d+/; 12711 return expr.test(url); 12712} 12713 12714/** 12715 * Get the Vimeo URL from an element. 12716 * The element must have either a data-vimeo-id or data-vimeo-url attribute. 12717 * 12718 * @param {object} oEmbedParameters The oEmbed parameters. 12719 * @return {string} 12720 */ 12721function getVimeoUrl() { 12722 var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 12723 var id = oEmbedParameters.id; 12724 var url = oEmbedParameters.url; 12725 var idOrUrl = id || url; 12726 if (!idOrUrl) { 12727 throw new Error('An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.'); 12728 } 12729 if (isInteger(idOrUrl)) { 12730 return "https://vimeo.com/".concat(idOrUrl); 12731 } 12732 if (isVimeoUrl(idOrUrl)) { 12733 return idOrUrl.replace('http:', 'https:'); 12734 } 12735 if (id) { 12736 throw new TypeError("\u201C".concat(id, "\u201D is not a valid video id.")); 12737 } 12738 throw new TypeError("\u201C".concat(idOrUrl, "\u201D is not a vimeo.com url.")); 12739} 12740 12741/* eslint-disable max-params */ 12742/** 12743 * A utility method for attaching and detaching event handlers 12744 * 12745 * @param {EventTarget} target 12746 * @param {string | string[]} eventName 12747 * @param {function} callback 12748 * @param {'addEventListener' | 'on'} onName 12749 * @param {'removeEventListener' | 'off'} offName 12750 * @return {{cancel: (function(): void)}} 12751 */ 12752var subscribe = function subscribe(target, eventName, callback) { 12753 var onName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'addEventListener'; 12754 var offName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'removeEventListener'; 12755 var eventNames = typeof eventName === 'string' ? [eventName] : eventName; 12756 eventNames.forEach(function (evName) { 12757 target[onName](evName, callback); 12758 }); 12759 return { 12760 cancel: function cancel() { 12761 return eventNames.forEach(function (evName) { 12762 return target[offName](evName, callback); 12763 }); 12764 } 12765 }; 12766}; 12767 12768var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined'; 12769var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined'; 12770if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) { 12771 throw new Error('Sorry, the Vimeo Player API is not available in this browser.'); 12772} 12773 12774var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; 12775 12776function createCommonjsModule(fn, module) { 12777 return module = { exports: {} }, fn(module, module.exports), module.exports; 12778} 12779 12780/*! 12781 * weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill 12782 * https://github.com/polygonplanet/weakmap-polyfill 12783 * Copyright (c) 2015-2021 polygonplanet <[email protected]> 12784 * @license MIT 12785 */ 12786 12787(function (self) { 12788 12789 if (self.WeakMap) { 12790 return; 12791 } 12792 var hasOwnProperty = Object.prototype.hasOwnProperty; 12793 var hasDefine = Object.defineProperty && function () { 12794 try { 12795 // Avoid IE8's broken Object.defineProperty 12796 return Object.defineProperty({}, 'x', { 12797 value: 1 12798 }).x === 1; 12799 } catch (e) {} 12800 }(); 12801 var defineProperty = function (object, name, value) { 12802 if (hasDefine) { 12803 Object.defineProperty(object, name, { 12804 configurable: true, 12805 writable: true, 12806 value: value 12807 }); 12808 } else { 12809 object[name] = value; 12810 } 12811 }; 12812 self.WeakMap = function () { 12813 // ECMA-262 23.3 WeakMap Objects 12814 function WeakMap() { 12815 if (this === void 0) { 12816 throw new TypeError("Constructor WeakMap requires 'new'"); 12817 } 12818 defineProperty(this, '_id', genId('_WeakMap')); 12819 12820 // ECMA-262 23.3.1.1 WeakMap([iterable]) 12821 if (arguments.length > 0) { 12822 // Currently, WeakMap `iterable` argument is not supported 12823 throw new TypeError('WeakMap iterable is not supported'); 12824 } 12825 } 12826 12827 // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key) 12828 defineProperty(WeakMap.prototype, 'delete', function (key) { 12829 checkInstance(this, 'delete'); 12830 if (!isObject(key)) { 12831 return false; 12832 } 12833 var entry = key[this._id]; 12834 if (entry && entry[0] === key) { 12835 delete key[this._id]; 12836 return true; 12837 } 12838 return false; 12839 }); 12840 12841 // ECMA-262 23.3.3.3 WeakMap.prototype.get(key) 12842 defineProperty(WeakMap.prototype, 'get', function (key) { 12843 checkInstance(this, 'get'); 12844 if (!isObject(key)) { 12845 return void 0; 12846 } 12847 var entry = key[this._id]; 12848 if (entry && entry[0] === key) { 12849 return entry[1]; 12850 } 12851 return void 0; 12852 }); 12853 12854 // ECMA-262 23.3.3.4 WeakMap.prototype.has(key) 12855 defineProperty(WeakMap.prototype, 'has', function (key) { 12856 checkInstance(this, 'has'); 12857 if (!isObject(key)) { 12858 return false; 12859 } 12860 var entry = key[this._id]; 12861 if (entry && entry[0] === key) { 12862 return true; 12863 } 12864 return false; 12865 }); 12866 12867 // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value) 12868 defineProperty(WeakMap.prototype, 'set', function (key, value) { 12869 checkInstance(this, 'set'); 12870 if (!isObject(key)) { 12871 throw new TypeError('Invalid value used as weak map key'); 12872 } 12873 var entry = key[this._id]; 12874 if (entry && entry[0] === key) { 12875 entry[1] = value; 12876 return this; 12877 } 12878 defineProperty(key, this._id, [key, value]); 12879 return this; 12880 }); 12881 function checkInstance(x, methodName) { 12882 if (!isObject(x) || !hasOwnProperty.call(x, '_id')) { 12883 throw new TypeError(methodName + ' method called on incompatible receiver ' + typeof x); 12884 } 12885 } 12886 function genId(prefix) { 12887 return prefix + '_' + rand() + '.' + rand(); 12888 } 12889 function rand() { 12890 return Math.random().toString().substring(2); 12891 } 12892 defineProperty(WeakMap, '_polyfill', true); 12893 return WeakMap; 12894 }(); 12895 function isObject(x) { 12896 return Object(x) === x; 12897 } 12898})(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal); 12899 12900var npo_src = createCommonjsModule(function (module) { 12901/*! Native Promise Only 12902 v0.8.1 (c) Kyle Simpson 12903 MIT License: http://getify.mit-license.org 12904*/ 12905 12906(function UMD(name, context, definition) { 12907 // special form of UMD for polyfilling across evironments 12908 context[name] = context[name] || definition(); 12909 if ( module.exports) { 12910 module.exports = context[name]; 12911 } 12912})("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() { 12913 12914 var builtInProp, 12915 cycle, 12916 scheduling_queue, 12917 ToString = Object.prototype.toString, 12918 timer = typeof setImmediate != "undefined" ? function timer(fn) { 12919 return setImmediate(fn); 12920 } : setTimeout; 12921 12922 // dammit, IE8. 12923 try { 12924 Object.defineProperty({}, "x", {}); 12925 builtInProp = function builtInProp(obj, name, val, config) { 12926 return Object.defineProperty(obj, name, { 12927 value: val, 12928 writable: true, 12929 configurable: config !== false 12930 }); 12931 }; 12932 } catch (err) { 12933 builtInProp = function builtInProp(obj, name, val) { 12934 obj[name] = val; 12935 return obj; 12936 }; 12937 } 12938 12939 // Note: using a queue instead of array for efficiency 12940 scheduling_queue = function Queue() { 12941 var first, last, item; 12942 function Item(fn, self) { 12943 this.fn = fn; 12944 this.self = self; 12945 this.next = void 0; 12946 } 12947 return { 12948 add: function add(fn, self) { 12949 item = new Item(fn, self); 12950 if (last) { 12951 last.next = item; 12952 } else { 12953 first = item; 12954 } 12955 last = item; 12956 item = void 0; 12957 }, 12958 drain: function drain() { 12959 var f = first; 12960 first = last = cycle = void 0; 12961 while (f) { 12962 f.fn.call(f.self); 12963 f = f.next; 12964 } 12965 } 12966 }; 12967 }(); 12968 function schedule(fn, self) { 12969 scheduling_queue.add(fn, self); 12970 if (!cycle) { 12971 cycle = timer(scheduling_queue.drain); 12972 } 12973 } 12974 12975 // promise duck typing 12976 function isThenable(o) { 12977 var _then, 12978 o_type = typeof o; 12979 if (o != null && (o_type == "object" || o_type == "function")) { 12980 _then = o.then; 12981 } 12982 return typeof _then == "function" ? _then : false; 12983 } 12984 function notify() { 12985 for (var i = 0; i < this.chain.length; i++) { 12986 notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]); 12987 } 12988 this.chain.length = 0; 12989 } 12990 12991 // NOTE: This is a separate function to isolate 12992 // the `try..catch` so that other code can be 12993 // optimized better 12994 function notifyIsolated(self, cb, chain) { 12995 var ret, _then; 12996 try { 12997 if (cb === false) { 12998 chain.reject(self.msg); 12999 } else { 13000 if (cb === true) { 13001 ret = self.msg; 13002 } else { 13003 ret = cb.call(void 0, self.msg); 13004 } 13005 if (ret === chain.promise) { 13006 chain.reject(TypeError("Promise-chain cycle")); 13007 } else if (_then = isThenable(ret)) { 13008 _then.call(ret, chain.resolve, chain.reject); 13009 } else { 13010 chain.resolve(ret); 13011 } 13012 } 13013 } catch (err) { 13014 chain.reject(err); 13015 } 13016 } 13017 function resolve(msg) { 13018 var _then, 13019 self = this; 13020 13021 // already triggered? 13022 if (self.triggered) { 13023 return; 13024 } 13025 self.triggered = true; 13026 13027 // unwrap 13028 if (self.def) { 13029 self = self.def; 13030 } 13031 try { 13032 if (_then = isThenable(msg)) { 13033 schedule(function () { 13034 var def_wrapper = new MakeDefWrapper(self); 13035 try { 13036 _then.call(msg, function $resolve$() { 13037 resolve.apply(def_wrapper, arguments); 13038 }, function $reject$() { 13039 reject.apply(def_wrapper, arguments); 13040 }); 13041 } catch (err) { 13042 reject.call(def_wrapper, err); 13043 } 13044 }); 13045 } else { 13046 self.msg = msg; 13047 self.state = 1; 13048 if (self.chain.length > 0) { 13049 schedule(notify, self); 13050 } 13051 } 13052 } catch (err) { 13053 reject.call(new MakeDefWrapper(self), err); 13054 } 13055 } 13056 function reject(msg) { 13057 var self = this; 13058 13059 // already triggered? 13060 if (self.triggered) { 13061 return; 13062 } 13063 self.triggered = true; 13064 13065 // unwrap 13066 if (self.def) { 13067 self = self.def; 13068 } 13069 self.msg = msg; 13070 self.state = 2; 13071 if (self.chain.length > 0) { 13072 schedule(notify, self); 13073 } 13074 } 13075 function iteratePromises(Constructor, arr, resolver, rejecter) { 13076 for (var idx = 0; idx < arr.length; idx++) { 13077 (function IIFE(idx) { 13078 Constructor.resolve(arr[idx]).then(function $resolver$(msg) { 13079 resolver(idx, msg); 13080 }, rejecter); 13081 })(idx); 13082 } 13083 } 13084 function MakeDefWrapper(self) { 13085 this.def = self; 13086 this.triggered = false; 13087 } 13088 function MakeDef(self) { 13089 this.promise = self; 13090 this.state = 0; 13091 this.triggered = false; 13092 this.chain = []; 13093 this.msg = void 0; 13094 } 13095 function Promise(executor) { 13096 if (typeof executor != "function") { 13097 throw TypeError("Not a function"); 13098 } 13099 if (this.__NPO__ !== 0) { 13100 throw TypeError("Not a promise"); 13101 } 13102 13103 // instance shadowing the inherited "brand" 13104 // to signal an already "initialized" promise 13105 this.__NPO__ = 1; 13106 var def = new MakeDef(this); 13107 this["then"] = function then(success, failure) { 13108 var o = { 13109 success: typeof success == "function" ? success : true, 13110 failure: typeof failure == "function" ? failure : false 13111 }; 13112 // Note: `then(..)` itself can be borrowed to be used against 13113 // a different promise constructor for making the chained promise, 13114 // by substituting a different `this` binding. 13115 o.promise = new this.constructor(function extractChain(resolve, reject) { 13116 if (typeof resolve != "function" || typeof reject != "function") { 13117 throw TypeError("Not a function"); 13118 } 13119 o.resolve = resolve; 13120 o.reject = reject; 13121 }); 13122 def.chain.push(o); 13123 if (def.state !== 0) { 13124 schedule(notify, def); 13125 } 13126 return o.promise; 13127 }; 13128 this["catch"] = function $catch$(failure) { 13129 return this.then(void 0, failure); 13130 }; 13131 try { 13132 executor.call(void 0, function publicResolve(msg) { 13133 resolve.call(def, msg); 13134 }, function publicReject(msg) { 13135 reject.call(def, msg); 13136 }); 13137 } catch (err) { 13138 reject.call(def, err); 13139 } 13140 } 13141 var PromisePrototype = builtInProp({}, "constructor", Promise, /*configurable=*/false); 13142 13143 // Note: Android 4 cannot use `Object.defineProperty(..)` here 13144 Promise.prototype = PromisePrototype; 13145 13146 // built-in "brand" to signal an "uninitialized" promise 13147 builtInProp(PromisePrototype, "__NPO__", 0, /*configurable=*/false); 13148 builtInProp(Promise, "resolve", function Promise$resolve(msg) { 13149 var Constructor = this; 13150 13151 // spec mandated checks 13152 // note: best "isPromise" check that's practical for now 13153 if (msg && typeof msg == "object" && msg.__NPO__ === 1) { 13154 return msg; 13155 } 13156 return new Constructor(function executor(resolve, reject) { 13157 if (typeof resolve != "function" || typeof reject != "function") { 13158 throw TypeError("Not a function"); 13159 } 13160 resolve(msg); 13161 }); 13162 }); 13163 builtInProp(Promise, "reject", function Promise$reject(msg) { 13164 return new this(function executor(resolve, reject) { 13165 if (typeof resolve != "function" || typeof reject != "function") { 13166 throw TypeError("Not a function"); 13167 } 13168 reject(msg); 13169 }); 13170 }); 13171 builtInProp(Promise, "all", function Promise$all(arr) { 13172 var Constructor = this; 13173 13174 // spec mandated checks 13175 if (ToString.call(arr) != "[object Array]") { 13176 return Constructor.reject(TypeError("Not an array")); 13177 } 13178 if (arr.length === 0) { 13179 return Constructor.resolve([]); 13180 } 13181 return new Constructor(function executor(resolve, reject) { 13182 if (typeof resolve != "function" || typeof reject != "function") { 13183 throw TypeError("Not a function"); 13184 } 13185 var len = arr.length, 13186 msgs = Array(len), 13187 count = 0; 13188 iteratePromises(Constructor, arr, function resolver(idx, msg) { 13189 msgs[idx] = msg; 13190 if (++count === len) { 13191 resolve(msgs); 13192 } 13193 }, reject); 13194 }); 13195 }); 13196 builtInProp(Promise, "race", function Promise$race(arr) { 13197 var Constructor = this; 13198 13199 // spec mandated checks 13200 if (ToString.call(arr) != "[object Array]") { 13201 return Constructor.reject(TypeError("Not an array")); 13202 } 13203 return new Constructor(function executor(resolve, reject) { 13204 if (typeof resolve != "function" || typeof reject != "function") { 13205 throw TypeError("Not a function"); 13206 } 13207 iteratePromises(Constructor, arr, function resolver(idx, msg) { 13208 resolve(msg); 13209 }, reject); 13210 }); 13211 }); 13212 return Promise; 13213}); 13214}); 13215 13216/** 13217 * @module lib/callbacks 13218 */ 13219 13220var callbackMap = new WeakMap(); 13221 13222/** 13223 * Store a callback for a method or event for a player. 13224 * 13225 * @param {Player} player The player object. 13226 * @param {string} name The method or event name. 13227 * @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback 13228 * The callback to call or an object with resolve and reject functions for a promise. 13229 * @return {void} 13230 */ 13231function storeCallback(player, name, callback) { 13232 var playerCallbacks = callbackMap.get(player.element) || {}; 13233 if (!(name in playerCallbacks)) { 13234 playerCallbacks[name] = []; 13235 } 13236 playerCallbacks[name].push(callback); 13237 callbackMap.set(player.element, playerCallbacks); 13238} 13239 13240/** 13241 * Get the callbacks for a player and event or method. 13242 * 13243 * @param {Player} player The player object. 13244 * @param {string} name The method or event name 13245 * @return {function[]} 13246 */ 13247function getCallbacks(player, name) { 13248 var playerCallbacks = callbackMap.get(player.element) || {}; 13249 return playerCallbacks[name] || []; 13250} 13251 13252/** 13253 * Remove a stored callback for a method or event for a player. 13254 * 13255 * @param {Player} player The player object. 13256 * @param {string} name The method or event name 13257 * @param {function} [callback] The specific callback to remove. 13258 * @return {boolean} Was this the last callback? 13259 */ 13260function removeCallback(player, name, callback) { 13261 var playerCallbacks = callbackMap.get(player.element) || {}; 13262 if (!playerCallbacks[name]) { 13263 return true; 13264 } 13265 13266 // If no callback is passed, remove all callbacks for the event 13267 if (!callback) { 13268 playerCallbacks[name] = []; 13269 callbackMap.set(player.element, playerCallbacks); 13270 return true; 13271 } 13272 var index = playerCallbacks[name].indexOf(callback); 13273 if (index !== -1) { 13274 playerCallbacks[name].splice(index, 1); 13275 } 13276 callbackMap.set(player.element, playerCallbacks); 13277 return playerCallbacks[name] && playerCallbacks[name].length === 0; 13278} 13279 13280/** 13281 * Return the first stored callback for a player and event or method. 13282 * 13283 * @param {Player} player The player object. 13284 * @param {string} name The method or event name. 13285 * @return {function} The callback, or false if there were none 13286 */ 13287function shiftCallbacks(player, name) { 13288 var playerCallbacks = getCallbacks(player, name); 13289 if (playerCallbacks.length < 1) { 13290 return false; 13291 } 13292 var callback = playerCallbacks.shift(); 13293 removeCallback(player, name, callback); 13294 return callback; 13295} 13296 13297/** 13298 * Move callbacks associated with an element to another element. 13299 * 13300 * @param {HTMLElement} oldElement The old element. 13301 * @param {HTMLElement} newElement The new element. 13302 * @return {void} 13303 */ 13304function swapCallbacks(oldElement, newElement) { 13305 var playerCallbacks = callbackMap.get(oldElement); 13306 callbackMap.set(newElement, playerCallbacks); 13307 callbackMap.delete(oldElement); 13308} 13309 13310/** 13311 * @module lib/postmessage 13312 */ 13313 13314/** 13315 * Parse a message received from postMessage. 13316 * 13317 * @param {*} data The data received from postMessage. 13318 * @return {object} 13319 */ 13320function parseMessageData(data) { 13321 if (typeof data === 'string') { 13322 try { 13323 data = JSON.parse(data); 13324 } catch (error) { 13325 // If the message cannot be parsed, throw the error as a warning 13326 console.warn(error); 13327 return {}; 13328 } 13329 } 13330 return data; 13331} 13332 13333/** 13334 * Post a message to the specified target. 13335 * 13336 * @param {Player} player The player object to use. 13337 * @param {string} method The API method to call. 13338 * @param {object} params The parameters to send to the player. 13339 * @return {void} 13340 */ 13341function postMessage(player, method, params) { 13342 if (!player.element.contentWindow || !player.element.contentWindow.postMessage) { 13343 return; 13344 } 13345 var message = { 13346 method: method 13347 }; 13348 if (params !== undefined) { 13349 message.value = params; 13350 } 13351 13352 // IE 8 and 9 do not support passing messages, so stringify them 13353 var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1')); 13354 if (ieVersion >= 8 && ieVersion < 10) { 13355 message = JSON.stringify(message); 13356 } 13357 player.element.contentWindow.postMessage(message, player.origin); 13358} 13359 13360/** 13361 * Parse the data received from a message event. 13362 * 13363 * @param {Player} player The player that received the message. 13364 * @param {(Object|string)} data The message data. Strings will be parsed into JSON. 13365 * @return {void} 13366 */ 13367function processData(player, data) { 13368 data = parseMessageData(data); 13369 var callbacks = []; 13370 var param; 13371 if (data.event) { 13372 if (data.event === 'error') { 13373 var promises = getCallbacks(player, data.data.method); 13374 promises.forEach(function (promise) { 13375 var error = new Error(data.data.message); 13376 error.name = data.data.name; 13377 promise.reject(error); 13378 removeCallback(player, data.data.method, promise); 13379 }); 13380 } 13381 callbacks = getCallbacks(player, "event:".concat(data.event)); 13382 param = data.data; 13383 } else if (data.method) { 13384 var callback = shiftCallbacks(player, data.method); 13385 if (callback) { 13386 callbacks.push(callback); 13387 param = data.value; 13388 } 13389 } 13390 callbacks.forEach(function (callback) { 13391 try { 13392 if (typeof callback === 'function') { 13393 callback.call(player, param); 13394 return; 13395 } 13396 callback.resolve(param); 13397 } catch (e) { 13398 // empty 13399 } 13400 }); 13401} 13402 13403/** 13404 * @module lib/embed 13405 */ 13406var oEmbedParameters = ['autopause', 'autoplay', 'background', 'byline', 'color', 'colors', 'controls', 'dnt', 'height', 'id', 'interactive_params', 'keyboard', 'loop', 'maxheight', 'maxwidth', 'muted', 'playsinline', 'portrait', 'responsive', 'speed', 'texttrack', 'title', 'transparent', 'url', 'width']; 13407 13408/** 13409 * Get the 'data-vimeo'-prefixed attributes from an element as an object. 13410 * 13411 * @param {HTMLElement} element The element. 13412 * @param {Object} [defaults={}] The default values to use. 13413 * @return {Object<string, string>} 13414 */ 13415function getOEmbedParameters(element) { 13416 var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 13417 return oEmbedParameters.reduce(function (params, param) { 13418 var value = element.getAttribute("data-vimeo-".concat(param)); 13419 if (value || value === '') { 13420 params[param] = value === '' ? 1 : value; 13421 } 13422 return params; 13423 }, defaults); 13424} 13425 13426/** 13427 * Create an embed from oEmbed data inside an element. 13428 * 13429 * @param {object} data The oEmbed data. 13430 * @param {HTMLElement} element The element to put the iframe in. 13431 * @return {HTMLIFrameElement} The iframe embed. 13432 */ 13433function createEmbed(_ref, element) { 13434 var html = _ref.html; 13435 if (!element) { 13436 throw new TypeError('An element must be provided'); 13437 } 13438 if (element.getAttribute('data-vimeo-initialized') !== null) { 13439 return element.querySelector('iframe'); 13440 } 13441 var div = document.createElement('div'); 13442 div.innerHTML = html; 13443 element.appendChild(div.firstChild); 13444 element.setAttribute('data-vimeo-initialized', 'true'); 13445 return element.querySelector('iframe'); 13446} 13447 13448/** 13449 * Make an oEmbed call for the specified URL. 13450 * 13451 * @param {string} videoUrl The vimeo.com url for the video. 13452 * @param {Object} [params] Parameters to pass to oEmbed. 13453 * @param {HTMLElement} element The element. 13454 * @return {Promise} 13455 */ 13456function getOEmbedData(videoUrl) { 13457 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 13458 var element = arguments.length > 2 ? arguments[2] : undefined; 13459 return new Promise(function (resolve, reject) { 13460 if (!isVimeoUrl(videoUrl)) { 13461 throw new TypeError("\u201C".concat(videoUrl, "\u201D is not a vimeo.com url.")); 13462 } 13463 var url = "https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(videoUrl)); 13464 for (var param in params) { 13465 if (params.hasOwnProperty(param)) { 13466 url += "&".concat(param, "=").concat(encodeURIComponent(params[param])); 13467 } 13468 } 13469 var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest(); 13470 xhr.open('GET', url, true); 13471 xhr.onload = function () { 13472 if (xhr.status === 404) { 13473 reject(new Error("\u201C".concat(videoUrl, "\u201D was not found."))); 13474 return; 13475 } 13476 if (xhr.status === 403) { 13477 reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); 13478 return; 13479 } 13480 try { 13481 var json = JSON.parse(xhr.responseText); 13482 // Check api response for 403 on oembed 13483 if (json.domain_status_code === 403) { 13484 // We still want to create the embed to give users visual feedback 13485 createEmbed(json, element); 13486 reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); 13487 return; 13488 } 13489 resolve(json); 13490 } catch (error) { 13491 reject(error); 13492 } 13493 }; 13494 xhr.onerror = function () { 13495 var status = xhr.status ? " (".concat(xhr.status, ")") : ''; 13496 reject(new Error("There was an error fetching the embed code from Vimeo".concat(status, "."))); 13497 }; 13498 xhr.send(); 13499 }); 13500} 13501 13502/** 13503 * Initialize all embeds within a specific element 13504 * 13505 * @param {HTMLElement} [parent=document] The parent element. 13506 * @return {void} 13507 */ 13508function initializeEmbeds() { 13509 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 13510 var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]')); 13511 var handleError = function handleError(error) { 13512 if ('console' in window && console.error) { 13513 console.error("There was an error creating an embed: ".concat(error)); 13514 } 13515 }; 13516 elements.forEach(function (element) { 13517 try { 13518 // Skip any that have data-vimeo-defer 13519 if (element.getAttribute('data-vimeo-defer') !== null) { 13520 return; 13521 } 13522 var params = getOEmbedParameters(element); 13523 var url = getVimeoUrl(params); 13524 getOEmbedData(url, params, element).then(function (data) { 13525 return createEmbed(data, element); 13526 }).catch(handleError); 13527 } catch (error) { 13528 handleError(error); 13529 } 13530 }); 13531} 13532 13533/** 13534 * Resize embeds when messaged by the player. 13535 * 13536 * @param {HTMLElement} [parent=document] The parent element. 13537 * @return {void} 13538 */ 13539function resizeEmbeds() { 13540 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 13541 // Prevent execution if users include the player.js script multiple times. 13542 if (window.VimeoPlayerResizeEmbeds_) { 13543 return; 13544 } 13545 window.VimeoPlayerResizeEmbeds_ = true; 13546 var onMessage = function onMessage(event) { 13547 if (!isVimeoUrl(event.origin)) { 13548 return; 13549 } 13550 13551 // 'spacechange' is fired only on embeds with cards 13552 if (!event.data || event.data.event !== 'spacechange') { 13553 return; 13554 } 13555 var iframes = parent.querySelectorAll('iframe'); 13556 for (var i = 0; i < iframes.length; i++) { 13557 if (iframes[i].contentWindow !== event.source) { 13558 continue; 13559 } 13560 13561 // Change padding-bottom of the enclosing div to accommodate 13562 // card carousel without distorting aspect ratio 13563 var space = iframes[i].parentElement; 13564 space.style.paddingBottom = "".concat(event.data.data[0].bottom, "px"); 13565 break; 13566 } 13567 }; 13568 window.addEventListener('message', onMessage); 13569} 13570 13571/** 13572 * Add chapters to existing metadata for Google SEO 13573 * 13574 * @param {HTMLElement} [parent=document] The parent element. 13575 * @return {void} 13576 */ 13577function initAppendVideoMetadata() { 13578 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 13579 // Prevent execution if users include the player.js script multiple times. 13580 if (window.VimeoSeoMetadataAppended) { 13581 return; 13582 } 13583 window.VimeoSeoMetadataAppended = true; 13584 var onMessage = function onMessage(event) { 13585 if (!isVimeoUrl(event.origin)) { 13586 return; 13587 } 13588 var data = parseMessageData(event.data); 13589 if (!data || data.event !== 'ready') { 13590 return; 13591 } 13592 var iframes = parent.querySelectorAll('iframe'); 13593 for (var i = 0; i < iframes.length; i++) { 13594 var iframe = iframes[i]; 13595 13596 // Initiate appendVideoMetadata if iframe is a Vimeo embed 13597 var isValidMessageSource = iframe.contentWindow === event.source; 13598 if (isVimeoEmbed(iframe.src) && isValidMessageSource) { 13599 var player = new Player(iframe); 13600 player.callMethod('appendVideoMetadata', window.location.href); 13601 } 13602 } 13603 }; 13604 window.addEventListener('message', onMessage); 13605} 13606 13607/** 13608 * Seek to time indicated by vimeo_t query parameter if present in URL 13609 * 13610 * @param {HTMLElement} [parent=document] The parent element. 13611 * @return {void} 13612 */ 13613function checkUrlTimeParam() { 13614 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 13615 // Prevent execution if users include the player.js script multiple times. 13616 if (window.VimeoCheckedUrlTimeParam) { 13617 return; 13618 } 13619 window.VimeoCheckedUrlTimeParam = true; 13620 var handleError = function handleError(error) { 13621 if ('console' in window && console.error) { 13622 console.error("There was an error getting video Id: ".concat(error)); 13623 } 13624 }; 13625 var onMessage = function onMessage(event) { 13626 if (!isVimeoUrl(event.origin)) { 13627 return; 13628 } 13629 var data = parseMessageData(event.data); 13630 if (!data || data.event !== 'ready') { 13631 return; 13632 } 13633 var iframes = parent.querySelectorAll('iframe'); 13634 var _loop = function _loop() { 13635 var iframe = iframes[i]; 13636 var isValidMessageSource = iframe.contentWindow === event.source; 13637 if (isVimeoEmbed(iframe.src) && isValidMessageSource) { 13638 var player = new Player(iframe); 13639 player.getVideoId().then(function (videoId) { 13640 var matches = new RegExp("[?&]vimeo_t_".concat(videoId, "=([^&#]*)")).exec(window.location.href); 13641 if (matches && matches[1]) { 13642 var sec = decodeURI(matches[1]); 13643 player.setCurrentTime(sec); 13644 } 13645 return; 13646 }).catch(handleError); 13647 } 13648 }; 13649 for (var i = 0; i < iframes.length; i++) { 13650 _loop(); 13651 } 13652 }; 13653 window.addEventListener('message', onMessage); 13654} 13655 13656/* MIT License 13657 13658Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com) 13659 13660Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 13661 13662The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13663 13664THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 13665Terms */ 13666 13667function initializeScreenfull() { 13668 var fn = function () { 13669 var val; 13670 var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'], 13671 // New WebKit 13672 ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'], 13673 // Old WebKit 13674 ['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']]; 13675 var i = 0; 13676 var l = fnMap.length; 13677 var ret = {}; 13678 for (; i < l; i++) { 13679 val = fnMap[i]; 13680 if (val && val[1] in document) { 13681 for (i = 0; i < val.length; i++) { 13682 ret[fnMap[0][i]] = val[i]; 13683 } 13684 return ret; 13685 } 13686 } 13687 return false; 13688 }(); 13689 var eventNameMap = { 13690 fullscreenchange: fn.fullscreenchange, 13691 fullscreenerror: fn.fullscreenerror 13692 }; 13693 var screenfull = { 13694 request: function request(element) { 13695 return new Promise(function (resolve, reject) { 13696 var onFullScreenEntered = function onFullScreenEntered() { 13697 screenfull.off('fullscreenchange', onFullScreenEntered); 13698 resolve(); 13699 }; 13700 screenfull.on('fullscreenchange', onFullScreenEntered); 13701 element = element || document.documentElement; 13702 var returnPromise = element[fn.requestFullscreen](); 13703 if (returnPromise instanceof Promise) { 13704 returnPromise.then(onFullScreenEntered).catch(reject); 13705 } 13706 }); 13707 }, 13708 exit: function exit() { 13709 return new Promise(function (resolve, reject) { 13710 if (!screenfull.isFullscreen) { 13711 resolve(); 13712 return; 13713 } 13714 var onFullScreenExit = function onFullScreenExit() { 13715 screenfull.off('fullscreenchange', onFullScreenExit); 13716 resolve(); 13717 }; 13718 screenfull.on('fullscreenchange', onFullScreenExit); 13719 var returnPromise = document[fn.exitFullscreen](); 13720 if (returnPromise instanceof Promise) { 13721 returnPromise.then(onFullScreenExit).catch(reject); 13722 } 13723 }); 13724 }, 13725 on: function on(event, callback) { 13726 var eventName = eventNameMap[event]; 13727 if (eventName) { 13728 document.addEventListener(eventName, callback); 13729 } 13730 }, 13731 off: function off(event, callback) { 13732 var eventName = eventNameMap[event]; 13733 if (eventName) { 13734 document.removeEventListener(eventName, callback); 13735 } 13736 } 13737 }; 13738 Object.defineProperties(screenfull, { 13739 isFullscreen: { 13740 get: function get() { 13741 return Boolean(document[fn.fullscreenElement]); 13742 } 13743 }, 13744 element: { 13745 enumerable: true, 13746 get: function get() { 13747 return document[fn.fullscreenElement]; 13748 } 13749 }, 13750 isEnabled: { 13751 enumerable: true, 13752 get: function get() { 13753 // Coerce to boolean in case of old WebKit 13754 return Boolean(document[fn.fullscreenEnabled]); 13755 } 13756 } 13757 }); 13758 return screenfull; 13759} 13760 13761/** @typedef {import('./timing-src-connector.types').PlayerControls} PlayerControls */ 13762/** @typedef {import('./timing-object.types').TimingObject} TimingObject */ 13763/** @typedef {import('./timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */ 13764/** @typedef {(msg: string) => any} Logger */ 13765/** @typedef {import('timing-object.types').TConnectionState} TConnectionState */ 13766 13767/** 13768 * @type {TimingSrcConnectorOptions} 13769 * 13770 * For details on these properties and their effects, see the typescript definition referenced above. 13771 */ 13772var defaultOptions = { 13773 role: 'viewer', 13774 autoPlayMuted: true, 13775 allowedDrift: 0.3, 13776 maxAllowedDrift: 1, 13777 minCheckInterval: 0.1, 13778 maxRateAdjustment: 0.2, 13779 maxTimeToCatchUp: 1 13780}; 13781 13782/** 13783 * There's a proposed W3C spec for the Timing Object which would introduce a new set of APIs that would simplify time-synchronization tasks for browser applications. 13784 * 13785 * Proposed spec: https://webtiming.github.io/timingobject/ 13786 * V3 Spec: https://timingsrc.readthedocs.io/en/latest/ 13787 * Demuxed talk: https://www.youtube.com/watch?v=cZSjDaGDmX8 13788 * 13789 * This class makes it easy to connect Vimeo.Player to a provided TimingObject via Vimeo.Player.setTimingSrc(myTimingObject, options) and the synchronization will be handled automatically. 13790 * 13791 * There are 5 general responsibilities in TimingSrcConnector: 13792 * 13793 * 1. `updatePlayer()` which sets the player's currentTime, playbackRate and pause/play state based on current state of the TimingObject. 13794 * 2. `updateTimingObject()` which sets the TimingObject's position and velocity from the player's state. 13795 * 3. `playerUpdater` which listens for change events on the TimingObject and will respond by calling updatePlayer. 13796 * 4. `timingObjectUpdater` which listens to the player events of seeked, play and pause and will respond by calling `updateTimingObject()`. 13797 * 5. `maintainPlaybackPosition` this is code that constantly monitors the player to make sure it's always in sync with the TimingObject. This is needed because videos will generally not play with precise time accuracy and there will be some drift which becomes more noticeable over longer periods (as noted in the timing-object spec). More details on this method below. 13798 */ 13799var TimingSrcConnector = /*#__PURE__*/function (_EventTarget) { 13800 _inherits(TimingSrcConnector, _EventTarget); 13801 var _super = _createSuper(TimingSrcConnector); 13802 /** 13803 * @param {PlayerControls} player 13804 * @param {TimingObject} timingObject 13805 * @param {TimingSrcConnectorOptions} options 13806 * @param {Logger} logger 13807 */ 13808 function TimingSrcConnector(_player, timingObject) { 13809 var _this; 13810 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 13811 var logger = arguments.length > 3 ? arguments[3] : undefined; 13812 _classCallCheck(this, TimingSrcConnector); 13813 _this = _super.call(this); 13814 _defineProperty(_assertThisInitialized(_this), "logger", void 0); 13815 _defineProperty(_assertThisInitialized(_this), "speedAdjustment", 0); 13816 /** 13817 * @param {PlayerControls} player 13818 * @param {number} newAdjustment 13819 * @return {Promise<void>} 13820 */ 13821 _defineProperty(_assertThisInitialized(_this), "adjustSpeed", /*#__PURE__*/function () { 13822 var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(player, newAdjustment) { 13823 var newPlaybackRate; 13824 return _regeneratorRuntime().wrap(function _callee$(_context) { 13825 while (1) switch (_context.prev = _context.next) { 13826 case 0: 13827 if (!(_this.speedAdjustment === newAdjustment)) { 13828 _context.next = 2; 13829 break; 13830 } 13831 return _context.abrupt("return"); 13832 case 2: 13833 _context.next = 4; 13834 return player.getPlaybackRate(); 13835 case 4: 13836 _context.t0 = _context.sent; 13837 _context.t1 = _this.speedAdjustment; 13838 _context.t2 = _context.t0 - _context.t1; 13839 _context.t3 = newAdjustment; 13840 newPlaybackRate = _context.t2 + _context.t3; 13841 _this.log("New playbackRate: ".concat(newPlaybackRate)); 13842 _context.next = 12; 13843 return player.setPlaybackRate(newPlaybackRate); 13844 case 12: 13845 _this.speedAdjustment = newAdjustment; 13846 case 13: 13847 case "end": 13848 return _context.stop(); 13849 } 13850 }, _callee); 13851 })); 13852 return function (_x, _x2) { 13853 return _ref.apply(this, arguments); 13854 }; 13855 }()); 13856 _this.logger = logger; 13857 _this.init(timingObject, _player, _objectSpread2(_objectSpread2({}, defaultOptions), options)); 13858 return _this; 13859 } 13860 _createClass(TimingSrcConnector, [{ 13861 key: "disconnect", 13862 value: function disconnect() { 13863 this.dispatchEvent(new Event('disconnect')); 13864 } 13865 13866 /** 13867 * @param {TimingObject} timingObject 13868 * @param {PlayerControls} player 13869 * @param {TimingSrcConnectorOptions} options 13870 * @return {Promise<void>} 13871 */ 13872 }, { 13873 key: "init", 13874 value: function () { 13875 var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(timingObject, player, options) { 13876 var _this2 = this; 13877 var playerUpdater, positionSync, timingObjectUpdater; 13878 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 13879 while (1) switch (_context2.prev = _context2.next) { 13880 case 0: 13881 _context2.next = 2; 13882 return this.waitForTOReadyState(timingObject, 'open'); 13883 case 2: 13884 if (!(options.role === 'viewer')) { 13885 _context2.next = 10; 13886 break; 13887 } 13888 _context2.next = 5; 13889 return this.updatePlayer(timingObject, player, options); 13890 case 5: 13891 playerUpdater = subscribe(timingObject, 'change', function () { 13892 return _this2.updatePlayer(timingObject, player, options); 13893 }); 13894 positionSync = this.maintainPlaybackPosition(timingObject, player, options); 13895 this.addEventListener('disconnect', function () { 13896 positionSync.cancel(); 13897 playerUpdater.cancel(); 13898 }); 13899 _context2.next = 14; 13900 break; 13901 case 10: 13902 _context2.next = 12; 13903 return this.updateTimingObject(timingObject, player); 13904 case 12: 13905 timingObjectUpdater = subscribe(player, ['seeked', 'play', 'pause', 'ratechange'], function () { 13906 return _this2.updateTimingObject(timingObject, player); 13907 }, 'on', 'off'); 13908 this.addEventListener('disconnect', function () { 13909 return timingObjectUpdater.cancel(); 13910 }); 13911 case 14: 13912 case "end": 13913 return _context2.stop(); 13914 } 13915 }, _callee2, this); 13916 })); 13917 function init(_x3, _x4, _x5) { 13918 return _init.apply(this, arguments); 13919 } 13920 return init; 13921 }() 13922 /** 13923 * Sets the TimingObject's state to reflect that of the player 13924 * 13925 * @param {TimingObject} timingObject 13926 * @param {PlayerControls} player 13927 * @return {Promise<void>} 13928 */ 13929 }, { 13930 key: "updateTimingObject", 13931 value: function () { 13932 var _updateTimingObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(timingObject, player) { 13933 return _regeneratorRuntime().wrap(function _callee3$(_context3) { 13934 while (1) switch (_context3.prev = _context3.next) { 13935 case 0: 13936 _context3.t0 = timingObject; 13937 _context3.next = 3; 13938 return player.getCurrentTime(); 13939 case 3: 13940 _context3.t1 = _context3.sent; 13941 _context3.next = 6; 13942 return player.getPaused(); 13943 case 6: 13944 if (!_context3.sent) { 13945 _context3.next = 10; 13946 break; 13947 } 13948 _context3.t2 = 0; 13949 _context3.next = 13; 13950 break; 13951 case 10: 13952 _context3.next = 12; 13953 return player.getPlaybackRate(); 13954 case 12: 13955 _context3.t2 = _context3.sent; 13956 case 13: 13957 _context3.t3 = _context3.t2; 13958 _context3.t4 = { 13959 position: _context3.t1, 13960 velocity: _context3.t3 13961 }; 13962 _context3.t0.update.call(_context3.t0, _context3.t4); 13963 case 16: 13964 case "end": 13965 return _context3.stop(); 13966 } 13967 }, _callee3); 13968 })); 13969 function updateTimingObject(_x6, _x7) { 13970 return _updateTimingObject.apply(this, arguments); 13971 } 13972 return updateTimingObject; 13973 }() 13974 /** 13975 * Sets the player's timing state to reflect that of the TimingObject 13976 * 13977 * @param {TimingObject} timingObject 13978 * @param {PlayerControls} player 13979 * @param {TimingSrcConnectorOptions} options 13980 * @return {Promise<void>} 13981 */ 13982 }, { 13983 key: "updatePlayer", 13984 value: function () { 13985 var _updatePlayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(timingObject, player, options) { 13986 var _timingObject$query, position, velocity; 13987 return _regeneratorRuntime().wrap(function _callee5$(_context5) { 13988 while (1) switch (_context5.prev = _context5.next) { 13989 case 0: 13990 _timingObject$query = timingObject.query(), position = _timingObject$query.position, velocity = _timingObject$query.velocity; 13991 if (typeof position === 'number') { 13992 player.setCurrentTime(position); 13993 } 13994 if (!(typeof velocity === 'number')) { 13995 _context5.next = 25; 13996 break; 13997 } 13998 if (!(velocity === 0)) { 13999 _context5.next = 11; 14000 break; 14001 } 14002 _context5.next = 6; 14003 return player.getPaused(); 14004 case 6: 14005 _context5.t0 = _context5.sent; 14006 if (!(_context5.t0 === false)) { 14007 _context5.next = 9; 14008 break; 14009 } 14010 player.pause(); 14011 case 9: 14012 _context5.next = 25; 14013 break; 14014 case 11: 14015 if (!(velocity > 0)) { 14016 _context5.next = 25; 14017 break; 14018 } 14019 _context5.next = 14; 14020 return player.getPaused(); 14021 case 14: 14022 _context5.t1 = _context5.sent; 14023 if (!(_context5.t1 === true)) { 14024 _context5.next = 19; 14025 break; 14026 } 14027 _context5.next = 18; 14028 return player.play().catch( /*#__PURE__*/function () { 14029 var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) { 14030 return _regeneratorRuntime().wrap(function _callee4$(_context4) { 14031 while (1) switch (_context4.prev = _context4.next) { 14032 case 0: 14033 if (!(err.name === 'NotAllowedError' && options.autoPlayMuted)) { 14034 _context4.next = 5; 14035 break; 14036 } 14037 _context4.next = 3; 14038 return player.setMuted(true); 14039 case 3: 14040 _context4.next = 5; 14041 return player.play().catch(function (err2) { 14042 return console.error('Couldn\'t play the video from TimingSrcConnector. Error:', err2); 14043 }); 14044 case 5: 14045 case "end": 14046 return _context4.stop(); 14047 } 14048 }, _callee4); 14049 })); 14050 return function (_x11) { 14051 return _ref2.apply(this, arguments); 14052 }; 14053 }()); 14054 case 18: 14055 this.updatePlayer(timingObject, player, options); 14056 case 19: 14057 _context5.next = 21; 14058 return player.getPlaybackRate(); 14059 case 21: 14060 _context5.t2 = _context5.sent; 14061 _context5.t3 = velocity; 14062 if (!(_context5.t2 !== _context5.t3)) { 14063 _context5.next = 25; 14064 break; 14065 } 14066 player.setPlaybackRate(velocity); 14067 case 25: 14068 case "end": 14069 return _context5.stop(); 14070 } 14071 }, _callee5, this); 14072 })); 14073 function updatePlayer(_x8, _x9, _x10) { 14074 return _updatePlayer.apply(this, arguments); 14075 } 14076 return updatePlayer; 14077 }() 14078 /** 14079 * Since video players do not play with 100% time precision, we need to closely monitor 14080 * our player to be sure it remains in sync with the TimingObject. 14081 * 14082 * If out of sync, we use the current conditions and the options provided to determine 14083 * whether to re-sync via setting currentTime or adjusting the playbackRate 14084 * 14085 * @param {TimingObject} timingObject 14086 * @param {PlayerControls} player 14087 * @param {TimingSrcConnectorOptions} options 14088 * @return {{cancel: (function(): void)}} 14089 */ 14090 }, { 14091 key: "maintainPlaybackPosition", 14092 value: function maintainPlaybackPosition(timingObject, player, options) { 14093 var _this3 = this; 14094 var allowedDrift = options.allowedDrift, 14095 maxAllowedDrift = options.maxAllowedDrift, 14096 minCheckInterval = options.minCheckInterval, 14097 maxRateAdjustment = options.maxRateAdjustment, 14098 maxTimeToCatchUp = options.maxTimeToCatchUp; 14099 var syncInterval = Math.min(maxTimeToCatchUp, Math.max(minCheckInterval, maxAllowedDrift)) * 1000; 14100 var check = /*#__PURE__*/function () { 14101 var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() { 14102 var diff, diffAbs, min, max, adjustment; 14103 return _regeneratorRuntime().wrap(function _callee6$(_context6) { 14104 while (1) switch (_context6.prev = _context6.next) { 14105 case 0: 14106 _context6.t0 = timingObject.query().velocity === 0; 14107 if (_context6.t0) { 14108 _context6.next = 6; 14109 break; 14110 } 14111 _context6.next = 4; 14112 return player.getPaused(); 14113 case 4: 14114 _context6.t1 = _context6.sent; 14115 _context6.t0 = _context6.t1 === true; 14116 case 6: 14117 if (!_context6.t0) { 14118 _context6.next = 8; 14119 break; 14120 } 14121 return _context6.abrupt("return"); 14122 case 8: 14123 _context6.t2 = timingObject.query().position; 14124 _context6.next = 11; 14125 return player.getCurrentTime(); 14126 case 11: 14127 _context6.t3 = _context6.sent; 14128 diff = _context6.t2 - _context6.t3; 14129 diffAbs = Math.abs(diff); 14130 _this3.log("Drift: ".concat(diff)); 14131 if (!(diffAbs > maxAllowedDrift)) { 14132 _context6.next = 22; 14133 break; 14134 } 14135 _context6.next = 18; 14136 return _this3.adjustSpeed(player, 0); 14137 case 18: 14138 player.setCurrentTime(timingObject.query().position); 14139 _this3.log('Resync by currentTime'); 14140 _context6.next = 29; 14141 break; 14142 case 22: 14143 if (!(diffAbs > allowedDrift)) { 14144 _context6.next = 29; 14145 break; 14146 } 14147 min = diffAbs / maxTimeToCatchUp; 14148 max = maxRateAdjustment; 14149 adjustment = min < max ? (max - min) / 2 : max; 14150 _context6.next = 28; 14151 return _this3.adjustSpeed(player, adjustment * Math.sign(diff)); 14152 case 28: 14153 _this3.log('Resync by playbackRate'); 14154 case 29: 14155 case "end": 14156 return _context6.stop(); 14157 } 14158 }, _callee6); 14159 })); 14160 return function check() { 14161 return _ref3.apply(this, arguments); 14162 }; 14163 }(); 14164 var interval = setInterval(function () { 14165 return check(); 14166 }, syncInterval); 14167 return { 14168 cancel: function cancel() { 14169 return clearInterval(interval); 14170 } 14171 }; 14172 } 14173 14174 /** 14175 * @param {string} msg 14176 */ 14177 }, { 14178 key: "log", 14179 value: function log(msg) { 14180 var _this$logger; 14181 (_this$logger = this.logger) === null || _this$logger === void 0 ? void 0 : _this$logger.call(this, "TimingSrcConnector: ".concat(msg)); 14182 } 14183 }, { 14184 key: "waitForTOReadyState", 14185 value: 14186 /** 14187 * @param {TimingObject} timingObject 14188 * @param {TConnectionState} state 14189 * @return {Promise<void>} 14190 */ 14191 function waitForTOReadyState(timingObject, state) { 14192 return new Promise(function (resolve) { 14193 var check = function check() { 14194 if (timingObject.readyState === state) { 14195 resolve(); 14196 } else { 14197 timingObject.addEventListener('readystatechange', check, { 14198 once: true 14199 }); 14200 } 14201 }; 14202 check(); 14203 }); 14204 } 14205 }]); 14206 return TimingSrcConnector; 14207}( /*#__PURE__*/_wrapNativeSuper(EventTarget)); 14208 14209var playerMap = new WeakMap(); 14210var readyMap = new WeakMap(); 14211var screenfull = {}; 14212var Player = /*#__PURE__*/function () { 14213 /** 14214 * Create a Player. 14215 * 14216 * @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo 14217 * player iframe, and id, or a jQuery object. 14218 * @param {object} [options] oEmbed parameters to use when creating an embed in the element. 14219 * @return {Player} 14220 */ 14221 function Player(element) { 14222 var _this = this; 14223 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 14224 _classCallCheck(this, Player); 14225 /* global jQuery */ 14226 if (window.jQuery && element instanceof jQuery) { 14227 if (element.length > 1 && window.console && console.warn) { 14228 console.warn('A jQuery object with multiple elements was passed, using the first element.'); 14229 } 14230 element = element[0]; 14231 } 14232 14233 // Find an element by ID 14234 if (typeof document !== 'undefined' && typeof element === 'string') { 14235 element = document.getElementById(element); 14236 } 14237 14238 // Not an element! 14239 if (!isDomElement(element)) { 14240 throw new TypeError('You must pass either a valid element or a valid id.'); 14241 } 14242 14243 // Already initialized an embed in this div, so grab the iframe 14244 if (element.nodeName !== 'IFRAME') { 14245 var iframe = element.querySelector('iframe'); 14246 if (iframe) { 14247 element = iframe; 14248 } 14249 } 14250 14251 // iframe url is not a Vimeo url 14252 if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) { 14253 throw new Error('The player element passed isnât a Vimeo embed.'); 14254 } 14255 14256 // If there is already a player object in the map, return that 14257 if (playerMap.has(element)) { 14258 return playerMap.get(element); 14259 } 14260 this._window = element.ownerDocument.defaultView; 14261 this.element = element; 14262 this.origin = '*'; 14263 var readyPromise = new npo_src(function (resolve, reject) { 14264 _this._onMessage = function (event) { 14265 if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) { 14266 return; 14267 } 14268 if (_this.origin === '*') { 14269 _this.origin = event.origin; 14270 } 14271 var data = parseMessageData(event.data); 14272 var isError = data && data.event === 'error'; 14273 var isReadyError = isError && data.data && data.data.method === 'ready'; 14274 if (isReadyError) { 14275 var error = new Error(data.data.message); 14276 error.name = data.data.name; 14277 reject(error); 14278 return; 14279 } 14280 var isReadyEvent = data && data.event === 'ready'; 14281 var isPingResponse = data && data.method === 'ping'; 14282 if (isReadyEvent || isPingResponse) { 14283 _this.element.setAttribute('data-ready', 'true'); 14284 resolve(); 14285 return; 14286 } 14287 processData(_this, data); 14288 }; 14289 _this._window.addEventListener('message', _this._onMessage); 14290 if (_this.element.nodeName !== 'IFRAME') { 14291 var params = getOEmbedParameters(element, options); 14292 var url = getVimeoUrl(params); 14293 getOEmbedData(url, params, element).then(function (data) { 14294 var iframe = createEmbed(data, element); 14295 // Overwrite element with the new iframe, 14296 // but store reference to the original element 14297 _this.element = iframe; 14298 _this._originalElement = element; 14299 swapCallbacks(element, iframe); 14300 playerMap.set(_this.element, _this); 14301 return data; 14302 }).catch(reject); 14303 } 14304 }); 14305 14306 // Store a copy of this Player in the map 14307 readyMap.set(this, readyPromise); 14308 playerMap.set(this.element, this); 14309 14310 // Send a ping to the iframe so the ready promise will be resolved if 14311 // the player is already ready. 14312 if (this.element.nodeName === 'IFRAME') { 14313 postMessage(this, 'ping'); 14314 } 14315 if (screenfull.isEnabled) { 14316 var exitFullscreen = function exitFullscreen() { 14317 return screenfull.exit(); 14318 }; 14319 this.fullscreenchangeHandler = function () { 14320 if (screenfull.isFullscreen) { 14321 storeCallback(_this, 'event:exitFullscreen', exitFullscreen); 14322 } else { 14323 removeCallback(_this, 'event:exitFullscreen', exitFullscreen); 14324 } 14325 // eslint-disable-next-line 14326 _this.ready().then(function () { 14327 postMessage(_this, 'fullscreenchange', screenfull.isFullscreen); 14328 }); 14329 }; 14330 screenfull.on('fullscreenchange', this.fullscreenchangeHandler); 14331 } 14332 return this; 14333 } 14334 14335 /** 14336 * Get a promise for a method. 14337 * 14338 * @param {string} name The API method to call. 14339 * @param {Object} [args={}] Arguments to send via postMessage. 14340 * @return {Promise} 14341 */ 14342 _createClass(Player, [{ 14343 key: "callMethod", 14344 value: function callMethod(name) { 14345 var _this2 = this; 14346 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 14347 return new npo_src(function (resolve, reject) { 14348 // We are storing the resolve/reject handlers to call later, so we 14349 // canât return here. 14350 // eslint-disable-next-line promise/always-return 14351 return _this2.ready().then(function () { 14352 storeCallback(_this2, name, { 14353 resolve: resolve, 14354 reject: reject 14355 }); 14356 postMessage(_this2, name, args); 14357 }).catch(reject); 14358 }); 14359 } 14360 14361 /** 14362 * Get a promise for the value of a player property. 14363 * 14364 * @param {string} name The property name 14365 * @return {Promise} 14366 */ 14367 }, { 14368 key: "get", 14369 value: function get(name) { 14370 var _this3 = this; 14371 return new npo_src(function (resolve, reject) { 14372 name = getMethodName(name, 'get'); 14373 14374 // We are storing the resolve/reject handlers to call later, so we 14375 // canât return here. 14376 // eslint-disable-next-line promise/always-return 14377 return _this3.ready().then(function () { 14378 storeCallback(_this3, name, { 14379 resolve: resolve, 14380 reject: reject 14381 }); 14382 postMessage(_this3, name); 14383 }).catch(reject); 14384 }); 14385 } 14386 14387 /** 14388 * Get a promise for setting the value of a player property. 14389 * 14390 * @param {string} name The API method to call. 14391 * @param {mixed} value The value to set. 14392 * @return {Promise} 14393 */ 14394 }, { 14395 key: "set", 14396 value: function set(name, value) { 14397 var _this4 = this; 14398 return new npo_src(function (resolve, reject) { 14399 name = getMethodName(name, 'set'); 14400 if (value === undefined || value === null) { 14401 throw new TypeError('There must be a value to set.'); 14402 } 14403 14404 // We are storing the resolve/reject handlers to call later, so we 14405 // canât return here. 14406 // eslint-disable-next-line promise/always-return 14407 return _this4.ready().then(function () { 14408 storeCallback(_this4, name, { 14409 resolve: resolve, 14410 reject: reject 14411 }); 14412 postMessage(_this4, name, value); 14413 }).catch(reject); 14414 }); 14415 } 14416 14417 /** 14418 * Add an event listener for the specified event. Will call the 14419 * callback with a single parameter, `data`, that contains the data for 14420 * that event. 14421 * 14422 * @param {string} eventName The name of the event. 14423 * @param {function(*)} callback The function to call when the event fires. 14424 * @return {void} 14425 */ 14426 }, { 14427 key: "on", 14428 value: function on(eventName, callback) { 14429 if (!eventName) { 14430 throw new TypeError('You must pass an event name.'); 14431 } 14432 if (!callback) { 14433 throw new TypeError('You must pass a callback function.'); 14434 } 14435 if (typeof callback !== 'function') { 14436 throw new TypeError('The callback must be a function.'); 14437 } 14438 var callbacks = getCallbacks(this, "event:".concat(eventName)); 14439 if (callbacks.length === 0) { 14440 this.callMethod('addEventListener', eventName).catch(function () { 14441 // Ignore the error. There will be an error event fired that 14442 // will trigger the error callback if they are listening. 14443 }); 14444 } 14445 storeCallback(this, "event:".concat(eventName), callback); 14446 } 14447 14448 /** 14449 * Remove an event listener for the specified event. Will remove all 14450 * listeners for that event if a `callback` isnât passed, or only that 14451 * specific callback if it is passed. 14452 * 14453 * @param {string} eventName The name of the event. 14454 * @param {function} [callback] The specific callback to remove. 14455 * @return {void} 14456 */ 14457 }, { 14458 key: "off", 14459 value: function off(eventName, callback) { 14460 if (!eventName) { 14461 throw new TypeError('You must pass an event name.'); 14462 } 14463 if (callback && typeof callback !== 'function') { 14464 throw new TypeError('The callback must be a function.'); 14465 } 14466 var lastCallback = removeCallback(this, "event:".concat(eventName), callback); 14467 14468 // If there are no callbacks left, remove the listener 14469 if (lastCallback) { 14470 this.callMethod('removeEventListener', eventName).catch(function (e) { 14471 // Ignore the error. There will be an error event fired that 14472 // will trigger the error callback if they are listening. 14473 }); 14474 } 14475 } 14476 14477 /** 14478 * A promise to load a new video. 14479 * 14480 * @promise LoadVideoPromise 14481 * @fulfill {number} The video with this id or url successfully loaded. 14482 * @reject {TypeError} The id was not a number. 14483 */ 14484 /** 14485 * Load a new video into this embed. The promise will be resolved if 14486 * the video is successfully loaded, or it will be rejected if it could 14487 * not be loaded. 14488 * 14489 * @param {number|string|object} options The id of the video, the url of the video, or an object with embed options. 14490 * @return {LoadVideoPromise} 14491 */ 14492 }, { 14493 key: "loadVideo", 14494 value: function loadVideo(options) { 14495 return this.callMethod('loadVideo', options); 14496 } 14497 14498 /** 14499 * A promise to perform an action when the Player is ready. 14500 * 14501 * @todo document errors 14502 * @promise LoadVideoPromise 14503 * @fulfill {void} 14504 */ 14505 /** 14506 * Trigger a function when the player iframe has initialized. You do not 14507 * need to wait for `ready` to trigger to begin adding event listeners 14508 * or calling other methods. 14509 * 14510 * @return {ReadyPromise} 14511 */ 14512 }, { 14513 key: "ready", 14514 value: function ready() { 14515 var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) { 14516 reject(new Error('Unknown player. Probably unloaded.')); 14517 }); 14518 return npo_src.resolve(readyPromise); 14519 } 14520 14521 /** 14522 * A promise to add a cue point to the player. 14523 * 14524 * @promise AddCuePointPromise 14525 * @fulfill {string} The id of the cue point to use for removeCuePoint. 14526 * @reject {RangeError} the time was less than 0 or greater than the 14527 * videoâs duration. 14528 * @reject {UnsupportedError} Cue points are not supported with the current 14529 * player or browser. 14530 */ 14531 /** 14532 * Add a cue point to the player. 14533 * 14534 * @param {number} time The time for the cue point. 14535 * @param {object} [data] Arbitrary data to be returned with the cue point. 14536 * @return {AddCuePointPromise} 14537 */ 14538 }, { 14539 key: "addCuePoint", 14540 value: function addCuePoint(time) { 14541 var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 14542 return this.callMethod('addCuePoint', { 14543 time: time, 14544 data: data 14545 }); 14546 } 14547 14548 /** 14549 * A promise to remove a cue point from the player. 14550 * 14551 * @promise AddCuePointPromise 14552 * @fulfill {string} The id of the cue point that was removed. 14553 * @reject {InvalidCuePoint} The cue point with the specified id was not 14554 * found. 14555 * @reject {UnsupportedError} Cue points are not supported with the current 14556 * player or browser. 14557 */ 14558 /** 14559 * Remove a cue point from the video. 14560 * 14561 * @param {string} id The id of the cue point to remove. 14562 * @return {RemoveCuePointPromise} 14563 */ 14564 }, { 14565 key: "removeCuePoint", 14566 value: function removeCuePoint(id) { 14567 return this.callMethod('removeCuePoint', id); 14568 } 14569 14570 /** 14571 * A representation of a text track on a video. 14572 * 14573 * @typedef {Object} VimeoTextTrack 14574 * @property {string} language The ISO language code. 14575 * @property {string} kind The kind of track it is (captions or subtitles). 14576 * @property {string} label The humanâreadable label for the track. 14577 */ 14578 /** 14579 * A promise to enable a text track. 14580 * 14581 * @promise EnableTextTrackPromise 14582 * @fulfill {VimeoTextTrack} The text track that was enabled. 14583 * @reject {InvalidTrackLanguageError} No track was available with the 14584 * specified language. 14585 * @reject {InvalidTrackError} No track was available with the specified 14586 * language and kind. 14587 */ 14588 /** 14589 * Enable the text track with the specified language, and optionally the 14590 * specified kind (captions or subtitles). 14591 * 14592 * When set via the API, the track language will not change the viewerâs 14593 * stored preference. 14594 * 14595 * @param {string} language The twoâletter language code. 14596 * @param {string} [kind] The kind of track to enable (captions or subtitles). 14597 * @return {EnableTextTrackPromise} 14598 */ 14599 }, { 14600 key: "enableTextTrack", 14601 value: function enableTextTrack(language, kind) { 14602 if (!language) { 14603 throw new TypeError('You must pass a language.'); 14604 } 14605 return this.callMethod('enableTextTrack', { 14606 language: language, 14607 kind: kind 14608 }); 14609 } 14610 14611 /** 14612 * A promise to disable the active text track. 14613 * 14614 * @promise DisableTextTrackPromise 14615 * @fulfill {void} The track was disabled. 14616 */ 14617 /** 14618 * Disable the currently-active text track. 14619 * 14620 * @return {DisableTextTrackPromise} 14621 */ 14622 }, { 14623 key: "disableTextTrack", 14624 value: function disableTextTrack() { 14625 return this.callMethod('disableTextTrack'); 14626 } 14627 14628 /** 14629 * A promise to pause the video. 14630 * 14631 * @promise PausePromise 14632 * @fulfill {void} The video was paused. 14633 */ 14634 /** 14635 * Pause the video if itâs playing. 14636 * 14637 * @return {PausePromise} 14638 */ 14639 }, { 14640 key: "pause", 14641 value: function pause() { 14642 return this.callMethod('pause'); 14643 } 14644 14645 /** 14646 * A promise to play the video. 14647 * 14648 * @promise PlayPromise 14649 * @fulfill {void} The video was played. 14650 */ 14651 /** 14652 * Play the video if itâs paused. **Note:** on iOS and some other 14653 * mobile devices, you cannot programmatically trigger play. Once the 14654 * viewer has tapped on the play button in the player, however, you 14655 * will be able to use this function. 14656 * 14657 * @return {PlayPromise} 14658 */ 14659 }, { 14660 key: "play", 14661 value: function play() { 14662 return this.callMethod('play'); 14663 } 14664 14665 /** 14666 * Request that the player enters fullscreen. 14667 * @return {Promise} 14668 */ 14669 }, { 14670 key: "requestFullscreen", 14671 value: function requestFullscreen() { 14672 if (screenfull.isEnabled) { 14673 return screenfull.request(this.element); 14674 } 14675 return this.callMethod('requestFullscreen'); 14676 } 14677 14678 /** 14679 * Request that the player exits fullscreen. 14680 * @return {Promise} 14681 */ 14682 }, { 14683 key: "exitFullscreen", 14684 value: function exitFullscreen() { 14685 if (screenfull.isEnabled) { 14686 return screenfull.exit(); 14687 } 14688 return this.callMethod('exitFullscreen'); 14689 } 14690 14691 /** 14692 * Returns true if the player is currently fullscreen. 14693 * @return {Promise} 14694 */ 14695 }, { 14696 key: "getFullscreen", 14697 value: function getFullscreen() { 14698 if (screenfull.isEnabled) { 14699 return npo_src.resolve(screenfull.isFullscreen); 14700 } 14701 return this.get('fullscreen'); 14702 } 14703 14704 /** 14705 * Request that the player enters picture-in-picture. 14706 * @return {Promise} 14707 */ 14708 }, { 14709 key: "requestPictureInPicture", 14710 value: function requestPictureInPicture() { 14711 return this.callMethod('requestPictureInPicture'); 14712 } 14713 14714 /** 14715 * Request that the player exits picture-in-picture. 14716 * @return {Promise} 14717 */ 14718 }, { 14719 key: "exitPictureInPicture", 14720 value: function exitPictureInPicture() { 14721 return this.callMethod('exitPictureInPicture'); 14722 } 14723 14724 /** 14725 * Returns true if the player is currently picture-in-picture. 14726 * @return {Promise} 14727 */ 14728 }, { 14729 key: "getPictureInPicture", 14730 value: function getPictureInPicture() { 14731 return this.get('pictureInPicture'); 14732 } 14733 14734 /** 14735 * A promise to prompt the viewer to initiate remote playback. 14736 * 14737 * @promise RemotePlaybackPromptPromise 14738 * @fulfill {void} 14739 * @reject {NotFoundError} No remote playback device is available. 14740 */ 14741 /** 14742 * Request to prompt the user to initiate remote playback. 14743 * 14744 * @return {RemotePlaybackPromptPromise} 14745 */ 14746 }, { 14747 key: "remotePlaybackPrompt", 14748 value: function remotePlaybackPrompt() { 14749 return this.callMethod('remotePlaybackPrompt'); 14750 } 14751 14752 /** 14753 * A promise to unload the video. 14754 * 14755 * @promise UnloadPromise 14756 * @fulfill {void} The video was unloaded. 14757 */ 14758 /** 14759 * Return the player to its initial state. 14760 * 14761 * @return {UnloadPromise} 14762 */ 14763 }, { 14764 key: "unload", 14765 value: function unload() { 14766 return this.callMethod('unload'); 14767 } 14768 14769 /** 14770 * Cleanup the player and remove it from the DOM 14771 * 14772 * It won't be usable and a new one should be constructed 14773 * in order to do any operations. 14774 * 14775 * @return {Promise} 14776 */ 14777 }, { 14778 key: "destroy", 14779 value: function destroy() { 14780 var _this5 = this; 14781 return new npo_src(function (resolve) { 14782 readyMap.delete(_this5); 14783 playerMap.delete(_this5.element); 14784 if (_this5._originalElement) { 14785 playerMap.delete(_this5._originalElement); 14786 _this5._originalElement.removeAttribute('data-vimeo-initialized'); 14787 } 14788 if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) { 14789 // If we've added an additional wrapper div, remove that from the DOM. 14790 // If not, just remove the iframe element. 14791 if (_this5.element.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== _this5.element.parentNode) { 14792 _this5.element.parentNode.parentNode.removeChild(_this5.element.parentNode); 14793 } else { 14794 _this5.element.parentNode.removeChild(_this5.element); 14795 } 14796 } 14797 14798 // If the clip is private there is a case where the element stays the 14799 // div element. Destroy should reset the div and remove the iframe child. 14800 if (_this5.element && _this5.element.nodeName === 'DIV' && _this5.element.parentNode) { 14801 _this5.element.removeAttribute('data-vimeo-initialized'); 14802 var iframe = _this5.element.querySelector('iframe'); 14803 if (iframe && iframe.parentNode) { 14804 // If we've added an additional wrapper div, remove that from the DOM. 14805 // If not, just remove the iframe element. 14806 if (iframe.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== iframe.parentNode) { 14807 iframe.parentNode.parentNode.removeChild(iframe.parentNode); 14808 } else { 14809 iframe.parentNode.removeChild(iframe); 14810 } 14811 } 14812 } 14813 _this5._window.removeEventListener('message', _this5._onMessage); 14814 if (screenfull.isEnabled) { 14815 screenfull.off('fullscreenchange', _this5.fullscreenchangeHandler); 14816 } 14817 resolve(); 14818 }); 14819 } 14820 14821 /** 14822 * A promise to get the autopause behavior of the video. 14823 * 14824 * @promise GetAutopausePromise 14825 * @fulfill {boolean} Whether autopause is turned on or off. 14826 * @reject {UnsupportedError} Autopause is not supported with the current 14827 * player or browser. 14828 */ 14829 /** 14830 * Get the autopause behavior for this player. 14831 * 14832 * @return {GetAutopausePromise} 14833 */ 14834 }, { 14835 key: "getAutopause", 14836 value: function getAutopause() { 14837 return this.get('autopause'); 14838 } 14839 14840 /** 14841 * A promise to set the autopause behavior of the video. 14842 * 14843 * @promise SetAutopausePromise 14844 * @fulfill {boolean} Whether autopause is turned on or off. 14845 * @reject {UnsupportedError} Autopause is not supported with the current 14846 * player or browser. 14847 */ 14848 /** 14849 * Enable or disable the autopause behavior of this player. 14850 * 14851 * By default, when another video is played in the same browser, this 14852 * player will automatically pause. Unless you have a specific reason 14853 * for doing so, we recommend that you leave autopause set to the 14854 * default (`true`). 14855 * 14856 * @param {boolean} autopause 14857 * @return {SetAutopausePromise} 14858 */ 14859 }, { 14860 key: "setAutopause", 14861 value: function setAutopause(autopause) { 14862 return this.set('autopause', autopause); 14863 } 14864 14865 /** 14866 * A promise to get the buffered property of the video. 14867 * 14868 * @promise GetBufferedPromise 14869 * @fulfill {Array} Buffered Timeranges converted to an Array. 14870 */ 14871 /** 14872 * Get the buffered property of the video. 14873 * 14874 * @return {GetBufferedPromise} 14875 */ 14876 }, { 14877 key: "getBuffered", 14878 value: function getBuffered() { 14879 return this.get('buffered'); 14880 } 14881 14882 /** 14883 * @typedef {Object} CameraProperties 14884 * @prop {number} props.yaw - Number between 0 and 360. 14885 * @prop {number} props.pitch - Number between -90 and 90. 14886 * @prop {number} props.roll - Number between -180 and 180. 14887 * @prop {number} props.fov - The field of view in degrees. 14888 */ 14889 /** 14890 * A promise to get the camera properties of the player. 14891 * 14892 * @promise GetCameraPromise 14893 * @fulfill {CameraProperties} The camera properties. 14894 */ 14895 /** 14896 * For 360° videos get the camera properties for this player. 14897 * 14898 * @return {GetCameraPromise} 14899 */ 14900 }, { 14901 key: "getCameraProps", 14902 value: function getCameraProps() { 14903 return this.get('cameraProps'); 14904 } 14905 14906 /** 14907 * A promise to set the camera properties of the player. 14908 * 14909 * @promise SetCameraPromise 14910 * @fulfill {Object} The camera was successfully set. 14911 * @reject {RangeError} The range was out of bounds. 14912 */ 14913 /** 14914 * For 360° videos set the camera properties for this player. 14915 * 14916 * @param {CameraProperties} camera The camera properties 14917 * @return {SetCameraPromise} 14918 */ 14919 }, { 14920 key: "setCameraProps", 14921 value: function setCameraProps(camera) { 14922 return this.set('cameraProps', camera); 14923 } 14924 14925 /** 14926 * A representation of a chapter. 14927 * 14928 * @typedef {Object} VimeoChapter 14929 * @property {number} startTime The start time of the chapter. 14930 * @property {object} title The title of the chapter. 14931 * @property {number} index The place in the order of Chapters. Starts at 1. 14932 */ 14933 /** 14934 * A promise to get chapters for the video. 14935 * 14936 * @promise GetChaptersPromise 14937 * @fulfill {VimeoChapter[]} The chapters for the video. 14938 */ 14939 /** 14940 * Get an array of all the chapters for the video. 14941 * 14942 * @return {GetChaptersPromise} 14943 */ 14944 }, { 14945 key: "getChapters", 14946 value: function getChapters() { 14947 return this.get('chapters'); 14948 } 14949 14950 /** 14951 * A promise to get the currently active chapter. 14952 * 14953 * @promise GetCurrentChaptersPromise 14954 * @fulfill {VimeoChapter|undefined} The current chapter for the video. 14955 */ 14956 /** 14957 * Get the currently active chapter for the video. 14958 * 14959 * @return {GetCurrentChaptersPromise} 14960 */ 14961 }, { 14962 key: "getCurrentChapter", 14963 value: function getCurrentChapter() { 14964 return this.get('currentChapter'); 14965 } 14966 14967 /** 14968 * A promise to get the accent color of the player. 14969 * 14970 * @promise GetColorPromise 14971 * @fulfill {string} The hex color of the player. 14972 */ 14973 /** 14974 * Get the accent color for this player. Note this is deprecated in place of `getColorTwo`. 14975 * 14976 * @return {GetColorPromise} 14977 */ 14978 }, { 14979 key: "getColor", 14980 value: function getColor() { 14981 return this.get('color'); 14982 } 14983 14984 /** 14985 * A promise to get all colors for the player in an array. 14986 * 14987 * @promise GetColorsPromise 14988 * @fulfill {string[]} The hex colors of the player. 14989 */ 14990 /** 14991 * Get all the colors for this player in an array: [colorOne, colorTwo, colorThree, colorFour] 14992 * 14993 * @return {GetColorPromise} 14994 */ 14995 }, { 14996 key: "getColors", 14997 value: function getColors() { 14998 return npo_src.all([this.get('colorOne'), this.get('colorTwo'), this.get('colorThree'), this.get('colorFour')]); 14999 } 15000 15001 /** 15002 * A promise to set the accent color of the player. 15003 * 15004 * @promise SetColorPromise 15005 * @fulfill {string} The color was successfully set. 15006 * @reject {TypeError} The string was not a valid hex or rgb color. 15007 * @reject {ContrastError} The color was set, but the contrast is 15008 * outside of the acceptable range. 15009 * @reject {EmbedSettingsError} The owner of the player has chosen to 15010 * use a specific color. 15011 */ 15012 /** 15013 * Set the accent color of this player to a hex or rgb string. Setting the 15014 * color may fail if the owner of the video has set their embed 15015 * preferences to force a specific color. 15016 * Note this is deprecated in place of `setColorTwo`. 15017 * 15018 * @param {string} color The hex or rgb color string to set. 15019 * @return {SetColorPromise} 15020 */ 15021 }, { 15022 key: "setColor", 15023 value: function setColor(color) { 15024 return this.set('color', color); 15025 } 15026 15027 /** 15028 * A promise to set all colors for the player. 15029 * 15030 * @promise SetColorsPromise 15031 * @fulfill {string[]} The colors were successfully set. 15032 * @reject {TypeError} The string was not a valid hex or rgb color. 15033 * @reject {ContrastError} The color was set, but the contrast is 15034 * outside of the acceptable range. 15035 * @reject {EmbedSettingsError} The owner of the player has chosen to 15036 * use a specific color. 15037 */ 15038 /** 15039 * Set the colors of this player to a hex or rgb string. Setting the 15040 * color may fail if the owner of the video has set their embed 15041 * preferences to force a specific color. 15042 * The colors should be passed in as an array: [colorOne, colorTwo, colorThree, colorFour]. 15043 * If a color should not be set, the index in the array can be left as null. 15044 * 15045 * @param {string[]} colors Array of the hex or rgb color strings to set. 15046 * @return {SetColorsPromise} 15047 */ 15048 }, { 15049 key: "setColors", 15050 value: function setColors(colors) { 15051 if (!Array.isArray(colors)) { 15052 return new npo_src(function (resolve, reject) { 15053 return reject(new TypeError('Argument must be an array.')); 15054 }); 15055 } 15056 var nullPromise = new npo_src(function (resolve) { 15057 return resolve(null); 15058 }); 15059 var colorPromises = [colors[0] ? this.set('colorOne', colors[0]) : nullPromise, colors[1] ? this.set('colorTwo', colors[1]) : nullPromise, colors[2] ? this.set('colorThree', colors[2]) : nullPromise, colors[3] ? this.set('colorFour', colors[3]) : nullPromise]; 15060 return npo_src.all(colorPromises); 15061 } 15062 15063 /** 15064 * A representation of a cue point. 15065 * 15066 * @typedef {Object} VimeoCuePoint 15067 * @property {number} time The time of the cue point. 15068 * @property {object} data The data passed when adding the cue point. 15069 * @property {string} id The unique id for use with removeCuePoint. 15070 */ 15071 /** 15072 * A promise to get the cue points of a video. 15073 * 15074 * @promise GetCuePointsPromise 15075 * @fulfill {VimeoCuePoint[]} The cue points added to the video. 15076 * @reject {UnsupportedError} Cue points are not supported with the current 15077 * player or browser. 15078 */ 15079 /** 15080 * Get an array of the cue points added to the video. 15081 * 15082 * @return {GetCuePointsPromise} 15083 */ 15084 }, { 15085 key: "getCuePoints", 15086 value: function getCuePoints() { 15087 return this.get('cuePoints'); 15088 } 15089 15090 /** 15091 * A promise to get the current time of the video. 15092 * 15093 * @promise GetCurrentTimePromise 15094 * @fulfill {number} The current time in seconds. 15095 */ 15096 /** 15097 * Get the current playback position in seconds. 15098 * 15099 * @return {GetCurrentTimePromise} 15100 */ 15101 }, { 15102 key: "getCurrentTime", 15103 value: function getCurrentTime() { 15104 return this.get('currentTime'); 15105 } 15106 15107 /** 15108 * A promise to set the current time of the video. 15109 * 15110 * @promise SetCurrentTimePromise 15111 * @fulfill {number} The actual current time that was set. 15112 * @reject {RangeError} the time was less than 0 or greater than the 15113 * videoâs duration. 15114 */ 15115 /** 15116 * Set the current playback position in seconds. If the player was 15117 * paused, it will remain paused. Likewise, if the player was playing, 15118 * it will resume playing once the video has buffered. 15119 * 15120 * You can provide an accurate time and the player will attempt to seek 15121 * to as close to that time as possible. The exact time will be the 15122 * fulfilled value of the promise. 15123 * 15124 * @param {number} currentTime 15125 * @return {SetCurrentTimePromise} 15126 */ 15127 }, { 15128 key: "setCurrentTime", 15129 value: function setCurrentTime(currentTime) { 15130 return this.set('currentTime', currentTime); 15131 } 15132 15133 /** 15134 * A promise to get the duration of the video. 15135 * 15136 * @promise GetDurationPromise 15137 * @fulfill {number} The duration in seconds. 15138 */ 15139 /** 15140 * Get the duration of the video in seconds. It will be rounded to the 15141 * nearest second before playback begins, and to the nearest thousandth 15142 * of a second after playback begins. 15143 * 15144 * @return {GetDurationPromise} 15145 */ 15146 }, { 15147 key: "getDuration", 15148 value: function getDuration() { 15149 return this.get('duration'); 15150 } 15151 15152 /** 15153 * A promise to get the ended state of the video. 15154 * 15155 * @promise GetEndedPromise 15156 * @fulfill {boolean} Whether or not the video has ended. 15157 */ 15158 /** 15159 * Get the ended state of the video. The video has ended if 15160 * `currentTime === duration`. 15161 * 15162 * @return {GetEndedPromise} 15163 */ 15164 }, { 15165 key: "getEnded", 15166 value: function getEnded() { 15167 return this.get('ended'); 15168 } 15169 15170 /** 15171 * A promise to get the loop state of the player. 15172 * 15173 * @promise GetLoopPromise 15174 * @fulfill {boolean} Whether or not the player is set to loop. 15175 */ 15176 /** 15177 * Get the loop state of the player. 15178 * 15179 * @return {GetLoopPromise} 15180 */ 15181 }, { 15182 key: "getLoop", 15183 value: function getLoop() { 15184 return this.get('loop'); 15185 } 15186 15187 /** 15188 * A promise to set the loop state of the player. 15189 * 15190 * @promise SetLoopPromise 15191 * @fulfill {boolean} The loop state that was set. 15192 */ 15193 /** 15194 * Set the loop state of the player. When set to `true`, the player 15195 * will start over immediately once playback ends. 15196 * 15197 * @param {boolean} loop 15198 * @return {SetLoopPromise} 15199 */ 15200 }, { 15201 key: "setLoop", 15202 value: function setLoop(loop) { 15203 return this.set('loop', loop); 15204 } 15205 15206 /** 15207 * A promise to set the muted state of the player. 15208 * 15209 * @promise SetMutedPromise 15210 * @fulfill {boolean} The muted state that was set. 15211 */ 15212 /** 15213 * Set the muted state of the player. When set to `true`, the player 15214 * volume will be muted. 15215 * 15216 * @param {boolean} muted 15217 * @return {SetMutedPromise} 15218 */ 15219 }, { 15220 key: "setMuted", 15221 value: function setMuted(muted) { 15222 return this.set('muted', muted); 15223 } 15224 15225 /** 15226 * A promise to get the muted state of the player. 15227 * 15228 * @promise GetMutedPromise 15229 * @fulfill {boolean} Whether or not the player is muted. 15230 */ 15231 /** 15232 * Get the muted state of the player. 15233 * 15234 * @return {GetMutedPromise} 15235 */ 15236 }, { 15237 key: "getMuted", 15238 value: function getMuted() { 15239 return this.get('muted'); 15240 } 15241 15242 /** 15243 * A promise to get the paused state of the player. 15244 * 15245 * @promise GetLoopPromise 15246 * @fulfill {boolean} Whether or not the video is paused. 15247 */ 15248 /** 15249 * Get the paused state of the player. 15250 * 15251 * @return {GetLoopPromise} 15252 */ 15253 }, { 15254 key: "getPaused", 15255 value: function getPaused() { 15256 return this.get('paused'); 15257 } 15258 15259 /** 15260 * A promise to get the playback rate of the player. 15261 * 15262 * @promise GetPlaybackRatePromise 15263 * @fulfill {number} The playback rate of the player on a scale from 0 to 2. 15264 */ 15265 /** 15266 * Get the playback rate of the player on a scale from `0` to `2`. 15267 * 15268 * @return {GetPlaybackRatePromise} 15269 */ 15270 }, { 15271 key: "getPlaybackRate", 15272 value: function getPlaybackRate() { 15273 return this.get('playbackRate'); 15274 } 15275 15276 /** 15277 * A promise to set the playbackrate of the player. 15278 * 15279 * @promise SetPlaybackRatePromise 15280 * @fulfill {number} The playback rate was set. 15281 * @reject {RangeError} The playback rate was less than 0 or greater than 2. 15282 */ 15283 /** 15284 * Set the playback rate of the player on a scale from `0` to `2`. When set 15285 * via the API, the playback rate will not be synchronized to other 15286 * players or stored as the viewer's preference. 15287 * 15288 * @param {number} playbackRate 15289 * @return {SetPlaybackRatePromise} 15290 */ 15291 }, { 15292 key: "setPlaybackRate", 15293 value: function setPlaybackRate(playbackRate) { 15294 return this.set('playbackRate', playbackRate); 15295 } 15296 15297 /** 15298 * A promise to get the played property of the video. 15299 * 15300 * @promise GetPlayedPromise 15301 * @fulfill {Array} Played Timeranges converted to an Array. 15302 */ 15303 /** 15304 * Get the played property of the video. 15305 * 15306 * @return {GetPlayedPromise} 15307 */ 15308 }, { 15309 key: "getPlayed", 15310 value: function getPlayed() { 15311 return this.get('played'); 15312 } 15313 15314 /** 15315 * A promise to get the qualities available of the current video. 15316 * 15317 * @promise GetQualitiesPromise 15318 * @fulfill {Array} The qualities of the video. 15319 */ 15320 /** 15321 * Get the qualities of the current video. 15322 * 15323 * @return {GetQualitiesPromise} 15324 */ 15325 }, { 15326 key: "getQualities", 15327 value: function getQualities() { 15328 return this.get('qualities'); 15329 } 15330 15331 /** 15332 * A promise to get the current set quality of the video. 15333 * 15334 * @promise GetQualityPromise 15335 * @fulfill {string} The current set quality. 15336 */ 15337 /** 15338 * Get the current set quality of the video. 15339 * 15340 * @return {GetQualityPromise} 15341 */ 15342 }, { 15343 key: "getQuality", 15344 value: function getQuality() { 15345 return this.get('quality'); 15346 } 15347 15348 /** 15349 * A promise to set the video quality. 15350 * 15351 * @promise SetQualityPromise 15352 * @fulfill {number} The quality was set. 15353 * @reject {RangeError} The quality is not available. 15354 */ 15355 /** 15356 * Set a video quality. 15357 * 15358 * @param {string} quality 15359 * @return {SetQualityPromise} 15360 */ 15361 }, { 15362 key: "setQuality", 15363 value: function setQuality(quality) { 15364 return this.set('quality', quality); 15365 } 15366 15367 /** 15368 * A promise to get the remote playback availability. 15369 * 15370 * @promise RemotePlaybackAvailabilityPromise 15371 * @fulfill {boolean} Whether remote playback is available. 15372 */ 15373 /** 15374 * Get the availability of remote playback. 15375 * 15376 * @return {RemotePlaybackAvailabilityPromise} 15377 */ 15378 }, { 15379 key: "getRemotePlaybackAvailability", 15380 value: function getRemotePlaybackAvailability() { 15381 return this.get('remotePlaybackAvailability'); 15382 } 15383 15384 /** 15385 * A promise to get the current remote playback state. 15386 * 15387 * @promise RemotePlaybackStatePromise 15388 * @fulfill {string} The state of the remote playback: connecting, connected, or disconnected. 15389 */ 15390 /** 15391 * Get the current remote playback state. 15392 * 15393 * @return {RemotePlaybackStatePromise} 15394 */ 15395 }, { 15396 key: "getRemotePlaybackState", 15397 value: function getRemotePlaybackState() { 15398 return this.get('remotePlaybackState'); 15399 } 15400 15401 /** 15402 * A promise to get the seekable property of the video. 15403 * 15404 * @promise GetSeekablePromise 15405 * @fulfill {Array} Seekable Timeranges converted to an Array. 15406 */ 15407 /** 15408 * Get the seekable property of the video. 15409 * 15410 * @return {GetSeekablePromise} 15411 */ 15412 }, { 15413 key: "getSeekable", 15414 value: function getSeekable() { 15415 return this.get('seekable'); 15416 } 15417 15418 /** 15419 * A promise to get the seeking property of the player. 15420 * 15421 * @promise GetSeekingPromise 15422 * @fulfill {boolean} Whether or not the player is currently seeking. 15423 */ 15424 /** 15425 * Get if the player is currently seeking. 15426 * 15427 * @return {GetSeekingPromise} 15428 */ 15429 }, { 15430 key: "getSeeking", 15431 value: function getSeeking() { 15432 return this.get('seeking'); 15433 } 15434 15435 /** 15436 * A promise to get the text tracks of a video. 15437 * 15438 * @promise GetTextTracksPromise 15439 * @fulfill {VimeoTextTrack[]} The text tracks associated with the video. 15440 */ 15441 /** 15442 * Get an array of the text tracks that exist for the video. 15443 * 15444 * @return {GetTextTracksPromise} 15445 */ 15446 }, { 15447 key: "getTextTracks", 15448 value: function getTextTracks() { 15449 return this.get('textTracks'); 15450 } 15451 15452 /** 15453 * A promise to get the embed code for the video. 15454 * 15455 * @promise GetVideoEmbedCodePromise 15456 * @fulfill {string} The `<iframe>` embed code for the video. 15457 */ 15458 /** 15459 * Get the `<iframe>` embed code for the video. 15460 * 15461 * @return {GetVideoEmbedCodePromise} 15462 */ 15463 }, { 15464 key: "getVideoEmbedCode", 15465 value: function getVideoEmbedCode() { 15466 return this.get('videoEmbedCode'); 15467 } 15468 15469 /** 15470 * A promise to get the id of the video. 15471 * 15472 * @promise GetVideoIdPromise 15473 * @fulfill {number} The id of the video. 15474 */ 15475 /** 15476 * Get the id of the video. 15477 * 15478 * @return {GetVideoIdPromise} 15479 */ 15480 }, { 15481 key: "getVideoId", 15482 value: function getVideoId() { 15483 return this.get('videoId'); 15484 } 15485 15486 /** 15487 * A promise to get the title of the video. 15488 * 15489 * @promise GetVideoTitlePromise 15490 * @fulfill {number} The title of the video. 15491 */ 15492 /** 15493 * Get the title of the video. 15494 * 15495 * @return {GetVideoTitlePromise} 15496 */ 15497 }, { 15498 key: "getVideoTitle", 15499 value: function getVideoTitle() { 15500 return this.get('videoTitle'); 15501 } 15502 15503 /** 15504 * A promise to get the native width of the video. 15505 * 15506 * @promise GetVideoWidthPromise 15507 * @fulfill {number} The native width of the video. 15508 */ 15509 /** 15510 * Get the native width of the currentlyâplaying video. The width of 15511 * the highestâresolution available will be used before playback begins. 15512 * 15513 * @return {GetVideoWidthPromise} 15514 */ 15515 }, { 15516 key: "getVideoWidth", 15517 value: function getVideoWidth() { 15518 return this.get('videoWidth'); 15519 } 15520 15521 /** 15522 * A promise to get the native height of the video. 15523 * 15524 * @promise GetVideoHeightPromise 15525 * @fulfill {number} The native height of the video. 15526 */ 15527 /** 15528 * Get the native height of the currentlyâplaying video. The height of 15529 * the highestâresolution available will be used before playback begins. 15530 * 15531 * @return {GetVideoHeightPromise} 15532 */ 15533 }, { 15534 key: "getVideoHeight", 15535 value: function getVideoHeight() { 15536 return this.get('videoHeight'); 15537 } 15538 15539 /** 15540 * A promise to get the vimeo.com url for the video. 15541 * 15542 * @promise GetVideoUrlPromise 15543 * @fulfill {number} The vimeo.com url for the video. 15544 * @reject {PrivacyError} The url isnât available because of the videoâs privacy setting. 15545 */ 15546 /** 15547 * Get the vimeo.com url for the video. 15548 * 15549 * @return {GetVideoUrlPromise} 15550 */ 15551 }, { 15552 key: "getVideoUrl", 15553 value: function getVideoUrl() { 15554 return this.get('videoUrl'); 15555 } 15556 15557 /** 15558 * A promise to get the volume level of the player. 15559 * 15560 * @promise GetVolumePromise 15561 * @fulfill {number} The volume level of the player on a scale from 0 to 1. 15562 */ 15563 /** 15564 * Get the current volume level of the player on a scale from `0` to `1`. 15565 * 15566 * Most mobile devices do not support an independent volume from the 15567 * system volume. In those cases, this method will always return `1`. 15568 * 15569 * @return {GetVolumePromise} 15570 */ 15571 }, { 15572 key: "getVolume", 15573 value: function getVolume() { 15574 return this.get('volume'); 15575 } 15576 15577 /** 15578 * A promise to set the volume level of the player. 15579 * 15580 * @promise SetVolumePromise 15581 * @fulfill {number} The volume was set. 15582 * @reject {RangeError} The volume was less than 0 or greater than 1. 15583 */ 15584 /** 15585 * Set the volume of the player on a scale from `0` to `1`. When set 15586 * via the API, the volume level will not be synchronized to other 15587 * players or stored as the viewerâs preference. 15588 * 15589 * Most mobile devices do not support setting the volume. An error will 15590 * *not* be triggered in that situation. 15591 * 15592 * @param {number} volume 15593 * @return {SetVolumePromise} 15594 */ 15595 }, { 15596 key: "setVolume", 15597 value: function setVolume(volume) { 15598 return this.set('volume', volume); 15599 } 15600 15601 /** @typedef {import('./lib/timing-object.types').TimingObject} TimingObject */ 15602 /** @typedef {import('./lib/timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */ 15603 /** @typedef {import('./lib/timing-src-connector').TimingSrcConnector} TimingSrcConnector */ 15604 15605 /** 15606 * Connects a TimingObject to the video player (https://webtiming.github.io/timingobject/) 15607 * 15608 * @param {TimingObject} timingObject 15609 * @param {TimingSrcConnectorOptions} options 15610 * 15611 * @return {Promise<TimingSrcConnector>} 15612 */ 15613 }, { 15614 key: "setTimingSrc", 15615 value: function () { 15616 var _setTimingSrc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(timingObject, options) { 15617 var _this6 = this; 15618 var connector; 15619 return _regeneratorRuntime().wrap(function _callee$(_context) { 15620 while (1) switch (_context.prev = _context.next) { 15621 case 0: 15622 if (timingObject) { 15623 _context.next = 2; 15624 break; 15625 } 15626 throw new TypeError('A Timing Object must be provided.'); 15627 case 2: 15628 _context.next = 4; 15629 return this.ready(); 15630 case 4: 15631 connector = new TimingSrcConnector(this, timingObject, options); 15632 postMessage(this, 'notifyTimingObjectConnect'); 15633 connector.addEventListener('disconnect', function () { 15634 return postMessage(_this6, 'notifyTimingObjectDisconnect'); 15635 }); 15636 return _context.abrupt("return", connector); 15637 case 8: 15638 case "end": 15639 return _context.stop(); 15640 } 15641 }, _callee, this); 15642 })); 15643 function setTimingSrc(_x, _x2) { 15644 return _setTimingSrc.apply(this, arguments); 15645 } 15646 return setTimingSrc; 15647 }() 15648 }]); 15649 return Player; 15650}(); // Setup embed only if this is not a node environment 15651if (!isNode) { 15652 screenfull = initializeScreenfull(); 15653 initializeEmbeds(); 15654 resizeEmbeds(); 15655 initAppendVideoMetadata(); 15656 checkUrlTimeParam(); 15657} 15658 15659/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Player); 15660 15661 15662/***/ }), 15663
vendor: 13,200 bytes, lines 15664-16096
15664/***/ "./node_modules/a11y-dialog/dist/a11y-dialog.esm.js": 15665/*!**********************************************************!*\ 15666 !*** ./node_modules/a11y-dialog/dist/a11y-dialog.esm.js ***! 15667 \**********************************************************/ 15668/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 15669 15670"use strict"; 15671__webpack_require__.r(__webpack_exports__); 15672/* harmony export */ __webpack_require__.d(__webpack_exports__, { 15673/* harmony export */ "default": () => (/* binding */ A11yDialog) 15674/* harmony export */ }); 15675var focusableSelectors = [ 15676 'a[href]:not([tabindex^="-"])', 15677 'area[href]:not([tabindex^="-"])', 15678 'input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])', 15679 'input[type="radio"]:not([disabled]):not([tabindex^="-"])', 15680 'select:not([disabled]):not([tabindex^="-"])', 15681 'textarea:not([disabled]):not([tabindex^="-"])', 15682 'button:not([disabled]):not([tabindex^="-"])', 15683 'iframe:not([tabindex^="-"])', 15684 'audio[controls]:not([tabindex^="-"])', 15685 'video[controls]:not([tabindex^="-"])', 15686 '[contenteditable]:not([tabindex^="-"])', 15687 '[tabindex]:not([tabindex^="-"])', 15688]; 15689 15690var TAB_KEY = 'Tab'; 15691var ESCAPE_KEY = 'Escape'; 15692 15693/** 15694 * Define the constructor to instantiate a dialog 15695 * 15696 * @constructor 15697 * @param {Element} element 15698 */ 15699function A11yDialog(element) { 15700 // Prebind the functions that will be bound in addEventListener and 15701 // removeEventListener to avoid losing references 15702 this._show = this.show.bind(this); 15703 this._hide = this.hide.bind(this); 15704 this._maintainFocus = this._maintainFocus.bind(this); 15705 this._bindKeypress = this._bindKeypress.bind(this); 15706 15707 this.$el = element; 15708 this.shown = false; 15709 this._id = this.$el.getAttribute('data-a11y-dialog') || this.$el.id; 15710 this._previouslyFocused = null; 15711 this._listeners = {}; 15712 15713 // Initialise everything needed for the dialog to work properly 15714 this.create(); 15715} 15716 15717/** 15718 * Set up everything necessary for the dialog to be functioning 15719 * 15720 * @param {(NodeList | Element | string)} targets 15721 * @return {this} 15722 */ 15723A11yDialog.prototype.create = function () { 15724 this.$el.setAttribute('aria-hidden', true); 15725 this.$el.setAttribute('aria-modal', true); 15726 this.$el.setAttribute('tabindex', -1); 15727 15728 if (!this.$el.hasAttribute('role')) { 15729 this.$el.setAttribute('role', 'dialog'); 15730 } 15731 15732 // Keep a collection of dialog openers, each of which will be bound a click 15733 // event listener to open the dialog 15734 this._openers = $$('[data-a11y-dialog-show="' + this._id + '"]'); 15735 this._openers.forEach( 15736 function (opener) { 15737 opener.addEventListener('click', this._show); 15738 }.bind(this) 15739 ); 15740 15741 // Keep a collection of dialog closers, each of which will be bound a click 15742 // event listener to close the dialog 15743 const $el = this.$el; 15744 15745 this._closers = $$('[data-a11y-dialog-hide]', this.$el) 15746 // This filter is necessary in case there are nested dialogs, so that 15747 // only closers from the current dialog are retrieved and effective 15748 .filter(function (closer) { 15749 // Testing for `[aria-modal="true"]` is not enough since this attribute 15750 // and the collect of closers is done at instantation time, when nested 15751 // dialogs might not have yet been instantiated. Note that if the dialogs 15752 // are manually instantiated, this could still fail because none of these 15753 // selectors would match; this would cause closers to close all parent 15754 // dialogs instead of just the current one 15755 return closer.closest('[aria-modal="true"], [data-a11y-dialog]') === $el 15756 }) 15757 .concat($$('[data-a11y-dialog-hide="' + this._id + '"]')); 15758 15759 this._closers.forEach( 15760 function (closer) { 15761 closer.addEventListener('click', this._hide); 15762 }.bind(this) 15763 ); 15764 15765 // Execute all callbacks registered for the `create` event 15766 this._fire('create'); 15767 15768 return this 15769}; 15770 15771/** 15772 * Show the dialog element, disable all the targets (siblings), trap the 15773 * current focus within it, listen for some specific key presses and fire all 15774 * registered callbacks for `show` event 15775 * 15776 * @param {CustomEvent} event 15777 * @return {this} 15778 */ 15779A11yDialog.prototype.show = function (event) { 15780 // If the dialog is already open, abort 15781 if (this.shown) { 15782 return this 15783 } 15784 15785 // Keep a reference to the currently focused element to be able to restore 15786 // it later 15787 this._previouslyFocused = document.activeElement; 15788 15789 // Due to a long lasting bug in Safari, clicking an interactive element (like 15790 // a <button>) does *not* move the focus to that element, which means 15791 // `document.activeElement` is whatever element is currently focused (like an 15792 // <input>), or the <body> element otherwise. We can work around that problem 15793 // by checking whether the focused element is the <body>, and if it, store the 15794 // click event target. 15795 // See: https://bugs.webkit.org/show_bug.cgi?id=22261 15796 const target = event && event.target ? event.target : null; 15797 if (target && Object.is(this._previouslyFocused, document.body)) { 15798 this._previouslyFocused = target; 15799 } 15800 15801 this.$el.removeAttribute('aria-hidden'); 15802 this.shown = true; 15803 15804 // Set the focus to the dialog element 15805 moveFocusToDialog(this.$el); 15806 15807 // Bind a focus event listener to the body element to make sure the focus 15808 // stays trapped inside the dialog while open, and start listening for some 15809 // specific key presses (TAB and ESC) 15810 document.body.addEventListener('focus', this._maintainFocus, true); 15811 document.addEventListener('keydown', this._bindKeypress); 15812 15813 // Execute all callbacks registered for the `show` event 15814 this._fire('show', event); 15815 15816 return this 15817}; 15818 15819/** 15820 * Hide the dialog element, enable all the targets (siblings), restore the 15821 * focus to the previously active element, stop listening for some specific 15822 * key presses and fire all registered callbacks for `hide` event 15823 * 15824 * @param {CustomEvent} event 15825 * @return {this} 15826 */ 15827A11yDialog.prototype.hide = function (event) { 15828 // If the dialog is already closed, abort 15829 if (!this.shown) { 15830 return this 15831 } 15832 15833 this.shown = false; 15834 this.$el.setAttribute('aria-hidden', 'true'); 15835 15836 // If there was a focused element before the dialog was opened (and it has a 15837 // `focus` method), restore the focus back to it 15838 // See: https://github.com/KittyGiraudel/a11y-dialog/issues/108 15839 if (this._previouslyFocused && this._previouslyFocused.focus) { 15840 this._previouslyFocused.focus(); 15841 } 15842 15843 // Remove the focus event listener to the body element and stop listening 15844 // for specific key presses 15845 document.body.removeEventListener('focus', this._maintainFocus, true); 15846 document.removeEventListener('keydown', this._bindKeypress); 15847 15848 // Execute all callbacks registered for the `hide` event 15849 this._fire('hide', event); 15850 15851 return this 15852}; 15853 15854/** 15855 * Destroy the current instance (after making sure the dialog has been hidden) 15856 * and remove all associated listeners from dialog openers and closers 15857 * 15858 * @return {this} 15859 */ 15860A11yDialog.prototype.destroy = function () { 15861 // Hide the dialog to avoid destroying an open instance 15862 this.hide(); 15863 15864 // Remove the click event listener from all dialog openers 15865 this._openers.forEach( 15866 function (opener) { 15867 opener.removeEventListener('click', this._show); 15868 }.bind(this) 15869 ); 15870 15871 // Remove the click event listener from all dialog closers 15872 this._closers.forEach( 15873 function (closer) { 15874 closer.removeEventListener('click', this._hide); 15875 }.bind(this) 15876 ); 15877 15878 // Execute all callbacks registered for the `destroy` event 15879 this._fire('destroy'); 15880 15881 // Keep an object of listener types mapped to callback functions 15882 this._listeners = {}; 15883 15884 return this 15885}; 15886 15887/** 15888 * Register a new callback for the given event type 15889 * 15890 * @param {string} type 15891 * @param {Function} handler 15892 */ 15893A11yDialog.prototype.on = function (type, handler) { 15894 if (typeof this._listeners[type] === 'undefined') { 15895 this._listeners[type] = []; 15896 } 15897 15898 this._listeners[type].push(handler); 15899 15900 return this 15901}; 15902 15903/** 15904 * Unregister an existing callback for the given event type 15905 * 15906 * @param {string} type 15907 * @param {Function} handler 15908 */ 15909A11yDialog.prototype.off = function (type, handler) { 15910 var index = (this._listeners[type] || []).indexOf(handler); 15911 15912 if (index > -1) { 15913 this._listeners[type].splice(index, 1); 15914 } 15915 15916 return this 15917}; 15918 15919/** 15920 * Iterate over all registered handlers for given type and call them all with 15921 * the dialog element as first argument, event as second argument (if any). Also 15922 * dispatch a custom event on the DOM element itself to make it possible to 15923 * react to the lifecycle of auto-instantiated dialogs. 15924 * 15925 * @access private 15926 * @param {string} type 15927 * @param {CustomEvent} event 15928 */ 15929A11yDialog.prototype._fire = function (type, event) { 15930 var listeners = this._listeners[type] || []; 15931 var domEvent = new CustomEvent(type, { detail: event }); 15932 15933 this.$el.dispatchEvent(domEvent); 15934 15935 listeners.forEach( 15936 function (listener) { 15937 listener(this.$el, event); 15938 }.bind(this) 15939 ); 15940}; 15941 15942/** 15943 * Private event handler used when listening to some specific key presses 15944 * (namely ESCAPE and TAB) 15945 * 15946 * @access private 15947 * @param {Event} event 15948 */ 15949A11yDialog.prototype._bindKeypress = function (event) { 15950 // This is an escape hatch in case there are nested dialogs, so the keypresses 15951 // are only reacted to for the most recent one 15952 const focused = document.activeElement; 15953 if (focused && focused.closest('[aria-modal="true"]') !== this.$el) return 15954 15955 // If the dialog is shown and the ESCAPE key is being pressed, prevent any 15956 // further effects from the ESCAPE key and hide the dialog, unless its role 15957 // is 'alertdialog', which should be modal 15958 if ( 15959 this.shown && 15960 event.key === ESCAPE_KEY && 15961 this.$el.getAttribute('role') !== 'alertdialog' 15962 ) { 15963 event.preventDefault(); 15964 this.hide(event); 15965 } 15966 15967 // If the dialog is shown and the TAB key is being pressed, make sure the 15968 // focus stays trapped within the dialog element 15969 if (this.shown && event.key === TAB_KEY) { 15970 trapTabKey(this.$el, event); 15971 } 15972}; 15973 15974/** 15975 * Private event handler used when making sure the focus stays within the 15976 * currently open dialog 15977 * 15978 * @access private 15979 * @param {Event} event 15980 */ 15981A11yDialog.prototype._maintainFocus = function (event) { 15982 // If the dialog is shown and the focus is not within a dialog element (either 15983 // this one or another one in case of nested dialogs) or within an element 15984 // with the `data-a11y-dialog-focus-trap-ignore` attribute, move it back to 15985 // its first focusable child. 15986 // See: https://github.com/KittyGiraudel/a11y-dialog/issues/177 15987 if ( 15988 this.shown && 15989 !event.target.closest('[aria-modal="true"]') && 15990 !event.target.closest('[data-a11y-dialog-ignore-focus-trap]') 15991 ) { 15992 moveFocusToDialog(this.$el); 15993 } 15994}; 15995 15996/** 15997 * Convert a NodeList into an array 15998 * 15999 * @param {NodeList} collection 16000 * @return {Array<Element>} 16001 */ 16002function toArray(collection) { 16003 return Array.prototype.slice.call(collection) 16004} 16005 16006/** 16007 * Query the DOM for nodes matching the given selector, scoped to context (or 16008 * the whole document) 16009 * 16010 * @param {String} selector 16011 * @param {Element} [context = document] 16012 * @return {Array<Element>} 16013 */ 16014function $$(selector, context) { 16015 return toArray((context || document).querySelectorAll(selector)) 16016} 16017 16018/** 16019 * Set the focus to the first element with `autofocus` with the element or the 16020 * element itself 16021 * 16022 * @param {Element} node 16023 */ 16024function moveFocusToDialog(node) { 16025 var focused = node.querySelector('[autofocus]') || node; 16026 16027 focused.focus(); 16028} 16029 16030/** 16031 * Get the focusable children of the given element 16032 * 16033 * @param {Element} node 16034 * @return {Array<Element>} 16035 */ 16036function getFocusableChildren(node) { 16037 return $$(focusableSelectors.join(','), node).filter(function (child) { 16038 return !!( 16039 child.offsetWidth || 16040 child.offsetHeight || 16041 child.getClientRects().length 16042 ) 16043 }) 16044} 16045 16046/** 16047 * Trap the focus inside the given element 16048 * 16049 * @param {Element} node 16050 * @param {Event} event 16051 */ 16052function trapTabKey(node, event) { 16053 var focusableChildren = getFocusableChildren(node); 16054 var focusedItemIndex = focusableChildren.indexOf(document.activeElement); 16055 16056 // If the SHIFT key is being pressed while tabbing (moving backwards) and 16057 // the currently focused item is the first one, move the focus to the last 16058 // focusable item from the dialog element 16059 if (event.shiftKey && focusedItemIndex === 0) { 16060 focusableChildren[focusableChildren.length - 1].focus(); 16061 event.preventDefault(); 16062 // If the SHIFT key is not being pressed (moving forwards) and the currently 16063 // focused item is the last one, move the focus to the first focusable item 16064 // from the dialog element 16065 } else if ( 16066 !event.shiftKey && 16067 focusedItemIndex === focusableChildren.length - 1 16068 ) { 16069 focusableChildren[0].focus(); 16070 event.preventDefault(); 16071 } 16072} 16073 16074function instantiateDialogs() { 16075 $$('[data-a11y-dialog]').forEach(function (node) { 16076 new A11yDialog(node); 16077 }); 16078} 16079 16080if (typeof document !== 'undefined') { 16081 if (document.readyState === 'loading') { 16082 document.addEventListener('DOMContentLoaded', instantiateDialogs); 16083 } else { 16084 if (window.requestAnimationFrame) { 16085 window.requestAnimationFrame(instantiateDialogs); 16086 } else { 16087 window.setTimeout(instantiateDialogs, 16); 16088 } 16089 } 16090} 16091 16092 16093 16094 16095/***/ }), 16096
vendor: 12,818 bytes, lines 16097-16474
16097/***/ "./node_modules/css-element-queries/src/ResizeSensor.js": 16098/*!**************************************************************!*\ 16099 !*** ./node_modules/css-element-queries/src/ResizeSensor.js ***! 16100 \**************************************************************/ 16101/***/ (function(module, exports, __webpack_require__) { 16102 16103"use strict"; 16104var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__; 16105 16106/** 16107 * Copyright Marc J. Schmidt. See the LICENSE file at the top-level 16108 * directory of this distribution and at 16109 * https://github.com/marcj/css-element-queries/blob/master/LICENSE. 16110 */ 16111(function (root, factory) { 16112 if (true) { 16113 !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 16114 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 16115 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : 16116 __WEBPACK_AMD_DEFINE_FACTORY__), 16117 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 16118 } else {} 16119}(typeof window !== 'undefined' ? window : this, function () { 16120 16121 // Make sure it does not throw in a SSR (Server Side Rendering) situation 16122 if (typeof window === "undefined") { 16123 return null; 16124 } 16125 // https://github.com/Semantic-Org/Semantic-UI/issues/3855 16126 // https://github.com/marcj/css-element-queries/issues/257 16127 var globalWindow = typeof window != 'undefined' && window.Math == Math 16128 ? window 16129 : typeof self != 'undefined' && self.Math == Math 16130 ? self 16131 : Function('return this')(); 16132 // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor. 16133 // In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and 16134 // would generate too many unnecessary events. 16135 var requestAnimationFrame = globalWindow.requestAnimationFrame || 16136 globalWindow.mozRequestAnimationFrame || 16137 globalWindow.webkitRequestAnimationFrame || 16138 function (fn) { 16139 return globalWindow.setTimeout(fn, 20); 16140 }; 16141 16142 var cancelAnimationFrame = globalWindow.cancelAnimationFrame || 16143 globalWindow.mozCancelAnimationFrame || 16144 globalWindow.webkitCancelAnimationFrame || 16145 function (timer) { 16146 globalWindow.clearTimeout(timer); 16147 }; 16148 16149 /** 16150 * Iterate over each of the provided element(s). 16151 * 16152 * @param {HTMLElement|HTMLElement[]} elements 16153 * @param {Function} callback 16154 */ 16155 function forEachElement(elements, callback){ 16156 var elementsType = Object.prototype.toString.call(elements); 16157 var isCollectionTyped = ('[object Array]' === elementsType 16158 || ('[object NodeList]' === elementsType) 16159 || ('[object HTMLCollection]' === elementsType) 16160 || ('[object Object]' === elementsType) 16161 || ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery 16162 || ('undefined' !== typeof Elements && elements instanceof Elements) //mootools 16163 ); 16164 var i = 0, j = elements.length; 16165 if (isCollectionTyped) { 16166 for (; i < j; i++) { 16167 callback(elements[i]); 16168 } 16169 } else { 16170 callback(elements); 16171 } 16172 } 16173 16174 /** 16175 * Get element size 16176 * @param {HTMLElement} element 16177 * @returns {Object} {width, height} 16178 */ 16179 function getElementSize(element) { 16180 if (!element.getBoundingClientRect) { 16181 return { 16182 width: element.offsetWidth, 16183 height: element.offsetHeight 16184 } 16185 } 16186 16187 var rect = element.getBoundingClientRect(); 16188 return { 16189 width: Math.round(rect.width), 16190 height: Math.round(rect.height) 16191 } 16192 } 16193 16194 /** 16195 * Apply CSS styles to element. 16196 * 16197 * @param {HTMLElement} element 16198 * @param {Object} style 16199 */ 16200 function setStyle(element, style) { 16201 Object.keys(style).forEach(function(key) { 16202 element.style[key] = style[key]; 16203 }); 16204 } 16205 16206 /** 16207 * Class for dimension change detection. 16208 * 16209 * @param {Element|Element[]|Elements|jQuery} element 16210 * @param {Function} callback 16211 * 16212 * @constructor 16213 */ 16214 var ResizeSensor = function(element, callback) { 16215 //Is used when checking in reset() only for invisible elements 16216 var lastAnimationFrameForInvisibleCheck = 0; 16217 16218 /** 16219 * 16220 * @constructor 16221 */ 16222 function EventQueue() { 16223 var q = []; 16224 this.add = function(ev) { 16225 q.push(ev); 16226 }; 16227 16228 var i, j; 16229 this.call = function(sizeInfo) { 16230 for (i = 0, j = q.length; i < j; i++) { 16231 q[i].call(this, sizeInfo); 16232 } 16233 }; 16234 16235 this.remove = function(ev) { 16236 var newQueue = []; 16237 for(i = 0, j = q.length; i < j; i++) { 16238 if(q[i] !== ev) newQueue.push(q[i]); 16239 } 16240 q = newQueue; 16241 }; 16242 16243 this.length = function() { 16244 return q.length; 16245 } 16246 } 16247 16248 /** 16249 * 16250 * @param {HTMLElement} element 16251 * @param {Function} resized 16252 */ 16253 function attachResizeEvent(element, resized) { 16254 if (!element) return; 16255 if (element.resizedAttached) { 16256 element.resizedAttached.add(resized); 16257 return; 16258 } 16259 16260 element.resizedAttached = new EventQueue(); 16261 element.resizedAttached.add(resized); 16262 16263 element.resizeSensor = document.createElement('div'); 16264 element.resizeSensor.dir = 'ltr'; 16265 element.resizeSensor.className = 'resize-sensor'; 16266 16267 var style = { 16268 pointerEvents: 'none', 16269 position: 'absolute', 16270 left: '0px', 16271 top: '0px', 16272 right: '0px', 16273 bottom: '0px', 16274 overflow: 'hidden', 16275 zIndex: '-1', 16276 visibility: 'hidden', 16277 maxWidth: '100%' 16278 }; 16279 var styleChild = { 16280 position: 'absolute', 16281 left: '0px', 16282 top: '0px', 16283 transition: '0s', 16284 }; 16285 16286 setStyle(element.resizeSensor, style); 16287 16288 var expand = document.createElement('div'); 16289 expand.className = 'resize-sensor-expand'; 16290 setStyle(expand, style); 16291 16292 var expandChild = document.createElement('div'); 16293 setStyle(expandChild, styleChild); 16294 expand.appendChild(expandChild); 16295 16296 var shrink = document.createElement('div'); 16297 shrink.className = 'resize-sensor-shrink'; 16298 setStyle(shrink, style); 16299 16300 var shrinkChild = document.createElement('div'); 16301 setStyle(shrinkChild, styleChild); 16302 setStyle(shrinkChild, { width: '200%', height: '200%' }); 16303 shrink.appendChild(shrinkChild); 16304 16305 element.resizeSensor.appendChild(expand); 16306 element.resizeSensor.appendChild(shrink); 16307 element.appendChild(element.resizeSensor); 16308 16309 var computedStyle = window.getComputedStyle(element); 16310 var position = computedStyle ? computedStyle.getPropertyValue('position') : null; 16311 if ('absolute' !== position && 'relative' !== position && 'fixed' !== position && 'sticky' !== position) { 16312 element.style.position = 'relative'; 16313 } 16314 16315 var dirty = false; 16316 16317 //last request animation frame id used in onscroll event 16318 var rafId = 0; 16319 var size = getElementSize(element); 16320 var lastWidth = 0; 16321 var lastHeight = 0; 16322 var initialHiddenCheck = true; 16323 lastAnimationFrameForInvisibleCheck = 0; 16324 16325 var resetExpandShrink = function () { 16326 var width = element.offsetWidth; 16327 var height = element.offsetHeight; 16328 16329 expandChild.style.width = (width + 10) + 'px'; 16330 expandChild.style.height = (height + 10) + 'px'; 16331 16332 expand.scrollLeft = width + 10; 16333 expand.scrollTop = height + 10; 16334 16335 shrink.scrollLeft = width + 10; 16336 shrink.scrollTop = height + 10; 16337 }; 16338 16339 var reset = function() { 16340 // Check if element is hidden 16341 if (initialHiddenCheck) { 16342 var invisible = element.offsetWidth === 0 && element.offsetHeight === 0; 16343 if (invisible) { 16344 // Check in next frame 16345 if (!lastAnimationFrameForInvisibleCheck){ 16346 lastAnimationFrameForInvisibleCheck = requestAnimationFrame(function(){ 16347 lastAnimationFrameForInvisibleCheck = 0; 16348 reset(); 16349 }); 16350 } 16351 16352 return; 16353 } else { 16354 // Stop checking 16355 initialHiddenCheck = false; 16356 } 16357 } 16358 16359 resetExpandShrink(); 16360 }; 16361 element.resizeSensor.resetSensor = reset; 16362 16363 var onResized = function() { 16364 rafId = 0; 16365 16366 if (!dirty) return; 16367 16368 lastWidth = size.width; 16369 lastHeight = size.height; 16370 16371 if (element.resizedAttached) { 16372 element.resizedAttached.call(size); 16373 } 16374 }; 16375 16376 var onScroll = function() { 16377 size = getElementSize(element); 16378 dirty = size.width !== lastWidth || size.height !== lastHeight; 16379 16380 if (dirty && !rafId) { 16381 rafId = requestAnimationFrame(onResized); 16382 } 16383 16384 reset(); 16385 }; 16386 16387 var addEvent = function(el, name, cb) { 16388 if (el.attachEvent) { 16389 el.attachEvent('on' + name, cb); 16390 } else { 16391 el.addEventListener(name, cb); 16392 } 16393 }; 16394 16395 addEvent(expand, 'scroll', onScroll); 16396 addEvent(shrink, 'scroll', onScroll); 16397 16398 // Fix for custom Elements and invisible elements 16399 lastAnimationFrameForInvisibleCheck = requestAnimationFrame(function(){ 16400 lastAnimationFrameForInvisibleCheck = 0; 16401 reset(); 16402 }); 16403 } 16404 16405 forEachElement(element, function(elem){ 16406 attachResizeEvent(elem, callback); 16407 }); 16408 16409 this.detach = function(ev) { 16410 // clean up the unfinished animation frame to prevent a potential endless requestAnimationFrame of reset 16411 if (!lastAnimationFrameForInvisibleCheck) { 16412 cancelAnimationFrame(lastAnimationFrameForInvisibleCheck); 16413 lastAnimationFrameForInvisibleCheck = 0; 16414 } 16415 ResizeSensor.detach(element, ev); 16416 }; 16417 16418 this.reset = function() { 16419 element.resizeSensor.resetSensor(); 16420 }; 16421 }; 16422 16423 ResizeSensor.reset = function(element) { 16424 forEachElement(element, function(elem){ 16425 elem.resizeSensor.resetSensor(); 16426 }); 16427 }; 16428 16429 ResizeSensor.detach = function(element, ev) { 16430 forEachElement(element, function(elem){ 16431 if (!elem) return; 16432 if(elem.resizedAttached && typeof ev === "function"){ 16433 elem.resizedAttached.remove(ev); 16434 if(elem.resizedAttached.length()) return; 16435 } 16436 if (elem.resizeSensor) { 16437 if (elem.contains(elem.resizeSensor)) { 16438 elem.removeChild(elem.resizeSensor); 16439 } 16440 delete elem.resizeSensor; 16441 delete elem.resizedAttached; 16442 } 16443 }); 16444 }; 16445 16446 if (typeof MutationObserver !== "undefined") { 16447 var observer = new MutationObserver(function (mutations) { 16448 for (var i in mutations) { 16449 if (mutations.hasOwnProperty(i)) { 16450 var items = mutations[i].addedNodes; 16451 for (var j = 0; j < items.length; j++) { 16452 if (items[j].resizeSensor) { 16453 ResizeSensor.reset(items[j]); 16454 } 16455 } 16456 } 16457 } 16458 }); 16459 16460 document.addEventListener("DOMContentLoaded", function (event) { 16461 observer.observe(document.body, { 16462 childList: true, 16463 subtree: true, 16464 }); 16465 }); 16466 } 16467 16468 return ResizeSensor; 16469 16470})); 16471 16472 16473/***/ }), 16474
vendor: 29,366 bytes, lines 16475-17657
16475/***/ "./node_modules/es6-promise/dist/es6-promise.js": 16476/*!******************************************************!*\ 16477 !*** ./node_modules/es6-promise/dist/es6-promise.js ***! 16478 \******************************************************/ 16479/***/ (function(module, __unused_webpack_exports, __webpack_require__) { 16480 16481/*! 16482 * @overview es6-promise - a tiny implementation of Promises/A+. 16483 * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) 16484 * @license Licensed under MIT license 16485 * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE 16486 * @version v4.2.8+1e68dce6 16487 */ 16488 16489(function (global, factory) { 16490 true ? module.exports = factory() : 16491 0; 16492}(this, (function () { 'use strict'; 16493 16494function objectOrFunction(x) { 16495 var type = typeof x; 16496 return x !== null && (type === 'object' || type === 'function'); 16497} 16498 16499function isFunction(x) { 16500 return typeof x === 'function'; 16501} 16502 16503 16504 16505var _isArray = void 0; 16506if (Array.isArray) { 16507 _isArray = Array.isArray; 16508} else { 16509 _isArray = function (x) { 16510 return Object.prototype.toString.call(x) === '[object Array]'; 16511 }; 16512} 16513 16514var isArray = _isArray; 16515 16516var len = 0; 16517var vertxNext = void 0; 16518var customSchedulerFn = void 0; 16519 16520var asap = function asap(callback, arg) { 16521 queue[len] = callback; 16522 queue[len + 1] = arg; 16523 len += 2; 16524 if (len === 2) { 16525 // If len is 2, that means that we need to schedule an async flush. 16526 // If additional callbacks are queued before the queue is flushed, they 16527 // will be processed by this flush that we are scheduling. 16528 if (customSchedulerFn) { 16529 customSchedulerFn(flush); 16530 } else { 16531 scheduleFlush(); 16532 } 16533 } 16534}; 16535 16536function setScheduler(scheduleFn) { 16537 customSchedulerFn = scheduleFn; 16538} 16539 16540function setAsap(asapFn) { 16541 asap = asapFn; 16542} 16543 16544var browserWindow = typeof window !== 'undefined' ? window : undefined; 16545var browserGlobal = browserWindow || {}; 16546var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; 16547var isNode = typeof self === 'undefined' && typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; 16548 16549// test for web worker but not in IE10 16550var isWorker = typeof Uint8ClampedArray !== 'undefined' && typeof importScripts !== 'undefined' && typeof MessageChannel !== 'undefined'; 16551 16552// node 16553function useNextTick() { 16554 // node version 0.10.x displays a deprecation warning when nextTick is used recursively 16555 // see https://github.com/cujojs/when/issues/410 for details 16556 return function () { 16557 return process.nextTick(flush); 16558 }; 16559} 16560 16561// vertx 16562function useVertxTimer() { 16563 if (typeof vertxNext !== 'undefined') { 16564 return function () { 16565 vertxNext(flush); 16566 }; 16567 } 16568 16569 return useSetTimeout(); 16570} 16571 16572function useMutationObserver() { 16573 var iterations = 0; 16574 var observer = new BrowserMutationObserver(flush); 16575 var node = document.createTextNode(''); 16576 observer.observe(node, { characterData: true }); 16577 16578 return function () { 16579 node.data = iterations = ++iterations % 2; 16580 }; 16581} 16582 16583// web worker 16584function useMessageChannel() { 16585 var channel = new MessageChannel(); 16586 channel.port1.onmessage = flush; 16587 return function () { 16588 return channel.port2.postMessage(0); 16589 }; 16590} 16591 16592function useSetTimeout() { 16593 // Store setTimeout reference so es6-promise will be unaffected by 16594 // other code modifying setTimeout (like sinon.useFakeTimers()) 16595 var globalSetTimeout = setTimeout; 16596 return function () { 16597 return globalSetTimeout(flush, 1); 16598 }; 16599} 16600 16601var queue = new Array(1000); 16602function flush() { 16603 for (var i = 0; i < len; i += 2) { 16604 var callback = queue[i]; 16605 var arg = queue[i + 1]; 16606 16607 callback(arg); 16608 16609 queue[i] = undefined; 16610 queue[i + 1] = undefined; 16611 } 16612 16613 len = 0; 16614} 16615 16616function attemptVertx() { 16617 try { 16618 var vertx = Function('return this')().require('vertx'); 16619 vertxNext = vertx.runOnLoop || vertx.runOnContext; 16620 return useVertxTimer(); 16621 } catch (e) { 16622 return useSetTimeout(); 16623 } 16624} 16625 16626var scheduleFlush = void 0; 16627// Decide what async method to use to triggering processing of queued callbacks: 16628if (isNode) { 16629 scheduleFlush = useNextTick(); 16630} else if (BrowserMutationObserver) { 16631 scheduleFlush = useMutationObserver(); 16632} else if (isWorker) { 16633 scheduleFlush = useMessageChannel(); 16634} else if (browserWindow === undefined && "function" === 'function') { 16635 scheduleFlush = attemptVertx(); 16636} else { 16637 scheduleFlush = useSetTimeout(); 16638} 16639 16640function then(onFulfillment, onRejection) { 16641 var parent = this; 16642 16643 var child = new this.constructor(noop); 16644 16645 if (child[PROMISE_ID] === undefined) { 16646 makePromise(child); 16647 } 16648 16649 var _state = parent._state; 16650 16651 16652 if (_state) { 16653 var callback = arguments[_state - 1]; 16654 asap(function () { 16655 return invokeCallback(_state, child, callback, parent._result); 16656 }); 16657 } else { 16658 subscribe(parent, child, onFulfillment, onRejection); 16659 } 16660 16661 return child; 16662} 16663 16664/** 16665 `Promise.resolve` returns a promise that will become resolved with the 16666 passed `value`. It is shorthand for the following: 16667 16668 ```javascript 16669 let promise = new Promise(function(resolve, reject){ 16670 resolve(1); 16671 }); 16672 16673 promise.then(function(value){ 16674 // value === 1 16675 }); 16676 ``` 16677 16678 Instead of writing the above, your code now simply becomes the following: 16679 16680 ```javascript 16681 let promise = Promise.resolve(1); 16682 16683 promise.then(function(value){ 16684 // value === 1 16685 }); 16686 ``` 16687 16688 @method resolve 16689 @static 16690 @param {Any} value value that the returned promise will be resolved with 16691 Useful for tooling. 16692 @return {Promise} a promise that will become fulfilled with the given 16693 `value` 16694*/ 16695function resolve$1(object) { 16696 /*jshint validthis:true */ 16697 var Constructor = this; 16698 16699 if (object && typeof object === 'object' && object.constructor === Constructor) { 16700 return object; 16701 } 16702 16703 var promise = new Constructor(noop); 16704 resolve(promise, object); 16705 return promise; 16706} 16707 16708var PROMISE_ID = Math.random().toString(36).substring(2); 16709 16710function noop() {} 16711 16712var PENDING = void 0; 16713var FULFILLED = 1; 16714var REJECTED = 2; 16715 16716function selfFulfillment() { 16717 return new TypeError("You cannot resolve a promise with itself"); 16718} 16719 16720function cannotReturnOwn() { 16721 return new TypeError('A promises callback cannot return that same promise.'); 16722} 16723 16724function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) { 16725 try { 16726 then$$1.call(value, fulfillmentHandler, rejectionHandler); 16727 } catch (e) { 16728 return e; 16729 } 16730} 16731 16732function handleForeignThenable(promise, thenable, then$$1) { 16733 asap(function (promise) { 16734 var sealed = false; 16735 var error = tryThen(then$$1, thenable, function (value) { 16736 if (sealed) { 16737 return; 16738 } 16739 sealed = true; 16740 if (thenable !== value) { 16741 resolve(promise, value); 16742 } else { 16743 fulfill(promise, value); 16744 } 16745 }, function (reason) { 16746 if (sealed) { 16747 return; 16748 } 16749 sealed = true; 16750 16751 reject(promise, reason); 16752 }, 'Settle: ' + (promise._label || ' unknown promise')); 16753 16754 if (!sealed && error) { 16755 sealed = true; 16756 reject(promise, error); 16757 } 16758 }, promise); 16759} 16760 16761function handleOwnThenable(promise, thenable) { 16762 if (thenable._state === FULFILLED) { 16763 fulfill(promise, thenable._result); 16764 } else if (thenable._state === REJECTED) { 16765 reject(promise, thenable._result); 16766 } else { 16767 subscribe(thenable, undefined, function (value) { 16768 return resolve(promise, value); 16769 }, function (reason) { 16770 return reject(promise, reason); 16771 }); 16772 } 16773} 16774 16775function handleMaybeThenable(promise, maybeThenable, then$$1) { 16776 if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) { 16777 handleOwnThenable(promise, maybeThenable); 16778 } else { 16779 if (then$$1 === undefined) { 16780 fulfill(promise, maybeThenable); 16781 } else if (isFunction(then$$1)) { 16782 handleForeignThenable(promise, maybeThenable, then$$1); 16783 } else { 16784 fulfill(promise, maybeThenable); 16785 } 16786 } 16787} 16788 16789function resolve(promise, value) { 16790 if (promise === value) { 16791 reject(promise, selfFulfillment()); 16792 } else if (objectOrFunction(value)) { 16793 var then$$1 = void 0; 16794 try { 16795 then$$1 = value.then; 16796 } catch (error) { 16797 reject(promise, error); 16798 return; 16799 } 16800 handleMaybeThenable(promise, value, then$$1); 16801 } else { 16802 fulfill(promise, value); 16803 } 16804} 16805 16806function publishRejection(promise) { 16807 if (promise._onerror) { 16808 promise._onerror(promise._result); 16809 } 16810 16811 publish(promise); 16812} 16813 16814function fulfill(promise, value) { 16815 if (promise._state !== PENDING) { 16816 return; 16817 } 16818 16819 promise._result = value; 16820 promise._state = FULFILLED; 16821 16822 if (promise._subscribers.length !== 0) { 16823 asap(publish, promise); 16824 } 16825} 16826 16827function reject(promise, reason) { 16828 if (promise._state !== PENDING) { 16829 return; 16830 } 16831 promise._state = REJECTED; 16832 promise._result = reason; 16833 16834 asap(publishRejection, promise); 16835} 16836 16837function subscribe(parent, child, onFulfillment, onRejection) { 16838 var _subscribers = parent._subscribers; 16839 var length = _subscribers.length; 16840 16841 16842 parent._onerror = null; 16843 16844 _subscribers[length] = child; 16845 _subscribers[length + FULFILLED] = onFulfillment; 16846 _subscribers[length + REJECTED] = onRejection; 16847 16848 if (length === 0 && parent._state) { 16849 asap(publish, parent); 16850 } 16851} 16852 16853function publish(promise) { 16854 var subscribers = promise._subscribers; 16855 var settled = promise._state; 16856 16857 if (subscribers.length === 0) { 16858 return; 16859 } 16860 16861 var child = void 0, 16862 callback = void 0, 16863 detail = promise._result; 16864 16865 for (var i = 0; i < subscribers.length; i += 3) { 16866 child = subscribers[i]; 16867 callback = subscribers[i + settled]; 16868 16869 if (child) { 16870 invokeCallback(settled, child, callback, detail); 16871 } else { 16872 callback(detail); 16873 } 16874 } 16875 16876 promise._subscribers.length = 0; 16877} 16878 16879function invokeCallback(settled, promise, callback, detail) { 16880 var hasCallback = isFunction(callback), 16881 value = void 0, 16882 error = void 0, 16883 succeeded = true; 16884 16885 if (hasCallback) { 16886 try { 16887 value = callback(detail); 16888 } catch (e) { 16889 succeeded = false; 16890 error = e; 16891 } 16892 16893 if (promise === value) { 16894 reject(promise, cannotReturnOwn()); 16895 return; 16896 } 16897 } else { 16898 value = detail; 16899 } 16900 16901 if (promise._state !== PENDING) { 16902 // noop 16903 } else if (hasCallback && succeeded) { 16904 resolve(promise, value); 16905 } else if (succeeded === false) { 16906 reject(promise, error); 16907 } else if (settled === FULFILLED) { 16908 fulfill(promise, value); 16909 } else if (settled === REJECTED) { 16910 reject(promise, value); 16911 } 16912} 16913 16914function initializePromise(promise, resolver) { 16915 try { 16916 resolver(function resolvePromise(value) { 16917 resolve(promise, value); 16918 }, function rejectPromise(reason) { 16919 reject(promise, reason); 16920 }); 16921 } catch (e) { 16922 reject(promise, e); 16923 } 16924} 16925 16926var id = 0; 16927function nextId() { 16928 return id++; 16929} 16930 16931function makePromise(promise) { 16932 promise[PROMISE_ID] = id++; 16933 promise._state = undefined; 16934 promise._result = undefined; 16935 promise._subscribers = []; 16936} 16937 16938function validationError() { 16939 return new Error('Array Methods must be provided an Array'); 16940} 16941 16942var Enumerator = function () { 16943 function Enumerator(Constructor, input) { 16944 this._instanceConstructor = Constructor; 16945 this.promise = new Constructor(noop); 16946 16947 if (!this.promise[PROMISE_ID]) { 16948 makePromise(this.promise); 16949 } 16950 16951 if (isArray(input)) { 16952 this.length = input.length; 16953 this._remaining = input.length; 16954 16955 this._result = new Array(this.length); 16956 16957 if (this.length === 0) { 16958 fulfill(this.promise, this._result); 16959 } else { 16960 this.length = this.length || 0; 16961 this._enumerate(input); 16962 if (this._remaining === 0) { 16963 fulfill(this.promise, this._result); 16964 } 16965 } 16966 } else { 16967 reject(this.promise, validationError()); 16968 } 16969 } 16970 16971 Enumerator.prototype._enumerate = function _enumerate(input) { 16972 for (var i = 0; this._state === PENDING && i < input.length; i++) { 16973 this._eachEntry(input[i], i); 16974 } 16975 }; 16976 16977 Enumerator.prototype._eachEntry = function _eachEntry(entry, i) { 16978 var c = this._instanceConstructor; 16979 var resolve$$1 = c.resolve; 16980 16981 16982 if (resolve$$1 === resolve$1) { 16983 var _then = void 0; 16984 var error = void 0; 16985 var didError = false; 16986 try { 16987 _then = entry.then; 16988 } catch (e) { 16989 didError = true; 16990 error = e; 16991 } 16992 16993 if (_then === then && entry._state !== PENDING) { 16994 this._settledAt(entry._state, i, entry._result); 16995 } else if (typeof _then !== 'function') { 16996 this._remaining--; 16997 this._result[i] = entry; 16998 } else if (c === Promise$1) { 16999 var promise = new c(noop); 17000 if (didError) { 17001 reject(promise, error); 17002 } else { 17003 handleMaybeThenable(promise, entry, _then); 17004 } 17005 this._willSettleAt(promise, i); 17006 } else { 17007 this._willSettleAt(new c(function (resolve$$1) { 17008 return resolve$$1(entry); 17009 }), i); 17010 } 17011 } else { 17012 this._willSettleAt(resolve$$1(entry), i); 17013 } 17014 }; 17015 17016 Enumerator.prototype._settledAt = function _settledAt(state, i, value) { 17017 var promise = this.promise; 17018 17019 17020 if (promise._state === PENDING) { 17021 this._remaining--; 17022 17023 if (state === REJECTED) { 17024 reject(promise, value); 17025 } else { 17026 this._result[i] = value; 17027 } 17028 } 17029 17030 if (this._remaining === 0) { 17031 fulfill(promise, this._result); 17032 } 17033 }; 17034 17035 Enumerator.prototype._willSettleAt = function _willSettleAt(promise, i) { 17036 var enumerator = this; 17037 17038 subscribe(promise, undefined, function (value) { 17039 return enumerator._settledAt(FULFILLED, i, value); 17040 }, function (reason) { 17041 return enumerator._settledAt(REJECTED, i, reason); 17042 }); 17043 }; 17044 17045 return Enumerator; 17046}(); 17047 17048/** 17049 `Promise.all` accepts an array of promises, and returns a new promise which 17050 is fulfilled with an array of fulfillment values for the passed promises, or 17051 rejected with the reason of the first passed promise to be rejected. It casts all 17052 elements of the passed iterable to promises as it runs this algorithm. 17053 17054 Example: 17055 17056 ```javascript 17057 let promise1 = resolve(1); 17058 let promise2 = resolve(2); 17059 let promise3 = resolve(3); 17060 let promises = [ promise1, promise2, promise3 ]; 17061 17062 Promise.all(promises).then(function(array){ 17063 // The array here would be [ 1, 2, 3 ]; 17064 }); 17065 ``` 17066 17067 If any of the `promises` given to `all` are rejected, the first promise 17068 that is rejected will be given as an argument to the returned promises's 17069 rejection handler. For example: 17070 17071 Example: 17072 17073 ```javascript 17074 let promise1 = resolve(1); 17075 let promise2 = reject(new Error("2")); 17076 let promise3 = reject(new Error("3")); 17077 let promises = [ promise1, promise2, promise3 ]; 17078 17079 Promise.all(promises).then(function(array){ 17080 // Code here never runs because there are rejected promises! 17081 }, function(error) { 17082 // error.message === "2" 17083 }); 17084 ``` 17085 17086 @method all 17087 @static 17088 @param {Array} entries array of promises 17089 @param {String} label optional string for labeling the promise. 17090 Useful for tooling. 17091 @return {Promise} promise that is fulfilled when all `promises` have been 17092 fulfilled, or rejected if any of them become rejected. 17093 @static 17094*/ 17095function all(entries) { 17096 return new Enumerator(this, entries).promise; 17097} 17098 17099/** 17100 `Promise.race` returns a new promise which is settled in the same way as the 17101 first passed promise to settle. 17102 17103 Example: 17104 17105 ```javascript 17106 let promise1 = new Promise(function(resolve, reject){ 17107 setTimeout(function(){ 17108 resolve('promise 1'); 17109 }, 200); 17110 }); 17111 17112 let promise2 = new Promise(function(resolve, reject){ 17113 setTimeout(function(){ 17114 resolve('promise 2'); 17115 }, 100); 17116 }); 17117 17118 Promise.race([promise1, promise2]).then(function(result){ 17119 // result === 'promise 2' because it was resolved before promise1 17120 // was resolved. 17121 }); 17122 ``` 17123 17124 `Promise.race` is deterministic in that only the state of the first 17125 settled promise matters. For example, even if other promises given to the 17126 `promises` array argument are resolved, but the first settled promise has 17127 become rejected before the other promises became fulfilled, the returned 17128 promise will become rejected: 17129 17130 ```javascript 17131 let promise1 = new Promise(function(resolve, reject){ 17132 setTimeout(function(){ 17133 resolve('promise 1'); 17134 }, 200); 17135 }); 17136 17137 let promise2 = new Promise(function(resolve, reject){ 17138 setTimeout(function(){ 17139 reject(new Error('promise 2')); 17140 }, 100); 17141 }); 17142 17143 Promise.race([promise1, promise2]).then(function(result){ 17144 // Code here never runs 17145 }, function(reason){ 17146 // reason.message === 'promise 2' because promise 2 became rejected before 17147 // promise 1 became fulfilled 17148 }); 17149 ``` 17150 17151 An example real-world use case is implementing timeouts: 17152 17153 ```javascript 17154 Promise.race([ajax('foo.json'), timeout(5000)]) 17155 ``` 17156 17157 @method race 17158 @static 17159 @param {Array} promises array of promises to observe 17160 Useful for tooling. 17161 @return {Promise} a promise which settles in the same way as the first passed 17162 promise to settle. 17163*/ 17164function race(entries) { 17165 /*jshint validthis:true */ 17166 var Constructor = this; 17167 17168 if (!isArray(entries)) { 17169 return new Constructor(function (_, reject) { 17170 return reject(new TypeError('You must pass an array to race.')); 17171 }); 17172 } else { 17173 return new Constructor(function (resolve, reject) { 17174 var length = entries.length; 17175 for (var i = 0; i < length; i++) { 17176 Constructor.resolve(entries[i]).then(resolve, reject); 17177 } 17178 }); 17179 } 17180} 17181 17182/** 17183 `Promise.reject` returns a promise rejected with the passed `reason`. 17184 It is shorthand for the following: 17185 17186 ```javascript 17187 let promise = new Promise(function(resolve, reject){ 17188 reject(new Error('WHOOPS')); 17189 }); 17190 17191 promise.then(function(value){ 17192 // Code here doesn't run because the promise is rejected! 17193 }, function(reason){ 17194 // reason.message === 'WHOOPS' 17195 }); 17196 ``` 17197 17198 Instead of writing the above, your code now simply becomes the following: 17199 17200 ```javascript 17201 let promise = Promise.reject(new Error('WHOOPS')); 17202 17203 promise.then(function(value){ 17204 // Code here doesn't run because the promise is rejected! 17205 }, function(reason){ 17206 // reason.message === 'WHOOPS' 17207 }); 17208 ``` 17209 17210 @method reject 17211 @static 17212 @param {Any} reason value that the returned promise will be rejected with. 17213 Useful for tooling. 17214 @return {Promise} a promise rejected with the given `reason`. 17215*/ 17216function reject$1(reason) { 17217 /*jshint validthis:true */ 17218 var Constructor = this; 17219 var promise = new Constructor(noop); 17220 reject(promise, reason); 17221 return promise; 17222} 17223 17224function needsResolver() { 17225 throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); 17226} 17227 17228function needsNew() { 17229 throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); 17230} 17231 17232/** 17233 Promise objects represent the eventual result of an asynchronous operation. The 17234 primary way of interacting with a promise is through its `then` method, which 17235 registers callbacks to receive either a promise's eventual value or the reason 17236 why the promise cannot be fulfilled. 17237 17238 Terminology 17239 ----------- 17240 17241 - `promise` is an object or function with a `then` method whose behavior conforms to this specification. 17242 - `thenable` is an object or function that defines a `then` method. 17243 - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). 17244 - `exception` is a value that is thrown using the throw statement. 17245 - `reason` is a value that indicates why a promise was rejected. 17246 - `settled` the final resting state of a promise, fulfilled or rejected. 17247 17248 A promise can be in one of three states: pending, fulfilled, or rejected. 17249 17250 Promises that are fulfilled have a fulfillment value and are in the fulfilled 17251 state. Promises that are rejected have a rejection reason and are in the 17252 rejected state. A fulfillment value is never a thenable. 17253 17254 Promises can also be said to *resolve* a value. If this value is also a 17255 promise, then the original promise's settled state will match the value's 17256 settled state. So a promise that *resolves* a promise that rejects will 17257 itself reject, and a promise that *resolves* a promise that fulfills will 17258 itself fulfill. 17259 17260 17261 Basic Usage: 17262 ------------ 17263 17264 ```js 17265 let promise = new Promise(function(resolve, reject) { 17266 // on success 17267 resolve(value); 17268 17269 // on failure 17270 reject(reason); 17271 }); 17272 17273 promise.then(function(value) { 17274 // on fulfillment 17275 }, function(reason) { 17276 // on rejection 17277 }); 17278 ``` 17279 17280 Advanced Usage: 17281 --------------- 17282 17283 Promises shine when abstracting away asynchronous interactions such as 17284 `XMLHttpRequest`s. 17285 17286 ```js 17287 function getJSON(url) { 17288 return new Promise(function(resolve, reject){ 17289 let xhr = new XMLHttpRequest(); 17290 17291 xhr.open('GET', url); 17292 xhr.onreadystatechange = handler; 17293 xhr.responseType = 'json'; 17294 xhr.setRequestHeader('Accept', 'application/json'); 17295 xhr.send(); 17296 17297 function handler() { 17298 if (this.readyState === this.DONE) { 17299 if (this.status === 200) { 17300 resolve(this.response); 17301 } else { 17302 reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); 17303 } 17304 } 17305 }; 17306 }); 17307 } 17308 17309 getJSON('/posts.json').then(function(json) { 17310 // on fulfillment 17311 }, function(reason) { 17312 // on rejection 17313 }); 17314 ``` 17315 17316 Unlike callbacks, promises are great composable primitives. 17317 17318 ```js 17319 Promise.all([ 17320 getJSON('/posts'), 17321 getJSON('/comments') 17322 ]).then(function(values){ 17323 values[0] // => postsJSON 17324 values[1] // => commentsJSON 17325 17326 return values; 17327 }); 17328 ``` 17329 17330 @class Promise 17331 @param {Function} resolver 17332 Useful for tooling. 17333 @constructor 17334*/ 17335 17336var Promise$1 = function () { 17337 function Promise(resolver) { 17338 this[PROMISE_ID] = nextId(); 17339 this._result = this._state = undefined; 17340 this._subscribers = []; 17341 17342 if (noop !== resolver) { 17343 typeof resolver !== 'function' && needsResolver(); 17344 this instanceof Promise ? initializePromise(this, resolver) : needsNew(); 17345 } 17346 } 17347 17348 /** 17349 The primary way of interacting with a promise is through its `then` method, 17350 which registers callbacks to receive either a promise's eventual value or the 17351 reason why the promise cannot be fulfilled. 17352 ```js 17353 findUser().then(function(user){ 17354 // user is available 17355 }, function(reason){ 17356 // user is unavailable, and you are given the reason why 17357 }); 17358 ``` 17359 Chaining 17360 -------- 17361 The return value of `then` is itself a promise. This second, 'downstream' 17362 promise is resolved with the return value of the first promise's fulfillment 17363 or rejection handler, or rejected if the handler throws an exception. 17364 ```js 17365 findUser().then(function (user) { 17366 return user.name; 17367 }, function (reason) { 17368 return 'default name'; 17369 }).then(function (userName) { 17370 // If `findUser` fulfilled, `userName` will be the user's name, otherwise it 17371 // will be `'default name'` 17372 }); 17373 findUser().then(function (user) { 17374 throw new Error('Found user, but still unhappy'); 17375 }, function (reason) { 17376 throw new Error('`findUser` rejected and we're unhappy'); 17377 }).then(function (value) { 17378 // never reached 17379 }, function (reason) { 17380 // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. 17381 // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. 17382 }); 17383 ``` 17384 If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. 17385 ```js 17386 findUser().then(function (user) { 17387 throw new PedagogicalException('Upstream error'); 17388 }).then(function (value) { 17389 // never reached 17390 }).then(function (value) { 17391 // never reached 17392 }, function (reason) { 17393 // The `PedgagocialException` is propagated all the way down to here 17394 }); 17395 ``` 17396 Assimilation 17397 ------------ 17398 Sometimes the value you want to propagate to a downstream promise can only be 17399 retrieved asynchronously. This can be achieved by returning a promise in the 17400 fulfillment or rejection handler. The downstream promise will then be pending 17401 until the returned promise is settled. This is called *assimilation*. 17402 ```js 17403 findUser().then(function (user) { 17404 return findCommentsByAuthor(user); 17405 }).then(function (comments) { 17406 // The user's comments are now available 17407 }); 17408 ``` 17409 If the assimliated promise rejects, then the downstream promise will also reject. 17410 ```js 17411 findUser().then(function (user) { 17412 return findCommentsByAuthor(user); 17413 }).then(function (comments) { 17414 // If `findCommentsByAuthor` fulfills, we'll have the value here 17415 }, function (reason) { 17416 // If `findCommentsByAuthor` rejects, we'll have the reason here 17417 }); 17418 ``` 17419 Simple Example 17420 -------------- 17421 Synchronous Example 17422 ```javascript 17423 let result; 17424 try { 17425 result = findResult(); 17426 // success 17427 } catch(reason) { 17428 // failure 17429 } 17430 ``` 17431 Errback Example 17432 ```js 17433 findResult(function(result, err){ 17434 if (err) { 17435 // failure 17436 } else { 17437 // success 17438 } 17439 }); 17440 ``` 17441 Promise Example; 17442 ```javascript 17443 findResult().then(function(result){ 17444 // success 17445 }, function(reason){ 17446 // failure 17447 }); 17448 ``` 17449 Advanced Example 17450 -------------- 17451 Synchronous Example 17452 ```javascript 17453 let author, books; 17454 try { 17455 author = findAuthor(); 17456 books = findBooksByAuthor(author); 17457 // success 17458 } catch(reason) { 17459 // failure 17460 } 17461 ``` 17462 Errback Example 17463 ```js 17464 function foundBooks(books) { 17465 } 17466 function failure(reason) { 17467 } 17468 findAuthor(function(author, err){ 17469 if (err) { 17470 failure(err); 17471 // failure 17472 } else { 17473 try { 17474 findBoooksByAuthor(author, function(books, err) { 17475 if (err) { 17476 failure(err); 17477 } else { 17478 try { 17479 foundBooks(books); 17480 } catch(reason) { 17481 failure(reason); 17482 } 17483 } 17484 }); 17485 } catch(error) { 17486 failure(err); 17487 } 17488 // success 17489 } 17490 }); 17491 ``` 17492 Promise Example; 17493 ```javascript 17494 findAuthor(). 17495 then(findBooksByAuthor). 17496 then(function(books){ 17497 // found books 17498 }).catch(function(reason){ 17499 // something went wrong 17500 }); 17501 ``` 17502 @method then 17503 @param {Function} onFulfilled 17504 @param {Function} onRejected 17505 Useful for tooling. 17506 @return {Promise} 17507 */ 17508 17509 /** 17510 `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same 17511 as the catch block of a try/catch statement. 17512 ```js 17513 function findAuthor(){ 17514 throw new Error('couldn't find that author'); 17515 } 17516 // synchronous 17517 try { 17518 findAuthor(); 17519 } catch(reason) { 17520 // something went wrong 17521 } 17522 // async with promises 17523 findAuthor().catch(function(reason){ 17524 // something went wrong 17525 }); 17526 ``` 17527 @method catch 17528 @param {Function} onRejection 17529 Useful for tooling. 17530 @return {Promise} 17531 */ 17532 17533 17534 Promise.prototype.catch = function _catch(onRejection) { 17535 return this.then(null, onRejection); 17536 }; 17537 17538 /** 17539 `finally` will be invoked regardless of the promise's fate just as native 17540 try/catch/finally behaves 17541 17542 Synchronous example: 17543 17544 ```js 17545 findAuthor() { 17546 if (Math.random() > 0.5) { 17547 throw new Error(); 17548 } 17549 return new Author(); 17550 } 17551 17552 try { 17553 return findAuthor(); // succeed or fail 17554 } catch(error) { 17555 return findOtherAuther(); 17556 } finally { 17557 // always runs 17558 // doesn't affect the return value 17559 } 17560 ``` 17561 17562 Asynchronous example: 17563 17564 ```js 17565 findAuthor().catch(function(reason){ 17566 return findOtherAuther(); 17567 }).finally(function(){ 17568 // author was either found, or not 17569 }); 17570 ``` 17571 17572 @method finally 17573 @param {Function} callback 17574 @return {Promise} 17575 */ 17576 17577 17578 Promise.prototype.finally = function _finally(callback) { 17579 var promise = this; 17580 var constructor = promise.constructor; 17581 17582 if (isFunction(callback)) { 17583 return promise.then(function (value) { 17584 return constructor.resolve(callback()).then(function () { 17585 return value; 17586 }); 17587 }, function (reason) { 17588 return constructor.resolve(callback()).then(function () { 17589 throw reason; 17590 }); 17591 }); 17592 } 17593 17594 return promise.then(callback, callback); 17595 }; 17596 17597 return Promise; 17598}(); 17599 17600Promise$1.prototype.then = then; 17601Promise$1.all = all; 17602Promise$1.race = race; 17603Promise$1.resolve = resolve$1; 17604Promise$1.reject = reject$1; 17605Promise$1._setScheduler = setScheduler; 17606Promise$1._setAsap = setAsap; 17607Promise$1._asap = asap; 17608 17609/*global self*/ 17610function polyfill() { 17611 var local = void 0; 17612 17613 if (typeof __webpack_require__.g !== 'undefined') { 17614 local = __webpack_require__.g; 17615 } else if (typeof self !== 'undefined') { 17616 local = self; 17617 } else { 17618 try { 17619 local = Function('return this')(); 17620 } catch (e) { 17621 throw new Error('polyfill failed because global object is unavailable in this environment'); 17622 } 17623 } 17624 17625 var P = local.Promise; 17626 17627 if (P) { 17628 var promiseToString = null; 17629 try { 17630 promiseToString = Object.prototype.toString.call(P.resolve()); 17631 } catch (e) { 17632 // silently ignored 17633 } 17634 17635 if (promiseToString === '[object Promise]' && !P.cast) { 17636 return; 17637 } 17638 } 17639 17640 local.Promise = Promise$1; 17641} 17642 17643// Strange compat.. 17644Promise$1.polyfill = polyfill; 17645Promise$1.Promise = Promise$1; 17646 17647return Promise$1; 17648 17649}))); 17650 17651 17652 17653//# sourceMappingURL=es6-promise.map 17654 17655 17656/***/ }), 17657
vendor: 3,262 bytes, lines 17658-17771
17658/***/ "./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js": 17659/*!**********************************************************************************!*\ 17660 !*** ./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js ***! 17661 \**********************************************************************************/ 17662/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 17663 17664"use strict"; 17665 17666 17667var reactIs = __webpack_require__(/*! react-is */ "./node_modules/hoist-non-react-statics/node_modules/react-is/index.js"); 17668 17669/** 17670 * Copyright 2015, Yahoo! Inc. 17671 * Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. 17672 */ 17673var REACT_STATICS = { 17674 childContextTypes: true, 17675 contextType: true, 17676 contextTypes: true, 17677 defaultProps: true, 17678 displayName: true, 17679 getDefaultProps: true, 17680 getDerivedStateFromError: true, 17681 getDerivedStateFromProps: true, 17682 mixins: true, 17683 propTypes: true, 17684 type: true 17685}; 17686var KNOWN_STATICS = { 17687 name: true, 17688 length: true, 17689 prototype: true, 17690 caller: true, 17691 callee: true, 17692 arguments: true, 17693 arity: true 17694}; 17695var FORWARD_REF_STATICS = { 17696 '$$typeof': true, 17697 render: true, 17698 defaultProps: true, 17699 displayName: true, 17700 propTypes: true 17701}; 17702var MEMO_STATICS = { 17703 '$$typeof': true, 17704 compare: true, 17705 defaultProps: true, 17706 displayName: true, 17707 propTypes: true, 17708 type: true 17709}; 17710var TYPE_STATICS = {}; 17711TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS; 17712TYPE_STATICS[reactIs.Memo] = MEMO_STATICS; 17713 17714function getStatics(component) { 17715 // React v16.11 and below 17716 if (reactIs.isMemo(component)) { 17717 return MEMO_STATICS; 17718 } // React v16.12 and above 17719 17720 17721 return TYPE_STATICS[component['$$typeof']] || REACT_STATICS; 17722} 17723 17724var defineProperty = Object.defineProperty; 17725var getOwnPropertyNames = Object.getOwnPropertyNames; 17726var getOwnPropertySymbols = Object.getOwnPropertySymbols; 17727var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; 17728var getPrototypeOf = Object.getPrototypeOf; 17729var objectPrototype = Object.prototype; 17730function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) { 17731 if (typeof sourceComponent !== 'string') { 17732 // don't hoist over string (html) components 17733 if (objectPrototype) { 17734 var inheritedComponent = getPrototypeOf(sourceComponent); 17735 17736 if (inheritedComponent && inheritedComponent !== objectPrototype) { 17737 hoistNonReactStatics(targetComponent, inheritedComponent, blacklist); 17738 } 17739 } 17740 17741 var keys = getOwnPropertyNames(sourceComponent); 17742 17743 if (getOwnPropertySymbols) { 17744 keys = keys.concat(getOwnPropertySymbols(sourceComponent)); 17745 } 17746 17747 var targetStatics = getStatics(targetComponent); 17748 var sourceStatics = getStatics(sourceComponent); 17749 17750 for (var i = 0; i < keys.length; ++i) { 17751 var key = keys[i]; 17752 17753 if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) { 17754 var descriptor = getOwnPropertyDescriptor(sourceComponent, key); 17755 17756 try { 17757 // Avoid failures from read-only properties 17758 defineProperty(targetComponent, key, descriptor); 17759 } catch (e) {} 17760 } 17761 } 17762 } 17763 17764 return targetComponent; 17765} 17766 17767module.exports = hoistNonReactStatics; 17768 17769 17770/***/ }), 17771
vendor: 7,412 bytes, lines 17772-17963
17772/***/ "./node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js": 17773/*!************************************************************************************************!*\ 17774 !*** ./node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js ***! 17775 \************************************************************************************************/ 17776/***/ ((__unused_webpack_module, exports) => { 17777 17778"use strict"; 17779/** @license React v16.13.1 17780 * react-is.development.js 17781 * 17782 * Copyright (c) Facebook, Inc. and its affiliates. 17783 * 17784 * This source code is licensed under the MIT license found in the 17785 * LICENSE file in the root directory of this source tree. 17786 */ 17787 17788 17789 17790 17791 17792if (true) { 17793 (function() { 17794'use strict'; 17795 17796// The Symbol used to tag the ReactElement-like types. If there is no native Symbol 17797// nor polyfill, then a plain number is used for performance. 17798var hasSymbol = typeof Symbol === 'function' && Symbol.for; 17799var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; 17800var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; 17801var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; 17802var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; 17803var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; 17804var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; 17805var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary 17806// (unstable) APIs that have been removed. Can we remove the symbols? 17807 17808var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; 17809var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; 17810var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; 17811var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; 17812var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; 17813var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; 17814var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; 17815var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; 17816var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; 17817var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; 17818var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; 17819 17820function isValidElementType(type) { 17821 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. 17822 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); 17823} 17824 17825function typeOf(object) { 17826 if (typeof object === 'object' && object !== null) { 17827 var $$typeof = object.$$typeof; 17828 17829 switch ($$typeof) { 17830 case REACT_ELEMENT_TYPE: 17831 var type = object.type; 17832 17833 switch (type) { 17834 case REACT_ASYNC_MODE_TYPE: 17835 case REACT_CONCURRENT_MODE_TYPE: 17836 case REACT_FRAGMENT_TYPE: 17837 case REACT_PROFILER_TYPE: 17838 case REACT_STRICT_MODE_TYPE: 17839 case REACT_SUSPENSE_TYPE: 17840 return type; 17841 17842 default: 17843 var $$typeofType = type && type.$$typeof; 17844 17845 switch ($$typeofType) { 17846 case REACT_CONTEXT_TYPE: 17847 case REACT_FORWARD_REF_TYPE: 17848 case REACT_LAZY_TYPE: 17849 case REACT_MEMO_TYPE: 17850 case REACT_PROVIDER_TYPE: 17851 return $$typeofType; 17852 17853 default: 17854 return $$typeof; 17855 } 17856 17857 } 17858 17859 case REACT_PORTAL_TYPE: 17860 return $$typeof; 17861 } 17862 } 17863 17864 return undefined; 17865} // AsyncMode is deprecated along with isAsyncMode 17866 17867var AsyncMode = REACT_ASYNC_MODE_TYPE; 17868var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; 17869var ContextConsumer = REACT_CONTEXT_TYPE; 17870var ContextProvider = REACT_PROVIDER_TYPE; 17871var Element = REACT_ELEMENT_TYPE; 17872var ForwardRef = REACT_FORWARD_REF_TYPE; 17873var Fragment = REACT_FRAGMENT_TYPE; 17874var Lazy = REACT_LAZY_TYPE; 17875var Memo = REACT_MEMO_TYPE; 17876var Portal = REACT_PORTAL_TYPE; 17877var Profiler = REACT_PROFILER_TYPE; 17878var StrictMode = REACT_STRICT_MODE_TYPE; 17879var Suspense = REACT_SUSPENSE_TYPE; 17880var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated 17881 17882function isAsyncMode(object) { 17883 { 17884 if (!hasWarnedAboutDeprecatedIsAsyncMode) { 17885 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint 17886 17887 console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); 17888 } 17889 } 17890 17891 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; 17892} 17893function isConcurrentMode(object) { 17894 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; 17895} 17896function isContextConsumer(object) { 17897 return typeOf(object) === REACT_CONTEXT_TYPE; 17898} 17899function isContextProvider(object) { 17900 return typeOf(object) === REACT_PROVIDER_TYPE; 17901} 17902function isElement(object) { 17903 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 17904} 17905function isForwardRef(object) { 17906 return typeOf(object) === REACT_FORWARD_REF_TYPE; 17907} 17908function isFragment(object) { 17909 return typeOf(object) === REACT_FRAGMENT_TYPE; 17910} 17911function isLazy(object) { 17912 return typeOf(object) === REACT_LAZY_TYPE; 17913} 17914function isMemo(object) { 17915 return typeOf(object) === REACT_MEMO_TYPE; 17916} 17917function isPortal(object) { 17918 return typeOf(object) === REACT_PORTAL_TYPE; 17919} 17920function isProfiler(object) { 17921 return typeOf(object) === REACT_PROFILER_TYPE; 17922} 17923function isStrictMode(object) { 17924 return typeOf(object) === REACT_STRICT_MODE_TYPE; 17925} 17926function isSuspense(object) { 17927 return typeOf(object) === REACT_SUSPENSE_TYPE; 17928} 17929 17930exports.AsyncMode = AsyncMode; 17931exports.ConcurrentMode = ConcurrentMode; 17932exports.ContextConsumer = ContextConsumer; 17933exports.ContextProvider = ContextProvider; 17934exports.Element = Element; 17935exports.ForwardRef = ForwardRef; 17936exports.Fragment = Fragment; 17937exports.Lazy = Lazy; 17938exports.Memo = Memo; 17939exports.Portal = Portal; 17940exports.Profiler = Profiler; 17941exports.StrictMode = StrictMode; 17942exports.Suspense = Suspense; 17943exports.isAsyncMode = isAsyncMode; 17944exports.isConcurrentMode = isConcurrentMode; 17945exports.isContextConsumer = isContextConsumer; 17946exports.isContextProvider = isContextProvider; 17947exports.isElement = isElement; 17948exports.isForwardRef = isForwardRef; 17949exports.isFragment = isFragment; 17950exports.isLazy = isLazy; 17951exports.isMemo = isMemo; 17952exports.isPortal = isPortal; 17953exports.isProfiler = isProfiler; 17954exports.isStrictMode = isStrictMode; 17955exports.isSuspense = isSuspense; 17956exports.isValidElementType = isValidElementType; 17957exports.typeOf = typeOf; 17958 })(); 17959} 17960 17961 17962/***/ }), 17963
vendor: 617 bytes, lines 17964-17979
17964/***/ "./node_modules/hoist-non-react-statics/node_modules/react-is/index.js": 17965/*!*****************************************************************************!*\ 17966 !*** ./node_modules/hoist-non-react-statics/node_modules/react-is/index.js ***! 17967 \*****************************************************************************/ 17968/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 17969 17970"use strict"; 17971 17972 17973if (false) {} else { 17974 module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "./node_modules/hoist-non-react-statics/node_modules/react-is/cjs/react-is.development.js"); 17975} 17976 17977 17978/***/ }), 17979
vendor: 642 bytes, lines 17980-17995
17980/***/ "./node_modules/isomorphic-fetch/fetch-npm-browserify.js": 17981/*!***************************************************************!*\ 17982 !*** ./node_modules/isomorphic-fetch/fetch-npm-browserify.js ***! 17983 \***************************************************************/ 17984/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 17985 17986// the whatwg-fetch polyfill installs the fetch() function 17987// on the global object (window or self) 17988// 17989// Return that as the export for use in Webpack, Browserify etc. 17990__webpack_require__(/*! whatwg-fetch */ "./node_modules/whatwg-fetch/fetch.js"); 17991module.exports = self.fetch.bind(self); 17992 17993 17994/***/ }), 17995
vendor: 11,133 bytes, lines 17996-18382
17996/***/ "./node_modules/lodash.debounce/index.js": 17997/*!***********************************************!*\ 17998 !*** ./node_modules/lodash.debounce/index.js ***! 17999 \***********************************************/ 18000/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 18001 18002/** 18003 * lodash (Custom Build) <https://lodash.com/> 18004 * Build: `lodash modularize exports="npm" -o ./` 18005 * Copyright jQuery Foundation and other contributors <https://jquery.org/> 18006 * Released under MIT license <https://lodash.com/license> 18007 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 18008 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 18009 */ 18010 18011/** Used as the `TypeError` message for "Functions" methods. */ 18012var FUNC_ERROR_TEXT = 'Expected a function'; 18013 18014/** Used as references for various `Number` constants. */ 18015var NAN = 0 / 0; 18016 18017/** `Object#toString` result references. */ 18018var symbolTag = '[object Symbol]'; 18019 18020/** Used to match leading and trailing whitespace. */ 18021var reTrim = /^\s+|\s+$/g; 18022 18023/** Used to detect bad signed hexadecimal string values. */ 18024var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 18025 18026/** Used to detect binary string values. */ 18027var reIsBinary = /^0b[01]+$/i; 18028 18029/** Used to detect octal string values. */ 18030var reIsOctal = /^0o[0-7]+$/i; 18031 18032/** Built-in method references without a dependency on `root`. */ 18033var freeParseInt = parseInt; 18034 18035/** Detect free variable `global` from Node.js. */ 18036var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; 18037 18038/** Detect free variable `self`. */ 18039var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 18040 18041/** Used as a reference to the global object. */ 18042var root = freeGlobal || freeSelf || Function('return this')(); 18043 18044/** Used for built-in method references. */ 18045var objectProto = Object.prototype; 18046 18047/** 18048 * Used to resolve the 18049 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 18050 * of values. 18051 */ 18052var objectToString = objectProto.toString; 18053 18054/* Built-in method references for those with the same name as other `lodash` methods. */ 18055var nativeMax = Math.max, 18056 nativeMin = Math.min; 18057 18058/** 18059 * Gets the timestamp of the number of milliseconds that have elapsed since 18060 * the Unix epoch (1 January 1970 00:00:00 UTC). 18061 * 18062 * @static 18063 * @memberOf _ 18064 * @since 2.4.0 18065 * @category Date 18066 * @returns {number} Returns the timestamp. 18067 * @example 18068 * 18069 * _.defer(function(stamp) { 18070 * console.log(_.now() - stamp); 18071 * }, _.now()); 18072 * // => Logs the number of milliseconds it took for the deferred invocation. 18073 */ 18074var now = function() { 18075 return root.Date.now(); 18076}; 18077 18078/** 18079 * Creates a debounced function that delays invoking `func` until after `wait` 18080 * milliseconds have elapsed since the last time the debounced function was 18081 * invoked. The debounced function comes with a `cancel` method to cancel 18082 * delayed `func` invocations and a `flush` method to immediately invoke them. 18083 * Provide `options` to indicate whether `func` should be invoked on the 18084 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 18085 * with the last arguments provided to the debounced function. Subsequent 18086 * calls to the debounced function return the result of the last `func` 18087 * invocation. 18088 * 18089 * **Note:** If `leading` and `trailing` options are `true`, `func` is 18090 * invoked on the trailing edge of the timeout only if the debounced function 18091 * is invoked more than once during the `wait` timeout. 18092 * 18093 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 18094 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 18095 * 18096 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 18097 * for details over the differences between `_.debounce` and `_.throttle`. 18098 * 18099 * @static 18100 * @memberOf _ 18101 * @since 0.1.0 18102 * @category Function 18103 * @param {Function} func The function to debounce. 18104 * @param {number} [wait=0] The number of milliseconds to delay. 18105 * @param {Object} [options={}] The options object. 18106 * @param {boolean} [options.leading=false] 18107 * Specify invoking on the leading edge of the timeout. 18108 * @param {number} [options.maxWait] 18109 * The maximum time `func` is allowed to be delayed before it's invoked. 18110 * @param {boolean} [options.trailing=true] 18111 * Specify invoking on the trailing edge of the timeout. 18112 * @returns {Function} Returns the new debounced function. 18113 * @example 18114 * 18115 * // Avoid costly calculations while the window size is in flux. 18116 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 18117 * 18118 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 18119 * jQuery(element).on('click', _.debounce(sendMail, 300, { 18120 * 'leading': true, 18121 * 'trailing': false 18122 * })); 18123 * 18124 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 18125 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 18126 * var source = new EventSource('/stream'); 18127 * jQuery(source).on('message', debounced); 18128 * 18129 * // Cancel the trailing debounced invocation. 18130 * jQuery(window).on('popstate', debounced.cancel); 18131 */ 18132function debounce(func, wait, options) { 18133 var lastArgs, 18134 lastThis, 18135 maxWait, 18136 result, 18137 timerId, 18138 lastCallTime, 18139 lastInvokeTime = 0, 18140 leading = false, 18141 maxing = false, 18142 trailing = true; 18143 18144 if (typeof func != 'function') { 18145 throw new TypeError(FUNC_ERROR_TEXT); 18146 } 18147 wait = toNumber(wait) || 0; 18148 if (isObject(options)) { 18149 leading = !!options.leading; 18150 maxing = 'maxWait' in options; 18151 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 18152 trailing = 'trailing' in options ? !!options.trailing : trailing; 18153 } 18154 18155 function invokeFunc(time) { 18156 var args = lastArgs, 18157 thisArg = lastThis; 18158 18159 lastArgs = lastThis = undefined; 18160 lastInvokeTime = time; 18161 result = func.apply(thisArg, args); 18162 return result; 18163 } 18164 18165 function leadingEdge(time) { 18166 // Reset any `maxWait` timer. 18167 lastInvokeTime = time; 18168 // Start the timer for the trailing edge. 18169 timerId = setTimeout(timerExpired, wait); 18170 // Invoke the leading edge. 18171 return leading ? invokeFunc(time) : result; 18172 } 18173 18174 function remainingWait(time) { 18175 var timeSinceLastCall = time - lastCallTime, 18176 timeSinceLastInvoke = time - lastInvokeTime, 18177 result = wait - timeSinceLastCall; 18178 18179 return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; 18180 } 18181 18182 function shouldInvoke(time) { 18183 var timeSinceLastCall = time - lastCallTime, 18184 timeSinceLastInvoke = time - lastInvokeTime; 18185 18186 // Either this is the first call, activity has stopped and we're at the 18187 // trailing edge, the system time has gone backwards and we're treating 18188 // it as the trailing edge, or we've hit the `maxWait` limit. 18189 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 18190 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 18191 } 18192 18193 function timerExpired() { 18194 var time = now(); 18195 if (shouldInvoke(time)) { 18196 return trailingEdge(time); 18197 } 18198 // Restart the timer. 18199 timerId = setTimeout(timerExpired, remainingWait(time)); 18200 } 18201 18202 function trailingEdge(time) { 18203 timerId = undefined; 18204 18205 // Only invoke if we have `lastArgs` which means `func` has been 18206 // debounced at least once. 18207 if (trailing && lastArgs) { 18208 return invokeFunc(time); 18209 } 18210 lastArgs = lastThis = undefined; 18211 return result; 18212 } 18213 18214 function cancel() { 18215 if (timerId !== undefined) { 18216 clearTimeout(timerId); 18217 } 18218 lastInvokeTime = 0; 18219 lastArgs = lastCallTime = lastThis = timerId = undefined; 18220 } 18221 18222 function flush() { 18223 return timerId === undefined ? result : trailingEdge(now()); 18224 } 18225 18226 function debounced() { 18227 var time = now(), 18228 isInvoking = shouldInvoke(time); 18229 18230 lastArgs = arguments; 18231 lastThis = this; 18232 lastCallTime = time; 18233 18234 if (isInvoking) { 18235 if (timerId === undefined) { 18236 return leadingEdge(lastCallTime); 18237 } 18238 if (maxing) { 18239 // Handle invocations in a tight loop. 18240 timerId = setTimeout(timerExpired, wait); 18241 return invokeFunc(lastCallTime); 18242 } 18243 } 18244 if (timerId === undefined) { 18245 timerId = setTimeout(timerExpired, wait); 18246 } 18247 return result; 18248 } 18249 debounced.cancel = cancel; 18250 debounced.flush = flush; 18251 return debounced; 18252} 18253 18254/** 18255 * Checks if `value` is the 18256 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 18257 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 18258 * 18259 * @static 18260 * @memberOf _ 18261 * @since 0.1.0 18262 * @category Lang 18263 * @param {*} value The value to check. 18264 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 18265 * @example 18266 * 18267 * _.isObject({}); 18268 * // => true 18269 * 18270 * _.isObject([1, 2, 3]); 18271 * // => true 18272 * 18273 * _.isObject(_.noop); 18274 * // => true 18275 * 18276 * _.isObject(null); 18277 * // => false 18278 */ 18279function isObject(value) { 18280 var type = typeof value; 18281 return !!value && (type == 'object' || type == 'function'); 18282} 18283 18284/** 18285 * Checks if `value` is object-like. A value is object-like if it's not `null` 18286 * and has a `typeof` result of "object". 18287 * 18288 * @static 18289 * @memberOf _ 18290 * @since 4.0.0 18291 * @category Lang 18292 * @param {*} value The value to check. 18293 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 18294 * @example 18295 * 18296 * _.isObjectLike({}); 18297 * // => true 18298 * 18299 * _.isObjectLike([1, 2, 3]); 18300 * // => true 18301 * 18302 * _.isObjectLike(_.noop); 18303 * // => false 18304 * 18305 * _.isObjectLike(null); 18306 * // => false 18307 */ 18308function isObjectLike(value) { 18309 return !!value && typeof value == 'object'; 18310} 18311 18312/** 18313 * Checks if `value` is classified as a `Symbol` primitive or object. 18314 * 18315 * @static 18316 * @memberOf _ 18317 * @since 4.0.0 18318 * @category Lang 18319 * @param {*} value The value to check. 18320 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 18321 * @example 18322 * 18323 * _.isSymbol(Symbol.iterator); 18324 * // => true 18325 * 18326 * _.isSymbol('abc'); 18327 * // => false 18328 */ 18329function isSymbol(value) { 18330 return typeof value == 'symbol' || 18331 (isObjectLike(value) && objectToString.call(value) == symbolTag); 18332} 18333 18334/** 18335 * Converts `value` to a number. 18336 * 18337 * @static 18338 * @memberOf _ 18339 * @since 4.0.0 18340 * @category Lang 18341 * @param {*} value The value to process. 18342 * @returns {number} Returns the number. 18343 * @example 18344 * 18345 * _.toNumber(3.2); 18346 * // => 3.2 18347 * 18348 * _.toNumber(Number.MIN_VALUE); 18349 * // => 5e-324 18350 * 18351 * _.toNumber(Infinity); 18352 * // => Infinity 18353 * 18354 * _.toNumber('3.2'); 18355 * // => 3.2 18356 */ 18357function toNumber(value) { 18358 if (typeof value == 'number') { 18359 return value; 18360 } 18361 if (isSymbol(value)) { 18362 return NAN; 18363 } 18364 if (isObject(value)) { 18365 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 18366 value = isObject(other) ? (other + '') : other; 18367 } 18368 if (typeof value != 'string') { 18369 return value === 0 ? value : +value; 18370 } 18371 value = value.replace(reTrim, ''); 18372 var isBinary = reIsBinary.test(value); 18373 return (isBinary || reIsOctal.test(value)) 18374 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 18375 : (reIsBadHex.test(value) ? NAN : +value); 18376} 18377 18378module.exports = debounce; 18379 18380 18381/***/ }), 18382
vendor: 2,343 bytes, lines 18383-18483
18383/***/ "./node_modules/object-assign/index.js": 18384/*!*********************************************!*\ 18385 !*** ./node_modules/object-assign/index.js ***! 18386 \*********************************************/ 18387/***/ ((module) => { 18388 18389"use strict"; 18390/* 18391object-assign 18392(c) Sindre Sorhus 18393@license MIT 18394*/ 18395 18396 18397/* eslint-disable no-unused-vars */ 18398var getOwnPropertySymbols = Object.getOwnPropertySymbols; 18399var hasOwnProperty = Object.prototype.hasOwnProperty; 18400var propIsEnumerable = Object.prototype.propertyIsEnumerable; 18401 18402function toObject(val) { 18403 if (val === null || val === undefined) { 18404 throw new TypeError('Object.assign cannot be called with null or undefined'); 18405 } 18406 18407 return Object(val); 18408} 18409 18410function shouldUseNative() { 18411 try { 18412 if (!Object.assign) { 18413 return false; 18414 } 18415 18416 // Detect buggy property enumeration order in older V8 versions. 18417 18418 // https://bugs.chromium.org/p/v8/issues/detail?id=4118 18419 var test1 = new String('abc'); // eslint-disable-line no-new-wrappers 18420 test1[5] = 'de'; 18421 if (Object.getOwnPropertyNames(test1)[0] === '5') { 18422 return false; 18423 } 18424 18425 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 18426 var test2 = {}; 18427 for (var i = 0; i < 10; i++) { 18428 test2['_' + String.fromCharCode(i)] = i; 18429 } 18430 var order2 = Object.getOwnPropertyNames(test2).map(function (n) { 18431 return test2[n]; 18432 }); 18433 if (order2.join('') !== '0123456789') { 18434 return false; 18435 } 18436 18437 // https://bugs.chromium.org/p/v8/issues/detail?id=3056 18438 var test3 = {}; 18439 'abcdefghijklmnopqrst'.split('').forEach(function (letter) { 18440 test3[letter] = letter; 18441 }); 18442 if (Object.keys(Object.assign({}, test3)).join('') !== 18443 'abcdefghijklmnopqrst') { 18444 return false; 18445 } 18446 18447 return true; 18448 } catch (err) { 18449 // We don't expect any of the above to throw, but better to be safe. 18450 return false; 18451 } 18452} 18453 18454module.exports = shouldUseNative() ? Object.assign : function (target, source) { 18455 var from; 18456 var to = toObject(target); 18457 var symbols; 18458 18459 for (var s = 1; s < arguments.length; s++) { 18460 from = Object(arguments[s]); 18461 18462 for (var key in from) { 18463 if (hasOwnProperty.call(from, key)) { 18464 to[key] = from[key]; 18465 } 18466 } 18467 18468 if (getOwnPropertySymbols) { 18469 symbols = getOwnPropertySymbols(from); 18470 for (var i = 0; i < symbols.length; i++) { 18471 if (propIsEnumerable.call(from, symbols[i])) { 18472 to[symbols[i]] = from[symbols[i]]; 18473 } 18474 } 18475 } 18476 } 18477 18478 return to; 18479}; 18480 18481 18482/***/ }), 18483
vendor: 4,204 bytes, lines 18484-18597
18484/***/ "./node_modules/prop-types/checkPropTypes.js": 18485/*!***************************************************!*\ 18486 !*** ./node_modules/prop-types/checkPropTypes.js ***! 18487 \***************************************************/ 18488/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 18489 18490"use strict"; 18491/** 18492 * Copyright (c) 2013-present, Facebook, Inc. 18493 * 18494 * This source code is licensed under the MIT license found in the 18495 * LICENSE file in the root directory of this source tree. 18496 */ 18497 18498 18499 18500var printWarning = function() {}; 18501 18502if (true) { 18503 var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); 18504 var loggedTypeFailures = {}; 18505 var has = __webpack_require__(/*! ./lib/has */ "./node_modules/prop-types/lib/has.js"); 18506 18507 printWarning = function(text) { 18508 var message = 'Warning: ' + text; 18509 if (typeof console !== 'undefined') { 18510 console.error(message); 18511 } 18512 try { 18513 // --- Welcome to debugging React --- 18514 // This error was thrown as a convenience so that you can use this stack 18515 // to find the callsite that caused this warning to fire. 18516 throw new Error(message); 18517 } catch (x) { /**/ } 18518 }; 18519} 18520 18521/** 18522 * Assert that the values match with the type specs. 18523 * Error messages are memorized and will only be shown once. 18524 * 18525 * @param {object} typeSpecs Map of name to a ReactPropType 18526 * @param {object} values Runtime values that need to be type-checked 18527 * @param {string} location e.g. "prop", "context", "child context" 18528 * @param {string} componentName Name of the component for error messages. 18529 * @param {?Function} getStack Returns the component stack. 18530 * @private 18531 */ 18532function checkPropTypes(typeSpecs, values, location, componentName, getStack) { 18533 if (true) { 18534 for (var typeSpecName in typeSpecs) { 18535 if (has(typeSpecs, typeSpecName)) { 18536 var error; 18537 // Prop type validation may throw. In case they do, we don't want to 18538 // fail the render phase where it didn't fail before. So we log it. 18539 // After these have been cleaned up, we'll let them throw. 18540 try { 18541 // This is intentionally an invariant that gets caught. It's the same 18542 // behavior as without this statement except with a better message. 18543 if (typeof typeSpecs[typeSpecName] !== 'function') { 18544 var err = Error( 18545 (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 18546 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 18547 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.' 18548 ); 18549 err.name = 'Invariant Violation'; 18550 throw err; 18551 } 18552 error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret); 18553 } catch (ex) { 18554 error = ex; 18555 } 18556 if (error && !(error instanceof Error)) { 18557 printWarning( 18558 (componentName || 'React class') + ': type specification of ' + 18559 location + ' `' + typeSpecName + '` is invalid; the type checker ' + 18560 'function must return `null` or an `Error` but returned a ' + typeof error + '. ' + 18561 'You may have forgotten to pass an argument to the type checker ' + 18562 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 18563 'shape all require an argument).' 18564 ); 18565 } 18566 if (error instanceof Error && !(error.message in loggedTypeFailures)) { 18567 // Only monitor this failure once because there tends to be a lot of the 18568 // same error. 18569 loggedTypeFailures[error.message] = true; 18570 18571 var stack = getStack ? getStack() : ''; 18572 18573 printWarning( 18574 'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '') 18575 ); 18576 } 18577 } 18578 } 18579 } 18580} 18581 18582/** 18583 * Resets warning cache when testing. 18584 * 18585 * @private 18586 */ 18587checkPropTypes.resetWarningCache = function() { 18588 if (true) { 18589 loggedTypeFailures = {}; 18590 } 18591} 18592 18593module.exports = checkPropTypes; 18594 18595 18596/***/ }), 18597
vendor: 23,215 bytes, lines 18598-19218
18598/***/ "./node_modules/prop-types/factoryWithTypeCheckers.js": 18599/*!************************************************************!*\ 18600 !*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***! 18601 \************************************************************/ 18602/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 18603 18604"use strict"; 18605/** 18606 * Copyright (c) 2013-present, Facebook, Inc. 18607 * 18608 * This source code is licensed under the MIT license found in the 18609 * LICENSE file in the root directory of this source tree. 18610 */ 18611 18612 18613 18614var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/prop-types/node_modules/react-is/index.js"); 18615var assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js"); 18616 18617var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js"); 18618var has = __webpack_require__(/*! ./lib/has */ "./node_modules/prop-types/lib/has.js"); 18619var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js"); 18620 18621var printWarning = function() {}; 18622 18623if (true) { 18624 printWarning = function(text) { 18625 var message = 'Warning: ' + text; 18626 if (typeof console !== 'undefined') { 18627 console.error(message); 18628 } 18629 try { 18630 // --- Welcome to debugging React --- 18631 // This error was thrown as a convenience so that you can use this stack 18632 // to find the callsite that caused this warning to fire. 18633 throw new Error(message); 18634 } catch (x) {} 18635 }; 18636} 18637 18638function emptyFunctionThatReturnsNull() { 18639 return null; 18640} 18641 18642module.exports = function(isValidElement, throwOnDirectAccess) { 18643 /* global Symbol */ 18644 var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator; 18645 var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec. 18646 18647 /** 18648 * Returns the iterator method function contained on the iterable object. 18649 * 18650 * Be sure to invoke the function with the iterable as context: 18651 * 18652 * var iteratorFn = getIteratorFn(myIterable); 18653 * if (iteratorFn) { 18654 * var iterator = iteratorFn.call(myIterable); 18655 * ... 18656 * } 18657 * 18658 * @param {?object} maybeIterable 18659 * @return {?function} 18660 */ 18661 function getIteratorFn(maybeIterable) { 18662 var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]); 18663 if (typeof iteratorFn === 'function') { 18664 return iteratorFn; 18665 } 18666 } 18667 18668 /** 18669 * Collection of methods that allow declaration and validation of props that are 18670 * supplied to React components. Example usage: 18671 * 18672 * var Props = require('ReactPropTypes'); 18673 * var MyArticle = React.createClass({ 18674 * propTypes: { 18675 * // An optional string prop named "description". 18676 * description: Props.string, 18677 * 18678 * // A required enum prop named "category". 18679 * category: Props.oneOf(['News','Photos']).isRequired, 18680 * 18681 * // A prop named "dialog" that requires an instance of Dialog. 18682 * dialog: Props.instanceOf(Dialog).isRequired 18683 * }, 18684 * render: function() { ... } 18685 * }); 18686 * 18687 * A more formal specification of how these methods are used: 18688 * 18689 * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...) 18690 * decl := ReactPropTypes.{type}(.isRequired)? 18691 * 18692 * Each and every declaration produces a function with the same signature. This 18693 * allows the creation of custom validation functions. For example: 18694 * 18695 * var MyLink = React.createClass({ 18696 * propTypes: { 18697 * // An optional string or URI prop named "href". 18698 * href: function(props, propName, componentName) { 18699 * var propValue = props[propName]; 18700 * if (propValue != null && typeof propValue !== 'string' && 18701 * !(propValue instanceof URI)) { 18702 * return new Error( 18703 * 'Expected a string or an URI for ' + propName + ' in ' + 18704 * componentName 18705 * ); 18706 * } 18707 * } 18708 * }, 18709 * render: function() {...} 18710 * }); 18711 * 18712 * @internal 18713 */ 18714 18715 var ANONYMOUS = '<<anonymous>>'; 18716 18717 // Important! 18718 // Keep this list in sync with production version in `./factoryWithThrowingShims.js`. 18719 var ReactPropTypes = { 18720 array: createPrimitiveTypeChecker('array'), 18721 bigint: createPrimitiveTypeChecker('bigint'), 18722 bool: createPrimitiveTypeChecker('boolean'), 18723 func: createPrimitiveTypeChecker('function'), 18724 number: createPrimitiveTypeChecker('number'), 18725 object: createPrimitiveTypeChecker('object'), 18726 string: createPrimitiveTypeChecker('string'), 18727 symbol: createPrimitiveTypeChecker('symbol'), 18728 18729 any: createAnyTypeChecker(), 18730 arrayOf: createArrayOfTypeChecker, 18731 element: createElementTypeChecker(), 18732 elementType: createElementTypeTypeChecker(), 18733 instanceOf: createInstanceTypeChecker, 18734 node: createNodeChecker(), 18735 objectOf: createObjectOfTypeChecker, 18736 oneOf: createEnumTypeChecker, 18737 oneOfType: createUnionTypeChecker, 18738 shape: createShapeTypeChecker, 18739 exact: createStrictShapeTypeChecker, 18740 }; 18741 18742 /** 18743 * inlined Object.is polyfill to avoid requiring consumers ship their own 18744 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 18745 */ 18746 /*eslint-disable no-self-compare*/ 18747 function is(x, y) { 18748 // SameValue algorithm 18749 if (x === y) { 18750 // Steps 1-5, 7-10 18751 // Steps 6.b-6.e: +0 != -0 18752 return x !== 0 || 1 / x === 1 / y; 18753 } else { 18754 // Step 6.a: NaN == NaN 18755 return x !== x && y !== y; 18756 } 18757 } 18758 /*eslint-enable no-self-compare*/ 18759 18760 /** 18761 * We use an Error-like object for backward compatibility as people may call 18762 * PropTypes directly and inspect their output. However, we don't use real 18763 * Errors anymore. We don't inspect their stack anyway, and creating them 18764 * is prohibitively expensive if they are created too often, such as what 18765 * happens in oneOfType() for any type before the one that matched. 18766 */ 18767 function PropTypeError(message, data) { 18768 this.message = message; 18769 this.data = data && typeof data === 'object' ? data: {}; 18770 this.stack = ''; 18771 } 18772 // Make `instanceof Error` still work for returned errors. 18773 PropTypeError.prototype = Error.prototype; 18774 18775 function createChainableTypeChecker(validate) { 18776 if (true) { 18777 var manualPropTypeCallCache = {}; 18778 var manualPropTypeWarningCount = 0; 18779 } 18780 function checkType(isRequired, props, propName, componentName, location, propFullName, secret) { 18781 componentName = componentName || ANONYMOUS; 18782 propFullName = propFullName || propName; 18783 18784 if (secret !== ReactPropTypesSecret) { 18785 if (throwOnDirectAccess) { 18786 // New behavior only for users of `prop-types` package 18787 var err = new Error( 18788 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' + 18789 'Use `PropTypes.checkPropTypes()` to call them. ' + 18790 'Read more at http://fb.me/use-check-prop-types' 18791 ); 18792 err.name = 'Invariant Violation'; 18793 throw err; 18794 } else if ( true && typeof console !== 'undefined') { 18795 // Old behavior for people using React.PropTypes 18796 var cacheKey = componentName + ':' + propName; 18797 if ( 18798 !manualPropTypeCallCache[cacheKey] && 18799 // Avoid spamming the console because they are often not actionable except for lib authors 18800 manualPropTypeWarningCount < 3 18801 ) { 18802 printWarning( 18803 'You are manually calling a React.PropTypes validation ' + 18804 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' + 18805 'and will throw in the standalone `prop-types` package. ' + 18806 'You may be seeing this warning due to a third-party PropTypes ' + 18807 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.' 18808 ); 18809 manualPropTypeCallCache[cacheKey] = true; 18810 manualPropTypeWarningCount++; 18811 } 18812 } 18813 } 18814 if (props[propName] == null) { 18815 if (isRequired) { 18816 if (props[propName] === null) { 18817 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.')); 18818 } 18819 return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.')); 18820 } 18821 return null; 18822 } else { 18823 return validate(props, propName, componentName, location, propFullName); 18824 } 18825 } 18826 18827 var chainedCheckType = checkType.bind(null, false); 18828 chainedCheckType.isRequired = checkType.bind(null, true); 18829 18830 return chainedCheckType; 18831 } 18832 18833 function createPrimitiveTypeChecker(expectedType) { 18834 function validate(props, propName, componentName, location, propFullName, secret) { 18835 var propValue = props[propName]; 18836 var propType = getPropType(propValue); 18837 if (propType !== expectedType) { 18838 // `propValue` being instance of, say, date/regexp, pass the 'object' 18839 // check, but we can offer a more precise error message here rather than 18840 // 'of type `object`'. 18841 var preciseType = getPreciseType(propValue); 18842 18843 return new PropTypeError( 18844 'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'), 18845 {expectedType: expectedType} 18846 ); 18847 } 18848 return null; 18849 } 18850 return createChainableTypeChecker(validate); 18851 } 18852 18853 function createAnyTypeChecker() { 18854 return createChainableTypeChecker(emptyFunctionThatReturnsNull); 18855 } 18856 18857 function createArrayOfTypeChecker(typeChecker) { 18858 function validate(props, propName, componentName, location, propFullName) { 18859 if (typeof typeChecker !== 'function') { 18860 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.'); 18861 } 18862 var propValue = props[propName]; 18863 if (!Array.isArray(propValue)) { 18864 var propType = getPropType(propValue); 18865 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.')); 18866 } 18867 for (var i = 0; i < propValue.length; i++) { 18868 var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret); 18869 if (error instanceof Error) { 18870 return error; 18871 } 18872 } 18873 return null; 18874 } 18875 return createChainableTypeChecker(validate); 18876 } 18877 18878 function createElementTypeChecker() { 18879 function validate(props, propName, componentName, location, propFullName) { 18880 var propValue = props[propName]; 18881 if (!isValidElement(propValue)) { 18882 var propType = getPropType(propValue); 18883 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.')); 18884 } 18885 return null; 18886 } 18887 return createChainableTypeChecker(validate); 18888 } 18889 18890 function createElementTypeTypeChecker() { 18891 function validate(props, propName, componentName, location, propFullName) { 18892 var propValue = props[propName]; 18893 if (!ReactIs.isValidElementType(propValue)) { 18894 var propType = getPropType(propValue); 18895 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.')); 18896 } 18897 return null; 18898 } 18899 return createChainableTypeChecker(validate); 18900 } 18901 18902 function createInstanceTypeChecker(expectedClass) { 18903 function validate(props, propName, componentName, location, propFullName) { 18904 if (!(props[propName] instanceof expectedClass)) { 18905 var expectedClassName = expectedClass.name || ANONYMOUS; 18906 var actualClassName = getClassName(props[propName]); 18907 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.')); 18908 } 18909 return null; 18910 } 18911 return createChainableTypeChecker(validate); 18912 } 18913 18914 function createEnumTypeChecker(expectedValues) { 18915 if (!Array.isArray(expectedValues)) { 18916 if (true) { 18917 if (arguments.length > 1) { 18918 printWarning( 18919 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' + 18920 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).' 18921 ); 18922 } else { 18923 printWarning('Invalid argument supplied to oneOf, expected an array.'); 18924 } 18925 } 18926 return emptyFunctionThatReturnsNull; 18927 } 18928 18929 function validate(props, propName, componentName, location, propFullName) { 18930 var propValue = props[propName]; 18931 for (var i = 0; i < expectedValues.length; i++) { 18932 if (is(propValue, expectedValues[i])) { 18933 return null; 18934 } 18935 } 18936 18937 var valuesString = JSON.stringify(expectedValues, function replacer(key, value) { 18938 var type = getPreciseType(value); 18939 if (type === 'symbol') { 18940 return String(value); 18941 } 18942 return value; 18943 }); 18944 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.')); 18945 } 18946 return createChainableTypeChecker(validate); 18947 } 18948 18949 function createObjectOfTypeChecker(typeChecker) { 18950 function validate(props, propName, componentName, location, propFullName) { 18951 if (typeof typeChecker !== 'function') { 18952 return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.'); 18953 } 18954 var propValue = props[propName]; 18955 var propType = getPropType(propValue); 18956 if (propType !== 'object') { 18957 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.')); 18958 } 18959 for (var key in propValue) { 18960 if (has(propValue, key)) { 18961 var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); 18962 if (error instanceof Error) { 18963 return error; 18964 } 18965 } 18966 } 18967 return null; 18968 } 18969 return createChainableTypeChecker(validate); 18970 } 18971 18972 function createUnionTypeChecker(arrayOfTypeCheckers) { 18973 if (!Array.isArray(arrayOfTypeCheckers)) { 18974 true ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : 0; 18975 return emptyFunctionThatReturnsNull; 18976 } 18977 18978 for (var i = 0; i < arrayOfTypeCheckers.length; i++) { 18979 var checker = arrayOfTypeCheckers[i]; 18980 if (typeof checker !== 'function') { 18981 printWarning( 18982 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' + 18983 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.' 18984 ); 18985 return emptyFunctionThatReturnsNull; 18986 } 18987 } 18988 18989 function validate(props, propName, componentName, location, propFullName) { 18990 var expectedTypes = []; 18991 for (var i = 0; i < arrayOfTypeCheckers.length; i++) { 18992 var checker = arrayOfTypeCheckers[i]; 18993 var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret); 18994 if (checkerResult == null) { 18995 return null; 18996 } 18997 if (checkerResult.data && has(checkerResult.data, 'expectedType')) { 18998 expectedTypes.push(checkerResult.data.expectedType); 18999 } 19000 } 19001 var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': ''; 19002 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.')); 19003 } 19004 return createChainableTypeChecker(validate); 19005 } 19006 19007 function createNodeChecker() { 19008 function validate(props, propName, componentName, location, propFullName) { 19009 if (!isNode(props[propName])) { 19010 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.')); 19011 } 19012 return null; 19013 } 19014 return createChainableTypeChecker(validate); 19015 } 19016 19017 function invalidValidatorError(componentName, location, propFullName, key, type) { 19018 return new PropTypeError( 19019 (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' + 19020 'it must be a function, usually from the `prop-types` package, but received `' + type + '`.' 19021 ); 19022 } 19023 19024 function createShapeTypeChecker(shapeTypes) { 19025 function validate(props, propName, componentName, location, propFullName) { 19026 var propValue = props[propName]; 19027 var propType = getPropType(propValue); 19028 if (propType !== 'object') { 19029 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); 19030 } 19031 for (var key in shapeTypes) { 19032 var checker = shapeTypes[key]; 19033 if (typeof checker !== 'function') { 19034 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); 19035 } 19036 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); 19037 if (error) { 19038 return error; 19039 } 19040 } 19041 return null; 19042 } 19043 return createChainableTypeChecker(validate); 19044 } 19045 19046 function createStrictShapeTypeChecker(shapeTypes) { 19047 function validate(props, propName, componentName, location, propFullName) { 19048 var propValue = props[propName]; 19049 var propType = getPropType(propValue); 19050 if (propType !== 'object') { 19051 return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.')); 19052 } 19053 // We need to check all keys in case some are required but missing from props. 19054 var allKeys = assign({}, props[propName], shapeTypes); 19055 for (var key in allKeys) { 19056 var checker = shapeTypes[key]; 19057 if (has(shapeTypes, key) && typeof checker !== 'function') { 19058 return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker)); 19059 } 19060 if (!checker) { 19061 return new PropTypeError( 19062 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' + 19063 '\nBad object: ' + JSON.stringify(props[propName], null, ' ') + 19064 '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ') 19065 ); 19066 } 19067 var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret); 19068 if (error) { 19069 return error; 19070 } 19071 } 19072 return null; 19073 } 19074 19075 return createChainableTypeChecker(validate); 19076 } 19077 19078 function isNode(propValue) { 19079 switch (typeof propValue) { 19080 case 'number': 19081 case 'string': 19082 case 'undefined': 19083 return true; 19084 case 'boolean': 19085 return !propValue; 19086 case 'object': 19087 if (Array.isArray(propValue)) { 19088 return propValue.every(isNode); 19089 } 19090 if (propValue === null || isValidElement(propValue)) { 19091 return true; 19092 } 19093 19094 var iteratorFn = getIteratorFn(propValue); 19095 if (iteratorFn) { 19096 var iterator = iteratorFn.call(propValue); 19097 var step; 19098 if (iteratorFn !== propValue.entries) { 19099 while (!(step = iterator.next()).done) { 19100 if (!isNode(step.value)) { 19101 return false; 19102 } 19103 } 19104 } else { 19105 // Iterator will provide entry [k,v] tuples rather than values. 19106 while (!(step = iterator.next()).done) { 19107 var entry = step.value; 19108 if (entry) { 19109 if (!isNode(entry[1])) { 19110 return false; 19111 } 19112 } 19113 } 19114 } 19115 } else { 19116 return false; 19117 } 19118 19119 return true; 19120 default: 19121 return false; 19122 } 19123 } 19124 19125 function isSymbol(propType, propValue) { 19126 // Native Symbol. 19127 if (propType === 'symbol') { 19128 return true; 19129 } 19130 19131 // falsy value can't be a Symbol 19132 if (!propValue) { 19133 return false; 19134 } 19135 19136 // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol' 19137 if (propValue['@@toStringTag'] === 'Symbol') { 19138 return true; 19139 } 19140 19141 // Fallback for non-spec compliant Symbols which are polyfilled. 19142 if (typeof Symbol === 'function' && propValue instanceof Symbol) { 19143 return true; 19144 } 19145 19146 return false; 19147 } 19148 19149 // Equivalent of `typeof` but with special handling for array and regexp. 19150 function getPropType(propValue) { 19151 var propType = typeof propValue; 19152 if (Array.isArray(propValue)) { 19153 return 'array'; 19154 } 19155 if (propValue instanceof RegExp) { 19156 // Old webkits (at least until Android 4.0) return 'function' rather than 19157 // 'object' for typeof a RegExp. We'll normalize this here so that /bla/ 19158 // passes PropTypes.object. 19159 return 'object'; 19160 } 19161 if (isSymbol(propType, propValue)) { 19162 return 'symbol'; 19163 } 19164 return propType; 19165 } 19166 19167 // This handles more types than `getPropType`. Only used for error messages. 19168 // See `createPrimitiveTypeChecker`. 19169 function getPreciseType(propValue) { 19170 if (typeof propValue === 'undefined' || propValue === null) { 19171 return '' + propValue; 19172 } 19173 var propType = getPropType(propValue); 19174 if (propType === 'object') { 19175 if (propValue instanceof Date) { 19176 return 'date'; 19177 } else if (propValue instanceof RegExp) { 19178 return 'regexp'; 19179 } 19180 } 19181 return propType; 19182 } 19183 19184 // Returns a string that is postfixed to a warning about an invalid type. 19185 // For example, "undefined" or "of type array" 19186 function getPostfixForTypeWarning(value) { 19187 var type = getPreciseType(value); 19188 switch (type) { 19189 case 'array': 19190 case 'object': 19191 return 'an ' + type; 19192 case 'boolean': 19193 case 'date': 19194 case 'regexp': 19195 return 'a ' + type; 19196 default: 19197 return type; 19198 } 19199 } 19200 19201 // Returns class name of the object, if any. 19202 function getClassName(propValue) { 19203 if (!propValue.constructor || !propValue.constructor.name) { 19204 return ANONYMOUS; 19205 } 19206 return propValue.constructor.name; 19207 } 19208 19209 ReactPropTypes.checkPropTypes = checkPropTypes; 19210 ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache; 19211 ReactPropTypes.PropTypes = ReactPropTypes; 19212 19213 return ReactPropTypes; 19214}; 19215 19216 19217/***/ }), 19218
vendor: 913 bytes, lines 19219-19243
19219/***/ "./node_modules/prop-types/index.js": 19220/*!******************************************!*\ 19221 !*** ./node_modules/prop-types/index.js ***! 19222 \******************************************/ 19223/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 19224 19225/** 19226 * Copyright (c) 2013-present, Facebook, Inc. 19227 * 19228 * This source code is licensed under the MIT license found in the 19229 * LICENSE file in the root directory of this source tree. 19230 */ 19231 19232if (true) { 19233 var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/prop-types/node_modules/react-is/index.js"); 19234 19235 // By explicitly using `prop-types` you are opting into new development behavior. 19236 // http://fb.me/prop-types-in-prod 19237 var throwOnDirectAccess = true; 19238 module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ "./node_modules/prop-types/factoryWithTypeCheckers.js")(ReactIs.isElement, throwOnDirectAccess); 19239} else {} 19240 19241 19242/***/ }), 19243
vendor: 613 bytes, lines 19244-19266
19244/***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js": 19245/*!*************************************************************!*\ 19246 !*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***! 19247 \*************************************************************/ 19248/***/ ((module) => { 19249 19250"use strict"; 19251/** 19252 * Copyright (c) 2013-present, Facebook, Inc. 19253 * 19254 * This source code is licensed under the MIT license found in the 19255 * LICENSE file in the root directory of this source tree. 19256 */ 19257 19258 19259 19260var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'; 19261 19262module.exports = ReactPropTypesSecret; 19263 19264 19265/***/ }), 19266
vendor: 300 bytes, lines 19267-19277
19267/***/ "./node_modules/prop-types/lib/has.js": 19268/*!********************************************!*\ 19269 !*** ./node_modules/prop-types/lib/has.js ***! 19270 \********************************************/ 19271/***/ ((module) => { 19272 19273module.exports = Function.call.bind(Object.prototype.hasOwnProperty); 19274 19275 19276/***/ }), 19277
vendor: 7,360 bytes, lines 19278-19469
19278/***/ "./node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js": 19279/*!***********************************************************************************!*\ 19280 !*** ./node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js ***! 19281 \***********************************************************************************/ 19282/***/ ((__unused_webpack_module, exports) => { 19283 19284"use strict"; 19285/** @license React v16.13.1 19286 * react-is.development.js 19287 * 19288 * Copyright (c) Facebook, Inc. and its affiliates. 19289 * 19290 * This source code is licensed under the MIT license found in the 19291 * LICENSE file in the root directory of this source tree. 19292 */ 19293 19294 19295 19296 19297 19298if (true) { 19299 (function() { 19300'use strict'; 19301 19302// The Symbol used to tag the ReactElement-like types. If there is no native Symbol 19303// nor polyfill, then a plain number is used for performance. 19304var hasSymbol = typeof Symbol === 'function' && Symbol.for; 19305var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7; 19306var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca; 19307var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb; 19308var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc; 19309var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2; 19310var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd; 19311var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary 19312// (unstable) APIs that have been removed. Can we remove the symbols? 19313 19314var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf; 19315var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf; 19316var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0; 19317var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1; 19318var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8; 19319var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3; 19320var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4; 19321var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9; 19322var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5; 19323var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6; 19324var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7; 19325 19326function isValidElementType(type) { 19327 return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. 19328 type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE); 19329} 19330 19331function typeOf(object) { 19332 if (typeof object === 'object' && object !== null) { 19333 var $$typeof = object.$$typeof; 19334 19335 switch ($$typeof) { 19336 case REACT_ELEMENT_TYPE: 19337 var type = object.type; 19338 19339 switch (type) { 19340 case REACT_ASYNC_MODE_TYPE: 19341 case REACT_CONCURRENT_MODE_TYPE: 19342 case REACT_FRAGMENT_TYPE: 19343 case REACT_PROFILER_TYPE: 19344 case REACT_STRICT_MODE_TYPE: 19345 case REACT_SUSPENSE_TYPE: 19346 return type; 19347 19348 default: 19349 var $$typeofType = type && type.$$typeof; 19350 19351 switch ($$typeofType) { 19352 case REACT_CONTEXT_TYPE: 19353 case REACT_FORWARD_REF_TYPE: 19354 case REACT_LAZY_TYPE: 19355 case REACT_MEMO_TYPE: 19356 case REACT_PROVIDER_TYPE: 19357 return $$typeofType; 19358 19359 default: 19360 return $$typeof; 19361 } 19362 19363 } 19364 19365 case REACT_PORTAL_TYPE: 19366 return $$typeof; 19367 } 19368 } 19369 19370 return undefined; 19371} // AsyncMode is deprecated along with isAsyncMode 19372 19373var AsyncMode = REACT_ASYNC_MODE_TYPE; 19374var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE; 19375var ContextConsumer = REACT_CONTEXT_TYPE; 19376var ContextProvider = REACT_PROVIDER_TYPE; 19377var Element = REACT_ELEMENT_TYPE; 19378var ForwardRef = REACT_FORWARD_REF_TYPE; 19379var Fragment = REACT_FRAGMENT_TYPE; 19380var Lazy = REACT_LAZY_TYPE; 19381var Memo = REACT_MEMO_TYPE; 19382var Portal = REACT_PORTAL_TYPE; 19383var Profiler = REACT_PROFILER_TYPE; 19384var StrictMode = REACT_STRICT_MODE_TYPE; 19385var Suspense = REACT_SUSPENSE_TYPE; 19386var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated 19387 19388function isAsyncMode(object) { 19389 { 19390 if (!hasWarnedAboutDeprecatedIsAsyncMode) { 19391 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint 19392 19393 console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.'); 19394 } 19395 } 19396 19397 return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE; 19398} 19399function isConcurrentMode(object) { 19400 return typeOf(object) === REACT_CONCURRENT_MODE_TYPE; 19401} 19402function isContextConsumer(object) { 19403 return typeOf(object) === REACT_CONTEXT_TYPE; 19404} 19405function isContextProvider(object) { 19406 return typeOf(object) === REACT_PROVIDER_TYPE; 19407} 19408function isElement(object) { 19409 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 19410} 19411function isForwardRef(object) { 19412 return typeOf(object) === REACT_FORWARD_REF_TYPE; 19413} 19414function isFragment(object) { 19415 return typeOf(object) === REACT_FRAGMENT_TYPE; 19416} 19417function isLazy(object) { 19418 return typeOf(object) === REACT_LAZY_TYPE; 19419} 19420function isMemo(object) { 19421 return typeOf(object) === REACT_MEMO_TYPE; 19422} 19423function isPortal(object) { 19424 return typeOf(object) === REACT_PORTAL_TYPE; 19425} 19426function isProfiler(object) { 19427 return typeOf(object) === REACT_PROFILER_TYPE; 19428} 19429function isStrictMode(object) { 19430 return typeOf(object) === REACT_STRICT_MODE_TYPE; 19431} 19432function isSuspense(object) { 19433 return typeOf(object) === REACT_SUSPENSE_TYPE; 19434} 19435 19436exports.AsyncMode = AsyncMode; 19437exports.ConcurrentMode = ConcurrentMode; 19438exports.ContextConsumer = ContextConsumer; 19439exports.ContextProvider = ContextProvider; 19440exports.Element = Element; 19441exports.ForwardRef = ForwardRef; 19442exports.Fragment = Fragment; 19443exports.Lazy = Lazy; 19444exports.Memo = Memo; 19445exports.Portal = Portal; 19446exports.Profiler = Profiler; 19447exports.StrictMode = StrictMode; 19448exports.Suspense = Suspense; 19449exports.isAsyncMode = isAsyncMode; 19450exports.isConcurrentMode = isConcurrentMode; 19451exports.isContextConsumer = isContextConsumer; 19452exports.isContextProvider = isContextProvider; 19453exports.isElement = isElement; 19454exports.isForwardRef = isForwardRef; 19455exports.isFragment = isFragment; 19456exports.isLazy = isLazy; 19457exports.isMemo = isMemo; 19458exports.isPortal = isPortal; 19459exports.isProfiler = isProfiler; 19460exports.isStrictMode = isStrictMode; 19461exports.isSuspense = isSuspense; 19462exports.isValidElementType = isValidElementType; 19463exports.typeOf = typeOf; 19464 })(); 19465} 19466 19467 19468/***/ }), 19469
vendor: 552 bytes, lines 19470-19485
19470/***/ "./node_modules/prop-types/node_modules/react-is/index.js": 19471/*!****************************************************************!*\ 19472 !*** ./node_modules/prop-types/node_modules/react-is/index.js ***! 19473 \****************************************************************/ 19474/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 19475 19476"use strict"; 19477 19478 19479if (false) {} else { 19480 module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "./node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js"); 19481} 19482 19483 19484/***/ }), 19485
vendor: 9,583 bytes, lines 19486-19676
19486/***/ "./node_modules/react-a11y-dialog/dist/index.js": 19487/*!******************************************************!*\ 19488 !*** ./node_modules/react-a11y-dialog/dist/index.js ***! 19489 \******************************************************/ 19490/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 19491 19492"use strict"; 19493 19494 19495Object.defineProperty(exports, "__esModule", ({ 19496 value: true 19497})); 19498exports.useA11yDialog = exports.A11yDialog = void 0; 19499var _react = _interopRequireDefault(__webpack_require__(/*! react */ "./node_modules/react/index.js")); 19500var _reactDom = _interopRequireDefault(__webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js")); 19501var _a11yDialog = _interopRequireDefault(__webpack_require__(/*! a11y-dialog */ "./node_modules/a11y-dialog/dist/a11y-dialog.esm.js")); 19502var _propTypes = _interopRequireDefault(__webpack_require__(/*! prop-types */ "./node_modules/prop-types/index.js")); 19503function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } 19504function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } 19505function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 19506function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 19507function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } 19508function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } 19509function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } 19510function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 19511var useIsMounted = function useIsMounted() { 19512 var _React$useState = _react["default"].useState(false), 19513 _React$useState2 = _slicedToArray(_React$useState, 2), 19514 isMounted = _React$useState2[0], 19515 setIsMounted = _React$useState2[1]; 19516 _react["default"].useEffect(function () { 19517 return setIsMounted(true); 19518 }, []); 19519 return isMounted; 19520}; 19521var useA11yDialogInstance = function useA11yDialogInstance() { 19522 var _React$useState3 = _react["default"].useState(null), 19523 _React$useState4 = _slicedToArray(_React$useState3, 2), 19524 instance = _React$useState4[0], 19525 setInstance = _React$useState4[1]; 19526 var container = _react["default"].useCallback(function (node) { 19527 if (node !== null) setInstance(new _a11yDialog["default"](node)); 19528 }, []); 19529 return [instance, container]; 19530}; 19531var useA11yDialog = function useA11yDialog(props) { 19532 var _useA11yDialogInstanc = useA11yDialogInstance(), 19533 _useA11yDialogInstanc2 = _slicedToArray(_useA11yDialogInstanc, 2), 19534 instance = _useA11yDialogInstanc2[0], 19535 ref = _useA11yDialogInstanc2[1]; 19536 var close = _react["default"].useCallback(function () { 19537 return instance.hide(); 19538 }, [instance]); 19539 var role = props.role || 'dialog'; 19540 var isAlertDialog = role === 'alertdialog'; 19541 var titleId = props.titleId || props.id + '-title'; 19542 19543 // Destroy the `a11y-dialog` instance when unmounting the component. 19544 _react["default"].useEffect(function () { 19545 return function () { 19546 if (instance) instance.destroy(); 19547 }; 19548 }, [instance]); 19549 return [instance, { 19550 container: { 19551 id: props.id, 19552 ref: ref, 19553 role: role, 19554 tabIndex: -1, 19555 'aria-modal': true, 19556 'aria-hidden': true, 19557 'aria-labelledby': titleId 19558 }, 19559 overlay: { 19560 onClick: isAlertDialog ? undefined : close 19561 }, 19562 dialog: { 19563 role: 'document' 19564 }, 19565 closeButton: { 19566 type: 'button', 19567 onClick: close 19568 }, 19569 // Using a paragraph with accessibility mapping can be useful to work 19570 // around SEO concerns of having multiple <h1> per page. 19571 // See: https://twitter.com/goetsu/status/1261253532315004930 19572 title: { 19573 role: 'heading', 19574 'aria-level': 1, 19575 id: titleId 19576 } 19577 }]; 19578}; 19579exports.useA11yDialog = useA11yDialog; 19580var A11yDialog = function A11yDialog(props) { 19581 var isMounted = useIsMounted(); 19582 var _useA11yDialog = useA11yDialog(props), 19583 _useA11yDialog2 = _slicedToArray(_useA11yDialog, 2), 19584 instance = _useA11yDialog2[0], 19585 attributes = _useA11yDialog2[1]; 19586 var dialogRef = props.dialogRef; 19587 _react["default"].useEffect(function () { 19588 if (instance) dialogRef(instance); 19589 return function () { 19590 return dialogRef(undefined); 19591 }; 19592 }, [dialogRef, instance]); 19593 if (!isMounted) return null; 19594 var root = props.dialogRoot ? document.querySelector(props.dialogRoot) : document.body; 19595 var title = /*#__PURE__*/_react["default"].createElement("p", _extends({}, attributes.title, { 19596 className: props.classNames.title, 19597 key: "title" 19598 }), props.title); 19599 var button = /*#__PURE__*/_react["default"].createElement("button", _extends({}, attributes.closeButton, { 19600 className: props.classNames.closeButton, 19601 "aria-label": props.closeButtonLabel, 19602 key: "button" 19603 }), props.closeButtonContent); 19604 var children = [props.closeButtonPosition === 'first' && button, title, props.children, props.closeButtonPosition === 'last' && button].filter(Boolean); 19605 return /*#__PURE__*/_reactDom["default"].createPortal( /*#__PURE__*/_react["default"].createElement("div", _extends({}, attributes.container, { 19606 className: props.classNames.container 19607 }), /*#__PURE__*/_react["default"].createElement("div", _extends({}, attributes.overlay, { 19608 className: props.classNames.overlay 19609 })), /*#__PURE__*/_react["default"].createElement("div", _extends({}, attributes.dialog, { 19610 className: props.classNames.dialog 19611 }), children)), root); 19612}; 19613exports.A11yDialog = A11yDialog; 19614A11yDialog.defaultProps = { 19615 role: 'dialog', 19616 closeButtonLabel: 'Close this dialog window', 19617 closeButtonContent: "\xD7", 19618 closeButtonPosition: 'first', 19619 classNames: {}, 19620 dialogRef: function dialogRef() { 19621 return void 0; 19622 } 19623 // Default properties cannot be based on other properties, so the default 19624 // value for the `titleId` prop is defined in the `render(..)` method. 19625}; 19626 19627A11yDialog.propTypes = { 19628 // The `role` attribute of the dialog element, either `dialog` (default) or 19629 // `alertdialog` to make it a modal (preventing closing on click outside of 19630 // ESC key). 19631 role: _propTypes["default"].oneOf(['dialog', 'alertdialog']), 19632 // The HTML `id` attribute of the dialog element, internally used by 19633 // a11y-dialog to manipulate the dialog. 19634 id: _propTypes["default"].string.isRequired, 19635 // The title of the dialog, mandatory in the document to provide context to 19636 // assistive technology. Could be hidden (while remaining accessible) with 19637 // CSS though. 19638 title: _propTypes["default"].node.isRequired, 19639 // A function called when the component has mounted, receiving the instance 19640 // of A11yDialog so that it can be programmatically accessed later on. 19641 // E.g.: dialogRef={(dialog) => (this.dialog = dialog)} 19642 dialogRef: _propTypes["default"].func, 19643 // The HTML `id` attribute of the dialogâs title element, used by assistive 19644 // technologies to provide context and meaning to the dialog window. Falls 19645 // back to the `${this.props.id}-title` if not provided. 19646 titleId: _propTypes["default"].string, 19647 // The HTML `aria-label` attribute of the close button, used by assistive 19648 // technologies to provide extra meaning to the usual cross-mark. Defaults 19649 // to a generic English explanation. 19650 closeButtonLabel: _propTypes["default"].string, 19651 // The string that is the innerHTML of the close button. 19652 closeButtonContent: _propTypes["default"].node, 19653 // Whether the close button should be rendered as first/last children or not at all. 19654 closeButtonPosition: _propTypes["default"].oneOf(['first', 'last', 'none']), 19655 // React 16 requires a container for the portalâs content to be rendered 19656 // into; this needs to be an existing valid DOM node and defaults to the body 19657 // element. 19658 dialogRoot: _propTypes["default"].string, 19659 // Object of classes for each HTML element of the dialog element. 19660 // See: https://a11y-dialog.netlify.app/usage/markup 19661 classNames: _propTypes["default"].exact({ 19662 container: _propTypes["default"].string, 19663 overlay: _propTypes["default"].string, 19664 dialog: _propTypes["default"].string, 19665 title: _propTypes["default"].string, 19666 closeButton: _propTypes["default"].string 19667 }), 19668 // Dialog content. 19669 // Anything that can be rendered: numbers, strings, elements or an array 19670 // (or fragment) containing these types. 19671 children: _propTypes["default"].node 19672}; 19673 19674 19675/***/ }), 19676
vendor: 1,029,841 bytes, lines 19677-49606
19677/***/ "./node_modules/react-dom/cjs/react-dom.development.js": 19678/*!*************************************************************!*\ 19679 !*** ./node_modules/react-dom/cjs/react-dom.development.js ***! 19680 \*************************************************************/ 19681/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 19682 19683"use strict"; 19684/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 19685/** 19686 * @license React 19687 * react-dom.development.js 19688 * 19689 * Copyright (c) Facebook, Inc. and its affiliates. 19690 * 19691 * This source code is licensed under the MIT license found in the 19692 * LICENSE file in the root directory of this source tree. 19693 */ 19694 19695 19696 19697if (true) { 19698 (function() { 19699 19700 'use strict'; 19701 19702/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 19703if ( 19704 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 19705 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === 19706 'function' 19707) { 19708 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); 19709} 19710 var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 19711var Scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js"); 19712 19713var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 19714 19715var suppressWarning = false; 19716function setSuppressWarning(newSuppressWarning) { 19717 { 19718 suppressWarning = newSuppressWarning; 19719 } 19720} // In DEV, calls to console.warn and console.error get replaced 19721// by calls to these methods by a Babel plugin. 19722// 19723// In PROD (or in packages without access to React internals), 19724// they are left as they are instead. 19725 19726function warn(format) { 19727 { 19728 if (!suppressWarning) { 19729 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 19730 args[_key - 1] = arguments[_key]; 19731 } 19732 19733 printWarning('warn', format, args); 19734 } 19735 } 19736} 19737function error(format) { 19738 { 19739 if (!suppressWarning) { 19740 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 19741 args[_key2 - 1] = arguments[_key2]; 19742 } 19743 19744 printWarning('error', format, args); 19745 } 19746 } 19747} 19748 19749function printWarning(level, format, args) { 19750 // When changing this logic, you might want to also 19751 // update consoleWithStackDev.www.js as well. 19752 { 19753 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; 19754 var stack = ReactDebugCurrentFrame.getStackAddendum(); 19755 19756 if (stack !== '') { 19757 format += '%s'; 19758 args = args.concat([stack]); 19759 } // eslint-disable-next-line react-internal/safe-string-coercion 19760 19761 19762 var argsWithFormat = args.map(function (item) { 19763 return String(item); 19764 }); // Careful: RN currently depends on this prefix 19765 19766 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it 19767 // breaks IE9: https://github.com/facebook/react/issues/13610 19768 // eslint-disable-next-line react-internal/no-production-logging 19769 19770 Function.prototype.apply.call(console[level], console, argsWithFormat); 19771 } 19772} 19773 19774var FunctionComponent = 0; 19775var ClassComponent = 1; 19776var IndeterminateComponent = 2; // Before we know whether it is function or class 19777 19778var HostRoot = 3; // Root of a host tree. Could be nested inside another node. 19779 19780var HostPortal = 4; // A subtree. Could be an entry point to a different renderer. 19781 19782var HostComponent = 5; 19783var HostText = 6; 19784var Fragment = 7; 19785var Mode = 8; 19786var ContextConsumer = 9; 19787var ContextProvider = 10; 19788var ForwardRef = 11; 19789var Profiler = 12; 19790var SuspenseComponent = 13; 19791var MemoComponent = 14; 19792var SimpleMemoComponent = 15; 19793var LazyComponent = 16; 19794var IncompleteClassComponent = 17; 19795var DehydratedFragment = 18; 19796var SuspenseListComponent = 19; 19797var ScopeComponent = 21; 19798var OffscreenComponent = 22; 19799var LegacyHiddenComponent = 23; 19800var CacheComponent = 24; 19801var TracingMarkerComponent = 25; 19802 19803// ----------------------------------------------------------------------------- 19804 19805var enableClientRenderFallbackOnTextMismatch = true; // TODO: Need to review this code one more time before landing 19806// the react-reconciler package. 19807 19808var enableNewReconciler = false; // Support legacy Primer support on internal FB www 19809 19810var enableLazyContextPropagation = false; // FB-only usage. The new API has different semantics. 19811 19812var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber 19813 19814var enableSuspenseAvoidThisFallback = false; // Enables unstable_avoidThisFallback feature in Fizz 19815// React DOM Chopping Block 19816// 19817// Similar to main Chopping Block but only flags related to React DOM. These are 19818// grouped because we will likely batch all of them into a single major release. 19819// ----------------------------------------------------------------------------- 19820// Disable support for comment nodes as React DOM containers. Already disabled 19821// in open source, but www codebase still relies on it. Need to remove. 19822 19823var disableCommentsAsDOMContainers = true; // Disable javascript: URL strings in href for XSS protection. 19824// and client rendering, mostly to allow JSX attributes to apply to the custom 19825// element's object properties instead of only HTML attributes. 19826// https://github.com/facebook/react/issues/11347 19827 19828var enableCustomElementPropertySupport = false; // Disables children for <textarea> elements 19829var warnAboutStringRefs = true; // ----------------------------------------------------------------------------- 19830// Debugging and DevTools 19831// ----------------------------------------------------------------------------- 19832// Adds user timing marks for e.g. state updates, suspense, and work loop stuff, 19833// for an experimental timeline tool. 19834 19835var enableSchedulingProfiler = true; // Helps identify side effects in render-phase lifecycle hooks and setState 19836 19837var enableProfilerTimer = true; // Record durations for commit and passive effects phases. 19838 19839var enableProfilerCommitHooks = true; // Phase param passed to onRender callback differentiates between an "update" and a "cascading-update". 19840 19841var allNativeEvents = new Set(); 19842/** 19843 * Mapping from registration name to event name 19844 */ 19845 19846 19847var registrationNameDependencies = {}; 19848/** 19849 * Mapping from lowercase registration names to the properly cased version, 19850 * used to warn in the case of missing event handlers. Available 19851 * only in true. 19852 * @type {Object} 19853 */ 19854 19855var possibleRegistrationNames = {} ; // Trust the developer to only use possibleRegistrationNames in true 19856 19857function registerTwoPhaseEvent(registrationName, dependencies) { 19858 registerDirectEvent(registrationName, dependencies); 19859 registerDirectEvent(registrationName + 'Capture', dependencies); 19860} 19861function registerDirectEvent(registrationName, dependencies) { 19862 { 19863 if (registrationNameDependencies[registrationName]) { 19864 error('EventRegistry: More than one plugin attempted to publish the same ' + 'registration name, `%s`.', registrationName); 19865 } 19866 } 19867 19868 registrationNameDependencies[registrationName] = dependencies; 19869 19870 { 19871 var lowerCasedName = registrationName.toLowerCase(); 19872 possibleRegistrationNames[lowerCasedName] = registrationName; 19873 19874 if (registrationName === 'onDoubleClick') { 19875 possibleRegistrationNames.ondblclick = registrationName; 19876 } 19877 } 19878 19879 for (var i = 0; i < dependencies.length; i++) { 19880 allNativeEvents.add(dependencies[i]); 19881 } 19882} 19883 19884var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); 19885 19886var hasOwnProperty = Object.prototype.hasOwnProperty; 19887 19888/* 19889 * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol 19890 * and Temporal.* types. See https://github.com/facebook/react/pull/22064. 19891 * 19892 * The functions in this module will throw an easier-to-understand, 19893 * easier-to-debug exception with a clear errors message message explaining the 19894 * problem. (Instead of a confusing exception thrown inside the implementation 19895 * of the `value` object). 19896 */ 19897// $FlowFixMe only called in DEV, so void return is not possible. 19898function typeName(value) { 19899 { 19900 // toStringTag is needed for namespaced types like Temporal.Instant 19901 var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; 19902 var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; 19903 return type; 19904 } 19905} // $FlowFixMe only called in DEV, so void return is not possible. 19906 19907 19908function willCoercionThrow(value) { 19909 { 19910 try { 19911 testStringCoercion(value); 19912 return false; 19913 } catch (e) { 19914 return true; 19915 } 19916 } 19917} 19918 19919function testStringCoercion(value) { 19920 // If you ended up here by following an exception call stack, here's what's 19921 // happened: you supplied an object or symbol value to React (as a prop, key, 19922 // DOM attribute, CSS property, string ref, etc.) and when React tried to 19923 // coerce it to a string using `'' + value`, an exception was thrown. 19924 // 19925 // The most common types that will cause this exception are `Symbol` instances 19926 // and Temporal objects like `Temporal.Instant`. But any object that has a 19927 // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this 19928 // exception. (Library authors do this to prevent users from using built-in 19929 // numeric operators like `+` or comparison operators like `>=` because custom 19930 // methods are needed to perform accurate arithmetic or comparison.) 19931 // 19932 // To fix the problem, coerce this object or symbol value to a string before 19933 // passing it to React. The most reliable way is usually `String(value)`. 19934 // 19935 // To find which value is throwing, check the browser or debugger console. 19936 // Before this exception was thrown, there should be `console.error` output 19937 // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the 19938 // problem and how that type was used: key, atrribute, input value prop, etc. 19939 // In most cases, this console output also shows the component and its 19940 // ancestor components where the exception happened. 19941 // 19942 // eslint-disable-next-line react-internal/safe-string-coercion 19943 return '' + value; 19944} 19945 19946function checkAttributeStringCoercion(value, attributeName) { 19947 { 19948 if (willCoercionThrow(value)) { 19949 error('The provided `%s` attribute is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', attributeName, typeName(value)); 19950 19951 return testStringCoercion(value); // throw (to help callers find troubleshooting comments) 19952 } 19953 } 19954} 19955function checkKeyStringCoercion(value) { 19956 { 19957 if (willCoercionThrow(value)) { 19958 error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); 19959 19960 return testStringCoercion(value); // throw (to help callers find troubleshooting comments) 19961 } 19962 } 19963} 19964function checkPropStringCoercion(value, propName) { 19965 { 19966 if (willCoercionThrow(value)) { 19967 error('The provided `%s` prop is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', propName, typeName(value)); 19968 19969 return testStringCoercion(value); // throw (to help callers find troubleshooting comments) 19970 } 19971 } 19972} 19973function checkCSSPropertyStringCoercion(value, propName) { 19974 { 19975 if (willCoercionThrow(value)) { 19976 error('The provided `%s` CSS property is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', propName, typeName(value)); 19977 19978 return testStringCoercion(value); // throw (to help callers find troubleshooting comments) 19979 } 19980 } 19981} 19982function checkHtmlStringCoercion(value) { 19983 { 19984 if (willCoercionThrow(value)) { 19985 error('The provided HTML markup uses a value of unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); 19986 19987 return testStringCoercion(value); // throw (to help callers find troubleshooting comments) 19988 } 19989 } 19990} 19991function checkFormFieldValueStringCoercion(value) { 19992 { 19993 if (willCoercionThrow(value)) { 19994 error('Form field values (value, checked, defaultValue, or defaultChecked props)' + ' must be strings, not %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); 19995 19996 return testStringCoercion(value); // throw (to help callers find troubleshooting comments) 19997 } 19998 } 19999} 20000 20001// A reserved attribute. 20002// It is handled by React separately and shouldn't be written to the DOM. 20003var RESERVED = 0; // A simple string attribute. 20004// Attributes that aren't in the filter are presumed to have this type. 20005 20006var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called 20007// "enumerated" attributes with "true" and "false" as possible values. 20008// When true, it should be set to a "true" string. 20009// When false, it should be set to a "false" string. 20010 20011var BOOLEANISH_STRING = 2; // A real boolean attribute. 20012// When true, it should be present (set either to an empty string or its name). 20013// When false, it should be omitted. 20014 20015var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value. 20016// When true, it should be present (set either to an empty string or its name). 20017// When false, it should be omitted. 20018// For any other value, should be present with that value. 20019 20020var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric. 20021// When falsy, it should be removed. 20022 20023var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric. 20024// When falsy, it should be removed. 20025 20026var POSITIVE_NUMERIC = 6; 20027 20028/* eslint-disable max-len */ 20029var ATTRIBUTE_NAME_START_CHAR = ":A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD"; 20030/* eslint-enable max-len */ 20031 20032var ATTRIBUTE_NAME_CHAR = ATTRIBUTE_NAME_START_CHAR + "\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040"; 20033var VALID_ATTRIBUTE_NAME_REGEX = new RegExp('^[' + ATTRIBUTE_NAME_START_CHAR + '][' + ATTRIBUTE_NAME_CHAR + ']*$'); 20034var illegalAttributeNameCache = {}; 20035var validatedAttributeNameCache = {}; 20036function isAttributeNameSafe(attributeName) { 20037 if (hasOwnProperty.call(validatedAttributeNameCache, attributeName)) { 20038 return true; 20039 } 20040 20041 if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) { 20042 return false; 20043 } 20044 20045 if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName)) { 20046 validatedAttributeNameCache[attributeName] = true; 20047 return true; 20048 } 20049 20050 illegalAttributeNameCache[attributeName] = true; 20051 20052 { 20053 error('Invalid attribute name: `%s`', attributeName); 20054 } 20055 20056 return false; 20057} 20058function shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag) { 20059 if (propertyInfo !== null) { 20060 return propertyInfo.type === RESERVED; 20061 } 20062 20063 if (isCustomComponentTag) { 20064 return false; 20065 } 20066 20067 if (name.length > 2 && (name[0] === 'o' || name[0] === 'O') && (name[1] === 'n' || name[1] === 'N')) { 20068 return true; 20069 } 20070 20071 return false; 20072} 20073function shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag) { 20074 if (propertyInfo !== null && propertyInfo.type === RESERVED) { 20075 return false; 20076 } 20077 20078 switch (typeof value) { 20079 case 'function': // $FlowIssue symbol is perfectly valid here 20080 20081 case 'symbol': 20082 // eslint-disable-line 20083 return true; 20084 20085 case 'boolean': 20086 { 20087 if (isCustomComponentTag) { 20088 return false; 20089 } 20090 20091 if (propertyInfo !== null) { 20092 return !propertyInfo.acceptsBooleans; 20093 } else { 20094 var prefix = name.toLowerCase().slice(0, 5); 20095 return prefix !== 'data-' && prefix !== 'aria-'; 20096 } 20097 } 20098 20099 default: 20100 return false; 20101 } 20102} 20103function shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag) { 20104 if (value === null || typeof value === 'undefined') { 20105 return true; 20106 } 20107 20108 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, isCustomComponentTag)) { 20109 return true; 20110 } 20111 20112 if (isCustomComponentTag) { 20113 20114 return false; 20115 } 20116 20117 if (propertyInfo !== null) { 20118 20119 switch (propertyInfo.type) { 20120 case BOOLEAN: 20121 return !value; 20122 20123 case OVERLOADED_BOOLEAN: 20124 return value === false; 20125 20126 case NUMERIC: 20127 return isNaN(value); 20128 20129 case POSITIVE_NUMERIC: 20130 return isNaN(value) || value < 1; 20131 } 20132 } 20133 20134 return false; 20135} 20136function getPropertyInfo(name) { 20137 return properties.hasOwnProperty(name) ? properties[name] : null; 20138} 20139 20140function PropertyInfoRecord(name, type, mustUseProperty, attributeName, attributeNamespace, sanitizeURL, removeEmptyString) { 20141 this.acceptsBooleans = type === BOOLEANISH_STRING || type === BOOLEAN || type === OVERLOADED_BOOLEAN; 20142 this.attributeName = attributeName; 20143 this.attributeNamespace = attributeNamespace; 20144 this.mustUseProperty = mustUseProperty; 20145 this.propertyName = name; 20146 this.type = type; 20147 this.sanitizeURL = sanitizeURL; 20148 this.removeEmptyString = removeEmptyString; 20149} // When adding attributes to this list, be sure to also add them to 20150// the `possibleStandardNames` module to ensure casing and incorrect 20151// name warnings. 20152 20153 20154var properties = {}; // These props are reserved by React. They shouldn't be written to the DOM. 20155 20156var reservedProps = ['children', 'dangerouslySetInnerHTML', // TODO: This prevents the assignment of defaultValue to regular 20157// elements (not just inputs). Now that ReactDOMInput assigns to the 20158// defaultValue property -- do we need this? 20159'defaultValue', 'defaultChecked', 'innerHTML', 'suppressContentEditableWarning', 'suppressHydrationWarning', 'style']; 20160 20161reservedProps.forEach(function (name) { 20162 properties[name] = new PropertyInfoRecord(name, RESERVED, false, // mustUseProperty 20163 name, // attributeName 20164 null, // attributeNamespace 20165 false, // sanitizeURL 20166 false); 20167}); // A few React string attributes have a different name. 20168// This is a mapping from React prop names to the attribute names. 20169 20170[['acceptCharset', 'accept-charset'], ['className', 'class'], ['htmlFor', 'for'], ['httpEquiv', 'http-equiv']].forEach(function (_ref) { 20171 var name = _ref[0], 20172 attributeName = _ref[1]; 20173 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty 20174 attributeName, // attributeName 20175 null, // attributeNamespace 20176 false, // sanitizeURL 20177 false); 20178}); // These are "enumerated" HTML attributes that accept "true" and "false". 20179// In React, we let users pass `true` and `false` even though technically 20180// these aren't boolean attributes (they are coerced to strings). 20181 20182['contentEditable', 'draggable', 'spellCheck', 'value'].forEach(function (name) { 20183 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty 20184 name.toLowerCase(), // attributeName 20185 null, // attributeNamespace 20186 false, // sanitizeURL 20187 false); 20188}); // These are "enumerated" SVG attributes that accept "true" and "false". 20189// In React, we let users pass `true` and `false` even though technically 20190// these aren't boolean attributes (they are coerced to strings). 20191// Since these are SVG attributes, their attribute names are case-sensitive. 20192 20193['autoReverse', 'externalResourcesRequired', 'focusable', 'preserveAlpha'].forEach(function (name) { 20194 properties[name] = new PropertyInfoRecord(name, BOOLEANISH_STRING, false, // mustUseProperty 20195 name, // attributeName 20196 null, // attributeNamespace 20197 false, // sanitizeURL 20198 false); 20199}); // These are HTML boolean attributes. 20200 20201['allowFullScreen', 'async', // Note: there is a special case that prevents it from being written to the DOM 20202// on the client side because the browsers are inconsistent. Instead we call focus(). 20203'autoFocus', 'autoPlay', 'controls', 'default', 'defer', 'disabled', 'disablePictureInPicture', 'disableRemotePlayback', 'formNoValidate', 'hidden', 'loop', 'noModule', 'noValidate', 'open', 'playsInline', 'readOnly', 'required', 'reversed', 'scoped', 'seamless', // Microdata 20204'itemScope'].forEach(function (name) { 20205 properties[name] = new PropertyInfoRecord(name, BOOLEAN, false, // mustUseProperty 20206 name.toLowerCase(), // attributeName 20207 null, // attributeNamespace 20208 false, // sanitizeURL 20209 false); 20210}); // These are the few React props that we set as DOM properties 20211// rather than attributes. These are all booleans. 20212 20213['checked', // Note: `option.selected` is not updated if `select.multiple` is 20214// disabled with `removeAttribute`. We have special logic for handling this. 20215'multiple', 'muted', 'selected' // NOTE: if you add a camelCased prop to this list, 20216// you'll need to set attributeName to name.toLowerCase() 20217// instead in the assignment below. 20218].forEach(function (name) { 20219 properties[name] = new PropertyInfoRecord(name, BOOLEAN, true, // mustUseProperty 20220 name, // attributeName 20221 null, // attributeNamespace 20222 false, // sanitizeURL 20223 false); 20224}); // These are HTML attributes that are "overloaded booleans": they behave like 20225// booleans, but can also accept a string value. 20226 20227['capture', 'download' // NOTE: if you add a camelCased prop to this list, 20228// you'll need to set attributeName to name.toLowerCase() 20229// instead in the assignment below. 20230].forEach(function (name) { 20231 properties[name] = new PropertyInfoRecord(name, OVERLOADED_BOOLEAN, false, // mustUseProperty 20232 name, // attributeName 20233 null, // attributeNamespace 20234 false, // sanitizeURL 20235 false); 20236}); // These are HTML attributes that must be positive numbers. 20237 20238['cols', 'rows', 'size', 'span' // NOTE: if you add a camelCased prop to this list, 20239// you'll need to set attributeName to name.toLowerCase() 20240// instead in the assignment below. 20241].forEach(function (name) { 20242 properties[name] = new PropertyInfoRecord(name, POSITIVE_NUMERIC, false, // mustUseProperty 20243 name, // attributeName 20244 null, // attributeNamespace 20245 false, // sanitizeURL 20246 false); 20247}); // These are HTML attributes that must be numbers. 20248 20249['rowSpan', 'start'].forEach(function (name) { 20250 properties[name] = new PropertyInfoRecord(name, NUMERIC, false, // mustUseProperty 20251 name.toLowerCase(), // attributeName 20252 null, // attributeNamespace 20253 false, // sanitizeURL 20254 false); 20255}); 20256var CAMELIZE = /[\-\:]([a-z])/g; 20257 20258var capitalize = function (token) { 20259 return token[1].toUpperCase(); 20260}; // This is a list of all SVG attributes that need special casing, namespacing, 20261// or boolean value assignment. Regular attributes that just accept strings 20262// and have the same names are omitted, just like in the HTML attribute filter. 20263// Some of these attributes can be hard to find. This list was created by 20264// scraping the MDN documentation. 20265 20266 20267['accent-height', 'alignment-baseline', 'arabic-form', 'baseline-shift', 'cap-height', 'clip-path', 'clip-rule', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'dominant-baseline', 'enable-background', 'fill-opacity', 'fill-rule', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-name', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'horiz-adv-x', 'horiz-origin-x', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start', 'overline-position', 'overline-thickness', 'paint-order', 'panose-1', 'pointer-events', 'rendering-intent', 'shape-rendering', 'stop-color', 'stop-opacity', 'strikethrough-position', 'strikethrough-thickness', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-decoration', 'text-rendering', 'underline-position', 'underline-thickness', 'unicode-bidi', 'unicode-range', 'units-per-em', 'v-alphabetic', 'v-hanging', 'v-ideographic', 'v-mathematical', 'vector-effect', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'word-spacing', 'writing-mode', 'xmlns:xlink', 'x-height' // NOTE: if you add a camelCased prop to this list, 20268// you'll need to set attributeName to name.toLowerCase() 20269// instead in the assignment below. 20270].forEach(function (attributeName) { 20271 var name = attributeName.replace(CAMELIZE, capitalize); 20272 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty 20273 attributeName, null, // attributeNamespace 20274 false, // sanitizeURL 20275 false); 20276}); // String SVG attributes with the xlink namespace. 20277 20278['xlink:actuate', 'xlink:arcrole', 'xlink:role', 'xlink:show', 'xlink:title', 'xlink:type' // NOTE: if you add a camelCased prop to this list, 20279// you'll need to set attributeName to name.toLowerCase() 20280// instead in the assignment below. 20281].forEach(function (attributeName) { 20282 var name = attributeName.replace(CAMELIZE, capitalize); 20283 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty 20284 attributeName, 'http://www.w3.org/1999/xlink', false, // sanitizeURL 20285 false); 20286}); // String SVG attributes with the xml namespace. 20287 20288['xml:base', 'xml:lang', 'xml:space' // NOTE: if you add a camelCased prop to this list, 20289// you'll need to set attributeName to name.toLowerCase() 20290// instead in the assignment below. 20291].forEach(function (attributeName) { 20292 var name = attributeName.replace(CAMELIZE, capitalize); 20293 properties[name] = new PropertyInfoRecord(name, STRING, false, // mustUseProperty 20294 attributeName, 'http://www.w3.org/XML/1998/namespace', false, // sanitizeURL 20295 false); 20296}); // These attribute exists both in HTML and SVG. 20297// The attribute name is case-sensitive in SVG so we can't just use 20298// the React name like we do for attributes that exist only in HTML. 20299 20300['tabIndex', 'crossOrigin'].forEach(function (attributeName) { 20301 properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty 20302 attributeName.toLowerCase(), // attributeName 20303 null, // attributeNamespace 20304 false, // sanitizeURL 20305 false); 20306}); // These attributes accept URLs. These must not allow javascript: URLS. 20307// These will also need to accept Trusted Types object in the future. 20308 20309var xlinkHref = 'xlinkHref'; 20310properties[xlinkHref] = new PropertyInfoRecord('xlinkHref', STRING, false, // mustUseProperty 20311'xlink:href', 'http://www.w3.org/1999/xlink', true, // sanitizeURL 20312false); 20313['src', 'href', 'action', 'formAction'].forEach(function (attributeName) { 20314 properties[attributeName] = new PropertyInfoRecord(attributeName, STRING, false, // mustUseProperty 20315 attributeName.toLowerCase(), // attributeName 20316 null, // attributeNamespace 20317 true, // sanitizeURL 20318 true); 20319}); 20320 20321// and any newline or tab are filtered out as if they're not part of the URL. 20322// https://url.spec.whatwg.org/#url-parsing 20323// Tab or newline are defined as \r\n\t: 20324// https://infra.spec.whatwg.org/#ascii-tab-or-newline 20325// A C0 control is a code point in the range \u0000 NULL to \u001F 20326// INFORMATION SEPARATOR ONE, inclusive: 20327// https://infra.spec.whatwg.org/#c0-control-or-space 20328 20329/* eslint-disable max-len */ 20330 20331var isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i; 20332var didWarn = false; 20333 20334function sanitizeURL(url) { 20335 { 20336 if (!didWarn && isJavaScriptProtocol.test(url)) { 20337 didWarn = true; 20338 20339 error('A future version of React will block javascript: URLs as a security precaution. ' + 'Use event handlers instead if you can. If you need to generate unsafe HTML try ' + 'using dangerouslySetInnerHTML instead. React was passed %s.', JSON.stringify(url)); 20340 } 20341 } 20342} 20343 20344/** 20345 * Get the value for a property on a node. Only used in DEV for SSR validation. 20346 * The "expected" argument is used as a hint of what the expected value is. 20347 * Some properties have multiple equivalent values. 20348 */ 20349function getValueForProperty(node, name, expected, propertyInfo) { 20350 { 20351 if (propertyInfo.mustUseProperty) { 20352 var propertyName = propertyInfo.propertyName; 20353 return node[propertyName]; 20354 } else { 20355 // This check protects multiple uses of `expected`, which is why the 20356 // react-internal/safe-string-coercion rule is disabled in several spots 20357 // below. 20358 { 20359 checkAttributeStringCoercion(expected, name); 20360 } 20361 20362 if ( propertyInfo.sanitizeURL) { 20363 // If we haven't fully disabled javascript: URLs, and if 20364 // the hydration is successful of a javascript: URL, we 20365 // still want to warn on the client. 20366 // eslint-disable-next-line react-internal/safe-string-coercion 20367 sanitizeURL('' + expected); 20368 } 20369 20370 var attributeName = propertyInfo.attributeName; 20371 var stringValue = null; 20372 20373 if (propertyInfo.type === OVERLOADED_BOOLEAN) { 20374 if (node.hasAttribute(attributeName)) { 20375 var value = node.getAttribute(attributeName); 20376 20377 if (value === '') { 20378 return true; 20379 } 20380 20381 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { 20382 return value; 20383 } // eslint-disable-next-line react-internal/safe-string-coercion 20384 20385 20386 if (value === '' + expected) { 20387 return expected; 20388 } 20389 20390 return value; 20391 } 20392 } else if (node.hasAttribute(attributeName)) { 20393 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { 20394 // We had an attribute but shouldn't have had one, so read it 20395 // for the error message. 20396 return node.getAttribute(attributeName); 20397 } 20398 20399 if (propertyInfo.type === BOOLEAN) { 20400 // If this was a boolean, it doesn't matter what the value is 20401 // the fact that we have it is the same as the expected. 20402 return expected; 20403 } // Even if this property uses a namespace we use getAttribute 20404 // because we assume its namespaced name is the same as our config. 20405 // To use getAttributeNS we need the local name which we don't have 20406 // in our config atm. 20407 20408 20409 stringValue = node.getAttribute(attributeName); 20410 } 20411 20412 if (shouldRemoveAttribute(name, expected, propertyInfo, false)) { 20413 return stringValue === null ? expected : stringValue; // eslint-disable-next-line react-internal/safe-string-coercion 20414 } else if (stringValue === '' + expected) { 20415 return expected; 20416 } else { 20417 return stringValue; 20418 } 20419 } 20420 } 20421} 20422/** 20423 * Get the value for a attribute on a node. Only used in DEV for SSR validation. 20424 * The third argument is used as a hint of what the expected value is. Some 20425 * attributes have multiple equivalent values. 20426 */ 20427 20428function getValueForAttribute(node, name, expected, isCustomComponentTag) { 20429 { 20430 if (!isAttributeNameSafe(name)) { 20431 return; 20432 } 20433 20434 if (!node.hasAttribute(name)) { 20435 return expected === undefined ? undefined : null; 20436 } 20437 20438 var value = node.getAttribute(name); 20439 20440 { 20441 checkAttributeStringCoercion(expected, name); 20442 } 20443 20444 if (value === '' + expected) { 20445 return expected; 20446 } 20447 20448 return value; 20449 } 20450} 20451/** 20452 * Sets the value for a property on a node. 20453 * 20454 * @param {DOMElement} node 20455 * @param {string} name 20456 * @param {*} value 20457 */ 20458 20459function setValueForProperty(node, name, value, isCustomComponentTag) { 20460 var propertyInfo = getPropertyInfo(name); 20461 20462 if (shouldIgnoreAttribute(name, propertyInfo, isCustomComponentTag)) { 20463 return; 20464 } 20465 20466 if (shouldRemoveAttribute(name, value, propertyInfo, isCustomComponentTag)) { 20467 value = null; 20468 } 20469 20470 20471 if (isCustomComponentTag || propertyInfo === null) { 20472 if (isAttributeNameSafe(name)) { 20473 var _attributeName = name; 20474 20475 if (value === null) { 20476 node.removeAttribute(_attributeName); 20477 } else { 20478 { 20479 checkAttributeStringCoercion(value, name); 20480 } 20481 20482 node.setAttribute(_attributeName, '' + value); 20483 } 20484 } 20485 20486 return; 20487 } 20488 20489 var mustUseProperty = propertyInfo.mustUseProperty; 20490 20491 if (mustUseProperty) { 20492 var propertyName = propertyInfo.propertyName; 20493 20494 if (value === null) { 20495 var type = propertyInfo.type; 20496 node[propertyName] = type === BOOLEAN ? false : ''; 20497 } else { 20498 // Contrary to `setAttribute`, object properties are properly 20499 // `toString`ed by IE8/9. 20500 node[propertyName] = value; 20501 } 20502 20503 return; 20504 } // The rest are treated as attributes with special cases. 20505 20506 20507 var attributeName = propertyInfo.attributeName, 20508 attributeNamespace = propertyInfo.attributeNamespace; 20509 20510 if (value === null) { 20511 node.removeAttribute(attributeName); 20512 } else { 20513 var _type = propertyInfo.type; 20514 var attributeValue; 20515 20516 if (_type === BOOLEAN || _type === OVERLOADED_BOOLEAN && value === true) { 20517 // If attribute type is boolean, we know for sure it won't be an execution sink 20518 // and we won't require Trusted Type here. 20519 attributeValue = ''; 20520 } else { 20521 // `setAttribute` with objects becomes only `[object]` in IE8/9, 20522 // ('' + value) makes it output the correct toString()-value. 20523 { 20524 { 20525 checkAttributeStringCoercion(value, attributeName); 20526 } 20527 20528 attributeValue = '' + value; 20529 } 20530 20531 if (propertyInfo.sanitizeURL) { 20532 sanitizeURL(attributeValue.toString()); 20533 } 20534 } 20535 20536 if (attributeNamespace) { 20537 node.setAttributeNS(attributeNamespace, attributeName, attributeValue); 20538 } else { 20539 node.setAttribute(attributeName, attributeValue); 20540 } 20541 } 20542} 20543 20544// ATTENTION 20545// When adding new symbols to this file, 20546// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' 20547// The Symbol used to tag the ReactElement-like types. 20548var REACT_ELEMENT_TYPE = Symbol.for('react.element'); 20549var REACT_PORTAL_TYPE = Symbol.for('react.portal'); 20550var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); 20551var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); 20552var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); 20553var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); 20554var REACT_CONTEXT_TYPE = Symbol.for('react.context'); 20555var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); 20556var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); 20557var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); 20558var REACT_MEMO_TYPE = Symbol.for('react.memo'); 20559var REACT_LAZY_TYPE = Symbol.for('react.lazy'); 20560var REACT_SCOPE_TYPE = Symbol.for('react.scope'); 20561var REACT_DEBUG_TRACING_MODE_TYPE = Symbol.for('react.debug_trace_mode'); 20562var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); 20563var REACT_LEGACY_HIDDEN_TYPE = Symbol.for('react.legacy_hidden'); 20564var REACT_CACHE_TYPE = Symbol.for('react.cache'); 20565var REACT_TRACING_MARKER_TYPE = Symbol.for('react.tracing_marker'); 20566var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; 20567var FAUX_ITERATOR_SYMBOL = '@@iterator'; 20568function getIteratorFn(maybeIterable) { 20569 if (maybeIterable === null || typeof maybeIterable !== 'object') { 20570 return null; 20571 } 20572 20573 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; 20574 20575 if (typeof maybeIterator === 'function') { 20576 return maybeIterator; 20577 } 20578 20579 return null; 20580} 20581 20582var assign = Object.assign; 20583 20584// Helpers to patch console.logs to avoid logging during side-effect free 20585// replaying on render function. This currently only patches the object 20586// lazily which won't cover if the log function was extracted eagerly. 20587// We could also eagerly patch the method. 20588var disabledDepth = 0; 20589var prevLog; 20590var prevInfo; 20591var prevWarn; 20592var prevError; 20593var prevGroup; 20594var prevGroupCollapsed; 20595var prevGroupEnd; 20596 20597function disabledLog() {} 20598 20599disabledLog.__reactDisabledLog = true; 20600function disableLogs() { 20601 { 20602 if (disabledDepth === 0) { 20603 /* eslint-disable react-internal/no-production-logging */ 20604 prevLog = console.log; 20605 prevInfo = console.info; 20606 prevWarn = console.warn; 20607 prevError = console.error; 20608 prevGroup = console.group; 20609 prevGroupCollapsed = console.groupCollapsed; 20610 prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 20611 20612 var props = { 20613 configurable: true, 20614 enumerable: true, 20615 value: disabledLog, 20616 writable: true 20617 }; // $FlowFixMe Flow thinks console is immutable. 20618 20619 Object.defineProperties(console, { 20620 info: props, 20621 log: props, 20622 warn: props, 20623 error: props, 20624 group: props, 20625 groupCollapsed: props, 20626 groupEnd: props 20627 }); 20628 /* eslint-enable react-internal/no-production-logging */ 20629 } 20630 20631 disabledDepth++; 20632 } 20633} 20634function reenableLogs() { 20635 { 20636 disabledDepth--; 20637 20638 if (disabledDepth === 0) { 20639 /* eslint-disable react-internal/no-production-logging */ 20640 var props = { 20641 configurable: true, 20642 enumerable: true, 20643 writable: true 20644 }; // $FlowFixMe Flow thinks console is immutable. 20645 20646 Object.defineProperties(console, { 20647 log: assign({}, props, { 20648 value: prevLog 20649 }), 20650 info: assign({}, props, { 20651 value: prevInfo 20652 }), 20653 warn: assign({}, props, { 20654 value: prevWarn 20655 }), 20656 error: assign({}, props, { 20657 value: prevError 20658 }), 20659 group: assign({}, props, { 20660 value: prevGroup 20661 }), 20662 groupCollapsed: assign({}, props, { 20663 value: prevGroupCollapsed 20664 }), 20665 groupEnd: assign({}, props, { 20666 value: prevGroupEnd 20667 }) 20668 }); 20669 /* eslint-enable react-internal/no-production-logging */ 20670 } 20671 20672 if (disabledDepth < 0) { 20673 error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); 20674 } 20675 } 20676} 20677 20678var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; 20679var prefix; 20680function describeBuiltInComponentFrame(name, source, ownerFn) { 20681 { 20682 if (prefix === undefined) { 20683 // Extract the VM specific prefix used by each line. 20684 try { 20685 throw Error(); 20686 } catch (x) { 20687 var match = x.stack.trim().match(/\n( *(at )?)/); 20688 prefix = match && match[1] || ''; 20689 } 20690 } // We use the prefix to ensure our stacks line up with native stack frames. 20691 20692 20693 return '\n' + prefix + name; 20694 } 20695} 20696var reentry = false; 20697var componentFrameCache; 20698 20699{ 20700 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; 20701 componentFrameCache = new PossiblyWeakMap(); 20702} 20703 20704function describeNativeComponentFrame(fn, construct) { 20705 // If something asked for a stack inside a fake render, it should get ignored. 20706 if ( !fn || reentry) { 20707 return ''; 20708 } 20709 20710 { 20711 var frame = componentFrameCache.get(fn); 20712 20713 if (frame !== undefined) { 20714 return frame; 20715 } 20716 } 20717 20718 var control; 20719 reentry = true; 20720 var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. 20721 20722 Error.prepareStackTrace = undefined; 20723 var previousDispatcher; 20724 20725 { 20726 previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function 20727 // for warnings. 20728 20729 ReactCurrentDispatcher.current = null; 20730 disableLogs(); 20731 } 20732 20733 try { 20734 // This should throw. 20735 if (construct) { 20736 // Something should be setting the props in the constructor. 20737 var Fake = function () { 20738 throw Error(); 20739 }; // $FlowFixMe 20740 20741 20742 Object.defineProperty(Fake.prototype, 'props', { 20743 set: function () { 20744 // We use a throwing setter instead of frozen or non-writable props 20745 // because that won't throw in a non-strict mode function. 20746 throw Error(); 20747 } 20748 }); 20749 20750 if (typeof Reflect === 'object' && Reflect.construct) { 20751 // We construct a different control for this case to include any extra 20752 // frames added by the construct call. 20753 try { 20754 Reflect.construct(Fake, []); 20755 } catch (x) { 20756 control = x; 20757 } 20758 20759 Reflect.construct(fn, [], Fake); 20760 } else { 20761 try { 20762 Fake.call(); 20763 } catch (x) { 20764 control = x; 20765 } 20766 20767 fn.call(Fake.prototype); 20768 } 20769 } else { 20770 try { 20771 throw Error(); 20772 } catch (x) { 20773 control = x; 20774 } 20775 20776 fn(); 20777 } 20778 } catch (sample) { 20779 // This is inlined manually because closure doesn't do it for us. 20780 if (sample && control && typeof sample.stack === 'string') { 20781 // This extracts the first frame from the sample that isn't also in the control. 20782 // Skipping one frame that we assume is the frame that calls the two. 20783 var sampleLines = sample.stack.split('\n'); 20784 var controlLines = control.stack.split('\n'); 20785 var s = sampleLines.length - 1; 20786 var c = controlLines.length - 1; 20787 20788 while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { 20789 // We expect at least one stack frame to be shared. 20790 // Typically this will be the root most one. However, stack frames may be 20791 // cut off due to maximum stack limits. In this case, one maybe cut off 20792 // earlier than the other. We assume that the sample is longer or the same 20793 // and there for cut off earlier. So we should find the root most frame in 20794 // the sample somewhere in the control. 20795 c--; 20796 } 20797 20798 for (; s >= 1 && c >= 0; s--, c--) { 20799 // Next we find the first one that isn't the same which should be the 20800 // frame that called our sample function and the control. 20801 if (sampleLines[s] !== controlLines[c]) { 20802 // In V8, the first line is describing the message but other VMs don't. 20803 // If we're about to return the first line, and the control is also on the same 20804 // line, that's a pretty good indicator that our sample threw at same line as 20805 // the control. I.e. before we entered the sample frame. So we ignore this result. 20806 // This can happen if you passed a class to function component, or non-function. 20807 if (s !== 1 || c !== 1) { 20808 do { 20809 s--; 20810 c--; // We may still have similar intermediate frames from the construct call. 20811 // The next one that isn't the same should be our match though. 20812 20813 if (c < 0 || sampleLines[s] !== controlLines[c]) { 20814 // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. 20815 var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>" 20816 // but we have a user-provided "displayName" 20817 // splice it in to make the stack more readable. 20818 20819 20820 if (fn.displayName && _frame.includes('<anonymous>')) { 20821 _frame = _frame.replace('<anonymous>', fn.displayName); 20822 } 20823 20824 { 20825 if (typeof fn === 'function') { 20826 componentFrameCache.set(fn, _frame); 20827 } 20828 } // Return the line we found. 20829 20830 20831 return _frame; 20832 } 20833 } while (s >= 1 && c >= 0); 20834 } 20835 20836 break; 20837 } 20838 } 20839 } 20840 } finally { 20841 reentry = false; 20842 20843 { 20844 ReactCurrentDispatcher.current = previousDispatcher; 20845 reenableLogs(); 20846 } 20847 20848 Error.prepareStackTrace = previousPrepareStackTrace; 20849 } // Fallback to just using the name if we couldn't make it throw. 20850 20851 20852 var name = fn ? fn.displayName || fn.name : ''; 20853 var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; 20854 20855 { 20856 if (typeof fn === 'function') { 20857 componentFrameCache.set(fn, syntheticFrame); 20858 } 20859 } 20860 20861 return syntheticFrame; 20862} 20863 20864function describeClassComponentFrame(ctor, source, ownerFn) { 20865 { 20866 return describeNativeComponentFrame(ctor, true); 20867 } 20868} 20869function describeFunctionComponentFrame(fn, source, ownerFn) { 20870 { 20871 return describeNativeComponentFrame(fn, false); 20872 } 20873} 20874 20875function shouldConstruct(Component) { 20876 var prototype = Component.prototype; 20877 return !!(prototype && prototype.isReactComponent); 20878} 20879 20880function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { 20881 20882 if (type == null) { 20883 return ''; 20884 } 20885 20886 if (typeof type === 'function') { 20887 { 20888 return describeNativeComponentFrame(type, shouldConstruct(type)); 20889 } 20890 } 20891 20892 if (typeof type === 'string') { 20893 return describeBuiltInComponentFrame(type); 20894 } 20895 20896 switch (type) { 20897 case REACT_SUSPENSE_TYPE: 20898 return describeBuiltInComponentFrame('Suspense'); 20899 20900 case REACT_SUSPENSE_LIST_TYPE: 20901 return describeBuiltInComponentFrame('SuspenseList'); 20902 } 20903 20904 if (typeof type === 'object') { 20905 switch (type.$$typeof) { 20906 case REACT_FORWARD_REF_TYPE: 20907 return describeFunctionComponentFrame(type.render); 20908 20909 case REACT_MEMO_TYPE: 20910 // Memo may contain any component type so we recursively resolve it. 20911 return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); 20912 20913 case REACT_LAZY_TYPE: 20914 { 20915 var lazyComponent = type; 20916 var payload = lazyComponent._payload; 20917 var init = lazyComponent._init; 20918 20919 try { 20920 // Lazy may contain any component type so we recursively resolve it. 20921 return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); 20922 } catch (x) {} 20923 } 20924 } 20925 } 20926 20927 return ''; 20928} 20929 20930function describeFiber(fiber) { 20931 var owner = fiber._debugOwner ? fiber._debugOwner.type : null ; 20932 var source = fiber._debugSource ; 20933 20934 switch (fiber.tag) { 20935 case HostComponent: 20936 return describeBuiltInComponentFrame(fiber.type); 20937 20938 case LazyComponent: 20939 return describeBuiltInComponentFrame('Lazy'); 20940 20941 case SuspenseComponent: 20942 return describeBuiltInComponentFrame('Suspense'); 20943 20944 case SuspenseListComponent: 20945 return describeBuiltInComponentFrame('SuspenseList'); 20946 20947 case FunctionComponent: 20948 case IndeterminateComponent: 20949 case SimpleMemoComponent: 20950 return describeFunctionComponentFrame(fiber.type); 20951 20952 case ForwardRef: 20953 return describeFunctionComponentFrame(fiber.type.render); 20954 20955 case ClassComponent: 20956 return describeClassComponentFrame(fiber.type); 20957 20958 default: 20959 return ''; 20960 } 20961} 20962 20963function getStackByFiberInDevAndProd(workInProgress) { 20964 try { 20965 var info = ''; 20966 var node = workInProgress; 20967 20968 do { 20969 info += describeFiber(node); 20970 node = node.return; 20971 } while (node); 20972 20973 return info; 20974 } catch (x) { 20975 return '\nError generating stack: ' + x.message + '\n' + x.stack; 20976 } 20977} 20978 20979function getWrappedName(outerType, innerType, wrapperName) { 20980 var displayName = outerType.displayName; 20981 20982 if (displayName) { 20983 return displayName; 20984 } 20985 20986 var functionName = innerType.displayName || innerType.name || ''; 20987 return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; 20988} // Keep in sync with react-reconciler/getComponentNameFromFiber 20989 20990 20991function getContextName(type) { 20992 return type.displayName || 'Context'; 20993} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. 20994 20995 20996function getComponentNameFromType(type) { 20997 if (type == null) { 20998 // Host root, text node or just invalid type. 20999 return null; 21000 } 21001 21002 { 21003 if (typeof type.tag === 'number') { 21004 error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); 21005 } 21006 } 21007 21008 if (typeof type === 'function') { 21009 return type.displayName || type.name || null; 21010 } 21011 21012 if (typeof type === 'string') { 21013 return type; 21014 } 21015 21016 switch (type) { 21017 case REACT_FRAGMENT_TYPE: 21018 return 'Fragment'; 21019 21020 case REACT_PORTAL_TYPE: 21021 return 'Portal'; 21022 21023 case REACT_PROFILER_TYPE: 21024 return 'Profiler'; 21025 21026 case REACT_STRICT_MODE_TYPE: 21027 return 'StrictMode'; 21028 21029 case REACT_SUSPENSE_TYPE: 21030 return 'Suspense'; 21031 21032 case REACT_SUSPENSE_LIST_TYPE: 21033 return 'SuspenseList'; 21034 21035 } 21036 21037 if (typeof type === 'object') { 21038 switch (type.$$typeof) { 21039 case REACT_CONTEXT_TYPE: 21040 var context = type; 21041 return getContextName(context) + '.Consumer'; 21042 21043 case REACT_PROVIDER_TYPE: 21044 var provider = type; 21045 return getContextName(provider._context) + '.Provider'; 21046 21047 case REACT_FORWARD_REF_TYPE: 21048 return getWrappedName(type, type.render, 'ForwardRef'); 21049 21050 case REACT_MEMO_TYPE: 21051 var outerName = type.displayName || null; 21052 21053 if (outerName !== null) { 21054 return outerName; 21055 } 21056 21057 return getComponentNameFromType(type.type) || 'Memo'; 21058 21059 case REACT_LAZY_TYPE: 21060 { 21061 var lazyComponent = type; 21062 var payload = lazyComponent._payload; 21063 var init = lazyComponent._init; 21064 21065 try { 21066 return getComponentNameFromType(init(payload)); 21067 } catch (x) { 21068 return null; 21069 } 21070 } 21071 21072 // eslint-disable-next-line no-fallthrough 21073 } 21074 } 21075 21076 return null; 21077} 21078 21079function getWrappedName$1(outerType, innerType, wrapperName) { 21080 var functionName = innerType.displayName || innerType.name || ''; 21081 return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName); 21082} // Keep in sync with shared/getComponentNameFromType 21083 21084 21085function getContextName$1(type) { 21086 return type.displayName || 'Context'; 21087} 21088 21089function getComponentNameFromFiber(fiber) { 21090 var tag = fiber.tag, 21091 type = fiber.type; 21092 21093 switch (tag) { 21094 case CacheComponent: 21095 return 'Cache'; 21096 21097 case ContextConsumer: 21098 var context = type; 21099 return getContextName$1(context) + '.Consumer'; 21100 21101 case ContextProvider: 21102 var provider = type; 21103 return getContextName$1(provider._context) + '.Provider'; 21104 21105 case DehydratedFragment: 21106 return 'DehydratedFragment'; 21107 21108 case ForwardRef: 21109 return getWrappedName$1(type, type.render, 'ForwardRef'); 21110 21111 case Fragment: 21112 return 'Fragment'; 21113 21114 case HostComponent: 21115 // Host component type is the display name (e.g. "div", "View") 21116 return type; 21117 21118 case HostPortal: 21119 return 'Portal'; 21120 21121 case HostRoot: 21122 return 'Root'; 21123 21124 case HostText: 21125 return 'Text'; 21126 21127 case LazyComponent: 21128 // Name comes from the type in this case; we don't have a tag. 21129 return getComponentNameFromType(type); 21130 21131 case Mode: 21132 if (type === REACT_STRICT_MODE_TYPE) { 21133 // Don't be less specific than shared/getComponentNameFromType 21134 return 'StrictMode'; 21135 } 21136 21137 return 'Mode'; 21138 21139 case OffscreenComponent: 21140 return 'Offscreen'; 21141 21142 case Profiler: 21143 return 'Profiler'; 21144 21145 case ScopeComponent: 21146 return 'Scope'; 21147 21148 case SuspenseComponent: 21149 return 'Suspense'; 21150 21151 case SuspenseListComponent: 21152 return 'SuspenseList'; 21153 21154 case TracingMarkerComponent: 21155 return 'TracingMarker'; 21156 // The display name for this tags come from the user-provided type: 21157 21158 case ClassComponent: 21159 case FunctionComponent: 21160 case IncompleteClassComponent: 21161 case IndeterminateComponent: 21162 case MemoComponent: 21163 case SimpleMemoComponent: 21164 if (typeof type === 'function') { 21165 return type.displayName || type.name || null; 21166 } 21167 21168 if (typeof type === 'string') { 21169 return type; 21170 } 21171 21172 break; 21173 21174 } 21175 21176 return null; 21177} 21178 21179var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; 21180var current = null; 21181var isRendering = false; 21182function getCurrentFiberOwnerNameInDevOrNull() { 21183 { 21184 if (current === null) { 21185 return null; 21186 } 21187 21188 var owner = current._debugOwner; 21189 21190 if (owner !== null && typeof owner !== 'undefined') { 21191 return getComponentNameFromFiber(owner); 21192 } 21193 } 21194 21195 return null; 21196} 21197 21198function getCurrentFiberStackInDev() { 21199 { 21200 if (current === null) { 21201 return ''; 21202 } // Safe because if current fiber exists, we are reconciling, 21203 // and it is guaranteed to be the work-in-progress version. 21204 21205 21206 return getStackByFiberInDevAndProd(current); 21207 } 21208} 21209 21210function resetCurrentFiber() { 21211 { 21212 ReactDebugCurrentFrame.getCurrentStack = null; 21213 current = null; 21214 isRendering = false; 21215 } 21216} 21217function setCurrentFiber(fiber) { 21218 { 21219 ReactDebugCurrentFrame.getCurrentStack = fiber === null ? null : getCurrentFiberStackInDev; 21220 current = fiber; 21221 isRendering = false; 21222 } 21223} 21224function getCurrentFiber() { 21225 { 21226 return current; 21227 } 21228} 21229function setIsRendering(rendering) { 21230 { 21231 isRendering = rendering; 21232 } 21233} 21234 21235// Flow does not allow string concatenation of most non-string types. To work 21236// around this limitation, we use an opaque type that can only be obtained by 21237// passing the value through getToStringValue first. 21238function toString(value) { 21239 // The coercion safety check is performed in getToStringValue(). 21240 // eslint-disable-next-line react-internal/safe-string-coercion 21241 return '' + value; 21242} 21243function getToStringValue(value) { 21244 switch (typeof value) { 21245 case 'boolean': 21246 case 'number': 21247 case 'string': 21248 case 'undefined': 21249 return value; 21250 21251 case 'object': 21252 { 21253 checkFormFieldValueStringCoercion(value); 21254 } 21255 21256 return value; 21257 21258 default: 21259 // function, symbol are assigned as empty strings 21260 return ''; 21261 } 21262} 21263 21264var hasReadOnlyValue = { 21265 button: true, 21266 checkbox: true, 21267 image: true, 21268 hidden: true, 21269 radio: true, 21270 reset: true, 21271 submit: true 21272}; 21273function checkControlledValueProps(tagName, props) { 21274 { 21275 if (!(hasReadOnlyValue[props.type] || props.onChange || props.onInput || props.readOnly || props.disabled || props.value == null)) { 21276 error('You provided a `value` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultValue`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); 21277 } 21278 21279 if (!(props.onChange || props.readOnly || props.disabled || props.checked == null)) { 21280 error('You provided a `checked` prop to a form field without an ' + '`onChange` handler. This will render a read-only field. If ' + 'the field should be mutable use `defaultChecked`. Otherwise, ' + 'set either `onChange` or `readOnly`.'); 21281 } 21282 } 21283} 21284 21285function isCheckable(elem) { 21286 var type = elem.type; 21287 var nodeName = elem.nodeName; 21288 return nodeName && nodeName.toLowerCase() === 'input' && (type === 'checkbox' || type === 'radio'); 21289} 21290 21291function getTracker(node) { 21292 return node._valueTracker; 21293} 21294 21295function detachTracker(node) { 21296 node._valueTracker = null; 21297} 21298 21299function getValueFromNode(node) { 21300 var value = ''; 21301 21302 if (!node) { 21303 return value; 21304 } 21305 21306 if (isCheckable(node)) { 21307 value = node.checked ? 'true' : 'false'; 21308 } else { 21309 value = node.value; 21310 } 21311 21312 return value; 21313} 21314 21315function trackValueOnNode(node) { 21316 var valueField = isCheckable(node) ? 'checked' : 'value'; 21317 var descriptor = Object.getOwnPropertyDescriptor(node.constructor.prototype, valueField); 21318 21319 { 21320 checkFormFieldValueStringCoercion(node[valueField]); 21321 } 21322 21323 var currentValue = '' + node[valueField]; // if someone has already defined a value or Safari, then bail 21324 // and don't track value will cause over reporting of changes, 21325 // but it's better then a hard failure 21326 // (needed for certain tests that spyOn input values and Safari) 21327 21328 if (node.hasOwnProperty(valueField) || typeof descriptor === 'undefined' || typeof descriptor.get !== 'function' || typeof descriptor.set !== 'function') { 21329 return; 21330 } 21331 21332 var get = descriptor.get, 21333 set = descriptor.set; 21334 Object.defineProperty(node, valueField, { 21335 configurable: true, 21336 get: function () { 21337 return get.call(this); 21338 }, 21339 set: function (value) { 21340 { 21341 checkFormFieldValueStringCoercion(value); 21342 } 21343 21344 currentValue = '' + value; 21345 set.call(this, value); 21346 } 21347 }); // We could've passed this the first time 21348 // but it triggers a bug in IE11 and Edge 14/15. 21349 // Calling defineProperty() again should be equivalent. 21350 // https://github.com/facebook/react/issues/11768 21351 21352 Object.defineProperty(node, valueField, { 21353 enumerable: descriptor.enumerable 21354 }); 21355 var tracker = { 21356 getValue: function () { 21357 return currentValue; 21358 }, 21359 setValue: function (value) { 21360 { 21361 checkFormFieldValueStringCoercion(value); 21362 } 21363 21364 currentValue = '' + value; 21365 }, 21366 stopTracking: function () { 21367 detachTracker(node); 21368 delete node[valueField]; 21369 } 21370 }; 21371 return tracker; 21372} 21373 21374function track(node) { 21375 if (getTracker(node)) { 21376 return; 21377 } // TODO: Once it's just Fiber we can move this to node._wrapperState 21378 21379 21380 node._valueTracker = trackValueOnNode(node); 21381} 21382function updateValueIfChanged(node) { 21383 if (!node) { 21384 return false; 21385 } 21386 21387 var tracker = getTracker(node); // if there is no tracker at this point it's unlikely 21388 // that trying again will succeed 21389 21390 if (!tracker) { 21391 return true; 21392 } 21393 21394 var lastValue = tracker.getValue(); 21395 var nextValue = getValueFromNode(node); 21396 21397 if (nextValue !== lastValue) { 21398 tracker.setValue(nextValue); 21399 return true; 21400 } 21401 21402 return false; 21403} 21404 21405function getActiveElement(doc) { 21406 doc = doc || (typeof document !== 'undefined' ? document : undefined); 21407 21408 if (typeof doc === 'undefined') { 21409 return null; 21410 } 21411 21412 try { 21413 return doc.activeElement || doc.body; 21414 } catch (e) { 21415 return doc.body; 21416 } 21417} 21418 21419var didWarnValueDefaultValue = false; 21420var didWarnCheckedDefaultChecked = false; 21421var didWarnControlledToUncontrolled = false; 21422var didWarnUncontrolledToControlled = false; 21423 21424function isControlled(props) { 21425 var usesChecked = props.type === 'checkbox' || props.type === 'radio'; 21426 return usesChecked ? props.checked != null : props.value != null; 21427} 21428/** 21429 * Implements an <input> host component that allows setting these optional 21430 * props: `checked`, `value`, `defaultChecked`, and `defaultValue`. 21431 * 21432 * If `checked` or `value` are not supplied (or null/undefined), user actions 21433 * that affect the checked state or value will trigger updates to the element. 21434 * 21435 * If they are supplied (and not null/undefined), the rendered element will not 21436 * trigger updates to the element. Instead, the props must change in order for 21437 * the rendered element to be updated. 21438 * 21439 * The rendered element will be initialized as unchecked (or `defaultChecked`) 21440 * with an empty value (or `defaultValue`). 21441 * 21442 * See http://www.w3.org/TR/2012/WD-html5-20121025/the-input-element.html 21443 */ 21444 21445 21446function getHostProps(element, props) { 21447 var node = element; 21448 var checked = props.checked; 21449 var hostProps = assign({}, props, { 21450 defaultChecked: undefined, 21451 defaultValue: undefined, 21452 value: undefined, 21453 checked: checked != null ? checked : node._wrapperState.initialChecked 21454 }); 21455 return hostProps; 21456} 21457function initWrapperState(element, props) { 21458 { 21459 checkControlledValueProps('input', props); 21460 21461 if (props.checked !== undefined && props.defaultChecked !== undefined && !didWarnCheckedDefaultChecked) { 21462 error('%s contains an input of type %s with both checked and defaultChecked props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the checked prop, or the defaultChecked prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); 21463 21464 didWarnCheckedDefaultChecked = true; 21465 } 21466 21467 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue) { 21468 error('%s contains an input of type %s with both value and defaultValue props. ' + 'Input elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled input ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component', props.type); 21469 21470 didWarnValueDefaultValue = true; 21471 } 21472 } 21473 21474 var node = element; 21475 var defaultValue = props.defaultValue == null ? '' : props.defaultValue; 21476 node._wrapperState = { 21477 initialChecked: props.checked != null ? props.checked : props.defaultChecked, 21478 initialValue: getToStringValue(props.value != null ? props.value : defaultValue), 21479 controlled: isControlled(props) 21480 }; 21481} 21482function updateChecked(element, props) { 21483 var node = element; 21484 var checked = props.checked; 21485 21486 if (checked != null) { 21487 setValueForProperty(node, 'checked', checked, false); 21488 } 21489} 21490function updateWrapper(element, props) { 21491 var node = element; 21492 21493 { 21494 var controlled = isControlled(props); 21495 21496 if (!node._wrapperState.controlled && controlled && !didWarnUncontrolledToControlled) { 21497 error('A component is changing an uncontrolled input to be controlled. ' + 'This is likely caused by the value changing from undefined to ' + 'a defined value, which should not happen. ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components'); 21498 21499 didWarnUncontrolledToControlled = true; 21500 } 21501 21502 if (node._wrapperState.controlled && !controlled && !didWarnControlledToUncontrolled) { 21503 error('A component is changing a controlled input to be uncontrolled. ' + 'This is likely caused by the value changing from a defined to ' + 'undefined, which should not happen. ' + 'Decide between using a controlled or uncontrolled input ' + 'element for the lifetime of the component. More info: https://reactjs.org/link/controlled-components'); 21504 21505 didWarnControlledToUncontrolled = true; 21506 } 21507 } 21508 21509 updateChecked(element, props); 21510 var value = getToStringValue(props.value); 21511 var type = props.type; 21512 21513 if (value != null) { 21514 if (type === 'number') { 21515 if (value === 0 && node.value === '' || // We explicitly want to coerce to number here if possible. 21516 // eslint-disable-next-line 21517 node.value != value) { 21518 node.value = toString(value); 21519 } 21520 } else if (node.value !== toString(value)) { 21521 node.value = toString(value); 21522 } 21523 } else if (type === 'submit' || type === 'reset') { 21524 // Submit/reset inputs need the attribute removed completely to avoid 21525 // blank-text buttons. 21526 node.removeAttribute('value'); 21527 return; 21528 } 21529 21530 { 21531 // When syncing the value attribute, the value comes from a cascade of 21532 // properties: 21533 // 1. The value React property 21534 // 2. The defaultValue React property 21535 // 3. Otherwise there should be no change 21536 if (props.hasOwnProperty('value')) { 21537 setDefaultValue(node, props.type, value); 21538 } else if (props.hasOwnProperty('defaultValue')) { 21539 setDefaultValue(node, props.type, getToStringValue(props.defaultValue)); 21540 } 21541 } 21542 21543 { 21544 // When syncing the checked attribute, it only changes when it needs 21545 // to be removed, such as transitioning from a checkbox into a text input 21546 if (props.checked == null && props.defaultChecked != null) { 21547 node.defaultChecked = !!props.defaultChecked; 21548 } 21549 } 21550} 21551function postMountWrapper(element, props, isHydrating) { 21552 var node = element; // Do not assign value if it is already set. This prevents user text input 21553 // from being lost during SSR hydration. 21554 21555 if (props.hasOwnProperty('value') || props.hasOwnProperty('defaultValue')) { 21556 var type = props.type; 21557 var isButton = type === 'submit' || type === 'reset'; // Avoid setting value attribute on submit/reset inputs as it overrides the 21558 // default value provided by the browser. See: #12872 21559 21560 if (isButton && (props.value === undefined || props.value === null)) { 21561 return; 21562 } 21563 21564 var initialValue = toString(node._wrapperState.initialValue); // Do not assign value if it is already set. This prevents user text input 21565 // from being lost during SSR hydration. 21566 21567 if (!isHydrating) { 21568 { 21569 // When syncing the value attribute, the value property should use 21570 // the wrapperState._initialValue property. This uses: 21571 // 21572 // 1. The value React property when present 21573 // 2. The defaultValue React property when present 21574 // 3. An empty string 21575 if (initialValue !== node.value) { 21576 node.value = initialValue; 21577 } 21578 } 21579 } 21580 21581 { 21582 // Otherwise, the value attribute is synchronized to the property, 21583 // so we assign defaultValue to the same thing as the value property 21584 // assignment step above. 21585 node.defaultValue = initialValue; 21586 } 21587 } // Normally, we'd just do `node.checked = node.checked` upon initial mount, less this bug 21588 // this is needed to work around a chrome bug where setting defaultChecked 21589 // will sometimes influence the value of checked (even after detachment). 21590 // Reference: https://bugs.chromium.org/p/chromium/issues/detail?id=608416 21591 // We need to temporarily unset name to avoid disrupting radio button groups. 21592 21593 21594 var name = node.name; 21595 21596 if (name !== '') { 21597 node.name = ''; 21598 } 21599 21600 { 21601 // When syncing the checked attribute, both the checked property and 21602 // attribute are assigned at the same time using defaultChecked. This uses: 21603 // 21604 // 1. The checked React property when present 21605 // 2. The defaultChecked React property when present 21606 // 3. Otherwise, false 21607 node.defaultChecked = !node.defaultChecked; 21608 node.defaultChecked = !!node._wrapperState.initialChecked; 21609 } 21610 21611 if (name !== '') { 21612 node.name = name; 21613 } 21614} 21615function restoreControlledState(element, props) { 21616 var node = element; 21617 updateWrapper(node, props); 21618 updateNamedCousins(node, props); 21619} 21620 21621function updateNamedCousins(rootNode, props) { 21622 var name = props.name; 21623 21624 if (props.type === 'radio' && name != null) { 21625 var queryRoot = rootNode; 21626 21627 while (queryRoot.parentNode) { 21628 queryRoot = queryRoot.parentNode; 21629 } // If `rootNode.form` was non-null, then we could try `form.elements`, 21630 // but that sometimes behaves strangely in IE8. We could also try using 21631 // `form.getElementsByName`, but that will only return direct children 21632 // and won't include inputs that use the HTML5 `form=` attribute. Since 21633 // the input might not even be in a form. It might not even be in the 21634 // document. Let's just use the local `querySelectorAll` to ensure we don't 21635 // miss anything. 21636 21637 21638 { 21639 checkAttributeStringCoercion(name, 'name'); 21640 } 21641 21642 var group = queryRoot.querySelectorAll('input[name=' + JSON.stringify('' + name) + '][type="radio"]'); 21643 21644 for (var i = 0; i < group.length; i++) { 21645 var otherNode = group[i]; 21646 21647 if (otherNode === rootNode || otherNode.form !== rootNode.form) { 21648 continue; 21649 } // This will throw if radio buttons rendered by different copies of React 21650 // and the same name are rendered into the same form (same as #1939). 21651 // That's probably okay; we don't support it just as we don't support 21652 // mixing React radio buttons with non-React ones. 21653 21654 21655 var otherProps = getFiberCurrentPropsFromNode(otherNode); 21656 21657 if (!otherProps) { 21658 throw new Error('ReactDOMInput: Mixing React and non-React radio inputs with the ' + 'same `name` is not supported.'); 21659 } // We need update the tracked value on the named cousin since the value 21660 // was changed but the input saw no event or value set 21661 21662 21663 updateValueIfChanged(otherNode); // If this is a controlled radio button group, forcing the input that 21664 // was previously checked to update will cause it to be come re-checked 21665 // as appropriate. 21666 21667 updateWrapper(otherNode, otherProps); 21668 } 21669 } 21670} // In Chrome, assigning defaultValue to certain input types triggers input validation. 21671// For number inputs, the display value loses trailing decimal points. For email inputs, 21672// Chrome raises "The specified value <x> is not a valid email address". 21673// 21674// Here we check to see if the defaultValue has actually changed, avoiding these problems 21675// when the user is inputting text 21676// 21677// https://github.com/facebook/react/issues/7253 21678 21679 21680function setDefaultValue(node, type, value) { 21681 if ( // Focused number inputs synchronize on blur. See ChangeEventPlugin.js 21682 type !== 'number' || getActiveElement(node.ownerDocument) !== node) { 21683 if (value == null) { 21684 node.defaultValue = toString(node._wrapperState.initialValue); 21685 } else if (node.defaultValue !== toString(value)) { 21686 node.defaultValue = toString(value); 21687 } 21688 } 21689} 21690 21691var didWarnSelectedSetOnOption = false; 21692var didWarnInvalidChild = false; 21693var didWarnInvalidInnerHTML = false; 21694/** 21695 * Implements an <option> host component that warns when `selected` is set. 21696 */ 21697 21698function validateProps(element, props) { 21699 { 21700 // If a value is not provided, then the children must be simple. 21701 if (props.value == null) { 21702 if (typeof props.children === 'object' && props.children !== null) { 21703 React.Children.forEach(props.children, function (child) { 21704 if (child == null) { 21705 return; 21706 } 21707 21708 if (typeof child === 'string' || typeof child === 'number') { 21709 return; 21710 } 21711 21712 if (!didWarnInvalidChild) { 21713 didWarnInvalidChild = true; 21714 21715 error('Cannot infer the option value of complex children. ' + 'Pass a `value` prop or use a plain string as children to <option>.'); 21716 } 21717 }); 21718 } else if (props.dangerouslySetInnerHTML != null) { 21719 if (!didWarnInvalidInnerHTML) { 21720 didWarnInvalidInnerHTML = true; 21721 21722 error('Pass a `value` prop if you set dangerouslyInnerHTML so React knows ' + 'which value should be selected.'); 21723 } 21724 } 21725 } // TODO: Remove support for `selected` in <option>. 21726 21727 21728 if (props.selected != null && !didWarnSelectedSetOnOption) { 21729 error('Use the `defaultValue` or `value` props on <select> instead of ' + 'setting `selected` on <option>.'); 21730 21731 didWarnSelectedSetOnOption = true; 21732 } 21733 } 21734} 21735function postMountWrapper$1(element, props) { 21736 // value="" should make a value attribute (#6219) 21737 if (props.value != null) { 21738 element.setAttribute('value', toString(getToStringValue(props.value))); 21739 } 21740} 21741 21742var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare 21743 21744function isArray(a) { 21745 return isArrayImpl(a); 21746} 21747 21748var didWarnValueDefaultValue$1; 21749 21750{ 21751 didWarnValueDefaultValue$1 = false; 21752} 21753 21754function getDeclarationErrorAddendum() { 21755 var ownerName = getCurrentFiberOwnerNameInDevOrNull(); 21756 21757 if (ownerName) { 21758 return '\n\nCheck the render method of `' + ownerName + '`.'; 21759 } 21760 21761 return ''; 21762} 21763 21764var valuePropNames = ['value', 'defaultValue']; 21765/** 21766 * Validation function for `value` and `defaultValue`. 21767 */ 21768 21769function checkSelectPropTypes(props) { 21770 { 21771 checkControlledValueProps('select', props); 21772 21773 for (var i = 0; i < valuePropNames.length; i++) { 21774 var propName = valuePropNames[i]; 21775 21776 if (props[propName] == null) { 21777 continue; 21778 } 21779 21780 var propNameIsArray = isArray(props[propName]); 21781 21782 if (props.multiple && !propNameIsArray) { 21783 error('The `%s` prop supplied to <select> must be an array if ' + '`multiple` is true.%s', propName, getDeclarationErrorAddendum()); 21784 } else if (!props.multiple && propNameIsArray) { 21785 error('The `%s` prop supplied to <select> must be a scalar ' + 'value if `multiple` is false.%s', propName, getDeclarationErrorAddendum()); 21786 } 21787 } 21788 } 21789} 21790 21791function updateOptions(node, multiple, propValue, setDefaultSelected) { 21792 var options = node.options; 21793 21794 if (multiple) { 21795 var selectedValues = propValue; 21796 var selectedValue = {}; 21797 21798 for (var i = 0; i < selectedValues.length; i++) { 21799 // Prefix to avoid chaos with special keys. 21800 selectedValue['$' + selectedValues[i]] = true; 21801 } 21802 21803 for (var _i = 0; _i < options.length; _i++) { 21804 var selected = selectedValue.hasOwnProperty('$' + options[_i].value); 21805 21806 if (options[_i].selected !== selected) { 21807 options[_i].selected = selected; 21808 } 21809 21810 if (selected && setDefaultSelected) { 21811 options[_i].defaultSelected = true; 21812 } 21813 } 21814 } else { 21815 // Do not set `select.value` as exact behavior isn't consistent across all 21816 // browsers for all cases. 21817 var _selectedValue = toString(getToStringValue(propValue)); 21818 21819 var defaultSelected = null; 21820 21821 for (var _i2 = 0; _i2 < options.length; _i2++) { 21822 if (options[_i2].value === _selectedValue) { 21823 options[_i2].selected = true; 21824 21825 if (setDefaultSelected) { 21826 options[_i2].defaultSelected = true; 21827 } 21828 21829 return; 21830 } 21831 21832 if (defaultSelected === null && !options[_i2].disabled) { 21833 defaultSelected = options[_i2]; 21834 } 21835 } 21836 21837 if (defaultSelected !== null) { 21838 defaultSelected.selected = true; 21839 } 21840 } 21841} 21842/** 21843 * Implements a <select> host component that allows optionally setting the 21844 * props `value` and `defaultValue`. If `multiple` is false, the prop must be a 21845 * stringable. If `multiple` is true, the prop must be an array of stringables. 21846 * 21847 * If `value` is not supplied (or null/undefined), user actions that change the 21848 * selected option will trigger updates to the rendered options. 21849 * 21850 * If it is supplied (and not null/undefined), the rendered options will not 21851 * update in response to user actions. Instead, the `value` prop must change in 21852 * order for the rendered options to update. 21853 * 21854 * If `defaultValue` is provided, any options with the supplied values will be 21855 * selected. 21856 */ 21857 21858 21859function getHostProps$1(element, props) { 21860 return assign({}, props, { 21861 value: undefined 21862 }); 21863} 21864function initWrapperState$1(element, props) { 21865 var node = element; 21866 21867 { 21868 checkSelectPropTypes(props); 21869 } 21870 21871 node._wrapperState = { 21872 wasMultiple: !!props.multiple 21873 }; 21874 21875 { 21876 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValueDefaultValue$1) { 21877 error('Select elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled select ' + 'element and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components'); 21878 21879 didWarnValueDefaultValue$1 = true; 21880 } 21881 } 21882} 21883function postMountWrapper$2(element, props) { 21884 var node = element; 21885 node.multiple = !!props.multiple; 21886 var value = props.value; 21887 21888 if (value != null) { 21889 updateOptions(node, !!props.multiple, value, false); 21890 } else if (props.defaultValue != null) { 21891 updateOptions(node, !!props.multiple, props.defaultValue, true); 21892 } 21893} 21894function postUpdateWrapper(element, props) { 21895 var node = element; 21896 var wasMultiple = node._wrapperState.wasMultiple; 21897 node._wrapperState.wasMultiple = !!props.multiple; 21898 var value = props.value; 21899 21900 if (value != null) { 21901 updateOptions(node, !!props.multiple, value, false); 21902 } else if (wasMultiple !== !!props.multiple) { 21903 // For simplicity, reapply `defaultValue` if `multiple` is toggled. 21904 if (props.defaultValue != null) { 21905 updateOptions(node, !!props.multiple, props.defaultValue, true); 21906 } else { 21907 // Revert the select back to its default unselected state. 21908 updateOptions(node, !!props.multiple, props.multiple ? [] : '', false); 21909 } 21910 } 21911} 21912function restoreControlledState$1(element, props) { 21913 var node = element; 21914 var value = props.value; 21915 21916 if (value != null) { 21917 updateOptions(node, !!props.multiple, value, false); 21918 } 21919} 21920 21921var didWarnValDefaultVal = false; 21922 21923/** 21924 * Implements a <textarea> host component that allows setting `value`, and 21925 * `defaultValue`. This differs from the traditional DOM API because value is 21926 * usually set as PCDATA children. 21927 * 21928 * If `value` is not supplied (or null/undefined), user actions that affect the 21929 * value will trigger updates to the element. 21930 * 21931 * If `value` is supplied (and not null/undefined), the rendered element will 21932 * not trigger updates to the element. Instead, the `value` prop must change in 21933 * order for the rendered element to be updated. 21934 * 21935 * The rendered element will be initialized with an empty value, the prop 21936 * `defaultValue` if specified, or the children content (deprecated). 21937 */ 21938function getHostProps$2(element, props) { 21939 var node = element; 21940 21941 if (props.dangerouslySetInnerHTML != null) { 21942 throw new Error('`dangerouslySetInnerHTML` does not make sense on <textarea>.'); 21943 } // Always set children to the same thing. In IE9, the selection range will 21944 // get reset if `textContent` is mutated. We could add a check in setTextContent 21945 // to only set the value if/when the value differs from the node value (which would 21946 // completely solve this IE9 bug), but Sebastian+Sophie seemed to like this 21947 // solution. The value can be a boolean or object so that's why it's forced 21948 // to be a string. 21949 21950 21951 var hostProps = assign({}, props, { 21952 value: undefined, 21953 defaultValue: undefined, 21954 children: toString(node._wrapperState.initialValue) 21955 }); 21956 21957 return hostProps; 21958} 21959function initWrapperState$2(element, props) { 21960 var node = element; 21961 21962 { 21963 checkControlledValueProps('textarea', props); 21964 21965 if (props.value !== undefined && props.defaultValue !== undefined && !didWarnValDefaultVal) { 21966 error('%s contains a textarea with both value and defaultValue props. ' + 'Textarea elements must be either controlled or uncontrolled ' + '(specify either the value prop, or the defaultValue prop, but not ' + 'both). Decide between using a controlled or uncontrolled textarea ' + 'and remove one of these props. More info: ' + 'https://reactjs.org/link/controlled-components', getCurrentFiberOwnerNameInDevOrNull() || 'A component'); 21967 21968 didWarnValDefaultVal = true; 21969 } 21970 } 21971 21972 var initialValue = props.value; // Only bother fetching default value if we're going to use it 21973 21974 if (initialValue == null) { 21975 var children = props.children, 21976 defaultValue = props.defaultValue; 21977 21978 if (children != null) { 21979 { 21980 error('Use the `defaultValue` or `value` props instead of setting ' + 'children on <textarea>.'); 21981 } 21982 21983 { 21984 if (defaultValue != null) { 21985 throw new Error('If you supply `defaultValue` on a <textarea>, do not pass children.'); 21986 } 21987 21988 if (isArray(children)) { 21989 if (children.length > 1) { 21990 throw new Error('<textarea> can only have at most one child.'); 21991 } 21992 21993 children = children[0]; 21994 } 21995 21996 defaultValue = children; 21997 } 21998 } 21999 22000 if (defaultValue == null) { 22001 defaultValue = ''; 22002 } 22003 22004 initialValue = defaultValue; 22005 } 22006 22007 node._wrapperState = { 22008 initialValue: getToStringValue(initialValue) 22009 }; 22010} 22011function updateWrapper$1(element, props) { 22012 var node = element; 22013 var value = getToStringValue(props.value); 22014 var defaultValue = getToStringValue(props.defaultValue); 22015 22016 if (value != null) { 22017 // Cast `value` to a string to ensure the value is set correctly. While 22018 // browsers typically do this as necessary, jsdom doesn't. 22019 var newValue = toString(value); // To avoid side effects (such as losing text selection), only set value if changed 22020 22021 if (newValue !== node.value) { 22022 node.value = newValue; 22023 } 22024 22025 if (props.defaultValue == null && node.defaultValue !== newValue) { 22026 node.defaultValue = newValue; 22027 } 22028 } 22029 22030 if (defaultValue != null) { 22031 node.defaultValue = toString(defaultValue); 22032 } 22033} 22034function postMountWrapper$3(element, props) { 22035 var node = element; // This is in postMount because we need access to the DOM node, which is not 22036 // available until after the component has mounted. 22037 22038 var textContent = node.textContent; // Only set node.value if textContent is equal to the expected 22039 // initial value. In IE10/IE11 there is a bug where the placeholder attribute 22040 // will populate textContent as well. 22041 // https://developer.microsoft.com/microsoft-edge/platform/issues/101525/ 22042 22043 if (textContent === node._wrapperState.initialValue) { 22044 if (textContent !== '' && textContent !== null) { 22045 node.value = textContent; 22046 } 22047 } 22048} 22049function restoreControlledState$2(element, props) { 22050 // DOM component is still mounted; update 22051 updateWrapper$1(element, props); 22052} 22053 22054var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; 22055var MATH_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; 22056var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; // Assumes there is no parent namespace. 22057 22058function getIntrinsicNamespace(type) { 22059 switch (type) { 22060 case 'svg': 22061 return SVG_NAMESPACE; 22062 22063 case 'math': 22064 return MATH_NAMESPACE; 22065 22066 default: 22067 return HTML_NAMESPACE; 22068 } 22069} 22070function getChildNamespace(parentNamespace, type) { 22071 if (parentNamespace == null || parentNamespace === HTML_NAMESPACE) { 22072 // No (or default) parent namespace: potential entry point. 22073 return getIntrinsicNamespace(type); 22074 } 22075 22076 if (parentNamespace === SVG_NAMESPACE && type === 'foreignObject') { 22077 // We're leaving SVG. 22078 return HTML_NAMESPACE; 22079 } // By default, pass namespace below. 22080 22081 22082 return parentNamespace; 22083} 22084 22085/* globals MSApp */ 22086 22087/** 22088 * Create a function which has 'unsafe' privileges (required by windows8 apps) 22089 */ 22090var createMicrosoftUnsafeLocalFunction = function (func) { 22091 if (typeof MSApp !== 'undefined' && MSApp.execUnsafeLocalFunction) { 22092 return function (arg0, arg1, arg2, arg3) { 22093 MSApp.execUnsafeLocalFunction(function () { 22094 return func(arg0, arg1, arg2, arg3); 22095 }); 22096 }; 22097 } else { 22098 return func; 22099 } 22100}; 22101 22102var reusableSVGContainer; 22103/** 22104 * Set the innerHTML property of a node 22105 * 22106 * @param {DOMElement} node 22107 * @param {string} html 22108 * @internal 22109 */ 22110 22111var setInnerHTML = createMicrosoftUnsafeLocalFunction(function (node, html) { 22112 if (node.namespaceURI === SVG_NAMESPACE) { 22113 22114 if (!('innerHTML' in node)) { 22115 // IE does not have innerHTML for SVG nodes, so instead we inject the 22116 // new markup in a temp node and then move the child nodes across into 22117 // the target node 22118 reusableSVGContainer = reusableSVGContainer || document.createElement('div'); 22119 reusableSVGContainer.innerHTML = '<svg>' + html.valueOf().toString() + '</svg>'; 22120 var svgNode = reusableSVGContainer.firstChild; 22121 22122 while (node.firstChild) { 22123 node.removeChild(node.firstChild); 22124 } 22125 22126 while (svgNode.firstChild) { 22127 node.appendChild(svgNode.firstChild); 22128 } 22129 22130 return; 22131 } 22132 } 22133 22134 node.innerHTML = html; 22135}); 22136 22137/** 22138 * HTML nodeType values that represent the type of the node 22139 */ 22140var ELEMENT_NODE = 1; 22141var TEXT_NODE = 3; 22142var COMMENT_NODE = 8; 22143var DOCUMENT_NODE = 9; 22144var DOCUMENT_FRAGMENT_NODE = 11; 22145 22146/** 22147 * Set the textContent property of a node. For text updates, it's faster 22148 * to set the `nodeValue` of the Text node directly instead of using 22149 * `.textContent` which will remove the existing node and create a new one. 22150 * 22151 * @param {DOMElement} node 22152 * @param {string} text 22153 * @internal 22154 */ 22155 22156var setTextContent = function (node, text) { 22157 if (text) { 22158 var firstChild = node.firstChild; 22159 22160 if (firstChild && firstChild === node.lastChild && firstChild.nodeType === TEXT_NODE) { 22161 firstChild.nodeValue = text; 22162 return; 22163 } 22164 } 22165 22166 node.textContent = text; 22167}; 22168 22169// List derived from Gecko source code: 22170// https://github.com/mozilla/gecko-dev/blob/4e638efc71/layout/style/test/property_database.js 22171var shorthandToLonghand = { 22172 animation: ['animationDelay', 'animationDirection', 'animationDuration', 'animationFillMode', 'animationIterationCount', 'animationName', 'animationPlayState', 'animationTimingFunction'], 22173 background: ['backgroundAttachment', 'backgroundClip', 'backgroundColor', 'backgroundImage', 'backgroundOrigin', 'backgroundPositionX', 'backgroundPositionY', 'backgroundRepeat', 'backgroundSize'], 22174 backgroundPosition: ['backgroundPositionX', 'backgroundPositionY'], 22175 border: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth', 'borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth', 'borderLeftColor', 'borderLeftStyle', 'borderLeftWidth', 'borderRightColor', 'borderRightStyle', 'borderRightWidth', 'borderTopColor', 'borderTopStyle', 'borderTopWidth'], 22176 borderBlockEnd: ['borderBlockEndColor', 'borderBlockEndStyle', 'borderBlockEndWidth'], 22177 borderBlockStart: ['borderBlockStartColor', 'borderBlockStartStyle', 'borderBlockStartWidth'], 22178 borderBottom: ['borderBottomColor', 'borderBottomStyle', 'borderBottomWidth'], 22179 borderColor: ['borderBottomColor', 'borderLeftColor', 'borderRightColor', 'borderTopColor'], 22180 borderImage: ['borderImageOutset', 'borderImageRepeat', 'borderImageSlice', 'borderImageSource', 'borderImageWidth'], 22181 borderInlineEnd: ['borderInlineEndColor', 'borderInlineEndStyle', 'borderInlineEndWidth'], 22182 borderInlineStart: ['borderInlineStartColor', 'borderInlineStartStyle', 'borderInlineStartWidth'], 22183 borderLeft: ['borderLeftColor', 'borderLeftStyle', 'borderLeftWidth'], 22184 borderRadius: ['borderBottomLeftRadius', 'borderBottomRightRadius', 'borderTopLeftRadius', 'borderTopRightRadius'], 22185 borderRight: ['borderRightColor', 'borderRightStyle', 'borderRightWidth'], 22186 borderStyle: ['borderBottomStyle', 'borderLeftStyle', 'borderRightStyle', 'borderTopStyle'], 22187 borderTop: ['borderTopColor', 'borderTopStyle', 'borderTopWidth'], 22188 borderWidth: ['borderBottomWidth', 'borderLeftWidth', 'borderRightWidth', 'borderTopWidth'], 22189 columnRule: ['columnRuleColor', 'columnRuleStyle', 'columnRuleWidth'], 22190 columns: ['columnCount', 'columnWidth'], 22191 flex: ['flexBasis', 'flexGrow', 'flexShrink'], 22192 flexFlow: ['flexDirection', 'flexWrap'], 22193 font: ['fontFamily', 'fontFeatureSettings', 'fontKerning', 'fontLanguageOverride', 'fontSize', 'fontSizeAdjust', 'fontStretch', 'fontStyle', 'fontVariant', 'fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition', 'fontWeight', 'lineHeight'], 22194 fontVariant: ['fontVariantAlternates', 'fontVariantCaps', 'fontVariantEastAsian', 'fontVariantLigatures', 'fontVariantNumeric', 'fontVariantPosition'], 22195 gap: ['columnGap', 'rowGap'], 22196 grid: ['gridAutoColumns', 'gridAutoFlow', 'gridAutoRows', 'gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'], 22197 gridArea: ['gridColumnEnd', 'gridColumnStart', 'gridRowEnd', 'gridRowStart'], 22198 gridColumn: ['gridColumnEnd', 'gridColumnStart'], 22199 gridColumnGap: ['columnGap'], 22200 gridGap: ['columnGap', 'rowGap'], 22201 gridRow: ['gridRowEnd', 'gridRowStart'], 22202 gridRowGap: ['rowGap'], 22203 gridTemplate: ['gridTemplateAreas', 'gridTemplateColumns', 'gridTemplateRows'], 22204 listStyle: ['listStyleImage', 'listStylePosition', 'listStyleType'], 22205 margin: ['marginBottom', 'marginLeft', 'marginRight', 'marginTop'], 22206 marker: ['markerEnd', 'markerMid', 'markerStart'], 22207 mask: ['maskClip', 'maskComposite', 'maskImage', 'maskMode', 'maskOrigin', 'maskPositionX', 'maskPositionY', 'maskRepeat', 'maskSize'], 22208 maskPosition: ['maskPositionX', 'maskPositionY'], 22209 outline: ['outlineColor', 'outlineStyle', 'outlineWidth'], 22210 overflow: ['overflowX', 'overflowY'], 22211 padding: ['paddingBottom', 'paddingLeft', 'paddingRight', 'paddingTop'], 22212 placeContent: ['alignContent', 'justifyContent'], 22213 placeItems: ['alignItems', 'justifyItems'], 22214 placeSelf: ['alignSelf', 'justifySelf'], 22215 textDecoration: ['textDecorationColor', 'textDecorationLine', 'textDecorationStyle'], 22216 textEmphasis: ['textEmphasisColor', 'textEmphasisStyle'], 22217 transition: ['transitionDelay', 'transitionDuration', 'transitionProperty', 'transitionTimingFunction'], 22218 wordWrap: ['overflowWrap'] 22219}; 22220 22221/** 22222 * CSS properties which accept numbers but are not in units of "px". 22223 */ 22224var isUnitlessNumber = { 22225 animationIterationCount: true, 22226 aspectRatio: true, 22227 borderImageOutset: true, 22228 borderImageSlice: true, 22229 borderImageWidth: true, 22230 boxFlex: true, 22231 boxFlexGroup: true, 22232 boxOrdinalGroup: true, 22233 columnCount: true, 22234 columns: true, 22235 flex: true, 22236 flexGrow: true, 22237 flexPositive: true, 22238 flexShrink: true, 22239 flexNegative: true, 22240 flexOrder: true, 22241 gridArea: true, 22242 gridRow: true, 22243 gridRowEnd: true, 22244 gridRowSpan: true, 22245 gridRowStart: true, 22246 gridColumn: true, 22247 gridColumnEnd: true, 22248 gridColumnSpan: true, 22249 gridColumnStart: true, 22250 fontWeight: true, 22251 lineClamp: true, 22252 lineHeight: true, 22253 opacity: true, 22254 order: true, 22255 orphans: true, 22256 tabSize: true, 22257 widows: true, 22258 zIndex: true, 22259 zoom: true, 22260 // SVG-related properties 22261 fillOpacity: true, 22262 floodOpacity: true, 22263 stopOpacity: true, 22264 strokeDasharray: true, 22265 strokeDashoffset: true, 22266 strokeMiterlimit: true, 22267 strokeOpacity: true, 22268 strokeWidth: true 22269}; 22270/** 22271 * @param {string} prefix vendor-specific prefix, eg: Webkit 22272 * @param {string} key style name, eg: transitionDuration 22273 * @return {string} style name prefixed with `prefix`, properly camelCased, eg: 22274 * WebkitTransitionDuration 22275 */ 22276 22277function prefixKey(prefix, key) { 22278 return prefix + key.charAt(0).toUpperCase() + key.substring(1); 22279} 22280/** 22281 * Support style names that may come passed in prefixed by adding permutations 22282 * of vendor prefixes. 22283 */ 22284 22285 22286var prefixes = ['Webkit', 'ms', 'Moz', 'O']; // Using Object.keys here, or else the vanilla for-in loop makes IE8 go into an 22287// infinite loop, because it iterates over the newly added props too. 22288 22289Object.keys(isUnitlessNumber).forEach(function (prop) { 22290 prefixes.forEach(function (prefix) { 22291 isUnitlessNumber[prefixKey(prefix, prop)] = isUnitlessNumber[prop]; 22292 }); 22293}); 22294 22295/** 22296 * Convert a value into the proper css writable value. The style name `name` 22297 * should be logical (no hyphens), as specified 22298 * in `CSSProperty.isUnitlessNumber`. 22299 * 22300 * @param {string} name CSS property name such as `topMargin`. 22301 * @param {*} value CSS property value such as `10px`. 22302 * @return {string} Normalized style value with dimensions applied. 22303 */ 22304 22305function dangerousStyleValue(name, value, isCustomProperty) { 22306 // Note that we've removed escapeTextForBrowser() calls here since the 22307 // whole string will be escaped when the attribute is injected into 22308 // the markup. If you provide unsafe user data here they can inject 22309 // arbitrary CSS which may be problematic (I couldn't repro this): 22310 // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet 22311 // http://www.thespanner.co.uk/2007/11/26/ultimate-xss-css-injection/ 22312 // This is not an XSS hole but instead a potential CSS injection issue 22313 // which has lead to a greater discussion about how we're going to 22314 // trust URLs moving forward. See #2115901 22315 var isEmpty = value == null || typeof value === 'boolean' || value === ''; 22316 22317 if (isEmpty) { 22318 return ''; 22319 } 22320 22321 if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) { 22322 return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers 22323 } 22324 22325 { 22326 checkCSSPropertyStringCoercion(value, name); 22327 } 22328 22329 return ('' + value).trim(); 22330} 22331 22332var uppercasePattern = /([A-Z])/g; 22333var msPattern = /^ms-/; 22334/** 22335 * Hyphenates a camelcased CSS property name, for example: 22336 * 22337 * > hyphenateStyleName('backgroundColor') 22338 * < "background-color" 22339 * > hyphenateStyleName('MozTransition') 22340 * < "-moz-transition" 22341 * > hyphenateStyleName('msTransition') 22342 * < "-ms-transition" 22343 * 22344 * As Modernizr suggests (http://modernizr.com/docs/#prefixed), an `ms` prefix 22345 * is converted to `-ms-`. 22346 */ 22347 22348function hyphenateStyleName(name) { 22349 return name.replace(uppercasePattern, '-$1').toLowerCase().replace(msPattern, '-ms-'); 22350} 22351 22352var warnValidStyle = function () {}; 22353 22354{ 22355 // 'msTransform' is correct, but the other prefixes should be capitalized 22356 var badVendoredStyleNamePattern = /^(?:webkit|moz|o)[A-Z]/; 22357 var msPattern$1 = /^-ms-/; 22358 var hyphenPattern = /-(.)/g; // style values shouldn't contain a semicolon 22359 22360 var badStyleValueWithSemicolonPattern = /;\s*$/; 22361 var warnedStyleNames = {}; 22362 var warnedStyleValues = {}; 22363 var warnedForNaNValue = false; 22364 var warnedForInfinityValue = false; 22365 22366 var camelize = function (string) { 22367 return string.replace(hyphenPattern, function (_, character) { 22368 return character.toUpperCase(); 22369 }); 22370 }; 22371 22372 var warnHyphenatedStyleName = function (name) { 22373 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { 22374 return; 22375 } 22376 22377 warnedStyleNames[name] = true; 22378 22379 error('Unsupported style property %s. Did you mean %s?', name, // As Andi Smith suggests 22380 // (http://www.andismith.com/blog/2012/02/modernizr-prefixed/), an `-ms` prefix 22381 // is converted to lowercase `ms`. 22382 camelize(name.replace(msPattern$1, 'ms-'))); 22383 }; 22384 22385 var warnBadVendoredStyleName = function (name) { 22386 if (warnedStyleNames.hasOwnProperty(name) && warnedStyleNames[name]) { 22387 return; 22388 } 22389 22390 warnedStyleNames[name] = true; 22391 22392 error('Unsupported vendor-prefixed style property %s. Did you mean %s?', name, name.charAt(0).toUpperCase() + name.slice(1)); 22393 }; 22394 22395 var warnStyleValueWithSemicolon = function (name, value) { 22396 if (warnedStyleValues.hasOwnProperty(value) && warnedStyleValues[value]) { 22397 return; 22398 } 22399 22400 warnedStyleValues[value] = true; 22401 22402 error("Style property values shouldn't contain a semicolon. " + 'Try "%s: %s" instead.', name, value.replace(badStyleValueWithSemicolonPattern, '')); 22403 }; 22404 22405 var warnStyleValueIsNaN = function (name, value) { 22406 if (warnedForNaNValue) { 22407 return; 22408 } 22409 22410 warnedForNaNValue = true; 22411 22412 error('`NaN` is an invalid value for the `%s` css style property.', name); 22413 }; 22414 22415 var warnStyleValueIsInfinity = function (name, value) { 22416 if (warnedForInfinityValue) { 22417 return; 22418 } 22419 22420 warnedForInfinityValue = true; 22421 22422 error('`Infinity` is an invalid value for the `%s` css style property.', name); 22423 }; 22424 22425 warnValidStyle = function (name, value) { 22426 if (name.indexOf('-') > -1) { 22427 warnHyphenatedStyleName(name); 22428 } else if (badVendoredStyleNamePattern.test(name)) { 22429 warnBadVendoredStyleName(name); 22430 } else if (badStyleValueWithSemicolonPattern.test(value)) { 22431 warnStyleValueWithSemicolon(name, value); 22432 } 22433 22434 if (typeof value === 'number') { 22435 if (isNaN(value)) { 22436 warnStyleValueIsNaN(name, value); 22437 } else if (!isFinite(value)) { 22438 warnStyleValueIsInfinity(name, value); 22439 } 22440 } 22441 }; 22442} 22443 22444var warnValidStyle$1 = warnValidStyle; 22445 22446/** 22447 * Operations for dealing with CSS properties. 22448 */ 22449 22450/** 22451 * This creates a string that is expected to be equivalent to the style 22452 * attribute generated by server-side rendering. It by-passes warnings and 22453 * security checks so it's not safe to use this value for anything other than 22454 * comparison. It is only used in DEV for SSR validation. 22455 */ 22456 22457function createDangerousStringForStyles(styles) { 22458 { 22459 var serialized = ''; 22460 var delimiter = ''; 22461 22462 for (var styleName in styles) { 22463 if (!styles.hasOwnProperty(styleName)) { 22464 continue; 22465 } 22466 22467 var styleValue = styles[styleName]; 22468 22469 if (styleValue != null) { 22470 var isCustomProperty = styleName.indexOf('--') === 0; 22471 serialized += delimiter + (isCustomProperty ? styleName : hyphenateStyleName(styleName)) + ':'; 22472 serialized += dangerousStyleValue(styleName, styleValue, isCustomProperty); 22473 delimiter = ';'; 22474 } 22475 } 22476 22477 return serialized || null; 22478 } 22479} 22480/** 22481 * Sets the value for multiple styles on a node. If a value is specified as 22482 * '' (empty string), the corresponding style property will be unset. 22483 * 22484 * @param {DOMElement} node 22485 * @param {object} styles 22486 */ 22487 22488function setValueForStyles(node, styles) { 22489 var style = node.style; 22490 22491 for (var styleName in styles) { 22492 if (!styles.hasOwnProperty(styleName)) { 22493 continue; 22494 } 22495 22496 var isCustomProperty = styleName.indexOf('--') === 0; 22497 22498 { 22499 if (!isCustomProperty) { 22500 warnValidStyle$1(styleName, styles[styleName]); 22501 } 22502 } 22503 22504 var styleValue = dangerousStyleValue(styleName, styles[styleName], isCustomProperty); 22505 22506 if (styleName === 'float') { 22507 styleName = 'cssFloat'; 22508 } 22509 22510 if (isCustomProperty) { 22511 style.setProperty(styleName, styleValue); 22512 } else { 22513 style[styleName] = styleValue; 22514 } 22515 } 22516} 22517 22518function isValueEmpty(value) { 22519 return value == null || typeof value === 'boolean' || value === ''; 22520} 22521/** 22522 * Given {color: 'red', overflow: 'hidden'} returns { 22523 * color: 'color', 22524 * overflowX: 'overflow', 22525 * overflowY: 'overflow', 22526 * }. This can be read as "the overflowY property was set by the overflow 22527 * shorthand". That is, the values are the property that each was derived from. 22528 */ 22529 22530 22531function expandShorthandMap(styles) { 22532 var expanded = {}; 22533 22534 for (var key in styles) { 22535 var longhands = shorthandToLonghand[key] || [key]; 22536 22537 for (var i = 0; i < longhands.length; i++) { 22538 expanded[longhands[i]] = key; 22539 } 22540 } 22541 22542 return expanded; 22543} 22544/** 22545 * When mixing shorthand and longhand property names, we warn during updates if 22546 * we expect an incorrect result to occur. In particular, we warn for: 22547 * 22548 * Updating a shorthand property (longhand gets overwritten): 22549 * {font: 'foo', fontVariant: 'bar'} -> {font: 'baz', fontVariant: 'bar'} 22550 * becomes .style.font = 'baz' 22551 * Removing a shorthand property (longhand gets lost too): 22552 * {font: 'foo', fontVariant: 'bar'} -> {fontVariant: 'bar'} 22553 * becomes .style.font = '' 22554 * Removing a longhand property (should revert to shorthand; doesn't): 22555 * {font: 'foo', fontVariant: 'bar'} -> {font: 'foo'} 22556 * becomes .style.fontVariant = '' 22557 */ 22558 22559 22560function validateShorthandPropertyCollisionInDev(styleUpdates, nextStyles) { 22561 { 22562 if (!nextStyles) { 22563 return; 22564 } 22565 22566 var expandedUpdates = expandShorthandMap(styleUpdates); 22567 var expandedStyles = expandShorthandMap(nextStyles); 22568 var warnedAbout = {}; 22569 22570 for (var key in expandedUpdates) { 22571 var originalKey = expandedUpdates[key]; 22572 var correctOriginalKey = expandedStyles[key]; 22573 22574 if (correctOriginalKey && originalKey !== correctOriginalKey) { 22575 var warningKey = originalKey + ',' + correctOriginalKey; 22576 22577 if (warnedAbout[warningKey]) { 22578 continue; 22579 } 22580 22581 warnedAbout[warningKey] = true; 22582 22583 error('%s a style property during rerender (%s) when a ' + 'conflicting property is set (%s) can lead to styling bugs. To ' + "avoid this, don't mix shorthand and non-shorthand properties " + 'for the same value; instead, replace the shorthand with ' + 'separate values.', isValueEmpty(styleUpdates[originalKey]) ? 'Removing' : 'Updating', originalKey, correctOriginalKey); 22584 } 22585 } 22586 } 22587} 22588 22589// For HTML, certain tags should omit their close tag. We keep a list for 22590// those special-case tags. 22591var omittedCloseTags = { 22592 area: true, 22593 base: true, 22594 br: true, 22595 col: true, 22596 embed: true, 22597 hr: true, 22598 img: true, 22599 input: true, 22600 keygen: true, 22601 link: true, 22602 meta: true, 22603 param: true, 22604 source: true, 22605 track: true, 22606 wbr: true // NOTE: menuitem's close tag should be omitted, but that causes problems. 22607 22608}; 22609 22610// `omittedCloseTags` except that `menuitem` should still have its closing tag. 22611 22612var voidElementTags = assign({ 22613 menuitem: true 22614}, omittedCloseTags); 22615 22616var HTML = '__html'; 22617 22618function assertValidProps(tag, props) { 22619 if (!props) { 22620 return; 22621 } // Note the use of `==` which checks for null or undefined. 22622 22623 22624 if (voidElementTags[tag]) { 22625 if (props.children != null || props.dangerouslySetInnerHTML != null) { 22626 throw new Error(tag + " is a void element tag and must neither have `children` nor " + 'use `dangerouslySetInnerHTML`.'); 22627 } 22628 } 22629 22630 if (props.dangerouslySetInnerHTML != null) { 22631 if (props.children != null) { 22632 throw new Error('Can only set one of `children` or `props.dangerouslySetInnerHTML`.'); 22633 } 22634 22635 if (typeof props.dangerouslySetInnerHTML !== 'object' || !(HTML in props.dangerouslySetInnerHTML)) { 22636 throw new Error('`props.dangerouslySetInnerHTML` must be in the form `{__html: ...}`. ' + 'Please visit https://reactjs.org/link/dangerously-set-inner-html ' + 'for more information.'); 22637 } 22638 } 22639 22640 { 22641 if (!props.suppressContentEditableWarning && props.contentEditable && props.children != null) { 22642 error('A component is `contentEditable` and contains `children` managed by ' + 'React. It is now your responsibility to guarantee that none of ' + 'those nodes are unexpectedly modified or duplicated. This is ' + 'probably not intentional.'); 22643 } 22644 } 22645 22646 if (props.style != null && typeof props.style !== 'object') { 22647 throw new Error('The `style` prop expects a mapping from style properties to values, ' + "not a string. For example, style={{marginRight: spacing + 'em'}} when " + 'using JSX.'); 22648 } 22649} 22650 22651function isCustomComponent(tagName, props) { 22652 if (tagName.indexOf('-') === -1) { 22653 return typeof props.is === 'string'; 22654 } 22655 22656 switch (tagName) { 22657 // These are reserved SVG and MathML elements. 22658 // We don't mind this list too much because we expect it to never grow. 22659 // The alternative is to track the namespace in a few places which is convoluted. 22660 // https://w3c.github.io/webcomponents/spec/custom/#custom-elements-core-concepts 22661 case 'annotation-xml': 22662 case 'color-profile': 22663 case 'font-face': 22664 case 'font-face-src': 22665 case 'font-face-uri': 22666 case 'font-face-format': 22667 case 'font-face-name': 22668 case 'missing-glyph': 22669 return false; 22670 22671 default: 22672 return true; 22673 } 22674} 22675 22676// When adding attributes to the HTML or SVG allowed attribute list, be sure to 22677// also add them to this module to ensure casing and incorrect name 22678// warnings. 22679var possibleStandardNames = { 22680 // HTML 22681 accept: 'accept', 22682 acceptcharset: 'acceptCharset', 22683 'accept-charset': 'acceptCharset', 22684 accesskey: 'accessKey', 22685 action: 'action', 22686 allowfullscreen: 'allowFullScreen', 22687 alt: 'alt', 22688 as: 'as', 22689 async: 'async', 22690 autocapitalize: 'autoCapitalize', 22691 autocomplete: 'autoComplete', 22692 autocorrect: 'autoCorrect', 22693 autofocus: 'autoFocus', 22694 autoplay: 'autoPlay', 22695 autosave: 'autoSave', 22696 capture: 'capture', 22697 cellpadding: 'cellPadding', 22698 cellspacing: 'cellSpacing', 22699 challenge: 'challenge', 22700 charset: 'charSet', 22701 checked: 'checked', 22702 children: 'children', 22703 cite: 'cite', 22704 class: 'className', 22705 classid: 'classID', 22706 classname: 'className', 22707 cols: 'cols', 22708 colspan: 'colSpan', 22709 content: 'content', 22710 contenteditable: 'contentEditable', 22711 contextmenu: 'contextMenu', 22712 controls: 'controls', 22713 controlslist: 'controlsList', 22714 coords: 'coords', 22715 crossorigin: 'crossOrigin', 22716 dangerouslysetinnerhtml: 'dangerouslySetInnerHTML', 22717 data: 'data', 22718 datetime: 'dateTime', 22719 default: 'default', 22720 defaultchecked: 'defaultChecked', 22721 defaultvalue: 'defaultValue', 22722 defer: 'defer', 22723 dir: 'dir', 22724 disabled: 'disabled', 22725 disablepictureinpicture: 'disablePictureInPicture', 22726 disableremoteplayback: 'disableRemotePlayback', 22727 download: 'download', 22728 draggable: 'draggable', 22729 enctype: 'encType', 22730 enterkeyhint: 'enterKeyHint', 22731 for: 'htmlFor', 22732 form: 'form', 22733 formmethod: 'formMethod', 22734 formaction: 'formAction', 22735 formenctype: 'formEncType', 22736 formnovalidate: 'formNoValidate', 22737 formtarget: 'formTarget', 22738 frameborder: 'frameBorder', 22739 headers: 'headers', 22740 height: 'height', 22741 hidden: 'hidden', 22742 high: 'high', 22743 href: 'href', 22744 hreflang: 'hrefLang', 22745 htmlfor: 'htmlFor', 22746 httpequiv: 'httpEquiv', 22747 'http-equiv': 'httpEquiv', 22748 icon: 'icon', 22749 id: 'id', 22750 imagesizes: 'imageSizes', 22751 imagesrcset: 'imageSrcSet', 22752 innerhtml: 'innerHTML', 22753 inputmode: 'inputMode', 22754 integrity: 'integrity', 22755 is: 'is', 22756 itemid: 'itemID', 22757 itemprop: 'itemProp', 22758 itemref: 'itemRef', 22759 itemscope: 'itemScope', 22760 itemtype: 'itemType', 22761 keyparams: 'keyParams', 22762 keytype: 'keyType', 22763 kind: 'kind', 22764 label: 'label', 22765 lang: 'lang', 22766 list: 'list', 22767 loop: 'loop', 22768 low: 'low', 22769 manifest: 'manifest', 22770 marginwidth: 'marginWidth', 22771 marginheight: 'marginHeight', 22772 max: 'max', 22773 maxlength: 'maxLength', 22774 media: 'media', 22775 mediagroup: 'mediaGroup', 22776 method: 'method', 22777 min: 'min', 22778 minlength: 'minLength', 22779 multiple: 'multiple', 22780 muted: 'muted', 22781 name: 'name', 22782 nomodule: 'noModule', 22783 nonce: 'nonce', 22784 novalidate: 'noValidate', 22785 open: 'open', 22786 optimum: 'optimum', 22787 pattern: 'pattern', 22788 placeholder: 'placeholder', 22789 playsinline: 'playsInline', 22790 poster: 'poster', 22791 preload: 'preload', 22792 profile: 'profile', 22793 radiogroup: 'radioGroup', 22794 readonly: 'readOnly', 22795 referrerpolicy: 'referrerPolicy', 22796 rel: 'rel', 22797 required: 'required', 22798 reversed: 'reversed', 22799 role: 'role', 22800 rows: 'rows', 22801 rowspan: 'rowSpan', 22802 sandbox: 'sandbox', 22803 scope: 'scope', 22804 scoped: 'scoped', 22805 scrolling: 'scrolling', 22806 seamless: 'seamless', 22807 selected: 'selected', 22808 shape: 'shape', 22809 size: 'size', 22810 sizes: 'sizes', 22811 span: 'span', 22812 spellcheck: 'spellCheck', 22813 src: 'src', 22814 srcdoc: 'srcDoc', 22815 srclang: 'srcLang', 22816 srcset: 'srcSet', 22817 start: 'start', 22818 step: 'step', 22819 style: 'style', 22820 summary: 'summary', 22821 tabindex: 'tabIndex', 22822 target: 'target', 22823 title: 'title', 22824 type: 'type', 22825 usemap: 'useMap', 22826 value: 'value', 22827 width: 'width', 22828 wmode: 'wmode', 22829 wrap: 'wrap', 22830 // SVG 22831 about: 'about', 22832 accentheight: 'accentHeight', 22833 'accent-height': 'accentHeight', 22834 accumulate: 'accumulate', 22835 additive: 'additive', 22836 alignmentbaseline: 'alignmentBaseline', 22837 'alignment-baseline': 'alignmentBaseline', 22838 allowreorder: 'allowReorder', 22839 alphabetic: 'alphabetic', 22840 amplitude: 'amplitude', 22841 arabicform: 'arabicForm', 22842 'arabic-form': 'arabicForm', 22843 ascent: 'ascent', 22844 attributename: 'attributeName', 22845 attributetype: 'attributeType', 22846 autoreverse: 'autoReverse', 22847 azimuth: 'azimuth', 22848 basefrequency: 'baseFrequency', 22849 baselineshift: 'baselineShift', 22850 'baseline-shift': 'baselineShift', 22851 baseprofile: 'baseProfile', 22852 bbox: 'bbox', 22853 begin: 'begin', 22854 bias: 'bias', 22855 by: 'by', 22856 calcmode: 'calcMode', 22857 capheight: 'capHeight', 22858 'cap-height': 'capHeight', 22859 clip: 'clip', 22860 clippath: 'clipPath', 22861 'clip-path': 'clipPath', 22862 clippathunits: 'clipPathUnits', 22863 cliprule: 'clipRule', 22864 'clip-rule': 'clipRule', 22865 color: 'color', 22866 colorinterpolation: 'colorInterpolation', 22867 'color-interpolation': 'colorInterpolation', 22868 colorinterpolationfilters: 'colorInterpolationFilters', 22869 'color-interpolation-filters': 'colorInterpolationFilters', 22870 colorprofile: 'colorProfile', 22871 'color-profile': 'colorProfile', 22872 colorrendering: 'colorRendering', 22873 'color-rendering': 'colorRendering', 22874 contentscripttype: 'contentScriptType', 22875 contentstyletype: 'contentStyleType', 22876 cursor: 'cursor', 22877 cx: 'cx', 22878 cy: 'cy', 22879 d: 'd', 22880 datatype: 'datatype', 22881 decelerate: 'decelerate', 22882 descent: 'descent', 22883 diffuseconstant: 'diffuseConstant', 22884 direction: 'direction', 22885 display: 'display', 22886 divisor: 'divisor', 22887 dominantbaseline: 'dominantBaseline', 22888 'dominant-baseline': 'dominantBaseline', 22889 dur: 'dur', 22890 dx: 'dx', 22891 dy: 'dy', 22892 edgemode: 'edgeMode', 22893 elevation: 'elevation', 22894 enablebackground: 'enableBackground', 22895 'enable-background': 'enableBackground', 22896 end: 'end', 22897 exponent: 'exponent', 22898 externalresourcesrequired: 'externalResourcesRequired', 22899 fill: 'fill', 22900 fillopacity: 'fillOpacity', 22901 'fill-opacity': 'fillOpacity', 22902 fillrule: 'fillRule', 22903 'fill-rule': 'fillRule', 22904 filter: 'filter', 22905 filterres: 'filterRes', 22906 filterunits: 'filterUnits', 22907 floodopacity: 'floodOpacity', 22908 'flood-opacity': 'floodOpacity', 22909 floodcolor: 'floodColor', 22910 'flood-color': 'floodColor', 22911 focusable: 'focusable', 22912 fontfamily: 'fontFamily', 22913 'font-family': 'fontFamily', 22914 fontsize: 'fontSize', 22915 'font-size': 'fontSize', 22916 fontsizeadjust: 'fontSizeAdjust', 22917 'font-size-adjust': 'fontSizeAdjust', 22918 fontstretch: 'fontStretch', 22919 'font-stretch': 'fontStretch', 22920 fontstyle: 'fontStyle', 22921 'font-style': 'fontStyle', 22922 fontvariant: 'fontVariant', 22923 'font-variant': 'fontVariant', 22924 fontweight: 'fontWeight', 22925 'font-weight': 'fontWeight', 22926 format: 'format', 22927 from: 'from', 22928 fx: 'fx', 22929 fy: 'fy', 22930 g1: 'g1', 22931 g2: 'g2', 22932 glyphname: 'glyphName', 22933 'glyph-name': 'glyphName', 22934 glyphorientationhorizontal: 'glyphOrientationHorizontal', 22935 'glyph-orientation-horizontal': 'glyphOrientationHorizontal', 22936 glyphorientationvertical: 'glyphOrientationVertical', 22937 'glyph-orientation-vertical': 'glyphOrientationVertical', 22938 glyphref: 'glyphRef', 22939 gradienttransform: 'gradientTransform', 22940 gradientunits: 'gradientUnits', 22941 hanging: 'hanging', 22942 horizadvx: 'horizAdvX', 22943 'horiz-adv-x': 'horizAdvX', 22944 horizoriginx: 'horizOriginX', 22945 'horiz-origin-x': 'horizOriginX', 22946 ideographic: 'ideographic', 22947 imagerendering: 'imageRendering', 22948 'image-rendering': 'imageRendering', 22949 in2: 'in2', 22950 in: 'in', 22951 inlist: 'inlist', 22952 intercept: 'intercept', 22953 k1: 'k1', 22954 k2: 'k2', 22955 k3: 'k3', 22956 k4: 'k4', 22957 k: 'k', 22958 kernelmatrix: 'kernelMatrix', 22959 kernelunitlength: 'kernelUnitLength', 22960 kerning: 'kerning', 22961 keypoints: 'keyPoints', 22962 keysplines: 'keySplines', 22963 keytimes: 'keyTimes', 22964 lengthadjust: 'lengthAdjust', 22965 letterspacing: 'letterSpacing', 22966 'letter-spacing': 'letterSpacing', 22967 lightingcolor: 'lightingColor', 22968 'lighting-color': 'lightingColor', 22969 limitingconeangle: 'limitingConeAngle', 22970 local: 'local', 22971 markerend: 'markerEnd', 22972 'marker-end': 'markerEnd', 22973 markerheight: 'markerHeight', 22974 markermid: 'markerMid', 22975 'marker-mid': 'markerMid', 22976 markerstart: 'markerStart', 22977 'marker-start': 'markerStart', 22978 markerunits: 'markerUnits', 22979 markerwidth: 'markerWidth', 22980 mask: 'mask', 22981 maskcontentunits: 'maskContentUnits', 22982 maskunits: 'maskUnits', 22983 mathematical: 'mathematical', 22984 mode: 'mode', 22985 numoctaves: 'numOctaves', 22986 offset: 'offset', 22987 opacity: 'opacity', 22988 operator: 'operator', 22989 order: 'order', 22990 orient: 'orient', 22991 orientation: 'orientation', 22992 origin: 'origin', 22993 overflow: 'overflow', 22994 overlineposition: 'overlinePosition', 22995 'overline-position': 'overlinePosition', 22996 overlinethickness: 'overlineThickness', 22997 'overline-thickness': 'overlineThickness', 22998 paintorder: 'paintOrder', 22999 'paint-order': 'paintOrder', 23000 panose1: 'panose1', 23001 'panose-1': 'panose1', 23002 pathlength: 'pathLength', 23003 patterncontentunits: 'patternContentUnits', 23004 patterntransform: 'patternTransform', 23005 patternunits: 'patternUnits', 23006 pointerevents: 'pointerEvents', 23007 'pointer-events': 'pointerEvents', 23008 points: 'points', 23009 pointsatx: 'pointsAtX', 23010 pointsaty: 'pointsAtY', 23011 pointsatz: 'pointsAtZ', 23012 prefix: 'prefix', 23013 preservealpha: 'preserveAlpha', 23014 preserveaspectratio: 'preserveAspectRatio', 23015 primitiveunits: 'primitiveUnits', 23016 property: 'property', 23017 r: 'r', 23018 radius: 'radius', 23019 refx: 'refX', 23020 refy: 'refY', 23021 renderingintent: 'renderingIntent', 23022 'rendering-intent': 'renderingIntent', 23023 repeatcount: 'repeatCount', 23024 repeatdur: 'repeatDur', 23025 requiredextensions: 'requiredExtensions', 23026 requiredfeatures: 'requiredFeatures', 23027 resource: 'resource', 23028 restart: 'restart', 23029 result: 'result', 23030 results: 'results', 23031 rotate: 'rotate', 23032 rx: 'rx', 23033 ry: 'ry', 23034 scale: 'scale', 23035 security: 'security', 23036 seed: 'seed', 23037 shaperendering: 'shapeRendering', 23038 'shape-rendering': 'shapeRendering', 23039 slope: 'slope', 23040 spacing: 'spacing', 23041 specularconstant: 'specularConstant', 23042 specularexponent: 'specularExponent', 23043 speed: 'speed', 23044 spreadmethod: 'spreadMethod', 23045 startoffset: 'startOffset', 23046 stddeviation: 'stdDeviation', 23047 stemh: 'stemh', 23048 stemv: 'stemv', 23049 stitchtiles: 'stitchTiles', 23050 stopcolor: 'stopColor', 23051 'stop-color': 'stopColor', 23052 stopopacity: 'stopOpacity', 23053 'stop-opacity': 'stopOpacity', 23054 strikethroughposition: 'strikethroughPosition', 23055 'strikethrough-position': 'strikethroughPosition', 23056 strikethroughthickness: 'strikethroughThickness', 23057 'strikethrough-thickness': 'strikethroughThickness', 23058 string: 'string', 23059 stroke: 'stroke', 23060 strokedasharray: 'strokeDasharray', 23061 'stroke-dasharray': 'strokeDasharray', 23062 strokedashoffset: 'strokeDashoffset', 23063 'stroke-dashoffset': 'strokeDashoffset', 23064 strokelinecap: 'strokeLinecap', 23065 'stroke-linecap': 'strokeLinecap', 23066 strokelinejoin: 'strokeLinejoin', 23067 'stroke-linejoin': 'strokeLinejoin', 23068 strokemiterlimit: 'strokeMiterlimit', 23069 'stroke-miterlimit': 'strokeMiterlimit', 23070 strokewidth: 'strokeWidth', 23071 'stroke-width': 'strokeWidth', 23072 strokeopacity: 'strokeOpacity', 23073 'stroke-opacity': 'strokeOpacity', 23074 suppresscontenteditablewarning: 'suppressContentEditableWarning', 23075 suppresshydrationwarning: 'suppressHydrationWarning', 23076 surfacescale: 'surfaceScale', 23077 systemlanguage: 'systemLanguage', 23078 tablevalues: 'tableValues', 23079 targetx: 'targetX', 23080 targety: 'targetY', 23081 textanchor: 'textAnchor', 23082 'text-anchor': 'textAnchor', 23083 textdecoration: 'textDecoration', 23084 'text-decoration': 'textDecoration', 23085 textlength: 'textLength', 23086 textrendering: 'textRendering', 23087 'text-rendering': 'textRendering', 23088 to: 'to', 23089 transform: 'transform', 23090 typeof: 'typeof', 23091 u1: 'u1', 23092 u2: 'u2', 23093 underlineposition: 'underlinePosition', 23094 'underline-position': 'underlinePosition', 23095 underlinethickness: 'underlineThickness', 23096 'underline-thickness': 'underlineThickness', 23097 unicode: 'unicode', 23098 unicodebidi: 'unicodeBidi', 23099 'unicode-bidi': 'unicodeBidi', 23100 unicoderange: 'unicodeRange', 23101 'unicode-range': 'unicodeRange', 23102 unitsperem: 'unitsPerEm', 23103 'units-per-em': 'unitsPerEm', 23104 unselectable: 'unselectable', 23105 valphabetic: 'vAlphabetic', 23106 'v-alphabetic': 'vAlphabetic', 23107 values: 'values', 23108 vectoreffect: 'vectorEffect', 23109 'vector-effect': 'vectorEffect', 23110 version: 'version', 23111 vertadvy: 'vertAdvY', 23112 'vert-adv-y': 'vertAdvY', 23113 vertoriginx: 'vertOriginX', 23114 'vert-origin-x': 'vertOriginX', 23115 vertoriginy: 'vertOriginY', 23116 'vert-origin-y': 'vertOriginY', 23117 vhanging: 'vHanging', 23118 'v-hanging': 'vHanging', 23119 videographic: 'vIdeographic', 23120 'v-ideographic': 'vIdeographic', 23121 viewbox: 'viewBox', 23122 viewtarget: 'viewTarget', 23123 visibility: 'visibility', 23124 vmathematical: 'vMathematical', 23125 'v-mathematical': 'vMathematical', 23126 vocab: 'vocab', 23127 widths: 'widths', 23128 wordspacing: 'wordSpacing', 23129 'word-spacing': 'wordSpacing', 23130 writingmode: 'writingMode', 23131 'writing-mode': 'writingMode', 23132 x1: 'x1', 23133 x2: 'x2', 23134 x: 'x', 23135 xchannelselector: 'xChannelSelector', 23136 xheight: 'xHeight', 23137 'x-height': 'xHeight', 23138 xlinkactuate: 'xlinkActuate', 23139 'xlink:actuate': 'xlinkActuate', 23140 xlinkarcrole: 'xlinkArcrole', 23141 'xlink:arcrole': 'xlinkArcrole', 23142 xlinkhref: 'xlinkHref', 23143 'xlink:href': 'xlinkHref', 23144 xlinkrole: 'xlinkRole', 23145 'xlink:role': 'xlinkRole', 23146 xlinkshow: 'xlinkShow', 23147 'xlink:show': 'xlinkShow', 23148 xlinktitle: 'xlinkTitle', 23149 'xlink:title': 'xlinkTitle', 23150 xlinktype: 'xlinkType', 23151 'xlink:type': 'xlinkType', 23152 xmlbase: 'xmlBase', 23153 'xml:base': 'xmlBase', 23154 xmllang: 'xmlLang', 23155 'xml:lang': 'xmlLang', 23156 xmlns: 'xmlns', 23157 'xml:space': 'xmlSpace', 23158 xmlnsxlink: 'xmlnsXlink', 23159 'xmlns:xlink': 'xmlnsXlink', 23160 xmlspace: 'xmlSpace', 23161 y1: 'y1', 23162 y2: 'y2', 23163 y: 'y', 23164 ychannelselector: 'yChannelSelector', 23165 z: 'z', 23166 zoomandpan: 'zoomAndPan' 23167}; 23168 23169var ariaProperties = { 23170 'aria-current': 0, 23171 // state 23172 'aria-description': 0, 23173 'aria-details': 0, 23174 'aria-disabled': 0, 23175 // state 23176 'aria-hidden': 0, 23177 // state 23178 'aria-invalid': 0, 23179 // state 23180 'aria-keyshortcuts': 0, 23181 'aria-label': 0, 23182 'aria-roledescription': 0, 23183 // Widget Attributes 23184 'aria-autocomplete': 0, 23185 'aria-checked': 0, 23186 'aria-expanded': 0, 23187 'aria-haspopup': 0, 23188 'aria-level': 0, 23189 'aria-modal': 0, 23190 'aria-multiline': 0, 23191 'aria-multiselectable': 0, 23192 'aria-orientation': 0, 23193 'aria-placeholder': 0, 23194 'aria-pressed': 0, 23195 'aria-readonly': 0, 23196 'aria-required': 0, 23197 'aria-selected': 0, 23198 'aria-sort': 0, 23199 'aria-valuemax': 0, 23200 'aria-valuemin': 0, 23201 'aria-valuenow': 0, 23202 'aria-valuetext': 0, 23203 // Live Region Attributes 23204 'aria-atomic': 0, 23205 'aria-busy': 0, 23206 'aria-live': 0, 23207 'aria-relevant': 0, 23208 // Drag-and-Drop Attributes 23209 'aria-dropeffect': 0, 23210 'aria-grabbed': 0, 23211 // Relationship Attributes 23212 'aria-activedescendant': 0, 23213 'aria-colcount': 0, 23214 'aria-colindex': 0, 23215 'aria-colspan': 0, 23216 'aria-controls': 0, 23217 'aria-describedby': 0, 23218 'aria-errormessage': 0, 23219 'aria-flowto': 0, 23220 'aria-labelledby': 0, 23221 'aria-owns': 0, 23222 'aria-posinset': 0, 23223 'aria-rowcount': 0, 23224 'aria-rowindex': 0, 23225 'aria-rowspan': 0, 23226 'aria-setsize': 0 23227}; 23228 23229var warnedProperties = {}; 23230var rARIA = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$'); 23231var rARIACamel = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$'); 23232 23233function validateProperty(tagName, name) { 23234 { 23235 if (hasOwnProperty.call(warnedProperties, name) && warnedProperties[name]) { 23236 return true; 23237 } 23238 23239 if (rARIACamel.test(name)) { 23240 var ariaName = 'aria-' + name.slice(4).toLowerCase(); 23241 var correctName = ariaProperties.hasOwnProperty(ariaName) ? ariaName : null; // If this is an aria-* attribute, but is not listed in the known DOM 23242 // DOM properties, then it is an invalid aria-* attribute. 23243 23244 if (correctName == null) { 23245 error('Invalid ARIA attribute `%s`. ARIA attributes follow the pattern aria-* and must be lowercase.', name); 23246 23247 warnedProperties[name] = true; 23248 return true; 23249 } // aria-* attributes should be lowercase; suggest the lowercase version. 23250 23251 23252 if (name !== correctName) { 23253 error('Invalid ARIA attribute `%s`. Did you mean `%s`?', name, correctName); 23254 23255 warnedProperties[name] = true; 23256 return true; 23257 } 23258 } 23259 23260 if (rARIA.test(name)) { 23261 var lowerCasedName = name.toLowerCase(); 23262 var standardName = ariaProperties.hasOwnProperty(lowerCasedName) ? lowerCasedName : null; // If this is an aria-* attribute, but is not listed in the known DOM 23263 // DOM properties, then it is an invalid aria-* attribute. 23264 23265 if (standardName == null) { 23266 warnedProperties[name] = true; 23267 return false; 23268 } // aria-* attributes should be lowercase; suggest the lowercase version. 23269 23270 23271 if (name !== standardName) { 23272 error('Unknown ARIA attribute `%s`. Did you mean `%s`?', name, standardName); 23273 23274 warnedProperties[name] = true; 23275 return true; 23276 } 23277 } 23278 } 23279 23280 return true; 23281} 23282 23283function warnInvalidARIAProps(type, props) { 23284 { 23285 var invalidProps = []; 23286 23287 for (var key in props) { 23288 var isValid = validateProperty(type, key); 23289 23290 if (!isValid) { 23291 invalidProps.push(key); 23292 } 23293 } 23294 23295 var unknownPropString = invalidProps.map(function (prop) { 23296 return '`' + prop + '`'; 23297 }).join(', '); 23298 23299 if (invalidProps.length === 1) { 23300 error('Invalid aria prop %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type); 23301 } else if (invalidProps.length > 1) { 23302 error('Invalid aria props %s on <%s> tag. ' + 'For details, see https://reactjs.org/link/invalid-aria-props', unknownPropString, type); 23303 } 23304 } 23305} 23306 23307function validateProperties(type, props) { 23308 if (isCustomComponent(type, props)) { 23309 return; 23310 } 23311 23312 warnInvalidARIAProps(type, props); 23313} 23314 23315var didWarnValueNull = false; 23316function validateProperties$1(type, props) { 23317 { 23318 if (type !== 'input' && type !== 'textarea' && type !== 'select') { 23319 return; 23320 } 23321 23322 if (props != null && props.value === null && !didWarnValueNull) { 23323 didWarnValueNull = true; 23324 23325 if (type === 'select' && props.multiple) { 23326 error('`value` prop on `%s` should not be null. ' + 'Consider using an empty array when `multiple` is set to `true` ' + 'to clear the component or `undefined` for uncontrolled components.', type); 23327 } else { 23328 error('`value` prop on `%s` should not be null. ' + 'Consider using an empty string to clear the component or `undefined` ' + 'for uncontrolled components.', type); 23329 } 23330 } 23331 } 23332} 23333 23334var validateProperty$1 = function () {}; 23335 23336{ 23337 var warnedProperties$1 = {}; 23338 var EVENT_NAME_REGEX = /^on./; 23339 var INVALID_EVENT_NAME_REGEX = /^on[^A-Z]/; 23340 var rARIA$1 = new RegExp('^(aria)-[' + ATTRIBUTE_NAME_CHAR + ']*$'); 23341 var rARIACamel$1 = new RegExp('^(aria)[A-Z][' + ATTRIBUTE_NAME_CHAR + ']*$'); 23342 23343 validateProperty$1 = function (tagName, name, value, eventRegistry) { 23344 if (hasOwnProperty.call(warnedProperties$1, name) && warnedProperties$1[name]) { 23345 return true; 23346 } 23347 23348 var lowerCasedName = name.toLowerCase(); 23349 23350 if (lowerCasedName === 'onfocusin' || lowerCasedName === 'onfocusout') { 23351 error('React uses onFocus and onBlur instead of onFocusIn and onFocusOut. ' + 'All React events are normalized to bubble, so onFocusIn and onFocusOut ' + 'are not needed/supported by React.'); 23352 23353 warnedProperties$1[name] = true; 23354 return true; 23355 } // We can't rely on the event system being injected on the server. 23356 23357 23358 if (eventRegistry != null) { 23359 var registrationNameDependencies = eventRegistry.registrationNameDependencies, 23360 possibleRegistrationNames = eventRegistry.possibleRegistrationNames; 23361 23362 if (registrationNameDependencies.hasOwnProperty(name)) { 23363 return true; 23364 } 23365 23366 var registrationName = possibleRegistrationNames.hasOwnProperty(lowerCasedName) ? possibleRegistrationNames[lowerCasedName] : null; 23367 23368 if (registrationName != null) { 23369 error('Invalid event handler property `%s`. Did you mean `%s`?', name, registrationName); 23370 23371 warnedProperties$1[name] = true; 23372 return true; 23373 } 23374 23375 if (EVENT_NAME_REGEX.test(name)) { 23376 error('Unknown event handler property `%s`. It will be ignored.', name); 23377 23378 warnedProperties$1[name] = true; 23379 return true; 23380 } 23381 } else if (EVENT_NAME_REGEX.test(name)) { 23382 // If no event plugins have been injected, we are in a server environment. 23383 // So we can't tell if the event name is correct for sure, but we can filter 23384 // out known bad ones like `onclick`. We can't suggest a specific replacement though. 23385 if (INVALID_EVENT_NAME_REGEX.test(name)) { 23386 error('Invalid event handler property `%s`. ' + 'React events use the camelCase naming convention, for example `onClick`.', name); 23387 } 23388 23389 warnedProperties$1[name] = true; 23390 return true; 23391 } // Let the ARIA attribute hook validate ARIA attributes 23392 23393 23394 if (rARIA$1.test(name) || rARIACamel$1.test(name)) { 23395 return true; 23396 } 23397 23398 if (lowerCasedName === 'innerhtml') { 23399 error('Directly setting property `innerHTML` is not permitted. ' + 'For more information, lookup documentation on `dangerouslySetInnerHTML`.'); 23400 23401 warnedProperties$1[name] = true; 23402 return true; 23403 } 23404 23405 if (lowerCasedName === 'aria') { 23406 error('The `aria` attribute is reserved for future use in React. ' + 'Pass individual `aria-` attributes instead.'); 23407 23408 warnedProperties$1[name] = true; 23409 return true; 23410 } 23411 23412 if (lowerCasedName === 'is' && value !== null && value !== undefined && typeof value !== 'string') { 23413 error('Received a `%s` for a string attribute `is`. If this is expected, cast ' + 'the value to a string.', typeof value); 23414 23415 warnedProperties$1[name] = true; 23416 return true; 23417 } 23418 23419 if (typeof value === 'number' && isNaN(value)) { 23420 error('Received NaN for the `%s` attribute. If this is expected, cast ' + 'the value to a string.', name); 23421 23422 warnedProperties$1[name] = true; 23423 return true; 23424 } 23425 23426 var propertyInfo = getPropertyInfo(name); 23427 var isReserved = propertyInfo !== null && propertyInfo.type === RESERVED; // Known attributes should match the casing specified in the property config. 23428 23429 if (possibleStandardNames.hasOwnProperty(lowerCasedName)) { 23430 var standardName = possibleStandardNames[lowerCasedName]; 23431 23432 if (standardName !== name) { 23433 error('Invalid DOM property `%s`. Did you mean `%s`?', name, standardName); 23434 23435 warnedProperties$1[name] = true; 23436 return true; 23437 } 23438 } else if (!isReserved && name !== lowerCasedName) { 23439 // Unknown attributes should have lowercase casing since that's how they 23440 // will be cased anyway with server rendering. 23441 error('React does not recognize the `%s` prop on a DOM element. If you ' + 'intentionally want it to appear in the DOM as a custom ' + 'attribute, spell it as lowercase `%s` instead. ' + 'If you accidentally passed it from a parent component, remove ' + 'it from the DOM element.', name, lowerCasedName); 23442 23443 warnedProperties$1[name] = true; 23444 return true; 23445 } 23446 23447 if (typeof value === 'boolean' && shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) { 23448 if (value) { 23449 error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.', value, name, name, value, name); 23450 } else { 23451 error('Received `%s` for a non-boolean attribute `%s`.\n\n' + 'If you want to write it to the DOM, pass a string instead: ' + '%s="%s" or %s={value.toString()}.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', value, name, name, value, name, name, name); 23452 } 23453 23454 warnedProperties$1[name] = true; 23455 return true; 23456 } // Now that we've validated casing, do not validate 23457 // data types for reserved props 23458 23459 23460 if (isReserved) { 23461 return true; 23462 } // Warn when a known attribute is a bad type 23463 23464 23465 if (shouldRemoveAttributeWithWarning(name, value, propertyInfo, false)) { 23466 warnedProperties$1[name] = true; 23467 return false; 23468 } // Warn when passing the strings 'false' or 'true' into a boolean prop 23469 23470 23471 if ((value === 'false' || value === 'true') && propertyInfo !== null && propertyInfo.type === BOOLEAN) { 23472 error('Received the string `%s` for the boolean attribute `%s`. ' + '%s ' + 'Did you mean %s={%s}?', value, name, value === 'false' ? 'The browser will interpret it as a truthy value.' : 'Although this works, it will not work as expected if you pass the string "false".', name, value); 23473 23474 warnedProperties$1[name] = true; 23475 return true; 23476 } 23477 23478 return true; 23479 }; 23480} 23481 23482var warnUnknownProperties = function (type, props, eventRegistry) { 23483 { 23484 var unknownProps = []; 23485 23486 for (var key in props) { 23487 var isValid = validateProperty$1(type, key, props[key], eventRegistry); 23488 23489 if (!isValid) { 23490 unknownProps.push(key); 23491 } 23492 } 23493 23494 var unknownPropString = unknownProps.map(function (prop) { 23495 return '`' + prop + '`'; 23496 }).join(', '); 23497 23498 if (unknownProps.length === 1) { 23499 error('Invalid value for prop %s on <%s> tag. Either remove it from the element, ' + 'or pass a string or number value to keep it in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type); 23500 } else if (unknownProps.length > 1) { 23501 error('Invalid values for props %s on <%s> tag. Either remove them from the element, ' + 'or pass a string or number value to keep them in the DOM. ' + 'For details, see https://reactjs.org/link/attribute-behavior ', unknownPropString, type); 23502 } 23503 } 23504}; 23505 23506function validateProperties$2(type, props, eventRegistry) { 23507 if (isCustomComponent(type, props)) { 23508 return; 23509 } 23510 23511 warnUnknownProperties(type, props, eventRegistry); 23512} 23513 23514var IS_EVENT_HANDLE_NON_MANAGED_NODE = 1; 23515var IS_NON_DELEGATED = 1 << 1; 23516var IS_CAPTURE_PHASE = 1 << 2; 23517// set to LEGACY_FB_SUPPORT. LEGACY_FB_SUPPORT only gets set when 23518// we call willDeferLaterForLegacyFBSupport, thus not bailing out 23519// will result in endless cycles like an infinite loop. 23520// We also don't want to defer during event replaying. 23521 23522var SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS = IS_EVENT_HANDLE_NON_MANAGED_NODE | IS_NON_DELEGATED | IS_CAPTURE_PHASE; 23523 23524// This exists to avoid circular dependency between ReactDOMEventReplaying 23525// and DOMPluginEventSystem. 23526var currentReplayingEvent = null; 23527function setReplayingEvent(event) { 23528 { 23529 if (currentReplayingEvent !== null) { 23530 error('Expected currently replaying event to be null. This error ' + 'is likely caused by a bug in React. Please file an issue.'); 23531 } 23532 } 23533 23534 currentReplayingEvent = event; 23535} 23536function resetReplayingEvent() { 23537 { 23538 if (currentReplayingEvent === null) { 23539 error('Expected currently replaying event to not be null. This error ' + 'is likely caused by a bug in React. Please file an issue.'); 23540 } 23541 } 23542 23543 currentReplayingEvent = null; 23544} 23545function isReplayingEvent(event) { 23546 return event === currentReplayingEvent; 23547} 23548 23549/** 23550 * Gets the target node from a native browser event by accounting for 23551 * inconsistencies in browser DOM APIs. 23552 * 23553 * @param {object} nativeEvent Native browser event. 23554 * @return {DOMEventTarget} Target node. 23555 */ 23556 23557function getEventTarget(nativeEvent) { 23558 // Fallback to nativeEvent.srcElement for IE9 23559 // https://github.com/facebook/react/issues/12506 23560 var target = nativeEvent.target || nativeEvent.srcElement || window; // Normalize SVG <use> element events #4963 23561 23562 if (target.correspondingUseElement) { 23563 target = target.correspondingUseElement; 23564 } // Safari may fire events on text nodes (Node.TEXT_NODE is 3). 23565 // @see http://www.quirksmode.org/js/events_properties.html 23566 23567 23568 return target.nodeType === TEXT_NODE ? target.parentNode : target; 23569} 23570 23571var restoreImpl = null; 23572var restoreTarget = null; 23573var restoreQueue = null; 23574 23575function restoreStateOfTarget(target) { 23576 // We perform this translation at the end of the event loop so that we 23577 // always receive the correct fiber here 23578 var internalInstance = getInstanceFromNode(target); 23579 23580 if (!internalInstance) { 23581 // Unmounted 23582 return; 23583 } 23584 23585 if (typeof restoreImpl !== 'function') { 23586 throw new Error('setRestoreImplementation() needs to be called to handle a target for controlled ' + 'events. This error is likely caused by a bug in React. Please file an issue.'); 23587 } 23588 23589 var stateNode = internalInstance.stateNode; // Guard against Fiber being unmounted. 23590 23591 if (stateNode) { 23592 var _props = getFiberCurrentPropsFromNode(stateNode); 23593 23594 restoreImpl(internalInstance.stateNode, internalInstance.type, _props); 23595 } 23596} 23597 23598function setRestoreImplementation(impl) { 23599 restoreImpl = impl; 23600} 23601function enqueueStateRestore(target) { 23602 if (restoreTarget) { 23603 if (restoreQueue) { 23604 restoreQueue.push(target); 23605 } else { 23606 restoreQueue = [target]; 23607 } 23608 } else { 23609 restoreTarget = target; 23610 } 23611} 23612function needsStateRestore() { 23613 return restoreTarget !== null || restoreQueue !== null; 23614} 23615function restoreStateIfNeeded() { 23616 if (!restoreTarget) { 23617 return; 23618 } 23619 23620 var target = restoreTarget; 23621 var queuedTargets = restoreQueue; 23622 restoreTarget = null; 23623 restoreQueue = null; 23624 restoreStateOfTarget(target); 23625 23626 if (queuedTargets) { 23627 for (var i = 0; i < queuedTargets.length; i++) { 23628 restoreStateOfTarget(queuedTargets[i]); 23629 } 23630 } 23631} 23632 23633// the renderer. Such as when we're dispatching events or if third party 23634// libraries need to call batchedUpdates. Eventually, this API will go away when 23635// everything is batched by default. We'll then have a similar API to opt-out of 23636// scheduled work and instead do synchronous work. 23637// Defaults 23638 23639var batchedUpdatesImpl = function (fn, bookkeeping) { 23640 return fn(bookkeeping); 23641}; 23642 23643var flushSyncImpl = function () {}; 23644 23645var isInsideEventHandler = false; 23646 23647function finishEventHandler() { 23648 // Here we wait until all updates have propagated, which is important 23649 // when using controlled components within layers: 23650 // https://github.com/facebook/react/issues/1698 23651 // Then we restore state of any controlled component. 23652 var controlledComponentsHavePendingUpdates = needsStateRestore(); 23653 23654 if (controlledComponentsHavePendingUpdates) { 23655 // If a controlled event was fired, we may need to restore the state of 23656 // the DOM node back to the controlled value. This is necessary when React 23657 // bails out of the update without touching the DOM. 23658 // TODO: Restore state in the microtask, after the discrete updates flush, 23659 // instead of early flushing them here. 23660 flushSyncImpl(); 23661 restoreStateIfNeeded(); 23662 } 23663} 23664 23665function batchedUpdates(fn, a, b) { 23666 if (isInsideEventHandler) { 23667 // If we are currently inside another batch, we need to wait until it 23668 // fully completes before restoring state. 23669 return fn(a, b); 23670 } 23671 23672 isInsideEventHandler = true; 23673 23674 try { 23675 return batchedUpdatesImpl(fn, a, b); 23676 } finally { 23677 isInsideEventHandler = false; 23678 finishEventHandler(); 23679 } 23680} // TODO: Replace with flushSync 23681function setBatchingImplementation(_batchedUpdatesImpl, _discreteUpdatesImpl, _flushSyncImpl) { 23682 batchedUpdatesImpl = _batchedUpdatesImpl; 23683 flushSyncImpl = _flushSyncImpl; 23684} 23685 23686function isInteractive(tag) { 23687 return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea'; 23688} 23689 23690function shouldPreventMouseEvent(name, type, props) { 23691 switch (name) { 23692 case 'onClick': 23693 case 'onClickCapture': 23694 case 'onDoubleClick': 23695 case 'onDoubleClickCapture': 23696 case 'onMouseDown': 23697 case 'onMouseDownCapture': 23698 case 'onMouseMove': 23699 case 'onMouseMoveCapture': 23700 case 'onMouseUp': 23701 case 'onMouseUpCapture': 23702 case 'onMouseEnter': 23703 return !!(props.disabled && isInteractive(type)); 23704 23705 default: 23706 return false; 23707 } 23708} 23709/** 23710 * @param {object} inst The instance, which is the source of events. 23711 * @param {string} registrationName Name of listener (e.g. `onClick`). 23712 * @return {?function} The stored callback. 23713 */ 23714 23715 23716function getListener(inst, registrationName) { 23717 var stateNode = inst.stateNode; 23718 23719 if (stateNode === null) { 23720 // Work in progress (ex: onload events in incremental mode). 23721 return null; 23722 } 23723 23724 var props = getFiberCurrentPropsFromNode(stateNode); 23725 23726 if (props === null) { 23727 // Work in progress. 23728 return null; 23729 } 23730 23731 var listener = props[registrationName]; 23732 23733 if (shouldPreventMouseEvent(registrationName, inst.type, props)) { 23734 return null; 23735 } 23736 23737 if (listener && typeof listener !== 'function') { 23738 throw new Error("Expected `" + registrationName + "` listener to be a function, instead got a value of `" + typeof listener + "` type."); 23739 } 23740 23741 return listener; 23742} 23743 23744var passiveBrowserEventsSupported = false; // Check if browser support events with passive listeners 23745// https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Safely_detecting_option_support 23746 23747if (canUseDOM) { 23748 try { 23749 var options = {}; // $FlowFixMe: Ignore Flow complaining about needing a value 23750 23751 Object.defineProperty(options, 'passive', { 23752 get: function () { 23753 passiveBrowserEventsSupported = true; 23754 } 23755 }); 23756 window.addEventListener('test', options, options); 23757 window.removeEventListener('test', options, options); 23758 } catch (e) { 23759 passiveBrowserEventsSupported = false; 23760 } 23761} 23762 23763function invokeGuardedCallbackProd(name, func, context, a, b, c, d, e, f) { 23764 var funcArgs = Array.prototype.slice.call(arguments, 3); 23765 23766 try { 23767 func.apply(context, funcArgs); 23768 } catch (error) { 23769 this.onError(error); 23770 } 23771} 23772 23773var invokeGuardedCallbackImpl = invokeGuardedCallbackProd; 23774 23775{ 23776 // In DEV mode, we swap out invokeGuardedCallback for a special version 23777 // that plays more nicely with the browser's DevTools. The idea is to preserve 23778 // "Pause on exceptions" behavior. Because React wraps all user-provided 23779 // functions in invokeGuardedCallback, and the production version of 23780 // invokeGuardedCallback uses a try-catch, all user exceptions are treated 23781 // like caught exceptions, and the DevTools won't pause unless the developer 23782 // takes the extra step of enabling pause on caught exceptions. This is 23783 // unintuitive, though, because even though React has caught the error, from 23784 // the developer's perspective, the error is uncaught. 23785 // 23786 // To preserve the expected "Pause on exceptions" behavior, we don't use a 23787 // try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake 23788 // DOM node, and call the user-provided callback from inside an event handler 23789 // for that fake event. If the callback throws, the error is "captured" using 23790 // a global event handler. But because the error happens in a different 23791 // event loop context, it does not interrupt the normal program flow. 23792 // Effectively, this gives us try-catch behavior without actually using 23793 // try-catch. Neat! 23794 // Check that the browser supports the APIs we need to implement our special 23795 // DEV version of invokeGuardedCallback 23796 if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') { 23797 var fakeNode = document.createElement('react'); 23798 23799 invokeGuardedCallbackImpl = function invokeGuardedCallbackDev(name, func, context, a, b, c, d, e, f) { 23800 // If document doesn't exist we know for sure we will crash in this method 23801 // when we call document.createEvent(). However this can cause confusing 23802 // errors: https://github.com/facebook/create-react-app/issues/3482 23803 // So we preemptively throw with a better message instead. 23804 if (typeof document === 'undefined' || document === null) { 23805 throw new Error('The `document` global was defined when React was initialized, but is not ' + 'defined anymore. This can happen in a test environment if a component ' + 'schedules an update from an asynchronous callback, but the test has already ' + 'finished running. To solve this, you can either unmount the component at ' + 'the end of your test (and ensure that any asynchronous operations get ' + 'canceled in `componentWillUnmount`), or you can change the test itself ' + 'to be asynchronous.'); 23806 } 23807 23808 var evt = document.createEvent('Event'); 23809 var didCall = false; // Keeps track of whether the user-provided callback threw an error. We 23810 // set this to true at the beginning, then set it to false right after 23811 // calling the function. If the function errors, `didError` will never be 23812 // set to false. This strategy works even if the browser is flaky and 23813 // fails to call our global error handler, because it doesn't rely on 23814 // the error event at all. 23815 23816 var didError = true; // Keeps track of the value of window.event so that we can reset it 23817 // during the callback to let user code access window.event in the 23818 // browsers that support it. 23819 23820 var windowEvent = window.event; // Keeps track of the descriptor of window.event to restore it after event 23821 // dispatching: https://github.com/facebook/react/issues/13688 23822 23823 var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event'); 23824 23825 function restoreAfterDispatch() { 23826 // We immediately remove the callback from event listeners so that 23827 // nested `invokeGuardedCallback` calls do not clash. Otherwise, a 23828 // nested call would trigger the fake event handlers of any call higher 23829 // in the stack. 23830 fakeNode.removeEventListener(evtType, callCallback, false); // We check for window.hasOwnProperty('event') to prevent the 23831 // window.event assignment in both IE <= 10 as they throw an error 23832 // "Member not found" in strict mode, and in Firefox which does not 23833 // support window.event. 23834 23835 if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) { 23836 window.event = windowEvent; 23837 } 23838 } // Create an event handler for our fake event. We will synchronously 23839 // dispatch our fake event using `dispatchEvent`. Inside the handler, we 23840 // call the user-provided callback. 23841 23842 23843 var funcArgs = Array.prototype.slice.call(arguments, 3); 23844 23845 function callCallback() { 23846 didCall = true; 23847 restoreAfterDispatch(); 23848 func.apply(context, funcArgs); 23849 didError = false; 23850 } // Create a global error event handler. We use this to capture the value 23851 // that was thrown. It's possible that this error handler will fire more 23852 // than once; for example, if non-React code also calls `dispatchEvent` 23853 // and a handler for that event throws. We should be resilient to most of 23854 // those cases. Even if our error event handler fires more than once, the 23855 // last error event is always used. If the callback actually does error, 23856 // we know that the last error event is the correct one, because it's not 23857 // possible for anything else to have happened in between our callback 23858 // erroring and the code that follows the `dispatchEvent` call below. If 23859 // the callback doesn't error, but the error event was fired, we know to 23860 // ignore it because `didError` will be false, as described above. 23861 23862 23863 var error; // Use this to track whether the error event is ever called. 23864 23865 var didSetError = false; 23866 var isCrossOriginError = false; 23867 23868 function handleWindowError(event) { 23869 error = event.error; 23870 didSetError = true; 23871 23872 if (error === null && event.colno === 0 && event.lineno === 0) { 23873 isCrossOriginError = true; 23874 } 23875 23876 if (event.defaultPrevented) { 23877 // Some other error handler has prevented default. 23878 // Browsers silence the error report if this happens. 23879 // We'll remember this to later decide whether to log it or not. 23880 if (error != null && typeof error === 'object') { 23881 try { 23882 error._suppressLogging = true; 23883 } catch (inner) {// Ignore. 23884 } 23885 } 23886 } 23887 } // Create a fake event type. 23888 23889 23890 var evtType = "react-" + (name ? name : 'invokeguardedcallback'); // Attach our event handlers 23891 23892 window.addEventListener('error', handleWindowError); 23893 fakeNode.addEventListener(evtType, callCallback, false); // Synchronously dispatch our fake event. If the user-provided function 23894 // errors, it will trigger our global error handler. 23895 23896 evt.initEvent(evtType, false, false); 23897 fakeNode.dispatchEvent(evt); 23898 23899 if (windowEventDescriptor) { 23900 Object.defineProperty(window, 'event', windowEventDescriptor); 23901 } 23902 23903 if (didCall && didError) { 23904 if (!didSetError) { 23905 // The callback errored, but the error event never fired. 23906 // eslint-disable-next-line react-internal/prod-error-codes 23907 error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.'); 23908 } else if (isCrossOriginError) { 23909 // eslint-disable-next-line react-internal/prod-error-codes 23910 error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://reactjs.org/link/crossorigin-error for more information.'); 23911 } 23912 23913 this.onError(error); 23914 } // Remove our event listeners 23915 23916 23917 window.removeEventListener('error', handleWindowError); 23918 23919 if (!didCall) { 23920 // Something went really wrong, and our event was not dispatched. 23921 // https://github.com/facebook/react/issues/16734 23922 // https://github.com/facebook/react/issues/16585 23923 // Fall back to the production implementation. 23924 restoreAfterDispatch(); 23925 return invokeGuardedCallbackProd.apply(this, arguments); 23926 } 23927 }; 23928 } 23929} 23930 23931var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl; 23932 23933var hasError = false; 23934var caughtError = null; // Used by event system to capture/rethrow the first error. 23935 23936var hasRethrowError = false; 23937var rethrowError = null; 23938var reporter = { 23939 onError: function (error) { 23940 hasError = true; 23941 caughtError = error; 23942 } 23943}; 23944/** 23945 * Call a function while guarding against errors that happens within it. 23946 * Returns an error if it throws, otherwise null. 23947 * 23948 * In production, this is implemented using a try-catch. The reason we don't 23949 * use a try-catch directly is so that we can swap out a different 23950 * implementation in DEV mode. 23951 * 23952 * @param {String} name of the guard to use for logging or debugging 23953 * @param {Function} func The function to invoke 23954 * @param {*} context The context to use when calling the function 23955 * @param {...*} args Arguments for function 23956 */ 23957 23958function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) { 23959 hasError = false; 23960 caughtError = null; 23961 invokeGuardedCallbackImpl$1.apply(reporter, arguments); 23962} 23963/** 23964 * Same as invokeGuardedCallback, but instead of returning an error, it stores 23965 * it in a global so it can be rethrown by `rethrowCaughtError` later. 23966 * TODO: See if caughtError and rethrowError can be unified. 23967 * 23968 * @param {String} name of the guard to use for logging or debugging 23969 * @param {Function} func The function to invoke 23970 * @param {*} context The context to use when calling the function 23971 * @param {...*} args Arguments for function 23972 */ 23973 23974function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) { 23975 invokeGuardedCallback.apply(this, arguments); 23976 23977 if (hasError) { 23978 var error = clearCaughtError(); 23979 23980 if (!hasRethrowError) { 23981 hasRethrowError = true; 23982 rethrowError = error; 23983 } 23984 } 23985} 23986/** 23987 * During execution of guarded functions we will capture the first error which 23988 * we will rethrow to be handled by the top level error handler. 23989 */ 23990 23991function rethrowCaughtError() { 23992 if (hasRethrowError) { 23993 var error = rethrowError; 23994 hasRethrowError = false; 23995 rethrowError = null; 23996 throw error; 23997 } 23998} 23999function hasCaughtError() { 24000 return hasError; 24001} 24002function clearCaughtError() { 24003 if (hasError) { 24004 var error = caughtError; 24005 hasError = false; 24006 caughtError = null; 24007 return error; 24008 } else { 24009 throw new Error('clearCaughtError was called but no error was captured. This error ' + 'is likely caused by a bug in React. Please file an issue.'); 24010 } 24011} 24012 24013/** 24014 * `ReactInstanceMap` maintains a mapping from a public facing stateful 24015 * instance (key) and the internal representation (value). This allows public 24016 * methods to accept the user facing instance as an argument and map them back 24017 * to internal methods. 24018 * 24019 * Note that this module is currently shared and assumed to be stateless. 24020 * If this becomes an actual Map, that will break. 24021 */ 24022function get(key) { 24023 return key._reactInternals; 24024} 24025function has(key) { 24026 return key._reactInternals !== undefined; 24027} 24028function set(key, value) { 24029 key._reactInternals = value; 24030} 24031 24032// Don't change these two values. They're used by React Dev Tools. 24033var NoFlags = 24034/* */ 240350; 24036var PerformedWork = 24037/* */ 240381; // You can change the rest (and add more). 24039 24040var Placement = 24041/* */ 240422; 24043var Update = 24044/* */ 240454; 24046var ChildDeletion = 24047/* */ 2404816; 24049var ContentReset = 24050/* */ 2405132; 24052var Callback = 24053/* */ 2405464; 24055var DidCapture = 24056/* */ 24057128; 24058var ForceClientRender = 24059/* */ 24060256; 24061var Ref = 24062/* */ 24063512; 24064var Snapshot = 24065/* */ 240661024; 24067var Passive = 24068/* */ 240692048; 24070var Hydrating = 24071/* */ 240724096; 24073var Visibility = 24074/* */ 240758192; 24076var StoreConsistency = 24077/* */ 2407816384; 24079var LifecycleEffectMask = Passive | Update | Callback | Ref | Snapshot | StoreConsistency; // Union of all commit flags (flags with the lifetime of a particular commit) 24080 24081var HostEffectMask = 24082/* */ 2408332767; // These are not really side effects, but we still reuse this field. 24084 24085var Incomplete = 24086/* */ 2408732768; 24088var ShouldCapture = 24089/* */ 2409065536; 24091var ForceUpdateForLegacySuspense = 24092/* */ 24093131072; 24094var Forked = 24095/* */ 240961048576; // Static tags describe aspects of a fiber that are not specific to a render, 24097// e.g. a fiber uses a passive effect (even if there are no updates on this particular render). 24098// This enables us to defer more work in the unmount case, 24099// since we can defer traversing the tree during layout to look for Passive effects, 24100// and instead rely on the static flag as a signal that there may be cleanup work. 24101 24102var RefStatic = 24103/* */ 241042097152; 24105var LayoutStatic = 24106/* */ 241074194304; 24108var PassiveStatic = 24109/* */ 241108388608; // These flags allow us to traverse to fibers that have effects on mount 24111// without traversing the entire tree after every commit for 24112// double invoking 24113 24114var MountLayoutDev = 24115/* */ 2411616777216; 24117var MountPassiveDev = 24118/* */ 2411933554432; // Groups of flags that are used in the commit phase to skip over trees that 24120// don't contain effects, by checking subtreeFlags. 24121 24122var BeforeMutationMask = // TODO: Remove Update flag from before mutation phase by re-landing Visibility 24123// flag logic (see #20043) 24124Update | Snapshot | ( 0); 24125var MutationMask = Placement | Update | ChildDeletion | ContentReset | Ref | Hydrating | Visibility; 24126var LayoutMask = Update | Callback | Ref | Visibility; // TODO: Split into PassiveMountMask and PassiveUnmountMask 24127 24128var PassiveMask = Passive | ChildDeletion; // Union of tags that don't get reset on clones. 24129// This allows certain concepts to persist without recalculating them, 24130// e.g. whether a subtree contains passive effects or portals. 24131 24132var StaticMask = LayoutStatic | PassiveStatic | RefStatic; 24133 24134var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; 24135function getNearestMountedFiber(fiber) { 24136 var node = fiber; 24137 var nearestMounted = fiber; 24138 24139 if (!fiber.alternate) { 24140 // If there is no alternate, this might be a new tree that isn't inserted 24141 // yet. If it is, then it will have a pending insertion effect on it. 24142 var nextNode = node; 24143 24144 do { 24145 node = nextNode; 24146 24147 if ((node.flags & (Placement | Hydrating)) !== NoFlags) { 24148 // This is an insertion or in-progress hydration. The nearest possible 24149 // mounted fiber is the parent but we need to continue to figure out 24150 // if that one is still mounted. 24151 nearestMounted = node.return; 24152 } 24153 24154 nextNode = node.return; 24155 } while (nextNode); 24156 } else { 24157 while (node.return) { 24158 node = node.return; 24159 } 24160 } 24161 24162 if (node.tag === HostRoot) { 24163 // TODO: Check if this was a nested HostRoot when used with 24164 // renderContainerIntoSubtree. 24165 return nearestMounted; 24166 } // If we didn't hit the root, that means that we're in an disconnected tree 24167 // that has been unmounted. 24168 24169 24170 return null; 24171} 24172function getSuspenseInstanceFromFiber(fiber) { 24173 if (fiber.tag === SuspenseComponent) { 24174 var suspenseState = fiber.memoizedState; 24175 24176 if (suspenseState === null) { 24177 var current = fiber.alternate; 24178 24179 if (current !== null) { 24180 suspenseState = current.memoizedState; 24181 } 24182 } 24183 24184 if (suspenseState !== null) { 24185 return suspenseState.dehydrated; 24186 } 24187 } 24188 24189 return null; 24190} 24191function getContainerFromFiber(fiber) { 24192 return fiber.tag === HostRoot ? fiber.stateNode.containerInfo : null; 24193} 24194function isFiberMounted(fiber) { 24195 return getNearestMountedFiber(fiber) === fiber; 24196} 24197function isMounted(component) { 24198 { 24199 var owner = ReactCurrentOwner.current; 24200 24201 if (owner !== null && owner.tag === ClassComponent) { 24202 var ownerFiber = owner; 24203 var instance = ownerFiber.stateNode; 24204 24205 if (!instance._warnedAboutRefsInRender) { 24206 error('%s is accessing isMounted inside its render() function. ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromFiber(ownerFiber) || 'A component'); 24207 } 24208 24209 instance._warnedAboutRefsInRender = true; 24210 } 24211 } 24212 24213 var fiber = get(component); 24214 24215 if (!fiber) { 24216 return false; 24217 } 24218 24219 return getNearestMountedFiber(fiber) === fiber; 24220} 24221 24222function assertIsMounted(fiber) { 24223 if (getNearestMountedFiber(fiber) !== fiber) { 24224 throw new Error('Unable to find node on an unmounted component.'); 24225 } 24226} 24227 24228function findCurrentFiberUsingSlowPath(fiber) { 24229 var alternate = fiber.alternate; 24230 24231 if (!alternate) { 24232 // If there is no alternate, then we only need to check if it is mounted. 24233 var nearestMounted = getNearestMountedFiber(fiber); 24234 24235 if (nearestMounted === null) { 24236 throw new Error('Unable to find node on an unmounted component.'); 24237 } 24238 24239 if (nearestMounted !== fiber) { 24240 return null; 24241 } 24242 24243 return fiber; 24244 } // If we have two possible branches, we'll walk backwards up to the root 24245 // to see what path the root points to. On the way we may hit one of the 24246 // special cases and we'll deal with them. 24247 24248 24249 var a = fiber; 24250 var b = alternate; 24251 24252 while (true) { 24253 var parentA = a.return; 24254 24255 if (parentA === null) { 24256 // We're at the root. 24257 break; 24258 } 24259 24260 var parentB = parentA.alternate; 24261 24262 if (parentB === null) { 24263 // There is no alternate. This is an unusual case. Currently, it only 24264 // happens when a Suspense component is hidden. An extra fragment fiber 24265 // is inserted in between the Suspense fiber and its children. Skip 24266 // over this extra fragment fiber and proceed to the next parent. 24267 var nextParent = parentA.return; 24268 24269 if (nextParent !== null) { 24270 a = b = nextParent; 24271 continue; 24272 } // If there's no parent, we're at the root. 24273 24274 24275 break; 24276 } // If both copies of the parent fiber point to the same child, we can 24277 // assume that the child is current. This happens when we bailout on low 24278 // priority: the bailed out fiber's child reuses the current child. 24279 24280 24281 if (parentA.child === parentB.child) { 24282 var child = parentA.child; 24283 24284 while (child) { 24285 if (child === a) { 24286 // We've determined that A is the current branch. 24287 assertIsMounted(parentA); 24288 return fiber; 24289 } 24290 24291 if (child === b) { 24292 // We've determined that B is the current branch. 24293 assertIsMounted(parentA); 24294 return alternate; 24295 } 24296 24297 child = child.sibling; 24298 } // We should never have an alternate for any mounting node. So the only 24299 // way this could possibly happen is if this was unmounted, if at all. 24300 24301 24302 throw new Error('Unable to find node on an unmounted component.'); 24303 } 24304 24305 if (a.return !== b.return) { 24306 // The return pointer of A and the return pointer of B point to different 24307 // fibers. We assume that return pointers never criss-cross, so A must 24308 // belong to the child set of A.return, and B must belong to the child 24309 // set of B.return. 24310 a = parentA; 24311 b = parentB; 24312 } else { 24313 // The return pointers point to the same fiber. We'll have to use the 24314 // default, slow path: scan the child sets of each parent alternate to see 24315 // which child belongs to which set. 24316 // 24317 // Search parent A's child set 24318 var didFindChild = false; 24319 var _child = parentA.child; 24320 24321 while (_child) { 24322 if (_child === a) { 24323 didFindChild = true; 24324 a = parentA; 24325 b = parentB; 24326 break; 24327 } 24328 24329 if (_child === b) { 24330 didFindChild = true; 24331 b = parentA; 24332 a = parentB; 24333 break; 24334 } 24335 24336 _child = _child.sibling; 24337 } 24338 24339 if (!didFindChild) { 24340 // Search parent B's child set 24341 _child = parentB.child; 24342 24343 while (_child) { 24344 if (_child === a) { 24345 didFindChild = true; 24346 a = parentB; 24347 b = parentA; 24348 break; 24349 } 24350 24351 if (_child === b) { 24352 didFindChild = true; 24353 b = parentB; 24354 a = parentA; 24355 break; 24356 } 24357 24358 _child = _child.sibling; 24359 } 24360 24361 if (!didFindChild) { 24362 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.'); 24363 } 24364 } 24365 } 24366 24367 if (a.alternate !== b) { 24368 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.'); 24369 } 24370 } // If the root is not a host container, we're in a disconnected tree. I.e. 24371 // unmounted. 24372 24373 24374 if (a.tag !== HostRoot) { 24375 throw new Error('Unable to find node on an unmounted component.'); 24376 } 24377 24378 if (a.stateNode.current === a) { 24379 // We've determined that A is the current branch. 24380 return fiber; 24381 } // Otherwise B has to be current branch. 24382 24383 24384 return alternate; 24385} 24386function findCurrentHostFiber(parent) { 24387 var currentParent = findCurrentFiberUsingSlowPath(parent); 24388 return currentParent !== null ? findCurrentHostFiberImpl(currentParent) : null; 24389} 24390 24391function findCurrentHostFiberImpl(node) { 24392 // Next we'll drill down this component to find the first HostComponent/Text. 24393 if (node.tag === HostComponent || node.tag === HostText) { 24394 return node; 24395 } 24396 24397 var child = node.child; 24398 24399 while (child !== null) { 24400 var match = findCurrentHostFiberImpl(child); 24401 24402 if (match !== null) { 24403 return match; 24404 } 24405 24406 child = child.sibling; 24407 } 24408 24409 return null; 24410} 24411 24412function findCurrentHostFiberWithNoPortals(parent) { 24413 var currentParent = findCurrentFiberUsingSlowPath(parent); 24414 return currentParent !== null ? findCurrentHostFiberWithNoPortalsImpl(currentParent) : null; 24415} 24416 24417function findCurrentHostFiberWithNoPortalsImpl(node) { 24418 // Next we'll drill down this component to find the first HostComponent/Text. 24419 if (node.tag === HostComponent || node.tag === HostText) { 24420 return node; 24421 } 24422 24423 var child = node.child; 24424 24425 while (child !== null) { 24426 if (child.tag !== HostPortal) { 24427 var match = findCurrentHostFiberWithNoPortalsImpl(child); 24428 24429 if (match !== null) { 24430 return match; 24431 } 24432 } 24433 24434 child = child.sibling; 24435 } 24436 24437 return null; 24438} 24439 24440// This module only exists as an ESM wrapper around the external CommonJS 24441var scheduleCallback = Scheduler.unstable_scheduleCallback; 24442var cancelCallback = Scheduler.unstable_cancelCallback; 24443var shouldYield = Scheduler.unstable_shouldYield; 24444var requestPaint = Scheduler.unstable_requestPaint; 24445var now = Scheduler.unstable_now; 24446var getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel; 24447var ImmediatePriority = Scheduler.unstable_ImmediatePriority; 24448var UserBlockingPriority = Scheduler.unstable_UserBlockingPriority; 24449var NormalPriority = Scheduler.unstable_NormalPriority; 24450var LowPriority = Scheduler.unstable_LowPriority; 24451var IdlePriority = Scheduler.unstable_IdlePriority; 24452// this doesn't actually exist on the scheduler, but it *does* 24453// on scheduler/unstable_mock, which we'll need for internal testing 24454var unstable_yieldValue = Scheduler.unstable_yieldValue; 24455var unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue; 24456 24457var rendererID = null; 24458var injectedHook = null; 24459var injectedProfilingHooks = null; 24460var hasLoggedError = false; 24461var isDevToolsPresent = typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined'; 24462function injectInternals(internals) { 24463 if (typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined') { 24464 // No DevTools 24465 return false; 24466 } 24467 24468 var hook = __REACT_DEVTOOLS_GLOBAL_HOOK__; 24469 24470 if (hook.isDisabled) { 24471 // This isn't a real property on the hook, but it can be set to opt out 24472 // of DevTools integration and associated warnings and logs. 24473 // https://github.com/facebook/react/issues/3877 24474 return true; 24475 } 24476 24477 if (!hook.supportsFiber) { 24478 { 24479 error('The installed version of React DevTools is too old and will not work ' + 'with the current version of React. Please update React DevTools. ' + 'https://reactjs.org/link/react-devtools'); 24480 } // DevTools exists, even though it doesn't support Fiber. 24481 24482 24483 return true; 24484 } 24485 24486 try { 24487 if (enableSchedulingProfiler) { 24488 // Conditionally inject these hooks only if Timeline profiler is supported by this build. 24489 // This gives DevTools a way to feature detect that isn't tied to version number 24490 // (since profiling and timeline are controlled by different feature flags). 24491 internals = assign({}, internals, { 24492 getLaneLabelMap: getLaneLabelMap, 24493 injectProfilingHooks: injectProfilingHooks 24494 }); 24495 } 24496 24497 rendererID = hook.inject(internals); // We have successfully injected, so now it is safe to set up hooks. 24498 24499 injectedHook = hook; 24500 } catch (err) { 24501 // Catch all errors because it is unsafe to throw during initialization. 24502 { 24503 error('React instrumentation encountered an error: %s.', err); 24504 } 24505 } 24506 24507 if (hook.checkDCE) { 24508 // This is the real DevTools. 24509 return true; 24510 } else { 24511 // This is likely a hook installed by Fast Refresh runtime. 24512 return false; 24513 } 24514} 24515function onScheduleRoot(root, children) { 24516 { 24517 if (injectedHook && typeof injectedHook.onScheduleFiberRoot === 'function') { 24518 try { 24519 injectedHook.onScheduleFiberRoot(rendererID, root, children); 24520 } catch (err) { 24521 if ( !hasLoggedError) { 24522 hasLoggedError = true; 24523 24524 error('React instrumentation encountered an error: %s', err); 24525 } 24526 } 24527 } 24528 } 24529} 24530function onCommitRoot(root, eventPriority) { 24531 if (injectedHook && typeof injectedHook.onCommitFiberRoot === 'function') { 24532 try { 24533 var didError = (root.current.flags & DidCapture) === DidCapture; 24534 24535 if (enableProfilerTimer) { 24536 var schedulerPriority; 24537 24538 switch (eventPriority) { 24539 case DiscreteEventPriority: 24540 schedulerPriority = ImmediatePriority; 24541 break; 24542 24543 case ContinuousEventPriority: 24544 schedulerPriority = UserBlockingPriority; 24545 break; 24546 24547 case DefaultEventPriority: 24548 schedulerPriority = NormalPriority; 24549 break; 24550 24551 case IdleEventPriority: 24552 schedulerPriority = IdlePriority; 24553 break; 24554 24555 default: 24556 schedulerPriority = NormalPriority; 24557 break; 24558 } 24559 24560 injectedHook.onCommitFiberRoot(rendererID, root, schedulerPriority, didError); 24561 } else { 24562 injectedHook.onCommitFiberRoot(rendererID, root, undefined, didError); 24563 } 24564 } catch (err) { 24565 { 24566 if (!hasLoggedError) { 24567 hasLoggedError = true; 24568 24569 error('React instrumentation encountered an error: %s', err); 24570 } 24571 } 24572 } 24573 } 24574} 24575function onPostCommitRoot(root) { 24576 if (injectedHook && typeof injectedHook.onPostCommitFiberRoot === 'function') { 24577 try { 24578 injectedHook.onPostCommitFiberRoot(rendererID, root); 24579 } catch (err) { 24580 { 24581 if (!hasLoggedError) { 24582 hasLoggedError = true; 24583 24584 error('React instrumentation encountered an error: %s', err); 24585 } 24586 } 24587 } 24588 } 24589} 24590function onCommitUnmount(fiber) { 24591 if (injectedHook && typeof injectedHook.onCommitFiberUnmount === 'function') { 24592 try { 24593 injectedHook.onCommitFiberUnmount(rendererID, fiber); 24594 } catch (err) { 24595 { 24596 if (!hasLoggedError) { 24597 hasLoggedError = true; 24598 24599 error('React instrumentation encountered an error: %s', err); 24600 } 24601 } 24602 } 24603 } 24604} 24605function setIsStrictModeForDevtools(newIsStrictMode) { 24606 { 24607 if (typeof unstable_yieldValue === 'function') { 24608 // We're in a test because Scheduler.unstable_yieldValue only exists 24609 // in SchedulerMock. To reduce the noise in strict mode tests, 24610 // suppress warnings and disable scheduler yielding during the double render 24611 unstable_setDisableYieldValue(newIsStrictMode); 24612 setSuppressWarning(newIsStrictMode); 24613 } 24614 24615 if (injectedHook && typeof injectedHook.setStrictMode === 'function') { 24616 try { 24617 injectedHook.setStrictMode(rendererID, newIsStrictMode); 24618 } catch (err) { 24619 { 24620 if (!hasLoggedError) { 24621 hasLoggedError = true; 24622 24623 error('React instrumentation encountered an error: %s', err); 24624 } 24625 } 24626 } 24627 } 24628 } 24629} // Profiler API hooks 24630 24631function injectProfilingHooks(profilingHooks) { 24632 injectedProfilingHooks = profilingHooks; 24633} 24634 24635function getLaneLabelMap() { 24636 { 24637 var map = new Map(); 24638 var lane = 1; 24639 24640 for (var index = 0; index < TotalLanes; index++) { 24641 var label = getLabelForLane(lane); 24642 map.set(lane, label); 24643 lane *= 2; 24644 } 24645 24646 return map; 24647 } 24648} 24649 24650function markCommitStarted(lanes) { 24651 { 24652 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStarted === 'function') { 24653 injectedProfilingHooks.markCommitStarted(lanes); 24654 } 24655 } 24656} 24657function markCommitStopped() { 24658 { 24659 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markCommitStopped === 'function') { 24660 injectedProfilingHooks.markCommitStopped(); 24661 } 24662 } 24663} 24664function markComponentRenderStarted(fiber) { 24665 { 24666 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStarted === 'function') { 24667 injectedProfilingHooks.markComponentRenderStarted(fiber); 24668 } 24669 } 24670} 24671function markComponentRenderStopped() { 24672 { 24673 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentRenderStopped === 'function') { 24674 injectedProfilingHooks.markComponentRenderStopped(); 24675 } 24676 } 24677} 24678function markComponentPassiveEffectMountStarted(fiber) { 24679 { 24680 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStarted === 'function') { 24681 injectedProfilingHooks.markComponentPassiveEffectMountStarted(fiber); 24682 } 24683 } 24684} 24685function markComponentPassiveEffectMountStopped() { 24686 { 24687 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectMountStopped === 'function') { 24688 injectedProfilingHooks.markComponentPassiveEffectMountStopped(); 24689 } 24690 } 24691} 24692function markComponentPassiveEffectUnmountStarted(fiber) { 24693 { 24694 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStarted === 'function') { 24695 injectedProfilingHooks.markComponentPassiveEffectUnmountStarted(fiber); 24696 } 24697 } 24698} 24699function markComponentPassiveEffectUnmountStopped() { 24700 { 24701 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentPassiveEffectUnmountStopped === 'function') { 24702 injectedProfilingHooks.markComponentPassiveEffectUnmountStopped(); 24703 } 24704 } 24705} 24706function markComponentLayoutEffectMountStarted(fiber) { 24707 { 24708 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStarted === 'function') { 24709 injectedProfilingHooks.markComponentLayoutEffectMountStarted(fiber); 24710 } 24711 } 24712} 24713function markComponentLayoutEffectMountStopped() { 24714 { 24715 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectMountStopped === 'function') { 24716 injectedProfilingHooks.markComponentLayoutEffectMountStopped(); 24717 } 24718 } 24719} 24720function markComponentLayoutEffectUnmountStarted(fiber) { 24721 { 24722 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStarted === 'function') { 24723 injectedProfilingHooks.markComponentLayoutEffectUnmountStarted(fiber); 24724 } 24725 } 24726} 24727function markComponentLayoutEffectUnmountStopped() { 24728 { 24729 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentLayoutEffectUnmountStopped === 'function') { 24730 injectedProfilingHooks.markComponentLayoutEffectUnmountStopped(); 24731 } 24732 } 24733} 24734function markComponentErrored(fiber, thrownValue, lanes) { 24735 { 24736 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentErrored === 'function') { 24737 injectedProfilingHooks.markComponentErrored(fiber, thrownValue, lanes); 24738 } 24739 } 24740} 24741function markComponentSuspended(fiber, wakeable, lanes) { 24742 { 24743 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markComponentSuspended === 'function') { 24744 injectedProfilingHooks.markComponentSuspended(fiber, wakeable, lanes); 24745 } 24746 } 24747} 24748function markLayoutEffectsStarted(lanes) { 24749 { 24750 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStarted === 'function') { 24751 injectedProfilingHooks.markLayoutEffectsStarted(lanes); 24752 } 24753 } 24754} 24755function markLayoutEffectsStopped() { 24756 { 24757 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markLayoutEffectsStopped === 'function') { 24758 injectedProfilingHooks.markLayoutEffectsStopped(); 24759 } 24760 } 24761} 24762function markPassiveEffectsStarted(lanes) { 24763 { 24764 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStarted === 'function') { 24765 injectedProfilingHooks.markPassiveEffectsStarted(lanes); 24766 } 24767 } 24768} 24769function markPassiveEffectsStopped() { 24770 { 24771 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markPassiveEffectsStopped === 'function') { 24772 injectedProfilingHooks.markPassiveEffectsStopped(); 24773 } 24774 } 24775} 24776function markRenderStarted(lanes) { 24777 { 24778 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStarted === 'function') { 24779 injectedProfilingHooks.markRenderStarted(lanes); 24780 } 24781 } 24782} 24783function markRenderYielded() { 24784 { 24785 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderYielded === 'function') { 24786 injectedProfilingHooks.markRenderYielded(); 24787 } 24788 } 24789} 24790function markRenderStopped() { 24791 { 24792 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderStopped === 'function') { 24793 injectedProfilingHooks.markRenderStopped(); 24794 } 24795 } 24796} 24797function markRenderScheduled(lane) { 24798 { 24799 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markRenderScheduled === 'function') { 24800 injectedProfilingHooks.markRenderScheduled(lane); 24801 } 24802 } 24803} 24804function markForceUpdateScheduled(fiber, lane) { 24805 { 24806 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markForceUpdateScheduled === 'function') { 24807 injectedProfilingHooks.markForceUpdateScheduled(fiber, lane); 24808 } 24809 } 24810} 24811function markStateUpdateScheduled(fiber, lane) { 24812 { 24813 if (injectedProfilingHooks !== null && typeof injectedProfilingHooks.markStateUpdateScheduled === 'function') { 24814 injectedProfilingHooks.markStateUpdateScheduled(fiber, lane); 24815 } 24816 } 24817} 24818 24819var NoMode = 24820/* */ 248210; // TODO: Remove ConcurrentMode by reading from the root tag instead 24822 24823var ConcurrentMode = 24824/* */ 248251; 24826var ProfileMode = 24827/* */ 248282; 24829var StrictLegacyMode = 24830/* */ 248318; 24832var StrictEffectsMode = 24833/* */ 2483416; 24835 24836// TODO: This is pretty well supported by browsers. Maybe we can drop it. 24837var clz32 = Math.clz32 ? Math.clz32 : clz32Fallback; // Count leading zeros. 24838// Based on: 24839// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/clz32 24840 24841var log = Math.log; 24842var LN2 = Math.LN2; 24843 24844function clz32Fallback(x) { 24845 var asUint = x >>> 0; 24846 24847 if (asUint === 0) { 24848 return 32; 24849 } 24850 24851 return 31 - (log(asUint) / LN2 | 0) | 0; 24852} 24853 24854// If those values are changed that package should be rebuilt and redeployed. 24855 24856var TotalLanes = 31; 24857var NoLanes = 24858/* */ 248590; 24860var NoLane = 24861/* */ 248620; 24863var SyncLane = 24864/* */ 248651; 24866var InputContinuousHydrationLane = 24867/* */ 248682; 24869var InputContinuousLane = 24870/* */ 248714; 24872var DefaultHydrationLane = 24873/* */ 248748; 24875var DefaultLane = 24876/* */ 2487716; 24878var TransitionHydrationLane = 24879/* */ 2488032; 24881var TransitionLanes = 24882/* */ 248834194240; 24884var TransitionLane1 = 24885/* */ 2488664; 24887var TransitionLane2 = 24888/* */ 24889128; 24890var TransitionLane3 = 24891/* */ 24892256; 24893var TransitionLane4 = 24894/* */ 24895512; 24896var TransitionLane5 = 24897/* */ 248981024; 24899var TransitionLane6 = 24900/* */ 249012048; 24902var TransitionLane7 = 24903/* */ 249044096; 24905var TransitionLane8 = 24906/* */ 249078192; 24908var TransitionLane9 = 24909/* */ 2491016384; 24911var TransitionLane10 = 24912/* */ 2491332768; 24914var TransitionLane11 = 24915/* */ 2491665536; 24917var TransitionLane12 = 24918/* */ 24919131072; 24920var TransitionLane13 = 24921/* */ 24922262144; 24923var TransitionLane14 = 24924/* */ 24925524288; 24926var TransitionLane15 = 24927/* */ 249281048576; 24929var TransitionLane16 = 24930/* */ 249312097152; 24932var RetryLanes = 24933/* */ 24934130023424; 24935var RetryLane1 = 24936/* */ 249374194304; 24938var RetryLane2 = 24939/* */ 249408388608; 24941var RetryLane3 = 24942/* */ 2494316777216; 24944var RetryLane4 = 24945/* */ 2494633554432; 24947var RetryLane5 = 24948/* */ 2494967108864; 24950var SomeRetryLane = RetryLane1; 24951var SelectiveHydrationLane = 24952/* */ 24953134217728; 24954var NonIdleLanes = 24955/* */ 24956268435455; 24957var IdleHydrationLane = 24958/* */ 24959268435456; 24960var IdleLane = 24961/* */ 24962536870912; 24963var OffscreenLane = 24964/* */ 249651073741824; // This function is used for the experimental timeline (react-devtools-timeline) 24966// It should be kept in sync with the Lanes values above. 24967 24968function getLabelForLane(lane) { 24969 { 24970 if (lane & SyncLane) { 24971 return 'Sync'; 24972 } 24973 24974 if (lane & InputContinuousHydrationLane) { 24975 return 'InputContinuousHydration'; 24976 } 24977 24978 if (lane & InputContinuousLane) { 24979 return 'InputContinuous'; 24980 } 24981 24982 if (lane & DefaultHydrationLane) { 24983 return 'DefaultHydration'; 24984 } 24985 24986 if (lane & DefaultLane) { 24987 return 'Default'; 24988 } 24989 24990 if (lane & TransitionHydrationLane) { 24991 return 'TransitionHydration'; 24992 } 24993 24994 if (lane & TransitionLanes) { 24995 return 'Transition'; 24996 } 24997 24998 if (lane & RetryLanes) { 24999 return 'Retry'; 25000 } 25001 25002 if (lane & SelectiveHydrationLane) { 25003 return 'SelectiveHydration'; 25004 } 25005 25006 if (lane & IdleHydrationLane) { 25007 return 'IdleHydration'; 25008 } 25009 25010 if (lane & IdleLane) { 25011 return 'Idle'; 25012 } 25013 25014 if (lane & OffscreenLane) { 25015 return 'Offscreen'; 25016 } 25017 } 25018} 25019var NoTimestamp = -1; 25020var nextTransitionLane = TransitionLane1; 25021var nextRetryLane = RetryLane1; 25022 25023function getHighestPriorityLanes(lanes) { 25024 switch (getHighestPriorityLane(lanes)) { 25025 case SyncLane: 25026 return SyncLane; 25027 25028 case InputContinuousHydrationLane: 25029 return InputContinuousHydrationLane; 25030 25031 case InputContinuousLane: 25032 return InputContinuousLane; 25033 25034 case DefaultHydrationLane: 25035 return DefaultHydrationLane; 25036 25037 case DefaultLane: 25038 return DefaultLane; 25039 25040 case TransitionHydrationLane: 25041 return TransitionHydrationLane; 25042 25043 case TransitionLane1: 25044 case TransitionLane2: 25045 case TransitionLane3: 25046 case TransitionLane4: 25047 case TransitionLane5: 25048 case TransitionLane6: 25049 case TransitionLane7: 25050 case TransitionLane8: 25051 case TransitionLane9: 25052 case TransitionLane10: 25053 case TransitionLane11: 25054 case TransitionLane12: 25055 case TransitionLane13: 25056 case TransitionLane14: 25057 case TransitionLane15: 25058 case TransitionLane16: 25059 return lanes & TransitionLanes; 25060 25061 case RetryLane1: 25062 case RetryLane2: 25063 case RetryLane3: 25064 case RetryLane4: 25065 case RetryLane5: 25066 return lanes & RetryLanes; 25067 25068 case SelectiveHydrationLane: 25069 return SelectiveHydrationLane; 25070 25071 case IdleHydrationLane: 25072 return IdleHydrationLane; 25073 25074 case IdleLane: 25075 return IdleLane; 25076 25077 case OffscreenLane: 25078 return OffscreenLane; 25079 25080 default: 25081 { 25082 error('Should have found matching lanes. This is a bug in React.'); 25083 } // This shouldn't be reachable, but as a fallback, return the entire bitmask. 25084 25085 25086 return lanes; 25087 } 25088} 25089 25090function getNextLanes(root, wipLanes) { 25091 // Early bailout if there's no pending work left. 25092 var pendingLanes = root.pendingLanes; 25093 25094 if (pendingLanes === NoLanes) { 25095 return NoLanes; 25096 } 25097 25098 var nextLanes = NoLanes; 25099 var suspendedLanes = root.suspendedLanes; 25100 var pingedLanes = root.pingedLanes; // Do not work on any idle work until all the non-idle work has finished, 25101 // even if the work is suspended. 25102 25103 var nonIdlePendingLanes = pendingLanes & NonIdleLanes; 25104 25105 if (nonIdlePendingLanes !== NoLanes) { 25106 var nonIdleUnblockedLanes = nonIdlePendingLanes & ~suspendedLanes; 25107 25108 if (nonIdleUnblockedLanes !== NoLanes) { 25109 nextLanes = getHighestPriorityLanes(nonIdleUnblockedLanes); 25110 } else { 25111 var nonIdlePingedLanes = nonIdlePendingLanes & pingedLanes; 25112 25113 if (nonIdlePingedLanes !== NoLanes) { 25114 nextLanes = getHighestPriorityLanes(nonIdlePingedLanes); 25115 } 25116 } 25117 } else { 25118 // The only remaining work is Idle. 25119 var unblockedLanes = pendingLanes & ~suspendedLanes; 25120 25121 if (unblockedLanes !== NoLanes) { 25122 nextLanes = getHighestPriorityLanes(unblockedLanes); 25123 } else { 25124 if (pingedLanes !== NoLanes) { 25125 nextLanes = getHighestPriorityLanes(pingedLanes); 25126 } 25127 } 25128 } 25129 25130 if (nextLanes === NoLanes) { 25131 // This should only be reachable if we're suspended 25132 // TODO: Consider warning in this path if a fallback timer is not scheduled. 25133 return NoLanes; 25134 } // If we're already in the middle of a render, switching lanes will interrupt 25135 // it and we'll lose our progress. We should only do this if the new lanes are 25136 // higher priority. 25137 25138 25139 if (wipLanes !== NoLanes && wipLanes !== nextLanes && // If we already suspended with a delay, then interrupting is fine. Don't 25140 // bother waiting until the root is complete. 25141 (wipLanes & suspendedLanes) === NoLanes) { 25142 var nextLane = getHighestPriorityLane(nextLanes); 25143 var wipLane = getHighestPriorityLane(wipLanes); 25144 25145 if ( // Tests whether the next lane is equal or lower priority than the wip 25146 // one. This works because the bits decrease in priority as you go left. 25147 nextLane >= wipLane || // Default priority updates should not interrupt transition updates. The 25148 // only difference between default updates and transition updates is that 25149 // default updates do not support refresh transitions. 25150 nextLane === DefaultLane && (wipLane & TransitionLanes) !== NoLanes) { 25151 // Keep working on the existing in-progress tree. Do not interrupt. 25152 return wipLanes; 25153 } 25154 } 25155 25156 if ((nextLanes & InputContinuousLane) !== NoLanes) { 25157 // When updates are sync by default, we entangle continuous priority updates 25158 // and default updates, so they render in the same batch. The only reason 25159 // they use separate lanes is because continuous updates should interrupt 25160 // transitions, but default updates should not. 25161 nextLanes |= pendingLanes & DefaultLane; 25162 } // Check for entangled lanes and add them to the batch. 25163 // 25164 // A lane is said to be entangled with another when it's not allowed to render 25165 // in a batch that does not also include the other lane. Typically we do this 25166 // when multiple updates have the same source, and we only want to respond to 25167 // the most recent event from that source. 25168 // 25169 // Note that we apply entanglements *after* checking for partial work above. 25170 // This means that if a lane is entangled during an interleaved event while 25171 // it's already rendering, we won't interrupt it. This is intentional, since 25172 // entanglement is usually "best effort": we'll try our best to render the 25173 // lanes in the same batch, but it's not worth throwing out partially 25174 // completed work in order to do it. 25175 // TODO: Reconsider this. The counter-argument is that the partial work 25176 // represents an intermediate state, which we don't want to show to the user. 25177 // And by spending extra time finishing it, we're increasing the amount of 25178 // time it takes to show the final state, which is what they are actually 25179 // waiting for. 25180 // 25181 // For those exceptions where entanglement is semantically important, like 25182 // useMutableSource, we should ensure that there is no partial work at the 25183 // time we apply the entanglement. 25184 25185 25186 var entangledLanes = root.entangledLanes; 25187 25188 if (entangledLanes !== NoLanes) { 25189 var entanglements = root.entanglements; 25190 var lanes = nextLanes & entangledLanes; 25191 25192 while (lanes > 0) { 25193 var index = pickArbitraryLaneIndex(lanes); 25194 var lane = 1 << index; 25195 nextLanes |= entanglements[index]; 25196 lanes &= ~lane; 25197 } 25198 } 25199 25200 return nextLanes; 25201} 25202function getMostRecentEventTime(root, lanes) { 25203 var eventTimes = root.eventTimes; 25204 var mostRecentEventTime = NoTimestamp; 25205 25206 while (lanes > 0) { 25207 var index = pickArbitraryLaneIndex(lanes); 25208 var lane = 1 << index; 25209 var eventTime = eventTimes[index]; 25210 25211 if (eventTime > mostRecentEventTime) { 25212 mostRecentEventTime = eventTime; 25213 } 25214 25215 lanes &= ~lane; 25216 } 25217 25218 return mostRecentEventTime; 25219} 25220 25221function computeExpirationTime(lane, currentTime) { 25222 switch (lane) { 25223 case SyncLane: 25224 case InputContinuousHydrationLane: 25225 case InputContinuousLane: 25226 // User interactions should expire slightly more quickly. 25227 // 25228 // NOTE: This is set to the corresponding constant as in Scheduler.js. 25229 // When we made it larger, a product metric in www regressed, suggesting 25230 // there's a user interaction that's being starved by a series of 25231 // synchronous updates. If that theory is correct, the proper solution is 25232 // to fix the starvation. However, this scenario supports the idea that 25233 // expiration times are an important safeguard when starvation 25234 // does happen. 25235 return currentTime + 250; 25236 25237 case DefaultHydrationLane: 25238 case DefaultLane: 25239 case TransitionHydrationLane: 25240 case TransitionLane1: 25241 case TransitionLane2: 25242 case TransitionLane3: 25243 case TransitionLane4: 25244 case TransitionLane5: 25245 case TransitionLane6: 25246 case TransitionLane7: 25247 case TransitionLane8: 25248 case TransitionLane9: 25249 case TransitionLane10: 25250 case TransitionLane11: 25251 case TransitionLane12: 25252 case TransitionLane13: 25253 case TransitionLane14: 25254 case TransitionLane15: 25255 case TransitionLane16: 25256 return currentTime + 5000; 25257 25258 case RetryLane1: 25259 case RetryLane2: 25260 case RetryLane3: 25261 case RetryLane4: 25262 case RetryLane5: 25263 // TODO: Retries should be allowed to expire if they are CPU bound for 25264 // too long, but when I made this change it caused a spike in browser 25265 // crashes. There must be some other underlying bug; not super urgent but 25266 // ideally should figure out why and fix it. Unfortunately we don't have 25267 // a repro for the crashes, only detected via production metrics. 25268 return NoTimestamp; 25269 25270 case SelectiveHydrationLane: 25271 case IdleHydrationLane: 25272 case IdleLane: 25273 case OffscreenLane: 25274 // Anything idle priority or lower should never expire. 25275 return NoTimestamp; 25276 25277 default: 25278 { 25279 error('Should have found matching lanes. This is a bug in React.'); 25280 } 25281 25282 return NoTimestamp; 25283 } 25284} 25285 25286function markStarvedLanesAsExpired(root, currentTime) { 25287 // TODO: This gets called every time we yield. We can optimize by storing 25288 // the earliest expiration time on the root. Then use that to quickly bail out 25289 // of this function. 25290 var pendingLanes = root.pendingLanes; 25291 var suspendedLanes = root.suspendedLanes; 25292 var pingedLanes = root.pingedLanes; 25293 var expirationTimes = root.expirationTimes; // Iterate through the pending lanes and check if we've reached their 25294 // expiration time. If so, we'll assume the update is being starved and mark 25295 // it as expired to force it to finish. 25296 25297 var lanes = pendingLanes; 25298 25299 while (lanes > 0) { 25300 var index = pickArbitraryLaneIndex(lanes); 25301 var lane = 1 << index; 25302 var expirationTime = expirationTimes[index]; 25303 25304 if (expirationTime === NoTimestamp) { 25305 // Found a pending lane with no expiration time. If it's not suspended, or 25306 // if it's pinged, assume it's CPU-bound. Compute a new expiration time 25307 // using the current time. 25308 if ((lane & suspendedLanes) === NoLanes || (lane & pingedLanes) !== NoLanes) { 25309 // Assumes timestamps are monotonically increasing. 25310 expirationTimes[index] = computeExpirationTime(lane, currentTime); 25311 } 25312 } else if (expirationTime <= currentTime) { 25313 // This lane expired 25314 root.expiredLanes |= lane; 25315 } 25316 25317 lanes &= ~lane; 25318 } 25319} // This returns the highest priority pending lanes regardless of whether they 25320// are suspended. 25321 25322function getHighestPriorityPendingLanes(root) { 25323 return getHighestPriorityLanes(root.pendingLanes); 25324} 25325function getLanesToRetrySynchronouslyOnError(root) { 25326 var everythingButOffscreen = root.pendingLanes & ~OffscreenLane; 25327 25328 if (everythingButOffscreen !== NoLanes) { 25329 return everythingButOffscreen; 25330 } 25331 25332 if (everythingButOffscreen & OffscreenLane) { 25333 return OffscreenLane; 25334 } 25335 25336 return NoLanes; 25337} 25338function includesSyncLane(lanes) { 25339 return (lanes & SyncLane) !== NoLanes; 25340} 25341function includesNonIdleWork(lanes) { 25342 return (lanes & NonIdleLanes) !== NoLanes; 25343} 25344function includesOnlyRetries(lanes) { 25345 return (lanes & RetryLanes) === lanes; 25346} 25347function includesOnlyNonUrgentLanes(lanes) { 25348 var UrgentLanes = SyncLane | InputContinuousLane | DefaultLane; 25349 return (lanes & UrgentLanes) === NoLanes; 25350} 25351function includesOnlyTransitions(lanes) { 25352 return (lanes & TransitionLanes) === lanes; 25353} 25354function includesBlockingLane(root, lanes) { 25355 25356 var SyncDefaultLanes = InputContinuousHydrationLane | InputContinuousLane | DefaultHydrationLane | DefaultLane; 25357 return (lanes & SyncDefaultLanes) !== NoLanes; 25358} 25359function includesExpiredLane(root, lanes) { 25360 // This is a separate check from includesBlockingLane because a lane can 25361 // expire after a render has already started. 25362 return (lanes & root.expiredLanes) !== NoLanes; 25363} 25364function isTransitionLane(lane) { 25365 return (lane & TransitionLanes) !== NoLanes; 25366} 25367function claimNextTransitionLane() { 25368 // Cycle through the lanes, assigning each new transition to the next lane. 25369 // In most cases, this means every transition gets its own lane, until we 25370 // run out of lanes and cycle back to the beginning. 25371 var lane = nextTransitionLane; 25372 nextTransitionLane <<= 1; 25373 25374 if ((nextTransitionLane & TransitionLanes) === NoLanes) { 25375 nextTransitionLane = TransitionLane1; 25376 } 25377 25378 return lane; 25379} 25380function claimNextRetryLane() { 25381 var lane = nextRetryLane; 25382 nextRetryLane <<= 1; 25383 25384 if ((nextRetryLane & RetryLanes) === NoLanes) { 25385 nextRetryLane = RetryLane1; 25386 } 25387 25388 return lane; 25389} 25390function getHighestPriorityLane(lanes) { 25391 return lanes & -lanes; 25392} 25393function pickArbitraryLane(lanes) { 25394 // This wrapper function gets inlined. Only exists so to communicate that it 25395 // doesn't matter which bit is selected; you can pick any bit without 25396 // affecting the algorithms where its used. Here I'm using 25397 // getHighestPriorityLane because it requires the fewest operations. 25398 return getHighestPriorityLane(lanes); 25399} 25400 25401function pickArbitraryLaneIndex(lanes) { 25402 return 31 - clz32(lanes); 25403} 25404 25405function laneToIndex(lane) { 25406 return pickArbitraryLaneIndex(lane); 25407} 25408 25409function includesSomeLane(a, b) { 25410 return (a & b) !== NoLanes; 25411} 25412function isSubsetOfLanes(set, subset) { 25413 return (set & subset) === subset; 25414} 25415function mergeLanes(a, b) { 25416 return a | b; 25417} 25418function removeLanes(set, subset) { 25419 return set & ~subset; 25420} 25421function intersectLanes(a, b) { 25422 return a & b; 25423} // Seems redundant, but it changes the type from a single lane (used for 25424// updates) to a group of lanes (used for flushing work). 25425 25426function laneToLanes(lane) { 25427 return lane; 25428} 25429function higherPriorityLane(a, b) { 25430 // This works because the bit ranges decrease in priority as you go left. 25431 return a !== NoLane && a < b ? a : b; 25432} 25433function createLaneMap(initial) { 25434 // Intentionally pushing one by one. 25435 // https://v8.dev/blog/elements-kinds#avoid-creating-holes 25436 var laneMap = []; 25437 25438 for (var i = 0; i < TotalLanes; i++) { 25439 laneMap.push(initial); 25440 } 25441 25442 return laneMap; 25443} 25444function markRootUpdated(root, updateLane, eventTime) { 25445 root.pendingLanes |= updateLane; // If there are any suspended transitions, it's possible this new update 25446 // could unblock them. Clear the suspended lanes so that we can try rendering 25447 // them again. 25448 // 25449 // TODO: We really only need to unsuspend only lanes that are in the 25450 // `subtreeLanes` of the updated fiber, or the update lanes of the return 25451 // path. This would exclude suspended updates in an unrelated sibling tree, 25452 // since there's no way for this update to unblock it. 25453 // 25454 // We don't do this if the incoming update is idle, because we never process 25455 // idle updates until after all the regular updates have finished; there's no 25456 // way it could unblock a transition. 25457 25458 if (updateLane !== IdleLane) { 25459 root.suspendedLanes = NoLanes; 25460 root.pingedLanes = NoLanes; 25461 } 25462 25463 var eventTimes = root.eventTimes; 25464 var index = laneToIndex(updateLane); // We can always overwrite an existing timestamp because we prefer the most 25465 // recent event, and we assume time is monotonically increasing. 25466 25467 eventTimes[index] = eventTime; 25468} 25469function markRootSuspended(root, suspendedLanes) { 25470 root.suspendedLanes |= suspendedLanes; 25471 root.pingedLanes &= ~suspendedLanes; // The suspended lanes are no longer CPU-bound. Clear their expiration times. 25472 25473 var expirationTimes = root.expirationTimes; 25474 var lanes = suspendedLanes; 25475 25476 while (lanes > 0) { 25477 var index = pickArbitraryLaneIndex(lanes); 25478 var lane = 1 << index; 25479 expirationTimes[index] = NoTimestamp; 25480 lanes &= ~lane; 25481 } 25482} 25483function markRootPinged(root, pingedLanes, eventTime) { 25484 root.pingedLanes |= root.suspendedLanes & pingedLanes; 25485} 25486function markRootFinished(root, remainingLanes) { 25487 var noLongerPendingLanes = root.pendingLanes & ~remainingLanes; 25488 root.pendingLanes = remainingLanes; // Let's try everything again 25489 25490 root.suspendedLanes = NoLanes; 25491 root.pingedLanes = NoLanes; 25492 root.expiredLanes &= remainingLanes; 25493 root.mutableReadLanes &= remainingLanes; 25494 root.entangledLanes &= remainingLanes; 25495 var entanglements = root.entanglements; 25496 var eventTimes = root.eventTimes; 25497 var expirationTimes = root.expirationTimes; // Clear the lanes that no longer have pending work 25498 25499 var lanes = noLongerPendingLanes; 25500 25501 while (lanes > 0) { 25502 var index = pickArbitraryLaneIndex(lanes); 25503 var lane = 1 << index; 25504 entanglements[index] = NoLanes; 25505 eventTimes[index] = NoTimestamp; 25506 expirationTimes[index] = NoTimestamp; 25507 lanes &= ~lane; 25508 } 25509} 25510function markRootEntangled(root, entangledLanes) { 25511 // In addition to entangling each of the given lanes with each other, we also 25512 // have to consider _transitive_ entanglements. For each lane that is already 25513 // entangled with *any* of the given lanes, that lane is now transitively 25514 // entangled with *all* the given lanes. 25515 // 25516 // Translated: If C is entangled with A, then entangling A with B also 25517 // entangles C with B. 25518 // 25519 // If this is hard to grasp, it might help to intentionally break this 25520 // function and look at the tests that fail in ReactTransition-test.js. Try 25521 // commenting out one of the conditions below. 25522 var rootEntangledLanes = root.entangledLanes |= entangledLanes; 25523 var entanglements = root.entanglements; 25524 var lanes = rootEntangledLanes; 25525 25526 while (lanes) { 25527 var index = pickArbitraryLaneIndex(lanes); 25528 var lane = 1 << index; 25529 25530 if ( // Is this one of the newly entangled lanes? 25531 lane & entangledLanes | // Is this lane transitively entangled with the newly entangled lanes? 25532 entanglements[index] & entangledLanes) { 25533 entanglements[index] |= entangledLanes; 25534 } 25535 25536 lanes &= ~lane; 25537 } 25538} 25539function getBumpedLaneForHydration(root, renderLanes) { 25540 var renderLane = getHighestPriorityLane(renderLanes); 25541 var lane; 25542 25543 switch (renderLane) { 25544 case InputContinuousLane: 25545 lane = InputContinuousHydrationLane; 25546 break; 25547 25548 case DefaultLane: 25549 lane = DefaultHydrationLane; 25550 break; 25551 25552 case TransitionLane1: 25553 case TransitionLane2: 25554 case TransitionLane3: 25555 case TransitionLane4: 25556 case TransitionLane5: 25557 case TransitionLane6: 25558 case TransitionLane7: 25559 case TransitionLane8: 25560 case TransitionLane9: 25561 case TransitionLane10: 25562 case TransitionLane11: 25563 case TransitionLane12: 25564 case TransitionLane13: 25565 case TransitionLane14: 25566 case TransitionLane15: 25567 case TransitionLane16: 25568 case RetryLane1: 25569 case RetryLane2: 25570 case RetryLane3: 25571 case RetryLane4: 25572 case RetryLane5: 25573 lane = TransitionHydrationLane; 25574 break; 25575 25576 case IdleLane: 25577 lane = IdleHydrationLane; 25578 break; 25579 25580 default: 25581 // Everything else is already either a hydration lane, or shouldn't 25582 // be retried at a hydration lane. 25583 lane = NoLane; 25584 break; 25585 } // Check if the lane we chose is suspended. If so, that indicates that we 25586 // already attempted and failed to hydrate at that level. Also check if we're 25587 // already rendering that lane, which is rare but could happen. 25588 25589 25590 if ((lane & (root.suspendedLanes | renderLanes)) !== NoLane) { 25591 // Give up trying to hydrate and fall back to client render. 25592 return NoLane; 25593 } 25594 25595 return lane; 25596} 25597function addFiberToLanesMap(root, fiber, lanes) { 25598 25599 if (!isDevToolsPresent) { 25600 return; 25601 } 25602 25603 var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; 25604 25605 while (lanes > 0) { 25606 var index = laneToIndex(lanes); 25607 var lane = 1 << index; 25608 var updaters = pendingUpdatersLaneMap[index]; 25609 updaters.add(fiber); 25610 lanes &= ~lane; 25611 } 25612} 25613function movePendingFibersToMemoized(root, lanes) { 25614 25615 if (!isDevToolsPresent) { 25616 return; 25617 } 25618 25619 var pendingUpdatersLaneMap = root.pendingUpdatersLaneMap; 25620 var memoizedUpdaters = root.memoizedUpdaters; 25621 25622 while (lanes > 0) { 25623 var index = laneToIndex(lanes); 25624 var lane = 1 << index; 25625 var updaters = pendingUpdatersLaneMap[index]; 25626 25627 if (updaters.size > 0) { 25628 updaters.forEach(function (fiber) { 25629 var alternate = fiber.alternate; 25630 25631 if (alternate === null || !memoizedUpdaters.has(alternate)) { 25632 memoizedUpdaters.add(fiber); 25633 } 25634 }); 25635 updaters.clear(); 25636 } 25637 25638 lanes &= ~lane; 25639 } 25640} 25641function getTransitionsForLanes(root, lanes) { 25642 { 25643 return null; 25644 } 25645} 25646 25647var DiscreteEventPriority = SyncLane; 25648var ContinuousEventPriority = InputContinuousLane; 25649var DefaultEventPriority = DefaultLane; 25650var IdleEventPriority = IdleLane; 25651var currentUpdatePriority = NoLane; 25652function getCurrentUpdatePriority() { 25653 return currentUpdatePriority; 25654} 25655function setCurrentUpdatePriority(newPriority) { 25656 currentUpdatePriority = newPriority; 25657} 25658function runWithPriority(priority, fn) { 25659 var previousPriority = currentUpdatePriority; 25660 25661 try { 25662 currentUpdatePriority = priority; 25663 return fn(); 25664 } finally { 25665 currentUpdatePriority = previousPriority; 25666 } 25667} 25668function higherEventPriority(a, b) { 25669 return a !== 0 && a < b ? a : b; 25670} 25671function lowerEventPriority(a, b) { 25672 return a === 0 || a > b ? a : b; 25673} 25674function isHigherEventPriority(a, b) { 25675 return a !== 0 && a < b; 25676} 25677function lanesToEventPriority(lanes) { 25678 var lane = getHighestPriorityLane(lanes); 25679 25680 if (!isHigherEventPriority(DiscreteEventPriority, lane)) { 25681 return DiscreteEventPriority; 25682 } 25683 25684 if (!isHigherEventPriority(ContinuousEventPriority, lane)) { 25685 return ContinuousEventPriority; 25686 } 25687 25688 if (includesNonIdleWork(lane)) { 25689 return DefaultEventPriority; 25690 } 25691 25692 return IdleEventPriority; 25693} 25694 25695// This is imported by the event replaying implementation in React DOM. It's 25696// in a separate file to break a circular dependency between the renderer and 25697// the reconciler. 25698function isRootDehydrated(root) { 25699 var currentState = root.current.memoizedState; 25700 return currentState.isDehydrated; 25701} 25702 25703var _attemptSynchronousHydration; 25704 25705function setAttemptSynchronousHydration(fn) { 25706 _attemptSynchronousHydration = fn; 25707} 25708function attemptSynchronousHydration(fiber) { 25709 _attemptSynchronousHydration(fiber); 25710} 25711var attemptContinuousHydration; 25712function setAttemptContinuousHydration(fn) { 25713 attemptContinuousHydration = fn; 25714} 25715var attemptHydrationAtCurrentPriority; 25716function setAttemptHydrationAtCurrentPriority(fn) { 25717 attemptHydrationAtCurrentPriority = fn; 25718} 25719var getCurrentUpdatePriority$1; 25720function setGetCurrentUpdatePriority(fn) { 25721 getCurrentUpdatePriority$1 = fn; 25722} 25723var attemptHydrationAtPriority; 25724function setAttemptHydrationAtPriority(fn) { 25725 attemptHydrationAtPriority = fn; 25726} // TODO: Upgrade this definition once we're on a newer version of Flow that 25727// has this definition built-in. 25728 25729var hasScheduledReplayAttempt = false; // The queue of discrete events to be replayed. 25730 25731var queuedDiscreteEvents = []; // Indicates if any continuous event targets are non-null for early bailout. 25732// if the last target was dehydrated. 25733 25734var queuedFocus = null; 25735var queuedDrag = null; 25736var queuedMouse = null; // For pointer events there can be one latest event per pointerId. 25737 25738var queuedPointers = new Map(); 25739var queuedPointerCaptures = new Map(); // We could consider replaying selectionchange and touchmoves too. 25740 25741var queuedExplicitHydrationTargets = []; 25742var discreteReplayableEvents = ['mousedown', 'mouseup', 'touchcancel', 'touchend', 'touchstart', 'auxclick', 'dblclick', 'pointercancel', 'pointerdown', 'pointerup', 'dragend', 'dragstart', 'drop', 'compositionend', 'compositionstart', 'keydown', 'keypress', 'keyup', 'input', 'textInput', // Intentionally camelCase 25743'copy', 'cut', 'paste', 'click', 'change', 'contextmenu', 'reset', 'submit']; 25744function isDiscreteEventThatRequiresHydration(eventType) { 25745 return discreteReplayableEvents.indexOf(eventType) > -1; 25746} 25747 25748function createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) { 25749 return { 25750 blockedOn: blockedOn, 25751 domEventName: domEventName, 25752 eventSystemFlags: eventSystemFlags, 25753 nativeEvent: nativeEvent, 25754 targetContainers: [targetContainer] 25755 }; 25756} 25757 25758function clearIfContinuousEvent(domEventName, nativeEvent) { 25759 switch (domEventName) { 25760 case 'focusin': 25761 case 'focusout': 25762 queuedFocus = null; 25763 break; 25764 25765 case 'dragenter': 25766 case 'dragleave': 25767 queuedDrag = null; 25768 break; 25769 25770 case 'mouseover': 25771 case 'mouseout': 25772 queuedMouse = null; 25773 break; 25774 25775 case 'pointerover': 25776 case 'pointerout': 25777 { 25778 var pointerId = nativeEvent.pointerId; 25779 queuedPointers.delete(pointerId); 25780 break; 25781 } 25782 25783 case 'gotpointercapture': 25784 case 'lostpointercapture': 25785 { 25786 var _pointerId = nativeEvent.pointerId; 25787 queuedPointerCaptures.delete(_pointerId); 25788 break; 25789 } 25790 } 25791} 25792 25793function accumulateOrCreateContinuousQueuedReplayableEvent(existingQueuedEvent, blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) { 25794 if (existingQueuedEvent === null || existingQueuedEvent.nativeEvent !== nativeEvent) { 25795 var queuedEvent = createQueuedReplayableEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent); 25796 25797 if (blockedOn !== null) { 25798 var _fiber2 = getInstanceFromNode(blockedOn); 25799 25800 if (_fiber2 !== null) { 25801 // Attempt to increase the priority of this target. 25802 attemptContinuousHydration(_fiber2); 25803 } 25804 } 25805 25806 return queuedEvent; 25807 } // If we have already queued this exact event, then it's because 25808 // the different event systems have different DOM event listeners. 25809 // We can accumulate the flags, and the targetContainers, and 25810 // store a single event to be replayed. 25811 25812 25813 existingQueuedEvent.eventSystemFlags |= eventSystemFlags; 25814 var targetContainers = existingQueuedEvent.targetContainers; 25815 25816 if (targetContainer !== null && targetContainers.indexOf(targetContainer) === -1) { 25817 targetContainers.push(targetContainer); 25818 } 25819 25820 return existingQueuedEvent; 25821} 25822 25823function queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent) { 25824 // These set relatedTarget to null because the replayed event will be treated as if we 25825 // moved from outside the window (no target) onto the target once it hydrates. 25826 // Instead of mutating we could clone the event. 25827 switch (domEventName) { 25828 case 'focusin': 25829 { 25830 var focusEvent = nativeEvent; 25831 queuedFocus = accumulateOrCreateContinuousQueuedReplayableEvent(queuedFocus, blockedOn, domEventName, eventSystemFlags, targetContainer, focusEvent); 25832 return true; 25833 } 25834 25835 case 'dragenter': 25836 { 25837 var dragEvent = nativeEvent; 25838 queuedDrag = accumulateOrCreateContinuousQueuedReplayableEvent(queuedDrag, blockedOn, domEventName, eventSystemFlags, targetContainer, dragEvent); 25839 return true; 25840 } 25841 25842 case 'mouseover': 25843 { 25844 var mouseEvent = nativeEvent; 25845 queuedMouse = accumulateOrCreateContinuousQueuedReplayableEvent(queuedMouse, blockedOn, domEventName, eventSystemFlags, targetContainer, mouseEvent); 25846 return true; 25847 } 25848 25849 case 'pointerover': 25850 { 25851 var pointerEvent = nativeEvent; 25852 var pointerId = pointerEvent.pointerId; 25853 queuedPointers.set(pointerId, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointers.get(pointerId) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, pointerEvent)); 25854 return true; 25855 } 25856 25857 case 'gotpointercapture': 25858 { 25859 var _pointerEvent = nativeEvent; 25860 var _pointerId2 = _pointerEvent.pointerId; 25861 queuedPointerCaptures.set(_pointerId2, accumulateOrCreateContinuousQueuedReplayableEvent(queuedPointerCaptures.get(_pointerId2) || null, blockedOn, domEventName, eventSystemFlags, targetContainer, _pointerEvent)); 25862 return true; 25863 } 25864 } 25865 25866 return false; 25867} // Check if this target is unblocked. Returns true if it's unblocked. 25868 25869function attemptExplicitHydrationTarget(queuedTarget) { 25870 // TODO: This function shares a lot of logic with findInstanceBlockingEvent. 25871 // Try to unify them. It's a bit tricky since it would require two return 25872 // values. 25873 var targetInst = getClosestInstanceFromNode(queuedTarget.target); 25874 25875 if (targetInst !== null) { 25876 var nearestMounted = getNearestMountedFiber(targetInst); 25877 25878 if (nearestMounted !== null) { 25879 var tag = nearestMounted.tag; 25880 25881 if (tag === SuspenseComponent) { 25882 var instance = getSuspenseInstanceFromFiber(nearestMounted); 25883 25884 if (instance !== null) { 25885 // We're blocked on hydrating this boundary. 25886 // Increase its priority. 25887 queuedTarget.blockedOn = instance; 25888 attemptHydrationAtPriority(queuedTarget.priority, function () { 25889 attemptHydrationAtCurrentPriority(nearestMounted); 25890 }); 25891 return; 25892 } 25893 } else if (tag === HostRoot) { 25894 var root = nearestMounted.stateNode; 25895 25896 if (isRootDehydrated(root)) { 25897 queuedTarget.blockedOn = getContainerFromFiber(nearestMounted); // We don't currently have a way to increase the priority of 25898 // a root other than sync. 25899 25900 return; 25901 } 25902 } 25903 } 25904 } 25905 25906 queuedTarget.blockedOn = null; 25907} 25908 25909function queueExplicitHydrationTarget(target) { 25910 // TODO: This will read the priority if it's dispatched by the React 25911 // event system but not native events. Should read window.event.type, like 25912 // we do for updates (getCurrentEventPriority). 25913 var updatePriority = getCurrentUpdatePriority$1(); 25914 var queuedTarget = { 25915 blockedOn: null, 25916 target: target, 25917 priority: updatePriority 25918 }; 25919 var i = 0; 25920 25921 for (; i < queuedExplicitHydrationTargets.length; i++) { 25922 // Stop once we hit the first target with lower priority than 25923 if (!isHigherEventPriority(updatePriority, queuedExplicitHydrationTargets[i].priority)) { 25924 break; 25925 } 25926 } 25927 25928 queuedExplicitHydrationTargets.splice(i, 0, queuedTarget); 25929 25930 if (i === 0) { 25931 attemptExplicitHydrationTarget(queuedTarget); 25932 } 25933} 25934 25935function attemptReplayContinuousQueuedEvent(queuedEvent) { 25936 if (queuedEvent.blockedOn !== null) { 25937 return false; 25938 } 25939 25940 var targetContainers = queuedEvent.targetContainers; 25941 25942 while (targetContainers.length > 0) { 25943 var targetContainer = targetContainers[0]; 25944 var nextBlockedOn = findInstanceBlockingEvent(queuedEvent.domEventName, queuedEvent.eventSystemFlags, targetContainer, queuedEvent.nativeEvent); 25945 25946 if (nextBlockedOn === null) { 25947 { 25948 var nativeEvent = queuedEvent.nativeEvent; 25949 var nativeEventClone = new nativeEvent.constructor(nativeEvent.type, nativeEvent); 25950 setReplayingEvent(nativeEventClone); 25951 nativeEvent.target.dispatchEvent(nativeEventClone); 25952 resetReplayingEvent(); 25953 } 25954 } else { 25955 // We're still blocked. Try again later. 25956 var _fiber3 = getInstanceFromNode(nextBlockedOn); 25957 25958 if (_fiber3 !== null) { 25959 attemptContinuousHydration(_fiber3); 25960 } 25961 25962 queuedEvent.blockedOn = nextBlockedOn; 25963 return false; 25964 } // This target container was successfully dispatched. Try the next. 25965 25966 25967 targetContainers.shift(); 25968 } 25969 25970 return true; 25971} 25972 25973function attemptReplayContinuousQueuedEventInMap(queuedEvent, key, map) { 25974 if (attemptReplayContinuousQueuedEvent(queuedEvent)) { 25975 map.delete(key); 25976 } 25977} 25978 25979function replayUnblockedEvents() { 25980 hasScheduledReplayAttempt = false; 25981 25982 25983 if (queuedFocus !== null && attemptReplayContinuousQueuedEvent(queuedFocus)) { 25984 queuedFocus = null; 25985 } 25986 25987 if (queuedDrag !== null && attemptReplayContinuousQueuedEvent(queuedDrag)) { 25988 queuedDrag = null; 25989 } 25990 25991 if (queuedMouse !== null && attemptReplayContinuousQueuedEvent(queuedMouse)) { 25992 queuedMouse = null; 25993 } 25994 25995 queuedPointers.forEach(attemptReplayContinuousQueuedEventInMap); 25996 queuedPointerCaptures.forEach(attemptReplayContinuousQueuedEventInMap); 25997} 25998 25999function scheduleCallbackIfUnblocked(queuedEvent, unblocked) { 26000 if (queuedEvent.blockedOn === unblocked) { 26001 queuedEvent.blockedOn = null; 26002 26003 if (!hasScheduledReplayAttempt) { 26004 hasScheduledReplayAttempt = true; // Schedule a callback to attempt replaying as many events as are 26005 // now unblocked. This first might not actually be unblocked yet. 26006 // We could check it early to avoid scheduling an unnecessary callback. 26007 26008 Scheduler.unstable_scheduleCallback(Scheduler.unstable_NormalPriority, replayUnblockedEvents); 26009 } 26010 } 26011} 26012 26013function retryIfBlockedOn(unblocked) { 26014 // Mark anything that was blocked on this as no longer blocked 26015 // and eligible for a replay. 26016 if (queuedDiscreteEvents.length > 0) { 26017 scheduleCallbackIfUnblocked(queuedDiscreteEvents[0], unblocked); // This is a exponential search for each boundary that commits. I think it's 26018 // worth it because we expect very few discrete events to queue up and once 26019 // we are actually fully unblocked it will be fast to replay them. 26020 26021 for (var i = 1; i < queuedDiscreteEvents.length; i++) { 26022 var queuedEvent = queuedDiscreteEvents[i]; 26023 26024 if (queuedEvent.blockedOn === unblocked) { 26025 queuedEvent.blockedOn = null; 26026 } 26027 } 26028 } 26029 26030 if (queuedFocus !== null) { 26031 scheduleCallbackIfUnblocked(queuedFocus, unblocked); 26032 } 26033 26034 if (queuedDrag !== null) { 26035 scheduleCallbackIfUnblocked(queuedDrag, unblocked); 26036 } 26037 26038 if (queuedMouse !== null) { 26039 scheduleCallbackIfUnblocked(queuedMouse, unblocked); 26040 } 26041 26042 var unblock = function (queuedEvent) { 26043 return scheduleCallbackIfUnblocked(queuedEvent, unblocked); 26044 }; 26045 26046 queuedPointers.forEach(unblock); 26047 queuedPointerCaptures.forEach(unblock); 26048 26049 for (var _i = 0; _i < queuedExplicitHydrationTargets.length; _i++) { 26050 var queuedTarget = queuedExplicitHydrationTargets[_i]; 26051 26052 if (queuedTarget.blockedOn === unblocked) { 26053 queuedTarget.blockedOn = null; 26054 } 26055 } 26056 26057 while (queuedExplicitHydrationTargets.length > 0) { 26058 var nextExplicitTarget = queuedExplicitHydrationTargets[0]; 26059 26060 if (nextExplicitTarget.blockedOn !== null) { 26061 // We're still blocked. 26062 break; 26063 } else { 26064 attemptExplicitHydrationTarget(nextExplicitTarget); 26065 26066 if (nextExplicitTarget.blockedOn === null) { 26067 // We're unblocked. 26068 queuedExplicitHydrationTargets.shift(); 26069 } 26070 } 26071 } 26072} 26073 26074var ReactCurrentBatchConfig = ReactSharedInternals.ReactCurrentBatchConfig; // TODO: can we stop exporting these? 26075 26076var _enabled = true; // This is exported in FB builds for use by legacy FB layer infra. 26077// We'd like to remove this but it's not clear if this is safe. 26078 26079function setEnabled(enabled) { 26080 _enabled = !!enabled; 26081} 26082function isEnabled() { 26083 return _enabled; 26084} 26085function createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags) { 26086 var eventPriority = getEventPriority(domEventName); 26087 var listenerWrapper; 26088 26089 switch (eventPriority) { 26090 case DiscreteEventPriority: 26091 listenerWrapper = dispatchDiscreteEvent; 26092 break; 26093 26094 case ContinuousEventPriority: 26095 listenerWrapper = dispatchContinuousEvent; 26096 break; 26097 26098 case DefaultEventPriority: 26099 default: 26100 listenerWrapper = dispatchEvent; 26101 break; 26102 } 26103 26104 return listenerWrapper.bind(null, domEventName, eventSystemFlags, targetContainer); 26105} 26106 26107function dispatchDiscreteEvent(domEventName, eventSystemFlags, container, nativeEvent) { 26108 var previousPriority = getCurrentUpdatePriority(); 26109 var prevTransition = ReactCurrentBatchConfig.transition; 26110 ReactCurrentBatchConfig.transition = null; 26111 26112 try { 26113 setCurrentUpdatePriority(DiscreteEventPriority); 26114 dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent); 26115 } finally { 26116 setCurrentUpdatePriority(previousPriority); 26117 ReactCurrentBatchConfig.transition = prevTransition; 26118 } 26119} 26120 26121function dispatchContinuousEvent(domEventName, eventSystemFlags, container, nativeEvent) { 26122 var previousPriority = getCurrentUpdatePriority(); 26123 var prevTransition = ReactCurrentBatchConfig.transition; 26124 ReactCurrentBatchConfig.transition = null; 26125 26126 try { 26127 setCurrentUpdatePriority(ContinuousEventPriority); 26128 dispatchEvent(domEventName, eventSystemFlags, container, nativeEvent); 26129 } finally { 26130 setCurrentUpdatePriority(previousPriority); 26131 ReactCurrentBatchConfig.transition = prevTransition; 26132 } 26133} 26134 26135function dispatchEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) { 26136 if (!_enabled) { 26137 return; 26138 } 26139 26140 { 26141 dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay(domEventName, eventSystemFlags, targetContainer, nativeEvent); 26142 } 26143} 26144 26145function dispatchEventWithEnableCapturePhaseSelectiveHydrationWithoutDiscreteEventReplay(domEventName, eventSystemFlags, targetContainer, nativeEvent) { 26146 var blockedOn = findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent); 26147 26148 if (blockedOn === null) { 26149 dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, return_targetInst, targetContainer); 26150 clearIfContinuousEvent(domEventName, nativeEvent); 26151 return; 26152 } 26153 26154 if (queueIfContinuousEvent(blockedOn, domEventName, eventSystemFlags, targetContainer, nativeEvent)) { 26155 nativeEvent.stopPropagation(); 26156 return; 26157 } // We need to clear only if we didn't queue because 26158 // queueing is accumulative. 26159 26160 26161 clearIfContinuousEvent(domEventName, nativeEvent); 26162 26163 if (eventSystemFlags & IS_CAPTURE_PHASE && isDiscreteEventThatRequiresHydration(domEventName)) { 26164 while (blockedOn !== null) { 26165 var fiber = getInstanceFromNode(blockedOn); 26166 26167 if (fiber !== null) { 26168 attemptSynchronousHydration(fiber); 26169 } 26170 26171 var nextBlockedOn = findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent); 26172 26173 if (nextBlockedOn === null) { 26174 dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, return_targetInst, targetContainer); 26175 } 26176 26177 if (nextBlockedOn === blockedOn) { 26178 break; 26179 } 26180 26181 blockedOn = nextBlockedOn; 26182 } 26183 26184 if (blockedOn !== null) { 26185 nativeEvent.stopPropagation(); 26186 } 26187 26188 return; 26189 } // This is not replayable so we'll invoke it but without a target, 26190 // in case the event system needs to trace it. 26191 26192 26193 dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, null, targetContainer); 26194} 26195 26196var return_targetInst = null; // Returns a SuspenseInstance or Container if it's blocked. 26197// The return_targetInst field above is conceptually part of the return value. 26198 26199function findInstanceBlockingEvent(domEventName, eventSystemFlags, targetContainer, nativeEvent) { 26200 // TODO: Warn if _enabled is false. 26201 return_targetInst = null; 26202 var nativeEventTarget = getEventTarget(nativeEvent); 26203 var targetInst = getClosestInstanceFromNode(nativeEventTarget); 26204 26205 if (targetInst !== null) { 26206 var nearestMounted = getNearestMountedFiber(targetInst); 26207 26208 if (nearestMounted === null) { 26209 // This tree has been unmounted already. Dispatch without a target. 26210 targetInst = null; 26211 } else { 26212 var tag = nearestMounted.tag; 26213 26214 if (tag === SuspenseComponent) { 26215 var instance = getSuspenseInstanceFromFiber(nearestMounted); 26216 26217 if (instance !== null) { 26218 // Queue the event to be replayed later. Abort dispatching since we 26219 // don't want this event dispatched twice through the event system. 26220 // TODO: If this is the first discrete event in the queue. Schedule an increased 26221 // priority for this boundary. 26222 return instance; 26223 } // This shouldn't happen, something went wrong but to avoid blocking 26224 // the whole system, dispatch the event without a target. 26225 // TODO: Warn. 26226 26227 26228 targetInst = null; 26229 } else if (tag === HostRoot) { 26230 var root = nearestMounted.stateNode; 26231 26232 if (isRootDehydrated(root)) { 26233 // If this happens during a replay something went wrong and it might block 26234 // the whole system. 26235 return getContainerFromFiber(nearestMounted); 26236 } 26237 26238 targetInst = null; 26239 } else if (nearestMounted !== targetInst) { 26240 // If we get an event (ex: img onload) before committing that 26241 // component's mount, ignore it for now (that is, treat it as if it was an 26242 // event on a non-React tree). We might also consider queueing events and 26243 // dispatching them after the mount. 26244 targetInst = null; 26245 } 26246 } 26247 } 26248 26249 return_targetInst = targetInst; // We're not blocked on anything. 26250 26251 return null; 26252} 26253function getEventPriority(domEventName) { 26254 switch (domEventName) { 26255 // Used by SimpleEventPlugin: 26256 case 'cancel': 26257 case 'click': 26258 case 'close': 26259 case 'contextmenu': 26260 case 'copy': 26261 case 'cut': 26262 case 'auxclick': 26263 case 'dblclick': 26264 case 'dragend': 26265 case 'dragstart': 26266 case 'drop': 26267 case 'focusin': 26268 case 'focusout': 26269 case 'input': 26270 case 'invalid': 26271 case 'keydown': 26272 case 'keypress': 26273 case 'keyup': 26274 case 'mousedown': 26275 case 'mouseup': 26276 case 'paste': 26277 case 'pause': 26278 case 'play': 26279 case 'pointercancel': 26280 case 'pointerdown': 26281 case 'pointerup': 26282 case 'ratechange': 26283 case 'reset': 26284 case 'resize': 26285 case 'seeked': 26286 case 'submit': 26287 case 'touchcancel': 26288 case 'touchend': 26289 case 'touchstart': 26290 case 'volumechange': // Used by polyfills: 26291 // eslint-disable-next-line no-fallthrough 26292 26293 case 'change': 26294 case 'selectionchange': 26295 case 'textInput': 26296 case 'compositionstart': 26297 case 'compositionend': 26298 case 'compositionupdate': // Only enableCreateEventHandleAPI: 26299 // eslint-disable-next-line no-fallthrough 26300 26301 case 'beforeblur': 26302 case 'afterblur': // Not used by React but could be by user code: 26303 // eslint-disable-next-line no-fallthrough 26304 26305 case 'beforeinput': 26306 case 'blur': 26307 case 'fullscreenchange': 26308 case 'focus': 26309 case 'hashchange': 26310 case 'popstate': 26311 case 'select': 26312 case 'selectstart': 26313 return DiscreteEventPriority; 26314 26315 case 'drag': 26316 case 'dragenter': 26317 case 'dragexit': 26318 case 'dragleave': 26319 case 'dragover': 26320 case 'mousemove': 26321 case 'mouseout': 26322 case 'mouseover': 26323 case 'pointermove': 26324 case 'pointerout': 26325 case 'pointerover': 26326 case 'scroll': 26327 case 'toggle': 26328 case 'touchmove': 26329 case 'wheel': // Not used by React but could be by user code: 26330 // eslint-disable-next-line no-fallthrough 26331 26332 case 'mouseenter': 26333 case 'mouseleave': 26334 case 'pointerenter': 26335 case 'pointerleave': 26336 return ContinuousEventPriority; 26337 26338 case 'message': 26339 { 26340 // We might be in the Scheduler callback. 26341 // Eventually this mechanism will be replaced by a check 26342 // of the current priority on the native scheduler. 26343 var schedulerPriority = getCurrentPriorityLevel(); 26344 26345 switch (schedulerPriority) { 26346 case ImmediatePriority: 26347 return DiscreteEventPriority; 26348 26349 case UserBlockingPriority: 26350 return ContinuousEventPriority; 26351 26352 case NormalPriority: 26353 case LowPriority: 26354 // TODO: Handle LowSchedulerPriority, somehow. Maybe the same lane as hydration. 26355 return DefaultEventPriority; 26356 26357 case IdlePriority: 26358 return IdleEventPriority; 26359 26360 default: 26361 return DefaultEventPriority; 26362 } 26363 } 26364 26365 default: 26366 return DefaultEventPriority; 26367 } 26368} 26369 26370function addEventBubbleListener(target, eventType, listener) { 26371 target.addEventListener(eventType, listener, false); 26372 return listener; 26373} 26374function addEventCaptureListener(target, eventType, listener) { 26375 target.addEventListener(eventType, listener, true); 26376 return listener; 26377} 26378function addEventCaptureListenerWithPassiveFlag(target, eventType, listener, passive) { 26379 target.addEventListener(eventType, listener, { 26380 capture: true, 26381 passive: passive 26382 }); 26383 return listener; 26384} 26385function addEventBubbleListenerWithPassiveFlag(target, eventType, listener, passive) { 26386 target.addEventListener(eventType, listener, { 26387 passive: passive 26388 }); 26389 return listener; 26390} 26391 26392/** 26393 * These variables store information about text content of a target node, 26394 * allowing comparison of content before and after a given event. 26395 * 26396 * Identify the node where selection currently begins, then observe 26397 * both its text content and its current position in the DOM. Since the 26398 * browser may natively replace the target node during composition, we can 26399 * use its position to find its replacement. 26400 * 26401 * 26402 */ 26403var root = null; 26404var startText = null; 26405var fallbackText = null; 26406function initialize(nativeEventTarget) { 26407 root = nativeEventTarget; 26408 startText = getText(); 26409 return true; 26410} 26411function reset() { 26412 root = null; 26413 startText = null; 26414 fallbackText = null; 26415} 26416function getData() { 26417 if (fallbackText) { 26418 return fallbackText; 26419 } 26420 26421 var start; 26422 var startValue = startText; 26423 var startLength = startValue.length; 26424 var end; 26425 var endValue = getText(); 26426 var endLength = endValue.length; 26427 26428 for (start = 0; start < startLength; start++) { 26429 if (startValue[start] !== endValue[start]) { 26430 break; 26431 } 26432 } 26433 26434 var minEnd = startLength - start; 26435 26436 for (end = 1; end <= minEnd; end++) { 26437 if (startValue[startLength - end] !== endValue[endLength - end]) { 26438 break; 26439 } 26440 } 26441 26442 var sliceTail = end > 1 ? 1 - end : undefined; 26443 fallbackText = endValue.slice(start, sliceTail); 26444 return fallbackText; 26445} 26446function getText() { 26447 if ('value' in root) { 26448 return root.value; 26449 } 26450 26451 return root.textContent; 26452} 26453 26454/** 26455 * `charCode` represents the actual "character code" and is safe to use with 26456 * `String.fromCharCode`. As such, only keys that correspond to printable 26457 * characters produce a valid `charCode`, the only exception to this is Enter. 26458 * The Tab-key is considered non-printable and does not have a `charCode`, 26459 * presumably because it does not produce a tab-character in browsers. 26460 * 26461 * @param {object} nativeEvent Native browser event. 26462 * @return {number} Normalized `charCode` property. 26463 */ 26464function getEventCharCode(nativeEvent) { 26465 var charCode; 26466 var keyCode = nativeEvent.keyCode; 26467 26468 if ('charCode' in nativeEvent) { 26469 charCode = nativeEvent.charCode; // FF does not set `charCode` for the Enter-key, check against `keyCode`. 26470 26471 if (charCode === 0 && keyCode === 13) { 26472 charCode = 13; 26473 } 26474 } else { 26475 // IE8 does not implement `charCode`, but `keyCode` has the correct value. 26476 charCode = keyCode; 26477 } // IE and Edge (on Windows) and Chrome / Safari (on Windows and Linux) 26478 // report Enter as charCode 10 when ctrl is pressed. 26479 26480 26481 if (charCode === 10) { 26482 charCode = 13; 26483 } // Some non-printable keys are reported in `charCode`/`keyCode`, discard them. 26484 // Must not discard the (non-)printable Enter-key. 26485 26486 26487 if (charCode >= 32 || charCode === 13) { 26488 return charCode; 26489 } 26490 26491 return 0; 26492} 26493 26494function functionThatReturnsTrue() { 26495 return true; 26496} 26497 26498function functionThatReturnsFalse() { 26499 return false; 26500} // This is intentionally a factory so that we have different returned constructors. 26501// If we had a single constructor, it would be megamorphic and engines would deopt. 26502 26503 26504function createSyntheticEvent(Interface) { 26505 /** 26506 * Synthetic events are dispatched by event plugins, typically in response to a 26507 * top-level event delegation handler. 26508 * 26509 * These systems should generally use pooling to reduce the frequency of garbage 26510 * collection. The system should check `isPersistent` to determine whether the 26511 * event should be released into the pool after being dispatched. Users that 26512 * need a persisted event should invoke `persist`. 26513 * 26514 * Synthetic events (and subclasses) implement the DOM Level 3 Events API by 26515 * normalizing browser quirks. Subclasses do not necessarily have to implement a 26516 * DOM interface; custom application-specific events can also subclass this. 26517 */ 26518 function SyntheticBaseEvent(reactName, reactEventType, targetInst, nativeEvent, nativeEventTarget) { 26519 this._reactName = reactName; 26520 this._targetInst = targetInst; 26521 this.type = reactEventType; 26522 this.nativeEvent = nativeEvent; 26523 this.target = nativeEventTarget; 26524 this.currentTarget = null; 26525 26526 for (var _propName in Interface) { 26527 if (!Interface.hasOwnProperty(_propName)) { 26528 continue; 26529 } 26530 26531 var normalize = Interface[_propName]; 26532 26533 if (normalize) { 26534 this[_propName] = normalize(nativeEvent); 26535 } else { 26536 this[_propName] = nativeEvent[_propName]; 26537 } 26538 } 26539 26540 var defaultPrevented = nativeEvent.defaultPrevented != null ? nativeEvent.defaultPrevented : nativeEvent.returnValue === false; 26541 26542 if (defaultPrevented) { 26543 this.isDefaultPrevented = functionThatReturnsTrue; 26544 } else { 26545 this.isDefaultPrevented = functionThatReturnsFalse; 26546 } 26547 26548 this.isPropagationStopped = functionThatReturnsFalse; 26549 return this; 26550 } 26551 26552 assign(SyntheticBaseEvent.prototype, { 26553 preventDefault: function () { 26554 this.defaultPrevented = true; 26555 var event = this.nativeEvent; 26556 26557 if (!event) { 26558 return; 26559 } 26560 26561 if (event.preventDefault) { 26562 event.preventDefault(); // $FlowFixMe - flow is not aware of `unknown` in IE 26563 } else if (typeof event.returnValue !== 'unknown') { 26564 event.returnValue = false; 26565 } 26566 26567 this.isDefaultPrevented = functionThatReturnsTrue; 26568 }, 26569 stopPropagation: function () { 26570 var event = this.nativeEvent; 26571 26572 if (!event) { 26573 return; 26574 } 26575 26576 if (event.stopPropagation) { 26577 event.stopPropagation(); // $FlowFixMe - flow is not aware of `unknown` in IE 26578 } else if (typeof event.cancelBubble !== 'unknown') { 26579 // The ChangeEventPlugin registers a "propertychange" event for 26580 // IE. This event does not support bubbling or cancelling, and 26581 // any references to cancelBubble throw "Member not found". A 26582 // typeof check of "unknown" circumvents this issue (and is also 26583 // IE specific). 26584 event.cancelBubble = true; 26585 } 26586 26587 this.isPropagationStopped = functionThatReturnsTrue; 26588 }, 26589 26590 /** 26591 * We release all dispatched `SyntheticEvent`s after each event loop, adding 26592 * them back into the pool. This allows a way to hold onto a reference that 26593 * won't be added back into the pool. 26594 */ 26595 persist: function () {// Modern event system doesn't use pooling. 26596 }, 26597 26598 /** 26599 * Checks if this event should be released back into the pool. 26600 * 26601 * @return {boolean} True if this should not be released, false otherwise. 26602 */ 26603 isPersistent: functionThatReturnsTrue 26604 }); 26605 return SyntheticBaseEvent; 26606} 26607/** 26608 * @interface Event 26609 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 26610 */ 26611 26612 26613var EventInterface = { 26614 eventPhase: 0, 26615 bubbles: 0, 26616 cancelable: 0, 26617 timeStamp: function (event) { 26618 return event.timeStamp || Date.now(); 26619 }, 26620 defaultPrevented: 0, 26621 isTrusted: 0 26622}; 26623var SyntheticEvent = createSyntheticEvent(EventInterface); 26624 26625var UIEventInterface = assign({}, EventInterface, { 26626 view: 0, 26627 detail: 0 26628}); 26629 26630var SyntheticUIEvent = createSyntheticEvent(UIEventInterface); 26631var lastMovementX; 26632var lastMovementY; 26633var lastMouseEvent; 26634 26635function updateMouseMovementPolyfillState(event) { 26636 if (event !== lastMouseEvent) { 26637 if (lastMouseEvent && event.type === 'mousemove') { 26638 lastMovementX = event.screenX - lastMouseEvent.screenX; 26639 lastMovementY = event.screenY - lastMouseEvent.screenY; 26640 } else { 26641 lastMovementX = 0; 26642 lastMovementY = 0; 26643 } 26644 26645 lastMouseEvent = event; 26646 } 26647} 26648/** 26649 * @interface MouseEvent 26650 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 26651 */ 26652 26653 26654var MouseEventInterface = assign({}, UIEventInterface, { 26655 screenX: 0, 26656 screenY: 0, 26657 clientX: 0, 26658 clientY: 0, 26659 pageX: 0, 26660 pageY: 0, 26661 ctrlKey: 0, 26662 shiftKey: 0, 26663 altKey: 0, 26664 metaKey: 0, 26665 getModifierState: getEventModifierState, 26666 button: 0, 26667 buttons: 0, 26668 relatedTarget: function (event) { 26669 if (event.relatedTarget === undefined) return event.fromElement === event.srcElement ? event.toElement : event.fromElement; 26670 return event.relatedTarget; 26671 }, 26672 movementX: function (event) { 26673 if ('movementX' in event) { 26674 return event.movementX; 26675 } 26676 26677 updateMouseMovementPolyfillState(event); 26678 return lastMovementX; 26679 }, 26680 movementY: function (event) { 26681 if ('movementY' in event) { 26682 return event.movementY; 26683 } // Don't need to call updateMouseMovementPolyfillState() here 26684 // because it's guaranteed to have already run when movementX 26685 // was copied. 26686 26687 26688 return lastMovementY; 26689 } 26690}); 26691 26692var SyntheticMouseEvent = createSyntheticEvent(MouseEventInterface); 26693/** 26694 * @interface DragEvent 26695 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 26696 */ 26697 26698var DragEventInterface = assign({}, MouseEventInterface, { 26699 dataTransfer: 0 26700}); 26701 26702var SyntheticDragEvent = createSyntheticEvent(DragEventInterface); 26703/** 26704 * @interface FocusEvent 26705 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 26706 */ 26707 26708var FocusEventInterface = assign({}, UIEventInterface, { 26709 relatedTarget: 0 26710}); 26711 26712var SyntheticFocusEvent = createSyntheticEvent(FocusEventInterface); 26713/** 26714 * @interface Event 26715 * @see http://www.w3.org/TR/css3-animations/#AnimationEvent-interface 26716 * @see https://developer.mozilla.org/en-US/docs/Web/API/AnimationEvent 26717 */ 26718 26719var AnimationEventInterface = assign({}, EventInterface, { 26720 animationName: 0, 26721 elapsedTime: 0, 26722 pseudoElement: 0 26723}); 26724 26725var SyntheticAnimationEvent = createSyntheticEvent(AnimationEventInterface); 26726/** 26727 * @interface Event 26728 * @see http://www.w3.org/TR/clipboard-apis/ 26729 */ 26730 26731var ClipboardEventInterface = assign({}, EventInterface, { 26732 clipboardData: function (event) { 26733 return 'clipboardData' in event ? event.clipboardData : window.clipboardData; 26734 } 26735}); 26736 26737var SyntheticClipboardEvent = createSyntheticEvent(ClipboardEventInterface); 26738/** 26739 * @interface Event 26740 * @see http://www.w3.org/TR/DOM-Level-3-Events/#events-compositionevents 26741 */ 26742 26743var CompositionEventInterface = assign({}, EventInterface, { 26744 data: 0 26745}); 26746 26747var SyntheticCompositionEvent = createSyntheticEvent(CompositionEventInterface); 26748/** 26749 * @interface Event 26750 * @see http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105 26751 * /#events-inputevents 26752 */ 26753// Happens to share the same list for now. 26754 26755var SyntheticInputEvent = SyntheticCompositionEvent; 26756/** 26757 * Normalization of deprecated HTML5 `key` values 26758 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names 26759 */ 26760 26761var normalizeKey = { 26762 Esc: 'Escape', 26763 Spacebar: ' ', 26764 Left: 'ArrowLeft', 26765 Up: 'ArrowUp', 26766 Right: 'ArrowRight', 26767 Down: 'ArrowDown', 26768 Del: 'Delete', 26769 Win: 'OS', 26770 Menu: 'ContextMenu', 26771 Apps: 'ContextMenu', 26772 Scroll: 'ScrollLock', 26773 MozPrintableKey: 'Unidentified' 26774}; 26775/** 26776 * Translation from legacy `keyCode` to HTML5 `key` 26777 * Only special keys supported, all others depend on keyboard layout or browser 26778 * @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Key_names 26779 */ 26780 26781var translateToKey = { 26782 '8': 'Backspace', 26783 '9': 'Tab', 26784 '12': 'Clear', 26785 '13': 'Enter', 26786 '16': 'Shift', 26787 '17': 'Control', 26788 '18': 'Alt', 26789 '19': 'Pause', 26790 '20': 'CapsLock', 26791 '27': 'Escape', 26792 '32': ' ', 26793 '33': 'PageUp', 26794 '34': 'PageDown', 26795 '35': 'End', 26796 '36': 'Home', 26797 '37': 'ArrowLeft', 26798 '38': 'ArrowUp', 26799 '39': 'ArrowRight', 26800 '40': 'ArrowDown', 26801 '45': 'Insert', 26802 '46': 'Delete', 26803 '112': 'F1', 26804 '113': 'F2', 26805 '114': 'F3', 26806 '115': 'F4', 26807 '116': 'F5', 26808 '117': 'F6', 26809 '118': 'F7', 26810 '119': 'F8', 26811 '120': 'F9', 26812 '121': 'F10', 26813 '122': 'F11', 26814 '123': 'F12', 26815 '144': 'NumLock', 26816 '145': 'ScrollLock', 26817 '224': 'Meta' 26818}; 26819/** 26820 * @param {object} nativeEvent Native browser event. 26821 * @return {string} Normalized `key` property. 26822 */ 26823 26824function getEventKey(nativeEvent) { 26825 if (nativeEvent.key) { 26826 // Normalize inconsistent values reported by browsers due to 26827 // implementations of a working draft specification. 26828 // FireFox implements `key` but returns `MozPrintableKey` for all 26829 // printable characters (normalized to `Unidentified`), ignore it. 26830 var key = normalizeKey[nativeEvent.key] || nativeEvent.key; 26831 26832 if (key !== 'Unidentified') { 26833 return key; 26834 } 26835 } // Browser does not implement `key`, polyfill as much of it as we can. 26836 26837 26838 if (nativeEvent.type === 'keypress') { 26839 var charCode = getEventCharCode(nativeEvent); // The enter-key is technically both printable and non-printable and can 26840 // thus be captured by `keypress`, no other non-printable key should. 26841 26842 return charCode === 13 ? 'Enter' : String.fromCharCode(charCode); 26843 } 26844 26845 if (nativeEvent.type === 'keydown' || nativeEvent.type === 'keyup') { 26846 // While user keyboard layout determines the actual meaning of each 26847 // `keyCode` value, almost all function keys have a universal value. 26848 return translateToKey[nativeEvent.keyCode] || 'Unidentified'; 26849 } 26850 26851 return ''; 26852} 26853/** 26854 * Translation from modifier key to the associated property in the event. 26855 * @see http://www.w3.org/TR/DOM-Level-3-Events/#keys-Modifiers 26856 */ 26857 26858 26859var modifierKeyToProp = { 26860 Alt: 'altKey', 26861 Control: 'ctrlKey', 26862 Meta: 'metaKey', 26863 Shift: 'shiftKey' 26864}; // Older browsers (Safari <= 10, iOS Safari <= 10.2) do not support 26865// getModifierState. If getModifierState is not supported, we map it to a set of 26866// modifier keys exposed by the event. In this case, Lock-keys are not supported. 26867 26868function modifierStateGetter(keyArg) { 26869 var syntheticEvent = this; 26870 var nativeEvent = syntheticEvent.nativeEvent; 26871 26872 if (nativeEvent.getModifierState) { 26873 return nativeEvent.getModifierState(keyArg); 26874 } 26875 26876 var keyProp = modifierKeyToProp[keyArg]; 26877 return keyProp ? !!nativeEvent[keyProp] : false; 26878} 26879 26880function getEventModifierState(nativeEvent) { 26881 return modifierStateGetter; 26882} 26883/** 26884 * @interface KeyboardEvent 26885 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 26886 */ 26887 26888 26889var KeyboardEventInterface = assign({}, UIEventInterface, { 26890 key: getEventKey, 26891 code: 0, 26892 location: 0, 26893 ctrlKey: 0, 26894 shiftKey: 0, 26895 altKey: 0, 26896 metaKey: 0, 26897 repeat: 0, 26898 locale: 0, 26899 getModifierState: getEventModifierState, 26900 // Legacy Interface 26901 charCode: function (event) { 26902 // `charCode` is the result of a KeyPress event and represents the value of 26903 // the actual printable character. 26904 // KeyPress is deprecated, but its replacement is not yet final and not 26905 // implemented in any major browser. Only KeyPress has charCode. 26906 if (event.type === 'keypress') { 26907 return getEventCharCode(event); 26908 } 26909 26910 return 0; 26911 }, 26912 keyCode: function (event) { 26913 // `keyCode` is the result of a KeyDown/Up event and represents the value of 26914 // physical keyboard key. 26915 // The actual meaning of the value depends on the users' keyboard layout 26916 // which cannot be detected. Assuming that it is a US keyboard layout 26917 // provides a surprisingly accurate mapping for US and European users. 26918 // Due to this, it is left to the user to implement at this time. 26919 if (event.type === 'keydown' || event.type === 'keyup') { 26920 return event.keyCode; 26921 } 26922 26923 return 0; 26924 }, 26925 which: function (event) { 26926 // `which` is an alias for either `keyCode` or `charCode` depending on the 26927 // type of the event. 26928 if (event.type === 'keypress') { 26929 return getEventCharCode(event); 26930 } 26931 26932 if (event.type === 'keydown' || event.type === 'keyup') { 26933 return event.keyCode; 26934 } 26935 26936 return 0; 26937 } 26938}); 26939 26940var SyntheticKeyboardEvent = createSyntheticEvent(KeyboardEventInterface); 26941/** 26942 * @interface PointerEvent 26943 * @see http://www.w3.org/TR/pointerevents/ 26944 */ 26945 26946var PointerEventInterface = assign({}, MouseEventInterface, { 26947 pointerId: 0, 26948 width: 0, 26949 height: 0, 26950 pressure: 0, 26951 tangentialPressure: 0, 26952 tiltX: 0, 26953 tiltY: 0, 26954 twist: 0, 26955 pointerType: 0, 26956 isPrimary: 0 26957}); 26958 26959var SyntheticPointerEvent = createSyntheticEvent(PointerEventInterface); 26960/** 26961 * @interface TouchEvent 26962 * @see http://www.w3.org/TR/touch-events/ 26963 */ 26964 26965var TouchEventInterface = assign({}, UIEventInterface, { 26966 touches: 0, 26967 targetTouches: 0, 26968 changedTouches: 0, 26969 altKey: 0, 26970 metaKey: 0, 26971 ctrlKey: 0, 26972 shiftKey: 0, 26973 getModifierState: getEventModifierState 26974}); 26975 26976var SyntheticTouchEvent = createSyntheticEvent(TouchEventInterface); 26977/** 26978 * @interface Event 26979 * @see http://www.w3.org/TR/2009/WD-css3-transitions-20090320/#transition-events- 26980 * @see https://developer.mozilla.org/en-US/docs/Web/API/TransitionEvent 26981 */ 26982 26983var TransitionEventInterface = assign({}, EventInterface, { 26984 propertyName: 0, 26985 elapsedTime: 0, 26986 pseudoElement: 0 26987}); 26988 26989var SyntheticTransitionEvent = createSyntheticEvent(TransitionEventInterface); 26990/** 26991 * @interface WheelEvent 26992 * @see http://www.w3.org/TR/DOM-Level-3-Events/ 26993 */ 26994 26995var WheelEventInterface = assign({}, MouseEventInterface, { 26996 deltaX: function (event) { 26997 return 'deltaX' in event ? event.deltaX : // Fallback to `wheelDeltaX` for Webkit and normalize (right is positive). 26998 'wheelDeltaX' in event ? -event.wheelDeltaX : 0; 26999 }, 27000 deltaY: function (event) { 27001 return 'deltaY' in event ? event.deltaY : // Fallback to `wheelDeltaY` for Webkit and normalize (down is positive). 27002 'wheelDeltaY' in event ? -event.wheelDeltaY : // Fallback to `wheelDelta` for IE<9 and normalize (down is positive). 27003 'wheelDelta' in event ? -event.wheelDelta : 0; 27004 }, 27005 deltaZ: 0, 27006 // Browsers without "deltaMode" is reporting in raw wheel delta where one 27007 // notch on the scroll is always +/- 120, roughly equivalent to pixels. 27008 // A good approximation of DOM_DELTA_LINE (1) is 5% of viewport size or 27009 // ~40 pixels, for DOM_DELTA_SCREEN (2) it is 87.5% of viewport size. 27010 deltaMode: 0 27011}); 27012 27013var SyntheticWheelEvent = createSyntheticEvent(WheelEventInterface); 27014 27015var END_KEYCODES = [9, 13, 27, 32]; // Tab, Return, Esc, Space 27016 27017var START_KEYCODE = 229; 27018var canUseCompositionEvent = canUseDOM && 'CompositionEvent' in window; 27019var documentMode = null; 27020 27021if (canUseDOM && 'documentMode' in document) { 27022 documentMode = document.documentMode; 27023} // Webkit offers a very useful `textInput` event that can be used to 27024// directly represent `beforeInput`. The IE `textinput` event is not as 27025// useful, so we don't use it. 27026 27027 27028var canUseTextInputEvent = canUseDOM && 'TextEvent' in window && !documentMode; // In IE9+, we have access to composition events, but the data supplied 27029// by the native compositionend event may be incorrect. Japanese ideographic 27030// spaces, for instance (\u3000) are not recorded correctly. 27031 27032var useFallbackCompositionData = canUseDOM && (!canUseCompositionEvent || documentMode && documentMode > 8 && documentMode <= 11); 27033var SPACEBAR_CODE = 32; 27034var SPACEBAR_CHAR = String.fromCharCode(SPACEBAR_CODE); 27035 27036function registerEvents() { 27037 registerTwoPhaseEvent('onBeforeInput', ['compositionend', 'keypress', 'textInput', 'paste']); 27038 registerTwoPhaseEvent('onCompositionEnd', ['compositionend', 'focusout', 'keydown', 'keypress', 'keyup', 'mousedown']); 27039 registerTwoPhaseEvent('onCompositionStart', ['compositionstart', 'focusout', 'keydown', 'keypress', 'keyup', 'mousedown']); 27040 registerTwoPhaseEvent('onCompositionUpdate', ['compositionupdate', 'focusout', 'keydown', 'keypress', 'keyup', 'mousedown']); 27041} // Track whether we've ever handled a keypress on the space key. 27042 27043 27044var hasSpaceKeypress = false; 27045/** 27046 * Return whether a native keypress event is assumed to be a command. 27047 * This is required because Firefox fires `keypress` events for key commands 27048 * (cut, copy, select-all, etc.) even though no character is inserted. 27049 */ 27050 27051function isKeypressCommand(nativeEvent) { 27052 return (nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) && // ctrlKey && altKey is equivalent to AltGr, and is not a command. 27053 !(nativeEvent.ctrlKey && nativeEvent.altKey); 27054} 27055/** 27056 * Translate native top level events into event types. 27057 */ 27058 27059 27060function getCompositionEventType(domEventName) { 27061 switch (domEventName) { 27062 case 'compositionstart': 27063 return 'onCompositionStart'; 27064 27065 case 'compositionend': 27066 return 'onCompositionEnd'; 27067 27068 case 'compositionupdate': 27069 return 'onCompositionUpdate'; 27070 } 27071} 27072/** 27073 * Does our fallback best-guess model think this event signifies that 27074 * composition has begun? 27075 */ 27076 27077 27078function isFallbackCompositionStart(domEventName, nativeEvent) { 27079 return domEventName === 'keydown' && nativeEvent.keyCode === START_KEYCODE; 27080} 27081/** 27082 * Does our fallback mode think that this event is the end of composition? 27083 */ 27084 27085 27086function isFallbackCompositionEnd(domEventName, nativeEvent) { 27087 switch (domEventName) { 27088 case 'keyup': 27089 // Command keys insert or clear IME input. 27090 return END_KEYCODES.indexOf(nativeEvent.keyCode) !== -1; 27091 27092 case 'keydown': 27093 // Expect IME keyCode on each keydown. If we get any other 27094 // code we must have exited earlier. 27095 return nativeEvent.keyCode !== START_KEYCODE; 27096 27097 case 'keypress': 27098 case 'mousedown': 27099 case 'focusout': 27100 // Events are not possible without cancelling IME. 27101 return true; 27102 27103 default: 27104 return false; 27105 } 27106} 27107/** 27108 * Google Input Tools provides composition data via a CustomEvent, 27109 * with the `data` property populated in the `detail` object. If this 27110 * is available on the event object, use it. If not, this is a plain 27111 * composition event and we have nothing special to extract. 27112 * 27113 * @param {object} nativeEvent 27114 * @return {?string} 27115 */ 27116 27117 27118function getDataFromCustomEvent(nativeEvent) { 27119 var detail = nativeEvent.detail; 27120 27121 if (typeof detail === 'object' && 'data' in detail) { 27122 return detail.data; 27123 } 27124 27125 return null; 27126} 27127/** 27128 * Check if a composition event was triggered by Korean IME. 27129 * Our fallback mode does not work well with IE's Korean IME, 27130 * so just use native composition events when Korean IME is used. 27131 * Although CompositionEvent.locale property is deprecated, 27132 * it is available in IE, where our fallback mode is enabled. 27133 * 27134 * @param {object} nativeEvent 27135 * @return {boolean} 27136 */ 27137 27138 27139function isUsingKoreanIME(nativeEvent) { 27140 return nativeEvent.locale === 'ko'; 27141} // Track the current IME composition status, if any. 27142 27143 27144var isComposing = false; 27145/** 27146 * @return {?object} A SyntheticCompositionEvent. 27147 */ 27148 27149function extractCompositionEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget) { 27150 var eventType; 27151 var fallbackData; 27152 27153 if (canUseCompositionEvent) { 27154 eventType = getCompositionEventType(domEventName); 27155 } else if (!isComposing) { 27156 if (isFallbackCompositionStart(domEventName, nativeEvent)) { 27157 eventType = 'onCompositionStart'; 27158 } 27159 } else if (isFallbackCompositionEnd(domEventName, nativeEvent)) { 27160 eventType = 'onCompositionEnd'; 27161 } 27162 27163 if (!eventType) { 27164 return null; 27165 } 27166 27167 if (useFallbackCompositionData && !isUsingKoreanIME(nativeEvent)) { 27168 // The current composition is stored statically and must not be 27169 // overwritten while composition continues. 27170 if (!isComposing && eventType === 'onCompositionStart') { 27171 isComposing = initialize(nativeEventTarget); 27172 } else if (eventType === 'onCompositionEnd') { 27173 if (isComposing) { 27174 fallbackData = getData(); 27175 } 27176 } 27177 } 27178 27179 var listeners = accumulateTwoPhaseListeners(targetInst, eventType); 27180 27181 if (listeners.length > 0) { 27182 var event = new SyntheticCompositionEvent(eventType, domEventName, null, nativeEvent, nativeEventTarget); 27183 dispatchQueue.push({ 27184 event: event, 27185 listeners: listeners 27186 }); 27187 27188 if (fallbackData) { 27189 // Inject data generated from fallback path into the synthetic event. 27190 // This matches the property of native CompositionEventInterface. 27191 event.data = fallbackData; 27192 } else { 27193 var customData = getDataFromCustomEvent(nativeEvent); 27194 27195 if (customData !== null) { 27196 event.data = customData; 27197 } 27198 } 27199 } 27200} 27201 27202function getNativeBeforeInputChars(domEventName, nativeEvent) { 27203 switch (domEventName) { 27204 case 'compositionend': 27205 return getDataFromCustomEvent(nativeEvent); 27206 27207 case 'keypress': 27208 /** 27209 * If native `textInput` events are available, our goal is to make 27210 * use of them. However, there is a special case: the spacebar key. 27211 * In Webkit, preventing default on a spacebar `textInput` event 27212 * cancels character insertion, but it *also* causes the browser 27213 * to fall back to its default spacebar behavior of scrolling the 27214 * page. 27215 * 27216 * Tracking at: 27217 * https://code.google.com/p/chromium/issues/detail?id=355103 27218 * 27219 * To avoid this issue, use the keypress event as if no `textInput` 27220 * event is available. 27221 */ 27222 var which = nativeEvent.which; 27223 27224 if (which !== SPACEBAR_CODE) { 27225 return null; 27226 } 27227 27228 hasSpaceKeypress = true; 27229 return SPACEBAR_CHAR; 27230 27231 case 'textInput': 27232 // Record the characters to be added to the DOM. 27233 var chars = nativeEvent.data; // If it's a spacebar character, assume that we have already handled 27234 // it at the keypress level and bail immediately. Android Chrome 27235 // doesn't give us keycodes, so we need to ignore it. 27236 27237 if (chars === SPACEBAR_CHAR && hasSpaceKeypress) { 27238 return null; 27239 } 27240 27241 return chars; 27242 27243 default: 27244 // For other native event types, do nothing. 27245 return null; 27246 } 27247} 27248/** 27249 * For browsers that do not provide the `textInput` event, extract the 27250 * appropriate string to use for SyntheticInputEvent. 27251 */ 27252 27253 27254function getFallbackBeforeInputChars(domEventName, nativeEvent) { 27255 // If we are currently composing (IME) and using a fallback to do so, 27256 // try to extract the composed characters from the fallback object. 27257 // If composition event is available, we extract a string only at 27258 // compositionevent, otherwise extract it at fallback events. 27259 if (isComposing) { 27260 if (domEventName === 'compositionend' || !canUseCompositionEvent && isFallbackCompositionEnd(domEventName, nativeEvent)) { 27261 var chars = getData(); 27262 reset(); 27263 isComposing = false; 27264 return chars; 27265 } 27266 27267 return null; 27268 } 27269 27270 switch (domEventName) { 27271 case 'paste': 27272 // If a paste event occurs after a keypress, throw out the input 27273 // chars. Paste events should not lead to BeforeInput events. 27274 return null; 27275 27276 case 'keypress': 27277 /** 27278 * As of v27, Firefox may fire keypress events even when no character 27279 * will be inserted. A few possibilities: 27280 * 27281 * - `which` is `0`. Arrow keys, Esc key, etc. 27282 * 27283 * - `which` is the pressed key code, but no char is available. 27284 * Ex: 'AltGr + d` in Polish. There is no modified character for 27285 * this key combination and no character is inserted into the 27286 * document, but FF fires the keypress for char code `100` anyway. 27287 * No `input` event will occur. 27288 * 27289 * - `which` is the pressed key code, but a command combination is 27290 * being used. Ex: `Cmd+C`. No character is inserted, and no 27291 * `input` event will occur. 27292 */ 27293 if (!isKeypressCommand(nativeEvent)) { 27294 // IE fires the `keypress` event when a user types an emoji via 27295 // Touch keyboard of Windows. In such a case, the `char` property 27296 // holds an emoji character like `\uD83D\uDE0A`. Because its length 27297 // is 2, the property `which` does not represent an emoji correctly. 27298 // In such a case, we directly return the `char` property instead of 27299 // using `which`. 27300 if (nativeEvent.char && nativeEvent.char.length > 1) { 27301 return nativeEvent.char; 27302 } else if (nativeEvent.which) { 27303 return String.fromCharCode(nativeEvent.which); 27304 } 27305 } 27306 27307 return null; 27308 27309 case 'compositionend': 27310 return useFallbackCompositionData && !isUsingKoreanIME(nativeEvent) ? null : nativeEvent.data; 27311 27312 default: 27313 return null; 27314 } 27315} 27316/** 27317 * Extract a SyntheticInputEvent for `beforeInput`, based on either native 27318 * `textInput` or fallback behavior. 27319 * 27320 * @return {?object} A SyntheticInputEvent. 27321 */ 27322 27323 27324function extractBeforeInputEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget) { 27325 var chars; 27326 27327 if (canUseTextInputEvent) { 27328 chars = getNativeBeforeInputChars(domEventName, nativeEvent); 27329 } else { 27330 chars = getFallbackBeforeInputChars(domEventName, nativeEvent); 27331 } // If no characters are being inserted, no BeforeInput event should 27332 // be fired. 27333 27334 27335 if (!chars) { 27336 return null; 27337 } 27338 27339 var listeners = accumulateTwoPhaseListeners(targetInst, 'onBeforeInput'); 27340 27341 if (listeners.length > 0) { 27342 var event = new SyntheticInputEvent('onBeforeInput', 'beforeinput', null, nativeEvent, nativeEventTarget); 27343 dispatchQueue.push({ 27344 event: event, 27345 listeners: listeners 27346 }); 27347 event.data = chars; 27348 } 27349} 27350/** 27351 * Create an `onBeforeInput` event to match 27352 * http://www.w3.org/TR/2013/WD-DOM-Level-3-Events-20131105/#events-inputevents. 27353 * 27354 * This event plugin is based on the native `textInput` event 27355 * available in Chrome, Safari, Opera, and IE. This event fires after 27356 * `onKeyPress` and `onCompositionEnd`, but before `onInput`. 27357 * 27358 * `beforeInput` is spec'd but not implemented in any browsers, and 27359 * the `input` event does not provide any useful information about what has 27360 * actually been added, contrary to the spec. Thus, `textInput` is the best 27361 * available event to identify the characters that have actually been inserted 27362 * into the target node. 27363 * 27364 * This plugin is also responsible for emitting `composition` events, thus 27365 * allowing us to share composition fallback code for both `beforeInput` and 27366 * `composition` event types. 27367 */ 27368 27369 27370function extractEvents(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { 27371 extractCompositionEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); 27372 extractBeforeInputEvent(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); 27373} 27374 27375/** 27376 * @see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#input-type-attr-summary 27377 */ 27378var supportedInputTypes = { 27379 color: true, 27380 date: true, 27381 datetime: true, 27382 'datetime-local': true, 27383 email: true, 27384 month: true, 27385 number: true, 27386 password: true, 27387 range: true, 27388 search: true, 27389 tel: true, 27390 text: true, 27391 time: true, 27392 url: true, 27393 week: true 27394}; 27395 27396function isTextInputElement(elem) { 27397 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); 27398 27399 if (nodeName === 'input') { 27400 return !!supportedInputTypes[elem.type]; 27401 } 27402 27403 if (nodeName === 'textarea') { 27404 return true; 27405 } 27406 27407 return false; 27408} 27409 27410/** 27411 * Checks if an event is supported in the current execution environment. 27412 * 27413 * NOTE: This will not work correctly for non-generic events such as `change`, 27414 * `reset`, `load`, `error`, and `select`. 27415 * 27416 * Borrows from Modernizr. 27417 * 27418 * @param {string} eventNameSuffix Event name, e.g. "click". 27419 * @return {boolean} True if the event is supported. 27420 * @internal 27421 * @license Modernizr 3.0.0pre (Custom Build) | MIT 27422 */ 27423 27424function isEventSupported(eventNameSuffix) { 27425 if (!canUseDOM) { 27426 return false; 27427 } 27428 27429 var eventName = 'on' + eventNameSuffix; 27430 var isSupported = (eventName in document); 27431 27432 if (!isSupported) { 27433 var element = document.createElement('div'); 27434 element.setAttribute(eventName, 'return;'); 27435 isSupported = typeof element[eventName] === 'function'; 27436 } 27437 27438 return isSupported; 27439} 27440 27441function registerEvents$1() { 27442 registerTwoPhaseEvent('onChange', ['change', 'click', 'focusin', 'focusout', 'input', 'keydown', 'keyup', 'selectionchange']); 27443} 27444 27445function createAndAccumulateChangeEvent(dispatchQueue, inst, nativeEvent, target) { 27446 // Flag this event loop as needing state restore. 27447 enqueueStateRestore(target); 27448 var listeners = accumulateTwoPhaseListeners(inst, 'onChange'); 27449 27450 if (listeners.length > 0) { 27451 var event = new SyntheticEvent('onChange', 'change', null, nativeEvent, target); 27452 dispatchQueue.push({ 27453 event: event, 27454 listeners: listeners 27455 }); 27456 } 27457} 27458/** 27459 * For IE shims 27460 */ 27461 27462 27463var activeElement = null; 27464var activeElementInst = null; 27465/** 27466 * SECTION: handle `change` event 27467 */ 27468 27469function shouldUseChangeEvent(elem) { 27470 var nodeName = elem.nodeName && elem.nodeName.toLowerCase(); 27471 return nodeName === 'select' || nodeName === 'input' && elem.type === 'file'; 27472} 27473 27474function manualDispatchChangeEvent(nativeEvent) { 27475 var dispatchQueue = []; 27476 createAndAccumulateChangeEvent(dispatchQueue, activeElementInst, nativeEvent, getEventTarget(nativeEvent)); // If change and propertychange bubbled, we'd just bind to it like all the 27477 // other events and have it go through ReactBrowserEventEmitter. Since it 27478 // doesn't, we manually listen for the events and so we have to enqueue and 27479 // process the abstract event manually. 27480 // 27481 // Batching is necessary here in order to ensure that all event handlers run 27482 // before the next rerender (including event handlers attached to ancestor 27483 // elements instead of directly on the input). Without this, controlled 27484 // components don't work properly in conjunction with event bubbling because 27485 // the component is rerendered and the value reverted before all the event 27486 // handlers can run. See https://github.com/facebook/react/issues/708. 27487 27488 batchedUpdates(runEventInBatch, dispatchQueue); 27489} 27490 27491function runEventInBatch(dispatchQueue) { 27492 processDispatchQueue(dispatchQueue, 0); 27493} 27494 27495function getInstIfValueChanged(targetInst) { 27496 var targetNode = getNodeFromInstance(targetInst); 27497 27498 if (updateValueIfChanged(targetNode)) { 27499 return targetInst; 27500 } 27501} 27502 27503function getTargetInstForChangeEvent(domEventName, targetInst) { 27504 if (domEventName === 'change') { 27505 return targetInst; 27506 } 27507} 27508/** 27509 * SECTION: handle `input` event 27510 */ 27511 27512 27513var isInputEventSupported = false; 27514 27515if (canUseDOM) { 27516 // IE9 claims to support the input event but fails to trigger it when 27517 // deleting text, so we ignore its input events. 27518 isInputEventSupported = isEventSupported('input') && (!document.documentMode || document.documentMode > 9); 27519} 27520/** 27521 * (For IE <=9) Starts tracking propertychange events on the passed-in element 27522 * and override the value property so that we can distinguish user events from 27523 * value changes in JS. 27524 */ 27525 27526 27527function startWatchingForValueChange(target, targetInst) { 27528 activeElement = target; 27529 activeElementInst = targetInst; 27530 activeElement.attachEvent('onpropertychange', handlePropertyChange); 27531} 27532/** 27533 * (For IE <=9) Removes the event listeners from the currently-tracked element, 27534 * if any exists. 27535 */ 27536 27537 27538function stopWatchingForValueChange() { 27539 if (!activeElement) { 27540 return; 27541 } 27542 27543 activeElement.detachEvent('onpropertychange', handlePropertyChange); 27544 activeElement = null; 27545 activeElementInst = null; 27546} 27547/** 27548 * (For IE <=9) Handles a propertychange event, sending a `change` event if 27549 * the value of the active element has changed. 27550 */ 27551 27552 27553function handlePropertyChange(nativeEvent) { 27554 if (nativeEvent.propertyName !== 'value') { 27555 return; 27556 } 27557 27558 if (getInstIfValueChanged(activeElementInst)) { 27559 manualDispatchChangeEvent(nativeEvent); 27560 } 27561} 27562 27563function handleEventsForInputEventPolyfill(domEventName, target, targetInst) { 27564 if (domEventName === 'focusin') { 27565 // In IE9, propertychange fires for most input events but is buggy and 27566 // doesn't fire when text is deleted, but conveniently, selectionchange 27567 // appears to fire in all of the remaining cases so we catch those and 27568 // forward the event if the value has changed 27569 // In either case, we don't want to call the event handler if the value 27570 // is changed from JS so we redefine a setter for `.value` that updates 27571 // our activeElementValue variable, allowing us to ignore those changes 27572 // 27573 // stopWatching() should be a noop here but we call it just in case we 27574 // missed a blur event somehow. 27575 stopWatchingForValueChange(); 27576 startWatchingForValueChange(target, targetInst); 27577 } else if (domEventName === 'focusout') { 27578 stopWatchingForValueChange(); 27579 } 27580} // For IE8 and IE9. 27581 27582 27583function getTargetInstForInputEventPolyfill(domEventName, targetInst) { 27584 if (domEventName === 'selectionchange' || domEventName === 'keyup' || domEventName === 'keydown') { 27585 // On the selectionchange event, the target is just document which isn't 27586 // helpful for us so just check activeElement instead. 27587 // 27588 // 99% of the time, keydown and keyup aren't necessary. IE8 fails to fire 27589 // propertychange on the first input event after setting `value` from a 27590 // script and fires only keydown, keypress, keyup. Catching keyup usually 27591 // gets it and catching keydown lets us fire an event for the first 27592 // keystroke if user does a key repeat (it'll be a little delayed: right 27593 // before the second keystroke). Other input methods (e.g., paste) seem to 27594 // fire selectionchange normally. 27595 return getInstIfValueChanged(activeElementInst); 27596 } 27597} 27598/** 27599 * SECTION: handle `click` event 27600 */ 27601 27602 27603function shouldUseClickEvent(elem) { 27604 // Use the `click` event to detect changes to checkbox and radio inputs. 27605 // This approach works across all browsers, whereas `change` does not fire 27606 // until `blur` in IE8. 27607 var nodeName = elem.nodeName; 27608 return nodeName && nodeName.toLowerCase() === 'input' && (elem.type === 'checkbox' || elem.type === 'radio'); 27609} 27610 27611function getTargetInstForClickEvent(domEventName, targetInst) { 27612 if (domEventName === 'click') { 27613 return getInstIfValueChanged(targetInst); 27614 } 27615} 27616 27617function getTargetInstForInputOrChangeEvent(domEventName, targetInst) { 27618 if (domEventName === 'input' || domEventName === 'change') { 27619 return getInstIfValueChanged(targetInst); 27620 } 27621} 27622 27623function handleControlledInputBlur(node) { 27624 var state = node._wrapperState; 27625 27626 if (!state || !state.controlled || node.type !== 'number') { 27627 return; 27628 } 27629 27630 { 27631 // If controlled, assign the value attribute to the current value on blur 27632 setDefaultValue(node, 'number', node.value); 27633 } 27634} 27635/** 27636 * This plugin creates an `onChange` event that normalizes change events 27637 * across form elements. This event fires at a time when it's possible to 27638 * change the element's value without seeing a flicker. 27639 * 27640 * Supported elements are: 27641 * - input (see `isTextInputElement`) 27642 * - textarea 27643 * - select 27644 */ 27645 27646 27647function extractEvents$1(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { 27648 var targetNode = targetInst ? getNodeFromInstance(targetInst) : window; 27649 var getTargetInstFunc, handleEventFunc; 27650 27651 if (shouldUseChangeEvent(targetNode)) { 27652 getTargetInstFunc = getTargetInstForChangeEvent; 27653 } else if (isTextInputElement(targetNode)) { 27654 if (isInputEventSupported) { 27655 getTargetInstFunc = getTargetInstForInputOrChangeEvent; 27656 } else { 27657 getTargetInstFunc = getTargetInstForInputEventPolyfill; 27658 handleEventFunc = handleEventsForInputEventPolyfill; 27659 } 27660 } else if (shouldUseClickEvent(targetNode)) { 27661 getTargetInstFunc = getTargetInstForClickEvent; 27662 } 27663 27664 if (getTargetInstFunc) { 27665 var inst = getTargetInstFunc(domEventName, targetInst); 27666 27667 if (inst) { 27668 createAndAccumulateChangeEvent(dispatchQueue, inst, nativeEvent, nativeEventTarget); 27669 return; 27670 } 27671 } 27672 27673 if (handleEventFunc) { 27674 handleEventFunc(domEventName, targetNode, targetInst); 27675 } // When blurring, set the value attribute for number inputs 27676 27677 27678 if (domEventName === 'focusout') { 27679 handleControlledInputBlur(targetNode); 27680 } 27681} 27682 27683function registerEvents$2() { 27684 registerDirectEvent('onMouseEnter', ['mouseout', 'mouseover']); 27685 registerDirectEvent('onMouseLeave', ['mouseout', 'mouseover']); 27686 registerDirectEvent('onPointerEnter', ['pointerout', 'pointerover']); 27687 registerDirectEvent('onPointerLeave', ['pointerout', 'pointerover']); 27688} 27689/** 27690 * For almost every interaction we care about, there will be both a top-level 27691 * `mouseover` and `mouseout` event that occurs. Only use `mouseout` so that 27692 * we do not extract duplicate events. However, moving the mouse into the 27693 * browser from outside will not fire a `mouseout` event. In this case, we use 27694 * the `mouseover` top-level event. 27695 */ 27696 27697 27698function extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { 27699 var isOverEvent = domEventName === 'mouseover' || domEventName === 'pointerover'; 27700 var isOutEvent = domEventName === 'mouseout' || domEventName === 'pointerout'; 27701 27702 if (isOverEvent && !isReplayingEvent(nativeEvent)) { 27703 // If this is an over event with a target, we might have already dispatched 27704 // the event in the out event of the other target. If this is replayed, 27705 // then it's because we couldn't dispatch against this target previously 27706 // so we have to do it now instead. 27707 var related = nativeEvent.relatedTarget || nativeEvent.fromElement; 27708 27709 if (related) { 27710 // If the related node is managed by React, we can assume that we have 27711 // already dispatched the corresponding events during its mouseout. 27712 if (getClosestInstanceFromNode(related) || isContainerMarkedAsRoot(related)) { 27713 return; 27714 } 27715 } 27716 } 27717 27718 if (!isOutEvent && !isOverEvent) { 27719 // Must not be a mouse or pointer in or out - ignoring. 27720 return; 27721 } 27722 27723 var win; // TODO: why is this nullable in the types but we read from it? 27724 27725 if (nativeEventTarget.window === nativeEventTarget) { 27726 // `nativeEventTarget` is probably a window object. 27727 win = nativeEventTarget; 27728 } else { 27729 // TODO: Figure out why `ownerDocument` is sometimes undefined in IE8. 27730 var doc = nativeEventTarget.ownerDocument; 27731 27732 if (doc) { 27733 win = doc.defaultView || doc.parentWindow; 27734 } else { 27735 win = window; 27736 } 27737 } 27738 27739 var from; 27740 var to; 27741 27742 if (isOutEvent) { 27743 var _related = nativeEvent.relatedTarget || nativeEvent.toElement; 27744 27745 from = targetInst; 27746 to = _related ? getClosestInstanceFromNode(_related) : null; 27747 27748 if (to !== null) { 27749 var nearestMounted = getNearestMountedFiber(to); 27750 27751 if (to !== nearestMounted || to.tag !== HostComponent && to.tag !== HostText) { 27752 to = null; 27753 } 27754 } 27755 } else { 27756 // Moving to a node from outside the window. 27757 from = null; 27758 to = targetInst; 27759 } 27760 27761 if (from === to) { 27762 // Nothing pertains to our managed components. 27763 return; 27764 } 27765 27766 var SyntheticEventCtor = SyntheticMouseEvent; 27767 var leaveEventType = 'onMouseLeave'; 27768 var enterEventType = 'onMouseEnter'; 27769 var eventTypePrefix = 'mouse'; 27770 27771 if (domEventName === 'pointerout' || domEventName === 'pointerover') { 27772 SyntheticEventCtor = SyntheticPointerEvent; 27773 leaveEventType = 'onPointerLeave'; 27774 enterEventType = 'onPointerEnter'; 27775 eventTypePrefix = 'pointer'; 27776 } 27777 27778 var fromNode = from == null ? win : getNodeFromInstance(from); 27779 var toNode = to == null ? win : getNodeFromInstance(to); 27780 var leave = new SyntheticEventCtor(leaveEventType, eventTypePrefix + 'leave', from, nativeEvent, nativeEventTarget); 27781 leave.target = fromNode; 27782 leave.relatedTarget = toNode; 27783 var enter = null; // We should only process this nativeEvent if we are processing 27784 // the first ancestor. Next time, we will ignore the event. 27785 27786 var nativeTargetInst = getClosestInstanceFromNode(nativeEventTarget); 27787 27788 if (nativeTargetInst === targetInst) { 27789 var enterEvent = new SyntheticEventCtor(enterEventType, eventTypePrefix + 'enter', to, nativeEvent, nativeEventTarget); 27790 enterEvent.target = toNode; 27791 enterEvent.relatedTarget = fromNode; 27792 enter = enterEvent; 27793 } 27794 27795 accumulateEnterLeaveTwoPhaseListeners(dispatchQueue, leave, enter, from, to); 27796} 27797 27798/** 27799 * inlined Object.is polyfill to avoid requiring consumers ship their own 27800 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 27801 */ 27802function is(x, y) { 27803 return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare 27804 ; 27805} 27806 27807var objectIs = typeof Object.is === 'function' ? Object.is : is; 27808 27809/** 27810 * Performs equality by iterating through keys on an object and returning false 27811 * when any key has values which are not strictly equal between the arguments. 27812 * Returns true when the values of all keys are strictly equal. 27813 */ 27814 27815function shallowEqual(objA, objB) { 27816 if (objectIs(objA, objB)) { 27817 return true; 27818 } 27819 27820 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { 27821 return false; 27822 } 27823 27824 var keysA = Object.keys(objA); 27825 var keysB = Object.keys(objB); 27826 27827 if (keysA.length !== keysB.length) { 27828 return false; 27829 } // Test for A's keys different from B. 27830 27831 27832 for (var i = 0; i < keysA.length; i++) { 27833 var currentKey = keysA[i]; 27834 27835 if (!hasOwnProperty.call(objB, currentKey) || !objectIs(objA[currentKey], objB[currentKey])) { 27836 return false; 27837 } 27838 } 27839 27840 return true; 27841} 27842 27843/** 27844 * Given any node return the first leaf node without children. 27845 * 27846 * @param {DOMElement|DOMTextNode} node 27847 * @return {DOMElement|DOMTextNode} 27848 */ 27849 27850function getLeafNode(node) { 27851 while (node && node.firstChild) { 27852 node = node.firstChild; 27853 } 27854 27855 return node; 27856} 27857/** 27858 * Get the next sibling within a container. This will walk up the 27859 * DOM if a node's siblings have been exhausted. 27860 * 27861 * @param {DOMElement|DOMTextNode} node 27862 * @return {?DOMElement|DOMTextNode} 27863 */ 27864 27865 27866function getSiblingNode(node) { 27867 while (node) { 27868 if (node.nextSibling) { 27869 return node.nextSibling; 27870 } 27871 27872 node = node.parentNode; 27873 } 27874} 27875/** 27876 * Get object describing the nodes which contain characters at offset. 27877 * 27878 * @param {DOMElement|DOMTextNode} root 27879 * @param {number} offset 27880 * @return {?object} 27881 */ 27882 27883 27884function getNodeForCharacterOffset(root, offset) { 27885 var node = getLeafNode(root); 27886 var nodeStart = 0; 27887 var nodeEnd = 0; 27888 27889 while (node) { 27890 if (node.nodeType === TEXT_NODE) { 27891 nodeEnd = nodeStart + node.textContent.length; 27892 27893 if (nodeStart <= offset && nodeEnd >= offset) { 27894 return { 27895 node: node, 27896 offset: offset - nodeStart 27897 }; 27898 } 27899 27900 nodeStart = nodeEnd; 27901 } 27902 27903 node = getLeafNode(getSiblingNode(node)); 27904 } 27905} 27906 27907/** 27908 * @param {DOMElement} outerNode 27909 * @return {?object} 27910 */ 27911 27912function getOffsets(outerNode) { 27913 var ownerDocument = outerNode.ownerDocument; 27914 var win = ownerDocument && ownerDocument.defaultView || window; 27915 var selection = win.getSelection && win.getSelection(); 27916 27917 if (!selection || selection.rangeCount === 0) { 27918 return null; 27919 } 27920 27921 var anchorNode = selection.anchorNode, 27922 anchorOffset = selection.anchorOffset, 27923 focusNode = selection.focusNode, 27924 focusOffset = selection.focusOffset; // In Firefox, anchorNode and focusNode can be "anonymous divs", e.g. the 27925 // up/down buttons on an <input type="number">. Anonymous divs do not seem to 27926 // expose properties, triggering a "Permission denied error" if any of its 27927 // properties are accessed. The only seemingly possible way to avoid erroring 27928 // is to access a property that typically works for non-anonymous divs and 27929 // catch any error that may otherwise arise. See 27930 // https://bugzilla.mozilla.org/show_bug.cgi?id=208427 27931 27932 try { 27933 /* eslint-disable no-unused-expressions */ 27934 anchorNode.nodeType; 27935 focusNode.nodeType; 27936 /* eslint-enable no-unused-expressions */ 27937 } catch (e) { 27938 return null; 27939 } 27940 27941 return getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset); 27942} 27943/** 27944 * Returns {start, end} where `start` is the character/codepoint index of 27945 * (anchorNode, anchorOffset) within the textContent of `outerNode`, and 27946 * `end` is the index of (focusNode, focusOffset). 27947 * 27948 * Returns null if you pass in garbage input but we should probably just crash. 27949 * 27950 * Exported only for testing. 27951 */ 27952 27953function getModernOffsetsFromPoints(outerNode, anchorNode, anchorOffset, focusNode, focusOffset) { 27954 var length = 0; 27955 var start = -1; 27956 var end = -1; 27957 var indexWithinAnchor = 0; 27958 var indexWithinFocus = 0; 27959 var node = outerNode; 27960 var parentNode = null; 27961 27962 outer: while (true) { 27963 var next = null; 27964 27965 while (true) { 27966 if (node === anchorNode && (anchorOffset === 0 || node.nodeType === TEXT_NODE)) { 27967 start = length + anchorOffset; 27968 } 27969 27970 if (node === focusNode && (focusOffset === 0 || node.nodeType === TEXT_NODE)) { 27971 end = length + focusOffset; 27972 } 27973 27974 if (node.nodeType === TEXT_NODE) { 27975 length += node.nodeValue.length; 27976 } 27977 27978 if ((next = node.firstChild) === null) { 27979 break; 27980 } // Moving from `node` to its first child `next`. 27981 27982 27983 parentNode = node; 27984 node = next; 27985 } 27986 27987 while (true) { 27988 if (node === outerNode) { 27989 // If `outerNode` has children, this is always the second time visiting 27990 // it. If it has no children, this is still the first loop, and the only 27991 // valid selection is anchorNode and focusNode both equal to this node 27992 // and both offsets 0, in which case we will have handled above. 27993 break outer; 27994 } 27995 27996 if (parentNode === anchorNode && ++indexWithinAnchor === anchorOffset) { 27997 start = length; 27998 } 27999 28000 if (parentNode === focusNode && ++indexWithinFocus === focusOffset) { 28001 end = length; 28002 } 28003 28004 if ((next = node.nextSibling) !== null) { 28005 break; 28006 } 28007 28008 node = parentNode; 28009 parentNode = node.parentNode; 28010 } // Moving from `node` to its next sibling `next`. 28011 28012 28013 node = next; 28014 } 28015 28016 if (start === -1 || end === -1) { 28017 // This should never happen. (Would happen if the anchor/focus nodes aren't 28018 // actually inside the passed-in node.) 28019 return null; 28020 } 28021 28022 return { 28023 start: start, 28024 end: end 28025 }; 28026} 28027/** 28028 * In modern non-IE browsers, we can support both forward and backward 28029 * selections. 28030 * 28031 * Note: IE10+ supports the Selection object, but it does not support 28032 * the `extend` method, which means that even in modern IE, it's not possible 28033 * to programmatically create a backward selection. Thus, for all IE 28034 * versions, we use the old IE API to create our selections. 28035 * 28036 * @param {DOMElement|DOMTextNode} node 28037 * @param {object} offsets 28038 */ 28039 28040function setOffsets(node, offsets) { 28041 var doc = node.ownerDocument || document; 28042 var win = doc && doc.defaultView || window; // Edge fails with "Object expected" in some scenarios. 28043 // (For instance: TinyMCE editor used in a list component that supports pasting to add more, 28044 // fails when pasting 100+ items) 28045 28046 if (!win.getSelection) { 28047 return; 28048 } 28049 28050 var selection = win.getSelection(); 28051 var length = node.textContent.length; 28052 var start = Math.min(offsets.start, length); 28053 var end = offsets.end === undefined ? start : Math.min(offsets.end, length); // IE 11 uses modern selection, but doesn't support the extend method. 28054 // Flip backward selections, so we can set with a single range. 28055 28056 if (!selection.extend && start > end) { 28057 var temp = end; 28058 end = start; 28059 start = temp; 28060 } 28061 28062 var startMarker = getNodeForCharacterOffset(node, start); 28063 var endMarker = getNodeForCharacterOffset(node, end); 28064 28065 if (startMarker && endMarker) { 28066 if (selection.rangeCount === 1 && selection.anchorNode === startMarker.node && selection.anchorOffset === startMarker.offset && selection.focusNode === endMarker.node && selection.focusOffset === endMarker.offset) { 28067 return; 28068 } 28069 28070 var range = doc.createRange(); 28071 range.setStart(startMarker.node, startMarker.offset); 28072 selection.removeAllRanges(); 28073 28074 if (start > end) { 28075 selection.addRange(range); 28076 selection.extend(endMarker.node, endMarker.offset); 28077 } else { 28078 range.setEnd(endMarker.node, endMarker.offset); 28079 selection.addRange(range); 28080 } 28081 } 28082} 28083 28084function isTextNode(node) { 28085 return node && node.nodeType === TEXT_NODE; 28086} 28087 28088function containsNode(outerNode, innerNode) { 28089 if (!outerNode || !innerNode) { 28090 return false; 28091 } else if (outerNode === innerNode) { 28092 return true; 28093 } else if (isTextNode(outerNode)) { 28094 return false; 28095 } else if (isTextNode(innerNode)) { 28096 return containsNode(outerNode, innerNode.parentNode); 28097 } else if ('contains' in outerNode) { 28098 return outerNode.contains(innerNode); 28099 } else if (outerNode.compareDocumentPosition) { 28100 return !!(outerNode.compareDocumentPosition(innerNode) & 16); 28101 } else { 28102 return false; 28103 } 28104} 28105 28106function isInDocument(node) { 28107 return node && node.ownerDocument && containsNode(node.ownerDocument.documentElement, node); 28108} 28109 28110function isSameOriginFrame(iframe) { 28111 try { 28112 // Accessing the contentDocument of a HTMLIframeElement can cause the browser 28113 // to throw, e.g. if it has a cross-origin src attribute. 28114 // Safari will show an error in the console when the access results in "Blocked a frame with origin". e.g: 28115 // iframe.contentDocument.defaultView; 28116 // A safety way is to access one of the cross origin properties: Window or Location 28117 // Which might result in "SecurityError" DOM Exception and it is compatible to Safari. 28118 // https://html.spec.whatwg.org/multipage/browsers.html#integration-with-idl 28119 return typeof iframe.contentWindow.location.href === 'string'; 28120 } catch (err) { 28121 return false; 28122 } 28123} 28124 28125function getActiveElementDeep() { 28126 var win = window; 28127 var element = getActiveElement(); 28128 28129 while (element instanceof win.HTMLIFrameElement) { 28130 if (isSameOriginFrame(element)) { 28131 win = element.contentWindow; 28132 } else { 28133 return element; 28134 } 28135 28136 element = getActiveElement(win.document); 28137 } 28138 28139 return element; 28140} 28141/** 28142 * @ReactInputSelection: React input selection module. Based on Selection.js, 28143 * but modified to be suitable for react and has a couple of bug fixes (doesn't 28144 * assume buttons have range selections allowed). 28145 * Input selection module for React. 28146 */ 28147 28148/** 28149 * @hasSelectionCapabilities: we get the element types that support selection 28150 * from https://html.spec.whatwg.org/#do-not-apply, looking at `selectionStart` 28151 * and `selectionEnd` rows. 28152 */ 28153 28154 28155function hasSelectionCapabilities(elem) { 28156 var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase(); 28157 return nodeName && (nodeName === 'input' && (elem.type === 'text' || elem.type === 'search' || elem.type === 'tel' || elem.type === 'url' || elem.type === 'password') || nodeName === 'textarea' || elem.contentEditable === 'true'); 28158} 28159function getSelectionInformation() { 28160 var focusedElem = getActiveElementDeep(); 28161 return { 28162 focusedElem: focusedElem, 28163 selectionRange: hasSelectionCapabilities(focusedElem) ? getSelection(focusedElem) : null 28164 }; 28165} 28166/** 28167 * @restoreSelection: If any selection information was potentially lost, 28168 * restore it. This is useful when performing operations that could remove dom 28169 * nodes and place them back in, resulting in focus being lost. 28170 */ 28171 28172function restoreSelection(priorSelectionInformation) { 28173 var curFocusedElem = getActiveElementDeep(); 28174 var priorFocusedElem = priorSelectionInformation.focusedElem; 28175 var priorSelectionRange = priorSelectionInformation.selectionRange; 28176 28177 if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) { 28178 if (priorSelectionRange !== null && hasSelectionCapabilities(priorFocusedElem)) { 28179 setSelection(priorFocusedElem, priorSelectionRange); 28180 } // Focusing a node can change the scroll position, which is undesirable 28181 28182 28183 var ancestors = []; 28184 var ancestor = priorFocusedElem; 28185 28186 while (ancestor = ancestor.parentNode) { 28187 if (ancestor.nodeType === ELEMENT_NODE) { 28188 ancestors.push({ 28189 element: ancestor, 28190 left: ancestor.scrollLeft, 28191 top: ancestor.scrollTop 28192 }); 28193 } 28194 } 28195 28196 if (typeof priorFocusedElem.focus === 'function') { 28197 priorFocusedElem.focus(); 28198 } 28199 28200 for (var i = 0; i < ancestors.length; i++) { 28201 var info = ancestors[i]; 28202 info.element.scrollLeft = info.left; 28203 info.element.scrollTop = info.top; 28204 } 28205 } 28206} 28207/** 28208 * @getSelection: Gets the selection bounds of a focused textarea, input or 28209 * contentEditable node. 28210 * -@input: Look up selection bounds of this input 28211 * -@return {start: selectionStart, end: selectionEnd} 28212 */ 28213 28214function getSelection(input) { 28215 var selection; 28216 28217 if ('selectionStart' in input) { 28218 // Modern browser with input or textarea. 28219 selection = { 28220 start: input.selectionStart, 28221 end: input.selectionEnd 28222 }; 28223 } else { 28224 // Content editable or old IE textarea. 28225 selection = getOffsets(input); 28226 } 28227 28228 return selection || { 28229 start: 0, 28230 end: 0 28231 }; 28232} 28233/** 28234 * @setSelection: Sets the selection bounds of a textarea or input and focuses 28235 * the input. 28236 * -@input Set selection bounds of this input or textarea 28237 * -@offsets Object of same form that is returned from get* 28238 */ 28239 28240function setSelection(input, offsets) { 28241 var start = offsets.start; 28242 var end = offsets.end; 28243 28244 if (end === undefined) { 28245 end = start; 28246 } 28247 28248 if ('selectionStart' in input) { 28249 input.selectionStart = start; 28250 input.selectionEnd = Math.min(end, input.value.length); 28251 } else { 28252 setOffsets(input, offsets); 28253 } 28254} 28255 28256var skipSelectionChangeEvent = canUseDOM && 'documentMode' in document && document.documentMode <= 11; 28257 28258function registerEvents$3() { 28259 registerTwoPhaseEvent('onSelect', ['focusout', 'contextmenu', 'dragend', 'focusin', 'keydown', 'keyup', 'mousedown', 'mouseup', 'selectionchange']); 28260} 28261 28262var activeElement$1 = null; 28263var activeElementInst$1 = null; 28264var lastSelection = null; 28265var mouseDown = false; 28266/** 28267 * Get an object which is a unique representation of the current selection. 28268 * 28269 * The return value will not be consistent across nodes or browsers, but 28270 * two identical selections on the same node will return identical objects. 28271 */ 28272 28273function getSelection$1(node) { 28274 if ('selectionStart' in node && hasSelectionCapabilities(node)) { 28275 return { 28276 start: node.selectionStart, 28277 end: node.selectionEnd 28278 }; 28279 } else { 28280 var win = node.ownerDocument && node.ownerDocument.defaultView || window; 28281 var selection = win.getSelection(); 28282 return { 28283 anchorNode: selection.anchorNode, 28284 anchorOffset: selection.anchorOffset, 28285 focusNode: selection.focusNode, 28286 focusOffset: selection.focusOffset 28287 }; 28288 } 28289} 28290/** 28291 * Get document associated with the event target. 28292 */ 28293 28294 28295function getEventTargetDocument(eventTarget) { 28296 return eventTarget.window === eventTarget ? eventTarget.document : eventTarget.nodeType === DOCUMENT_NODE ? eventTarget : eventTarget.ownerDocument; 28297} 28298/** 28299 * Poll selection to see whether it's changed. 28300 * 28301 * @param {object} nativeEvent 28302 * @param {object} nativeEventTarget 28303 * @return {?SyntheticEvent} 28304 */ 28305 28306 28307function constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget) { 28308 // Ensure we have the right element, and that the user is not dragging a 28309 // selection (this matches native `select` event behavior). In HTML5, select 28310 // fires only on input and textarea thus if there's no focused element we 28311 // won't dispatch. 28312 var doc = getEventTargetDocument(nativeEventTarget); 28313 28314 if (mouseDown || activeElement$1 == null || activeElement$1 !== getActiveElement(doc)) { 28315 return; 28316 } // Only fire when selection has actually changed. 28317 28318 28319 var currentSelection = getSelection$1(activeElement$1); 28320 28321 if (!lastSelection || !shallowEqual(lastSelection, currentSelection)) { 28322 lastSelection = currentSelection; 28323 var listeners = accumulateTwoPhaseListeners(activeElementInst$1, 'onSelect'); 28324 28325 if (listeners.length > 0) { 28326 var event = new SyntheticEvent('onSelect', 'select', null, nativeEvent, nativeEventTarget); 28327 dispatchQueue.push({ 28328 event: event, 28329 listeners: listeners 28330 }); 28331 event.target = activeElement$1; 28332 } 28333 } 28334} 28335/** 28336 * This plugin creates an `onSelect` event that normalizes select events 28337 * across form elements. 28338 * 28339 * Supported elements are: 28340 * - input (see `isTextInputElement`) 28341 * - textarea 28342 * - contentEditable 28343 * 28344 * This differs from native browser implementations in the following ways: 28345 * - Fires on contentEditable fields as well as inputs. 28346 * - Fires for collapsed selection. 28347 * - Fires after user input. 28348 */ 28349 28350 28351function extractEvents$3(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { 28352 var targetNode = targetInst ? getNodeFromInstance(targetInst) : window; 28353 28354 switch (domEventName) { 28355 // Track the input node that has focus. 28356 case 'focusin': 28357 if (isTextInputElement(targetNode) || targetNode.contentEditable === 'true') { 28358 activeElement$1 = targetNode; 28359 activeElementInst$1 = targetInst; 28360 lastSelection = null; 28361 } 28362 28363 break; 28364 28365 case 'focusout': 28366 activeElement$1 = null; 28367 activeElementInst$1 = null; 28368 lastSelection = null; 28369 break; 28370 // Don't fire the event while the user is dragging. This matches the 28371 // semantics of the native select event. 28372 28373 case 'mousedown': 28374 mouseDown = true; 28375 break; 28376 28377 case 'contextmenu': 28378 case 'mouseup': 28379 case 'dragend': 28380 mouseDown = false; 28381 constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget); 28382 break; 28383 // Chrome and IE fire non-standard event when selection is changed (and 28384 // sometimes when it hasn't). IE's event fires out of order with respect 28385 // to key and input events on deletion, so we discard it. 28386 // 28387 // Firefox doesn't support selectionchange, so check selection status 28388 // after each key entry. The selection changes after keydown and before 28389 // keyup, but we check on keydown as well in the case of holding down a 28390 // key, when multiple keydown events are fired but only one keyup is. 28391 // This is also our approach for IE handling, for the reason above. 28392 28393 case 'selectionchange': 28394 if (skipSelectionChangeEvent) { 28395 break; 28396 } 28397 28398 // falls through 28399 28400 case 'keydown': 28401 case 'keyup': 28402 constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget); 28403 } 28404} 28405 28406/** 28407 * Generate a mapping of standard vendor prefixes using the defined style property and event name. 28408 * 28409 * @param {string} styleProp 28410 * @param {string} eventName 28411 * @returns {object} 28412 */ 28413 28414function makePrefixMap(styleProp, eventName) { 28415 var prefixes = {}; 28416 prefixes[styleProp.toLowerCase()] = eventName.toLowerCase(); 28417 prefixes['Webkit' + styleProp] = 'webkit' + eventName; 28418 prefixes['Moz' + styleProp] = 'moz' + eventName; 28419 return prefixes; 28420} 28421/** 28422 * A list of event names to a configurable list of vendor prefixes. 28423 */ 28424 28425 28426var vendorPrefixes = { 28427 animationend: makePrefixMap('Animation', 'AnimationEnd'), 28428 animationiteration: makePrefixMap('Animation', 'AnimationIteration'), 28429 animationstart: makePrefixMap('Animation', 'AnimationStart'), 28430 transitionend: makePrefixMap('Transition', 'TransitionEnd') 28431}; 28432/** 28433 * Event names that have already been detected and prefixed (if applicable). 28434 */ 28435 28436var prefixedEventNames = {}; 28437/** 28438 * Element to check for prefixes on. 28439 */ 28440 28441var style = {}; 28442/** 28443 * Bootstrap if a DOM exists. 28444 */ 28445 28446if (canUseDOM) { 28447 style = document.createElement('div').style; // On some platforms, in particular some releases of Android 4.x, 28448 // the un-prefixed "animation" and "transition" properties are defined on the 28449 // style object but the events that fire will still be prefixed, so we need 28450 // to check if the un-prefixed events are usable, and if not remove them from the map. 28451 28452 if (!('AnimationEvent' in window)) { 28453 delete vendorPrefixes.animationend.animation; 28454 delete vendorPrefixes.animationiteration.animation; 28455 delete vendorPrefixes.animationstart.animation; 28456 } // Same as above 28457 28458 28459 if (!('TransitionEvent' in window)) { 28460 delete vendorPrefixes.transitionend.transition; 28461 } 28462} 28463/** 28464 * Attempts to determine the correct vendor prefixed event name. 28465 * 28466 * @param {string} eventName 28467 * @returns {string} 28468 */ 28469 28470 28471function getVendorPrefixedEventName(eventName) { 28472 if (prefixedEventNames[eventName]) { 28473 return prefixedEventNames[eventName]; 28474 } else if (!vendorPrefixes[eventName]) { 28475 return eventName; 28476 } 28477 28478 var prefixMap = vendorPrefixes[eventName]; 28479 28480 for (var styleProp in prefixMap) { 28481 if (prefixMap.hasOwnProperty(styleProp) && styleProp in style) { 28482 return prefixedEventNames[eventName] = prefixMap[styleProp]; 28483 } 28484 } 28485 28486 return eventName; 28487} 28488 28489var ANIMATION_END = getVendorPrefixedEventName('animationend'); 28490var ANIMATION_ITERATION = getVendorPrefixedEventName('animationiteration'); 28491var ANIMATION_START = getVendorPrefixedEventName('animationstart'); 28492var TRANSITION_END = getVendorPrefixedEventName('transitionend'); 28493 28494var topLevelEventsToReactNames = new Map(); // NOTE: Capitalization is important in this list! 28495// 28496// E.g. it needs "pointerDown", not "pointerdown". 28497// This is because we derive both React name ("onPointerDown") 28498// and DOM name ("pointerdown") from the same list. 28499// 28500// Exceptions that don't match this convention are listed separately. 28501// 28502// prettier-ignore 28503 28504var simpleEventPluginEvents = ['abort', 'auxClick', 'cancel', 'canPlay', 'canPlayThrough', 'click', 'close', 'contextMenu', 'copy', 'cut', 'drag', 'dragEnd', 'dragEnter', 'dragExit', 'dragLeave', 'dragOver', 'dragStart', 'drop', 'durationChange', 'emptied', 'encrypted', 'ended', 'error', 'gotPointerCapture', 'input', 'invalid', 'keyDown', 'keyPress', 'keyUp', 'load', 'loadedData', 'loadedMetadata', 'loadStart', 'lostPointerCapture', 'mouseDown', 'mouseMove', 'mouseOut', 'mouseOver', 'mouseUp', 'paste', 'pause', 'play', 'playing', 'pointerCancel', 'pointerDown', 'pointerMove', 'pointerOut', 'pointerOver', 'pointerUp', 'progress', 'rateChange', 'reset', 'resize', 'seeked', 'seeking', 'stalled', 'submit', 'suspend', 'timeUpdate', 'touchCancel', 'touchEnd', 'touchStart', 'volumeChange', 'scroll', 'toggle', 'touchMove', 'waiting', 'wheel']; 28505 28506function registerSimpleEvent(domEventName, reactName) { 28507 topLevelEventsToReactNames.set(domEventName, reactName); 28508 registerTwoPhaseEvent(reactName, [domEventName]); 28509} 28510 28511function registerSimpleEvents() { 28512 for (var i = 0; i < simpleEventPluginEvents.length; i++) { 28513 var eventName = simpleEventPluginEvents[i]; 28514 var domEventName = eventName.toLowerCase(); 28515 var capitalizedEvent = eventName[0].toUpperCase() + eventName.slice(1); 28516 registerSimpleEvent(domEventName, 'on' + capitalizedEvent); 28517 } // Special cases where event names don't match. 28518 28519 28520 registerSimpleEvent(ANIMATION_END, 'onAnimationEnd'); 28521 registerSimpleEvent(ANIMATION_ITERATION, 'onAnimationIteration'); 28522 registerSimpleEvent(ANIMATION_START, 'onAnimationStart'); 28523 registerSimpleEvent('dblclick', 'onDoubleClick'); 28524 registerSimpleEvent('focusin', 'onFocus'); 28525 registerSimpleEvent('focusout', 'onBlur'); 28526 registerSimpleEvent(TRANSITION_END, 'onTransitionEnd'); 28527} 28528 28529function extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { 28530 var reactName = topLevelEventsToReactNames.get(domEventName); 28531 28532 if (reactName === undefined) { 28533 return; 28534 } 28535 28536 var SyntheticEventCtor = SyntheticEvent; 28537 var reactEventType = domEventName; 28538 28539 switch (domEventName) { 28540 case 'keypress': 28541 // Firefox creates a keypress event for function keys too. This removes 28542 // the unwanted keypress events. Enter is however both printable and 28543 // non-printable. One would expect Tab to be as well (but it isn't). 28544 if (getEventCharCode(nativeEvent) === 0) { 28545 return; 28546 } 28547 28548 /* falls through */ 28549 28550 case 'keydown': 28551 case 'keyup': 28552 SyntheticEventCtor = SyntheticKeyboardEvent; 28553 break; 28554 28555 case 'focusin': 28556 reactEventType = 'focus'; 28557 SyntheticEventCtor = SyntheticFocusEvent; 28558 break; 28559 28560 case 'focusout': 28561 reactEventType = 'blur'; 28562 SyntheticEventCtor = SyntheticFocusEvent; 28563 break; 28564 28565 case 'beforeblur': 28566 case 'afterblur': 28567 SyntheticEventCtor = SyntheticFocusEvent; 28568 break; 28569 28570 case 'click': 28571 // Firefox creates a click event on right mouse clicks. This removes the 28572 // unwanted click events. 28573 if (nativeEvent.button === 2) { 28574 return; 28575 } 28576 28577 /* falls through */ 28578 28579 case 'auxclick': 28580 case 'dblclick': 28581 case 'mousedown': 28582 case 'mousemove': 28583 case 'mouseup': // TODO: Disabled elements should not respond to mouse events 28584 28585 /* falls through */ 28586 28587 case 'mouseout': 28588 case 'mouseover': 28589 case 'contextmenu': 28590 SyntheticEventCtor = SyntheticMouseEvent; 28591 break; 28592 28593 case 'drag': 28594 case 'dragend': 28595 case 'dragenter': 28596 case 'dragexit': 28597 case 'dragleave': 28598 case 'dragover': 28599 case 'dragstart': 28600 case 'drop': 28601 SyntheticEventCtor = SyntheticDragEvent; 28602 break; 28603 28604 case 'touchcancel': 28605 case 'touchend': 28606 case 'touchmove': 28607 case 'touchstart': 28608 SyntheticEventCtor = SyntheticTouchEvent; 28609 break; 28610 28611 case ANIMATION_END: 28612 case ANIMATION_ITERATION: 28613 case ANIMATION_START: 28614 SyntheticEventCtor = SyntheticAnimationEvent; 28615 break; 28616 28617 case TRANSITION_END: 28618 SyntheticEventCtor = SyntheticTransitionEvent; 28619 break; 28620 28621 case 'scroll': 28622 SyntheticEventCtor = SyntheticUIEvent; 28623 break; 28624 28625 case 'wheel': 28626 SyntheticEventCtor = SyntheticWheelEvent; 28627 break; 28628 28629 case 'copy': 28630 case 'cut': 28631 case 'paste': 28632 SyntheticEventCtor = SyntheticClipboardEvent; 28633 break; 28634 28635 case 'gotpointercapture': 28636 case 'lostpointercapture': 28637 case 'pointercancel': 28638 case 'pointerdown': 28639 case 'pointermove': 28640 case 'pointerout': 28641 case 'pointerover': 28642 case 'pointerup': 28643 SyntheticEventCtor = SyntheticPointerEvent; 28644 break; 28645 } 28646 28647 var inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0; 28648 28649 { 28650 // Some events don't bubble in the browser. 28651 // In the past, React has always bubbled them, but this can be surprising. 28652 // We're going to try aligning closer to the browser behavior by not bubbling 28653 // them in React either. We'll start by not bubbling onScroll, and then expand. 28654 var accumulateTargetOnly = !inCapturePhase && // TODO: ideally, we'd eventually add all events from 28655 // nonDelegatedEvents list in DOMPluginEventSystem. 28656 // Then we can remove this special list. 28657 // This is a breaking change that can wait until React 18. 28658 domEventName === 'scroll'; 28659 28660 var _listeners = accumulateSinglePhaseListeners(targetInst, reactName, nativeEvent.type, inCapturePhase, accumulateTargetOnly); 28661 28662 if (_listeners.length > 0) { 28663 // Intentionally create event lazily. 28664 var _event = new SyntheticEventCtor(reactName, reactEventType, null, nativeEvent, nativeEventTarget); 28665 28666 dispatchQueue.push({ 28667 event: _event, 28668 listeners: _listeners 28669 }); 28670 } 28671 } 28672} 28673 28674// TODO: remove top-level side effect. 28675registerSimpleEvents(); 28676registerEvents$2(); 28677registerEvents$1(); 28678registerEvents$3(); 28679registerEvents(); 28680 28681function extractEvents$5(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags, targetContainer) { 28682 // TODO: we should remove the concept of a "SimpleEventPlugin". 28683 // This is the basic functionality of the event system. All 28684 // the other plugins are essentially polyfills. So the plugin 28685 // should probably be inlined somewhere and have its logic 28686 // be core the to event system. This would potentially allow 28687 // us to ship builds of React without the polyfilled plugins below. 28688 extractEvents$4(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags); 28689 var shouldProcessPolyfillPlugins = (eventSystemFlags & SHOULD_NOT_PROCESS_POLYFILL_EVENT_PLUGINS) === 0; // We don't process these events unless we are in the 28690 // event's native "bubble" phase, which means that we're 28691 // not in the capture phase. That's because we emulate 28692 // the capture phase here still. This is a trade-off, 28693 // because in an ideal world we would not emulate and use 28694 // the phases properly, like we do with the SimpleEvent 28695 // plugin. However, the plugins below either expect 28696 // emulation (EnterLeave) or use state localized to that 28697 // plugin (BeforeInput, Change, Select). The state in 28698 // these modules complicates things, as you'll essentially 28699 // get the case where the capture phase event might change 28700 // state, only for the following bubble event to come in 28701 // later and not trigger anything as the state now 28702 // invalidates the heuristics of the event plugin. We 28703 // could alter all these plugins to work in such ways, but 28704 // that might cause other unknown side-effects that we 28705 // can't foresee right now. 28706 28707 if (shouldProcessPolyfillPlugins) { 28708 extractEvents$2(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); 28709 extractEvents$1(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); 28710 extractEvents$3(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); 28711 extractEvents(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget); 28712 } 28713} // List of events that need to be individually attached to media elements. 28714 28715 28716var mediaEventTypes = ['abort', 'canplay', 'canplaythrough', 'durationchange', 'emptied', 'encrypted', 'ended', 'error', 'loadeddata', 'loadedmetadata', 'loadstart', 'pause', 'play', 'playing', 'progress', 'ratechange', 'resize', 'seeked', 'seeking', 'stalled', 'suspend', 'timeupdate', 'volumechange', 'waiting']; // We should not delegate these events to the container, but rather 28717// set them on the actual target element itself. This is primarily 28718// because these events do not consistently bubble in the DOM. 28719 28720var nonDelegatedEvents = new Set(['cancel', 'close', 'invalid', 'load', 'scroll', 'toggle'].concat(mediaEventTypes)); 28721 28722function executeDispatch(event, listener, currentTarget) { 28723 var type = event.type || 'unknown-event'; 28724 event.currentTarget = currentTarget; 28725 invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event); 28726 event.currentTarget = null; 28727} 28728 28729function processDispatchQueueItemsInOrder(event, dispatchListeners, inCapturePhase) { 28730 var previousInstance; 28731 28732 if (inCapturePhase) { 28733 for (var i = dispatchListeners.length - 1; i >= 0; i--) { 28734 var _dispatchListeners$i = dispatchListeners[i], 28735 instance = _dispatchListeners$i.instance, 28736 currentTarget = _dispatchListeners$i.currentTarget, 28737 listener = _dispatchListeners$i.listener; 28738 28739 if (instance !== previousInstance && event.isPropagationStopped()) { 28740 return; 28741 } 28742 28743 executeDispatch(event, listener, currentTarget); 28744 previousInstance = instance; 28745 } 28746 } else { 28747 for (var _i = 0; _i < dispatchListeners.length; _i++) { 28748 var _dispatchListeners$_i = dispatchListeners[_i], 28749 _instance = _dispatchListeners$_i.instance, 28750 _currentTarget = _dispatchListeners$_i.currentTarget, 28751 _listener = _dispatchListeners$_i.listener; 28752 28753 if (_instance !== previousInstance && event.isPropagationStopped()) { 28754 return; 28755 } 28756 28757 executeDispatch(event, _listener, _currentTarget); 28758 previousInstance = _instance; 28759 } 28760 } 28761} 28762 28763function processDispatchQueue(dispatchQueue, eventSystemFlags) { 28764 var inCapturePhase = (eventSystemFlags & IS_CAPTURE_PHASE) !== 0; 28765 28766 for (var i = 0; i < dispatchQueue.length; i++) { 28767 var _dispatchQueue$i = dispatchQueue[i], 28768 event = _dispatchQueue$i.event, 28769 listeners = _dispatchQueue$i.listeners; 28770 processDispatchQueueItemsInOrder(event, listeners, inCapturePhase); // event system doesn't use pooling. 28771 } // This would be a good time to rethrow if any of the event handlers threw. 28772 28773 28774 rethrowCaughtError(); 28775} 28776 28777function dispatchEventsForPlugins(domEventName, eventSystemFlags, nativeEvent, targetInst, targetContainer) { 28778 var nativeEventTarget = getEventTarget(nativeEvent); 28779 var dispatchQueue = []; 28780 extractEvents$5(dispatchQueue, domEventName, targetInst, nativeEvent, nativeEventTarget, eventSystemFlags); 28781 processDispatchQueue(dispatchQueue, eventSystemFlags); 28782} 28783 28784function listenToNonDelegatedEvent(domEventName, targetElement) { 28785 { 28786 if (!nonDelegatedEvents.has(domEventName)) { 28787 error('Did not expect a listenToNonDelegatedEvent() call for "%s". ' + 'This is a bug in React. Please file an issue.', domEventName); 28788 } 28789 } 28790 28791 var isCapturePhaseListener = false; 28792 var listenerSet = getEventListenerSet(targetElement); 28793 var listenerSetKey = getListenerSetKey(domEventName, isCapturePhaseListener); 28794 28795 if (!listenerSet.has(listenerSetKey)) { 28796 addTrappedEventListener(targetElement, domEventName, IS_NON_DELEGATED, isCapturePhaseListener); 28797 listenerSet.add(listenerSetKey); 28798 } 28799} 28800function listenToNativeEvent(domEventName, isCapturePhaseListener, target) { 28801 { 28802 if (nonDelegatedEvents.has(domEventName) && !isCapturePhaseListener) { 28803 error('Did not expect a listenToNativeEvent() call for "%s" in the bubble phase. ' + 'This is a bug in React. Please file an issue.', domEventName); 28804 } 28805 } 28806 28807 var eventSystemFlags = 0; 28808 28809 if (isCapturePhaseListener) { 28810 eventSystemFlags |= IS_CAPTURE_PHASE; 28811 } 28812 28813 addTrappedEventListener(target, domEventName, eventSystemFlags, isCapturePhaseListener); 28814} // This is only used by createEventHandle when the 28815var listeningMarker = '_reactListening' + Math.random().toString(36).slice(2); 28816function listenToAllSupportedEvents(rootContainerElement) { 28817 if (!rootContainerElement[listeningMarker]) { 28818 rootContainerElement[listeningMarker] = true; 28819 allNativeEvents.forEach(function (domEventName) { 28820 // We handle selectionchange separately because it 28821 // doesn't bubble and needs to be on the document. 28822 if (domEventName !== 'selectionchange') { 28823 if (!nonDelegatedEvents.has(domEventName)) { 28824 listenToNativeEvent(domEventName, false, rootContainerElement); 28825 } 28826 28827 listenToNativeEvent(domEventName, true, rootContainerElement); 28828 } 28829 }); 28830 var ownerDocument = rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument; 28831 28832 if (ownerDocument !== null) { 28833 // The selectionchange event also needs deduplication 28834 // but it is attached to the document. 28835 if (!ownerDocument[listeningMarker]) { 28836 ownerDocument[listeningMarker] = true; 28837 listenToNativeEvent('selectionchange', false, ownerDocument); 28838 } 28839 } 28840 } 28841} 28842 28843function addTrappedEventListener(targetContainer, domEventName, eventSystemFlags, isCapturePhaseListener, isDeferredListenerForLegacyFBSupport) { 28844 var listener = createEventListenerWrapperWithPriority(targetContainer, domEventName, eventSystemFlags); // If passive option is not supported, then the event will be 28845 // active and not passive. 28846 28847 var isPassiveListener = undefined; 28848 28849 if (passiveBrowserEventsSupported) { 28850 // Browsers introduced an intervention, making these events 28851 // passive by default on document. React doesn't bind them 28852 // to document anymore, but changing this now would undo 28853 // the performance wins from the change. So we emulate 28854 // the existing behavior manually on the roots now. 28855 // https://github.com/facebook/react/issues/19651 28856 if (domEventName === 'touchstart' || domEventName === 'touchmove' || domEventName === 'wheel') { 28857 isPassiveListener = true; 28858 } 28859 } 28860 28861 targetContainer = targetContainer; 28862 var unsubscribeListener; // When legacyFBSupport is enabled, it's for when we 28863 28864 28865 if (isCapturePhaseListener) { 28866 if (isPassiveListener !== undefined) { 28867 unsubscribeListener = addEventCaptureListenerWithPassiveFlag(targetContainer, domEventName, listener, isPassiveListener); 28868 } else { 28869 unsubscribeListener = addEventCaptureListener(targetContainer, domEventName, listener); 28870 } 28871 } else { 28872 if (isPassiveListener !== undefined) { 28873 unsubscribeListener = addEventBubbleListenerWithPassiveFlag(targetContainer, domEventName, listener, isPassiveListener); 28874 } else { 28875 unsubscribeListener = addEventBubbleListener(targetContainer, domEventName, listener); 28876 } 28877 } 28878} 28879 28880function isMatchingRootContainer(grandContainer, targetContainer) { 28881 return grandContainer === targetContainer || grandContainer.nodeType === COMMENT_NODE && grandContainer.parentNode === targetContainer; 28882} 28883 28884function dispatchEventForPluginEventSystem(domEventName, eventSystemFlags, nativeEvent, targetInst, targetContainer) { 28885 var ancestorInst = targetInst; 28886 28887 if ((eventSystemFlags & IS_EVENT_HANDLE_NON_MANAGED_NODE) === 0 && (eventSystemFlags & IS_NON_DELEGATED) === 0) { 28888 var targetContainerNode = targetContainer; // If we are using the legacy FB support flag, we 28889 28890 if (targetInst !== null) { 28891 // The below logic attempts to work out if we need to change 28892 // the target fiber to a different ancestor. We had similar logic 28893 // in the legacy event system, except the big difference between 28894 // systems is that the modern event system now has an event listener 28895 // attached to each React Root and React Portal Root. Together, 28896 // the DOM nodes representing these roots are the "rootContainer". 28897 // To figure out which ancestor instance we should use, we traverse 28898 // up the fiber tree from the target instance and attempt to find 28899 // root boundaries that match that of our current "rootContainer". 28900 // If we find that "rootContainer", we find the parent fiber 28901 // sub-tree for that root and make that our ancestor instance. 28902 var node = targetInst; 28903 28904 mainLoop: while (true) { 28905 if (node === null) { 28906 return; 28907 } 28908 28909 var nodeTag = node.tag; 28910 28911 if (nodeTag === HostRoot || nodeTag === HostPortal) { 28912 var container = node.stateNode.containerInfo; 28913 28914 if (isMatchingRootContainer(container, targetContainerNode)) { 28915 break; 28916 } 28917 28918 if (nodeTag === HostPortal) { 28919 // The target is a portal, but it's not the rootContainer we're looking for. 28920 // Normally portals handle their own events all the way down to the root. 28921 // So we should be able to stop now. However, we don't know if this portal 28922 // was part of *our* root. 28923 var grandNode = node.return; 28924 28925 while (grandNode !== null) { 28926 var grandTag = grandNode.tag; 28927 28928 if (grandTag === HostRoot || grandTag === HostPortal) { 28929 var grandContainer = grandNode.stateNode.containerInfo; 28930 28931 if (isMatchingRootContainer(grandContainer, targetContainerNode)) { 28932 // This is the rootContainer we're looking for and we found it as 28933 // a parent of the Portal. That means we can ignore it because the 28934 // Portal will bubble through to us. 28935 return; 28936 } 28937 } 28938 28939 grandNode = grandNode.return; 28940 } 28941 } // Now we need to find it's corresponding host fiber in the other 28942 // tree. To do this we can use getClosestInstanceFromNode, but we 28943 // need to validate that the fiber is a host instance, otherwise 28944 // we need to traverse up through the DOM till we find the correct 28945 // node that is from the other tree. 28946 28947 28948 while (container !== null) { 28949 var parentNode = getClosestInstanceFromNode(container); 28950 28951 if (parentNode === null) { 28952 return; 28953 } 28954 28955 var parentTag = parentNode.tag; 28956 28957 if (parentTag === HostComponent || parentTag === HostText) { 28958 node = ancestorInst = parentNode; 28959 continue mainLoop; 28960 } 28961 28962 container = container.parentNode; 28963 } 28964 } 28965 28966 node = node.return; 28967 } 28968 } 28969 } 28970 28971 batchedUpdates(function () { 28972 return dispatchEventsForPlugins(domEventName, eventSystemFlags, nativeEvent, ancestorInst); 28973 }); 28974} 28975 28976function createDispatchListener(instance, listener, currentTarget) { 28977 return { 28978 instance: instance, 28979 listener: listener, 28980 currentTarget: currentTarget 28981 }; 28982} 28983 28984function accumulateSinglePhaseListeners(targetFiber, reactName, nativeEventType, inCapturePhase, accumulateTargetOnly, nativeEvent) { 28985 var captureName = reactName !== null ? reactName + 'Capture' : null; 28986 var reactEventName = inCapturePhase ? captureName : reactName; 28987 var listeners = []; 28988 var instance = targetFiber; 28989 var lastHostComponent = null; // Accumulate all instances and listeners via the target -> root path. 28990 28991 while (instance !== null) { 28992 var _instance2 = instance, 28993 stateNode = _instance2.stateNode, 28994 tag = _instance2.tag; // Handle listeners that are on HostComponents (i.e. <div>) 28995 28996 if (tag === HostComponent && stateNode !== null) { 28997 lastHostComponent = stateNode; // createEventHandle listeners 28998 28999 29000 if (reactEventName !== null) { 29001 var listener = getListener(instance, reactEventName); 29002 29003 if (listener != null) { 29004 listeners.push(createDispatchListener(instance, listener, lastHostComponent)); 29005 } 29006 } 29007 } // If we are only accumulating events for the target, then we don't 29008 // continue to propagate through the React fiber tree to find other 29009 // listeners. 29010 29011 29012 if (accumulateTargetOnly) { 29013 break; 29014 } // If we are processing the onBeforeBlur event, then we need to take 29015 29016 instance = instance.return; 29017 } 29018 29019 return listeners; 29020} // We should only use this function for: 29021// - BeforeInputEventPlugin 29022// - ChangeEventPlugin 29023// - SelectEventPlugin 29024// This is because we only process these plugins 29025// in the bubble phase, so we need to accumulate two 29026// phase event listeners (via emulation). 29027 29028function accumulateTwoPhaseListeners(targetFiber, reactName) { 29029 var captureName = reactName + 'Capture'; 29030 var listeners = []; 29031 var instance = targetFiber; // Accumulate all instances and listeners via the target -> root path. 29032 29033 while (instance !== null) { 29034 var _instance3 = instance, 29035 stateNode = _instance3.stateNode, 29036 tag = _instance3.tag; // Handle listeners that are on HostComponents (i.e. <div>) 29037 29038 if (tag === HostComponent && stateNode !== null) { 29039 var currentTarget = stateNode; 29040 var captureListener = getListener(instance, captureName); 29041 29042 if (captureListener != null) { 29043 listeners.unshift(createDispatchListener(instance, captureListener, currentTarget)); 29044 } 29045 29046 var bubbleListener = getListener(instance, reactName); 29047 29048 if (bubbleListener != null) { 29049 listeners.push(createDispatchListener(instance, bubbleListener, currentTarget)); 29050 } 29051 } 29052 29053 instance = instance.return; 29054 } 29055 29056 return listeners; 29057} 29058 29059function getParent(inst) { 29060 if (inst === null) { 29061 return null; 29062 } 29063 29064 do { 29065 inst = inst.return; // TODO: If this is a HostRoot we might want to bail out. 29066 // That is depending on if we want nested subtrees (layers) to bubble 29067 // events to their parent. We could also go through parentNode on the 29068 // host node but that wouldn't work for React Native and doesn't let us 29069 // do the portal feature. 29070 } while (inst && inst.tag !== HostComponent); 29071 29072 if (inst) { 29073 return inst; 29074 } 29075 29076 return null; 29077} 29078/** 29079 * Return the lowest common ancestor of A and B, or null if they are in 29080 * different trees. 29081 */ 29082 29083 29084function getLowestCommonAncestor(instA, instB) { 29085 var nodeA = instA; 29086 var nodeB = instB; 29087 var depthA = 0; 29088 29089 for (var tempA = nodeA; tempA; tempA = getParent(tempA)) { 29090 depthA++; 29091 } 29092 29093 var depthB = 0; 29094 29095 for (var tempB = nodeB; tempB; tempB = getParent(tempB)) { 29096 depthB++; 29097 } // If A is deeper, crawl up. 29098 29099 29100 while (depthA - depthB > 0) { 29101 nodeA = getParent(nodeA); 29102 depthA--; 29103 } // If B is deeper, crawl up. 29104 29105 29106 while (depthB - depthA > 0) { 29107 nodeB = getParent(nodeB); 29108 depthB--; 29109 } // Walk in lockstep until we find a match. 29110 29111 29112 var depth = depthA; 29113 29114 while (depth--) { 29115 if (nodeA === nodeB || nodeB !== null && nodeA === nodeB.alternate) { 29116 return nodeA; 29117 } 29118 29119 nodeA = getParent(nodeA); 29120 nodeB = getParent(nodeB); 29121 } 29122 29123 return null; 29124} 29125 29126function accumulateEnterLeaveListenersForEvent(dispatchQueue, event, target, common, inCapturePhase) { 29127 var registrationName = event._reactName; 29128 var listeners = []; 29129 var instance = target; 29130 29131 while (instance !== null) { 29132 if (instance === common) { 29133 break; 29134 } 29135 29136 var _instance4 = instance, 29137 alternate = _instance4.alternate, 29138 stateNode = _instance4.stateNode, 29139 tag = _instance4.tag; 29140 29141 if (alternate !== null && alternate === common) { 29142 break; 29143 } 29144 29145 if (tag === HostComponent && stateNode !== null) { 29146 var currentTarget = stateNode; 29147 29148 if (inCapturePhase) { 29149 var captureListener = getListener(instance, registrationName); 29150 29151 if (captureListener != null) { 29152 listeners.unshift(createDispatchListener(instance, captureListener, currentTarget)); 29153 } 29154 } else if (!inCapturePhase) { 29155 var bubbleListener = getListener(instance, registrationName); 29156 29157 if (bubbleListener != null) { 29158 listeners.push(createDispatchListener(instance, bubbleListener, currentTarget)); 29159 } 29160 } 29161 } 29162 29163 instance = instance.return; 29164 } 29165 29166 if (listeners.length !== 0) { 29167 dispatchQueue.push({ 29168 event: event, 29169 listeners: listeners 29170 }); 29171 } 29172} // We should only use this function for: 29173// - EnterLeaveEventPlugin 29174// This is because we only process this plugin 29175// in the bubble phase, so we need to accumulate two 29176// phase event listeners. 29177 29178 29179function accumulateEnterLeaveTwoPhaseListeners(dispatchQueue, leaveEvent, enterEvent, from, to) { 29180 var common = from && to ? getLowestCommonAncestor(from, to) : null; 29181 29182 if (from !== null) { 29183 accumulateEnterLeaveListenersForEvent(dispatchQueue, leaveEvent, from, common, false); 29184 } 29185 29186 if (to !== null && enterEvent !== null) { 29187 accumulateEnterLeaveListenersForEvent(dispatchQueue, enterEvent, to, common, true); 29188 } 29189} 29190function getListenerSetKey(domEventName, capture) { 29191 return domEventName + "__" + (capture ? 'capture' : 'bubble'); 29192} 29193 29194var didWarnInvalidHydration = false; 29195var DANGEROUSLY_SET_INNER_HTML = 'dangerouslySetInnerHTML'; 29196var SUPPRESS_CONTENT_EDITABLE_WARNING = 'suppressContentEditableWarning'; 29197var SUPPRESS_HYDRATION_WARNING = 'suppressHydrationWarning'; 29198var AUTOFOCUS = 'autoFocus'; 29199var CHILDREN = 'children'; 29200var STYLE = 'style'; 29201var HTML$1 = '__html'; 29202var warnedUnknownTags; 29203var validatePropertiesInDevelopment; 29204var warnForPropDifference; 29205var warnForExtraAttributes; 29206var warnForInvalidEventListener; 29207var canDiffStyleForHydrationWarning; 29208var normalizeHTML; 29209 29210{ 29211 warnedUnknownTags = { 29212 // There are working polyfills for <dialog>. Let people use it. 29213 dialog: true, 29214 // Electron ships a custom <webview> tag to display external web content in 29215 // an isolated frame and process. 29216 // This tag is not present in non Electron environments such as JSDom which 29217 // is often used for testing purposes. 29218 // @see https://electronjs.org/docs/api/webview-tag 29219 webview: true 29220 }; 29221 29222 validatePropertiesInDevelopment = function (type, props) { 29223 validateProperties(type, props); 29224 validateProperties$1(type, props); 29225 validateProperties$2(type, props, { 29226 registrationNameDependencies: registrationNameDependencies, 29227 possibleRegistrationNames: possibleRegistrationNames 29228 }); 29229 }; // IE 11 parses & normalizes the style attribute as opposed to other 29230 // browsers. It adds spaces and sorts the properties in some 29231 // non-alphabetical order. Handling that would require sorting CSS 29232 // properties in the client & server versions or applying 29233 // `expectedStyle` to a temporary DOM node to read its `style` attribute 29234 // normalized. Since it only affects IE, we're skipping style warnings 29235 // in that browser completely in favor of doing all that work. 29236 // See https://github.com/facebook/react/issues/11807 29237 29238 29239 canDiffStyleForHydrationWarning = canUseDOM && !document.documentMode; 29240 29241 warnForPropDifference = function (propName, serverValue, clientValue) { 29242 if (didWarnInvalidHydration) { 29243 return; 29244 } 29245 29246 var normalizedClientValue = normalizeMarkupForTextOrAttribute(clientValue); 29247 var normalizedServerValue = normalizeMarkupForTextOrAttribute(serverValue); 29248 29249 if (normalizedServerValue === normalizedClientValue) { 29250 return; 29251 } 29252 29253 didWarnInvalidHydration = true; 29254 29255 error('Prop `%s` did not match. Server: %s Client: %s', propName, JSON.stringify(normalizedServerValue), JSON.stringify(normalizedClientValue)); 29256 }; 29257 29258 warnForExtraAttributes = function (attributeNames) { 29259 if (didWarnInvalidHydration) { 29260 return; 29261 } 29262 29263 didWarnInvalidHydration = true; 29264 var names = []; 29265 attributeNames.forEach(function (name) { 29266 names.push(name); 29267 }); 29268 29269 error('Extra attributes from the server: %s', names); 29270 }; 29271 29272 warnForInvalidEventListener = function (registrationName, listener) { 29273 if (listener === false) { 29274 error('Expected `%s` listener to be a function, instead got `false`.\n\n' + 'If you used to conditionally omit it with %s={condition && value}, ' + 'pass %s={condition ? value : undefined} instead.', registrationName, registrationName, registrationName); 29275 } else { 29276 error('Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener); 29277 } 29278 }; // Parse the HTML and read it back to normalize the HTML string so that it 29279 // can be used for comparison. 29280 29281 29282 normalizeHTML = function (parent, html) { 29283 // We could have created a separate document here to avoid 29284 // re-initializing custom elements if they exist. But this breaks 29285 // how <noscript> is being handled. So we use the same document. 29286 // See the discussion in https://github.com/facebook/react/pull/11157. 29287 var testElement = parent.namespaceURI === HTML_NAMESPACE ? parent.ownerDocument.createElement(parent.tagName) : parent.ownerDocument.createElementNS(parent.namespaceURI, parent.tagName); 29288 testElement.innerHTML = html; 29289 return testElement.innerHTML; 29290 }; 29291} // HTML parsing normalizes CR and CRLF to LF. 29292// It also can turn \u0000 into \uFFFD inside attributes. 29293// https://www.w3.org/TR/html5/single-page.html#preprocessing-the-input-stream 29294// If we have a mismatch, it might be caused by that. 29295// We will still patch up in this case but not fire the warning. 29296 29297 29298var NORMALIZE_NEWLINES_REGEX = /\r\n?/g; 29299var NORMALIZE_NULL_AND_REPLACEMENT_REGEX = /\u0000|\uFFFD/g; 29300 29301function normalizeMarkupForTextOrAttribute(markup) { 29302 { 29303 checkHtmlStringCoercion(markup); 29304 } 29305 29306 var markupString = typeof markup === 'string' ? markup : '' + markup; 29307 return markupString.replace(NORMALIZE_NEWLINES_REGEX, '\n').replace(NORMALIZE_NULL_AND_REPLACEMENT_REGEX, ''); 29308} 29309 29310function checkForUnmatchedText(serverText, clientText, isConcurrentMode, shouldWarnDev) { 29311 var normalizedClientText = normalizeMarkupForTextOrAttribute(clientText); 29312 var normalizedServerText = normalizeMarkupForTextOrAttribute(serverText); 29313 29314 if (normalizedServerText === normalizedClientText) { 29315 return; 29316 } 29317 29318 if (shouldWarnDev) { 29319 { 29320 if (!didWarnInvalidHydration) { 29321 didWarnInvalidHydration = true; 29322 29323 error('Text content did not match. Server: "%s" Client: "%s"', normalizedServerText, normalizedClientText); 29324 } 29325 } 29326 } 29327 29328 if (isConcurrentMode && enableClientRenderFallbackOnTextMismatch) { 29329 // In concurrent roots, we throw when there's a text mismatch and revert to 29330 // client rendering, up to the nearest Suspense boundary. 29331 throw new Error('Text content does not match server-rendered HTML.'); 29332 } 29333} 29334 29335function getOwnerDocumentFromRootContainer(rootContainerElement) { 29336 return rootContainerElement.nodeType === DOCUMENT_NODE ? rootContainerElement : rootContainerElement.ownerDocument; 29337} 29338 29339function noop() {} 29340 29341function trapClickOnNonInteractiveElement(node) { 29342 // Mobile Safari does not fire properly bubble click events on 29343 // non-interactive elements, which means delegated click listeners do not 29344 // fire. The workaround for this bug involves attaching an empty click 29345 // listener on the target node. 29346 // https://www.quirksmode.org/blog/archives/2010/09/click_event_del.html 29347 // Just set it using the onclick property so that we don't have to manage any 29348 // bookkeeping for it. Not sure if we need to clear it when the listener is 29349 // removed. 29350 // TODO: Only do this for the relevant Safaris maybe? 29351 node.onclick = noop; 29352} 29353 29354function setInitialDOMProperties(tag, domElement, rootContainerElement, nextProps, isCustomComponentTag) { 29355 for (var propKey in nextProps) { 29356 if (!nextProps.hasOwnProperty(propKey)) { 29357 continue; 29358 } 29359 29360 var nextProp = nextProps[propKey]; 29361 29362 if (propKey === STYLE) { 29363 { 29364 if (nextProp) { 29365 // Freeze the next style object so that we can assume it won't be 29366 // mutated. We have already warned for this in the past. 29367 Object.freeze(nextProp); 29368 } 29369 } // Relies on `updateStylesByID` not mutating `styleUpdates`. 29370 29371 29372 setValueForStyles(domElement, nextProp); 29373 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { 29374 var nextHtml = nextProp ? nextProp[HTML$1] : undefined; 29375 29376 if (nextHtml != null) { 29377 setInnerHTML(domElement, nextHtml); 29378 } 29379 } else if (propKey === CHILDREN) { 29380 if (typeof nextProp === 'string') { 29381 // Avoid setting initial textContent when the text is empty. In IE11 setting 29382 // textContent on a <textarea> will cause the placeholder to not 29383 // show within the <textarea> until it has been focused and blurred again. 29384 // https://github.com/facebook/react/issues/6731#issuecomment-254874553 29385 var canSetTextContent = tag !== 'textarea' || nextProp !== ''; 29386 29387 if (canSetTextContent) { 29388 setTextContent(domElement, nextProp); 29389 } 29390 } else if (typeof nextProp === 'number') { 29391 setTextContent(domElement, '' + nextProp); 29392 } 29393 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (propKey === AUTOFOCUS) ; else if (registrationNameDependencies.hasOwnProperty(propKey)) { 29394 if (nextProp != null) { 29395 if ( typeof nextProp !== 'function') { 29396 warnForInvalidEventListener(propKey, nextProp); 29397 } 29398 29399 if (propKey === 'onScroll') { 29400 listenToNonDelegatedEvent('scroll', domElement); 29401 } 29402 } 29403 } else if (nextProp != null) { 29404 setValueForProperty(domElement, propKey, nextProp, isCustomComponentTag); 29405 } 29406 } 29407} 29408 29409function updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag) { 29410 // TODO: Handle wasCustomComponentTag 29411 for (var i = 0; i < updatePayload.length; i += 2) { 29412 var propKey = updatePayload[i]; 29413 var propValue = updatePayload[i + 1]; 29414 29415 if (propKey === STYLE) { 29416 setValueForStyles(domElement, propValue); 29417 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { 29418 setInnerHTML(domElement, propValue); 29419 } else if (propKey === CHILDREN) { 29420 setTextContent(domElement, propValue); 29421 } else { 29422 setValueForProperty(domElement, propKey, propValue, isCustomComponentTag); 29423 } 29424 } 29425} 29426 29427function createElement(type, props, rootContainerElement, parentNamespace) { 29428 var isCustomComponentTag; // We create tags in the namespace of their parent container, except HTML 29429 // tags get no namespace. 29430 29431 var ownerDocument = getOwnerDocumentFromRootContainer(rootContainerElement); 29432 var domElement; 29433 var namespaceURI = parentNamespace; 29434 29435 if (namespaceURI === HTML_NAMESPACE) { 29436 namespaceURI = getIntrinsicNamespace(type); 29437 } 29438 29439 if (namespaceURI === HTML_NAMESPACE) { 29440 { 29441 isCustomComponentTag = isCustomComponent(type, props); // Should this check be gated by parent namespace? Not sure we want to 29442 // allow <SVG> or <mATH>. 29443 29444 if (!isCustomComponentTag && type !== type.toLowerCase()) { 29445 error('<%s /> is using incorrect casing. ' + 'Use PascalCase for React components, ' + 'or lowercase for HTML elements.', type); 29446 } 29447 } 29448 29449 if (type === 'script') { 29450 // Create the script via .innerHTML so its "parser-inserted" flag is 29451 // set to true and it does not execute 29452 var div = ownerDocument.createElement('div'); 29453 29454 div.innerHTML = '<script><' + '/script>'; // eslint-disable-line 29455 // This is guaranteed to yield a script element. 29456 29457 var firstChild = div.firstChild; 29458 domElement = div.removeChild(firstChild); 29459 } else if (typeof props.is === 'string') { 29460 // $FlowIssue `createElement` should be updated for Web Components 29461 domElement = ownerDocument.createElement(type, { 29462 is: props.is 29463 }); 29464 } else { 29465 // Separate else branch instead of using `props.is || undefined` above because of a Firefox bug. 29466 // See discussion in https://github.com/facebook/react/pull/6896 29467 // and discussion in https://bugzilla.mozilla.org/show_bug.cgi?id=1276240 29468 domElement = ownerDocument.createElement(type); // Normally attributes are assigned in `setInitialDOMProperties`, however the `multiple` and `size` 29469 // attributes on `select`s needs to be added before `option`s are inserted. 29470 // This prevents: 29471 // - a bug where the `select` does not scroll to the correct option because singular 29472 // `select` elements automatically pick the first item #13222 29473 // - a bug where the `select` set the first item as selected despite the `size` attribute #14239 29474 // See https://github.com/facebook/react/issues/13222 29475 // and https://github.com/facebook/react/issues/14239 29476 29477 if (type === 'select') { 29478 var node = domElement; 29479 29480 if (props.multiple) { 29481 node.multiple = true; 29482 } else if (props.size) { 29483 // Setting a size greater than 1 causes a select to behave like `multiple=true`, where 29484 // it is possible that no option is selected. 29485 // 29486 // This is only necessary when a select in "single selection mode". 29487 node.size = props.size; 29488 } 29489 } 29490 } 29491 } else { 29492 domElement = ownerDocument.createElementNS(namespaceURI, type); 29493 } 29494 29495 { 29496 if (namespaceURI === HTML_NAMESPACE) { 29497 if (!isCustomComponentTag && Object.prototype.toString.call(domElement) === '[object HTMLUnknownElement]' && !hasOwnProperty.call(warnedUnknownTags, type)) { 29498 warnedUnknownTags[type] = true; 29499 29500 error('The tag <%s> is unrecognized in this browser. ' + 'If you meant to render a React component, start its name with ' + 'an uppercase letter.', type); 29501 } 29502 } 29503 } 29504 29505 return domElement; 29506} 29507function createTextNode(text, rootContainerElement) { 29508 return getOwnerDocumentFromRootContainer(rootContainerElement).createTextNode(text); 29509} 29510function setInitialProperties(domElement, tag, rawProps, rootContainerElement) { 29511 var isCustomComponentTag = isCustomComponent(tag, rawProps); 29512 29513 { 29514 validatePropertiesInDevelopment(tag, rawProps); 29515 } // TODO: Make sure that we check isMounted before firing any of these events. 29516 29517 29518 var props; 29519 29520 switch (tag) { 29521 case 'dialog': 29522 listenToNonDelegatedEvent('cancel', domElement); 29523 listenToNonDelegatedEvent('close', domElement); 29524 props = rawProps; 29525 break; 29526 29527 case 'iframe': 29528 case 'object': 29529 case 'embed': 29530 // We listen to this event in case to ensure emulated bubble 29531 // listeners still fire for the load event. 29532 listenToNonDelegatedEvent('load', domElement); 29533 props = rawProps; 29534 break; 29535 29536 case 'video': 29537 case 'audio': 29538 // We listen to these events in case to ensure emulated bubble 29539 // listeners still fire for all the media events. 29540 for (var i = 0; i < mediaEventTypes.length; i++) { 29541 listenToNonDelegatedEvent(mediaEventTypes[i], domElement); 29542 } 29543 29544 props = rawProps; 29545 break; 29546 29547 case 'source': 29548 // We listen to this event in case to ensure emulated bubble 29549 // listeners still fire for the error event. 29550 listenToNonDelegatedEvent('error', domElement); 29551 props = rawProps; 29552 break; 29553 29554 case 'img': 29555 case 'image': 29556 case 'link': 29557 // We listen to these events in case to ensure emulated bubble 29558 // listeners still fire for error and load events. 29559 listenToNonDelegatedEvent('error', domElement); 29560 listenToNonDelegatedEvent('load', domElement); 29561 props = rawProps; 29562 break; 29563 29564 case 'details': 29565 // We listen to this event in case to ensure emulated bubble 29566 // listeners still fire for the toggle event. 29567 listenToNonDelegatedEvent('toggle', domElement); 29568 props = rawProps; 29569 break; 29570 29571 case 'input': 29572 initWrapperState(domElement, rawProps); 29573 props = getHostProps(domElement, rawProps); // We listen to this event in case to ensure emulated bubble 29574 // listeners still fire for the invalid event. 29575 29576 listenToNonDelegatedEvent('invalid', domElement); 29577 break; 29578 29579 case 'option': 29580 validateProps(domElement, rawProps); 29581 props = rawProps; 29582 break; 29583 29584 case 'select': 29585 initWrapperState$1(domElement, rawProps); 29586 props = getHostProps$1(domElement, rawProps); // We listen to this event in case to ensure emulated bubble 29587 // listeners still fire for the invalid event. 29588 29589 listenToNonDelegatedEvent('invalid', domElement); 29590 break; 29591 29592 case 'textarea': 29593 initWrapperState$2(domElement, rawProps); 29594 props = getHostProps$2(domElement, rawProps); // We listen to this event in case to ensure emulated bubble 29595 // listeners still fire for the invalid event. 29596 29597 listenToNonDelegatedEvent('invalid', domElement); 29598 break; 29599 29600 default: 29601 props = rawProps; 29602 } 29603 29604 assertValidProps(tag, props); 29605 setInitialDOMProperties(tag, domElement, rootContainerElement, props, isCustomComponentTag); 29606 29607 switch (tag) { 29608 case 'input': 29609 // TODO: Make sure we check if this is still unmounted or do any clean 29610 // up necessary since we never stop tracking anymore. 29611 track(domElement); 29612 postMountWrapper(domElement, rawProps, false); 29613 break; 29614 29615 case 'textarea': 29616 // TODO: Make sure we check if this is still unmounted or do any clean 29617 // up necessary since we never stop tracking anymore. 29618 track(domElement); 29619 postMountWrapper$3(domElement); 29620 break; 29621 29622 case 'option': 29623 postMountWrapper$1(domElement, rawProps); 29624 break; 29625 29626 case 'select': 29627 postMountWrapper$2(domElement, rawProps); 29628 break; 29629 29630 default: 29631 if (typeof props.onClick === 'function') { 29632 // TODO: This cast may not be sound for SVG, MathML or custom elements. 29633 trapClickOnNonInteractiveElement(domElement); 29634 } 29635 29636 break; 29637 } 29638} // Calculate the diff between the two objects. 29639 29640function diffProperties(domElement, tag, lastRawProps, nextRawProps, rootContainerElement) { 29641 { 29642 validatePropertiesInDevelopment(tag, nextRawProps); 29643 } 29644 29645 var updatePayload = null; 29646 var lastProps; 29647 var nextProps; 29648 29649 switch (tag) { 29650 case 'input': 29651 lastProps = getHostProps(domElement, lastRawProps); 29652 nextProps = getHostProps(domElement, nextRawProps); 29653 updatePayload = []; 29654 break; 29655 29656 case 'select': 29657 lastProps = getHostProps$1(domElement, lastRawProps); 29658 nextProps = getHostProps$1(domElement, nextRawProps); 29659 updatePayload = []; 29660 break; 29661 29662 case 'textarea': 29663 lastProps = getHostProps$2(domElement, lastRawProps); 29664 nextProps = getHostProps$2(domElement, nextRawProps); 29665 updatePayload = []; 29666 break; 29667 29668 default: 29669 lastProps = lastRawProps; 29670 nextProps = nextRawProps; 29671 29672 if (typeof lastProps.onClick !== 'function' && typeof nextProps.onClick === 'function') { 29673 // TODO: This cast may not be sound for SVG, MathML or custom elements. 29674 trapClickOnNonInteractiveElement(domElement); 29675 } 29676 29677 break; 29678 } 29679 29680 assertValidProps(tag, nextProps); 29681 var propKey; 29682 var styleName; 29683 var styleUpdates = null; 29684 29685 for (propKey in lastProps) { 29686 if (nextProps.hasOwnProperty(propKey) || !lastProps.hasOwnProperty(propKey) || lastProps[propKey] == null) { 29687 continue; 29688 } 29689 29690 if (propKey === STYLE) { 29691 var lastStyle = lastProps[propKey]; 29692 29693 for (styleName in lastStyle) { 29694 if (lastStyle.hasOwnProperty(styleName)) { 29695 if (!styleUpdates) { 29696 styleUpdates = {}; 29697 } 29698 29699 styleUpdates[styleName] = ''; 29700 } 29701 } 29702 } else if (propKey === DANGEROUSLY_SET_INNER_HTML || propKey === CHILDREN) ; else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (propKey === AUTOFOCUS) ; else if (registrationNameDependencies.hasOwnProperty(propKey)) { 29703 // This is a special case. If any listener updates we need to ensure 29704 // that the "current" fiber pointer gets updated so we need a commit 29705 // to update this element. 29706 if (!updatePayload) { 29707 updatePayload = []; 29708 } 29709 } else { 29710 // For all other deleted properties we add it to the queue. We use 29711 // the allowed property list in the commit phase instead. 29712 (updatePayload = updatePayload || []).push(propKey, null); 29713 } 29714 } 29715 29716 for (propKey in nextProps) { 29717 var nextProp = nextProps[propKey]; 29718 var lastProp = lastProps != null ? lastProps[propKey] : undefined; 29719 29720 if (!nextProps.hasOwnProperty(propKey) || nextProp === lastProp || nextProp == null && lastProp == null) { 29721 continue; 29722 } 29723 29724 if (propKey === STYLE) { 29725 { 29726 if (nextProp) { 29727 // Freeze the next style object so that we can assume it won't be 29728 // mutated. We have already warned for this in the past. 29729 Object.freeze(nextProp); 29730 } 29731 } 29732 29733 if (lastProp) { 29734 // Unset styles on `lastProp` but not on `nextProp`. 29735 for (styleName in lastProp) { 29736 if (lastProp.hasOwnProperty(styleName) && (!nextProp || !nextProp.hasOwnProperty(styleName))) { 29737 if (!styleUpdates) { 29738 styleUpdates = {}; 29739 } 29740 29741 styleUpdates[styleName] = ''; 29742 } 29743 } // Update styles that changed since `lastProp`. 29744 29745 29746 for (styleName in nextProp) { 29747 if (nextProp.hasOwnProperty(styleName) && lastProp[styleName] !== nextProp[styleName]) { 29748 if (!styleUpdates) { 29749 styleUpdates = {}; 29750 } 29751 29752 styleUpdates[styleName] = nextProp[styleName]; 29753 } 29754 } 29755 } else { 29756 // Relies on `updateStylesByID` not mutating `styleUpdates`. 29757 if (!styleUpdates) { 29758 if (!updatePayload) { 29759 updatePayload = []; 29760 } 29761 29762 updatePayload.push(propKey, styleUpdates); 29763 } 29764 29765 styleUpdates = nextProp; 29766 } 29767 } else if (propKey === DANGEROUSLY_SET_INNER_HTML) { 29768 var nextHtml = nextProp ? nextProp[HTML$1] : undefined; 29769 var lastHtml = lastProp ? lastProp[HTML$1] : undefined; 29770 29771 if (nextHtml != null) { 29772 if (lastHtml !== nextHtml) { 29773 (updatePayload = updatePayload || []).push(propKey, nextHtml); 29774 } 29775 } 29776 } else if (propKey === CHILDREN) { 29777 if (typeof nextProp === 'string' || typeof nextProp === 'number') { 29778 (updatePayload = updatePayload || []).push(propKey, '' + nextProp); 29779 } 29780 } else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING) ; else if (registrationNameDependencies.hasOwnProperty(propKey)) { 29781 if (nextProp != null) { 29782 // We eagerly listen to this even though we haven't committed yet. 29783 if ( typeof nextProp !== 'function') { 29784 warnForInvalidEventListener(propKey, nextProp); 29785 } 29786 29787 if (propKey === 'onScroll') { 29788 listenToNonDelegatedEvent('scroll', domElement); 29789 } 29790 } 29791 29792 if (!updatePayload && lastProp !== nextProp) { 29793 // This is a special case. If any listener updates we need to ensure 29794 // that the "current" props pointer gets updated so we need a commit 29795 // to update this element. 29796 updatePayload = []; 29797 } 29798 } else { 29799 // For any other property we always add it to the queue and then we 29800 // filter it out using the allowed property list during the commit. 29801 (updatePayload = updatePayload || []).push(propKey, nextProp); 29802 } 29803 } 29804 29805 if (styleUpdates) { 29806 { 29807 validateShorthandPropertyCollisionInDev(styleUpdates, nextProps[STYLE]); 29808 } 29809 29810 (updatePayload = updatePayload || []).push(STYLE, styleUpdates); 29811 } 29812 29813 return updatePayload; 29814} // Apply the diff. 29815 29816function updateProperties(domElement, updatePayload, tag, lastRawProps, nextRawProps) { 29817 // Update checked *before* name. 29818 // In the middle of an update, it is possible to have multiple checked. 29819 // When a checked radio tries to change name, browser makes another radio's checked false. 29820 if (tag === 'input' && nextRawProps.type === 'radio' && nextRawProps.name != null) { 29821 updateChecked(domElement, nextRawProps); 29822 } 29823 29824 var wasCustomComponentTag = isCustomComponent(tag, lastRawProps); 29825 var isCustomComponentTag = isCustomComponent(tag, nextRawProps); // Apply the diff. 29826 29827 updateDOMProperties(domElement, updatePayload, wasCustomComponentTag, isCustomComponentTag); // TODO: Ensure that an update gets scheduled if any of the special props 29828 // changed. 29829 29830 switch (tag) { 29831 case 'input': 29832 // Update the wrapper around inputs *after* updating props. This has to 29833 // happen after `updateDOMProperties`. Otherwise HTML5 input validations 29834 // raise warnings and prevent the new value from being assigned. 29835 updateWrapper(domElement, nextRawProps); 29836 break; 29837 29838 case 'textarea': 29839 updateWrapper$1(domElement, nextRawProps); 29840 break; 29841 29842 case 'select': 29843 // <select> value update needs to occur after <option> children 29844 // reconciliation 29845 postUpdateWrapper(domElement, nextRawProps); 29846 break; 29847 } 29848} 29849 29850function getPossibleStandardName(propName) { 29851 { 29852 var lowerCasedName = propName.toLowerCase(); 29853 29854 if (!possibleStandardNames.hasOwnProperty(lowerCasedName)) { 29855 return null; 29856 } 29857 29858 return possibleStandardNames[lowerCasedName] || null; 29859 } 29860} 29861 29862function diffHydratedProperties(domElement, tag, rawProps, parentNamespace, rootContainerElement, isConcurrentMode, shouldWarnDev) { 29863 var isCustomComponentTag; 29864 var extraAttributeNames; 29865 29866 { 29867 isCustomComponentTag = isCustomComponent(tag, rawProps); 29868 validatePropertiesInDevelopment(tag, rawProps); 29869 } // TODO: Make sure that we check isMounted before firing any of these events. 29870 29871 29872 switch (tag) { 29873 case 'dialog': 29874 listenToNonDelegatedEvent('cancel', domElement); 29875 listenToNonDelegatedEvent('close', domElement); 29876 break; 29877 29878 case 'iframe': 29879 case 'object': 29880 case 'embed': 29881 // We listen to this event in case to ensure emulated bubble 29882 // listeners still fire for the load event. 29883 listenToNonDelegatedEvent('load', domElement); 29884 break; 29885 29886 case 'video': 29887 case 'audio': 29888 // We listen to these events in case to ensure emulated bubble 29889 // listeners still fire for all the media events. 29890 for (var i = 0; i < mediaEventTypes.length; i++) { 29891 listenToNonDelegatedEvent(mediaEventTypes[i], domElement); 29892 } 29893 29894 break; 29895 29896 case 'source': 29897 // We listen to this event in case to ensure emulated bubble 29898 // listeners still fire for the error event. 29899 listenToNonDelegatedEvent('error', domElement); 29900 break; 29901 29902 case 'img': 29903 case 'image': 29904 case 'link': 29905 // We listen to these events in case to ensure emulated bubble 29906 // listeners still fire for error and load events. 29907 listenToNonDelegatedEvent('error', domElement); 29908 listenToNonDelegatedEvent('load', domElement); 29909 break; 29910 29911 case 'details': 29912 // We listen to this event in case to ensure emulated bubble 29913 // listeners still fire for the toggle event. 29914 listenToNonDelegatedEvent('toggle', domElement); 29915 break; 29916 29917 case 'input': 29918 initWrapperState(domElement, rawProps); // We listen to this event in case to ensure emulated bubble 29919 // listeners still fire for the invalid event. 29920 29921 listenToNonDelegatedEvent('invalid', domElement); 29922 break; 29923 29924 case 'option': 29925 validateProps(domElement, rawProps); 29926 break; 29927 29928 case 'select': 29929 initWrapperState$1(domElement, rawProps); // We listen to this event in case to ensure emulated bubble 29930 // listeners still fire for the invalid event. 29931 29932 listenToNonDelegatedEvent('invalid', domElement); 29933 break; 29934 29935 case 'textarea': 29936 initWrapperState$2(domElement, rawProps); // We listen to this event in case to ensure emulated bubble 29937 // listeners still fire for the invalid event. 29938 29939 listenToNonDelegatedEvent('invalid', domElement); 29940 break; 29941 } 29942 29943 assertValidProps(tag, rawProps); 29944 29945 { 29946 extraAttributeNames = new Set(); 29947 var attributes = domElement.attributes; 29948 29949 for (var _i = 0; _i < attributes.length; _i++) { 29950 var name = attributes[_i].name.toLowerCase(); 29951 29952 switch (name) { 29953 // Controlled attributes are not validated 29954 // TODO: Only ignore them on controlled tags. 29955 case 'value': 29956 break; 29957 29958 case 'checked': 29959 break; 29960 29961 case 'selected': 29962 break; 29963 29964 default: 29965 // Intentionally use the original name. 29966 // See discussion in https://github.com/facebook/react/pull/10676. 29967 extraAttributeNames.add(attributes[_i].name); 29968 } 29969 } 29970 } 29971 29972 var updatePayload = null; 29973 29974 for (var propKey in rawProps) { 29975 if (!rawProps.hasOwnProperty(propKey)) { 29976 continue; 29977 } 29978 29979 var nextProp = rawProps[propKey]; 29980 29981 if (propKey === CHILDREN) { 29982 // For text content children we compare against textContent. This 29983 // might match additional HTML that is hidden when we read it using 29984 // textContent. E.g. "foo" will match "f<span>oo</span>" but that still 29985 // satisfies our requirement. Our requirement is not to produce perfect 29986 // HTML and attributes. Ideally we should preserve structure but it's 29987 // ok not to if the visible content is still enough to indicate what 29988 // even listeners these nodes might be wired up to. 29989 // TODO: Warn if there is more than a single textNode as a child. 29990 // TODO: Should we use domElement.firstChild.nodeValue to compare? 29991 if (typeof nextProp === 'string') { 29992 if (domElement.textContent !== nextProp) { 29993 if (rawProps[SUPPRESS_HYDRATION_WARNING] !== true) { 29994 checkForUnmatchedText(domElement.textContent, nextProp, isConcurrentMode, shouldWarnDev); 29995 } 29996 29997 updatePayload = [CHILDREN, nextProp]; 29998 } 29999 } else if (typeof nextProp === 'number') { 30000 if (domElement.textContent !== '' + nextProp) { 30001 if (rawProps[SUPPRESS_HYDRATION_WARNING] !== true) { 30002 checkForUnmatchedText(domElement.textContent, nextProp, isConcurrentMode, shouldWarnDev); 30003 } 30004 30005 updatePayload = [CHILDREN, '' + nextProp]; 30006 } 30007 } 30008 } else if (registrationNameDependencies.hasOwnProperty(propKey)) { 30009 if (nextProp != null) { 30010 if ( typeof nextProp !== 'function') { 30011 warnForInvalidEventListener(propKey, nextProp); 30012 } 30013 30014 if (propKey === 'onScroll') { 30015 listenToNonDelegatedEvent('scroll', domElement); 30016 } 30017 } 30018 } else if (shouldWarnDev && true && // Convince Flow we've calculated it (it's DEV-only in this method.) 30019 typeof isCustomComponentTag === 'boolean') { 30020 // Validate that the properties correspond to their expected values. 30021 var serverValue = void 0; 30022 var propertyInfo = isCustomComponentTag && enableCustomElementPropertySupport ? null : getPropertyInfo(propKey); 30023 30024 if (rawProps[SUPPRESS_HYDRATION_WARNING] === true) ; else if (propKey === SUPPRESS_CONTENT_EDITABLE_WARNING || propKey === SUPPRESS_HYDRATION_WARNING || // Controlled attributes are not validated 30025 // TODO: Only ignore them on controlled tags. 30026 propKey === 'value' || propKey === 'checked' || propKey === 'selected') ; else if (propKey === DANGEROUSLY_SET_INNER_HTML) { 30027 var serverHTML = domElement.innerHTML; 30028 var nextHtml = nextProp ? nextProp[HTML$1] : undefined; 30029 30030 if (nextHtml != null) { 30031 var expectedHTML = normalizeHTML(domElement, nextHtml); 30032 30033 if (expectedHTML !== serverHTML) { 30034 warnForPropDifference(propKey, serverHTML, expectedHTML); 30035 } 30036 } 30037 } else if (propKey === STYLE) { 30038 // $FlowFixMe - Should be inferred as not undefined. 30039 extraAttributeNames.delete(propKey); 30040 30041 if (canDiffStyleForHydrationWarning) { 30042 var expectedStyle = createDangerousStringForStyles(nextProp); 30043 serverValue = domElement.getAttribute('style'); 30044 30045 if (expectedStyle !== serverValue) { 30046 warnForPropDifference(propKey, serverValue, expectedStyle); 30047 } 30048 } 30049 } else if (isCustomComponentTag && !enableCustomElementPropertySupport) { 30050 // $FlowFixMe - Should be inferred as not undefined. 30051 extraAttributeNames.delete(propKey.toLowerCase()); 30052 serverValue = getValueForAttribute(domElement, propKey, nextProp); 30053 30054 if (nextProp !== serverValue) { 30055 warnForPropDifference(propKey, serverValue, nextProp); 30056 } 30057 } else if (!shouldIgnoreAttribute(propKey, propertyInfo, isCustomComponentTag) && !shouldRemoveAttribute(propKey, nextProp, propertyInfo, isCustomComponentTag)) { 30058 var isMismatchDueToBadCasing = false; 30059 30060 if (propertyInfo !== null) { 30061 // $FlowFixMe - Should be inferred as not undefined. 30062 extraAttributeNames.delete(propertyInfo.attributeName); 30063 serverValue = getValueForProperty(domElement, propKey, nextProp, propertyInfo); 30064 } else { 30065 var ownNamespace = parentNamespace; 30066 30067 if (ownNamespace === HTML_NAMESPACE) { 30068 ownNamespace = getIntrinsicNamespace(tag); 30069 } 30070 30071 if (ownNamespace === HTML_NAMESPACE) { 30072 // $FlowFixMe - Should be inferred as not undefined. 30073 extraAttributeNames.delete(propKey.toLowerCase()); 30074 } else { 30075 var standardName = getPossibleStandardName(propKey); 30076 30077 if (standardName !== null && standardName !== propKey) { 30078 // If an SVG prop is supplied with bad casing, it will 30079 // be successfully parsed from HTML, but will produce a mismatch 30080 // (and would be incorrectly rendered on the client). 30081 // However, we already warn about bad casing elsewhere. 30082 // So we'll skip the misleading extra mismatch warning in this case. 30083 isMismatchDueToBadCasing = true; // $FlowFixMe - Should be inferred as not undefined. 30084 30085 extraAttributeNames.delete(standardName); 30086 } // $FlowFixMe - Should be inferred as not undefined. 30087 30088 30089 extraAttributeNames.delete(propKey); 30090 } 30091 30092 serverValue = getValueForAttribute(domElement, propKey, nextProp); 30093 } 30094 30095 var dontWarnCustomElement = enableCustomElementPropertySupport ; 30096 30097 if (!dontWarnCustomElement && nextProp !== serverValue && !isMismatchDueToBadCasing) { 30098 warnForPropDifference(propKey, serverValue, nextProp); 30099 } 30100 } 30101 } 30102 } 30103 30104 { 30105 if (shouldWarnDev) { 30106 if ( // $FlowFixMe - Should be inferred as not undefined. 30107 extraAttributeNames.size > 0 && rawProps[SUPPRESS_HYDRATION_WARNING] !== true) { 30108 // $FlowFixMe - Should be inferred as not undefined. 30109 warnForExtraAttributes(extraAttributeNames); 30110 } 30111 } 30112 } 30113 30114 switch (tag) { 30115 case 'input': 30116 // TODO: Make sure we check if this is still unmounted or do any clean 30117 // up necessary since we never stop tracking anymore. 30118 track(domElement); 30119 postMountWrapper(domElement, rawProps, true); 30120 break; 30121 30122 case 'textarea': 30123 // TODO: Make sure we check if this is still unmounted or do any clean 30124 // up necessary since we never stop tracking anymore. 30125 track(domElement); 30126 postMountWrapper$3(domElement); 30127 break; 30128 30129 case 'select': 30130 case 'option': 30131 // For input and textarea we current always set the value property at 30132 // post mount to force it to diverge from attributes. However, for 30133 // option and select we don't quite do the same thing and select 30134 // is not resilient to the DOM state changing so we don't do that here. 30135 // TODO: Consider not doing this for input and textarea. 30136 break; 30137 30138 default: 30139 if (typeof rawProps.onClick === 'function') { 30140 // TODO: This cast may not be sound for SVG, MathML or custom elements. 30141 trapClickOnNonInteractiveElement(domElement); 30142 } 30143 30144 break; 30145 } 30146 30147 return updatePayload; 30148} 30149function diffHydratedText(textNode, text, isConcurrentMode) { 30150 var isDifferent = textNode.nodeValue !== text; 30151 return isDifferent; 30152} 30153function warnForDeletedHydratableElement(parentNode, child) { 30154 { 30155 if (didWarnInvalidHydration) { 30156 return; 30157 } 30158 30159 didWarnInvalidHydration = true; 30160 30161 error('Did not expect server HTML to contain a <%s> in <%s>.', child.nodeName.toLowerCase(), parentNode.nodeName.toLowerCase()); 30162 } 30163} 30164function warnForDeletedHydratableText(parentNode, child) { 30165 { 30166 if (didWarnInvalidHydration) { 30167 return; 30168 } 30169 30170 didWarnInvalidHydration = true; 30171 30172 error('Did not expect server HTML to contain the text node "%s" in <%s>.', child.nodeValue, parentNode.nodeName.toLowerCase()); 30173 } 30174} 30175function warnForInsertedHydratedElement(parentNode, tag, props) { 30176 { 30177 if (didWarnInvalidHydration) { 30178 return; 30179 } 30180 30181 didWarnInvalidHydration = true; 30182 30183 error('Expected server HTML to contain a matching <%s> in <%s>.', tag, parentNode.nodeName.toLowerCase()); 30184 } 30185} 30186function warnForInsertedHydratedText(parentNode, text) { 30187 { 30188 if (text === '') { 30189 // We expect to insert empty text nodes since they're not represented in 30190 // the HTML. 30191 // TODO: Remove this special case if we can just avoid inserting empty 30192 // text nodes. 30193 return; 30194 } 30195 30196 if (didWarnInvalidHydration) { 30197 return; 30198 } 30199 30200 didWarnInvalidHydration = true; 30201 30202 error('Expected server HTML to contain a matching text node for "%s" in <%s>.', text, parentNode.nodeName.toLowerCase()); 30203 } 30204} 30205function restoreControlledState$3(domElement, tag, props) { 30206 switch (tag) { 30207 case 'input': 30208 restoreControlledState(domElement, props); 30209 return; 30210 30211 case 'textarea': 30212 restoreControlledState$2(domElement, props); 30213 return; 30214 30215 case 'select': 30216 restoreControlledState$1(domElement, props); 30217 return; 30218 } 30219} 30220 30221var validateDOMNesting = function () {}; 30222 30223var updatedAncestorInfo = function () {}; 30224 30225{ 30226 // This validation code was written based on the HTML5 parsing spec: 30227 // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope 30228 // 30229 // Note: this does not catch all invalid nesting, nor does it try to (as it's 30230 // not clear what practical benefit doing so provides); instead, we warn only 30231 // for cases where the parser will give a parse tree differing from what React 30232 // intended. For example, <b><div></div></b> is invalid but we don't warn 30233 // because it still parses correctly; we do warn for other cases like nested 30234 // <p> tags where the beginning of the second element implicitly closes the 30235 // first, causing a confusing mess. 30236 // https://html.spec.whatwg.org/multipage/syntax.html#special 30237 var specialTags = ['address', 'applet', 'area', 'article', 'aside', 'base', 'basefont', 'bgsound', 'blockquote', 'body', 'br', 'button', 'caption', 'center', 'col', 'colgroup', 'dd', 'details', 'dir', 'div', 'dl', 'dt', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'frame', 'frameset', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'iframe', 'img', 'input', 'isindex', 'li', 'link', 'listing', 'main', 'marquee', 'menu', 'menuitem', 'meta', 'nav', 'noembed', 'noframes', 'noscript', 'object', 'ol', 'p', 'param', 'plaintext', 'pre', 'script', 'section', 'select', 'source', 'style', 'summary', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'title', 'tr', 'track', 'ul', 'wbr', 'xmp']; // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-scope 30238 30239 var inScopeTags = ['applet', 'caption', 'html', 'table', 'td', 'th', 'marquee', 'object', 'template', // https://html.spec.whatwg.org/multipage/syntax.html#html-integration-point 30240 // TODO: Distinguish by namespace here -- for <title>, including it here 30241 // errs on the side of fewer warnings 30242 'foreignObject', 'desc', 'title']; // https://html.spec.whatwg.org/multipage/syntax.html#has-an-element-in-button-scope 30243 30244 var buttonScopeTags = inScopeTags.concat(['button']); // https://html.spec.whatwg.org/multipage/syntax.html#generate-implied-end-tags 30245 30246 var impliedEndTags = ['dd', 'dt', 'li', 'option', 'optgroup', 'p', 'rp', 'rt']; 30247 var emptyAncestorInfo = { 30248 current: null, 30249 formTag: null, 30250 aTagInScope: null, 30251 buttonTagInScope: null, 30252 nobrTagInScope: null, 30253 pTagInButtonScope: null, 30254 listItemTagAutoclosing: null, 30255 dlItemTagAutoclosing: null 30256 }; 30257 30258 updatedAncestorInfo = function (oldInfo, tag) { 30259 var ancestorInfo = assign({}, oldInfo || emptyAncestorInfo); 30260 30261 var info = { 30262 tag: tag 30263 }; 30264 30265 if (inScopeTags.indexOf(tag) !== -1) { 30266 ancestorInfo.aTagInScope = null; 30267 ancestorInfo.buttonTagInScope = null; 30268 ancestorInfo.nobrTagInScope = null; 30269 } 30270 30271 if (buttonScopeTags.indexOf(tag) !== -1) { 30272 ancestorInfo.pTagInButtonScope = null; 30273 } // See rules for 'li', 'dd', 'dt' start tags in 30274 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody 30275 30276 30277 if (specialTags.indexOf(tag) !== -1 && tag !== 'address' && tag !== 'div' && tag !== 'p') { 30278 ancestorInfo.listItemTagAutoclosing = null; 30279 ancestorInfo.dlItemTagAutoclosing = null; 30280 } 30281 30282 ancestorInfo.current = info; 30283 30284 if (tag === 'form') { 30285 ancestorInfo.formTag = info; 30286 } 30287 30288 if (tag === 'a') { 30289 ancestorInfo.aTagInScope = info; 30290 } 30291 30292 if (tag === 'button') { 30293 ancestorInfo.buttonTagInScope = info; 30294 } 30295 30296 if (tag === 'nobr') { 30297 ancestorInfo.nobrTagInScope = info; 30298 } 30299 30300 if (tag === 'p') { 30301 ancestorInfo.pTagInButtonScope = info; 30302 } 30303 30304 if (tag === 'li') { 30305 ancestorInfo.listItemTagAutoclosing = info; 30306 } 30307 30308 if (tag === 'dd' || tag === 'dt') { 30309 ancestorInfo.dlItemTagAutoclosing = info; 30310 } 30311 30312 return ancestorInfo; 30313 }; 30314 /** 30315 * Returns whether 30316 */ 30317 30318 30319 var isTagValidWithParent = function (tag, parentTag) { 30320 // First, let's check if we're in an unusual parsing mode... 30321 switch (parentTag) { 30322 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inselect 30323 case 'select': 30324 return tag === 'option' || tag === 'optgroup' || tag === '#text'; 30325 30326 case 'optgroup': 30327 return tag === 'option' || tag === '#text'; 30328 // Strictly speaking, seeing an <option> doesn't mean we're in a <select> 30329 // but 30330 30331 case 'option': 30332 return tag === '#text'; 30333 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intd 30334 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incaption 30335 // No special behavior since these rules fall back to "in body" mode for 30336 // all except special table nodes which cause bad parsing behavior anyway. 30337 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intr 30338 30339 case 'tr': 30340 return tag === 'th' || tag === 'td' || tag === 'style' || tag === 'script' || tag === 'template'; 30341 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intbody 30342 30343 case 'tbody': 30344 case 'thead': 30345 case 'tfoot': 30346 return tag === 'tr' || tag === 'style' || tag === 'script' || tag === 'template'; 30347 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-incolgroup 30348 30349 case 'colgroup': 30350 return tag === 'col' || tag === 'template'; 30351 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-intable 30352 30353 case 'table': 30354 return tag === 'caption' || tag === 'colgroup' || tag === 'tbody' || tag === 'tfoot' || tag === 'thead' || tag === 'style' || tag === 'script' || tag === 'template'; 30355 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inhead 30356 30357 case 'head': 30358 return tag === 'base' || tag === 'basefont' || tag === 'bgsound' || tag === 'link' || tag === 'meta' || tag === 'title' || tag === 'noscript' || tag === 'noframes' || tag === 'style' || tag === 'script' || tag === 'template'; 30359 // https://html.spec.whatwg.org/multipage/semantics.html#the-html-element 30360 30361 case 'html': 30362 return tag === 'head' || tag === 'body' || tag === 'frameset'; 30363 30364 case 'frameset': 30365 return tag === 'frame'; 30366 30367 case '#document': 30368 return tag === 'html'; 30369 } // Probably in the "in body" parsing mode, so we outlaw only tag combos 30370 // where the parsing rules cause implicit opens or closes to be added. 30371 // https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody 30372 30373 30374 switch (tag) { 30375 case 'h1': 30376 case 'h2': 30377 case 'h3': 30378 case 'h4': 30379 case 'h5': 30380 case 'h6': 30381 return parentTag !== 'h1' && parentTag !== 'h2' && parentTag !== 'h3' && parentTag !== 'h4' && parentTag !== 'h5' && parentTag !== 'h6'; 30382 30383 case 'rp': 30384 case 'rt': 30385 return impliedEndTags.indexOf(parentTag) === -1; 30386 30387 case 'body': 30388 case 'caption': 30389 case 'col': 30390 case 'colgroup': 30391 case 'frameset': 30392 case 'frame': 30393 case 'head': 30394 case 'html': 30395 case 'tbody': 30396 case 'td': 30397 case 'tfoot': 30398 case 'th': 30399 case 'thead': 30400 case 'tr': 30401 // These tags are only valid with a few parents that have special child 30402 // parsing rules -- if we're down here, then none of those matched and 30403 // so we allow it only if we don't know what the parent is, as all other 30404 // cases are invalid. 30405 return parentTag == null; 30406 } 30407 30408 return true; 30409 }; 30410 /** 30411 * Returns whether 30412 */ 30413 30414 30415 var findInvalidAncestorForTag = function (tag, ancestorInfo) { 30416 switch (tag) { 30417 case 'address': 30418 case 'article': 30419 case 'aside': 30420 case 'blockquote': 30421 case 'center': 30422 case 'details': 30423 case 'dialog': 30424 case 'dir': 30425 case 'div': 30426 case 'dl': 30427 case 'fieldset': 30428 case 'figcaption': 30429 case 'figure': 30430 case 'footer': 30431 case 'header': 30432 case 'hgroup': 30433 case 'main': 30434 case 'menu': 30435 case 'nav': 30436 case 'ol': 30437 case 'p': 30438 case 'section': 30439 case 'summary': 30440 case 'ul': 30441 case 'pre': 30442 case 'listing': 30443 case 'table': 30444 case 'hr': 30445 case 'xmp': 30446 case 'h1': 30447 case 'h2': 30448 case 'h3': 30449 case 'h4': 30450 case 'h5': 30451 case 'h6': 30452 return ancestorInfo.pTagInButtonScope; 30453 30454 case 'form': 30455 return ancestorInfo.formTag || ancestorInfo.pTagInButtonScope; 30456 30457 case 'li': 30458 return ancestorInfo.listItemTagAutoclosing; 30459 30460 case 'dd': 30461 case 'dt': 30462 return ancestorInfo.dlItemTagAutoclosing; 30463 30464 case 'button': 30465 return ancestorInfo.buttonTagInScope; 30466 30467 case 'a': 30468 // Spec says something about storing a list of markers, but it sounds 30469 // equivalent to this check. 30470 return ancestorInfo.aTagInScope; 30471 30472 case 'nobr': 30473 return ancestorInfo.nobrTagInScope; 30474 } 30475 30476 return null; 30477 }; 30478 30479 var didWarn$1 = {}; 30480 30481 validateDOMNesting = function (childTag, childText, ancestorInfo) { 30482 ancestorInfo = ancestorInfo || emptyAncestorInfo; 30483 var parentInfo = ancestorInfo.current; 30484 var parentTag = parentInfo && parentInfo.tag; 30485 30486 if (childText != null) { 30487 if (childTag != null) { 30488 error('validateDOMNesting: when childText is passed, childTag should be null'); 30489 } 30490 30491 childTag = '#text'; 30492 } 30493 30494 var invalidParent = isTagValidWithParent(childTag, parentTag) ? null : parentInfo; 30495 var invalidAncestor = invalidParent ? null : findInvalidAncestorForTag(childTag, ancestorInfo); 30496 var invalidParentOrAncestor = invalidParent || invalidAncestor; 30497 30498 if (!invalidParentOrAncestor) { 30499 return; 30500 } 30501 30502 var ancestorTag = invalidParentOrAncestor.tag; 30503 var warnKey = !!invalidParent + '|' + childTag + '|' + ancestorTag; 30504 30505 if (didWarn$1[warnKey]) { 30506 return; 30507 } 30508 30509 didWarn$1[warnKey] = true; 30510 var tagDisplayName = childTag; 30511 var whitespaceInfo = ''; 30512 30513 if (childTag === '#text') { 30514 if (/\S/.test(childText)) { 30515 tagDisplayName = 'Text nodes'; 30516 } else { 30517 tagDisplayName = 'Whitespace text nodes'; 30518 whitespaceInfo = " Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.'; 30519 } 30520 } else { 30521 tagDisplayName = '<' + childTag + '>'; 30522 } 30523 30524 if (invalidParent) { 30525 var info = ''; 30526 30527 if (ancestorTag === 'table' && childTag === 'tr') { 30528 info += ' Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated by ' + 'the browser.'; 30529 } 30530 30531 error('validateDOMNesting(...): %s cannot appear as a child of <%s>.%s%s', tagDisplayName, ancestorTag, whitespaceInfo, info); 30532 } else { 30533 error('validateDOMNesting(...): %s cannot appear as a descendant of ' + '<%s>.', tagDisplayName, ancestorTag); 30534 } 30535 }; 30536} 30537 30538var SUPPRESS_HYDRATION_WARNING$1 = 'suppressHydrationWarning'; 30539var SUSPENSE_START_DATA = '$'; 30540var SUSPENSE_END_DATA = '/$'; 30541var SUSPENSE_PENDING_START_DATA = '$?'; 30542var SUSPENSE_FALLBACK_START_DATA = '$!'; 30543var STYLE$1 = 'style'; 30544var eventsEnabled = null; 30545var selectionInformation = null; 30546function getRootHostContext(rootContainerInstance) { 30547 var type; 30548 var namespace; 30549 var nodeType = rootContainerInstance.nodeType; 30550 30551 switch (nodeType) { 30552 case DOCUMENT_NODE: 30553 case DOCUMENT_FRAGMENT_NODE: 30554 { 30555 type = nodeType === DOCUMENT_NODE ? '#document' : '#fragment'; 30556 var root = rootContainerInstance.documentElement; 30557 namespace = root ? root.namespaceURI : getChildNamespace(null, ''); 30558 break; 30559 } 30560 30561 default: 30562 { 30563 var container = nodeType === COMMENT_NODE ? rootContainerInstance.parentNode : rootContainerInstance; 30564 var ownNamespace = container.namespaceURI || null; 30565 type = container.tagName; 30566 namespace = getChildNamespace(ownNamespace, type); 30567 break; 30568 } 30569 } 30570 30571 { 30572 var validatedTag = type.toLowerCase(); 30573 var ancestorInfo = updatedAncestorInfo(null, validatedTag); 30574 return { 30575 namespace: namespace, 30576 ancestorInfo: ancestorInfo 30577 }; 30578 } 30579} 30580function getChildHostContext(parentHostContext, type, rootContainerInstance) { 30581 { 30582 var parentHostContextDev = parentHostContext; 30583 var namespace = getChildNamespace(parentHostContextDev.namespace, type); 30584 var ancestorInfo = updatedAncestorInfo(parentHostContextDev.ancestorInfo, type); 30585 return { 30586 namespace: namespace, 30587 ancestorInfo: ancestorInfo 30588 }; 30589 } 30590} 30591function getPublicInstance(instance) { 30592 return instance; 30593} 30594function prepareForCommit(containerInfo) { 30595 eventsEnabled = isEnabled(); 30596 selectionInformation = getSelectionInformation(); 30597 var activeInstance = null; 30598 30599 setEnabled(false); 30600 return activeInstance; 30601} 30602function resetAfterCommit(containerInfo) { 30603 restoreSelection(selectionInformation); 30604 setEnabled(eventsEnabled); 30605 eventsEnabled = null; 30606 selectionInformation = null; 30607} 30608function createInstance(type, props, rootContainerInstance, hostContext, internalInstanceHandle) { 30609 var parentNamespace; 30610 30611 { 30612 // TODO: take namespace into account when validating. 30613 var hostContextDev = hostContext; 30614 validateDOMNesting(type, null, hostContextDev.ancestorInfo); 30615 30616 if (typeof props.children === 'string' || typeof props.children === 'number') { 30617 var string = '' + props.children; 30618 var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type); 30619 validateDOMNesting(null, string, ownAncestorInfo); 30620 } 30621 30622 parentNamespace = hostContextDev.namespace; 30623 } 30624 30625 var domElement = createElement(type, props, rootContainerInstance, parentNamespace); 30626 precacheFiberNode(internalInstanceHandle, domElement); 30627 updateFiberProps(domElement, props); 30628 return domElement; 30629} 30630function appendInitialChild(parentInstance, child) { 30631 parentInstance.appendChild(child); 30632} 30633function finalizeInitialChildren(domElement, type, props, rootContainerInstance, hostContext) { 30634 setInitialProperties(domElement, type, props, rootContainerInstance); 30635 30636 switch (type) { 30637 case 'button': 30638 case 'input': 30639 case 'select': 30640 case 'textarea': 30641 return !!props.autoFocus; 30642 30643 case 'img': 30644 return true; 30645 30646 default: 30647 return false; 30648 } 30649} 30650function prepareUpdate(domElement, type, oldProps, newProps, rootContainerInstance, hostContext) { 30651 { 30652 var hostContextDev = hostContext; 30653 30654 if (typeof newProps.children !== typeof oldProps.children && (typeof newProps.children === 'string' || typeof newProps.children === 'number')) { 30655 var string = '' + newProps.children; 30656 var ownAncestorInfo = updatedAncestorInfo(hostContextDev.ancestorInfo, type); 30657 validateDOMNesting(null, string, ownAncestorInfo); 30658 } 30659 } 30660 30661 return diffProperties(domElement, type, oldProps, newProps); 30662} 30663function shouldSetTextContent(type, props) { 30664 return type === 'textarea' || type === 'noscript' || typeof props.children === 'string' || typeof props.children === 'number' || typeof props.dangerouslySetInnerHTML === 'object' && props.dangerouslySetInnerHTML !== null && props.dangerouslySetInnerHTML.__html != null; 30665} 30666function createTextInstance(text, rootContainerInstance, hostContext, internalInstanceHandle) { 30667 { 30668 var hostContextDev = hostContext; 30669 validateDOMNesting(null, text, hostContextDev.ancestorInfo); 30670 } 30671 30672 var textNode = createTextNode(text, rootContainerInstance); 30673 precacheFiberNode(internalInstanceHandle, textNode); 30674 return textNode; 30675} 30676function getCurrentEventPriority() { 30677 var currentEvent = window.event; 30678 30679 if (currentEvent === undefined) { 30680 return DefaultEventPriority; 30681 } 30682 30683 return getEventPriority(currentEvent.type); 30684} 30685// if a component just imports ReactDOM (e.g. for findDOMNode). 30686// Some environments might not have setTimeout or clearTimeout. 30687 30688var scheduleTimeout = typeof setTimeout === 'function' ? setTimeout : undefined; 30689var cancelTimeout = typeof clearTimeout === 'function' ? clearTimeout : undefined; 30690var noTimeout = -1; 30691var localPromise = typeof Promise === 'function' ? Promise : undefined; // ------------------- 30692var scheduleMicrotask = typeof queueMicrotask === 'function' ? queueMicrotask : typeof localPromise !== 'undefined' ? function (callback) { 30693 return localPromise.resolve(null).then(callback).catch(handleErrorInNextTick); 30694} : scheduleTimeout; // TODO: Determine the best fallback here. 30695 30696function handleErrorInNextTick(error) { 30697 setTimeout(function () { 30698 throw error; 30699 }); 30700} // ------------------- 30701function commitMount(domElement, type, newProps, internalInstanceHandle) { 30702 // Despite the naming that might imply otherwise, this method only 30703 // fires if there is an `Update` effect scheduled during mounting. 30704 // This happens if `finalizeInitialChildren` returns `true` (which it 30705 // does to implement the `autoFocus` attribute on the client). But 30706 // there are also other cases when this might happen (such as patching 30707 // up text content during hydration mismatch). So we'll check this again. 30708 switch (type) { 30709 case 'button': 30710 case 'input': 30711 case 'select': 30712 case 'textarea': 30713 if (newProps.autoFocus) { 30714 domElement.focus(); 30715 } 30716 30717 return; 30718 30719 case 'img': 30720 { 30721 if (newProps.src) { 30722 domElement.src = newProps.src; 30723 } 30724 30725 return; 30726 } 30727 } 30728} 30729function commitUpdate(domElement, updatePayload, type, oldProps, newProps, internalInstanceHandle) { 30730 // Apply the diff to the DOM node. 30731 updateProperties(domElement, updatePayload, type, oldProps, newProps); // Update the props handle so that we know which props are the ones with 30732 // with current event handlers. 30733 30734 updateFiberProps(domElement, newProps); 30735} 30736function resetTextContent(domElement) { 30737 setTextContent(domElement, ''); 30738} 30739function commitTextUpdate(textInstance, oldText, newText) { 30740 textInstance.nodeValue = newText; 30741} 30742function appendChild(parentInstance, child) { 30743 parentInstance.appendChild(child); 30744} 30745function appendChildToContainer(container, child) { 30746 var parentNode; 30747 30748 if (container.nodeType === COMMENT_NODE) { 30749 parentNode = container.parentNode; 30750 parentNode.insertBefore(child, container); 30751 } else { 30752 parentNode = container; 30753 parentNode.appendChild(child); 30754 } // This container might be used for a portal. 30755 // If something inside a portal is clicked, that click should bubble 30756 // through the React tree. However, on Mobile Safari the click would 30757 // never bubble through the *DOM* tree unless an ancestor with onclick 30758 // event exists. So we wouldn't see it and dispatch it. 30759 // This is why we ensure that non React root containers have inline onclick 30760 // defined. 30761 // https://github.com/facebook/react/issues/11918 30762 30763 30764 var reactRootContainer = container._reactRootContainer; 30765 30766 if ((reactRootContainer === null || reactRootContainer === undefined) && parentNode.onclick === null) { 30767 // TODO: This cast may not be sound for SVG, MathML or custom elements. 30768 trapClickOnNonInteractiveElement(parentNode); 30769 } 30770} 30771function insertBefore(parentInstance, child, beforeChild) { 30772 parentInstance.insertBefore(child, beforeChild); 30773} 30774function insertInContainerBefore(container, child, beforeChild) { 30775 if (container.nodeType === COMMENT_NODE) { 30776 container.parentNode.insertBefore(child, beforeChild); 30777 } else { 30778 container.insertBefore(child, beforeChild); 30779 } 30780} 30781 30782function removeChild(parentInstance, child) { 30783 parentInstance.removeChild(child); 30784} 30785function removeChildFromContainer(container, child) { 30786 if (container.nodeType === COMMENT_NODE) { 30787 container.parentNode.removeChild(child); 30788 } else { 30789 container.removeChild(child); 30790 } 30791} 30792function clearSuspenseBoundary(parentInstance, suspenseInstance) { 30793 var node = suspenseInstance; // Delete all nodes within this suspense boundary. 30794 // There might be nested nodes so we need to keep track of how 30795 // deep we are and only break out when we're back on top. 30796 30797 var depth = 0; 30798 30799 do { 30800 var nextNode = node.nextSibling; 30801 parentInstance.removeChild(node); 30802 30803 if (nextNode && nextNode.nodeType === COMMENT_NODE) { 30804 var data = nextNode.data; 30805 30806 if (data === SUSPENSE_END_DATA) { 30807 if (depth === 0) { 30808 parentInstance.removeChild(nextNode); // Retry if any event replaying was blocked on this. 30809 30810 retryIfBlockedOn(suspenseInstance); 30811 return; 30812 } else { 30813 depth--; 30814 } 30815 } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_PENDING_START_DATA || data === SUSPENSE_FALLBACK_START_DATA) { 30816 depth++; 30817 } 30818 } 30819 30820 node = nextNode; 30821 } while (node); // TODO: Warn, we didn't find the end comment boundary. 30822 // Retry if any event replaying was blocked on this. 30823 30824 30825 retryIfBlockedOn(suspenseInstance); 30826} 30827function clearSuspenseBoundaryFromContainer(container, suspenseInstance) { 30828 if (container.nodeType === COMMENT_NODE) { 30829 clearSuspenseBoundary(container.parentNode, suspenseInstance); 30830 } else if (container.nodeType === ELEMENT_NODE) { 30831 clearSuspenseBoundary(container, suspenseInstance); 30832 } // Retry if any event replaying was blocked on this. 30833 30834 30835 retryIfBlockedOn(container); 30836} 30837function hideInstance(instance) { 30838 // TODO: Does this work for all element types? What about MathML? Should we 30839 // pass host context to this method? 30840 instance = instance; 30841 var style = instance.style; 30842 30843 if (typeof style.setProperty === 'function') { 30844 style.setProperty('display', 'none', 'important'); 30845 } else { 30846 style.display = 'none'; 30847 } 30848} 30849function hideTextInstance(textInstance) { 30850 textInstance.nodeValue = ''; 30851} 30852function unhideInstance(instance, props) { 30853 instance = instance; 30854 var styleProp = props[STYLE$1]; 30855 var display = styleProp !== undefined && styleProp !== null && styleProp.hasOwnProperty('display') ? styleProp.display : null; 30856 instance.style.display = dangerousStyleValue('display', display); 30857} 30858function unhideTextInstance(textInstance, text) { 30859 textInstance.nodeValue = text; 30860} 30861function clearContainer(container) { 30862 if (container.nodeType === ELEMENT_NODE) { 30863 container.textContent = ''; 30864 } else if (container.nodeType === DOCUMENT_NODE) { 30865 if (container.documentElement) { 30866 container.removeChild(container.documentElement); 30867 } 30868 } 30869} // ------------------- 30870function canHydrateInstance(instance, type, props) { 30871 if (instance.nodeType !== ELEMENT_NODE || type.toLowerCase() !== instance.nodeName.toLowerCase()) { 30872 return null; 30873 } // This has now been refined to an element node. 30874 30875 30876 return instance; 30877} 30878function canHydrateTextInstance(instance, text) { 30879 if (text === '' || instance.nodeType !== TEXT_NODE) { 30880 // Empty strings are not parsed by HTML so there won't be a correct match here. 30881 return null; 30882 } // This has now been refined to a text node. 30883 30884 30885 return instance; 30886} 30887function canHydrateSuspenseInstance(instance) { 30888 if (instance.nodeType !== COMMENT_NODE) { 30889 // Empty strings are not parsed by HTML so there won't be a correct match here. 30890 return null; 30891 } // This has now been refined to a suspense node. 30892 30893 30894 return instance; 30895} 30896function isSuspenseInstancePending(instance) { 30897 return instance.data === SUSPENSE_PENDING_START_DATA; 30898} 30899function isSuspenseInstanceFallback(instance) { 30900 return instance.data === SUSPENSE_FALLBACK_START_DATA; 30901} 30902function getSuspenseInstanceFallbackErrorDetails(instance) { 30903 var dataset = instance.nextSibling && instance.nextSibling.dataset; 30904 var digest, message, stack; 30905 30906 if (dataset) { 30907 digest = dataset.dgst; 30908 30909 { 30910 message = dataset.msg; 30911 stack = dataset.stck; 30912 } 30913 } 30914 30915 { 30916 return { 30917 message: message, 30918 digest: digest, 30919 stack: stack 30920 }; 30921 } // let value = {message: undefined, hash: undefined}; 30922 // const nextSibling = instance.nextSibling; 30923 // if (nextSibling) { 30924 // const dataset = ((nextSibling: any): HTMLTemplateElement).dataset; 30925 // value.message = dataset.msg; 30926 // value.hash = dataset.hash; 30927 // if (true) { 30928 // value.stack = dataset.stack; 30929 // } 30930 // } 30931 // return value; 30932 30933} 30934function registerSuspenseInstanceRetry(instance, callback) { 30935 instance._reactRetry = callback; 30936} 30937 30938function getNextHydratable(node) { 30939 // Skip non-hydratable nodes. 30940 for (; node != null; node = node.nextSibling) { 30941 var nodeType = node.nodeType; 30942 30943 if (nodeType === ELEMENT_NODE || nodeType === TEXT_NODE) { 30944 break; 30945 } 30946 30947 if (nodeType === COMMENT_NODE) { 30948 var nodeData = node.data; 30949 30950 if (nodeData === SUSPENSE_START_DATA || nodeData === SUSPENSE_FALLBACK_START_DATA || nodeData === SUSPENSE_PENDING_START_DATA) { 30951 break; 30952 } 30953 30954 if (nodeData === SUSPENSE_END_DATA) { 30955 return null; 30956 } 30957 } 30958 } 30959 30960 return node; 30961} 30962 30963function getNextHydratableSibling(instance) { 30964 return getNextHydratable(instance.nextSibling); 30965} 30966function getFirstHydratableChild(parentInstance) { 30967 return getNextHydratable(parentInstance.firstChild); 30968} 30969function getFirstHydratableChildWithinContainer(parentContainer) { 30970 return getNextHydratable(parentContainer.firstChild); 30971} 30972function getFirstHydratableChildWithinSuspenseInstance(parentInstance) { 30973 return getNextHydratable(parentInstance.nextSibling); 30974} 30975function hydrateInstance(instance, type, props, rootContainerInstance, hostContext, internalInstanceHandle, shouldWarnDev) { 30976 precacheFiberNode(internalInstanceHandle, instance); // TODO: Possibly defer this until the commit phase where all the events 30977 // get attached. 30978 30979 updateFiberProps(instance, props); 30980 var parentNamespace; 30981 30982 { 30983 var hostContextDev = hostContext; 30984 parentNamespace = hostContextDev.namespace; 30985 } // TODO: Temporary hack to check if we're in a concurrent root. We can delete 30986 // when the legacy root API is removed. 30987 30988 30989 var isConcurrentMode = (internalInstanceHandle.mode & ConcurrentMode) !== NoMode; 30990 return diffHydratedProperties(instance, type, props, parentNamespace, rootContainerInstance, isConcurrentMode, shouldWarnDev); 30991} 30992function hydrateTextInstance(textInstance, text, internalInstanceHandle, shouldWarnDev) { 30993 precacheFiberNode(internalInstanceHandle, textInstance); // TODO: Temporary hack to check if we're in a concurrent root. We can delete 30994 // when the legacy root API is removed. 30995 30996 var isConcurrentMode = (internalInstanceHandle.mode & ConcurrentMode) !== NoMode; 30997 return diffHydratedText(textInstance, text); 30998} 30999function hydrateSuspenseInstance(suspenseInstance, internalInstanceHandle) { 31000 precacheFiberNode(internalInstanceHandle, suspenseInstance); 31001} 31002function getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance) { 31003 var node = suspenseInstance.nextSibling; // Skip past all nodes within this suspense boundary. 31004 // There might be nested nodes so we need to keep track of how 31005 // deep we are and only break out when we're back on top. 31006 31007 var depth = 0; 31008 31009 while (node) { 31010 if (node.nodeType === COMMENT_NODE) { 31011 var data = node.data; 31012 31013 if (data === SUSPENSE_END_DATA) { 31014 if (depth === 0) { 31015 return getNextHydratableSibling(node); 31016 } else { 31017 depth--; 31018 } 31019 } else if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) { 31020 depth++; 31021 } 31022 } 31023 31024 node = node.nextSibling; 31025 } // TODO: Warn, we didn't find the end comment boundary. 31026 31027 31028 return null; 31029} // Returns the SuspenseInstance if this node is a direct child of a 31030// SuspenseInstance. I.e. if its previous sibling is a Comment with 31031// SUSPENSE_x_START_DATA. Otherwise, null. 31032 31033function getParentSuspenseInstance(targetInstance) { 31034 var node = targetInstance.previousSibling; // Skip past all nodes within this suspense boundary. 31035 // There might be nested nodes so we need to keep track of how 31036 // deep we are and only break out when we're back on top. 31037 31038 var depth = 0; 31039 31040 while (node) { 31041 if (node.nodeType === COMMENT_NODE) { 31042 var data = node.data; 31043 31044 if (data === SUSPENSE_START_DATA || data === SUSPENSE_FALLBACK_START_DATA || data === SUSPENSE_PENDING_START_DATA) { 31045 if (depth === 0) { 31046 return node; 31047 } else { 31048 depth--; 31049 } 31050 } else if (data === SUSPENSE_END_DATA) { 31051 depth++; 31052 } 31053 } 31054 31055 node = node.previousSibling; 31056 } 31057 31058 return null; 31059} 31060function commitHydratedContainer(container) { 31061 // Retry if any event replaying was blocked on this. 31062 retryIfBlockedOn(container); 31063} 31064function commitHydratedSuspenseInstance(suspenseInstance) { 31065 // Retry if any event replaying was blocked on this. 31066 retryIfBlockedOn(suspenseInstance); 31067} 31068function shouldDeleteUnhydratedTailInstances(parentType) { 31069 return parentType !== 'head' && parentType !== 'body'; 31070} 31071function didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, text, isConcurrentMode) { 31072 var shouldWarnDev = true; 31073 checkForUnmatchedText(textInstance.nodeValue, text, isConcurrentMode, shouldWarnDev); 31074} 31075function didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, text, isConcurrentMode) { 31076 if (parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { 31077 var shouldWarnDev = true; 31078 checkForUnmatchedText(textInstance.nodeValue, text, isConcurrentMode, shouldWarnDev); 31079 } 31080} 31081function didNotHydrateInstanceWithinContainer(parentContainer, instance) { 31082 { 31083 if (instance.nodeType === ELEMENT_NODE) { 31084 warnForDeletedHydratableElement(parentContainer, instance); 31085 } else if (instance.nodeType === COMMENT_NODE) ; else { 31086 warnForDeletedHydratableText(parentContainer, instance); 31087 } 31088 } 31089} 31090function didNotHydrateInstanceWithinSuspenseInstance(parentInstance, instance) { 31091 { 31092 // $FlowFixMe: Only Element or Document can be parent nodes. 31093 var parentNode = parentInstance.parentNode; 31094 31095 if (parentNode !== null) { 31096 if (instance.nodeType === ELEMENT_NODE) { 31097 warnForDeletedHydratableElement(parentNode, instance); 31098 } else if (instance.nodeType === COMMENT_NODE) ; else { 31099 warnForDeletedHydratableText(parentNode, instance); 31100 } 31101 } 31102 } 31103} 31104function didNotHydrateInstance(parentType, parentProps, parentInstance, instance, isConcurrentMode) { 31105 { 31106 if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { 31107 if (instance.nodeType === ELEMENT_NODE) { 31108 warnForDeletedHydratableElement(parentInstance, instance); 31109 } else if (instance.nodeType === COMMENT_NODE) ; else { 31110 warnForDeletedHydratableText(parentInstance, instance); 31111 } 31112 } 31113 } 31114} 31115function didNotFindHydratableInstanceWithinContainer(parentContainer, type, props) { 31116 { 31117 warnForInsertedHydratedElement(parentContainer, type); 31118 } 31119} 31120function didNotFindHydratableTextInstanceWithinContainer(parentContainer, text) { 31121 { 31122 warnForInsertedHydratedText(parentContainer, text); 31123 } 31124} 31125function didNotFindHydratableInstanceWithinSuspenseInstance(parentInstance, type, props) { 31126 { 31127 // $FlowFixMe: Only Element or Document can be parent nodes. 31128 var parentNode = parentInstance.parentNode; 31129 if (parentNode !== null) warnForInsertedHydratedElement(parentNode, type); 31130 } 31131} 31132function didNotFindHydratableTextInstanceWithinSuspenseInstance(parentInstance, text) { 31133 { 31134 // $FlowFixMe: Only Element or Document can be parent nodes. 31135 var parentNode = parentInstance.parentNode; 31136 if (parentNode !== null) warnForInsertedHydratedText(parentNode, text); 31137 } 31138} 31139function didNotFindHydratableInstance(parentType, parentProps, parentInstance, type, props, isConcurrentMode) { 31140 { 31141 if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { 31142 warnForInsertedHydratedElement(parentInstance, type); 31143 } 31144 } 31145} 31146function didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, text, isConcurrentMode) { 31147 { 31148 if (isConcurrentMode || parentProps[SUPPRESS_HYDRATION_WARNING$1] !== true) { 31149 warnForInsertedHydratedText(parentInstance, text); 31150 } 31151 } 31152} 31153function errorHydratingContainer(parentContainer) { 31154 { 31155 // TODO: This gets logged by onRecoverableError, too, so we should be 31156 // able to remove it. 31157 error('An error occurred during hydration. The server HTML was replaced with client content in <%s>.', parentContainer.nodeName.toLowerCase()); 31158 } 31159} 31160function preparePortalMount(portalInstance) { 31161 listenToAllSupportedEvents(portalInstance); 31162} 31163 31164var randomKey = Math.random().toString(36).slice(2); 31165var internalInstanceKey = '__reactFiber$' + randomKey; 31166var internalPropsKey = '__reactProps$' + randomKey; 31167var internalContainerInstanceKey = '__reactContainer$' + randomKey; 31168var internalEventHandlersKey = '__reactEvents$' + randomKey; 31169var internalEventHandlerListenersKey = '__reactListeners$' + randomKey; 31170var internalEventHandlesSetKey = '__reactHandles$' + randomKey; 31171function detachDeletedInstance(node) { 31172 // TODO: This function is only called on host components. I don't think all of 31173 // these fields are relevant. 31174 delete node[internalInstanceKey]; 31175 delete node[internalPropsKey]; 31176 delete node[internalEventHandlersKey]; 31177 delete node[internalEventHandlerListenersKey]; 31178 delete node[internalEventHandlesSetKey]; 31179} 31180function precacheFiberNode(hostInst, node) { 31181 node[internalInstanceKey] = hostInst; 31182} 31183function markContainerAsRoot(hostRoot, node) { 31184 node[internalContainerInstanceKey] = hostRoot; 31185} 31186function unmarkContainerAsRoot(node) { 31187 node[internalContainerInstanceKey] = null; 31188} 31189function isContainerMarkedAsRoot(node) { 31190 return !!node[internalContainerInstanceKey]; 31191} // Given a DOM node, return the closest HostComponent or HostText fiber ancestor. 31192// If the target node is part of a hydrated or not yet rendered subtree, then 31193// this may also return a SuspenseComponent or HostRoot to indicate that. 31194// Conceptually the HostRoot fiber is a child of the Container node. So if you 31195// pass the Container node as the targetNode, you will not actually get the 31196// HostRoot back. To get to the HostRoot, you need to pass a child of it. 31197// The same thing applies to Suspense boundaries. 31198 31199function getClosestInstanceFromNode(targetNode) { 31200 var targetInst = targetNode[internalInstanceKey]; 31201 31202 if (targetInst) { 31203 // Don't return HostRoot or SuspenseComponent here. 31204 return targetInst; 31205 } // If the direct event target isn't a React owned DOM node, we need to look 31206 // to see if one of its parents is a React owned DOM node. 31207 31208 31209 var parentNode = targetNode.parentNode; 31210 31211 while (parentNode) { 31212 // We'll check if this is a container root that could include 31213 // React nodes in the future. We need to check this first because 31214 // if we're a child of a dehydrated container, we need to first 31215 // find that inner container before moving on to finding the parent 31216 // instance. Note that we don't check this field on the targetNode 31217 // itself because the fibers are conceptually between the container 31218 // node and the first child. It isn't surrounding the container node. 31219 // If it's not a container, we check if it's an instance. 31220 targetInst = parentNode[internalContainerInstanceKey] || parentNode[internalInstanceKey]; 31221 31222 if (targetInst) { 31223 // Since this wasn't the direct target of the event, we might have 31224 // stepped past dehydrated DOM nodes to get here. However they could 31225 // also have been non-React nodes. We need to answer which one. 31226 // If we the instance doesn't have any children, then there can't be 31227 // a nested suspense boundary within it. So we can use this as a fast 31228 // bailout. Most of the time, when people add non-React children to 31229 // the tree, it is using a ref to a child-less DOM node. 31230 // Normally we'd only need to check one of the fibers because if it 31231 // has ever gone from having children to deleting them or vice versa 31232 // it would have deleted the dehydrated boundary nested inside already. 31233 // However, since the HostRoot starts out with an alternate it might 31234 // have one on the alternate so we need to check in case this was a 31235 // root. 31236 var alternate = targetInst.alternate; 31237 31238 if (targetInst.child !== null || alternate !== null && alternate.child !== null) { 31239 // Next we need to figure out if the node that skipped past is 31240 // nested within a dehydrated boundary and if so, which one. 31241 var suspenseInstance = getParentSuspenseInstance(targetNode); 31242 31243 while (suspenseInstance !== null) { 31244 // We found a suspense instance. That means that we haven't 31245 // hydrated it yet. Even though we leave the comments in the 31246 // DOM after hydrating, and there are boundaries in the DOM 31247 // that could already be hydrated, we wouldn't have found them 31248 // through this pass since if the target is hydrated it would 31249 // have had an internalInstanceKey on it. 31250 // Let's get the fiber associated with the SuspenseComponent 31251 // as the deepest instance. 31252 var targetSuspenseInst = suspenseInstance[internalInstanceKey]; 31253 31254 if (targetSuspenseInst) { 31255 return targetSuspenseInst; 31256 } // If we don't find a Fiber on the comment, it might be because 31257 // we haven't gotten to hydrate it yet. There might still be a 31258 // parent boundary that hasn't above this one so we need to find 31259 // the outer most that is known. 31260 31261 31262 suspenseInstance = getParentSuspenseInstance(suspenseInstance); // If we don't find one, then that should mean that the parent 31263 // host component also hasn't hydrated yet. We can return it 31264 // below since it will bail out on the isMounted check later. 31265 } 31266 } 31267 31268 return targetInst; 31269 } 31270 31271 targetNode = parentNode; 31272 parentNode = targetNode.parentNode; 31273 } 31274 31275 return null; 31276} 31277/** 31278 * Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent 31279 * instance, or null if the node was not rendered by this React. 31280 */ 31281 31282function getInstanceFromNode(node) { 31283 var inst = node[internalInstanceKey] || node[internalContainerInstanceKey]; 31284 31285 if (inst) { 31286 if (inst.tag === HostComponent || inst.tag === HostText || inst.tag === SuspenseComponent || inst.tag === HostRoot) { 31287 return inst; 31288 } else { 31289 return null; 31290 } 31291 } 31292 31293 return null; 31294} 31295/** 31296 * Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding 31297 * DOM node. 31298 */ 31299 31300function getNodeFromInstance(inst) { 31301 if (inst.tag === HostComponent || inst.tag === HostText) { 31302 // In Fiber this, is just the state node right now. We assume it will be 31303 // a host component or host text. 31304 return inst.stateNode; 31305 } // Without this first invariant, passing a non-DOM-component triggers the next 31306 // invariant for a missing parent, which is super confusing. 31307 31308 31309 throw new Error('getNodeFromInstance: Invalid argument.'); 31310} 31311function getFiberCurrentPropsFromNode(node) { 31312 return node[internalPropsKey] || null; 31313} 31314function updateFiberProps(node, props) { 31315 node[internalPropsKey] = props; 31316} 31317function getEventListenerSet(node) { 31318 var elementListenerSet = node[internalEventHandlersKey]; 31319 31320 if (elementListenerSet === undefined) { 31321 elementListenerSet = node[internalEventHandlersKey] = new Set(); 31322 } 31323 31324 return elementListenerSet; 31325} 31326 31327var loggedTypeFailures = {}; 31328var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; 31329 31330function setCurrentlyValidatingElement(element) { 31331 { 31332 if (element) { 31333 var owner = element._owner; 31334 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); 31335 ReactDebugCurrentFrame$1.setExtraStackFrame(stack); 31336 } else { 31337 ReactDebugCurrentFrame$1.setExtraStackFrame(null); 31338 } 31339 } 31340} 31341 31342function checkPropTypes(typeSpecs, values, location, componentName, element) { 31343 { 31344 // $FlowFixMe This is okay but Flow doesn't know it. 31345 var has = Function.call.bind(hasOwnProperty); 31346 31347 for (var typeSpecName in typeSpecs) { 31348 if (has(typeSpecs, typeSpecName)) { 31349 var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to 31350 // fail the render phase where it didn't fail before. So we log it. 31351 // After these have been cleaned up, we'll let them throw. 31352 31353 try { 31354 // This is intentionally an invariant that gets caught. It's the same 31355 // behavior as without this statement except with a better message. 31356 if (typeof typeSpecs[typeSpecName] !== 'function') { 31357 // eslint-disable-next-line react-internal/prod-error-codes 31358 var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); 31359 err.name = 'Invariant Violation'; 31360 throw err; 31361 } 31362 31363 error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); 31364 } catch (ex) { 31365 error$1 = ex; 31366 } 31367 31368 if (error$1 && !(error$1 instanceof Error)) { 31369 setCurrentlyValidatingElement(element); 31370 31371 error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); 31372 31373 setCurrentlyValidatingElement(null); 31374 } 31375 31376 if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { 31377 // Only monitor this failure once because there tends to be a lot of the 31378 // same error. 31379 loggedTypeFailures[error$1.message] = true; 31380 setCurrentlyValidatingElement(element); 31381 31382 error('Failed %s type: %s', location, error$1.message); 31383 31384 setCurrentlyValidatingElement(null); 31385 } 31386 } 31387 } 31388 } 31389} 31390 31391var valueStack = []; 31392var fiberStack; 31393 31394{ 31395 fiberStack = []; 31396} 31397 31398var index = -1; 31399 31400function createCursor(defaultValue) { 31401 return { 31402 current: defaultValue 31403 }; 31404} 31405 31406function pop(cursor, fiber) { 31407 if (index < 0) { 31408 { 31409 error('Unexpected pop.'); 31410 } 31411 31412 return; 31413 } 31414 31415 { 31416 if (fiber !== fiberStack[index]) { 31417 error('Unexpected Fiber popped.'); 31418 } 31419 } 31420 31421 cursor.current = valueStack[index]; 31422 valueStack[index] = null; 31423 31424 { 31425 fiberStack[index] = null; 31426 } 31427 31428 index--; 31429} 31430 31431function push(cursor, value, fiber) { 31432 index++; 31433 valueStack[index] = cursor.current; 31434 31435 { 31436 fiberStack[index] = fiber; 31437 } 31438 31439 cursor.current = value; 31440} 31441 31442var warnedAboutMissingGetChildContext; 31443 31444{ 31445 warnedAboutMissingGetChildContext = {}; 31446} 31447 31448var emptyContextObject = {}; 31449 31450{ 31451 Object.freeze(emptyContextObject); 31452} // A cursor to the current merged context object on the stack. 31453 31454 31455var contextStackCursor = createCursor(emptyContextObject); // A cursor to a boolean indicating whether the context has changed. 31456 31457var didPerformWorkStackCursor = createCursor(false); // Keep track of the previous context object that was on the stack. 31458// We use this to get access to the parent context after we have already 31459// pushed the next context provider, and now need to merge their contexts. 31460 31461var previousContext = emptyContextObject; 31462 31463function getUnmaskedContext(workInProgress, Component, didPushOwnContextIfProvider) { 31464 { 31465 if (didPushOwnContextIfProvider && isContextProvider(Component)) { 31466 // If the fiber is a context provider itself, when we read its context 31467 // we may have already pushed its own child context on the stack. A context 31468 // provider should not "see" its own child context. Therefore we read the 31469 // previous (parent) context instead for a context provider. 31470 return previousContext; 31471 } 31472 31473 return contextStackCursor.current; 31474 } 31475} 31476 31477function cacheContext(workInProgress, unmaskedContext, maskedContext) { 31478 { 31479 var instance = workInProgress.stateNode; 31480 instance.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext; 31481 instance.__reactInternalMemoizedMaskedChildContext = maskedContext; 31482 } 31483} 31484 31485function getMaskedContext(workInProgress, unmaskedContext) { 31486 { 31487 var type = workInProgress.type; 31488 var contextTypes = type.contextTypes; 31489 31490 if (!contextTypes) { 31491 return emptyContextObject; 31492 } // Avoid recreating masked context unless unmasked context has changed. 31493 // Failing to do this will result in unnecessary calls to componentWillReceiveProps. 31494 // This may trigger infinite loops if componentWillReceiveProps calls setState. 31495 31496 31497 var instance = workInProgress.stateNode; 31498 31499 if (instance && instance.__reactInternalMemoizedUnmaskedChildContext === unmaskedContext) { 31500 return instance.__reactInternalMemoizedMaskedChildContext; 31501 } 31502 31503 var context = {}; 31504 31505 for (var key in contextTypes) { 31506 context[key] = unmaskedContext[key]; 31507 } 31508 31509 { 31510 var name = getComponentNameFromFiber(workInProgress) || 'Unknown'; 31511 checkPropTypes(contextTypes, context, 'context', name); 31512 } // Cache unmasked context so we can avoid recreating masked context unless necessary. 31513 // Context is created before the class component is instantiated so check for instance. 31514 31515 31516 if (instance) { 31517 cacheContext(workInProgress, unmaskedContext, context); 31518 } 31519 31520 return context; 31521 } 31522} 31523 31524function hasContextChanged() { 31525 { 31526 return didPerformWorkStackCursor.current; 31527 } 31528} 31529 31530function isContextProvider(type) { 31531 { 31532 var childContextTypes = type.childContextTypes; 31533 return childContextTypes !== null && childContextTypes !== undefined; 31534 } 31535} 31536 31537function popContext(fiber) { 31538 { 31539 pop(didPerformWorkStackCursor, fiber); 31540 pop(contextStackCursor, fiber); 31541 } 31542} 31543 31544function popTopLevelContextObject(fiber) { 31545 { 31546 pop(didPerformWorkStackCursor, fiber); 31547 pop(contextStackCursor, fiber); 31548 } 31549} 31550 31551function pushTopLevelContextObject(fiber, context, didChange) { 31552 { 31553 if (contextStackCursor.current !== emptyContextObject) { 31554 throw new Error('Unexpected context found on stack. ' + 'This error is likely caused by a bug in React. Please file an issue.'); 31555 } 31556 31557 push(contextStackCursor, context, fiber); 31558 push(didPerformWorkStackCursor, didChange, fiber); 31559 } 31560} 31561 31562function processChildContext(fiber, type, parentContext) { 31563 { 31564 var instance = fiber.stateNode; 31565 var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. 31566 // It has only been added in Fiber to match the (unintentional) behavior in Stack. 31567 31568 if (typeof instance.getChildContext !== 'function') { 31569 { 31570 var componentName = getComponentNameFromFiber(fiber) || 'Unknown'; 31571 31572 if (!warnedAboutMissingGetChildContext[componentName]) { 31573 warnedAboutMissingGetChildContext[componentName] = true; 31574 31575 error('%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); 31576 } 31577 } 31578 31579 return parentContext; 31580 } 31581 31582 var childContext = instance.getChildContext(); 31583 31584 for (var contextKey in childContext) { 31585 if (!(contextKey in childContextTypes)) { 31586 throw new Error((getComponentNameFromFiber(fiber) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes."); 31587 } 31588 } 31589 31590 { 31591 var name = getComponentNameFromFiber(fiber) || 'Unknown'; 31592 checkPropTypes(childContextTypes, childContext, 'child context', name); 31593 } 31594 31595 return assign({}, parentContext, childContext); 31596 } 31597} 31598 31599function pushContextProvider(workInProgress) { 31600 { 31601 var instance = workInProgress.stateNode; // We push the context as early as possible to ensure stack integrity. 31602 // If the instance does not exist yet, we will push null at first, 31603 // and replace it on the stack later when invalidating the context. 31604 31605 var memoizedMergedChildContext = instance && instance.__reactInternalMemoizedMergedChildContext || emptyContextObject; // Remember the parent context so we can merge with it later. 31606 // Inherit the parent's did-perform-work value to avoid inadvertently blocking updates. 31607 31608 previousContext = contextStackCursor.current; 31609 push(contextStackCursor, memoizedMergedChildContext, workInProgress); 31610 push(didPerformWorkStackCursor, didPerformWorkStackCursor.current, workInProgress); 31611 return true; 31612 } 31613} 31614 31615function invalidateContextProvider(workInProgress, type, didChange) { 31616 { 31617 var instance = workInProgress.stateNode; 31618 31619 if (!instance) { 31620 throw new Error('Expected to have an instance by this point. ' + 'This error is likely caused by a bug in React. Please file an issue.'); 31621 } 31622 31623 if (didChange) { 31624 // Merge parent and own context. 31625 // Skip this if we're not updating due to sCU. 31626 // This avoids unnecessarily recomputing memoized values. 31627 var mergedContext = processChildContext(workInProgress, type, previousContext); 31628 instance.__reactInternalMemoizedMergedChildContext = mergedContext; // Replace the old (or empty) context with the new one. 31629 // It is important to unwind the context in the reverse order. 31630 31631 pop(didPerformWorkStackCursor, workInProgress); 31632 pop(contextStackCursor, workInProgress); // Now push the new context and mark that it has changed. 31633 31634 push(contextStackCursor, mergedContext, workInProgress); 31635 push(didPerformWorkStackCursor, didChange, workInProgress); 31636 } else { 31637 pop(didPerformWorkStackCursor, workInProgress); 31638 push(didPerformWorkStackCursor, didChange, workInProgress); 31639 } 31640 } 31641} 31642 31643function findCurrentUnmaskedContext(fiber) { 31644 { 31645 // Currently this is only used with renderSubtreeIntoContainer; not sure if it 31646 // makes sense elsewhere 31647 if (!isFiberMounted(fiber) || fiber.tag !== ClassComponent) { 31648 throw new Error('Expected subtree parent to be a mounted class component. ' + 'This error is likely caused by a bug in React. Please file an issue.'); 31649 } 31650 31651 var node = fiber; 31652 31653 do { 31654 switch (node.tag) { 31655 case HostRoot: 31656 return node.stateNode.context; 31657 31658 case ClassComponent: 31659 { 31660 var Component = node.type; 31661 31662 if (isContextProvider(Component)) { 31663 return node.stateNode.__reactInternalMemoizedMergedChildContext; 31664 } 31665 31666 break; 31667 } 31668 } 31669 31670 node = node.return; 31671 } while (node !== null); 31672 31673 throw new Error('Found unexpected detached subtree parent. ' + 'This error is likely caused by a bug in React. Please file an issue.'); 31674 } 31675} 31676 31677var LegacyRoot = 0; 31678var ConcurrentRoot = 1; 31679 31680var syncQueue = null; 31681var includesLegacySyncCallbacks = false; 31682var isFlushingSyncQueue = false; 31683function scheduleSyncCallback(callback) { 31684 // Push this callback into an internal queue. We'll flush these either in 31685 // the next tick, or earlier if something calls `flushSyncCallbackQueue`. 31686 if (syncQueue === null) { 31687 syncQueue = [callback]; 31688 } else { 31689 // Push onto existing queue. Don't need to schedule a callback because 31690 // we already scheduled one when we created the queue. 31691 syncQueue.push(callback); 31692 } 31693} 31694function scheduleLegacySyncCallback(callback) { 31695 includesLegacySyncCallbacks = true; 31696 scheduleSyncCallback(callback); 31697} 31698function flushSyncCallbacksOnlyInLegacyMode() { 31699 // Only flushes the queue if there's a legacy sync callback scheduled. 31700 // TODO: There's only a single type of callback: performSyncOnWorkOnRoot. So 31701 // it might make more sense for the queue to be a list of roots instead of a 31702 // list of generic callbacks. Then we can have two: one for legacy roots, one 31703 // for concurrent roots. And this method would only flush the legacy ones. 31704 if (includesLegacySyncCallbacks) { 31705 flushSyncCallbacks(); 31706 } 31707} 31708function flushSyncCallbacks() { 31709 if (!isFlushingSyncQueue && syncQueue !== null) { 31710 // Prevent re-entrance. 31711 isFlushingSyncQueue = true; 31712 var i = 0; 31713 var previousUpdatePriority = getCurrentUpdatePriority(); 31714 31715 try { 31716 var isSync = true; 31717 var queue = syncQueue; // TODO: Is this necessary anymore? The only user code that runs in this 31718 // queue is in the render or commit phases. 31719 31720 setCurrentUpdatePriority(DiscreteEventPriority); 31721 31722 for (; i < queue.length; i++) { 31723 var callback = queue[i]; 31724 31725 do { 31726 callback = callback(isSync); 31727 } while (callback !== null); 31728 } 31729 31730 syncQueue = null; 31731 includesLegacySyncCallbacks = false; 31732 } catch (error) { 31733 // If something throws, leave the remaining callbacks on the queue. 31734 if (syncQueue !== null) { 31735 syncQueue = syncQueue.slice(i + 1); 31736 } // Resume flushing in the next tick 31737 31738 31739 scheduleCallback(ImmediatePriority, flushSyncCallbacks); 31740 throw error; 31741 } finally { 31742 setCurrentUpdatePriority(previousUpdatePriority); 31743 isFlushingSyncQueue = false; 31744 } 31745 } 31746 31747 return null; 31748} 31749 31750// TODO: Use the unified fiber stack module instead of this local one? 31751// Intentionally not using it yet to derisk the initial implementation, because 31752// the way we push/pop these values is a bit unusual. If there's a mistake, I'd 31753// rather the ids be wrong than crash the whole reconciler. 31754var forkStack = []; 31755var forkStackIndex = 0; 31756var treeForkProvider = null; 31757var treeForkCount = 0; 31758var idStack = []; 31759var idStackIndex = 0; 31760var treeContextProvider = null; 31761var treeContextId = 1; 31762var treeContextOverflow = ''; 31763function isForkedChild(workInProgress) { 31764 warnIfNotHydrating(); 31765 return (workInProgress.flags & Forked) !== NoFlags; 31766} 31767function getForksAtLevel(workInProgress) { 31768 warnIfNotHydrating(); 31769 return treeForkCount; 31770} 31771function getTreeId() { 31772 var overflow = treeContextOverflow; 31773 var idWithLeadingBit = treeContextId; 31774 var id = idWithLeadingBit & ~getLeadingBit(idWithLeadingBit); 31775 return id.toString(32) + overflow; 31776} 31777function pushTreeFork(workInProgress, totalChildren) { 31778 // This is called right after we reconcile an array (or iterator) of child 31779 // fibers, because that's the only place where we know how many children in 31780 // the whole set without doing extra work later, or storing addtional 31781 // information on the fiber. 31782 // 31783 // That's why this function is separate from pushTreeId â it's called during 31784 // the render phase of the fork parent, not the child, which is where we push 31785 // the other context values. 31786 // 31787 // In the Fizz implementation this is much simpler because the child is 31788 // rendered in the same callstack as the parent. 31789 // 31790 // It might be better to just add a `forks` field to the Fiber type. It would 31791 // make this module simpler. 31792 warnIfNotHydrating(); 31793 forkStack[forkStackIndex++] = treeForkCount; 31794 forkStack[forkStackIndex++] = treeForkProvider; 31795 treeForkProvider = workInProgress; 31796 treeForkCount = totalChildren; 31797} 31798function pushTreeId(workInProgress, totalChildren, index) { 31799 warnIfNotHydrating(); 31800 idStack[idStackIndex++] = treeContextId; 31801 idStack[idStackIndex++] = treeContextOverflow; 31802 idStack[idStackIndex++] = treeContextProvider; 31803 treeContextProvider = workInProgress; 31804 var baseIdWithLeadingBit = treeContextId; 31805 var baseOverflow = treeContextOverflow; // The leftmost 1 marks the end of the sequence, non-inclusive. It's not part 31806 // of the id; we use it to account for leading 0s. 31807 31808 var baseLength = getBitLength(baseIdWithLeadingBit) - 1; 31809 var baseId = baseIdWithLeadingBit & ~(1 << baseLength); 31810 var slot = index + 1; 31811 var length = getBitLength(totalChildren) + baseLength; // 30 is the max length we can store without overflowing, taking into 31812 // consideration the leading 1 we use to mark the end of the sequence. 31813 31814 if (length > 30) { 31815 // We overflowed the bitwise-safe range. Fall back to slower algorithm. 31816 // This branch assumes the length of the base id is greater than 5; it won't 31817 // work for smaller ids, because you need 5 bits per character. 31818 // 31819 // We encode the id in multiple steps: first the base id, then the 31820 // remaining digits. 31821 // 31822 // Each 5 bit sequence corresponds to a single base 32 character. So for 31823 // example, if the current id is 23 bits long, we can convert 20 of those 31824 // bits into a string of 4 characters, with 3 bits left over. 31825 // 31826 // First calculate how many bits in the base id represent a complete 31827 // sequence of characters. 31828 var numberOfOverflowBits = baseLength - baseLength % 5; // Then create a bitmask that selects only those bits. 31829 31830 var newOverflowBits = (1 << numberOfOverflowBits) - 1; // Select the bits, and convert them to a base 32 string. 31831 31832 var newOverflow = (baseId & newOverflowBits).toString(32); // Now we can remove those bits from the base id. 31833 31834 var restOfBaseId = baseId >> numberOfOverflowBits; 31835 var restOfBaseLength = baseLength - numberOfOverflowBits; // Finally, encode the rest of the bits using the normal algorithm. Because 31836 // we made more room, this time it won't overflow. 31837 31838 var restOfLength = getBitLength(totalChildren) + restOfBaseLength; 31839 var restOfNewBits = slot << restOfBaseLength; 31840 var id = restOfNewBits | restOfBaseId; 31841 var overflow = newOverflow + baseOverflow; 31842 treeContextId = 1 << restOfLength | id; 31843 treeContextOverflow = overflow; 31844 } else { 31845 // Normal path 31846 var newBits = slot << baseLength; 31847 31848 var _id = newBits | baseId; 31849 31850 var _overflow = baseOverflow; 31851 treeContextId = 1 << length | _id; 31852 treeContextOverflow = _overflow; 31853 } 31854} 31855function pushMaterializedTreeId(workInProgress) { 31856 warnIfNotHydrating(); // This component materialized an id. This will affect any ids that appear 31857 // in its children. 31858 31859 var returnFiber = workInProgress.return; 31860 31861 if (returnFiber !== null) { 31862 var numberOfForks = 1; 31863 var slotIndex = 0; 31864 pushTreeFork(workInProgress, numberOfForks); 31865 pushTreeId(workInProgress, numberOfForks, slotIndex); 31866 } 31867} 31868 31869function getBitLength(number) { 31870 return 32 - clz32(number); 31871} 31872 31873function getLeadingBit(id) { 31874 return 1 << getBitLength(id) - 1; 31875} 31876 31877function popTreeContext(workInProgress) { 31878 // Restore the previous values. 31879 // This is a bit more complicated than other context-like modules in Fiber 31880 // because the same Fiber may appear on the stack multiple times and for 31881 // different reasons. We have to keep popping until the work-in-progress is 31882 // no longer at the top of the stack. 31883 while (workInProgress === treeForkProvider) { 31884 treeForkProvider = forkStack[--forkStackIndex]; 31885 forkStack[forkStackIndex] = null; 31886 treeForkCount = forkStack[--forkStackIndex]; 31887 forkStack[forkStackIndex] = null; 31888 } 31889 31890 while (workInProgress === treeContextProvider) { 31891 treeContextProvider = idStack[--idStackIndex]; 31892 idStack[idStackIndex] = null; 31893 treeContextOverflow = idStack[--idStackIndex]; 31894 idStack[idStackIndex] = null; 31895 treeContextId = idStack[--idStackIndex]; 31896 idStack[idStackIndex] = null; 31897 } 31898} 31899function getSuspendedTreeContext() { 31900 warnIfNotHydrating(); 31901 31902 if (treeContextProvider !== null) { 31903 return { 31904 id: treeContextId, 31905 overflow: treeContextOverflow 31906 }; 31907 } else { 31908 return null; 31909 } 31910} 31911function restoreSuspendedTreeContext(workInProgress, suspendedContext) { 31912 warnIfNotHydrating(); 31913 idStack[idStackIndex++] = treeContextId; 31914 idStack[idStackIndex++] = treeContextOverflow; 31915 idStack[idStackIndex++] = treeContextProvider; 31916 treeContextId = suspendedContext.id; 31917 treeContextOverflow = suspendedContext.overflow; 31918 treeContextProvider = workInProgress; 31919} 31920 31921function warnIfNotHydrating() { 31922 { 31923 if (!getIsHydrating()) { 31924 error('Expected to be hydrating. This is a bug in React. Please file ' + 'an issue.'); 31925 } 31926 } 31927} 31928 31929// This may have been an insertion or a hydration. 31930 31931var hydrationParentFiber = null; 31932var nextHydratableInstance = null; 31933var isHydrating = false; // This flag allows for warning supression when we expect there to be mismatches 31934// due to earlier mismatches or a suspended fiber. 31935 31936var didSuspendOrErrorDEV = false; // Hydration errors that were thrown inside this boundary 31937 31938var hydrationErrors = null; 31939 31940function warnIfHydrating() { 31941 { 31942 if (isHydrating) { 31943 error('We should not be hydrating here. This is a bug in React. Please file a bug.'); 31944 } 31945 } 31946} 31947 31948function markDidThrowWhileHydratingDEV() { 31949 { 31950 didSuspendOrErrorDEV = true; 31951 } 31952} 31953function didSuspendOrErrorWhileHydratingDEV() { 31954 { 31955 return didSuspendOrErrorDEV; 31956 } 31957} 31958 31959function enterHydrationState(fiber) { 31960 31961 var parentInstance = fiber.stateNode.containerInfo; 31962 nextHydratableInstance = getFirstHydratableChildWithinContainer(parentInstance); 31963 hydrationParentFiber = fiber; 31964 isHydrating = true; 31965 hydrationErrors = null; 31966 didSuspendOrErrorDEV = false; 31967 return true; 31968} 31969 31970function reenterHydrationStateFromDehydratedSuspenseInstance(fiber, suspenseInstance, treeContext) { 31971 31972 nextHydratableInstance = getFirstHydratableChildWithinSuspenseInstance(suspenseInstance); 31973 hydrationParentFiber = fiber; 31974 isHydrating = true; 31975 hydrationErrors = null; 31976 didSuspendOrErrorDEV = false; 31977 31978 if (treeContext !== null) { 31979 restoreSuspendedTreeContext(fiber, treeContext); 31980 } 31981 31982 return true; 31983} 31984 31985function warnUnhydratedInstance(returnFiber, instance) { 31986 { 31987 switch (returnFiber.tag) { 31988 case HostRoot: 31989 { 31990 didNotHydrateInstanceWithinContainer(returnFiber.stateNode.containerInfo, instance); 31991 break; 31992 } 31993 31994 case HostComponent: 31995 { 31996 var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode; 31997 didNotHydrateInstance(returnFiber.type, returnFiber.memoizedProps, returnFiber.stateNode, instance, // TODO: Delete this argument when we remove the legacy root API. 31998 isConcurrentMode); 31999 break; 32000 } 32001 32002 case SuspenseComponent: 32003 { 32004 var suspenseState = returnFiber.memoizedState; 32005 if (suspenseState.dehydrated !== null) didNotHydrateInstanceWithinSuspenseInstance(suspenseState.dehydrated, instance); 32006 break; 32007 } 32008 } 32009 } 32010} 32011 32012function deleteHydratableInstance(returnFiber, instance) { 32013 warnUnhydratedInstance(returnFiber, instance); 32014 var childToDelete = createFiberFromHostInstanceForDeletion(); 32015 childToDelete.stateNode = instance; 32016 childToDelete.return = returnFiber; 32017 var deletions = returnFiber.deletions; 32018 32019 if (deletions === null) { 32020 returnFiber.deletions = [childToDelete]; 32021 returnFiber.flags |= ChildDeletion; 32022 } else { 32023 deletions.push(childToDelete); 32024 } 32025} 32026 32027function warnNonhydratedInstance(returnFiber, fiber) { 32028 { 32029 if (didSuspendOrErrorDEV) { 32030 // Inside a boundary that already suspended. We're currently rendering the 32031 // siblings of a suspended node. The mismatch may be due to the missing 32032 // data, so it's probably a false positive. 32033 return; 32034 } 32035 32036 switch (returnFiber.tag) { 32037 case HostRoot: 32038 { 32039 var parentContainer = returnFiber.stateNode.containerInfo; 32040 32041 switch (fiber.tag) { 32042 case HostComponent: 32043 var type = fiber.type; 32044 var props = fiber.pendingProps; 32045 didNotFindHydratableInstanceWithinContainer(parentContainer, type); 32046 break; 32047 32048 case HostText: 32049 var text = fiber.pendingProps; 32050 didNotFindHydratableTextInstanceWithinContainer(parentContainer, text); 32051 break; 32052 } 32053 32054 break; 32055 } 32056 32057 case HostComponent: 32058 { 32059 var parentType = returnFiber.type; 32060 var parentProps = returnFiber.memoizedProps; 32061 var parentInstance = returnFiber.stateNode; 32062 32063 switch (fiber.tag) { 32064 case HostComponent: 32065 { 32066 var _type = fiber.type; 32067 var _props = fiber.pendingProps; 32068 var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode; 32069 didNotFindHydratableInstance(parentType, parentProps, parentInstance, _type, _props, // TODO: Delete this argument when we remove the legacy root API. 32070 isConcurrentMode); 32071 break; 32072 } 32073 32074 case HostText: 32075 { 32076 var _text = fiber.pendingProps; 32077 32078 var _isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode; 32079 32080 didNotFindHydratableTextInstance(parentType, parentProps, parentInstance, _text, // TODO: Delete this argument when we remove the legacy root API. 32081 _isConcurrentMode); 32082 break; 32083 } 32084 } 32085 32086 break; 32087 } 32088 32089 case SuspenseComponent: 32090 { 32091 var suspenseState = returnFiber.memoizedState; 32092 var _parentInstance = suspenseState.dehydrated; 32093 if (_parentInstance !== null) switch (fiber.tag) { 32094 case HostComponent: 32095 var _type2 = fiber.type; 32096 var _props2 = fiber.pendingProps; 32097 didNotFindHydratableInstanceWithinSuspenseInstance(_parentInstance, _type2); 32098 break; 32099 32100 case HostText: 32101 var _text2 = fiber.pendingProps; 32102 didNotFindHydratableTextInstanceWithinSuspenseInstance(_parentInstance, _text2); 32103 break; 32104 } 32105 break; 32106 } 32107 32108 default: 32109 return; 32110 } 32111 } 32112} 32113 32114function insertNonHydratedInstance(returnFiber, fiber) { 32115 fiber.flags = fiber.flags & ~Hydrating | Placement; 32116 warnNonhydratedInstance(returnFiber, fiber); 32117} 32118 32119function tryHydrate(fiber, nextInstance) { 32120 switch (fiber.tag) { 32121 case HostComponent: 32122 { 32123 var type = fiber.type; 32124 var props = fiber.pendingProps; 32125 var instance = canHydrateInstance(nextInstance, type); 32126 32127 if (instance !== null) { 32128 fiber.stateNode = instance; 32129 hydrationParentFiber = fiber; 32130 nextHydratableInstance = getFirstHydratableChild(instance); 32131 return true; 32132 } 32133 32134 return false; 32135 } 32136 32137 case HostText: 32138 { 32139 var text = fiber.pendingProps; 32140 var textInstance = canHydrateTextInstance(nextInstance, text); 32141 32142 if (textInstance !== null) { 32143 fiber.stateNode = textInstance; 32144 hydrationParentFiber = fiber; // Text Instances don't have children so there's nothing to hydrate. 32145 32146 nextHydratableInstance = null; 32147 return true; 32148 } 32149 32150 return false; 32151 } 32152 32153 case SuspenseComponent: 32154 { 32155 var suspenseInstance = canHydrateSuspenseInstance(nextInstance); 32156 32157 if (suspenseInstance !== null) { 32158 var suspenseState = { 32159 dehydrated: suspenseInstance, 32160 treeContext: getSuspendedTreeContext(), 32161 retryLane: OffscreenLane 32162 }; 32163 fiber.memoizedState = suspenseState; // Store the dehydrated fragment as a child fiber. 32164 // This simplifies the code for getHostSibling and deleting nodes, 32165 // since it doesn't have to consider all Suspense boundaries and 32166 // check if they're dehydrated ones or not. 32167 32168 var dehydratedFragment = createFiberFromDehydratedFragment(suspenseInstance); 32169 dehydratedFragment.return = fiber; 32170 fiber.child = dehydratedFragment; 32171 hydrationParentFiber = fiber; // While a Suspense Instance does have children, we won't step into 32172 // it during the first pass. Instead, we'll reenter it later. 32173 32174 nextHydratableInstance = null; 32175 return true; 32176 } 32177 32178 return false; 32179 } 32180 32181 default: 32182 return false; 32183 } 32184} 32185 32186function shouldClientRenderOnMismatch(fiber) { 32187 return (fiber.mode & ConcurrentMode) !== NoMode && (fiber.flags & DidCapture) === NoFlags; 32188} 32189 32190function throwOnHydrationMismatch(fiber) { 32191 throw new Error('Hydration failed because the initial UI does not match what was ' + 'rendered on the server.'); 32192} 32193 32194function tryToClaimNextHydratableInstance(fiber) { 32195 if (!isHydrating) { 32196 return; 32197 } 32198 32199 var nextInstance = nextHydratableInstance; 32200 32201 if (!nextInstance) { 32202 if (shouldClientRenderOnMismatch(fiber)) { 32203 warnNonhydratedInstance(hydrationParentFiber, fiber); 32204 throwOnHydrationMismatch(); 32205 } // Nothing to hydrate. Make it an insertion. 32206 32207 32208 insertNonHydratedInstance(hydrationParentFiber, fiber); 32209 isHydrating = false; 32210 hydrationParentFiber = fiber; 32211 return; 32212 } 32213 32214 var firstAttemptedInstance = nextInstance; 32215 32216 if (!tryHydrate(fiber, nextInstance)) { 32217 if (shouldClientRenderOnMismatch(fiber)) { 32218 warnNonhydratedInstance(hydrationParentFiber, fiber); 32219 throwOnHydrationMismatch(); 32220 } // If we can't hydrate this instance let's try the next one. 32221 // We use this as a heuristic. It's based on intuition and not data so it 32222 // might be flawed or unnecessary. 32223 32224 32225 nextInstance = getNextHydratableSibling(firstAttemptedInstance); 32226 var prevHydrationParentFiber = hydrationParentFiber; 32227 32228 if (!nextInstance || !tryHydrate(fiber, nextInstance)) { 32229 // Nothing to hydrate. Make it an insertion. 32230 insertNonHydratedInstance(hydrationParentFiber, fiber); 32231 isHydrating = false; 32232 hydrationParentFiber = fiber; 32233 return; 32234 } // We matched the next one, we'll now assume that the first one was 32235 // superfluous and we'll delete it. Since we can't eagerly delete it 32236 // we'll have to schedule a deletion. To do that, this node needs a dummy 32237 // fiber associated with it. 32238 32239 32240 deleteHydratableInstance(prevHydrationParentFiber, firstAttemptedInstance); 32241 } 32242} 32243 32244function prepareToHydrateHostInstance(fiber, rootContainerInstance, hostContext) { 32245 32246 var instance = fiber.stateNode; 32247 var shouldWarnIfMismatchDev = !didSuspendOrErrorDEV; 32248 var updatePayload = hydrateInstance(instance, fiber.type, fiber.memoizedProps, rootContainerInstance, hostContext, fiber, shouldWarnIfMismatchDev); // TODO: Type this specific to this type of component. 32249 32250 fiber.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there 32251 // is a new ref we mark this as an update. 32252 32253 if (updatePayload !== null) { 32254 return true; 32255 } 32256 32257 return false; 32258} 32259 32260function prepareToHydrateHostTextInstance(fiber) { 32261 32262 var textInstance = fiber.stateNode; 32263 var textContent = fiber.memoizedProps; 32264 var shouldUpdate = hydrateTextInstance(textInstance, textContent, fiber); 32265 32266 if (shouldUpdate) { 32267 // We assume that prepareToHydrateHostTextInstance is called in a context where the 32268 // hydration parent is the parent host component of this host text. 32269 var returnFiber = hydrationParentFiber; 32270 32271 if (returnFiber !== null) { 32272 switch (returnFiber.tag) { 32273 case HostRoot: 32274 { 32275 var parentContainer = returnFiber.stateNode.containerInfo; 32276 var isConcurrentMode = (returnFiber.mode & ConcurrentMode) !== NoMode; 32277 didNotMatchHydratedContainerTextInstance(parentContainer, textInstance, textContent, // TODO: Delete this argument when we remove the legacy root API. 32278 isConcurrentMode); 32279 break; 32280 } 32281 32282 case HostComponent: 32283 { 32284 var parentType = returnFiber.type; 32285 var parentProps = returnFiber.memoizedProps; 32286 var parentInstance = returnFiber.stateNode; 32287 32288 var _isConcurrentMode2 = (returnFiber.mode & ConcurrentMode) !== NoMode; 32289 32290 didNotMatchHydratedTextInstance(parentType, parentProps, parentInstance, textInstance, textContent, // TODO: Delete this argument when we remove the legacy root API. 32291 _isConcurrentMode2); 32292 break; 32293 } 32294 } 32295 } 32296 } 32297 32298 return shouldUpdate; 32299} 32300 32301function prepareToHydrateHostSuspenseInstance(fiber) { 32302 32303 var suspenseState = fiber.memoizedState; 32304 var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null; 32305 32306 if (!suspenseInstance) { 32307 throw new Error('Expected to have a hydrated suspense instance. ' + 'This error is likely caused by a bug in React. Please file an issue.'); 32308 } 32309 32310 hydrateSuspenseInstance(suspenseInstance, fiber); 32311} 32312 32313function skipPastDehydratedSuspenseInstance(fiber) { 32314 32315 var suspenseState = fiber.memoizedState; 32316 var suspenseInstance = suspenseState !== null ? suspenseState.dehydrated : null; 32317 32318 if (!suspenseInstance) { 32319 throw new Error('Expected to have a hydrated suspense instance. ' + 'This error is likely caused by a bug in React. Please file an issue.'); 32320 } 32321 32322 return getNextHydratableInstanceAfterSuspenseInstance(suspenseInstance); 32323} 32324 32325function popToNextHostParent(fiber) { 32326 var parent = fiber.return; 32327 32328 while (parent !== null && parent.tag !== HostComponent && parent.tag !== HostRoot && parent.tag !== SuspenseComponent) { 32329 parent = parent.return; 32330 } 32331 32332 hydrationParentFiber = parent; 32333} 32334 32335function popHydrationState(fiber) { 32336 32337 if (fiber !== hydrationParentFiber) { 32338 // We're deeper than the current hydration context, inside an inserted 32339 // tree. 32340 return false; 32341 } 32342 32343 if (!isHydrating) { 32344 // If we're not currently hydrating but we're in a hydration context, then 32345 // we were an insertion and now need to pop up reenter hydration of our 32346 // siblings. 32347 popToNextHostParent(fiber); 32348 isHydrating = true; 32349 return false; 32350 } // If we have any remaining hydratable nodes, we need to delete them now. 32351 // We only do this deeper than head and body since they tend to have random 32352 // other nodes in them. We also ignore components with pure text content in 32353 // side of them. We also don't delete anything inside the root container. 32354 32355 32356 if (fiber.tag !== HostRoot && (fiber.tag !== HostComponent || shouldDeleteUnhydratedTailInstances(fiber.type) && !shouldSetTextContent(fiber.type, fiber.memoizedProps))) { 32357 var nextInstance = nextHydratableInstance; 32358 32359 if (nextInstance) { 32360 if (shouldClientRenderOnMismatch(fiber)) { 32361 warnIfUnhydratedTailNodes(fiber); 32362 throwOnHydrationMismatch(); 32363 } else { 32364 while (nextInstance) { 32365 deleteHydratableInstance(fiber, nextInstance); 32366 nextInstance = getNextHydratableSibling(nextInstance); 32367 } 32368 } 32369 } 32370 } 32371 32372 popToNextHostParent(fiber); 32373 32374 if (fiber.tag === SuspenseComponent) { 32375 nextHydratableInstance = skipPastDehydratedSuspenseInstance(fiber); 32376 } else { 32377 nextHydratableInstance = hydrationParentFiber ? getNextHydratableSibling(fiber.stateNode) : null; 32378 } 32379 32380 return true; 32381} 32382 32383function hasUnhydratedTailNodes() { 32384 return isHydrating && nextHydratableInstance !== null; 32385} 32386 32387function warnIfUnhydratedTailNodes(fiber) { 32388 var nextInstance = nextHydratableInstance; 32389 32390 while (nextInstance) { 32391 warnUnhydratedInstance(fiber, nextInstance); 32392 nextInstance = getNextHydratableSibling(nextInstance); 32393 } 32394} 32395 32396function resetHydrationState() { 32397 32398 hydrationParentFiber = null; 32399 nextHydratableInstance = null; 32400 isHydrating = false; 32401 didSuspendOrErrorDEV = false; 32402} 32403 32404function upgradeHydrationErrorsToRecoverable() { 32405 if (hydrationErrors !== null) { 32406 // Successfully completed a forced client render. The errors that occurred 32407 // during the hydration attempt are now recovered. We will log them in 32408 // commit phase, once the entire tree has finished. 32409 queueRecoverableErrors(hydrationErrors); 32410 hydrationErrors = null; 32411 } 32412} 32413 32414function getIsHydrating() { 32415 return isHydrating; 32416} 32417 32418function queueHydrationError(error) { 32419 if (hydrationErrors === null) { 32420 hydrationErrors = [error]; 32421 } else { 32422 hydrationErrors.push(error); 32423 } 32424} 32425 32426var ReactCurrentBatchConfig$1 = ReactSharedInternals.ReactCurrentBatchConfig; 32427var NoTransition = null; 32428function requestCurrentTransition() { 32429 return ReactCurrentBatchConfig$1.transition; 32430} 32431 32432var ReactStrictModeWarnings = { 32433 recordUnsafeLifecycleWarnings: function (fiber, instance) {}, 32434 flushPendingUnsafeLifecycleWarnings: function () {}, 32435 recordLegacyContextWarning: function (fiber, instance) {}, 32436 flushLegacyContextWarning: function () {}, 32437 discardPendingWarnings: function () {} 32438}; 32439 32440{ 32441 var findStrictRoot = function (fiber) { 32442 var maybeStrictRoot = null; 32443 var node = fiber; 32444 32445 while (node !== null) { 32446 if (node.mode & StrictLegacyMode) { 32447 maybeStrictRoot = node; 32448 } 32449 32450 node = node.return; 32451 } 32452 32453 return maybeStrictRoot; 32454 }; 32455 32456 var setToSortedString = function (set) { 32457 var array = []; 32458 set.forEach(function (value) { 32459 array.push(value); 32460 }); 32461 return array.sort().join(', '); 32462 }; 32463 32464 var pendingComponentWillMountWarnings = []; 32465 var pendingUNSAFE_ComponentWillMountWarnings = []; 32466 var pendingComponentWillReceivePropsWarnings = []; 32467 var pendingUNSAFE_ComponentWillReceivePropsWarnings = []; 32468 var pendingComponentWillUpdateWarnings = []; 32469 var pendingUNSAFE_ComponentWillUpdateWarnings = []; // Tracks components we have already warned about. 32470 32471 var didWarnAboutUnsafeLifecycles = new Set(); 32472 32473 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings = function (fiber, instance) { 32474 // Dedupe strategy: Warn once per component. 32475 if (didWarnAboutUnsafeLifecycles.has(fiber.type)) { 32476 return; 32477 } 32478 32479 if (typeof instance.componentWillMount === 'function' && // Don't warn about react-lifecycles-compat polyfilled components. 32480 instance.componentWillMount.__suppressDeprecationWarning !== true) { 32481 pendingComponentWillMountWarnings.push(fiber); 32482 } 32483 32484 if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillMount === 'function') { 32485 pendingUNSAFE_ComponentWillMountWarnings.push(fiber); 32486 } 32487 32488 if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { 32489 pendingComponentWillReceivePropsWarnings.push(fiber); 32490 } 32491 32492 if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillReceiveProps === 'function') { 32493 pendingUNSAFE_ComponentWillReceivePropsWarnings.push(fiber); 32494 } 32495 32496 if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { 32497 pendingComponentWillUpdateWarnings.push(fiber); 32498 } 32499 32500 if (fiber.mode & StrictLegacyMode && typeof instance.UNSAFE_componentWillUpdate === 'function') { 32501 pendingUNSAFE_ComponentWillUpdateWarnings.push(fiber); 32502 } 32503 }; 32504 32505 ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings = function () { 32506 // We do an initial pass to gather component names 32507 var componentWillMountUniqueNames = new Set(); 32508 32509 if (pendingComponentWillMountWarnings.length > 0) { 32510 pendingComponentWillMountWarnings.forEach(function (fiber) { 32511 componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); 32512 didWarnAboutUnsafeLifecycles.add(fiber.type); 32513 }); 32514 pendingComponentWillMountWarnings = []; 32515 } 32516 32517 var UNSAFE_componentWillMountUniqueNames = new Set(); 32518 32519 if (pendingUNSAFE_ComponentWillMountWarnings.length > 0) { 32520 pendingUNSAFE_ComponentWillMountWarnings.forEach(function (fiber) { 32521 UNSAFE_componentWillMountUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); 32522 didWarnAboutUnsafeLifecycles.add(fiber.type); 32523 }); 32524 pendingUNSAFE_ComponentWillMountWarnings = []; 32525 } 32526 32527 var componentWillReceivePropsUniqueNames = new Set(); 32528 32529 if (pendingComponentWillReceivePropsWarnings.length > 0) { 32530 pendingComponentWillReceivePropsWarnings.forEach(function (fiber) { 32531 componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); 32532 didWarnAboutUnsafeLifecycles.add(fiber.type); 32533 }); 32534 pendingComponentWillReceivePropsWarnings = []; 32535 } 32536 32537 var UNSAFE_componentWillReceivePropsUniqueNames = new Set(); 32538 32539 if (pendingUNSAFE_ComponentWillReceivePropsWarnings.length > 0) { 32540 pendingUNSAFE_ComponentWillReceivePropsWarnings.forEach(function (fiber) { 32541 UNSAFE_componentWillReceivePropsUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); 32542 didWarnAboutUnsafeLifecycles.add(fiber.type); 32543 }); 32544 pendingUNSAFE_ComponentWillReceivePropsWarnings = []; 32545 } 32546 32547 var componentWillUpdateUniqueNames = new Set(); 32548 32549 if (pendingComponentWillUpdateWarnings.length > 0) { 32550 pendingComponentWillUpdateWarnings.forEach(function (fiber) { 32551 componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); 32552 didWarnAboutUnsafeLifecycles.add(fiber.type); 32553 }); 32554 pendingComponentWillUpdateWarnings = []; 32555 } 32556 32557 var UNSAFE_componentWillUpdateUniqueNames = new Set(); 32558 32559 if (pendingUNSAFE_ComponentWillUpdateWarnings.length > 0) { 32560 pendingUNSAFE_ComponentWillUpdateWarnings.forEach(function (fiber) { 32561 UNSAFE_componentWillUpdateUniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); 32562 didWarnAboutUnsafeLifecycles.add(fiber.type); 32563 }); 32564 pendingUNSAFE_ComponentWillUpdateWarnings = []; 32565 } // Finally, we flush all the warnings 32566 // UNSAFE_ ones before the deprecated ones, since they'll be 'louder' 32567 32568 32569 if (UNSAFE_componentWillMountUniqueNames.size > 0) { 32570 var sortedNames = setToSortedString(UNSAFE_componentWillMountUniqueNames); 32571 32572 error('Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '\nPlease update the following components: %s', sortedNames); 32573 } 32574 32575 if (UNSAFE_componentWillReceivePropsUniqueNames.size > 0) { 32576 var _sortedNames = setToSortedString(UNSAFE_componentWillReceivePropsUniqueNames); 32577 32578 error('Using UNSAFE_componentWillReceiveProps in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, " + 'refactor your code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n' + '\nPlease update the following components: %s', _sortedNames); 32579 } 32580 32581 if (UNSAFE_componentWillUpdateUniqueNames.size > 0) { 32582 var _sortedNames2 = setToSortedString(UNSAFE_componentWillUpdateUniqueNames); 32583 32584 error('Using UNSAFE_componentWillUpdate in strict mode is not recommended ' + 'and may indicate bugs in your code. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '\nPlease update the following components: %s', _sortedNames2); 32585 } 32586 32587 if (componentWillMountUniqueNames.size > 0) { 32588 var _sortedNames3 = setToSortedString(componentWillMountUniqueNames); 32589 32590 warn('componentWillMount has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move code with side effects to componentDidMount, and set initial state in the constructor.\n' + '* Rename componentWillMount to UNSAFE_componentWillMount to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames3); 32591 } 32592 32593 if (componentWillReceivePropsUniqueNames.size > 0) { 32594 var _sortedNames4 = setToSortedString(componentWillReceivePropsUniqueNames); 32595 32596 warn('componentWillReceiveProps has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + "* If you're updating state whenever props change, refactor your " + 'code to use memoization techniques or move it to ' + 'static getDerivedStateFromProps. Learn more at: https://reactjs.org/link/derived-state\n' + '* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames4); 32597 } 32598 32599 if (componentWillUpdateUniqueNames.size > 0) { 32600 var _sortedNames5 = setToSortedString(componentWillUpdateUniqueNames); 32601 32602 warn('componentWillUpdate has been renamed, and is not recommended for use. ' + 'See https://reactjs.org/link/unsafe-component-lifecycles for details.\n\n' + '* Move data fetching code or side effects to componentDidUpdate.\n' + '* Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress ' + 'this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. ' + 'To rename all deprecated lifecycles to their new names, you can run ' + '`npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n' + '\nPlease update the following components: %s', _sortedNames5); 32603 } 32604 }; 32605 32606 var pendingLegacyContextWarning = new Map(); // Tracks components we have already warned about. 32607 32608 var didWarnAboutLegacyContext = new Set(); 32609 32610 ReactStrictModeWarnings.recordLegacyContextWarning = function (fiber, instance) { 32611 var strictRoot = findStrictRoot(fiber); 32612 32613 if (strictRoot === null) { 32614 error('Expected to find a StrictMode component in a strict mode tree. ' + 'This error is likely caused by a bug in React. Please file an issue.'); 32615 32616 return; 32617 } // Dedup strategy: Warn once per component. 32618 32619 32620 if (didWarnAboutLegacyContext.has(fiber.type)) { 32621 return; 32622 } 32623 32624 var warningsForRoot = pendingLegacyContextWarning.get(strictRoot); 32625 32626 if (fiber.type.contextTypes != null || fiber.type.childContextTypes != null || instance !== null && typeof instance.getChildContext === 'function') { 32627 if (warningsForRoot === undefined) { 32628 warningsForRoot = []; 32629 pendingLegacyContextWarning.set(strictRoot, warningsForRoot); 32630 } 32631 32632 warningsForRoot.push(fiber); 32633 } 32634 }; 32635 32636 ReactStrictModeWarnings.flushLegacyContextWarning = function () { 32637 pendingLegacyContextWarning.forEach(function (fiberArray, strictRoot) { 32638 if (fiberArray.length === 0) { 32639 return; 32640 } 32641 32642 var firstFiber = fiberArray[0]; 32643 var uniqueNames = new Set(); 32644 fiberArray.forEach(function (fiber) { 32645 uniqueNames.add(getComponentNameFromFiber(fiber) || 'Component'); 32646 didWarnAboutLegacyContext.add(fiber.type); 32647 }); 32648 var sortedNames = setToSortedString(uniqueNames); 32649 32650 try { 32651 setCurrentFiber(firstFiber); 32652 32653 error('Legacy context API has been detected within a strict-mode tree.' + '\n\nThe old API will be supported in all 16.x releases, but applications ' + 'using it should migrate to the new version.' + '\n\nPlease update the following components: %s' + '\n\nLearn more about this warning here: https://reactjs.org/link/legacy-context', sortedNames); 32654 } finally { 32655 resetCurrentFiber(); 32656 } 32657 }); 32658 }; 32659 32660 ReactStrictModeWarnings.discardPendingWarnings = function () { 32661 pendingComponentWillMountWarnings = []; 32662 pendingUNSAFE_ComponentWillMountWarnings = []; 32663 pendingComponentWillReceivePropsWarnings = []; 32664 pendingUNSAFE_ComponentWillReceivePropsWarnings = []; 32665 pendingComponentWillUpdateWarnings = []; 32666 pendingUNSAFE_ComponentWillUpdateWarnings = []; 32667 pendingLegacyContextWarning = new Map(); 32668 }; 32669} 32670 32671var didWarnAboutMaps; 32672var didWarnAboutGenerators; 32673var didWarnAboutStringRefs; 32674var ownerHasKeyUseWarning; 32675var ownerHasFunctionTypeWarning; 32676 32677var warnForMissingKey = function (child, returnFiber) {}; 32678 32679{ 32680 didWarnAboutMaps = false; 32681 didWarnAboutGenerators = false; 32682 didWarnAboutStringRefs = {}; 32683 /** 32684 * Warn if there's no key explicitly set on dynamic arrays of children or 32685 * object keys are not valid. This allows us to keep track of children between 32686 * updates. 32687 */ 32688 32689 ownerHasKeyUseWarning = {}; 32690 ownerHasFunctionTypeWarning = {}; 32691 32692 warnForMissingKey = function (child, returnFiber) { 32693 if (child === null || typeof child !== 'object') { 32694 return; 32695 } 32696 32697 if (!child._store || child._store.validated || child.key != null) { 32698 return; 32699 } 32700 32701 if (typeof child._store !== 'object') { 32702 throw new Error('React Component in warnForMissingKey should have a _store. ' + 'This error is likely caused by a bug in React. Please file an issue.'); 32703 } 32704 32705 child._store.validated = true; 32706 var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; 32707 32708 if (ownerHasKeyUseWarning[componentName]) { 32709 return; 32710 } 32711 32712 ownerHasKeyUseWarning[componentName] = true; 32713 32714 error('Each child in a list should have a unique ' + '"key" prop. See https://reactjs.org/link/warning-keys for ' + 'more information.'); 32715 }; 32716} 32717 32718function isReactClass(type) { 32719 return type.prototype && type.prototype.isReactComponent; 32720} 32721 32722function coerceRef(returnFiber, current, element) { 32723 var mixedRef = element.ref; 32724 32725 if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') { 32726 { 32727 // TODO: Clean this up once we turn on the string ref warning for 32728 // everyone, because the strict mode case will no longer be relevant 32729 if ((returnFiber.mode & StrictLegacyMode || warnAboutStringRefs) && // We warn in ReactElement.js if owner and self are equal for string refs 32730 // because these cannot be automatically converted to an arrow function 32731 // using a codemod. Therefore, we don't have to warn about string refs again. 32732 !(element._owner && element._self && element._owner.stateNode !== element._self) && // Will already throw with "Function components cannot have string refs" 32733 !(element._owner && element._owner.tag !== ClassComponent) && // Will already warn with "Function components cannot be given refs" 32734 !(typeof element.type === 'function' && !isReactClass(element.type)) && // Will already throw with "Element ref was specified as a string (someStringRef) but no owner was set" 32735 element._owner) { 32736 var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; 32737 32738 if (!didWarnAboutStringRefs[componentName]) { 32739 { 32740 error('Component "%s" contains the string ref "%s". Support for string refs ' + 'will be removed in a future major release. We recommend using ' + 'useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, mixedRef); 32741 } 32742 32743 didWarnAboutStringRefs[componentName] = true; 32744 } 32745 } 32746 } 32747 32748 if (element._owner) { 32749 var owner = element._owner; 32750 var inst; 32751 32752 if (owner) { 32753 var ownerFiber = owner; 32754 32755 if (ownerFiber.tag !== ClassComponent) { 32756 throw new Error('Function components cannot have string refs. ' + 'We recommend using useRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref'); 32757 } 32758 32759 inst = ownerFiber.stateNode; 32760 } 32761 32762 if (!inst) { 32763 throw new Error("Missing owner for string ref " + mixedRef + ". This error is likely caused by a " + 'bug in React. Please file an issue.'); 32764 } // Assigning this to a const so Flow knows it won't change in the closure 32765 32766 32767 var resolvedInst = inst; 32768 32769 { 32770 checkPropStringCoercion(mixedRef, 'ref'); 32771 } 32772 32773 var stringRef = '' + mixedRef; // Check if previous string ref matches new string ref 32774 32775 if (current !== null && current.ref !== null && typeof current.ref === 'function' && current.ref._stringRef === stringRef) { 32776 return current.ref; 32777 } 32778 32779 var ref = function (value) { 32780 var refs = resolvedInst.refs; 32781 32782 if (value === null) { 32783 delete refs[stringRef]; 32784 } else { 32785 refs[stringRef] = value; 32786 } 32787 }; 32788 32789 ref._stringRef = stringRef; 32790 return ref; 32791 } else { 32792 if (typeof mixedRef !== 'string') { 32793 throw new Error('Expected ref to be a function, a string, an object returned by React.createRef(), or null.'); 32794 } 32795 32796 if (!element._owner) { 32797 throw new Error("Element ref was specified as a string (" + mixedRef + ") but no owner was set. This could happen for one of" + ' the following reasons:\n' + '1. You may be adding a ref to a function component\n' + "2. You may be adding a ref to a component that was not created inside a component's render method\n" + '3. You have multiple copies of React loaded\n' + 'See https://reactjs.org/link/refs-must-have-owner for more information.'); 32798 } 32799 } 32800 } 32801 32802 return mixedRef; 32803} 32804 32805function throwOnInvalidObjectType(returnFiber, newChild) { 32806 var childString = Object.prototype.toString.call(newChild); 32807 throw new Error("Objects are not valid as a React child (found: " + (childString === '[object Object]' ? 'object with keys {' + Object.keys(newChild).join(', ') + '}' : childString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.'); 32808} 32809 32810function warnOnFunctionType(returnFiber) { 32811 { 32812 var componentName = getComponentNameFromFiber(returnFiber) || 'Component'; 32813 32814 if (ownerHasFunctionTypeWarning[componentName]) { 32815 return; 32816 } 32817 32818 ownerHasFunctionTypeWarning[componentName] = true; 32819 32820 error('Functions are not valid as a React child. This may happen if ' + 'you return a Component instead of <Component /> from render. ' + 'Or maybe you meant to call this function rather than return it.'); 32821 } 32822} 32823 32824function resolveLazy(lazyType) { 32825 var payload = lazyType._payload; 32826 var init = lazyType._init; 32827 return init(payload); 32828} // This wrapper function exists because I expect to clone the code in each path 32829// to be able to optimize each path individually by branching early. This needs 32830// a compiler or we can do it manually. Helpers that don't need this branching 32831// live outside of this function. 32832 32833 32834function ChildReconciler(shouldTrackSideEffects) { 32835 function deleteChild(returnFiber, childToDelete) { 32836 if (!shouldTrackSideEffects) { 32837 // Noop. 32838 return; 32839 } 32840 32841 var deletions = returnFiber.deletions; 32842 32843 if (deletions === null) { 32844 returnFiber.deletions = [childToDelete]; 32845 returnFiber.flags |= ChildDeletion; 32846 } else { 32847 deletions.push(childToDelete); 32848 } 32849 } 32850 32851 function deleteRemainingChildren(returnFiber, currentFirstChild) { 32852 if (!shouldTrackSideEffects) { 32853 // Noop. 32854 return null; 32855 } // TODO: For the shouldClone case, this could be micro-optimized a bit by 32856 // assuming that after the first child we've already added everything. 32857 32858 32859 var childToDelete = currentFirstChild; 32860 32861 while (childToDelete !== null) { 32862 deleteChild(returnFiber, childToDelete); 32863 childToDelete = childToDelete.sibling; 32864 } 32865 32866 return null; 32867 } 32868 32869 function mapRemainingChildren(returnFiber, currentFirstChild) { 32870 // Add the remaining children to a temporary map so that we can find them by 32871 // keys quickly. Implicit (null) keys get added to this set with their index 32872 // instead. 32873 var existingChildren = new Map(); 32874 var existingChild = currentFirstChild; 32875 32876 while (existingChild !== null) { 32877 if (existingChild.key !== null) { 32878 existingChildren.set(existingChild.key, existingChild); 32879 } else { 32880 existingChildren.set(existingChild.index, existingChild); 32881 } 32882 32883 existingChild = existingChild.sibling; 32884 } 32885 32886 return existingChildren; 32887 } 32888 32889 function useFiber(fiber, pendingProps) { 32890 // We currently set sibling to null and index to 0 here because it is easy 32891 // to forget to do before returning it. E.g. for the single child case. 32892 var clone = createWorkInProgress(fiber, pendingProps); 32893 clone.index = 0; 32894 clone.sibling = null; 32895 return clone; 32896 } 32897 32898 function placeChild(newFiber, lastPlacedIndex, newIndex) { 32899 newFiber.index = newIndex; 32900 32901 if (!shouldTrackSideEffects) { 32902 // During hydration, the useId algorithm needs to know which fibers are 32903 // part of a list of children (arrays, iterators). 32904 newFiber.flags |= Forked; 32905 return lastPlacedIndex; 32906 } 32907 32908 var current = newFiber.alternate; 32909 32910 if (current !== null) { 32911 var oldIndex = current.index; 32912 32913 if (oldIndex < lastPlacedIndex) { 32914 // This is a move. 32915 newFiber.flags |= Placement; 32916 return lastPlacedIndex; 32917 } else { 32918 // This item can stay in place. 32919 return oldIndex; 32920 } 32921 } else { 32922 // This is an insertion. 32923 newFiber.flags |= Placement; 32924 return lastPlacedIndex; 32925 } 32926 } 32927 32928 function placeSingleChild(newFiber) { 32929 // This is simpler for the single child case. We only need to do a 32930 // placement for inserting new children. 32931 if (shouldTrackSideEffects && newFiber.alternate === null) { 32932 newFiber.flags |= Placement; 32933 } 32934 32935 return newFiber; 32936 } 32937 32938 function updateTextNode(returnFiber, current, textContent, lanes) { 32939 if (current === null || current.tag !== HostText) { 32940 // Insert 32941 var created = createFiberFromText(textContent, returnFiber.mode, lanes); 32942 created.return = returnFiber; 32943 return created; 32944 } else { 32945 // Update 32946 var existing = useFiber(current, textContent); 32947 existing.return = returnFiber; 32948 return existing; 32949 } 32950 } 32951 32952 function updateElement(returnFiber, current, element, lanes) { 32953 var elementType = element.type; 32954 32955 if (elementType === REACT_FRAGMENT_TYPE) { 32956 return updateFragment(returnFiber, current, element.props.children, lanes, element.key); 32957 } 32958 32959 if (current !== null) { 32960 if (current.elementType === elementType || ( // Keep this check inline so it only runs on the false path: 32961 isCompatibleFamilyForHotReloading(current, element) ) || // Lazy types should reconcile their resolved type. 32962 // We need to do this after the Hot Reloading check above, 32963 // because hot reloading has different semantics than prod because 32964 // it doesn't resuspend. So we can't let the call below suspend. 32965 typeof elementType === 'object' && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === current.type) { 32966 // Move based on index 32967 var existing = useFiber(current, element.props); 32968 existing.ref = coerceRef(returnFiber, current, element); 32969 existing.return = returnFiber; 32970 32971 { 32972 existing._debugSource = element._source; 32973 existing._debugOwner = element._owner; 32974 } 32975 32976 return existing; 32977 } 32978 } // Insert 32979 32980 32981 var created = createFiberFromElement(element, returnFiber.mode, lanes); 32982 created.ref = coerceRef(returnFiber, current, element); 32983 created.return = returnFiber; 32984 return created; 32985 } 32986 32987 function updatePortal(returnFiber, current, portal, lanes) { 32988 if (current === null || current.tag !== HostPortal || current.stateNode.containerInfo !== portal.containerInfo || current.stateNode.implementation !== portal.implementation) { 32989 // Insert 32990 var created = createFiberFromPortal(portal, returnFiber.mode, lanes); 32991 created.return = returnFiber; 32992 return created; 32993 } else { 32994 // Update 32995 var existing = useFiber(current, portal.children || []); 32996 existing.return = returnFiber; 32997 return existing; 32998 } 32999 } 33000 33001 function updateFragment(returnFiber, current, fragment, lanes, key) { 33002 if (current === null || current.tag !== Fragment) { 33003 // Insert 33004 var created = createFiberFromFragment(fragment, returnFiber.mode, lanes, key); 33005 created.return = returnFiber; 33006 return created; 33007 } else { 33008 // Update 33009 var existing = useFiber(current, fragment); 33010 existing.return = returnFiber; 33011 return existing; 33012 } 33013 } 33014 33015 function createChild(returnFiber, newChild, lanes) { 33016 if (typeof newChild === 'string' && newChild !== '' || typeof newChild === 'number') { 33017 // Text nodes don't have keys. If the previous node is implicitly keyed 33018 // we can continue to replace it without aborting even if it is not a text 33019 // node. 33020 var created = createFiberFromText('' + newChild, returnFiber.mode, lanes); 33021 created.return = returnFiber; 33022 return created; 33023 } 33024 33025 if (typeof newChild === 'object' && newChild !== null) { 33026 switch (newChild.$$typeof) { 33027 case REACT_ELEMENT_TYPE: 33028 { 33029 var _created = createFiberFromElement(newChild, returnFiber.mode, lanes); 33030 33031 _created.ref = coerceRef(returnFiber, null, newChild); 33032 _created.return = returnFiber; 33033 return _created; 33034 } 33035 33036 case REACT_PORTAL_TYPE: 33037 { 33038 var _created2 = createFiberFromPortal(newChild, returnFiber.mode, lanes); 33039 33040 _created2.return = returnFiber; 33041 return _created2; 33042 } 33043 33044 case REACT_LAZY_TYPE: 33045 { 33046 var payload = newChild._payload; 33047 var init = newChild._init; 33048 return createChild(returnFiber, init(payload), lanes); 33049 } 33050 } 33051 33052 if (isArray(newChild) || getIteratorFn(newChild)) { 33053 var _created3 = createFiberFromFragment(newChild, returnFiber.mode, lanes, null); 33054 33055 _created3.return = returnFiber; 33056 return _created3; 33057 } 33058 33059 throwOnInvalidObjectType(returnFiber, newChild); 33060 } 33061 33062 { 33063 if (typeof newChild === 'function') { 33064 warnOnFunctionType(returnFiber); 33065 } 33066 } 33067 33068 return null; 33069 } 33070 33071 function updateSlot(returnFiber, oldFiber, newChild, lanes) { 33072 // Update the fiber if the keys match, otherwise return null. 33073 var key = oldFiber !== null ? oldFiber.key : null; 33074 33075 if (typeof newChild === 'string' && newChild !== '' || typeof newChild === 'number') { 33076 // Text nodes don't have keys. If the previous node is implicitly keyed 33077 // we can continue to replace it without aborting even if it is not a text 33078 // node. 33079 if (key !== null) { 33080 return null; 33081 } 33082 33083 return updateTextNode(returnFiber, oldFiber, '' + newChild, lanes); 33084 } 33085 33086 if (typeof newChild === 'object' && newChild !== null) { 33087 switch (newChild.$$typeof) { 33088 case REACT_ELEMENT_TYPE: 33089 { 33090 if (newChild.key === key) { 33091 return updateElement(returnFiber, oldFiber, newChild, lanes); 33092 } else { 33093 return null; 33094 } 33095 } 33096 33097 case REACT_PORTAL_TYPE: 33098 { 33099 if (newChild.key === key) { 33100 return updatePortal(returnFiber, oldFiber, newChild, lanes); 33101 } else { 33102 return null; 33103 } 33104 } 33105 33106 case REACT_LAZY_TYPE: 33107 { 33108 var payload = newChild._payload; 33109 var init = newChild._init; 33110 return updateSlot(returnFiber, oldFiber, init(payload), lanes); 33111 } 33112 } 33113 33114 if (isArray(newChild) || getIteratorFn(newChild)) { 33115 if (key !== null) { 33116 return null; 33117 } 33118 33119 return updateFragment(returnFiber, oldFiber, newChild, lanes, null); 33120 } 33121 33122 throwOnInvalidObjectType(returnFiber, newChild); 33123 } 33124 33125 { 33126 if (typeof newChild === 'function') { 33127 warnOnFunctionType(returnFiber); 33128 } 33129 } 33130 33131 return null; 33132 } 33133 33134 function updateFromMap(existingChildren, returnFiber, newIdx, newChild, lanes) { 33135 if (typeof newChild === 'string' && newChild !== '' || typeof newChild === 'number') { 33136 // Text nodes don't have keys, so we neither have to check the old nor 33137 // new node for the key. If both are text nodes, they match. 33138 var matchedFiber = existingChildren.get(newIdx) || null; 33139 return updateTextNode(returnFiber, matchedFiber, '' + newChild, lanes); 33140 } 33141 33142 if (typeof newChild === 'object' && newChild !== null) { 33143 switch (newChild.$$typeof) { 33144 case REACT_ELEMENT_TYPE: 33145 { 33146 var _matchedFiber = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; 33147 33148 return updateElement(returnFiber, _matchedFiber, newChild, lanes); 33149 } 33150 33151 case REACT_PORTAL_TYPE: 33152 { 33153 var _matchedFiber2 = existingChildren.get(newChild.key === null ? newIdx : newChild.key) || null; 33154 33155 return updatePortal(returnFiber, _matchedFiber2, newChild, lanes); 33156 } 33157 33158 case REACT_LAZY_TYPE: 33159 var payload = newChild._payload; 33160 var init = newChild._init; 33161 return updateFromMap(existingChildren, returnFiber, newIdx, init(payload), lanes); 33162 } 33163 33164 if (isArray(newChild) || getIteratorFn(newChild)) { 33165 var _matchedFiber3 = existingChildren.get(newIdx) || null; 33166 33167 return updateFragment(returnFiber, _matchedFiber3, newChild, lanes, null); 33168 } 33169 33170 throwOnInvalidObjectType(returnFiber, newChild); 33171 } 33172 33173 { 33174 if (typeof newChild === 'function') { 33175 warnOnFunctionType(returnFiber); 33176 } 33177 } 33178 33179 return null; 33180 } 33181 /** 33182 * Warns if there is a duplicate or missing key 33183 */ 33184 33185 33186 function warnOnInvalidKey(child, knownKeys, returnFiber) { 33187 { 33188 if (typeof child !== 'object' || child === null) { 33189 return knownKeys; 33190 } 33191 33192 switch (child.$$typeof) { 33193 case REACT_ELEMENT_TYPE: 33194 case REACT_PORTAL_TYPE: 33195 warnForMissingKey(child, returnFiber); 33196 var key = child.key; 33197 33198 if (typeof key !== 'string') { 33199 break; 33200 } 33201 33202 if (knownKeys === null) { 33203 knownKeys = new Set(); 33204 knownKeys.add(key); 33205 break; 33206 } 33207 33208 if (!knownKeys.has(key)) { 33209 knownKeys.add(key); 33210 break; 33211 } 33212 33213 error('Encountered two children with the same key, `%s`. ' + 'Keys should be unique so that components maintain their identity ' + 'across updates. Non-unique keys may cause children to be ' + 'duplicated and/or omitted â the behavior is unsupported and ' + 'could change in a future version.', key); 33214 33215 break; 33216 33217 case REACT_LAZY_TYPE: 33218 var payload = child._payload; 33219 var init = child._init; 33220 warnOnInvalidKey(init(payload), knownKeys, returnFiber); 33221 break; 33222 } 33223 } 33224 33225 return knownKeys; 33226 } 33227 33228 function reconcileChildrenArray(returnFiber, currentFirstChild, newChildren, lanes) { 33229 // This algorithm can't optimize by searching from both ends since we 33230 // don't have backpointers on fibers. I'm trying to see how far we can get 33231 // with that model. If it ends up not being worth the tradeoffs, we can 33232 // add it later. 33233 // Even with a two ended optimization, we'd want to optimize for the case 33234 // where there are few changes and brute force the comparison instead of 33235 // going for the Map. It'd like to explore hitting that path first in 33236 // forward-only mode and only go for the Map once we notice that we need 33237 // lots of look ahead. This doesn't handle reversal as well as two ended 33238 // search but that's unusual. Besides, for the two ended optimization to 33239 // work on Iterables, we'd need to copy the whole set. 33240 // In this first iteration, we'll just live with hitting the bad case 33241 // (adding everything to a Map) in for every insert/move. 33242 // If you change this code, also update reconcileChildrenIterator() which 33243 // uses the same algorithm. 33244 { 33245 // First, validate keys. 33246 var knownKeys = null; 33247 33248 for (var i = 0; i < newChildren.length; i++) { 33249 var child = newChildren[i]; 33250 knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber); 33251 } 33252 } 33253 33254 var resultingFirstChild = null; 33255 var previousNewFiber = null; 33256 var oldFiber = currentFirstChild; 33257 var lastPlacedIndex = 0; 33258 var newIdx = 0; 33259 var nextOldFiber = null; 33260 33261 for (; oldFiber !== null && newIdx < newChildren.length; newIdx++) { 33262 if (oldFiber.index > newIdx) { 33263 nextOldFiber = oldFiber; 33264 oldFiber = null; 33265 } else { 33266 nextOldFiber = oldFiber.sibling; 33267 } 33268 33269 var newFiber = updateSlot(returnFiber, oldFiber, newChildren[newIdx], lanes); 33270 33271 if (newFiber === null) { 33272 // TODO: This breaks on empty slots like null children. That's 33273 // unfortunate because it triggers the slow path all the time. We need 33274 // a better way to communicate whether this was a miss or null, 33275 // boolean, undefined, etc. 33276 if (oldFiber === null) { 33277 oldFiber = nextOldFiber; 33278 } 33279 33280 break; 33281 } 33282 33283 if (shouldTrackSideEffects) { 33284 if (oldFiber && newFiber.alternate === null) { 33285 // We matched the slot, but we didn't reuse the existing fiber, so we 33286 // need to delete the existing child. 33287 deleteChild(returnFiber, oldFiber); 33288 } 33289 } 33290 33291 lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); 33292 33293 if (previousNewFiber === null) { 33294 // TODO: Move out of the loop. This only happens for the first run. 33295 resultingFirstChild = newFiber; 33296 } else { 33297 // TODO: Defer siblings if we're not at the right index for this slot. 33298 // I.e. if we had null values before, then we want to defer this 33299 // for each null value. However, we also don't want to call updateSlot 33300 // with the previous one. 33301 previousNewFiber.sibling = newFiber; 33302 } 33303 33304 previousNewFiber = newFiber; 33305 oldFiber = nextOldFiber; 33306 } 33307 33308 if (newIdx === newChildren.length) { 33309 // We've reached the end of the new children. We can delete the rest. 33310 deleteRemainingChildren(returnFiber, oldFiber); 33311 33312 if (getIsHydrating()) { 33313 var numberOfForks = newIdx; 33314 pushTreeFork(returnFiber, numberOfForks); 33315 } 33316 33317 return resultingFirstChild; 33318 } 33319 33320 if (oldFiber === null) { 33321 // If we don't have any more existing children we can choose a fast path 33322 // since the rest will all be insertions. 33323 for (; newIdx < newChildren.length; newIdx++) { 33324 var _newFiber = createChild(returnFiber, newChildren[newIdx], lanes); 33325 33326 if (_newFiber === null) { 33327 continue; 33328 } 33329 33330 lastPlacedIndex = placeChild(_newFiber, lastPlacedIndex, newIdx); 33331 33332 if (previousNewFiber === null) { 33333 // TODO: Move out of the loop. This only happens for the first run. 33334 resultingFirstChild = _newFiber; 33335 } else { 33336 previousNewFiber.sibling = _newFiber; 33337 } 33338 33339 previousNewFiber = _newFiber; 33340 } 33341 33342 if (getIsHydrating()) { 33343 var _numberOfForks = newIdx; 33344 pushTreeFork(returnFiber, _numberOfForks); 33345 } 33346 33347 return resultingFirstChild; 33348 } // Add all children to a key map for quick lookups. 33349 33350 33351 var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. 33352 33353 for (; newIdx < newChildren.length; newIdx++) { 33354 var _newFiber2 = updateFromMap(existingChildren, returnFiber, newIdx, newChildren[newIdx], lanes); 33355 33356 if (_newFiber2 !== null) { 33357 if (shouldTrackSideEffects) { 33358 if (_newFiber2.alternate !== null) { 33359 // The new fiber is a work in progress, but if there exists a 33360 // current, that means that we reused the fiber. We need to delete 33361 // it from the child list so that we don't add it to the deletion 33362 // list. 33363 existingChildren.delete(_newFiber2.key === null ? newIdx : _newFiber2.key); 33364 } 33365 } 33366 33367 lastPlacedIndex = placeChild(_newFiber2, lastPlacedIndex, newIdx); 33368 33369 if (previousNewFiber === null) { 33370 resultingFirstChild = _newFiber2; 33371 } else { 33372 previousNewFiber.sibling = _newFiber2; 33373 } 33374 33375 previousNewFiber = _newFiber2; 33376 } 33377 } 33378 33379 if (shouldTrackSideEffects) { 33380 // Any existing children that weren't consumed above were deleted. We need 33381 // to add them to the deletion list. 33382 existingChildren.forEach(function (child) { 33383 return deleteChild(returnFiber, child); 33384 }); 33385 } 33386 33387 if (getIsHydrating()) { 33388 var _numberOfForks2 = newIdx; 33389 pushTreeFork(returnFiber, _numberOfForks2); 33390 } 33391 33392 return resultingFirstChild; 33393 } 33394 33395 function reconcileChildrenIterator(returnFiber, currentFirstChild, newChildrenIterable, lanes) { 33396 // This is the same implementation as reconcileChildrenArray(), 33397 // but using the iterator instead. 33398 var iteratorFn = getIteratorFn(newChildrenIterable); 33399 33400 if (typeof iteratorFn !== 'function') { 33401 throw new Error('An object is not an iterable. This error is likely caused by a bug in ' + 'React. Please file an issue.'); 33402 } 33403 33404 { 33405 // We don't support rendering Generators because it's a mutation. 33406 // See https://github.com/facebook/react/issues/12995 33407 if (typeof Symbol === 'function' && // $FlowFixMe Flow doesn't know about toStringTag 33408 newChildrenIterable[Symbol.toStringTag] === 'Generator') { 33409 if (!didWarnAboutGenerators) { 33410 error('Using Generators as children is unsupported and will likely yield ' + 'unexpected results because enumerating a generator mutates it. ' + 'You may convert it to an array with `Array.from()` or the ' + '`[...spread]` operator before rendering. Keep in mind ' + 'you might need to polyfill these features for older browsers.'); 33411 } 33412 33413 didWarnAboutGenerators = true; 33414 } // Warn about using Maps as children 33415 33416 33417 if (newChildrenIterable.entries === iteratorFn) { 33418 if (!didWarnAboutMaps) { 33419 error('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); 33420 } 33421 33422 didWarnAboutMaps = true; 33423 } // First, validate keys. 33424 // We'll get a different iterator later for the main pass. 33425 33426 33427 var _newChildren = iteratorFn.call(newChildrenIterable); 33428 33429 if (_newChildren) { 33430 var knownKeys = null; 33431 33432 var _step = _newChildren.next(); 33433 33434 for (; !_step.done; _step = _newChildren.next()) { 33435 var child = _step.value; 33436 knownKeys = warnOnInvalidKey(child, knownKeys, returnFiber); 33437 } 33438 } 33439 } 33440 33441 var newChildren = iteratorFn.call(newChildrenIterable); 33442 33443 if (newChildren == null) { 33444 throw new Error('An iterable object provided no iterator.'); 33445 } 33446 33447 var resultingFirstChild = null; 33448 var previousNewFiber = null; 33449 var oldFiber = currentFirstChild; 33450 var lastPlacedIndex = 0; 33451 var newIdx = 0; 33452 var nextOldFiber = null; 33453 var step = newChildren.next(); 33454 33455 for (; oldFiber !== null && !step.done; newIdx++, step = newChildren.next()) { 33456 if (oldFiber.index > newIdx) { 33457 nextOldFiber = oldFiber; 33458 oldFiber = null; 33459 } else { 33460 nextOldFiber = oldFiber.sibling; 33461 } 33462 33463 var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes); 33464 33465 if (newFiber === null) { 33466 // TODO: This breaks on empty slots like null children. That's 33467 // unfortunate because it triggers the slow path all the time. We need 33468 // a better way to communicate whether this was a miss or null, 33469 // boolean, undefined, etc. 33470 if (oldFiber === null) { 33471 oldFiber = nextOldFiber; 33472 } 33473 33474 break; 33475 } 33476 33477 if (shouldTrackSideEffects) { 33478 if (oldFiber && newFiber.alternate === null) { 33479 // We matched the slot, but we didn't reuse the existing fiber, so we 33480 // need to delete the existing child. 33481 deleteChild(returnFiber, oldFiber); 33482 } 33483 } 33484 33485 lastPlacedIndex = placeChild(newFiber, lastPlacedIndex, newIdx); 33486 33487 if (previousNewFiber === null) { 33488 // TODO: Move out of the loop. This only happens for the first run. 33489 resultingFirstChild = newFiber; 33490 } else { 33491 // TODO: Defer siblings if we're not at the right index for this slot. 33492 // I.e. if we had null values before, then we want to defer this 33493 // for each null value. However, we also don't want to call updateSlot 33494 // with the previous one. 33495 previousNewFiber.sibling = newFiber; 33496 } 33497 33498 previousNewFiber = newFiber; 33499 oldFiber = nextOldFiber; 33500 } 33501 33502 if (step.done) { 33503 // We've reached the end of the new children. We can delete the rest. 33504 deleteRemainingChildren(returnFiber, oldFiber); 33505 33506 if (getIsHydrating()) { 33507 var numberOfForks = newIdx; 33508 pushTreeFork(returnFiber, numberOfForks); 33509 } 33510 33511 return resultingFirstChild; 33512 } 33513 33514 if (oldFiber === null) { 33515 // If we don't have any more existing children we can choose a fast path 33516 // since the rest will all be insertions. 33517 for (; !step.done; newIdx++, step = newChildren.next()) { 33518 var _newFiber3 = createChild(returnFiber, step.value, lanes); 33519 33520 if (_newFiber3 === null) { 33521 continue; 33522 } 33523 33524 lastPlacedIndex = placeChild(_newFiber3, lastPlacedIndex, newIdx); 33525 33526 if (previousNewFiber === null) { 33527 // TODO: Move out of the loop. This only happens for the first run. 33528 resultingFirstChild = _newFiber3; 33529 } else { 33530 previousNewFiber.sibling = _newFiber3; 33531 } 33532 33533 previousNewFiber = _newFiber3; 33534 } 33535 33536 if (getIsHydrating()) { 33537 var _numberOfForks3 = newIdx; 33538 pushTreeFork(returnFiber, _numberOfForks3); 33539 } 33540 33541 return resultingFirstChild; 33542 } // Add all children to a key map for quick lookups. 33543 33544 33545 var existingChildren = mapRemainingChildren(returnFiber, oldFiber); // Keep scanning and use the map to restore deleted items as moves. 33546 33547 for (; !step.done; newIdx++, step = newChildren.next()) { 33548 var _newFiber4 = updateFromMap(existingChildren, returnFiber, newIdx, step.value, lanes); 33549 33550 if (_newFiber4 !== null) { 33551 if (shouldTrackSideEffects) { 33552 if (_newFiber4.alternate !== null) { 33553 // The new fiber is a work in progress, but if there exists a 33554 // current, that means that we reused the fiber. We need to delete 33555 // it from the child list so that we don't add it to the deletion 33556 // list. 33557 existingChildren.delete(_newFiber4.key === null ? newIdx : _newFiber4.key); 33558 } 33559 } 33560 33561 lastPlacedIndex = placeChild(_newFiber4, lastPlacedIndex, newIdx); 33562 33563 if (previousNewFiber === null) { 33564 resultingFirstChild = _newFiber4; 33565 } else { 33566 previousNewFiber.sibling = _newFiber4; 33567 } 33568 33569 previousNewFiber = _newFiber4; 33570 } 33571 } 33572 33573 if (shouldTrackSideEffects) { 33574 // Any existing children that weren't consumed above were deleted. We need 33575 // to add them to the deletion list. 33576 existingChildren.forEach(function (child) { 33577 return deleteChild(returnFiber, child); 33578 }); 33579 } 33580 33581 if (getIsHydrating()) { 33582 var _numberOfForks4 = newIdx; 33583 pushTreeFork(returnFiber, _numberOfForks4); 33584 } 33585 33586 return resultingFirstChild; 33587 } 33588 33589 function reconcileSingleTextNode(returnFiber, currentFirstChild, textContent, lanes) { 33590 // There's no need to check for keys on text nodes since we don't have a 33591 // way to define them. 33592 if (currentFirstChild !== null && currentFirstChild.tag === HostText) { 33593 // We already have an existing node so let's just update it and delete 33594 // the rest. 33595 deleteRemainingChildren(returnFiber, currentFirstChild.sibling); 33596 var existing = useFiber(currentFirstChild, textContent); 33597 existing.return = returnFiber; 33598 return existing; 33599 } // The existing first child is not a text node so we need to create one 33600 // and delete the existing ones. 33601 33602 33603 deleteRemainingChildren(returnFiber, currentFirstChild); 33604 var created = createFiberFromText(textContent, returnFiber.mode, lanes); 33605 created.return = returnFiber; 33606 return created; 33607 } 33608 33609 function reconcileSingleElement(returnFiber, currentFirstChild, element, lanes) { 33610 var key = element.key; 33611 var child = currentFirstChild; 33612 33613 while (child !== null) { 33614 // TODO: If key === null and child.key === null, then this only applies to 33615 // the first item in the list. 33616 if (child.key === key) { 33617 var elementType = element.type; 33618 33619 if (elementType === REACT_FRAGMENT_TYPE) { 33620 if (child.tag === Fragment) { 33621 deleteRemainingChildren(returnFiber, child.sibling); 33622 var existing = useFiber(child, element.props.children); 33623 existing.return = returnFiber; 33624 33625 { 33626 existing._debugSource = element._source; 33627 existing._debugOwner = element._owner; 33628 } 33629 33630 return existing; 33631 } 33632 } else { 33633 if (child.elementType === elementType || ( // Keep this check inline so it only runs on the false path: 33634 isCompatibleFamilyForHotReloading(child, element) ) || // Lazy types should reconcile their resolved type. 33635 // We need to do this after the Hot Reloading check above, 33636 // because hot reloading has different semantics than prod because 33637 // it doesn't resuspend. So we can't let the call below suspend. 33638 typeof elementType === 'object' && elementType !== null && elementType.$$typeof === REACT_LAZY_TYPE && resolveLazy(elementType) === child.type) { 33639 deleteRemainingChildren(returnFiber, child.sibling); 33640 33641 var _existing = useFiber(child, element.props); 33642 33643 _existing.ref = coerceRef(returnFiber, child, element); 33644 _existing.return = returnFiber; 33645 33646 { 33647 _existing._debugSource = element._source; 33648 _existing._debugOwner = element._owner; 33649 } 33650 33651 return _existing; 33652 } 33653 } // Didn't match. 33654 33655 33656 deleteRemainingChildren(returnFiber, child); 33657 break; 33658 } else { 33659 deleteChild(returnFiber, child); 33660 } 33661 33662 child = child.sibling; 33663 } 33664 33665 if (element.type === REACT_FRAGMENT_TYPE) { 33666 var created = createFiberFromFragment(element.props.children, returnFiber.mode, lanes, element.key); 33667 created.return = returnFiber; 33668 return created; 33669 } else { 33670 var _created4 = createFiberFromElement(element, returnFiber.mode, lanes); 33671 33672 _created4.ref = coerceRef(returnFiber, currentFirstChild, element); 33673 _created4.return = returnFiber; 33674 return _created4; 33675 } 33676 } 33677 33678 function reconcileSinglePortal(returnFiber, currentFirstChild, portal, lanes) { 33679 var key = portal.key; 33680 var child = currentFirstChild; 33681 33682 while (child !== null) { 33683 // TODO: If key === null and child.key === null, then this only applies to 33684 // the first item in the list. 33685 if (child.key === key) { 33686 if (child.tag === HostPortal && child.stateNode.containerInfo === portal.containerInfo && child.stateNode.implementation === portal.implementation) { 33687 deleteRemainingChildren(returnFiber, child.sibling); 33688 var existing = useFiber(child, portal.children || []); 33689 existing.return = returnFiber; 33690 return existing; 33691 } else { 33692 deleteRemainingChildren(returnFiber, child); 33693 break; 33694 } 33695 } else { 33696 deleteChild(returnFiber, child); 33697 } 33698 33699 child = child.sibling; 33700 } 33701 33702 var created = createFiberFromPortal(portal, returnFiber.mode, lanes); 33703 created.return = returnFiber; 33704 return created; 33705 } // This API will tag the children with the side-effect of the reconciliation 33706 // itself. They will be added to the side-effect list as we pass through the 33707 // children and the parent. 33708 33709 33710 function reconcileChildFibers(returnFiber, currentFirstChild, newChild, lanes) { 33711 // This function is not recursive. 33712 // If the top level item is an array, we treat it as a set of children, 33713 // not as a fragment. Nested arrays on the other hand will be treated as 33714 // fragment nodes. Recursion happens at the normal flow. 33715 // Handle top level unkeyed fragments as if they were arrays. 33716 // This leads to an ambiguity between <>{[...]}</> and <>...</>. 33717 // We treat the ambiguous cases above the same. 33718 var isUnkeyedTopLevelFragment = typeof newChild === 'object' && newChild !== null && newChild.type === REACT_FRAGMENT_TYPE && newChild.key === null; 33719 33720 if (isUnkeyedTopLevelFragment) { 33721 newChild = newChild.props.children; 33722 } // Handle object types 33723 33724 33725 if (typeof newChild === 'object' && newChild !== null) { 33726 switch (newChild.$$typeof) { 33727 case REACT_ELEMENT_TYPE: 33728 return placeSingleChild(reconcileSingleElement(returnFiber, currentFirstChild, newChild, lanes)); 33729 33730 case REACT_PORTAL_TYPE: 33731 return placeSingleChild(reconcileSinglePortal(returnFiber, currentFirstChild, newChild, lanes)); 33732 33733 case REACT_LAZY_TYPE: 33734 var payload = newChild._payload; 33735 var init = newChild._init; // TODO: This function is supposed to be non-recursive. 33736 33737 return reconcileChildFibers(returnFiber, currentFirstChild, init(payload), lanes); 33738 } 33739 33740 if (isArray(newChild)) { 33741 return reconcileChildrenArray(returnFiber, currentFirstChild, newChild, lanes); 33742 } 33743 33744 if (getIteratorFn(newChild)) { 33745 return reconcileChildrenIterator(returnFiber, currentFirstChild, newChild, lanes); 33746 } 33747 33748 throwOnInvalidObjectType(returnFiber, newChild); 33749 } 33750 33751 if (typeof newChild === 'string' && newChild !== '' || typeof newChild === 'number') { 33752 return placeSingleChild(reconcileSingleTextNode(returnFiber, currentFirstChild, '' + newChild, lanes)); 33753 } 33754 33755 { 33756 if (typeof newChild === 'function') { 33757 warnOnFunctionType(returnFiber); 33758 } 33759 } // Remaining cases are all treated as empty. 33760 33761 33762 return deleteRemainingChildren(returnFiber, currentFirstChild); 33763 } 33764 33765 return reconcileChildFibers; 33766} 33767 33768var reconcileChildFibers = ChildReconciler(true); 33769var mountChildFibers = ChildReconciler(false); 33770function cloneChildFibers(current, workInProgress) { 33771 if (current !== null && workInProgress.child !== current.child) { 33772 throw new Error('Resuming work not yet implemented.'); 33773 } 33774 33775 if (workInProgress.child === null) { 33776 return; 33777 } 33778 33779 var currentChild = workInProgress.child; 33780 var newChild = createWorkInProgress(currentChild, currentChild.pendingProps); 33781 workInProgress.child = newChild; 33782 newChild.return = workInProgress; 33783 33784 while (currentChild.sibling !== null) { 33785 currentChild = currentChild.sibling; 33786 newChild = newChild.sibling = createWorkInProgress(currentChild, currentChild.pendingProps); 33787 newChild.return = workInProgress; 33788 } 33789 33790 newChild.sibling = null; 33791} // Reset a workInProgress child set to prepare it for a second pass. 33792 33793function resetChildFibers(workInProgress, lanes) { 33794 var child = workInProgress.child; 33795 33796 while (child !== null) { 33797 resetWorkInProgress(child, lanes); 33798 child = child.sibling; 33799 } 33800} 33801 33802var valueCursor = createCursor(null); 33803var rendererSigil; 33804 33805{ 33806 // Use this to detect multiple renderers using the same context 33807 rendererSigil = {}; 33808} 33809 33810var currentlyRenderingFiber = null; 33811var lastContextDependency = null; 33812var lastFullyObservedContext = null; 33813var isDisallowedContextReadInDEV = false; 33814function resetContextDependencies() { 33815 // This is called right before React yields execution, to ensure `readContext` 33816 // cannot be called outside the render phase. 33817 currentlyRenderingFiber = null; 33818 lastContextDependency = null; 33819 lastFullyObservedContext = null; 33820 33821 { 33822 isDisallowedContextReadInDEV = false; 33823 } 33824} 33825function enterDisallowedContextReadInDEV() { 33826 { 33827 isDisallowedContextReadInDEV = true; 33828 } 33829} 33830function exitDisallowedContextReadInDEV() { 33831 { 33832 isDisallowedContextReadInDEV = false; 33833 } 33834} 33835function pushProvider(providerFiber, context, nextValue) { 33836 { 33837 push(valueCursor, context._currentValue, providerFiber); 33838 context._currentValue = nextValue; 33839 33840 { 33841 if (context._currentRenderer !== undefined && context._currentRenderer !== null && context._currentRenderer !== rendererSigil) { 33842 error('Detected multiple renderers concurrently rendering the ' + 'same context provider. This is currently unsupported.'); 33843 } 33844 33845 context._currentRenderer = rendererSigil; 33846 } 33847 } 33848} 33849function popProvider(context, providerFiber) { 33850 var currentValue = valueCursor.current; 33851 pop(valueCursor, providerFiber); 33852 33853 { 33854 { 33855 context._currentValue = currentValue; 33856 } 33857 } 33858} 33859function scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) { 33860 // Update the child lanes of all the ancestors, including the alternates. 33861 var node = parent; 33862 33863 while (node !== null) { 33864 var alternate = node.alternate; 33865 33866 if (!isSubsetOfLanes(node.childLanes, renderLanes)) { 33867 node.childLanes = mergeLanes(node.childLanes, renderLanes); 33868 33869 if (alternate !== null) { 33870 alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); 33871 } 33872 } else if (alternate !== null && !isSubsetOfLanes(alternate.childLanes, renderLanes)) { 33873 alternate.childLanes = mergeLanes(alternate.childLanes, renderLanes); 33874 } 33875 33876 if (node === propagationRoot) { 33877 break; 33878 } 33879 33880 node = node.return; 33881 } 33882 33883 { 33884 if (node !== propagationRoot) { 33885 error('Expected to find the propagation root when scheduling context work. ' + 'This error is likely caused by a bug in React. Please file an issue.'); 33886 } 33887 } 33888} 33889function propagateContextChange(workInProgress, context, renderLanes) { 33890 { 33891 propagateContextChange_eager(workInProgress, context, renderLanes); 33892 } 33893} 33894 33895function propagateContextChange_eager(workInProgress, context, renderLanes) { 33896 33897 var fiber = workInProgress.child; 33898 33899 if (fiber !== null) { 33900 // Set the return pointer of the child to the work-in-progress fiber. 33901 fiber.return = workInProgress; 33902 } 33903 33904 while (fiber !== null) { 33905 var nextFiber = void 0; // Visit this fiber. 33906 33907 var list = fiber.dependencies; 33908 33909 if (list !== null) { 33910 nextFiber = fiber.child; 33911 var dependency = list.firstContext; 33912 33913 while (dependency !== null) { 33914 // Check if the context matches. 33915 if (dependency.context === context) { 33916 // Match! Schedule an update on this fiber. 33917 if (fiber.tag === ClassComponent) { 33918 // Schedule a force update on the work-in-progress. 33919 var lane = pickArbitraryLane(renderLanes); 33920 var update = createUpdate(NoTimestamp, lane); 33921 update.tag = ForceUpdate; // TODO: Because we don't have a work-in-progress, this will add the 33922 // update to the current fiber, too, which means it will persist even if 33923 // this render is thrown away. Since it's a race condition, not sure it's 33924 // worth fixing. 33925 // Inlined `enqueueUpdate` to remove interleaved update check 33926 33927 var updateQueue = fiber.updateQueue; 33928 33929 if (updateQueue === null) ; else { 33930 var sharedQueue = updateQueue.shared; 33931 var pending = sharedQueue.pending; 33932 33933 if (pending === null) { 33934 // This is the first update. Create a circular list. 33935 update.next = update; 33936 } else { 33937 update.next = pending.next; 33938 pending.next = update; 33939 } 33940 33941 sharedQueue.pending = update; 33942 } 33943 } 33944 33945 fiber.lanes = mergeLanes(fiber.lanes, renderLanes); 33946 var alternate = fiber.alternate; 33947 33948 if (alternate !== null) { 33949 alternate.lanes = mergeLanes(alternate.lanes, renderLanes); 33950 } 33951 33952 scheduleContextWorkOnParentPath(fiber.return, renderLanes, workInProgress); // Mark the updated lanes on the list, too. 33953 33954 list.lanes = mergeLanes(list.lanes, renderLanes); // Since we already found a match, we can stop traversing the 33955 // dependency list. 33956 33957 break; 33958 } 33959 33960 dependency = dependency.next; 33961 } 33962 } else if (fiber.tag === ContextProvider) { 33963 // Don't scan deeper if this is a matching provider 33964 nextFiber = fiber.type === workInProgress.type ? null : fiber.child; 33965 } else if (fiber.tag === DehydratedFragment) { 33966 // If a dehydrated suspense boundary is in this subtree, we don't know 33967 // if it will have any context consumers in it. The best we can do is 33968 // mark it as having updates. 33969 var parentSuspense = fiber.return; 33970 33971 if (parentSuspense === null) { 33972 throw new Error('We just came from a parent so we must have had a parent. This is a bug in React.'); 33973 } 33974 33975 parentSuspense.lanes = mergeLanes(parentSuspense.lanes, renderLanes); 33976 var _alternate = parentSuspense.alternate; 33977 33978 if (_alternate !== null) { 33979 _alternate.lanes = mergeLanes(_alternate.lanes, renderLanes); 33980 } // This is intentionally passing this fiber as the parent 33981 // because we want to schedule this fiber as having work 33982 // on its children. We'll use the childLanes on 33983 // this fiber to indicate that a context has changed. 33984 33985 33986 scheduleContextWorkOnParentPath(parentSuspense, renderLanes, workInProgress); 33987 nextFiber = fiber.sibling; 33988 } else { 33989 // Traverse down. 33990 nextFiber = fiber.child; 33991 } 33992 33993 if (nextFiber !== null) { 33994 // Set the return pointer of the child to the work-in-progress fiber. 33995 nextFiber.return = fiber; 33996 } else { 33997 // No child. Traverse to next sibling. 33998 nextFiber = fiber; 33999 34000 while (nextFiber !== null) { 34001 if (nextFiber === workInProgress) { 34002 // We're back to the root of this subtree. Exit. 34003 nextFiber = null; 34004 break; 34005 } 34006 34007 var sibling = nextFiber.sibling; 34008 34009 if (sibling !== null) { 34010 // Set the return pointer of the sibling to the work-in-progress fiber. 34011 sibling.return = nextFiber.return; 34012 nextFiber = sibling; 34013 break; 34014 } // No more siblings. Traverse up. 34015 34016 34017 nextFiber = nextFiber.return; 34018 } 34019 } 34020 34021 fiber = nextFiber; 34022 } 34023} 34024function prepareToReadContext(workInProgress, renderLanes) { 34025 currentlyRenderingFiber = workInProgress; 34026 lastContextDependency = null; 34027 lastFullyObservedContext = null; 34028 var dependencies = workInProgress.dependencies; 34029 34030 if (dependencies !== null) { 34031 { 34032 var firstContext = dependencies.firstContext; 34033 34034 if (firstContext !== null) { 34035 if (includesSomeLane(dependencies.lanes, renderLanes)) { 34036 // Context list has a pending update. Mark that this fiber performed work. 34037 markWorkInProgressReceivedUpdate(); 34038 } // Reset the work-in-progress list 34039 34040 34041 dependencies.firstContext = null; 34042 } 34043 } 34044 } 34045} 34046function readContext(context) { 34047 { 34048 // This warning would fire if you read context inside a Hook like useMemo. 34049 // Unlike the class check below, it's not enforced in production for perf. 34050 if (isDisallowedContextReadInDEV) { 34051 error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); 34052 } 34053 } 34054 34055 var value = context._currentValue ; 34056 34057 if (lastFullyObservedContext === context) ; else { 34058 var contextItem = { 34059 context: context, 34060 memoizedValue: value, 34061 next: null 34062 }; 34063 34064 if (lastContextDependency === null) { 34065 if (currentlyRenderingFiber === null) { 34066 throw new Error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); 34067 } // This is the first dependency for this component. Create a new list. 34068 34069 34070 lastContextDependency = contextItem; 34071 currentlyRenderingFiber.dependencies = { 34072 lanes: NoLanes, 34073 firstContext: contextItem 34074 }; 34075 } else { 34076 // Append a new context item. 34077 lastContextDependency = lastContextDependency.next = contextItem; 34078 } 34079 } 34080 34081 return value; 34082} 34083 34084// render. When this render exits, either because it finishes or because it is 34085// interrupted, the interleaved updates will be transferred onto the main part 34086// of the queue. 34087 34088var concurrentQueues = null; 34089function pushConcurrentUpdateQueue(queue) { 34090 if (concurrentQueues === null) { 34091 concurrentQueues = [queue]; 34092 } else { 34093 concurrentQueues.push(queue); 34094 } 34095} 34096function finishQueueingConcurrentUpdates() { 34097 // Transfer the interleaved updates onto the main queue. Each queue has a 34098 // `pending` field and an `interleaved` field. When they are not null, they 34099 // point to the last node in a circular linked list. We need to append the 34100 // interleaved list to the end of the pending list by joining them into a 34101 // single, circular list. 34102 if (concurrentQueues !== null) { 34103 for (var i = 0; i < concurrentQueues.length; i++) { 34104 var queue = concurrentQueues[i]; 34105 var lastInterleavedUpdate = queue.interleaved; 34106 34107 if (lastInterleavedUpdate !== null) { 34108 queue.interleaved = null; 34109 var firstInterleavedUpdate = lastInterleavedUpdate.next; 34110 var lastPendingUpdate = queue.pending; 34111 34112 if (lastPendingUpdate !== null) { 34113 var firstPendingUpdate = lastPendingUpdate.next; 34114 lastPendingUpdate.next = firstInterleavedUpdate; 34115 lastInterleavedUpdate.next = firstPendingUpdate; 34116 } 34117 34118 queue.pending = lastInterleavedUpdate; 34119 } 34120 } 34121 34122 concurrentQueues = null; 34123 } 34124} 34125function enqueueConcurrentHookUpdate(fiber, queue, update, lane) { 34126 var interleaved = queue.interleaved; 34127 34128 if (interleaved === null) { 34129 // This is the first update. Create a circular list. 34130 update.next = update; // At the end of the current render, this queue's interleaved updates will 34131 // be transferred to the pending queue. 34132 34133 pushConcurrentUpdateQueue(queue); 34134 } else { 34135 update.next = interleaved.next; 34136 interleaved.next = update; 34137 } 34138 34139 queue.interleaved = update; 34140 return markUpdateLaneFromFiberToRoot(fiber, lane); 34141} 34142function enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane) { 34143 var interleaved = queue.interleaved; 34144 34145 if (interleaved === null) { 34146 // This is the first update. Create a circular list. 34147 update.next = update; // At the end of the current render, this queue's interleaved updates will 34148 // be transferred to the pending queue. 34149 34150 pushConcurrentUpdateQueue(queue); 34151 } else { 34152 update.next = interleaved.next; 34153 interleaved.next = update; 34154 } 34155 34156 queue.interleaved = update; 34157} 34158function enqueueConcurrentClassUpdate(fiber, queue, update, lane) { 34159 var interleaved = queue.interleaved; 34160 34161 if (interleaved === null) { 34162 // This is the first update. Create a circular list. 34163 update.next = update; // At the end of the current render, this queue's interleaved updates will 34164 // be transferred to the pending queue. 34165 34166 pushConcurrentUpdateQueue(queue); 34167 } else { 34168 update.next = interleaved.next; 34169 interleaved.next = update; 34170 } 34171 34172 queue.interleaved = update; 34173 return markUpdateLaneFromFiberToRoot(fiber, lane); 34174} 34175function enqueueConcurrentRenderForLane(fiber, lane) { 34176 return markUpdateLaneFromFiberToRoot(fiber, lane); 34177} // Calling this function outside this module should only be done for backwards 34178// compatibility and should always be accompanied by a warning. 34179 34180var unsafe_markUpdateLaneFromFiberToRoot = markUpdateLaneFromFiberToRoot; 34181 34182function markUpdateLaneFromFiberToRoot(sourceFiber, lane) { 34183 // Update the source fiber's lanes 34184 sourceFiber.lanes = mergeLanes(sourceFiber.lanes, lane); 34185 var alternate = sourceFiber.alternate; 34186 34187 if (alternate !== null) { 34188 alternate.lanes = mergeLanes(alternate.lanes, lane); 34189 } 34190 34191 { 34192 if (alternate === null && (sourceFiber.flags & (Placement | Hydrating)) !== NoFlags) { 34193 warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); 34194 } 34195 } // Walk the parent path to the root and update the child lanes. 34196 34197 34198 var node = sourceFiber; 34199 var parent = sourceFiber.return; 34200 34201 while (parent !== null) { 34202 parent.childLanes = mergeLanes(parent.childLanes, lane); 34203 alternate = parent.alternate; 34204 34205 if (alternate !== null) { 34206 alternate.childLanes = mergeLanes(alternate.childLanes, lane); 34207 } else { 34208 { 34209 if ((parent.flags & (Placement | Hydrating)) !== NoFlags) { 34210 warnAboutUpdateOnNotYetMountedFiberInDEV(sourceFiber); 34211 } 34212 } 34213 } 34214 34215 node = parent; 34216 parent = parent.return; 34217 } 34218 34219 if (node.tag === HostRoot) { 34220 var root = node.stateNode; 34221 return root; 34222 } else { 34223 return null; 34224 } 34225} 34226 34227var UpdateState = 0; 34228var ReplaceState = 1; 34229var ForceUpdate = 2; 34230var CaptureUpdate = 3; // Global state that is reset at the beginning of calling `processUpdateQueue`. 34231// It should only be read right after calling `processUpdateQueue`, via 34232// `checkHasForceUpdateAfterProcessing`. 34233 34234var hasForceUpdate = false; 34235var didWarnUpdateInsideUpdate; 34236var currentlyProcessingQueue; 34237 34238{ 34239 didWarnUpdateInsideUpdate = false; 34240 currentlyProcessingQueue = null; 34241} 34242 34243function initializeUpdateQueue(fiber) { 34244 var queue = { 34245 baseState: fiber.memoizedState, 34246 firstBaseUpdate: null, 34247 lastBaseUpdate: null, 34248 shared: { 34249 pending: null, 34250 interleaved: null, 34251 lanes: NoLanes 34252 }, 34253 effects: null 34254 }; 34255 fiber.updateQueue = queue; 34256} 34257function cloneUpdateQueue(current, workInProgress) { 34258 // Clone the update queue from current. Unless it's already a clone. 34259 var queue = workInProgress.updateQueue; 34260 var currentQueue = current.updateQueue; 34261 34262 if (queue === currentQueue) { 34263 var clone = { 34264 baseState: currentQueue.baseState, 34265 firstBaseUpdate: currentQueue.firstBaseUpdate, 34266 lastBaseUpdate: currentQueue.lastBaseUpdate, 34267 shared: currentQueue.shared, 34268 effects: currentQueue.effects 34269 }; 34270 workInProgress.updateQueue = clone; 34271 } 34272} 34273function createUpdate(eventTime, lane) { 34274 var update = { 34275 eventTime: eventTime, 34276 lane: lane, 34277 tag: UpdateState, 34278 payload: null, 34279 callback: null, 34280 next: null 34281 }; 34282 return update; 34283} 34284function enqueueUpdate(fiber, update, lane) { 34285 var updateQueue = fiber.updateQueue; 34286 34287 if (updateQueue === null) { 34288 // Only occurs if the fiber has been unmounted. 34289 return null; 34290 } 34291 34292 var sharedQueue = updateQueue.shared; 34293 34294 { 34295 if (currentlyProcessingQueue === sharedQueue && !didWarnUpdateInsideUpdate) { 34296 error('An update (setState, replaceState, or forceUpdate) was scheduled ' + 'from inside an update function. Update functions should be pure, ' + 'with zero side-effects. Consider using componentDidUpdate or a ' + 'callback.'); 34297 34298 didWarnUpdateInsideUpdate = true; 34299 } 34300 } 34301 34302 if (isUnsafeClassRenderPhaseUpdate()) { 34303 // This is an unsafe render phase update. Add directly to the update 34304 // queue so we can process it immediately during the current render. 34305 var pending = sharedQueue.pending; 34306 34307 if (pending === null) { 34308 // This is the first update. Create a circular list. 34309 update.next = update; 34310 } else { 34311 update.next = pending.next; 34312 pending.next = update; 34313 } 34314 34315 sharedQueue.pending = update; // Update the childLanes even though we're most likely already rendering 34316 // this fiber. This is for backwards compatibility in the case where you 34317 // update a different component during render phase than the one that is 34318 // currently renderings (a pattern that is accompanied by a warning). 34319 34320 return unsafe_markUpdateLaneFromFiberToRoot(fiber, lane); 34321 } else { 34322 return enqueueConcurrentClassUpdate(fiber, sharedQueue, update, lane); 34323 } 34324} 34325function entangleTransitions(root, fiber, lane) { 34326 var updateQueue = fiber.updateQueue; 34327 34328 if (updateQueue === null) { 34329 // Only occurs if the fiber has been unmounted. 34330 return; 34331 } 34332 34333 var sharedQueue = updateQueue.shared; 34334 34335 if (isTransitionLane(lane)) { 34336 var queueLanes = sharedQueue.lanes; // If any entangled lanes are no longer pending on the root, then they must 34337 // have finished. We can remove them from the shared queue, which represents 34338 // a superset of the actually pending lanes. In some cases we may entangle 34339 // more than we need to, but that's OK. In fact it's worse if we *don't* 34340 // entangle when we should. 34341 34342 queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. 34343 34344 var newQueueLanes = mergeLanes(queueLanes, lane); 34345 sharedQueue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if 34346 // the lane finished since the last time we entangled it. So we need to 34347 // entangle it again, just to be sure. 34348 34349 markRootEntangled(root, newQueueLanes); 34350 } 34351} 34352function enqueueCapturedUpdate(workInProgress, capturedUpdate) { 34353 // Captured updates are updates that are thrown by a child during the render 34354 // phase. They should be discarded if the render is aborted. Therefore, 34355 // we should only put them on the work-in-progress queue, not the current one. 34356 var queue = workInProgress.updateQueue; // Check if the work-in-progress queue is a clone. 34357 34358 var current = workInProgress.alternate; 34359 34360 if (current !== null) { 34361 var currentQueue = current.updateQueue; 34362 34363 if (queue === currentQueue) { 34364 // The work-in-progress queue is the same as current. This happens when 34365 // we bail out on a parent fiber that then captures an error thrown by 34366 // a child. Since we want to append the update only to the work-in 34367 // -progress queue, we need to clone the updates. We usually clone during 34368 // processUpdateQueue, but that didn't happen in this case because we 34369 // skipped over the parent when we bailed out. 34370 var newFirst = null; 34371 var newLast = null; 34372 var firstBaseUpdate = queue.firstBaseUpdate; 34373 34374 if (firstBaseUpdate !== null) { 34375 // Loop through the updates and clone them. 34376 var update = firstBaseUpdate; 34377 34378 do { 34379 var clone = { 34380 eventTime: update.eventTime, 34381 lane: update.lane, 34382 tag: update.tag, 34383 payload: update.payload, 34384 callback: update.callback, 34385 next: null 34386 }; 34387 34388 if (newLast === null) { 34389 newFirst = newLast = clone; 34390 } else { 34391 newLast.next = clone; 34392 newLast = clone; 34393 } 34394 34395 update = update.next; 34396 } while (update !== null); // Append the captured update the end of the cloned list. 34397 34398 34399 if (newLast === null) { 34400 newFirst = newLast = capturedUpdate; 34401 } else { 34402 newLast.next = capturedUpdate; 34403 newLast = capturedUpdate; 34404 } 34405 } else { 34406 // There are no base updates. 34407 newFirst = newLast = capturedUpdate; 34408 } 34409 34410 queue = { 34411 baseState: currentQueue.baseState, 34412 firstBaseUpdate: newFirst, 34413 lastBaseUpdate: newLast, 34414 shared: currentQueue.shared, 34415 effects: currentQueue.effects 34416 }; 34417 workInProgress.updateQueue = queue; 34418 return; 34419 } 34420 } // Append the update to the end of the list. 34421 34422 34423 var lastBaseUpdate = queue.lastBaseUpdate; 34424 34425 if (lastBaseUpdate === null) { 34426 queue.firstBaseUpdate = capturedUpdate; 34427 } else { 34428 lastBaseUpdate.next = capturedUpdate; 34429 } 34430 34431 queue.lastBaseUpdate = capturedUpdate; 34432} 34433 34434function getStateFromUpdate(workInProgress, queue, update, prevState, nextProps, instance) { 34435 switch (update.tag) { 34436 case ReplaceState: 34437 { 34438 var payload = update.payload; 34439 34440 if (typeof payload === 'function') { 34441 // Updater function 34442 { 34443 enterDisallowedContextReadInDEV(); 34444 } 34445 34446 var nextState = payload.call(instance, prevState, nextProps); 34447 34448 { 34449 if ( workInProgress.mode & StrictLegacyMode) { 34450 setIsStrictModeForDevtools(true); 34451 34452 try { 34453 payload.call(instance, prevState, nextProps); 34454 } finally { 34455 setIsStrictModeForDevtools(false); 34456 } 34457 } 34458 34459 exitDisallowedContextReadInDEV(); 34460 } 34461 34462 return nextState; 34463 } // State object 34464 34465 34466 return payload; 34467 } 34468 34469 case CaptureUpdate: 34470 { 34471 workInProgress.flags = workInProgress.flags & ~ShouldCapture | DidCapture; 34472 } 34473 // Intentional fallthrough 34474 34475 case UpdateState: 34476 { 34477 var _payload = update.payload; 34478 var partialState; 34479 34480 if (typeof _payload === 'function') { 34481 // Updater function 34482 { 34483 enterDisallowedContextReadInDEV(); 34484 } 34485 34486 partialState = _payload.call(instance, prevState, nextProps); 34487 34488 { 34489 if ( workInProgress.mode & StrictLegacyMode) { 34490 setIsStrictModeForDevtools(true); 34491 34492 try { 34493 _payload.call(instance, prevState, nextProps); 34494 } finally { 34495 setIsStrictModeForDevtools(false); 34496 } 34497 } 34498 34499 exitDisallowedContextReadInDEV(); 34500 } 34501 } else { 34502 // Partial state object 34503 partialState = _payload; 34504 } 34505 34506 if (partialState === null || partialState === undefined) { 34507 // Null and undefined are treated as no-ops. 34508 return prevState; 34509 } // Merge the partial state and the previous state. 34510 34511 34512 return assign({}, prevState, partialState); 34513 } 34514 34515 case ForceUpdate: 34516 { 34517 hasForceUpdate = true; 34518 return prevState; 34519 } 34520 } 34521 34522 return prevState; 34523} 34524 34525function processUpdateQueue(workInProgress, props, instance, renderLanes) { 34526 // This is always non-null on a ClassComponent or HostRoot 34527 var queue = workInProgress.updateQueue; 34528 hasForceUpdate = false; 34529 34530 { 34531 currentlyProcessingQueue = queue.shared; 34532 } 34533 34534 var firstBaseUpdate = queue.firstBaseUpdate; 34535 var lastBaseUpdate = queue.lastBaseUpdate; // Check if there are pending updates. If so, transfer them to the base queue. 34536 34537 var pendingQueue = queue.shared.pending; 34538 34539 if (pendingQueue !== null) { 34540 queue.shared.pending = null; // The pending queue is circular. Disconnect the pointer between first 34541 // and last so that it's non-circular. 34542 34543 var lastPendingUpdate = pendingQueue; 34544 var firstPendingUpdate = lastPendingUpdate.next; 34545 lastPendingUpdate.next = null; // Append pending updates to base queue 34546 34547 if (lastBaseUpdate === null) { 34548 firstBaseUpdate = firstPendingUpdate; 34549 } else { 34550 lastBaseUpdate.next = firstPendingUpdate; 34551 } 34552 34553 lastBaseUpdate = lastPendingUpdate; // If there's a current queue, and it's different from the base queue, then 34554 // we need to transfer the updates to that queue, too. Because the base 34555 // queue is a singly-linked list with no cycles, we can append to both 34556 // lists and take advantage of structural sharing. 34557 // TODO: Pass `current` as argument 34558 34559 var current = workInProgress.alternate; 34560 34561 if (current !== null) { 34562 // This is always non-null on a ClassComponent or HostRoot 34563 var currentQueue = current.updateQueue; 34564 var currentLastBaseUpdate = currentQueue.lastBaseUpdate; 34565 34566 if (currentLastBaseUpdate !== lastBaseUpdate) { 34567 if (currentLastBaseUpdate === null) { 34568 currentQueue.firstBaseUpdate = firstPendingUpdate; 34569 } else { 34570 currentLastBaseUpdate.next = firstPendingUpdate; 34571 } 34572 34573 currentQueue.lastBaseUpdate = lastPendingUpdate; 34574 } 34575 } 34576 } // These values may change as we process the queue. 34577 34578 34579 if (firstBaseUpdate !== null) { 34580 // Iterate through the list of updates to compute the result. 34581 var newState = queue.baseState; // TODO: Don't need to accumulate this. Instead, we can remove renderLanes 34582 // from the original lanes. 34583 34584 var newLanes = NoLanes; 34585 var newBaseState = null; 34586 var newFirstBaseUpdate = null; 34587 var newLastBaseUpdate = null; 34588 var update = firstBaseUpdate; 34589 34590 do { 34591 var updateLane = update.lane; 34592 var updateEventTime = update.eventTime; 34593 34594 if (!isSubsetOfLanes(renderLanes, updateLane)) { 34595 // Priority is insufficient. Skip this update. If this is the first 34596 // skipped update, the previous update/state is the new base 34597 // update/state. 34598 var clone = { 34599 eventTime: updateEventTime, 34600 lane: updateLane, 34601 tag: update.tag, 34602 payload: update.payload, 34603 callback: update.callback, 34604 next: null 34605 }; 34606 34607 if (newLastBaseUpdate === null) { 34608 newFirstBaseUpdate = newLastBaseUpdate = clone; 34609 newBaseState = newState; 34610 } else { 34611 newLastBaseUpdate = newLastBaseUpdate.next = clone; 34612 } // Update the remaining priority in the queue. 34613 34614 34615 newLanes = mergeLanes(newLanes, updateLane); 34616 } else { 34617 // This update does have sufficient priority. 34618 if (newLastBaseUpdate !== null) { 34619 var _clone = { 34620 eventTime: updateEventTime, 34621 // This update is going to be committed so we never want uncommit 34622 // it. Using NoLane works because 0 is a subset of all bitmasks, so 34623 // this will never be skipped by the check above. 34624 lane: NoLane, 34625 tag: update.tag, 34626 payload: update.payload, 34627 callback: update.callback, 34628 next: null 34629 }; 34630 newLastBaseUpdate = newLastBaseUpdate.next = _clone; 34631 } // Process this update. 34632 34633 34634 newState = getStateFromUpdate(workInProgress, queue, update, newState, props, instance); 34635 var callback = update.callback; 34636 34637 if (callback !== null && // If the update was already committed, we should not queue its 34638 // callback again. 34639 update.lane !== NoLane) { 34640 workInProgress.flags |= Callback; 34641 var effects = queue.effects; 34642 34643 if (effects === null) { 34644 queue.effects = [update]; 34645 } else { 34646 effects.push(update); 34647 } 34648 } 34649 } 34650 34651 update = update.next; 34652 34653 if (update === null) { 34654 pendingQueue = queue.shared.pending; 34655 34656 if (pendingQueue === null) { 34657 break; 34658 } else { 34659 // An update was scheduled from inside a reducer. Add the new 34660 // pending updates to the end of the list and keep processing. 34661 var _lastPendingUpdate = pendingQueue; // Intentionally unsound. Pending updates form a circular list, but we 34662 // unravel them when transferring them to the base queue. 34663 34664 var _firstPendingUpdate = _lastPendingUpdate.next; 34665 _lastPendingUpdate.next = null; 34666 update = _firstPendingUpdate; 34667 queue.lastBaseUpdate = _lastPendingUpdate; 34668 queue.shared.pending = null; 34669 } 34670 } 34671 } while (true); 34672 34673 if (newLastBaseUpdate === null) { 34674 newBaseState = newState; 34675 } 34676 34677 queue.baseState = newBaseState; 34678 queue.firstBaseUpdate = newFirstBaseUpdate; 34679 queue.lastBaseUpdate = newLastBaseUpdate; // Interleaved updates are stored on a separate queue. We aren't going to 34680 // process them during this render, but we do need to track which lanes 34681 // are remaining. 34682 34683 var lastInterleaved = queue.shared.interleaved; 34684 34685 if (lastInterleaved !== null) { 34686 var interleaved = lastInterleaved; 34687 34688 do { 34689 newLanes = mergeLanes(newLanes, interleaved.lane); 34690 interleaved = interleaved.next; 34691 } while (interleaved !== lastInterleaved); 34692 } else if (firstBaseUpdate === null) { 34693 // `queue.lanes` is used for entangling transitions. We can set it back to 34694 // zero once the queue is empty. 34695 queue.shared.lanes = NoLanes; 34696 } // Set the remaining expiration time to be whatever is remaining in the queue. 34697 // This should be fine because the only two other things that contribute to 34698 // expiration time are props and context. We're already in the middle of the 34699 // begin phase by the time we start processing the queue, so we've already 34700 // dealt with the props. Context in components that specify 34701 // shouldComponentUpdate is tricky; but we'll have to account for 34702 // that regardless. 34703 34704 34705 markSkippedUpdateLanes(newLanes); 34706 workInProgress.lanes = newLanes; 34707 workInProgress.memoizedState = newState; 34708 } 34709 34710 { 34711 currentlyProcessingQueue = null; 34712 } 34713} 34714 34715function callCallback(callback, context) { 34716 if (typeof callback !== 'function') { 34717 throw new Error('Invalid argument passed as callback. Expected a function. Instead ' + ("received: " + callback)); 34718 } 34719 34720 callback.call(context); 34721} 34722 34723function resetHasForceUpdateBeforeProcessing() { 34724 hasForceUpdate = false; 34725} 34726function checkHasForceUpdateAfterProcessing() { 34727 return hasForceUpdate; 34728} 34729function commitUpdateQueue(finishedWork, finishedQueue, instance) { 34730 // Commit the effects 34731 var effects = finishedQueue.effects; 34732 finishedQueue.effects = null; 34733 34734 if (effects !== null) { 34735 for (var i = 0; i < effects.length; i++) { 34736 var effect = effects[i]; 34737 var callback = effect.callback; 34738 34739 if (callback !== null) { 34740 effect.callback = null; 34741 callCallback(callback, instance); 34742 } 34743 } 34744 } 34745} 34746 34747var NO_CONTEXT = {}; 34748var contextStackCursor$1 = createCursor(NO_CONTEXT); 34749var contextFiberStackCursor = createCursor(NO_CONTEXT); 34750var rootInstanceStackCursor = createCursor(NO_CONTEXT); 34751 34752function requiredContext(c) { 34753 if (c === NO_CONTEXT) { 34754 throw new Error('Expected host context to exist. This error is likely caused by a bug ' + 'in React. Please file an issue.'); 34755 } 34756 34757 return c; 34758} 34759 34760function getRootHostContainer() { 34761 var rootInstance = requiredContext(rootInstanceStackCursor.current); 34762 return rootInstance; 34763} 34764 34765function pushHostContainer(fiber, nextRootInstance) { 34766 // Push current root instance onto the stack; 34767 // This allows us to reset root when portals are popped. 34768 push(rootInstanceStackCursor, nextRootInstance, fiber); // Track the context and the Fiber that provided it. 34769 // This enables us to pop only Fibers that provide unique contexts. 34770 34771 push(contextFiberStackCursor, fiber, fiber); // Finally, we need to push the host context to the stack. 34772 // However, we can't just call getRootHostContext() and push it because 34773 // we'd have a different number of entries on the stack depending on 34774 // whether getRootHostContext() throws somewhere in renderer code or not. 34775 // So we push an empty value first. This lets us safely unwind on errors. 34776 34777 push(contextStackCursor$1, NO_CONTEXT, fiber); 34778 var nextRootContext = getRootHostContext(nextRootInstance); // Now that we know this function doesn't throw, replace it. 34779 34780 pop(contextStackCursor$1, fiber); 34781 push(contextStackCursor$1, nextRootContext, fiber); 34782} 34783 34784function popHostContainer(fiber) { 34785 pop(contextStackCursor$1, fiber); 34786 pop(contextFiberStackCursor, fiber); 34787 pop(rootInstanceStackCursor, fiber); 34788} 34789 34790function getHostContext() { 34791 var context = requiredContext(contextStackCursor$1.current); 34792 return context; 34793} 34794 34795function pushHostContext(fiber) { 34796 var rootInstance = requiredContext(rootInstanceStackCursor.current); 34797 var context = requiredContext(contextStackCursor$1.current); 34798 var nextContext = getChildHostContext(context, fiber.type); // Don't push this Fiber's context unless it's unique. 34799 34800 if (context === nextContext) { 34801 return; 34802 } // Track the context and the Fiber that provided it. 34803 // This enables us to pop only Fibers that provide unique contexts. 34804 34805 34806 push(contextFiberStackCursor, fiber, fiber); 34807 push(contextStackCursor$1, nextContext, fiber); 34808} 34809 34810function popHostContext(fiber) { 34811 // Do not pop unless this Fiber provided the current context. 34812 // pushHostContext() only pushes Fibers that provide unique contexts. 34813 if (contextFiberStackCursor.current !== fiber) { 34814 return; 34815 } 34816 34817 pop(contextStackCursor$1, fiber); 34818 pop(contextFiberStackCursor, fiber); 34819} 34820 34821var DefaultSuspenseContext = 0; // The Suspense Context is split into two parts. The lower bits is 34822// inherited deeply down the subtree. The upper bits only affect 34823// this immediate suspense boundary and gets reset each new 34824// boundary or suspense list. 34825 34826var SubtreeSuspenseContextMask = 1; // Subtree Flags: 34827// InvisibleParentSuspenseContext indicates that one of our parent Suspense 34828// boundaries is not currently showing visible main content. 34829// Either because it is already showing a fallback or is not mounted at all. 34830// We can use this to determine if it is desirable to trigger a fallback at 34831// the parent. If not, then we might need to trigger undesirable boundaries 34832// and/or suspend the commit to avoid hiding the parent content. 34833 34834var InvisibleParentSuspenseContext = 1; // Shallow Flags: 34835// ForceSuspenseFallback can be used by SuspenseList to force newly added 34836// items into their fallback state during one of the render passes. 34837 34838var ForceSuspenseFallback = 2; 34839var suspenseStackCursor = createCursor(DefaultSuspenseContext); 34840function hasSuspenseContext(parentContext, flag) { 34841 return (parentContext & flag) !== 0; 34842} 34843function setDefaultShallowSuspenseContext(parentContext) { 34844 return parentContext & SubtreeSuspenseContextMask; 34845} 34846function setShallowSuspenseContext(parentContext, shallowContext) { 34847 return parentContext & SubtreeSuspenseContextMask | shallowContext; 34848} 34849function addSubtreeSuspenseContext(parentContext, subtreeContext) { 34850 return parentContext | subtreeContext; 34851} 34852function pushSuspenseContext(fiber, newContext) { 34853 push(suspenseStackCursor, newContext, fiber); 34854} 34855function popSuspenseContext(fiber) { 34856 pop(suspenseStackCursor, fiber); 34857} 34858 34859function shouldCaptureSuspense(workInProgress, hasInvisibleParent) { 34860 // If it was the primary children that just suspended, capture and render the 34861 // fallback. Otherwise, don't capture and bubble to the next boundary. 34862 var nextState = workInProgress.memoizedState; 34863 34864 if (nextState !== null) { 34865 if (nextState.dehydrated !== null) { 34866 // A dehydrated boundary always captures. 34867 return true; 34868 } 34869 34870 return false; 34871 } 34872 34873 var props = workInProgress.memoizedProps; // Regular boundaries always capture. 34874 34875 { 34876 return true; 34877 } // If it's a boundary we should avoid, then we prefer to bubble up to the 34878} 34879function findFirstSuspended(row) { 34880 var node = row; 34881 34882 while (node !== null) { 34883 if (node.tag === SuspenseComponent) { 34884 var state = node.memoizedState; 34885 34886 if (state !== null) { 34887 var dehydrated = state.dehydrated; 34888 34889 if (dehydrated === null || isSuspenseInstancePending(dehydrated) || isSuspenseInstanceFallback(dehydrated)) { 34890 return node; 34891 } 34892 } 34893 } else if (node.tag === SuspenseListComponent && // revealOrder undefined can't be trusted because it don't 34894 // keep track of whether it suspended or not. 34895 node.memoizedProps.revealOrder !== undefined) { 34896 var didSuspend = (node.flags & DidCapture) !== NoFlags; 34897 34898 if (didSuspend) { 34899 return node; 34900 } 34901 } else if (node.child !== null) { 34902 node.child.return = node; 34903 node = node.child; 34904 continue; 34905 } 34906 34907 if (node === row) { 34908 return null; 34909 } 34910 34911 while (node.sibling === null) { 34912 if (node.return === null || node.return === row) { 34913 return null; 34914 } 34915 34916 node = node.return; 34917 } 34918 34919 node.sibling.return = node.return; 34920 node = node.sibling; 34921 } 34922 34923 return null; 34924} 34925 34926var NoFlags$1 = 34927/* */ 349280; // Represents whether effect should fire. 34929 34930var HasEffect = 34931/* */ 349321; // Represents the phase in which the effect (not the clean-up) fires. 34933 34934var Insertion = 34935/* */ 349362; 34937var Layout = 34938/* */ 349394; 34940var Passive$1 = 34941/* */ 349428; 34943 34944// and should be reset before starting a new render. 34945// This tracks which mutable sources need to be reset after a render. 34946 34947var workInProgressSources = []; 34948function resetWorkInProgressVersions() { 34949 for (var i = 0; i < workInProgressSources.length; i++) { 34950 var mutableSource = workInProgressSources[i]; 34951 34952 { 34953 mutableSource._workInProgressVersionPrimary = null; 34954 } 34955 } 34956 34957 workInProgressSources.length = 0; 34958} 34959// This ensures that the version used for server rendering matches the one 34960// that is eventually read during hydration. 34961// If they don't match there's a potential tear and a full deopt render is required. 34962 34963function registerMutableSourceForHydration(root, mutableSource) { 34964 var getVersion = mutableSource._getVersion; 34965 var version = getVersion(mutableSource._source); // TODO Clear this data once all pending hydration work is finished. 34966 // Retaining it forever may interfere with GC. 34967 34968 if (root.mutableSourceEagerHydrationData == null) { 34969 root.mutableSourceEagerHydrationData = [mutableSource, version]; 34970 } else { 34971 root.mutableSourceEagerHydrationData.push(mutableSource, version); 34972 } 34973} 34974 34975var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher, 34976 ReactCurrentBatchConfig$2 = ReactSharedInternals.ReactCurrentBatchConfig; 34977var didWarnAboutMismatchedHooksForComponent; 34978var didWarnUncachedGetSnapshot; 34979 34980{ 34981 didWarnAboutMismatchedHooksForComponent = new Set(); 34982} 34983 34984// These are set right before calling the component. 34985var renderLanes = NoLanes; // The work-in-progress fiber. I've named it differently to distinguish it from 34986// the work-in-progress hook. 34987 34988var currentlyRenderingFiber$1 = null; // Hooks are stored as a linked list on the fiber's memoizedState field. The 34989// current hook list is the list that belongs to the current fiber. The 34990// work-in-progress hook list is a new list that will be added to the 34991// work-in-progress fiber. 34992 34993var currentHook = null; 34994var workInProgressHook = null; // Whether an update was scheduled at any point during the render phase. This 34995// does not get reset if we do another render pass; only when we're completely 34996// finished evaluating this component. This is an optimization so we know 34997// whether we need to clear render phase updates after a throw. 34998 34999var didScheduleRenderPhaseUpdate = false; // Where an update was scheduled only during the current render pass. This 35000// gets reset after each attempt. 35001// TODO: Maybe there's some way to consolidate this with 35002// `didScheduleRenderPhaseUpdate`. Or with `numberOfReRenders`. 35003 35004var didScheduleRenderPhaseUpdateDuringThisPass = false; // Counts the number of useId hooks in this component. 35005 35006var localIdCounter = 0; // Used for ids that are generated completely client-side (i.e. not during 35007// hydration). This counter is global, so client ids are not stable across 35008// render attempts. 35009 35010var globalClientIdCounter = 0; 35011var RE_RENDER_LIMIT = 25; // In DEV, this is the name of the currently executing primitive hook 35012 35013var currentHookNameInDev = null; // In DEV, this list ensures that hooks are called in the same order between renders. 35014// The list stores the order of hooks used during the initial render (mount). 35015// Subsequent renders (updates) reference this list. 35016 35017var hookTypesDev = null; 35018var hookTypesUpdateIndexDev = -1; // In DEV, this tracks whether currently rendering component needs to ignore 35019// the dependencies for Hooks that need them (e.g. useEffect or useMemo). 35020// When true, such Hooks will always be "remounted". Only used during hot reload. 35021 35022var ignorePreviousDependencies = false; 35023 35024function mountHookTypesDev() { 35025 { 35026 var hookName = currentHookNameInDev; 35027 35028 if (hookTypesDev === null) { 35029 hookTypesDev = [hookName]; 35030 } else { 35031 hookTypesDev.push(hookName); 35032 } 35033 } 35034} 35035 35036function updateHookTypesDev() { 35037 { 35038 var hookName = currentHookNameInDev; 35039 35040 if (hookTypesDev !== null) { 35041 hookTypesUpdateIndexDev++; 35042 35043 if (hookTypesDev[hookTypesUpdateIndexDev] !== hookName) { 35044 warnOnHookMismatchInDev(hookName); 35045 } 35046 } 35047 } 35048} 35049 35050function checkDepsAreArrayDev(deps) { 35051 { 35052 if (deps !== undefined && deps !== null && !isArray(deps)) { 35053 // Verify deps, but only on mount to avoid extra checks. 35054 // It's unlikely their type would change as usually you define them inline. 35055 error('%s received a final argument that is not an array (instead, received `%s`). When ' + 'specified, the final argument must be an array.', currentHookNameInDev, typeof deps); 35056 } 35057 } 35058} 35059 35060function warnOnHookMismatchInDev(currentHookName) { 35061 { 35062 var componentName = getComponentNameFromFiber(currentlyRenderingFiber$1); 35063 35064 if (!didWarnAboutMismatchedHooksForComponent.has(componentName)) { 35065 didWarnAboutMismatchedHooksForComponent.add(componentName); 35066 35067 if (hookTypesDev !== null) { 35068 var table = ''; 35069 var secondColumnStart = 30; 35070 35071 for (var i = 0; i <= hookTypesUpdateIndexDev; i++) { 35072 var oldHookName = hookTypesDev[i]; 35073 var newHookName = i === hookTypesUpdateIndexDev ? currentHookName : oldHookName; 35074 var row = i + 1 + ". " + oldHookName; // Extra space so second column lines up 35075 // lol @ IE not supporting String#repeat 35076 35077 while (row.length < secondColumnStart) { 35078 row += ' '; 35079 } 35080 35081 row += newHookName + '\n'; 35082 table += row; 35083 } 35084 35085 error('React has detected a change in the order of Hooks called by %s. ' + 'This will lead to bugs and errors if not fixed. ' + 'For more information, read the Rules of Hooks: https://reactjs.org/link/rules-of-hooks\n\n' + ' Previous render Next render\n' + ' ------------------------------------------------------\n' + '%s' + ' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n', componentName, table); 35086 } 35087 } 35088 } 35089} 35090 35091function throwInvalidHookError() { 35092 throw new Error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.'); 35093} 35094 35095function areHookInputsEqual(nextDeps, prevDeps) { 35096 { 35097 if (ignorePreviousDependencies) { 35098 // Only true when this component is being hot reloaded. 35099 return false; 35100 } 35101 } 35102 35103 if (prevDeps === null) { 35104 { 35105 error('%s received a final argument during this render, but not during ' + 'the previous render. Even though the final argument is optional, ' + 'its type cannot change between renders.', currentHookNameInDev); 35106 } 35107 35108 return false; 35109 } 35110 35111 { 35112 // Don't bother comparing lengths in prod because these arrays should be 35113 // passed inline. 35114 if (nextDeps.length !== prevDeps.length) { 35115 error('The final argument passed to %s changed size between renders. The ' + 'order and size of this array must remain constant.\n\n' + 'Previous: %s\n' + 'Incoming: %s', currentHookNameInDev, "[" + prevDeps.join(', ') + "]", "[" + nextDeps.join(', ') + "]"); 35116 } 35117 } 35118 35119 for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++) { 35120 if (objectIs(nextDeps[i], prevDeps[i])) { 35121 continue; 35122 } 35123 35124 return false; 35125 } 35126 35127 return true; 35128} 35129 35130function renderWithHooks(current, workInProgress, Component, props, secondArg, nextRenderLanes) { 35131 renderLanes = nextRenderLanes; 35132 currentlyRenderingFiber$1 = workInProgress; 35133 35134 { 35135 hookTypesDev = current !== null ? current._debugHookTypes : null; 35136 hookTypesUpdateIndexDev = -1; // Used for hot reloading: 35137 35138 ignorePreviousDependencies = current !== null && current.type !== workInProgress.type; 35139 } 35140 35141 workInProgress.memoizedState = null; 35142 workInProgress.updateQueue = null; 35143 workInProgress.lanes = NoLanes; // The following should have already been reset 35144 // currentHook = null; 35145 // workInProgressHook = null; 35146 // didScheduleRenderPhaseUpdate = false; 35147 // localIdCounter = 0; 35148 // TODO Warn if no hooks are used at all during mount, then some are used during update. 35149 // Currently we will identify the update render as a mount because memoizedState === null. 35150 // This is tricky because it's valid for certain types of components (e.g. React.lazy) 35151 // Using memoizedState to differentiate between mount/update only works if at least one stateful hook is used. 35152 // Non-stateful hooks (e.g. context) don't get added to memoizedState, 35153 // so memoizedState would be null during updates and mounts. 35154 35155 { 35156 if (current !== null && current.memoizedState !== null) { 35157 ReactCurrentDispatcher$1.current = HooksDispatcherOnUpdateInDEV; 35158 } else if (hookTypesDev !== null) { 35159 // This dispatcher handles an edge case where a component is updating, 35160 // but no stateful hooks have been used. 35161 // We want to match the production code behavior (which will use HooksDispatcherOnMount), 35162 // but with the extra DEV validation to ensure hooks ordering hasn't changed. 35163 // This dispatcher does that. 35164 ReactCurrentDispatcher$1.current = HooksDispatcherOnMountWithHookTypesInDEV; 35165 } else { 35166 ReactCurrentDispatcher$1.current = HooksDispatcherOnMountInDEV; 35167 } 35168 } 35169 35170 var children = Component(props, secondArg); // Check if there was a render phase update 35171 35172 if (didScheduleRenderPhaseUpdateDuringThisPass) { 35173 // Keep rendering in a loop for as long as render phase updates continue to 35174 // be scheduled. Use a counter to prevent infinite loops. 35175 var numberOfReRenders = 0; 35176 35177 do { 35178 didScheduleRenderPhaseUpdateDuringThisPass = false; 35179 localIdCounter = 0; 35180 35181 if (numberOfReRenders >= RE_RENDER_LIMIT) { 35182 throw new Error('Too many re-renders. React limits the number of renders to prevent ' + 'an infinite loop.'); 35183 } 35184 35185 numberOfReRenders += 1; 35186 35187 { 35188 // Even when hot reloading, allow dependencies to stabilize 35189 // after first render to prevent infinite render phase updates. 35190 ignorePreviousDependencies = false; 35191 } // Start over from the beginning of the list 35192 35193 35194 currentHook = null; 35195 workInProgressHook = null; 35196 workInProgress.updateQueue = null; 35197 35198 { 35199 // Also validate hook order for cascading updates. 35200 hookTypesUpdateIndexDev = -1; 35201 } 35202 35203 ReactCurrentDispatcher$1.current = HooksDispatcherOnRerenderInDEV ; 35204 children = Component(props, secondArg); 35205 } while (didScheduleRenderPhaseUpdateDuringThisPass); 35206 } // We can assume the previous dispatcher is always this one, since we set it 35207 // at the beginning of the render phase and there's no re-entrance. 35208 35209 35210 ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; 35211 35212 { 35213 workInProgress._debugHookTypes = hookTypesDev; 35214 } // This check uses currentHook so that it works the same in DEV and prod bundles. 35215 // hookTypesDev could catch more cases (e.g. context) but only in DEV bundles. 35216 35217 35218 var didRenderTooFewHooks = currentHook !== null && currentHook.next !== null; 35219 renderLanes = NoLanes; 35220 currentlyRenderingFiber$1 = null; 35221 currentHook = null; 35222 workInProgressHook = null; 35223 35224 { 35225 currentHookNameInDev = null; 35226 hookTypesDev = null; 35227 hookTypesUpdateIndexDev = -1; // Confirm that a static flag was not added or removed since the last 35228 // render. If this fires, it suggests that we incorrectly reset the static 35229 // flags in some other part of the codebase. This has happened before, for 35230 // example, in the SuspenseList implementation. 35231 35232 if (current !== null && (current.flags & StaticMask) !== (workInProgress.flags & StaticMask) && // Disable this warning in legacy mode, because legacy Suspense is weird 35233 // and creates false positives. To make this work in legacy mode, we'd 35234 // need to mark fibers that commit in an incomplete state, somehow. For 35235 // now I'll disable the warning that most of the bugs that would trigger 35236 // it are either exclusive to concurrent mode or exist in both. 35237 (current.mode & ConcurrentMode) !== NoMode) { 35238 error('Internal React error: Expected static flag was missing. Please ' + 'notify the React team.'); 35239 } 35240 } 35241 35242 didScheduleRenderPhaseUpdate = false; // This is reset by checkDidRenderIdHook 35243 // localIdCounter = 0; 35244 35245 if (didRenderTooFewHooks) { 35246 throw new Error('Rendered fewer hooks than expected. This may be caused by an accidental ' + 'early return statement.'); 35247 } 35248 35249 return children; 35250} 35251function checkDidRenderIdHook() { 35252 // This should be called immediately after every renderWithHooks call. 35253 // Conceptually, it's part of the return value of renderWithHooks; it's only a 35254 // separate function to avoid using an array tuple. 35255 var didRenderIdHook = localIdCounter !== 0; 35256 localIdCounter = 0; 35257 return didRenderIdHook; 35258} 35259function bailoutHooks(current, workInProgress, lanes) { 35260 workInProgress.updateQueue = current.updateQueue; // TODO: Don't need to reset the flags here, because they're reset in the 35261 // complete phase (bubbleProperties). 35262 35263 if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { 35264 workInProgress.flags &= ~(MountPassiveDev | MountLayoutDev | Passive | Update); 35265 } else { 35266 workInProgress.flags &= ~(Passive | Update); 35267 } 35268 35269 current.lanes = removeLanes(current.lanes, lanes); 35270} 35271function resetHooksAfterThrow() { 35272 // We can assume the previous dispatcher is always this one, since we set it 35273 // at the beginning of the render phase and there's no re-entrance. 35274 ReactCurrentDispatcher$1.current = ContextOnlyDispatcher; 35275 35276 if (didScheduleRenderPhaseUpdate) { 35277 // There were render phase updates. These are only valid for this render 35278 // phase, which we are now aborting. Remove the updates from the queues so 35279 // they do not persist to the next render. Do not remove updates from hooks 35280 // that weren't processed. 35281 // 35282 // Only reset the updates from the queue if it has a clone. If it does 35283 // not have a clone, that means it wasn't processed, and the updates were 35284 // scheduled before we entered the render phase. 35285 var hook = currentlyRenderingFiber$1.memoizedState; 35286 35287 while (hook !== null) { 35288 var queue = hook.queue; 35289 35290 if (queue !== null) { 35291 queue.pending = null; 35292 } 35293 35294 hook = hook.next; 35295 } 35296 35297 didScheduleRenderPhaseUpdate = false; 35298 } 35299 35300 renderLanes = NoLanes; 35301 currentlyRenderingFiber$1 = null; 35302 currentHook = null; 35303 workInProgressHook = null; 35304 35305 { 35306 hookTypesDev = null; 35307 hookTypesUpdateIndexDev = -1; 35308 currentHookNameInDev = null; 35309 isUpdatingOpaqueValueInRenderPhase = false; 35310 } 35311 35312 didScheduleRenderPhaseUpdateDuringThisPass = false; 35313 localIdCounter = 0; 35314} 35315 35316function mountWorkInProgressHook() { 35317 var hook = { 35318 memoizedState: null, 35319 baseState: null, 35320 baseQueue: null, 35321 queue: null, 35322 next: null 35323 }; 35324 35325 if (workInProgressHook === null) { 35326 // This is the first hook in the list 35327 currentlyRenderingFiber$1.memoizedState = workInProgressHook = hook; 35328 } else { 35329 // Append to the end of the list 35330 workInProgressHook = workInProgressHook.next = hook; 35331 } 35332 35333 return workInProgressHook; 35334} 35335 35336function updateWorkInProgressHook() { 35337 // This function is used both for updates and for re-renders triggered by a 35338 // render phase update. It assumes there is either a current hook we can 35339 // clone, or a work-in-progress hook from a previous render pass that we can 35340 // use as a base. When we reach the end of the base list, we must switch to 35341 // the dispatcher used for mounts. 35342 var nextCurrentHook; 35343 35344 if (currentHook === null) { 35345 var current = currentlyRenderingFiber$1.alternate; 35346 35347 if (current !== null) { 35348 nextCurrentHook = current.memoizedState; 35349 } else { 35350 nextCurrentHook = null; 35351 } 35352 } else { 35353 nextCurrentHook = currentHook.next; 35354 } 35355 35356 var nextWorkInProgressHook; 35357 35358 if (workInProgressHook === null) { 35359 nextWorkInProgressHook = currentlyRenderingFiber$1.memoizedState; 35360 } else { 35361 nextWorkInProgressHook = workInProgressHook.next; 35362 } 35363 35364 if (nextWorkInProgressHook !== null) { 35365 // There's already a work-in-progress. Reuse it. 35366 workInProgressHook = nextWorkInProgressHook; 35367 nextWorkInProgressHook = workInProgressHook.next; 35368 currentHook = nextCurrentHook; 35369 } else { 35370 // Clone from the current hook. 35371 if (nextCurrentHook === null) { 35372 throw new Error('Rendered more hooks than during the previous render.'); 35373 } 35374 35375 currentHook = nextCurrentHook; 35376 var newHook = { 35377 memoizedState: currentHook.memoizedState, 35378 baseState: currentHook.baseState, 35379 baseQueue: currentHook.baseQueue, 35380 queue: currentHook.queue, 35381 next: null 35382 }; 35383 35384 if (workInProgressHook === null) { 35385 // This is the first hook in the list. 35386 currentlyRenderingFiber$1.memoizedState = workInProgressHook = newHook; 35387 } else { 35388 // Append to the end of the list. 35389 workInProgressHook = workInProgressHook.next = newHook; 35390 } 35391 } 35392 35393 return workInProgressHook; 35394} 35395 35396function createFunctionComponentUpdateQueue() { 35397 return { 35398 lastEffect: null, 35399 stores: null 35400 }; 35401} 35402 35403function basicStateReducer(state, action) { 35404 // $FlowFixMe: Flow doesn't like mixed types 35405 return typeof action === 'function' ? action(state) : action; 35406} 35407 35408function mountReducer(reducer, initialArg, init) { 35409 var hook = mountWorkInProgressHook(); 35410 var initialState; 35411 35412 if (init !== undefined) { 35413 initialState = init(initialArg); 35414 } else { 35415 initialState = initialArg; 35416 } 35417 35418 hook.memoizedState = hook.baseState = initialState; 35419 var queue = { 35420 pending: null, 35421 interleaved: null, 35422 lanes: NoLanes, 35423 dispatch: null, 35424 lastRenderedReducer: reducer, 35425 lastRenderedState: initialState 35426 }; 35427 hook.queue = queue; 35428 var dispatch = queue.dispatch = dispatchReducerAction.bind(null, currentlyRenderingFiber$1, queue); 35429 return [hook.memoizedState, dispatch]; 35430} 35431 35432function updateReducer(reducer, initialArg, init) { 35433 var hook = updateWorkInProgressHook(); 35434 var queue = hook.queue; 35435 35436 if (queue === null) { 35437 throw new Error('Should have a queue. This is likely a bug in React. Please file an issue.'); 35438 } 35439 35440 queue.lastRenderedReducer = reducer; 35441 var current = currentHook; // The last rebase update that is NOT part of the base state. 35442 35443 var baseQueue = current.baseQueue; // The last pending update that hasn't been processed yet. 35444 35445 var pendingQueue = queue.pending; 35446 35447 if (pendingQueue !== null) { 35448 // We have new updates that haven't been processed yet. 35449 // We'll add them to the base queue. 35450 if (baseQueue !== null) { 35451 // Merge the pending queue and the base queue. 35452 var baseFirst = baseQueue.next; 35453 var pendingFirst = pendingQueue.next; 35454 baseQueue.next = pendingFirst; 35455 pendingQueue.next = baseFirst; 35456 } 35457 35458 { 35459 if (current.baseQueue !== baseQueue) { 35460 // Internal invariant that should never happen, but feasibly could in 35461 // the future if we implement resuming, or some form of that. 35462 error('Internal error: Expected work-in-progress queue to be a clone. ' + 'This is a bug in React.'); 35463 } 35464 } 35465 35466 current.baseQueue = baseQueue = pendingQueue; 35467 queue.pending = null; 35468 } 35469 35470 if (baseQueue !== null) { 35471 // We have a queue to process. 35472 var first = baseQueue.next; 35473 var newState = current.baseState; 35474 var newBaseState = null; 35475 var newBaseQueueFirst = null; 35476 var newBaseQueueLast = null; 35477 var update = first; 35478 35479 do { 35480 var updateLane = update.lane; 35481 35482 if (!isSubsetOfLanes(renderLanes, updateLane)) { 35483 // Priority is insufficient. Skip this update. If this is the first 35484 // skipped update, the previous update/state is the new base 35485 // update/state. 35486 var clone = { 35487 lane: updateLane, 35488 action: update.action, 35489 hasEagerState: update.hasEagerState, 35490 eagerState: update.eagerState, 35491 next: null 35492 }; 35493 35494 if (newBaseQueueLast === null) { 35495 newBaseQueueFirst = newBaseQueueLast = clone; 35496 newBaseState = newState; 35497 } else { 35498 newBaseQueueLast = newBaseQueueLast.next = clone; 35499 } // Update the remaining priority in the queue. 35500 // TODO: Don't need to accumulate this. Instead, we can remove 35501 // renderLanes from the original lanes. 35502 35503 35504 currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, updateLane); 35505 markSkippedUpdateLanes(updateLane); 35506 } else { 35507 // This update does have sufficient priority. 35508 if (newBaseQueueLast !== null) { 35509 var _clone = { 35510 // This update is going to be committed so we never want uncommit 35511 // it. Using NoLane works because 0 is a subset of all bitmasks, so 35512 // this will never be skipped by the check above. 35513 lane: NoLane, 35514 action: update.action, 35515 hasEagerState: update.hasEagerState, 35516 eagerState: update.eagerState, 35517 next: null 35518 }; 35519 newBaseQueueLast = newBaseQueueLast.next = _clone; 35520 } // Process this update. 35521 35522 35523 if (update.hasEagerState) { 35524 // If this update is a state update (not a reducer) and was processed eagerly, 35525 // we can use the eagerly computed state 35526 newState = update.eagerState; 35527 } else { 35528 var action = update.action; 35529 newState = reducer(newState, action); 35530 } 35531 } 35532 35533 update = update.next; 35534 } while (update !== null && update !== first); 35535 35536 if (newBaseQueueLast === null) { 35537 newBaseState = newState; 35538 } else { 35539 newBaseQueueLast.next = newBaseQueueFirst; 35540 } // Mark that the fiber performed work, but only if the new state is 35541 // different from the current state. 35542 35543 35544 if (!objectIs(newState, hook.memoizedState)) { 35545 markWorkInProgressReceivedUpdate(); 35546 } 35547 35548 hook.memoizedState = newState; 35549 hook.baseState = newBaseState; 35550 hook.baseQueue = newBaseQueueLast; 35551 queue.lastRenderedState = newState; 35552 } // Interleaved updates are stored on a separate queue. We aren't going to 35553 // process them during this render, but we do need to track which lanes 35554 // are remaining. 35555 35556 35557 var lastInterleaved = queue.interleaved; 35558 35559 if (lastInterleaved !== null) { 35560 var interleaved = lastInterleaved; 35561 35562 do { 35563 var interleavedLane = interleaved.lane; 35564 currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, interleavedLane); 35565 markSkippedUpdateLanes(interleavedLane); 35566 interleaved = interleaved.next; 35567 } while (interleaved !== lastInterleaved); 35568 } else if (baseQueue === null) { 35569 // `queue.lanes` is used for entangling transitions. We can set it back to 35570 // zero once the queue is empty. 35571 queue.lanes = NoLanes; 35572 } 35573 35574 var dispatch = queue.dispatch; 35575 return [hook.memoizedState, dispatch]; 35576} 35577 35578function rerenderReducer(reducer, initialArg, init) { 35579 var hook = updateWorkInProgressHook(); 35580 var queue = hook.queue; 35581 35582 if (queue === null) { 35583 throw new Error('Should have a queue. This is likely a bug in React. Please file an issue.'); 35584 } 35585 35586 queue.lastRenderedReducer = reducer; // This is a re-render. Apply the new render phase updates to the previous 35587 // work-in-progress hook. 35588 35589 var dispatch = queue.dispatch; 35590 var lastRenderPhaseUpdate = queue.pending; 35591 var newState = hook.memoizedState; 35592 35593 if (lastRenderPhaseUpdate !== null) { 35594 // The queue doesn't persist past this render pass. 35595 queue.pending = null; 35596 var firstRenderPhaseUpdate = lastRenderPhaseUpdate.next; 35597 var update = firstRenderPhaseUpdate; 35598 35599 do { 35600 // Process this render phase update. We don't have to check the 35601 // priority because it will always be the same as the current 35602 // render's. 35603 var action = update.action; 35604 newState = reducer(newState, action); 35605 update = update.next; 35606 } while (update !== firstRenderPhaseUpdate); // Mark that the fiber performed work, but only if the new state is 35607 // different from the current state. 35608 35609 35610 if (!objectIs(newState, hook.memoizedState)) { 35611 markWorkInProgressReceivedUpdate(); 35612 } 35613 35614 hook.memoizedState = newState; // Don't persist the state accumulated from the render phase updates to 35615 // the base state unless the queue is empty. 35616 // TODO: Not sure if this is the desired semantics, but it's what we 35617 // do for gDSFP. I can't remember why. 35618 35619 if (hook.baseQueue === null) { 35620 hook.baseState = newState; 35621 } 35622 35623 queue.lastRenderedState = newState; 35624 } 35625 35626 return [newState, dispatch]; 35627} 35628 35629function mountMutableSource(source, getSnapshot, subscribe) { 35630 { 35631 return undefined; 35632 } 35633} 35634 35635function updateMutableSource(source, getSnapshot, subscribe) { 35636 { 35637 return undefined; 35638 } 35639} 35640 35641function mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { 35642 var fiber = currentlyRenderingFiber$1; 35643 var hook = mountWorkInProgressHook(); 35644 var nextSnapshot; 35645 var isHydrating = getIsHydrating(); 35646 35647 if (isHydrating) { 35648 if (getServerSnapshot === undefined) { 35649 throw new Error('Missing getServerSnapshot, which is required for ' + 'server-rendered content. Will revert to client rendering.'); 35650 } 35651 35652 nextSnapshot = getServerSnapshot(); 35653 35654 { 35655 if (!didWarnUncachedGetSnapshot) { 35656 if (nextSnapshot !== getServerSnapshot()) { 35657 error('The result of getServerSnapshot should be cached to avoid an infinite loop'); 35658 35659 didWarnUncachedGetSnapshot = true; 35660 } 35661 } 35662 } 35663 } else { 35664 nextSnapshot = getSnapshot(); 35665 35666 { 35667 if (!didWarnUncachedGetSnapshot) { 35668 var cachedSnapshot = getSnapshot(); 35669 35670 if (!objectIs(nextSnapshot, cachedSnapshot)) { 35671 error('The result of getSnapshot should be cached to avoid an infinite loop'); 35672 35673 didWarnUncachedGetSnapshot = true; 35674 } 35675 } 35676 } // Unless we're rendering a blocking lane, schedule a consistency check. 35677 // Right before committing, we will walk the tree and check if any of the 35678 // stores were mutated. 35679 // 35680 // We won't do this if we're hydrating server-rendered content, because if 35681 // the content is stale, it's already visible anyway. Instead we'll patch 35682 // it up in a passive effect. 35683 35684 35685 var root = getWorkInProgressRoot(); 35686 35687 if (root === null) { 35688 throw new Error('Expected a work-in-progress root. This is a bug in React. Please file an issue.'); 35689 } 35690 35691 if (!includesBlockingLane(root, renderLanes)) { 35692 pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); 35693 } 35694 } // Read the current snapshot from the store on every render. This breaks the 35695 // normal rules of React, and only works because store updates are 35696 // always synchronous. 35697 35698 35699 hook.memoizedState = nextSnapshot; 35700 var inst = { 35701 value: nextSnapshot, 35702 getSnapshot: getSnapshot 35703 }; 35704 hook.queue = inst; // Schedule an effect to subscribe to the store. 35705 35706 mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); // Schedule an effect to update the mutable instance fields. We will update 35707 // this whenever subscribe, getSnapshot, or value changes. Because there's no 35708 // clean-up function, and we track the deps correctly, we can call pushEffect 35709 // directly, without storing any additional state. For the same reason, we 35710 // don't need to set a static flag, either. 35711 // TODO: We can move this to the passive phase once we add a pre-commit 35712 // consistency check. See the next comment. 35713 35714 fiber.flags |= Passive; 35715 pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), undefined, null); 35716 return nextSnapshot; 35717} 35718 35719function updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { 35720 var fiber = currentlyRenderingFiber$1; 35721 var hook = updateWorkInProgressHook(); // Read the current snapshot from the store on every render. This breaks the 35722 // normal rules of React, and only works because store updates are 35723 // always synchronous. 35724 35725 var nextSnapshot = getSnapshot(); 35726 35727 { 35728 if (!didWarnUncachedGetSnapshot) { 35729 var cachedSnapshot = getSnapshot(); 35730 35731 if (!objectIs(nextSnapshot, cachedSnapshot)) { 35732 error('The result of getSnapshot should be cached to avoid an infinite loop'); 35733 35734 didWarnUncachedGetSnapshot = true; 35735 } 35736 } 35737 } 35738 35739 var prevSnapshot = hook.memoizedState; 35740 var snapshotChanged = !objectIs(prevSnapshot, nextSnapshot); 35741 35742 if (snapshotChanged) { 35743 hook.memoizedState = nextSnapshot; 35744 markWorkInProgressReceivedUpdate(); 35745 } 35746 35747 var inst = hook.queue; 35748 updateEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [subscribe]); // Whenever getSnapshot or subscribe changes, we need to check in the 35749 // commit phase if there was an interleaved mutation. In concurrent mode 35750 // this can happen all the time, but even in synchronous mode, an earlier 35751 // effect may have mutated the store. 35752 35753 if (inst.getSnapshot !== getSnapshot || snapshotChanged || // Check if the susbcribe function changed. We can save some memory by 35754 // checking whether we scheduled a subscription effect above. 35755 workInProgressHook !== null && workInProgressHook.memoizedState.tag & HasEffect) { 35756 fiber.flags |= Passive; 35757 pushEffect(HasEffect | Passive$1, updateStoreInstance.bind(null, fiber, inst, nextSnapshot, getSnapshot), undefined, null); // Unless we're rendering a blocking lane, schedule a consistency check. 35758 // Right before committing, we will walk the tree and check if any of the 35759 // stores were mutated. 35760 35761 var root = getWorkInProgressRoot(); 35762 35763 if (root === null) { 35764 throw new Error('Expected a work-in-progress root. This is a bug in React. Please file an issue.'); 35765 } 35766 35767 if (!includesBlockingLane(root, renderLanes)) { 35768 pushStoreConsistencyCheck(fiber, getSnapshot, nextSnapshot); 35769 } 35770 } 35771 35772 return nextSnapshot; 35773} 35774 35775function pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) { 35776 fiber.flags |= StoreConsistency; 35777 var check = { 35778 getSnapshot: getSnapshot, 35779 value: renderedSnapshot 35780 }; 35781 var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; 35782 35783 if (componentUpdateQueue === null) { 35784 componentUpdateQueue = createFunctionComponentUpdateQueue(); 35785 currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; 35786 componentUpdateQueue.stores = [check]; 35787 } else { 35788 var stores = componentUpdateQueue.stores; 35789 35790 if (stores === null) { 35791 componentUpdateQueue.stores = [check]; 35792 } else { 35793 stores.push(check); 35794 } 35795 } 35796} 35797 35798function updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) { 35799 // These are updated in the passive phase 35800 inst.value = nextSnapshot; 35801 inst.getSnapshot = getSnapshot; // Something may have been mutated in between render and commit. This could 35802 // have been in an event that fired before the passive effects, or it could 35803 // have been in a layout effect. In that case, we would have used the old 35804 // snapsho and getSnapshot values to bail out. We need to check one more time. 35805 35806 if (checkIfSnapshotChanged(inst)) { 35807 // Force a re-render. 35808 forceStoreRerender(fiber); 35809 } 35810} 35811 35812function subscribeToStore(fiber, inst, subscribe) { 35813 var handleStoreChange = function () { 35814 // The store changed. Check if the snapshot changed since the last time we 35815 // read from the store. 35816 if (checkIfSnapshotChanged(inst)) { 35817 // Force a re-render. 35818 forceStoreRerender(fiber); 35819 } 35820 }; // Subscribe to the store and return a clean-up function. 35821 35822 35823 return subscribe(handleStoreChange); 35824} 35825 35826function checkIfSnapshotChanged(inst) { 35827 var latestGetSnapshot = inst.getSnapshot; 35828 var prevValue = inst.value; 35829 35830 try { 35831 var nextValue = latestGetSnapshot(); 35832 return !objectIs(prevValue, nextValue); 35833 } catch (error) { 35834 return true; 35835 } 35836} 35837 35838function forceStoreRerender(fiber) { 35839 var root = enqueueConcurrentRenderForLane(fiber, SyncLane); 35840 35841 if (root !== null) { 35842 scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); 35843 } 35844} 35845 35846function mountState(initialState) { 35847 var hook = mountWorkInProgressHook(); 35848 35849 if (typeof initialState === 'function') { 35850 // $FlowFixMe: Flow doesn't like mixed types 35851 initialState = initialState(); 35852 } 35853 35854 hook.memoizedState = hook.baseState = initialState; 35855 var queue = { 35856 pending: null, 35857 interleaved: null, 35858 lanes: NoLanes, 35859 dispatch: null, 35860 lastRenderedReducer: basicStateReducer, 35861 lastRenderedState: initialState 35862 }; 35863 hook.queue = queue; 35864 var dispatch = queue.dispatch = dispatchSetState.bind(null, currentlyRenderingFiber$1, queue); 35865 return [hook.memoizedState, dispatch]; 35866} 35867 35868function updateState(initialState) { 35869 return updateReducer(basicStateReducer); 35870} 35871 35872function rerenderState(initialState) { 35873 return rerenderReducer(basicStateReducer); 35874} 35875 35876function pushEffect(tag, create, destroy, deps) { 35877 var effect = { 35878 tag: tag, 35879 create: create, 35880 destroy: destroy, 35881 deps: deps, 35882 // Circular 35883 next: null 35884 }; 35885 var componentUpdateQueue = currentlyRenderingFiber$1.updateQueue; 35886 35887 if (componentUpdateQueue === null) { 35888 componentUpdateQueue = createFunctionComponentUpdateQueue(); 35889 currentlyRenderingFiber$1.updateQueue = componentUpdateQueue; 35890 componentUpdateQueue.lastEffect = effect.next = effect; 35891 } else { 35892 var lastEffect = componentUpdateQueue.lastEffect; 35893 35894 if (lastEffect === null) { 35895 componentUpdateQueue.lastEffect = effect.next = effect; 35896 } else { 35897 var firstEffect = lastEffect.next; 35898 lastEffect.next = effect; 35899 effect.next = firstEffect; 35900 componentUpdateQueue.lastEffect = effect; 35901 } 35902 } 35903 35904 return effect; 35905} 35906 35907function mountRef(initialValue) { 35908 var hook = mountWorkInProgressHook(); 35909 35910 { 35911 var _ref2 = { 35912 current: initialValue 35913 }; 35914 hook.memoizedState = _ref2; 35915 return _ref2; 35916 } 35917} 35918 35919function updateRef(initialValue) { 35920 var hook = updateWorkInProgressHook(); 35921 return hook.memoizedState; 35922} 35923 35924function mountEffectImpl(fiberFlags, hookFlags, create, deps) { 35925 var hook = mountWorkInProgressHook(); 35926 var nextDeps = deps === undefined ? null : deps; 35927 currentlyRenderingFiber$1.flags |= fiberFlags; 35928 hook.memoizedState = pushEffect(HasEffect | hookFlags, create, undefined, nextDeps); 35929} 35930 35931function updateEffectImpl(fiberFlags, hookFlags, create, deps) { 35932 var hook = updateWorkInProgressHook(); 35933 var nextDeps = deps === undefined ? null : deps; 35934 var destroy = undefined; 35935 35936 if (currentHook !== null) { 35937 var prevEffect = currentHook.memoizedState; 35938 destroy = prevEffect.destroy; 35939 35940 if (nextDeps !== null) { 35941 var prevDeps = prevEffect.deps; 35942 35943 if (areHookInputsEqual(nextDeps, prevDeps)) { 35944 hook.memoizedState = pushEffect(hookFlags, create, destroy, nextDeps); 35945 return; 35946 } 35947 } 35948 } 35949 35950 currentlyRenderingFiber$1.flags |= fiberFlags; 35951 hook.memoizedState = pushEffect(HasEffect | hookFlags, create, destroy, nextDeps); 35952} 35953 35954function mountEffect(create, deps) { 35955 if ( (currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { 35956 return mountEffectImpl(MountPassiveDev | Passive | PassiveStatic, Passive$1, create, deps); 35957 } else { 35958 return mountEffectImpl(Passive | PassiveStatic, Passive$1, create, deps); 35959 } 35960} 35961 35962function updateEffect(create, deps) { 35963 return updateEffectImpl(Passive, Passive$1, create, deps); 35964} 35965 35966function mountInsertionEffect(create, deps) { 35967 return mountEffectImpl(Update, Insertion, create, deps); 35968} 35969 35970function updateInsertionEffect(create, deps) { 35971 return updateEffectImpl(Update, Insertion, create, deps); 35972} 35973 35974function mountLayoutEffect(create, deps) { 35975 var fiberFlags = Update; 35976 35977 { 35978 fiberFlags |= LayoutStatic; 35979 } 35980 35981 if ( (currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { 35982 fiberFlags |= MountLayoutDev; 35983 } 35984 35985 return mountEffectImpl(fiberFlags, Layout, create, deps); 35986} 35987 35988function updateLayoutEffect(create, deps) { 35989 return updateEffectImpl(Update, Layout, create, deps); 35990} 35991 35992function imperativeHandleEffect(create, ref) { 35993 if (typeof ref === 'function') { 35994 var refCallback = ref; 35995 35996 var _inst = create(); 35997 35998 refCallback(_inst); 35999 return function () { 36000 refCallback(null); 36001 }; 36002 } else if (ref !== null && ref !== undefined) { 36003 var refObject = ref; 36004 36005 { 36006 if (!refObject.hasOwnProperty('current')) { 36007 error('Expected useImperativeHandle() first argument to either be a ' + 'ref callback or React.createRef() object. Instead received: %s.', 'an object with keys {' + Object.keys(refObject).join(', ') + '}'); 36008 } 36009 } 36010 36011 var _inst2 = create(); 36012 36013 refObject.current = _inst2; 36014 return function () { 36015 refObject.current = null; 36016 }; 36017 } 36018} 36019 36020function mountImperativeHandle(ref, create, deps) { 36021 { 36022 if (typeof create !== 'function') { 36023 error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null'); 36024 } 36025 } // TODO: If deps are provided, should we skip comparing the ref itself? 36026 36027 36028 var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null; 36029 var fiberFlags = Update; 36030 36031 { 36032 fiberFlags |= LayoutStatic; 36033 } 36034 36035 if ( (currentlyRenderingFiber$1.mode & StrictEffectsMode) !== NoMode) { 36036 fiberFlags |= MountLayoutDev; 36037 } 36038 36039 return mountEffectImpl(fiberFlags, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); 36040} 36041 36042function updateImperativeHandle(ref, create, deps) { 36043 { 36044 if (typeof create !== 'function') { 36045 error('Expected useImperativeHandle() second argument to be a function ' + 'that creates a handle. Instead received: %s.', create !== null ? typeof create : 'null'); 36046 } 36047 } // TODO: If deps are provided, should we skip comparing the ref itself? 36048 36049 36050 var effectDeps = deps !== null && deps !== undefined ? deps.concat([ref]) : null; 36051 return updateEffectImpl(Update, Layout, imperativeHandleEffect.bind(null, create, ref), effectDeps); 36052} 36053 36054function mountDebugValue(value, formatterFn) {// This hook is normally a no-op. 36055 // The react-debug-hooks package injects its own implementation 36056 // so that e.g. DevTools can display custom hook values. 36057} 36058 36059var updateDebugValue = mountDebugValue; 36060 36061function mountCallback(callback, deps) { 36062 var hook = mountWorkInProgressHook(); 36063 var nextDeps = deps === undefined ? null : deps; 36064 hook.memoizedState = [callback, nextDeps]; 36065 return callback; 36066} 36067 36068function updateCallback(callback, deps) { 36069 var hook = updateWorkInProgressHook(); 36070 var nextDeps = deps === undefined ? null : deps; 36071 var prevState = hook.memoizedState; 36072 36073 if (prevState !== null) { 36074 if (nextDeps !== null) { 36075 var prevDeps = prevState[1]; 36076 36077 if (areHookInputsEqual(nextDeps, prevDeps)) { 36078 return prevState[0]; 36079 } 36080 } 36081 } 36082 36083 hook.memoizedState = [callback, nextDeps]; 36084 return callback; 36085} 36086 36087function mountMemo(nextCreate, deps) { 36088 var hook = mountWorkInProgressHook(); 36089 var nextDeps = deps === undefined ? null : deps; 36090 var nextValue = nextCreate(); 36091 hook.memoizedState = [nextValue, nextDeps]; 36092 return nextValue; 36093} 36094 36095function updateMemo(nextCreate, deps) { 36096 var hook = updateWorkInProgressHook(); 36097 var nextDeps = deps === undefined ? null : deps; 36098 var prevState = hook.memoizedState; 36099 36100 if (prevState !== null) { 36101 // Assume these are defined. If they're not, areHookInputsEqual will warn. 36102 if (nextDeps !== null) { 36103 var prevDeps = prevState[1]; 36104 36105 if (areHookInputsEqual(nextDeps, prevDeps)) { 36106 return prevState[0]; 36107 } 36108 } 36109 } 36110 36111 var nextValue = nextCreate(); 36112 hook.memoizedState = [nextValue, nextDeps]; 36113 return nextValue; 36114} 36115 36116function mountDeferredValue(value) { 36117 var hook = mountWorkInProgressHook(); 36118 hook.memoizedState = value; 36119 return value; 36120} 36121 36122function updateDeferredValue(value) { 36123 var hook = updateWorkInProgressHook(); 36124 var resolvedCurrentHook = currentHook; 36125 var prevValue = resolvedCurrentHook.memoizedState; 36126 return updateDeferredValueImpl(hook, prevValue, value); 36127} 36128 36129function rerenderDeferredValue(value) { 36130 var hook = updateWorkInProgressHook(); 36131 36132 if (currentHook === null) { 36133 // This is a rerender during a mount. 36134 hook.memoizedState = value; 36135 return value; 36136 } else { 36137 // This is a rerender during an update. 36138 var prevValue = currentHook.memoizedState; 36139 return updateDeferredValueImpl(hook, prevValue, value); 36140 } 36141} 36142 36143function updateDeferredValueImpl(hook, prevValue, value) { 36144 var shouldDeferValue = !includesOnlyNonUrgentLanes(renderLanes); 36145 36146 if (shouldDeferValue) { 36147 // This is an urgent update. If the value has changed, keep using the 36148 // previous value and spawn a deferred render to update it later. 36149 if (!objectIs(value, prevValue)) { 36150 // Schedule a deferred render 36151 var deferredLane = claimNextTransitionLane(); 36152 currentlyRenderingFiber$1.lanes = mergeLanes(currentlyRenderingFiber$1.lanes, deferredLane); 36153 markSkippedUpdateLanes(deferredLane); // Set this to true to indicate that the rendered value is inconsistent 36154 // from the latest value. The name "baseState" doesn't really match how we 36155 // use it because we're reusing a state hook field instead of creating a 36156 // new one. 36157 36158 hook.baseState = true; 36159 } // Reuse the previous value 36160 36161 36162 return prevValue; 36163 } else { 36164 // This is not an urgent update, so we can use the latest value regardless 36165 // of what it is. No need to defer it. 36166 // However, if we're currently inside a spawned render, then we need to mark 36167 // this as an update to prevent the fiber from bailing out. 36168 // 36169 // `baseState` is true when the current value is different from the rendered 36170 // value. The name doesn't really match how we use it because we're reusing 36171 // a state hook field instead of creating a new one. 36172 if (hook.baseState) { 36173 // Flip this back to false. 36174 hook.baseState = false; 36175 markWorkInProgressReceivedUpdate(); 36176 } 36177 36178 hook.memoizedState = value; 36179 return value; 36180 } 36181} 36182 36183function startTransition(setPending, callback, options) { 36184 var previousPriority = getCurrentUpdatePriority(); 36185 setCurrentUpdatePriority(higherEventPriority(previousPriority, ContinuousEventPriority)); 36186 setPending(true); 36187 var prevTransition = ReactCurrentBatchConfig$2.transition; 36188 ReactCurrentBatchConfig$2.transition = {}; 36189 var currentTransition = ReactCurrentBatchConfig$2.transition; 36190 36191 { 36192 ReactCurrentBatchConfig$2.transition._updatedFibers = new Set(); 36193 } 36194 36195 try { 36196 setPending(false); 36197 callback(); 36198 } finally { 36199 setCurrentUpdatePriority(previousPriority); 36200 ReactCurrentBatchConfig$2.transition = prevTransition; 36201 36202 { 36203 if (prevTransition === null && currentTransition._updatedFibers) { 36204 var updatedFibersCount = currentTransition._updatedFibers.size; 36205 36206 if (updatedFibersCount > 10) { 36207 warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.'); 36208 } 36209 36210 currentTransition._updatedFibers.clear(); 36211 } 36212 } 36213 } 36214} 36215 36216function mountTransition() { 36217 var _mountState = mountState(false), 36218 isPending = _mountState[0], 36219 setPending = _mountState[1]; // The `start` method never changes. 36220 36221 36222 var start = startTransition.bind(null, setPending); 36223 var hook = mountWorkInProgressHook(); 36224 hook.memoizedState = start; 36225 return [isPending, start]; 36226} 36227 36228function updateTransition() { 36229 var _updateState = updateState(), 36230 isPending = _updateState[0]; 36231 36232 var hook = updateWorkInProgressHook(); 36233 var start = hook.memoizedState; 36234 return [isPending, start]; 36235} 36236 36237function rerenderTransition() { 36238 var _rerenderState = rerenderState(), 36239 isPending = _rerenderState[0]; 36240 36241 var hook = updateWorkInProgressHook(); 36242 var start = hook.memoizedState; 36243 return [isPending, start]; 36244} 36245 36246var isUpdatingOpaqueValueInRenderPhase = false; 36247function getIsUpdatingOpaqueValueInRenderPhaseInDEV() { 36248 { 36249 return isUpdatingOpaqueValueInRenderPhase; 36250 } 36251} 36252 36253function mountId() { 36254 var hook = mountWorkInProgressHook(); 36255 var root = getWorkInProgressRoot(); // TODO: In Fizz, id generation is specific to each server config. Maybe we 36256 // should do this in Fiber, too? Deferring this decision for now because 36257 // there's no other place to store the prefix except for an internal field on 36258 // the public createRoot object, which the fiber tree does not currently have 36259 // a reference to. 36260 36261 var identifierPrefix = root.identifierPrefix; 36262 var id; 36263 36264 if (getIsHydrating()) { 36265 var treeId = getTreeId(); // Use a captial R prefix for server-generated ids. 36266 36267 id = ':' + identifierPrefix + 'R' + treeId; // Unless this is the first id at this level, append a number at the end 36268 // that represents the position of this useId hook among all the useId 36269 // hooks for this fiber. 36270 36271 var localId = localIdCounter++; 36272 36273 if (localId > 0) { 36274 id += 'H' + localId.toString(32); 36275 } 36276 36277 id += ':'; 36278 } else { 36279 // Use a lowercase r prefix for client-generated ids. 36280 var globalClientId = globalClientIdCounter++; 36281 id = ':' + identifierPrefix + 'r' + globalClientId.toString(32) + ':'; 36282 } 36283 36284 hook.memoizedState = id; 36285 return id; 36286} 36287 36288function updateId() { 36289 var hook = updateWorkInProgressHook(); 36290 var id = hook.memoizedState; 36291 return id; 36292} 36293 36294function dispatchReducerAction(fiber, queue, action) { 36295 { 36296 if (typeof arguments[3] === 'function') { 36297 error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().'); 36298 } 36299 } 36300 36301 var lane = requestUpdateLane(fiber); 36302 var update = { 36303 lane: lane, 36304 action: action, 36305 hasEagerState: false, 36306 eagerState: null, 36307 next: null 36308 }; 36309 36310 if (isRenderPhaseUpdate(fiber)) { 36311 enqueueRenderPhaseUpdate(queue, update); 36312 } else { 36313 var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane); 36314 36315 if (root !== null) { 36316 var eventTime = requestEventTime(); 36317 scheduleUpdateOnFiber(root, fiber, lane, eventTime); 36318 entangleTransitionUpdate(root, queue, lane); 36319 } 36320 } 36321 36322 markUpdateInDevTools(fiber, lane); 36323} 36324 36325function dispatchSetState(fiber, queue, action) { 36326 { 36327 if (typeof arguments[3] === 'function') { 36328 error("State updates from the useState() and useReducer() Hooks don't support the " + 'second callback argument. To execute a side effect after ' + 'rendering, declare it in the component body with useEffect().'); 36329 } 36330 } 36331 36332 var lane = requestUpdateLane(fiber); 36333 var update = { 36334 lane: lane, 36335 action: action, 36336 hasEagerState: false, 36337 eagerState: null, 36338 next: null 36339 }; 36340 36341 if (isRenderPhaseUpdate(fiber)) { 36342 enqueueRenderPhaseUpdate(queue, update); 36343 } else { 36344 var alternate = fiber.alternate; 36345 36346 if (fiber.lanes === NoLanes && (alternate === null || alternate.lanes === NoLanes)) { 36347 // The queue is currently empty, which means we can eagerly compute the 36348 // next state before entering the render phase. If the new state is the 36349 // same as the current state, we may be able to bail out entirely. 36350 var lastRenderedReducer = queue.lastRenderedReducer; 36351 36352 if (lastRenderedReducer !== null) { 36353 var prevDispatcher; 36354 36355 { 36356 prevDispatcher = ReactCurrentDispatcher$1.current; 36357 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 36358 } 36359 36360 try { 36361 var currentState = queue.lastRenderedState; 36362 var eagerState = lastRenderedReducer(currentState, action); // Stash the eagerly computed state, and the reducer used to compute 36363 // it, on the update object. If the reducer hasn't changed by the 36364 // time we enter the render phase, then the eager state can be used 36365 // without calling the reducer again. 36366 36367 update.hasEagerState = true; 36368 update.eagerState = eagerState; 36369 36370 if (objectIs(eagerState, currentState)) { 36371 // Fast path. We can bail out without scheduling React to re-render. 36372 // It's still possible that we'll need to rebase this update later, 36373 // if the component re-renders for a different reason and by that 36374 // time the reducer has changed. 36375 // TODO: Do we still need to entangle transitions in this case? 36376 enqueueConcurrentHookUpdateAndEagerlyBailout(fiber, queue, update, lane); 36377 return; 36378 } 36379 } catch (error) {// Suppress the error. It will throw again in the render phase. 36380 } finally { 36381 { 36382 ReactCurrentDispatcher$1.current = prevDispatcher; 36383 } 36384 } 36385 } 36386 } 36387 36388 var root = enqueueConcurrentHookUpdate(fiber, queue, update, lane); 36389 36390 if (root !== null) { 36391 var eventTime = requestEventTime(); 36392 scheduleUpdateOnFiber(root, fiber, lane, eventTime); 36393 entangleTransitionUpdate(root, queue, lane); 36394 } 36395 } 36396 36397 markUpdateInDevTools(fiber, lane); 36398} 36399 36400function isRenderPhaseUpdate(fiber) { 36401 var alternate = fiber.alternate; 36402 return fiber === currentlyRenderingFiber$1 || alternate !== null && alternate === currentlyRenderingFiber$1; 36403} 36404 36405function enqueueRenderPhaseUpdate(queue, update) { 36406 // This is a render phase update. Stash it in a lazily-created map of 36407 // queue -> linked list of updates. After this render pass, we'll restart 36408 // and apply the stashed updates on top of the work-in-progress hook. 36409 didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate = true; 36410 var pending = queue.pending; 36411 36412 if (pending === null) { 36413 // This is the first update. Create a circular list. 36414 update.next = update; 36415 } else { 36416 update.next = pending.next; 36417 pending.next = update; 36418 } 36419 36420 queue.pending = update; 36421} // TODO: Move to ReactFiberConcurrentUpdates? 36422 36423 36424function entangleTransitionUpdate(root, queue, lane) { 36425 if (isTransitionLane(lane)) { 36426 var queueLanes = queue.lanes; // If any entangled lanes are no longer pending on the root, then they 36427 // must have finished. We can remove them from the shared queue, which 36428 // represents a superset of the actually pending lanes. In some cases we 36429 // may entangle more than we need to, but that's OK. In fact it's worse if 36430 // we *don't* entangle when we should. 36431 36432 queueLanes = intersectLanes(queueLanes, root.pendingLanes); // Entangle the new transition lane with the other transition lanes. 36433 36434 var newQueueLanes = mergeLanes(queueLanes, lane); 36435 queue.lanes = newQueueLanes; // Even if queue.lanes already include lane, we don't know for certain if 36436 // the lane finished since the last time we entangled it. So we need to 36437 // entangle it again, just to be sure. 36438 36439 markRootEntangled(root, newQueueLanes); 36440 } 36441} 36442 36443function markUpdateInDevTools(fiber, lane, action) { 36444 36445 { 36446 markStateUpdateScheduled(fiber, lane); 36447 } 36448} 36449 36450var ContextOnlyDispatcher = { 36451 readContext: readContext, 36452 useCallback: throwInvalidHookError, 36453 useContext: throwInvalidHookError, 36454 useEffect: throwInvalidHookError, 36455 useImperativeHandle: throwInvalidHookError, 36456 useInsertionEffect: throwInvalidHookError, 36457 useLayoutEffect: throwInvalidHookError, 36458 useMemo: throwInvalidHookError, 36459 useReducer: throwInvalidHookError, 36460 useRef: throwInvalidHookError, 36461 useState: throwInvalidHookError, 36462 useDebugValue: throwInvalidHookError, 36463 useDeferredValue: throwInvalidHookError, 36464 useTransition: throwInvalidHookError, 36465 useMutableSource: throwInvalidHookError, 36466 useSyncExternalStore: throwInvalidHookError, 36467 useId: throwInvalidHookError, 36468 unstable_isNewReconciler: enableNewReconciler 36469}; 36470 36471var HooksDispatcherOnMountInDEV = null; 36472var HooksDispatcherOnMountWithHookTypesInDEV = null; 36473var HooksDispatcherOnUpdateInDEV = null; 36474var HooksDispatcherOnRerenderInDEV = null; 36475var InvalidNestedHooksDispatcherOnMountInDEV = null; 36476var InvalidNestedHooksDispatcherOnUpdateInDEV = null; 36477var InvalidNestedHooksDispatcherOnRerenderInDEV = null; 36478 36479{ 36480 var warnInvalidContextAccess = function () { 36481 error('Context can only be read while React is rendering. ' + 'In classes, you can read it in the render method or getDerivedStateFromProps. ' + 'In function components, you can read it directly in the function body, but not ' + 'inside Hooks like useReducer() or useMemo().'); 36482 }; 36483 36484 var warnInvalidHookAccess = function () { 36485 error('Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks. ' + 'You can only call Hooks at the top level of your React function. ' + 'For more information, see ' + 'https://reactjs.org/link/rules-of-hooks'); 36486 }; 36487 36488 HooksDispatcherOnMountInDEV = { 36489 readContext: function (context) { 36490 return readContext(context); 36491 }, 36492 useCallback: function (callback, deps) { 36493 currentHookNameInDev = 'useCallback'; 36494 mountHookTypesDev(); 36495 checkDepsAreArrayDev(deps); 36496 return mountCallback(callback, deps); 36497 }, 36498 useContext: function (context) { 36499 currentHookNameInDev = 'useContext'; 36500 mountHookTypesDev(); 36501 return readContext(context); 36502 }, 36503 useEffect: function (create, deps) { 36504 currentHookNameInDev = 'useEffect'; 36505 mountHookTypesDev(); 36506 checkDepsAreArrayDev(deps); 36507 return mountEffect(create, deps); 36508 }, 36509 useImperativeHandle: function (ref, create, deps) { 36510 currentHookNameInDev = 'useImperativeHandle'; 36511 mountHookTypesDev(); 36512 checkDepsAreArrayDev(deps); 36513 return mountImperativeHandle(ref, create, deps); 36514 }, 36515 useInsertionEffect: function (create, deps) { 36516 currentHookNameInDev = 'useInsertionEffect'; 36517 mountHookTypesDev(); 36518 checkDepsAreArrayDev(deps); 36519 return mountInsertionEffect(create, deps); 36520 }, 36521 useLayoutEffect: function (create, deps) { 36522 currentHookNameInDev = 'useLayoutEffect'; 36523 mountHookTypesDev(); 36524 checkDepsAreArrayDev(deps); 36525 return mountLayoutEffect(create, deps); 36526 }, 36527 useMemo: function (create, deps) { 36528 currentHookNameInDev = 'useMemo'; 36529 mountHookTypesDev(); 36530 checkDepsAreArrayDev(deps); 36531 var prevDispatcher = ReactCurrentDispatcher$1.current; 36532 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; 36533 36534 try { 36535 return mountMemo(create, deps); 36536 } finally { 36537 ReactCurrentDispatcher$1.current = prevDispatcher; 36538 } 36539 }, 36540 useReducer: function (reducer, initialArg, init) { 36541 currentHookNameInDev = 'useReducer'; 36542 mountHookTypesDev(); 36543 var prevDispatcher = ReactCurrentDispatcher$1.current; 36544 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; 36545 36546 try { 36547 return mountReducer(reducer, initialArg, init); 36548 } finally { 36549 ReactCurrentDispatcher$1.current = prevDispatcher; 36550 } 36551 }, 36552 useRef: function (initialValue) { 36553 currentHookNameInDev = 'useRef'; 36554 mountHookTypesDev(); 36555 return mountRef(initialValue); 36556 }, 36557 useState: function (initialState) { 36558 currentHookNameInDev = 'useState'; 36559 mountHookTypesDev(); 36560 var prevDispatcher = ReactCurrentDispatcher$1.current; 36561 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; 36562 36563 try { 36564 return mountState(initialState); 36565 } finally { 36566 ReactCurrentDispatcher$1.current = prevDispatcher; 36567 } 36568 }, 36569 useDebugValue: function (value, formatterFn) { 36570 currentHookNameInDev = 'useDebugValue'; 36571 mountHookTypesDev(); 36572 return mountDebugValue(); 36573 }, 36574 useDeferredValue: function (value) { 36575 currentHookNameInDev = 'useDeferredValue'; 36576 mountHookTypesDev(); 36577 return mountDeferredValue(value); 36578 }, 36579 useTransition: function () { 36580 currentHookNameInDev = 'useTransition'; 36581 mountHookTypesDev(); 36582 return mountTransition(); 36583 }, 36584 useMutableSource: function (source, getSnapshot, subscribe) { 36585 currentHookNameInDev = 'useMutableSource'; 36586 mountHookTypesDev(); 36587 return mountMutableSource(); 36588 }, 36589 useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { 36590 currentHookNameInDev = 'useSyncExternalStore'; 36591 mountHookTypesDev(); 36592 return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); 36593 }, 36594 useId: function () { 36595 currentHookNameInDev = 'useId'; 36596 mountHookTypesDev(); 36597 return mountId(); 36598 }, 36599 unstable_isNewReconciler: enableNewReconciler 36600 }; 36601 36602 HooksDispatcherOnMountWithHookTypesInDEV = { 36603 readContext: function (context) { 36604 return readContext(context); 36605 }, 36606 useCallback: function (callback, deps) { 36607 currentHookNameInDev = 'useCallback'; 36608 updateHookTypesDev(); 36609 return mountCallback(callback, deps); 36610 }, 36611 useContext: function (context) { 36612 currentHookNameInDev = 'useContext'; 36613 updateHookTypesDev(); 36614 return readContext(context); 36615 }, 36616 useEffect: function (create, deps) { 36617 currentHookNameInDev = 'useEffect'; 36618 updateHookTypesDev(); 36619 return mountEffect(create, deps); 36620 }, 36621 useImperativeHandle: function (ref, create, deps) { 36622 currentHookNameInDev = 'useImperativeHandle'; 36623 updateHookTypesDev(); 36624 return mountImperativeHandle(ref, create, deps); 36625 }, 36626 useInsertionEffect: function (create, deps) { 36627 currentHookNameInDev = 'useInsertionEffect'; 36628 updateHookTypesDev(); 36629 return mountInsertionEffect(create, deps); 36630 }, 36631 useLayoutEffect: function (create, deps) { 36632 currentHookNameInDev = 'useLayoutEffect'; 36633 updateHookTypesDev(); 36634 return mountLayoutEffect(create, deps); 36635 }, 36636 useMemo: function (create, deps) { 36637 currentHookNameInDev = 'useMemo'; 36638 updateHookTypesDev(); 36639 var prevDispatcher = ReactCurrentDispatcher$1.current; 36640 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; 36641 36642 try { 36643 return mountMemo(create, deps); 36644 } finally { 36645 ReactCurrentDispatcher$1.current = prevDispatcher; 36646 } 36647 }, 36648 useReducer: function (reducer, initialArg, init) { 36649 currentHookNameInDev = 'useReducer'; 36650 updateHookTypesDev(); 36651 var prevDispatcher = ReactCurrentDispatcher$1.current; 36652 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; 36653 36654 try { 36655 return mountReducer(reducer, initialArg, init); 36656 } finally { 36657 ReactCurrentDispatcher$1.current = prevDispatcher; 36658 } 36659 }, 36660 useRef: function (initialValue) { 36661 currentHookNameInDev = 'useRef'; 36662 updateHookTypesDev(); 36663 return mountRef(initialValue); 36664 }, 36665 useState: function (initialState) { 36666 currentHookNameInDev = 'useState'; 36667 updateHookTypesDev(); 36668 var prevDispatcher = ReactCurrentDispatcher$1.current; 36669 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; 36670 36671 try { 36672 return mountState(initialState); 36673 } finally { 36674 ReactCurrentDispatcher$1.current = prevDispatcher; 36675 } 36676 }, 36677 useDebugValue: function (value, formatterFn) { 36678 currentHookNameInDev = 'useDebugValue'; 36679 updateHookTypesDev(); 36680 return mountDebugValue(); 36681 }, 36682 useDeferredValue: function (value) { 36683 currentHookNameInDev = 'useDeferredValue'; 36684 updateHookTypesDev(); 36685 return mountDeferredValue(value); 36686 }, 36687 useTransition: function () { 36688 currentHookNameInDev = 'useTransition'; 36689 updateHookTypesDev(); 36690 return mountTransition(); 36691 }, 36692 useMutableSource: function (source, getSnapshot, subscribe) { 36693 currentHookNameInDev = 'useMutableSource'; 36694 updateHookTypesDev(); 36695 return mountMutableSource(); 36696 }, 36697 useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { 36698 currentHookNameInDev = 'useSyncExternalStore'; 36699 updateHookTypesDev(); 36700 return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); 36701 }, 36702 useId: function () { 36703 currentHookNameInDev = 'useId'; 36704 updateHookTypesDev(); 36705 return mountId(); 36706 }, 36707 unstable_isNewReconciler: enableNewReconciler 36708 }; 36709 36710 HooksDispatcherOnUpdateInDEV = { 36711 readContext: function (context) { 36712 return readContext(context); 36713 }, 36714 useCallback: function (callback, deps) { 36715 currentHookNameInDev = 'useCallback'; 36716 updateHookTypesDev(); 36717 return updateCallback(callback, deps); 36718 }, 36719 useContext: function (context) { 36720 currentHookNameInDev = 'useContext'; 36721 updateHookTypesDev(); 36722 return readContext(context); 36723 }, 36724 useEffect: function (create, deps) { 36725 currentHookNameInDev = 'useEffect'; 36726 updateHookTypesDev(); 36727 return updateEffect(create, deps); 36728 }, 36729 useImperativeHandle: function (ref, create, deps) { 36730 currentHookNameInDev = 'useImperativeHandle'; 36731 updateHookTypesDev(); 36732 return updateImperativeHandle(ref, create, deps); 36733 }, 36734 useInsertionEffect: function (create, deps) { 36735 currentHookNameInDev = 'useInsertionEffect'; 36736 updateHookTypesDev(); 36737 return updateInsertionEffect(create, deps); 36738 }, 36739 useLayoutEffect: function (create, deps) { 36740 currentHookNameInDev = 'useLayoutEffect'; 36741 updateHookTypesDev(); 36742 return updateLayoutEffect(create, deps); 36743 }, 36744 useMemo: function (create, deps) { 36745 currentHookNameInDev = 'useMemo'; 36746 updateHookTypesDev(); 36747 var prevDispatcher = ReactCurrentDispatcher$1.current; 36748 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 36749 36750 try { 36751 return updateMemo(create, deps); 36752 } finally { 36753 ReactCurrentDispatcher$1.current = prevDispatcher; 36754 } 36755 }, 36756 useReducer: function (reducer, initialArg, init) { 36757 currentHookNameInDev = 'useReducer'; 36758 updateHookTypesDev(); 36759 var prevDispatcher = ReactCurrentDispatcher$1.current; 36760 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 36761 36762 try { 36763 return updateReducer(reducer, initialArg, init); 36764 } finally { 36765 ReactCurrentDispatcher$1.current = prevDispatcher; 36766 } 36767 }, 36768 useRef: function (initialValue) { 36769 currentHookNameInDev = 'useRef'; 36770 updateHookTypesDev(); 36771 return updateRef(); 36772 }, 36773 useState: function (initialState) { 36774 currentHookNameInDev = 'useState'; 36775 updateHookTypesDev(); 36776 var prevDispatcher = ReactCurrentDispatcher$1.current; 36777 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 36778 36779 try { 36780 return updateState(initialState); 36781 } finally { 36782 ReactCurrentDispatcher$1.current = prevDispatcher; 36783 } 36784 }, 36785 useDebugValue: function (value, formatterFn) { 36786 currentHookNameInDev = 'useDebugValue'; 36787 updateHookTypesDev(); 36788 return updateDebugValue(); 36789 }, 36790 useDeferredValue: function (value) { 36791 currentHookNameInDev = 'useDeferredValue'; 36792 updateHookTypesDev(); 36793 return updateDeferredValue(value); 36794 }, 36795 useTransition: function () { 36796 currentHookNameInDev = 'useTransition'; 36797 updateHookTypesDev(); 36798 return updateTransition(); 36799 }, 36800 useMutableSource: function (source, getSnapshot, subscribe) { 36801 currentHookNameInDev = 'useMutableSource'; 36802 updateHookTypesDev(); 36803 return updateMutableSource(); 36804 }, 36805 useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { 36806 currentHookNameInDev = 'useSyncExternalStore'; 36807 updateHookTypesDev(); 36808 return updateSyncExternalStore(subscribe, getSnapshot); 36809 }, 36810 useId: function () { 36811 currentHookNameInDev = 'useId'; 36812 updateHookTypesDev(); 36813 return updateId(); 36814 }, 36815 unstable_isNewReconciler: enableNewReconciler 36816 }; 36817 36818 HooksDispatcherOnRerenderInDEV = { 36819 readContext: function (context) { 36820 return readContext(context); 36821 }, 36822 useCallback: function (callback, deps) { 36823 currentHookNameInDev = 'useCallback'; 36824 updateHookTypesDev(); 36825 return updateCallback(callback, deps); 36826 }, 36827 useContext: function (context) { 36828 currentHookNameInDev = 'useContext'; 36829 updateHookTypesDev(); 36830 return readContext(context); 36831 }, 36832 useEffect: function (create, deps) { 36833 currentHookNameInDev = 'useEffect'; 36834 updateHookTypesDev(); 36835 return updateEffect(create, deps); 36836 }, 36837 useImperativeHandle: function (ref, create, deps) { 36838 currentHookNameInDev = 'useImperativeHandle'; 36839 updateHookTypesDev(); 36840 return updateImperativeHandle(ref, create, deps); 36841 }, 36842 useInsertionEffect: function (create, deps) { 36843 currentHookNameInDev = 'useInsertionEffect'; 36844 updateHookTypesDev(); 36845 return updateInsertionEffect(create, deps); 36846 }, 36847 useLayoutEffect: function (create, deps) { 36848 currentHookNameInDev = 'useLayoutEffect'; 36849 updateHookTypesDev(); 36850 return updateLayoutEffect(create, deps); 36851 }, 36852 useMemo: function (create, deps) { 36853 currentHookNameInDev = 'useMemo'; 36854 updateHookTypesDev(); 36855 var prevDispatcher = ReactCurrentDispatcher$1.current; 36856 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; 36857 36858 try { 36859 return updateMemo(create, deps); 36860 } finally { 36861 ReactCurrentDispatcher$1.current = prevDispatcher; 36862 } 36863 }, 36864 useReducer: function (reducer, initialArg, init) { 36865 currentHookNameInDev = 'useReducer'; 36866 updateHookTypesDev(); 36867 var prevDispatcher = ReactCurrentDispatcher$1.current; 36868 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; 36869 36870 try { 36871 return rerenderReducer(reducer, initialArg, init); 36872 } finally { 36873 ReactCurrentDispatcher$1.current = prevDispatcher; 36874 } 36875 }, 36876 useRef: function (initialValue) { 36877 currentHookNameInDev = 'useRef'; 36878 updateHookTypesDev(); 36879 return updateRef(); 36880 }, 36881 useState: function (initialState) { 36882 currentHookNameInDev = 'useState'; 36883 updateHookTypesDev(); 36884 var prevDispatcher = ReactCurrentDispatcher$1.current; 36885 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnRerenderInDEV; 36886 36887 try { 36888 return rerenderState(initialState); 36889 } finally { 36890 ReactCurrentDispatcher$1.current = prevDispatcher; 36891 } 36892 }, 36893 useDebugValue: function (value, formatterFn) { 36894 currentHookNameInDev = 'useDebugValue'; 36895 updateHookTypesDev(); 36896 return updateDebugValue(); 36897 }, 36898 useDeferredValue: function (value) { 36899 currentHookNameInDev = 'useDeferredValue'; 36900 updateHookTypesDev(); 36901 return rerenderDeferredValue(value); 36902 }, 36903 useTransition: function () { 36904 currentHookNameInDev = 'useTransition'; 36905 updateHookTypesDev(); 36906 return rerenderTransition(); 36907 }, 36908 useMutableSource: function (source, getSnapshot, subscribe) { 36909 currentHookNameInDev = 'useMutableSource'; 36910 updateHookTypesDev(); 36911 return updateMutableSource(); 36912 }, 36913 useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { 36914 currentHookNameInDev = 'useSyncExternalStore'; 36915 updateHookTypesDev(); 36916 return updateSyncExternalStore(subscribe, getSnapshot); 36917 }, 36918 useId: function () { 36919 currentHookNameInDev = 'useId'; 36920 updateHookTypesDev(); 36921 return updateId(); 36922 }, 36923 unstable_isNewReconciler: enableNewReconciler 36924 }; 36925 36926 InvalidNestedHooksDispatcherOnMountInDEV = { 36927 readContext: function (context) { 36928 warnInvalidContextAccess(); 36929 return readContext(context); 36930 }, 36931 useCallback: function (callback, deps) { 36932 currentHookNameInDev = 'useCallback'; 36933 warnInvalidHookAccess(); 36934 mountHookTypesDev(); 36935 return mountCallback(callback, deps); 36936 }, 36937 useContext: function (context) { 36938 currentHookNameInDev = 'useContext'; 36939 warnInvalidHookAccess(); 36940 mountHookTypesDev(); 36941 return readContext(context); 36942 }, 36943 useEffect: function (create, deps) { 36944 currentHookNameInDev = 'useEffect'; 36945 warnInvalidHookAccess(); 36946 mountHookTypesDev(); 36947 return mountEffect(create, deps); 36948 }, 36949 useImperativeHandle: function (ref, create, deps) { 36950 currentHookNameInDev = 'useImperativeHandle'; 36951 warnInvalidHookAccess(); 36952 mountHookTypesDev(); 36953 return mountImperativeHandle(ref, create, deps); 36954 }, 36955 useInsertionEffect: function (create, deps) { 36956 currentHookNameInDev = 'useInsertionEffect'; 36957 warnInvalidHookAccess(); 36958 mountHookTypesDev(); 36959 return mountInsertionEffect(create, deps); 36960 }, 36961 useLayoutEffect: function (create, deps) { 36962 currentHookNameInDev = 'useLayoutEffect'; 36963 warnInvalidHookAccess(); 36964 mountHookTypesDev(); 36965 return mountLayoutEffect(create, deps); 36966 }, 36967 useMemo: function (create, deps) { 36968 currentHookNameInDev = 'useMemo'; 36969 warnInvalidHookAccess(); 36970 mountHookTypesDev(); 36971 var prevDispatcher = ReactCurrentDispatcher$1.current; 36972 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; 36973 36974 try { 36975 return mountMemo(create, deps); 36976 } finally { 36977 ReactCurrentDispatcher$1.current = prevDispatcher; 36978 } 36979 }, 36980 useReducer: function (reducer, initialArg, init) { 36981 currentHookNameInDev = 'useReducer'; 36982 warnInvalidHookAccess(); 36983 mountHookTypesDev(); 36984 var prevDispatcher = ReactCurrentDispatcher$1.current; 36985 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; 36986 36987 try { 36988 return mountReducer(reducer, initialArg, init); 36989 } finally { 36990 ReactCurrentDispatcher$1.current = prevDispatcher; 36991 } 36992 }, 36993 useRef: function (initialValue) { 36994 currentHookNameInDev = 'useRef'; 36995 warnInvalidHookAccess(); 36996 mountHookTypesDev(); 36997 return mountRef(initialValue); 36998 }, 36999 useState: function (initialState) { 37000 currentHookNameInDev = 'useState'; 37001 warnInvalidHookAccess(); 37002 mountHookTypesDev(); 37003 var prevDispatcher = ReactCurrentDispatcher$1.current; 37004 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnMountInDEV; 37005 37006 try { 37007 return mountState(initialState); 37008 } finally { 37009 ReactCurrentDispatcher$1.current = prevDispatcher; 37010 } 37011 }, 37012 useDebugValue: function (value, formatterFn) { 37013 currentHookNameInDev = 'useDebugValue'; 37014 warnInvalidHookAccess(); 37015 mountHookTypesDev(); 37016 return mountDebugValue(); 37017 }, 37018 useDeferredValue: function (value) { 37019 currentHookNameInDev = 'useDeferredValue'; 37020 warnInvalidHookAccess(); 37021 mountHookTypesDev(); 37022 return mountDeferredValue(value); 37023 }, 37024 useTransition: function () { 37025 currentHookNameInDev = 'useTransition'; 37026 warnInvalidHookAccess(); 37027 mountHookTypesDev(); 37028 return mountTransition(); 37029 }, 37030 useMutableSource: function (source, getSnapshot, subscribe) { 37031 currentHookNameInDev = 'useMutableSource'; 37032 warnInvalidHookAccess(); 37033 mountHookTypesDev(); 37034 return mountMutableSource(); 37035 }, 37036 useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { 37037 currentHookNameInDev = 'useSyncExternalStore'; 37038 warnInvalidHookAccess(); 37039 mountHookTypesDev(); 37040 return mountSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); 37041 }, 37042 useId: function () { 37043 currentHookNameInDev = 'useId'; 37044 warnInvalidHookAccess(); 37045 mountHookTypesDev(); 37046 return mountId(); 37047 }, 37048 unstable_isNewReconciler: enableNewReconciler 37049 }; 37050 37051 InvalidNestedHooksDispatcherOnUpdateInDEV = { 37052 readContext: function (context) { 37053 warnInvalidContextAccess(); 37054 return readContext(context); 37055 }, 37056 useCallback: function (callback, deps) { 37057 currentHookNameInDev = 'useCallback'; 37058 warnInvalidHookAccess(); 37059 updateHookTypesDev(); 37060 return updateCallback(callback, deps); 37061 }, 37062 useContext: function (context) { 37063 currentHookNameInDev = 'useContext'; 37064 warnInvalidHookAccess(); 37065 updateHookTypesDev(); 37066 return readContext(context); 37067 }, 37068 useEffect: function (create, deps) { 37069 currentHookNameInDev = 'useEffect'; 37070 warnInvalidHookAccess(); 37071 updateHookTypesDev(); 37072 return updateEffect(create, deps); 37073 }, 37074 useImperativeHandle: function (ref, create, deps) { 37075 currentHookNameInDev = 'useImperativeHandle'; 37076 warnInvalidHookAccess(); 37077 updateHookTypesDev(); 37078 return updateImperativeHandle(ref, create, deps); 37079 }, 37080 useInsertionEffect: function (create, deps) { 37081 currentHookNameInDev = 'useInsertionEffect'; 37082 warnInvalidHookAccess(); 37083 updateHookTypesDev(); 37084 return updateInsertionEffect(create, deps); 37085 }, 37086 useLayoutEffect: function (create, deps) { 37087 currentHookNameInDev = 'useLayoutEffect'; 37088 warnInvalidHookAccess(); 37089 updateHookTypesDev(); 37090 return updateLayoutEffect(create, deps); 37091 }, 37092 useMemo: function (create, deps) { 37093 currentHookNameInDev = 'useMemo'; 37094 warnInvalidHookAccess(); 37095 updateHookTypesDev(); 37096 var prevDispatcher = ReactCurrentDispatcher$1.current; 37097 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 37098 37099 try { 37100 return updateMemo(create, deps); 37101 } finally { 37102 ReactCurrentDispatcher$1.current = prevDispatcher; 37103 } 37104 }, 37105 useReducer: function (reducer, initialArg, init) { 37106 currentHookNameInDev = 'useReducer'; 37107 warnInvalidHookAccess(); 37108 updateHookTypesDev(); 37109 var prevDispatcher = ReactCurrentDispatcher$1.current; 37110 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 37111 37112 try { 37113 return updateReducer(reducer, initialArg, init); 37114 } finally { 37115 ReactCurrentDispatcher$1.current = prevDispatcher; 37116 } 37117 }, 37118 useRef: function (initialValue) { 37119 currentHookNameInDev = 'useRef'; 37120 warnInvalidHookAccess(); 37121 updateHookTypesDev(); 37122 return updateRef(); 37123 }, 37124 useState: function (initialState) { 37125 currentHookNameInDev = 'useState'; 37126 warnInvalidHookAccess(); 37127 updateHookTypesDev(); 37128 var prevDispatcher = ReactCurrentDispatcher$1.current; 37129 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 37130 37131 try { 37132 return updateState(initialState); 37133 } finally { 37134 ReactCurrentDispatcher$1.current = prevDispatcher; 37135 } 37136 }, 37137 useDebugValue: function (value, formatterFn) { 37138 currentHookNameInDev = 'useDebugValue'; 37139 warnInvalidHookAccess(); 37140 updateHookTypesDev(); 37141 return updateDebugValue(); 37142 }, 37143 useDeferredValue: function (value) { 37144 currentHookNameInDev = 'useDeferredValue'; 37145 warnInvalidHookAccess(); 37146 updateHookTypesDev(); 37147 return updateDeferredValue(value); 37148 }, 37149 useTransition: function () { 37150 currentHookNameInDev = 'useTransition'; 37151 warnInvalidHookAccess(); 37152 updateHookTypesDev(); 37153 return updateTransition(); 37154 }, 37155 useMutableSource: function (source, getSnapshot, subscribe) { 37156 currentHookNameInDev = 'useMutableSource'; 37157 warnInvalidHookAccess(); 37158 updateHookTypesDev(); 37159 return updateMutableSource(); 37160 }, 37161 useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { 37162 currentHookNameInDev = 'useSyncExternalStore'; 37163 warnInvalidHookAccess(); 37164 updateHookTypesDev(); 37165 return updateSyncExternalStore(subscribe, getSnapshot); 37166 }, 37167 useId: function () { 37168 currentHookNameInDev = 'useId'; 37169 warnInvalidHookAccess(); 37170 updateHookTypesDev(); 37171 return updateId(); 37172 }, 37173 unstable_isNewReconciler: enableNewReconciler 37174 }; 37175 37176 InvalidNestedHooksDispatcherOnRerenderInDEV = { 37177 readContext: function (context) { 37178 warnInvalidContextAccess(); 37179 return readContext(context); 37180 }, 37181 useCallback: function (callback, deps) { 37182 currentHookNameInDev = 'useCallback'; 37183 warnInvalidHookAccess(); 37184 updateHookTypesDev(); 37185 return updateCallback(callback, deps); 37186 }, 37187 useContext: function (context) { 37188 currentHookNameInDev = 'useContext'; 37189 warnInvalidHookAccess(); 37190 updateHookTypesDev(); 37191 return readContext(context); 37192 }, 37193 useEffect: function (create, deps) { 37194 currentHookNameInDev = 'useEffect'; 37195 warnInvalidHookAccess(); 37196 updateHookTypesDev(); 37197 return updateEffect(create, deps); 37198 }, 37199 useImperativeHandle: function (ref, create, deps) { 37200 currentHookNameInDev = 'useImperativeHandle'; 37201 warnInvalidHookAccess(); 37202 updateHookTypesDev(); 37203 return updateImperativeHandle(ref, create, deps); 37204 }, 37205 useInsertionEffect: function (create, deps) { 37206 currentHookNameInDev = 'useInsertionEffect'; 37207 warnInvalidHookAccess(); 37208 updateHookTypesDev(); 37209 return updateInsertionEffect(create, deps); 37210 }, 37211 useLayoutEffect: function (create, deps) { 37212 currentHookNameInDev = 'useLayoutEffect'; 37213 warnInvalidHookAccess(); 37214 updateHookTypesDev(); 37215 return updateLayoutEffect(create, deps); 37216 }, 37217 useMemo: function (create, deps) { 37218 currentHookNameInDev = 'useMemo'; 37219 warnInvalidHookAccess(); 37220 updateHookTypesDev(); 37221 var prevDispatcher = ReactCurrentDispatcher$1.current; 37222 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 37223 37224 try { 37225 return updateMemo(create, deps); 37226 } finally { 37227 ReactCurrentDispatcher$1.current = prevDispatcher; 37228 } 37229 }, 37230 useReducer: function (reducer, initialArg, init) { 37231 currentHookNameInDev = 'useReducer'; 37232 warnInvalidHookAccess(); 37233 updateHookTypesDev(); 37234 var prevDispatcher = ReactCurrentDispatcher$1.current; 37235 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 37236 37237 try { 37238 return rerenderReducer(reducer, initialArg, init); 37239 } finally { 37240 ReactCurrentDispatcher$1.current = prevDispatcher; 37241 } 37242 }, 37243 useRef: function (initialValue) { 37244 currentHookNameInDev = 'useRef'; 37245 warnInvalidHookAccess(); 37246 updateHookTypesDev(); 37247 return updateRef(); 37248 }, 37249 useState: function (initialState) { 37250 currentHookNameInDev = 'useState'; 37251 warnInvalidHookAccess(); 37252 updateHookTypesDev(); 37253 var prevDispatcher = ReactCurrentDispatcher$1.current; 37254 ReactCurrentDispatcher$1.current = InvalidNestedHooksDispatcherOnUpdateInDEV; 37255 37256 try { 37257 return rerenderState(initialState); 37258 } finally { 37259 ReactCurrentDispatcher$1.current = prevDispatcher; 37260 } 37261 }, 37262 useDebugValue: function (value, formatterFn) { 37263 currentHookNameInDev = 'useDebugValue'; 37264 warnInvalidHookAccess(); 37265 updateHookTypesDev(); 37266 return updateDebugValue(); 37267 }, 37268 useDeferredValue: function (value) { 37269 currentHookNameInDev = 'useDeferredValue'; 37270 warnInvalidHookAccess(); 37271 updateHookTypesDev(); 37272 return rerenderDeferredValue(value); 37273 }, 37274 useTransition: function () { 37275 currentHookNameInDev = 'useTransition'; 37276 warnInvalidHookAccess(); 37277 updateHookTypesDev(); 37278 return rerenderTransition(); 37279 }, 37280 useMutableSource: function (source, getSnapshot, subscribe) { 37281 currentHookNameInDev = 'useMutableSource'; 37282 warnInvalidHookAccess(); 37283 updateHookTypesDev(); 37284 return updateMutableSource(); 37285 }, 37286 useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) { 37287 currentHookNameInDev = 'useSyncExternalStore'; 37288 warnInvalidHookAccess(); 37289 updateHookTypesDev(); 37290 return updateSyncExternalStore(subscribe, getSnapshot); 37291 }, 37292 useId: function () { 37293 currentHookNameInDev = 'useId'; 37294 warnInvalidHookAccess(); 37295 updateHookTypesDev(); 37296 return updateId(); 37297 }, 37298 unstable_isNewReconciler: enableNewReconciler 37299 }; 37300} 37301 37302var now$1 = Scheduler.unstable_now; 37303var commitTime = 0; 37304var layoutEffectStartTime = -1; 37305var profilerStartTime = -1; 37306var passiveEffectStartTime = -1; 37307/** 37308 * Tracks whether the current update was a nested/cascading update (scheduled from a layout effect). 37309 * 37310 * The overall sequence is: 37311 * 1. render 37312 * 2. commit (and call `onRender`, `onCommit`) 37313 * 3. check for nested updates 37314 * 4. flush passive effects (and call `onPostCommit`) 37315 * 37316 * Nested updates are identified in step 3 above, 37317 * but step 4 still applies to the work that was just committed. 37318 * We use two flags to track nested updates then: 37319 * one tracks whether the upcoming update is a nested update, 37320 * and the other tracks whether the current update was a nested update. 37321 * The first value gets synced to the second at the start of the render phase. 37322 */ 37323 37324var currentUpdateIsNested = false; 37325var nestedUpdateScheduled = false; 37326 37327function isCurrentUpdateNested() { 37328 return currentUpdateIsNested; 37329} 37330 37331function markNestedUpdateScheduled() { 37332 { 37333 nestedUpdateScheduled = true; 37334 } 37335} 37336 37337function resetNestedUpdateFlag() { 37338 { 37339 currentUpdateIsNested = false; 37340 nestedUpdateScheduled = false; 37341 } 37342} 37343 37344function syncNestedUpdateFlag() { 37345 { 37346 currentUpdateIsNested = nestedUpdateScheduled; 37347 nestedUpdateScheduled = false; 37348 } 37349} 37350 37351function getCommitTime() { 37352 return commitTime; 37353} 37354 37355function recordCommitTime() { 37356 37357 commitTime = now$1(); 37358} 37359 37360function startProfilerTimer(fiber) { 37361 37362 profilerStartTime = now$1(); 37363 37364 if (fiber.actualStartTime < 0) { 37365 fiber.actualStartTime = now$1(); 37366 } 37367} 37368 37369function stopProfilerTimerIfRunning(fiber) { 37370 37371 profilerStartTime = -1; 37372} 37373 37374function stopProfilerTimerIfRunningAndRecordDelta(fiber, overrideBaseTime) { 37375 37376 if (profilerStartTime >= 0) { 37377 var elapsedTime = now$1() - profilerStartTime; 37378 fiber.actualDuration += elapsedTime; 37379 37380 if (overrideBaseTime) { 37381 fiber.selfBaseDuration = elapsedTime; 37382 } 37383 37384 profilerStartTime = -1; 37385 } 37386} 37387 37388function recordLayoutEffectDuration(fiber) { 37389 37390 if (layoutEffectStartTime >= 0) { 37391 var elapsedTime = now$1() - layoutEffectStartTime; 37392 layoutEffectStartTime = -1; // Store duration on the next nearest Profiler ancestor 37393 // Or the root (for the DevTools Profiler to read) 37394 37395 var parentFiber = fiber.return; 37396 37397 while (parentFiber !== null) { 37398 switch (parentFiber.tag) { 37399 case HostRoot: 37400 var root = parentFiber.stateNode; 37401 root.effectDuration += elapsedTime; 37402 return; 37403 37404 case Profiler: 37405 var parentStateNode = parentFiber.stateNode; 37406 parentStateNode.effectDuration += elapsedTime; 37407 return; 37408 } 37409 37410 parentFiber = parentFiber.return; 37411 } 37412 } 37413} 37414 37415function recordPassiveEffectDuration(fiber) { 37416 37417 if (passiveEffectStartTime >= 0) { 37418 var elapsedTime = now$1() - passiveEffectStartTime; 37419 passiveEffectStartTime = -1; // Store duration on the next nearest Profiler ancestor 37420 // Or the root (for the DevTools Profiler to read) 37421 37422 var parentFiber = fiber.return; 37423 37424 while (parentFiber !== null) { 37425 switch (parentFiber.tag) { 37426 case HostRoot: 37427 var root = parentFiber.stateNode; 37428 37429 if (root !== null) { 37430 root.passiveEffectDuration += elapsedTime; 37431 } 37432 37433 return; 37434 37435 case Profiler: 37436 var parentStateNode = parentFiber.stateNode; 37437 37438 if (parentStateNode !== null) { 37439 // Detached fibers have their state node cleared out. 37440 // In this case, the return pointer is also cleared out, 37441 // so we won't be able to report the time spent in this Profiler's subtree. 37442 parentStateNode.passiveEffectDuration += elapsedTime; 37443 } 37444 37445 return; 37446 } 37447 37448 parentFiber = parentFiber.return; 37449 } 37450 } 37451} 37452 37453function startLayoutEffectTimer() { 37454 37455 layoutEffectStartTime = now$1(); 37456} 37457 37458function startPassiveEffectTimer() { 37459 37460 passiveEffectStartTime = now$1(); 37461} 37462 37463function transferActualDuration(fiber) { 37464 // Transfer time spent rendering these children so we don't lose it 37465 // after we rerender. This is used as a helper in special cases 37466 // where we should count the work of multiple passes. 37467 var child = fiber.child; 37468 37469 while (child) { 37470 fiber.actualDuration += child.actualDuration; 37471 child = child.sibling; 37472 } 37473} 37474 37475function resolveDefaultProps(Component, baseProps) { 37476 if (Component && Component.defaultProps) { 37477 // Resolve default props. Taken from ReactElement 37478 var props = assign({}, baseProps); 37479 var defaultProps = Component.defaultProps; 37480 37481 for (var propName in defaultProps) { 37482 if (props[propName] === undefined) { 37483 props[propName] = defaultProps[propName]; 37484 } 37485 } 37486 37487 return props; 37488 } 37489 37490 return baseProps; 37491} 37492 37493var fakeInternalInstance = {}; 37494var didWarnAboutStateAssignmentForComponent; 37495var didWarnAboutUninitializedState; 37496var didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate; 37497var didWarnAboutLegacyLifecyclesAndDerivedState; 37498var didWarnAboutUndefinedDerivedState; 37499var warnOnUndefinedDerivedState; 37500var warnOnInvalidCallback; 37501var didWarnAboutDirectlyAssigningPropsToState; 37502var didWarnAboutContextTypeAndContextTypes; 37503var didWarnAboutInvalidateContextType; 37504var didWarnAboutLegacyContext$1; 37505 37506{ 37507 didWarnAboutStateAssignmentForComponent = new Set(); 37508 didWarnAboutUninitializedState = new Set(); 37509 didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate = new Set(); 37510 didWarnAboutLegacyLifecyclesAndDerivedState = new Set(); 37511 didWarnAboutDirectlyAssigningPropsToState = new Set(); 37512 didWarnAboutUndefinedDerivedState = new Set(); 37513 didWarnAboutContextTypeAndContextTypes = new Set(); 37514 didWarnAboutInvalidateContextType = new Set(); 37515 didWarnAboutLegacyContext$1 = new Set(); 37516 var didWarnOnInvalidCallback = new Set(); 37517 37518 warnOnInvalidCallback = function (callback, callerName) { 37519 if (callback === null || typeof callback === 'function') { 37520 return; 37521 } 37522 37523 var key = callerName + '_' + callback; 37524 37525 if (!didWarnOnInvalidCallback.has(key)) { 37526 didWarnOnInvalidCallback.add(key); 37527 37528 error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); 37529 } 37530 }; 37531 37532 warnOnUndefinedDerivedState = function (type, partialState) { 37533 if (partialState === undefined) { 37534 var componentName = getComponentNameFromType(type) || 'Component'; 37535 37536 if (!didWarnAboutUndefinedDerivedState.has(componentName)) { 37537 didWarnAboutUndefinedDerivedState.add(componentName); 37538 37539 error('%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' + 'You have returned undefined.', componentName); 37540 } 37541 } 37542 }; // This is so gross but it's at least non-critical and can be removed if 37543 // it causes problems. This is meant to give a nicer error message for 37544 // ReactDOM15.unstable_renderSubtreeIntoContainer(reactDOM16Component, 37545 // ...)) which otherwise throws a "_processChildContext is not a function" 37546 // exception. 37547 37548 37549 Object.defineProperty(fakeInternalInstance, '_processChildContext', { 37550 enumerable: false, 37551 value: function () { 37552 throw new Error('_processChildContext is not available in React 16+. This likely ' + 'means you have multiple copies of React and are attempting to nest ' + 'a React 15 tree inside a React 16 tree using ' + "unstable_renderSubtreeIntoContainer, which isn't supported. Try " + 'to make sure you have only one copy of React (and ideally, switch ' + 'to ReactDOM.createPortal).'); 37553 } 37554 }); 37555 Object.freeze(fakeInternalInstance); 37556} 37557 37558function applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, nextProps) { 37559 var prevState = workInProgress.memoizedState; 37560 var partialState = getDerivedStateFromProps(nextProps, prevState); 37561 37562 { 37563 if ( workInProgress.mode & StrictLegacyMode) { 37564 setIsStrictModeForDevtools(true); 37565 37566 try { 37567 // Invoke the function an extra time to help detect side-effects. 37568 partialState = getDerivedStateFromProps(nextProps, prevState); 37569 } finally { 37570 setIsStrictModeForDevtools(false); 37571 } 37572 } 37573 37574 warnOnUndefinedDerivedState(ctor, partialState); 37575 } // Merge the partial state and the previous state. 37576 37577 37578 var memoizedState = partialState === null || partialState === undefined ? prevState : assign({}, prevState, partialState); 37579 workInProgress.memoizedState = memoizedState; // Once the update queue is empty, persist the derived state onto the 37580 // base state. 37581 37582 if (workInProgress.lanes === NoLanes) { 37583 // Queue is always non-null for classes 37584 var updateQueue = workInProgress.updateQueue; 37585 updateQueue.baseState = memoizedState; 37586 } 37587} 37588 37589var classComponentUpdater = { 37590 isMounted: isMounted, 37591 enqueueSetState: function (inst, payload, callback) { 37592 var fiber = get(inst); 37593 var eventTime = requestEventTime(); 37594 var lane = requestUpdateLane(fiber); 37595 var update = createUpdate(eventTime, lane); 37596 update.payload = payload; 37597 37598 if (callback !== undefined && callback !== null) { 37599 { 37600 warnOnInvalidCallback(callback, 'setState'); 37601 } 37602 37603 update.callback = callback; 37604 } 37605 37606 var root = enqueueUpdate(fiber, update, lane); 37607 37608 if (root !== null) { 37609 scheduleUpdateOnFiber(root, fiber, lane, eventTime); 37610 entangleTransitions(root, fiber, lane); 37611 } 37612 37613 { 37614 markStateUpdateScheduled(fiber, lane); 37615 } 37616 }, 37617 enqueueReplaceState: function (inst, payload, callback) { 37618 var fiber = get(inst); 37619 var eventTime = requestEventTime(); 37620 var lane = requestUpdateLane(fiber); 37621 var update = createUpdate(eventTime, lane); 37622 update.tag = ReplaceState; 37623 update.payload = payload; 37624 37625 if (callback !== undefined && callback !== null) { 37626 { 37627 warnOnInvalidCallback(callback, 'replaceState'); 37628 } 37629 37630 update.callback = callback; 37631 } 37632 37633 var root = enqueueUpdate(fiber, update, lane); 37634 37635 if (root !== null) { 37636 scheduleUpdateOnFiber(root, fiber, lane, eventTime); 37637 entangleTransitions(root, fiber, lane); 37638 } 37639 37640 { 37641 markStateUpdateScheduled(fiber, lane); 37642 } 37643 }, 37644 enqueueForceUpdate: function (inst, callback) { 37645 var fiber = get(inst); 37646 var eventTime = requestEventTime(); 37647 var lane = requestUpdateLane(fiber); 37648 var update = createUpdate(eventTime, lane); 37649 update.tag = ForceUpdate; 37650 37651 if (callback !== undefined && callback !== null) { 37652 { 37653 warnOnInvalidCallback(callback, 'forceUpdate'); 37654 } 37655 37656 update.callback = callback; 37657 } 37658 37659 var root = enqueueUpdate(fiber, update, lane); 37660 37661 if (root !== null) { 37662 scheduleUpdateOnFiber(root, fiber, lane, eventTime); 37663 entangleTransitions(root, fiber, lane); 37664 } 37665 37666 { 37667 markForceUpdateScheduled(fiber, lane); 37668 } 37669 } 37670}; 37671 37672function checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) { 37673 var instance = workInProgress.stateNode; 37674 37675 if (typeof instance.shouldComponentUpdate === 'function') { 37676 var shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext); 37677 37678 { 37679 if ( workInProgress.mode & StrictLegacyMode) { 37680 setIsStrictModeForDevtools(true); 37681 37682 try { 37683 // Invoke the function an extra time to help detect side-effects. 37684 shouldUpdate = instance.shouldComponentUpdate(newProps, newState, nextContext); 37685 } finally { 37686 setIsStrictModeForDevtools(false); 37687 } 37688 } 37689 37690 if (shouldUpdate === undefined) { 37691 error('%s.shouldComponentUpdate(): Returned undefined instead of a ' + 'boolean value. Make sure to return true or false.', getComponentNameFromType(ctor) || 'Component'); 37692 } 37693 } 37694 37695 return shouldUpdate; 37696 } 37697 37698 if (ctor.prototype && ctor.prototype.isPureReactComponent) { 37699 return !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState); 37700 } 37701 37702 return true; 37703} 37704 37705function checkClassInstance(workInProgress, ctor, newProps) { 37706 var instance = workInProgress.stateNode; 37707 37708 { 37709 var name = getComponentNameFromType(ctor) || 'Component'; 37710 var renderPresent = instance.render; 37711 37712 if (!renderPresent) { 37713 if (ctor.prototype && typeof ctor.prototype.render === 'function') { 37714 error('%s(...): No `render` method found on the returned component ' + 'instance: did you accidentally return an object from the constructor?', name); 37715 } else { 37716 error('%s(...): No `render` method found on the returned component ' + 'instance: you may have forgotten to define `render`.', name); 37717 } 37718 } 37719 37720 if (instance.getInitialState && !instance.getInitialState.isReactClassApproved && !instance.state) { 37721 error('getInitialState was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Did you mean to define a state property instead?', name); 37722 } 37723 37724 if (instance.getDefaultProps && !instance.getDefaultProps.isReactClassApproved) { 37725 error('getDefaultProps was defined on %s, a plain JavaScript class. ' + 'This is only supported for classes created using React.createClass. ' + 'Use a static property to define defaultProps instead.', name); 37726 } 37727 37728 if (instance.propTypes) { 37729 error('propTypes was defined as an instance property on %s. Use a static ' + 'property to define propTypes instead.', name); 37730 } 37731 37732 if (instance.contextType) { 37733 error('contextType was defined as an instance property on %s. Use a static ' + 'property to define contextType instead.', name); 37734 } 37735 37736 { 37737 if (ctor.childContextTypes && !didWarnAboutLegacyContext$1.has(ctor) && // Strict Mode has its own warning for legacy context, so we can skip 37738 // this one. 37739 (workInProgress.mode & StrictLegacyMode) === NoMode) { 37740 didWarnAboutLegacyContext$1.add(ctor); 37741 37742 error('%s uses the legacy childContextTypes API which is no longer ' + 'supported and will be removed in the next major release. Use ' + 'React.createContext() instead\n\n.' + 'Learn more about this warning here: https://reactjs.org/link/legacy-context', name); 37743 } 37744 37745 if (ctor.contextTypes && !didWarnAboutLegacyContext$1.has(ctor) && // Strict Mode has its own warning for legacy context, so we can skip 37746 // this one. 37747 (workInProgress.mode & StrictLegacyMode) === NoMode) { 37748 didWarnAboutLegacyContext$1.add(ctor); 37749 37750 error('%s uses the legacy contextTypes API which is no longer supported ' + 'and will be removed in the next major release. Use ' + 'React.createContext() with static contextType instead.\n\n' + 'Learn more about this warning here: https://reactjs.org/link/legacy-context', name); 37751 } 37752 37753 if (instance.contextTypes) { 37754 error('contextTypes was defined as an instance property on %s. Use a static ' + 'property to define contextTypes instead.', name); 37755 } 37756 37757 if (ctor.contextType && ctor.contextTypes && !didWarnAboutContextTypeAndContextTypes.has(ctor)) { 37758 didWarnAboutContextTypeAndContextTypes.add(ctor); 37759 37760 error('%s declares both contextTypes and contextType static properties. ' + 'The legacy contextTypes property will be ignored.', name); 37761 } 37762 } 37763 37764 if (typeof instance.componentShouldUpdate === 'function') { 37765 error('%s has a method called ' + 'componentShouldUpdate(). Did you mean shouldComponentUpdate()? ' + 'The name is phrased as a question because the function is ' + 'expected to return a value.', name); 37766 } 37767 37768 if (ctor.prototype && ctor.prototype.isPureReactComponent && typeof instance.shouldComponentUpdate !== 'undefined') { 37769 error('%s has a method called shouldComponentUpdate(). ' + 'shouldComponentUpdate should not be used when extending React.PureComponent. ' + 'Please extend React.Component if shouldComponentUpdate is used.', getComponentNameFromType(ctor) || 'A pure component'); 37770 } 37771 37772 if (typeof instance.componentDidUnmount === 'function') { 37773 error('%s has a method called ' + 'componentDidUnmount(). But there is no such lifecycle method. ' + 'Did you mean componentWillUnmount()?', name); 37774 } 37775 37776 if (typeof instance.componentDidReceiveProps === 'function') { 37777 error('%s has a method called ' + 'componentDidReceiveProps(). But there is no such lifecycle method. ' + 'If you meant to update the state in response to changing props, ' + 'use componentWillReceiveProps(). If you meant to fetch data or ' + 'run side-effects or mutations after React has updated the UI, use componentDidUpdate().', name); 37778 } 37779 37780 if (typeof instance.componentWillRecieveProps === 'function') { 37781 error('%s has a method called ' + 'componentWillRecieveProps(). Did you mean componentWillReceiveProps()?', name); 37782 } 37783 37784 if (typeof instance.UNSAFE_componentWillRecieveProps === 'function') { 37785 error('%s has a method called ' + 'UNSAFE_componentWillRecieveProps(). Did you mean UNSAFE_componentWillReceiveProps()?', name); 37786 } 37787 37788 var hasMutatedProps = instance.props !== newProps; 37789 37790 if (instance.props !== undefined && hasMutatedProps) { 37791 error('%s(...): When calling super() in `%s`, make sure to pass ' + "up the same props that your component's constructor was passed.", name, name); 37792 } 37793 37794 if (instance.defaultProps) { 37795 error('Setting defaultProps as an instance property on %s is not supported and will be ignored.' + ' Instead, define defaultProps as a static property on %s.', name, name); 37796 } 37797 37798 if (typeof instance.getSnapshotBeforeUpdate === 'function' && typeof instance.componentDidUpdate !== 'function' && !didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.has(ctor)) { 37799 didWarnAboutGetSnapshotBeforeUpdateWithoutDidUpdate.add(ctor); 37800 37801 error('%s: getSnapshotBeforeUpdate() should be used with componentDidUpdate(). ' + 'This component defines getSnapshotBeforeUpdate() only.', getComponentNameFromType(ctor)); 37802 } 37803 37804 if (typeof instance.getDerivedStateFromProps === 'function') { 37805 error('%s: getDerivedStateFromProps() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); 37806 } 37807 37808 if (typeof instance.getDerivedStateFromError === 'function') { 37809 error('%s: getDerivedStateFromError() is defined as an instance method ' + 'and will be ignored. Instead, declare it as a static method.', name); 37810 } 37811 37812 if (typeof ctor.getSnapshotBeforeUpdate === 'function') { 37813 error('%s: getSnapshotBeforeUpdate() is defined as a static method ' + 'and will be ignored. Instead, declare it as an instance method.', name); 37814 } 37815 37816 var _state = instance.state; 37817 37818 if (_state && (typeof _state !== 'object' || isArray(_state))) { 37819 error('%s.state: must be set to an object or null', name); 37820 } 37821 37822 if (typeof instance.getChildContext === 'function' && typeof ctor.childContextTypes !== 'object') { 37823 error('%s.getChildContext(): childContextTypes must be defined in order to ' + 'use getChildContext().', name); 37824 } 37825 } 37826} 37827 37828function adoptClassInstance(workInProgress, instance) { 37829 instance.updater = classComponentUpdater; 37830 workInProgress.stateNode = instance; // The instance needs access to the fiber so that it can schedule updates 37831 37832 set(instance, workInProgress); 37833 37834 { 37835 instance._reactInternalInstance = fakeInternalInstance; 37836 } 37837} 37838 37839function constructClassInstance(workInProgress, ctor, props) { 37840 var isLegacyContextConsumer = false; 37841 var unmaskedContext = emptyContextObject; 37842 var context = emptyContextObject; 37843 var contextType = ctor.contextType; 37844 37845 { 37846 if ('contextType' in ctor) { 37847 var isValid = // Allow null for conditional declaration 37848 contextType === null || contextType !== undefined && contextType.$$typeof === REACT_CONTEXT_TYPE && contextType._context === undefined; // Not a <Context.Consumer> 37849 37850 if (!isValid && !didWarnAboutInvalidateContextType.has(ctor)) { 37851 didWarnAboutInvalidateContextType.add(ctor); 37852 var addendum = ''; 37853 37854 if (contextType === undefined) { 37855 addendum = ' However, it is set to undefined. ' + 'This can be caused by a typo or by mixing up named and default imports. ' + 'This can also happen due to a circular dependency, so ' + 'try moving the createContext() call to a separate file.'; 37856 } else if (typeof contextType !== 'object') { 37857 addendum = ' However, it is set to a ' + typeof contextType + '.'; 37858 } else if (contextType.$$typeof === REACT_PROVIDER_TYPE) { 37859 addendum = ' Did you accidentally pass the Context.Provider instead?'; 37860 } else if (contextType._context !== undefined) { 37861 // <Context.Consumer> 37862 addendum = ' Did you accidentally pass the Context.Consumer instead?'; 37863 } else { 37864 addendum = ' However, it is set to an object with keys {' + Object.keys(contextType).join(', ') + '}.'; 37865 } 37866 37867 error('%s defines an invalid contextType. ' + 'contextType should point to the Context object returned by React.createContext().%s', getComponentNameFromType(ctor) || 'Component', addendum); 37868 } 37869 } 37870 } 37871 37872 if (typeof contextType === 'object' && contextType !== null) { 37873 context = readContext(contextType); 37874 } else { 37875 unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); 37876 var contextTypes = ctor.contextTypes; 37877 isLegacyContextConsumer = contextTypes !== null && contextTypes !== undefined; 37878 context = isLegacyContextConsumer ? getMaskedContext(workInProgress, unmaskedContext) : emptyContextObject; 37879 } 37880 37881 var instance = new ctor(props, context); // Instantiate twice to help detect side-effects. 37882 37883 { 37884 if ( workInProgress.mode & StrictLegacyMode) { 37885 setIsStrictModeForDevtools(true); 37886 37887 try { 37888 instance = new ctor(props, context); // eslint-disable-line no-new 37889 } finally { 37890 setIsStrictModeForDevtools(false); 37891 } 37892 } 37893 } 37894 37895 var state = workInProgress.memoizedState = instance.state !== null && instance.state !== undefined ? instance.state : null; 37896 adoptClassInstance(workInProgress, instance); 37897 37898 { 37899 if (typeof ctor.getDerivedStateFromProps === 'function' && state === null) { 37900 var componentName = getComponentNameFromType(ctor) || 'Component'; 37901 37902 if (!didWarnAboutUninitializedState.has(componentName)) { 37903 didWarnAboutUninitializedState.add(componentName); 37904 37905 error('`%s` uses `getDerivedStateFromProps` but its initial state is ' + '%s. This is not recommended. Instead, define the initial state by ' + 'assigning an object to `this.state` in the constructor of `%s`. ' + 'This ensures that `getDerivedStateFromProps` arguments have a consistent shape.', componentName, instance.state === null ? 'null' : 'undefined', componentName); 37906 } 37907 } // If new component APIs are defined, "unsafe" lifecycles won't be called. 37908 // Warn about these lifecycles if they are present. 37909 // Don't warn about react-lifecycles-compat polyfilled methods though. 37910 37911 37912 if (typeof ctor.getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function') { 37913 var foundWillMountName = null; 37914 var foundWillReceivePropsName = null; 37915 var foundWillUpdateName = null; 37916 37917 if (typeof instance.componentWillMount === 'function' && instance.componentWillMount.__suppressDeprecationWarning !== true) { 37918 foundWillMountName = 'componentWillMount'; 37919 } else if (typeof instance.UNSAFE_componentWillMount === 'function') { 37920 foundWillMountName = 'UNSAFE_componentWillMount'; 37921 } 37922 37923 if (typeof instance.componentWillReceiveProps === 'function' && instance.componentWillReceiveProps.__suppressDeprecationWarning !== true) { 37924 foundWillReceivePropsName = 'componentWillReceiveProps'; 37925 } else if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { 37926 foundWillReceivePropsName = 'UNSAFE_componentWillReceiveProps'; 37927 } 37928 37929 if (typeof instance.componentWillUpdate === 'function' && instance.componentWillUpdate.__suppressDeprecationWarning !== true) { 37930 foundWillUpdateName = 'componentWillUpdate'; 37931 } else if (typeof instance.UNSAFE_componentWillUpdate === 'function') { 37932 foundWillUpdateName = 'UNSAFE_componentWillUpdate'; 37933 } 37934 37935 if (foundWillMountName !== null || foundWillReceivePropsName !== null || foundWillUpdateName !== null) { 37936 var _componentName = getComponentNameFromType(ctor) || 'Component'; 37937 37938 var newApiName = typeof ctor.getDerivedStateFromProps === 'function' ? 'getDerivedStateFromProps()' : 'getSnapshotBeforeUpdate()'; 37939 37940 if (!didWarnAboutLegacyLifecyclesAndDerivedState.has(_componentName)) { 37941 didWarnAboutLegacyLifecyclesAndDerivedState.add(_componentName); 37942 37943 error('Unsafe legacy lifecycles will not be called for components using new component APIs.\n\n' + '%s uses %s but also contains the following legacy lifecycles:%s%s%s\n\n' + 'The above lifecycles should be removed. Learn more about this warning here:\n' + 'https://reactjs.org/link/unsafe-component-lifecycles', _componentName, newApiName, foundWillMountName !== null ? "\n " + foundWillMountName : '', foundWillReceivePropsName !== null ? "\n " + foundWillReceivePropsName : '', foundWillUpdateName !== null ? "\n " + foundWillUpdateName : ''); 37944 } 37945 } 37946 } 37947 } // Cache unmasked context so we can avoid recreating masked context unless necessary. 37948 // ReactFiberContext usually updates this cache but can't for newly-created instances. 37949 37950 37951 if (isLegacyContextConsumer) { 37952 cacheContext(workInProgress, unmaskedContext, context); 37953 } 37954 37955 return instance; 37956} 37957 37958function callComponentWillMount(workInProgress, instance) { 37959 var oldState = instance.state; 37960 37961 if (typeof instance.componentWillMount === 'function') { 37962 instance.componentWillMount(); 37963 } 37964 37965 if (typeof instance.UNSAFE_componentWillMount === 'function') { 37966 instance.UNSAFE_componentWillMount(); 37967 } 37968 37969 if (oldState !== instance.state) { 37970 { 37971 error('%s.componentWillMount(): Assigning directly to this.state is ' + "deprecated (except inside a component's " + 'constructor). Use setState instead.', getComponentNameFromFiber(workInProgress) || 'Component'); 37972 } 37973 37974 classComponentUpdater.enqueueReplaceState(instance, instance.state, null); 37975 } 37976} 37977 37978function callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext) { 37979 var oldState = instance.state; 37980 37981 if (typeof instance.componentWillReceiveProps === 'function') { 37982 instance.componentWillReceiveProps(newProps, nextContext); 37983 } 37984 37985 if (typeof instance.UNSAFE_componentWillReceiveProps === 'function') { 37986 instance.UNSAFE_componentWillReceiveProps(newProps, nextContext); 37987 } 37988 37989 if (instance.state !== oldState) { 37990 { 37991 var componentName = getComponentNameFromFiber(workInProgress) || 'Component'; 37992 37993 if (!didWarnAboutStateAssignmentForComponent.has(componentName)) { 37994 didWarnAboutStateAssignmentForComponent.add(componentName); 37995 37996 error('%s.componentWillReceiveProps(): Assigning directly to ' + "this.state is deprecated (except inside a component's " + 'constructor). Use setState instead.', componentName); 37997 } 37998 } 37999 38000 classComponentUpdater.enqueueReplaceState(instance, instance.state, null); 38001 } 38002} // Invokes the mount life-cycles on a previously never rendered instance. 38003 38004 38005function mountClassInstance(workInProgress, ctor, newProps, renderLanes) { 38006 { 38007 checkClassInstance(workInProgress, ctor, newProps); 38008 } 38009 38010 var instance = workInProgress.stateNode; 38011 instance.props = newProps; 38012 instance.state = workInProgress.memoizedState; 38013 instance.refs = {}; 38014 initializeUpdateQueue(workInProgress); 38015 var contextType = ctor.contextType; 38016 38017 if (typeof contextType === 'object' && contextType !== null) { 38018 instance.context = readContext(contextType); 38019 } else { 38020 var unmaskedContext = getUnmaskedContext(workInProgress, ctor, true); 38021 instance.context = getMaskedContext(workInProgress, unmaskedContext); 38022 } 38023 38024 { 38025 if (instance.state === newProps) { 38026 var componentName = getComponentNameFromType(ctor) || 'Component'; 38027 38028 if (!didWarnAboutDirectlyAssigningPropsToState.has(componentName)) { 38029 didWarnAboutDirectlyAssigningPropsToState.add(componentName); 38030 38031 error('%s: It is not recommended to assign props directly to state ' + "because updates to props won't be reflected in state. " + 'In most cases, it is better to use props directly.', componentName); 38032 } 38033 } 38034 38035 if (workInProgress.mode & StrictLegacyMode) { 38036 ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, instance); 38037 } 38038 38039 { 38040 ReactStrictModeWarnings.recordUnsafeLifecycleWarnings(workInProgress, instance); 38041 } 38042 } 38043 38044 instance.state = workInProgress.memoizedState; 38045 var getDerivedStateFromProps = ctor.getDerivedStateFromProps; 38046 38047 if (typeof getDerivedStateFromProps === 'function') { 38048 applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); 38049 instance.state = workInProgress.memoizedState; 38050 } // In order to support react-lifecycles-compat polyfilled components, 38051 // Unsafe lifecycles should not be invoked for components using the new APIs. 38052 38053 38054 if (typeof ctor.getDerivedStateFromProps !== 'function' && typeof instance.getSnapshotBeforeUpdate !== 'function' && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { 38055 callComponentWillMount(workInProgress, instance); // If we had additional state updates during this life-cycle, let's 38056 // process them now. 38057 38058 processUpdateQueue(workInProgress, newProps, instance, renderLanes); 38059 instance.state = workInProgress.memoizedState; 38060 } 38061 38062 if (typeof instance.componentDidMount === 'function') { 38063 var fiberFlags = Update; 38064 38065 { 38066 fiberFlags |= LayoutStatic; 38067 } 38068 38069 if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { 38070 fiberFlags |= MountLayoutDev; 38071 } 38072 38073 workInProgress.flags |= fiberFlags; 38074 } 38075} 38076 38077function resumeMountClassInstance(workInProgress, ctor, newProps, renderLanes) { 38078 var instance = workInProgress.stateNode; 38079 var oldProps = workInProgress.memoizedProps; 38080 instance.props = oldProps; 38081 var oldContext = instance.context; 38082 var contextType = ctor.contextType; 38083 var nextContext = emptyContextObject; 38084 38085 if (typeof contextType === 'object' && contextType !== null) { 38086 nextContext = readContext(contextType); 38087 } else { 38088 var nextLegacyUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); 38089 nextContext = getMaskedContext(workInProgress, nextLegacyUnmaskedContext); 38090 } 38091 38092 var getDerivedStateFromProps = ctor.getDerivedStateFromProps; 38093 var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what 38094 // ever the previously attempted to render - not the "current". However, 38095 // during componentDidUpdate we pass the "current" props. 38096 // In order to support react-lifecycles-compat polyfilled components, 38097 // Unsafe lifecycles should not be invoked for components using the new APIs. 38098 38099 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { 38100 if (oldProps !== newProps || oldContext !== nextContext) { 38101 callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); 38102 } 38103 } 38104 38105 resetHasForceUpdateBeforeProcessing(); 38106 var oldState = workInProgress.memoizedState; 38107 var newState = instance.state = oldState; 38108 processUpdateQueue(workInProgress, newProps, instance, renderLanes); 38109 newState = workInProgress.memoizedState; 38110 38111 if (oldProps === newProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing()) { 38112 // If an update was already in progress, we should schedule an Update 38113 // effect even though we're bailing out, so that cWU/cDU are called. 38114 if (typeof instance.componentDidMount === 'function') { 38115 var fiberFlags = Update; 38116 38117 { 38118 fiberFlags |= LayoutStatic; 38119 } 38120 38121 if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { 38122 fiberFlags |= MountLayoutDev; 38123 } 38124 38125 workInProgress.flags |= fiberFlags; 38126 } 38127 38128 return false; 38129 } 38130 38131 if (typeof getDerivedStateFromProps === 'function') { 38132 applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); 38133 newState = workInProgress.memoizedState; 38134 } 38135 38136 var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext); 38137 38138 if (shouldUpdate) { 38139 // In order to support react-lifecycles-compat polyfilled components, 38140 // Unsafe lifecycles should not be invoked for components using the new APIs. 38141 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillMount === 'function' || typeof instance.componentWillMount === 'function')) { 38142 if (typeof instance.componentWillMount === 'function') { 38143 instance.componentWillMount(); 38144 } 38145 38146 if (typeof instance.UNSAFE_componentWillMount === 'function') { 38147 instance.UNSAFE_componentWillMount(); 38148 } 38149 } 38150 38151 if (typeof instance.componentDidMount === 'function') { 38152 var _fiberFlags = Update; 38153 38154 { 38155 _fiberFlags |= LayoutStatic; 38156 } 38157 38158 if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { 38159 _fiberFlags |= MountLayoutDev; 38160 } 38161 38162 workInProgress.flags |= _fiberFlags; 38163 } 38164 } else { 38165 // If an update was already in progress, we should schedule an Update 38166 // effect even though we're bailing out, so that cWU/cDU are called. 38167 if (typeof instance.componentDidMount === 'function') { 38168 var _fiberFlags2 = Update; 38169 38170 { 38171 _fiberFlags2 |= LayoutStatic; 38172 } 38173 38174 if ( (workInProgress.mode & StrictEffectsMode) !== NoMode) { 38175 _fiberFlags2 |= MountLayoutDev; 38176 } 38177 38178 workInProgress.flags |= _fiberFlags2; 38179 } // If shouldComponentUpdate returned false, we should still update the 38180 // memoized state to indicate that this work can be reused. 38181 38182 38183 workInProgress.memoizedProps = newProps; 38184 workInProgress.memoizedState = newState; 38185 } // Update the existing instance's state, props, and context pointers even 38186 // if shouldComponentUpdate returns false. 38187 38188 38189 instance.props = newProps; 38190 instance.state = newState; 38191 instance.context = nextContext; 38192 return shouldUpdate; 38193} // Invokes the update life-cycles and returns false if it shouldn't rerender. 38194 38195 38196function updateClassInstance(current, workInProgress, ctor, newProps, renderLanes) { 38197 var instance = workInProgress.stateNode; 38198 cloneUpdateQueue(current, workInProgress); 38199 var unresolvedOldProps = workInProgress.memoizedProps; 38200 var oldProps = workInProgress.type === workInProgress.elementType ? unresolvedOldProps : resolveDefaultProps(workInProgress.type, unresolvedOldProps); 38201 instance.props = oldProps; 38202 var unresolvedNewProps = workInProgress.pendingProps; 38203 var oldContext = instance.context; 38204 var contextType = ctor.contextType; 38205 var nextContext = emptyContextObject; 38206 38207 if (typeof contextType === 'object' && contextType !== null) { 38208 nextContext = readContext(contextType); 38209 } else { 38210 var nextUnmaskedContext = getUnmaskedContext(workInProgress, ctor, true); 38211 nextContext = getMaskedContext(workInProgress, nextUnmaskedContext); 38212 } 38213 38214 var getDerivedStateFromProps = ctor.getDerivedStateFromProps; 38215 var hasNewLifecycles = typeof getDerivedStateFromProps === 'function' || typeof instance.getSnapshotBeforeUpdate === 'function'; // Note: During these life-cycles, instance.props/instance.state are what 38216 // ever the previously attempted to render - not the "current". However, 38217 // during componentDidUpdate we pass the "current" props. 38218 // In order to support react-lifecycles-compat polyfilled components, 38219 // Unsafe lifecycles should not be invoked for components using the new APIs. 38220 38221 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillReceiveProps === 'function' || typeof instance.componentWillReceiveProps === 'function')) { 38222 if (unresolvedOldProps !== unresolvedNewProps || oldContext !== nextContext) { 38223 callComponentWillReceiveProps(workInProgress, instance, newProps, nextContext); 38224 } 38225 } 38226 38227 resetHasForceUpdateBeforeProcessing(); 38228 var oldState = workInProgress.memoizedState; 38229 var newState = instance.state = oldState; 38230 processUpdateQueue(workInProgress, newProps, instance, renderLanes); 38231 newState = workInProgress.memoizedState; 38232 38233 if (unresolvedOldProps === unresolvedNewProps && oldState === newState && !hasContextChanged() && !checkHasForceUpdateAfterProcessing() && !(enableLazyContextPropagation )) { 38234 // If an update was already in progress, we should schedule an Update 38235 // effect even though we're bailing out, so that cWU/cDU are called. 38236 if (typeof instance.componentDidUpdate === 'function') { 38237 if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { 38238 workInProgress.flags |= Update; 38239 } 38240 } 38241 38242 if (typeof instance.getSnapshotBeforeUpdate === 'function') { 38243 if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { 38244 workInProgress.flags |= Snapshot; 38245 } 38246 } 38247 38248 return false; 38249 } 38250 38251 if (typeof getDerivedStateFromProps === 'function') { 38252 applyDerivedStateFromProps(workInProgress, ctor, getDerivedStateFromProps, newProps); 38253 newState = workInProgress.memoizedState; 38254 } 38255 38256 var shouldUpdate = checkHasForceUpdateAfterProcessing() || checkShouldComponentUpdate(workInProgress, ctor, oldProps, newProps, oldState, newState, nextContext) || // TODO: In some cases, we'll end up checking if context has changed twice, 38257 // both before and after `shouldComponentUpdate` has been called. Not ideal, 38258 // but I'm loath to refactor this function. This only happens for memoized 38259 // components so it's not that common. 38260 enableLazyContextPropagation ; 38261 38262 if (shouldUpdate) { 38263 // In order to support react-lifecycles-compat polyfilled components, 38264 // Unsafe lifecycles should not be invoked for components using the new APIs. 38265 if (!hasNewLifecycles && (typeof instance.UNSAFE_componentWillUpdate === 'function' || typeof instance.componentWillUpdate === 'function')) { 38266 if (typeof instance.componentWillUpdate === 'function') { 38267 instance.componentWillUpdate(newProps, newState, nextContext); 38268 } 38269 38270 if (typeof instance.UNSAFE_componentWillUpdate === 'function') { 38271 instance.UNSAFE_componentWillUpdate(newProps, newState, nextContext); 38272 } 38273 } 38274 38275 if (typeof instance.componentDidUpdate === 'function') { 38276 workInProgress.flags |= Update; 38277 } 38278 38279 if (typeof instance.getSnapshotBeforeUpdate === 'function') { 38280 workInProgress.flags |= Snapshot; 38281 } 38282 } else { 38283 // If an update was already in progress, we should schedule an Update 38284 // effect even though we're bailing out, so that cWU/cDU are called. 38285 if (typeof instance.componentDidUpdate === 'function') { 38286 if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { 38287 workInProgress.flags |= Update; 38288 } 38289 } 38290 38291 if (typeof instance.getSnapshotBeforeUpdate === 'function') { 38292 if (unresolvedOldProps !== current.memoizedProps || oldState !== current.memoizedState) { 38293 workInProgress.flags |= Snapshot; 38294 } 38295 } // If shouldComponentUpdate returned false, we should still update the 38296 // memoized props/state to indicate that this work can be reused. 38297 38298 38299 workInProgress.memoizedProps = newProps; 38300 workInProgress.memoizedState = newState; 38301 } // Update the existing instance's state, props, and context pointers even 38302 // if shouldComponentUpdate returns false. 38303 38304 38305 instance.props = newProps; 38306 instance.state = newState; 38307 instance.context = nextContext; 38308 return shouldUpdate; 38309} 38310 38311function createCapturedValueAtFiber(value, source) { 38312 // If the value is an error, call this function immediately after it is thrown 38313 // so the stack is accurate. 38314 return { 38315 value: value, 38316 source: source, 38317 stack: getStackByFiberInDevAndProd(source), 38318 digest: null 38319 }; 38320} 38321function createCapturedValue(value, digest, stack) { 38322 return { 38323 value: value, 38324 source: null, 38325 stack: stack != null ? stack : null, 38326 digest: digest != null ? digest : null 38327 }; 38328} 38329 38330// This module is forked in different environments. 38331// By default, return `true` to log errors to the console. 38332// Forks can return `false` if this isn't desirable. 38333function showErrorDialog(boundary, errorInfo) { 38334 return true; 38335} 38336 38337function logCapturedError(boundary, errorInfo) { 38338 try { 38339 var logError = showErrorDialog(boundary, errorInfo); // Allow injected showErrorDialog() to prevent default console.error logging. 38340 // This enables renderers like ReactNative to better manage redbox behavior. 38341 38342 if (logError === false) { 38343 return; 38344 } 38345 38346 var error = errorInfo.value; 38347 38348 if (true) { 38349 var source = errorInfo.source; 38350 var stack = errorInfo.stack; 38351 var componentStack = stack !== null ? stack : ''; // Browsers support silencing uncaught errors by calling 38352 // `preventDefault()` in window `error` handler. 38353 // We record this information as an expando on the error. 38354 38355 if (error != null && error._suppressLogging) { 38356 if (boundary.tag === ClassComponent) { 38357 // The error is recoverable and was silenced. 38358 // Ignore it and don't print the stack addendum. 38359 // This is handy for testing error boundaries without noise. 38360 return; 38361 } // The error is fatal. Since the silencing might have 38362 // been accidental, we'll surface it anyway. 38363 // However, the browser would have silenced the original error 38364 // so we'll print it first, and then print the stack addendum. 38365 38366 38367 console['error'](error); // Don't transform to our wrapper 38368 // For a more detailed description of this block, see: 38369 // https://github.com/facebook/react/pull/13384 38370 } 38371 38372 var componentName = source ? getComponentNameFromFiber(source) : null; 38373 var componentNameMessage = componentName ? "The above error occurred in the <" + componentName + "> component:" : 'The above error occurred in one of your React components:'; 38374 var errorBoundaryMessage; 38375 38376 if (boundary.tag === HostRoot) { 38377 errorBoundaryMessage = 'Consider adding an error boundary to your tree to customize error handling behavior.\n' + 'Visit https://reactjs.org/link/error-boundaries to learn more about error boundaries.'; 38378 } else { 38379 var errorBoundaryName = getComponentNameFromFiber(boundary) || 'Anonymous'; 38380 errorBoundaryMessage = "React will try to recreate this component tree from scratch " + ("using the error boundary you provided, " + errorBoundaryName + "."); 38381 } 38382 38383 var combinedMessage = componentNameMessage + "\n" + componentStack + "\n\n" + ("" + errorBoundaryMessage); // In development, we provide our own message with just the component stack. 38384 // We don't include the original error message and JS stack because the browser 38385 // has already printed it. Even if the application swallows the error, it is still 38386 // displayed by the browser thanks to the DEV-only fake event trick in ReactErrorUtils. 38387 38388 console['error'](combinedMessage); // Don't transform to our wrapper 38389 } else {} 38390 } catch (e) { 38391 // This method must not throw, or React internal state will get messed up. 38392 // If console.error is overridden, or logCapturedError() shows a dialog that throws, 38393 // we want to report this error outside of the normal stack as a last resort. 38394 // https://github.com/facebook/react/issues/13188 38395 setTimeout(function () { 38396 throw e; 38397 }); 38398 } 38399} 38400 38401var PossiblyWeakMap$1 = typeof WeakMap === 'function' ? WeakMap : Map; 38402 38403function createRootErrorUpdate(fiber, errorInfo, lane) { 38404 var update = createUpdate(NoTimestamp, lane); // Unmount the root by rendering null. 38405 38406 update.tag = CaptureUpdate; // Caution: React DevTools currently depends on this property 38407 // being called "element". 38408 38409 update.payload = { 38410 element: null 38411 }; 38412 var error = errorInfo.value; 38413 38414 update.callback = function () { 38415 onUncaughtError(error); 38416 logCapturedError(fiber, errorInfo); 38417 }; 38418 38419 return update; 38420} 38421 38422function createClassErrorUpdate(fiber, errorInfo, lane) { 38423 var update = createUpdate(NoTimestamp, lane); 38424 update.tag = CaptureUpdate; 38425 var getDerivedStateFromError = fiber.type.getDerivedStateFromError; 38426 38427 if (typeof getDerivedStateFromError === 'function') { 38428 var error$1 = errorInfo.value; 38429 38430 update.payload = function () { 38431 return getDerivedStateFromError(error$1); 38432 }; 38433 38434 update.callback = function () { 38435 { 38436 markFailedErrorBoundaryForHotReloading(fiber); 38437 } 38438 38439 logCapturedError(fiber, errorInfo); 38440 }; 38441 } 38442 38443 var inst = fiber.stateNode; 38444 38445 if (inst !== null && typeof inst.componentDidCatch === 'function') { 38446 update.callback = function callback() { 38447 { 38448 markFailedErrorBoundaryForHotReloading(fiber); 38449 } 38450 38451 logCapturedError(fiber, errorInfo); 38452 38453 if (typeof getDerivedStateFromError !== 'function') { 38454 // To preserve the preexisting retry behavior of error boundaries, 38455 // we keep track of which ones already failed during this batch. 38456 // This gets reset before we yield back to the browser. 38457 // TODO: Warn in strict mode if getDerivedStateFromError is 38458 // not defined. 38459 markLegacyErrorBoundaryAsFailed(this); 38460 } 38461 38462 var error$1 = errorInfo.value; 38463 var stack = errorInfo.stack; 38464 this.componentDidCatch(error$1, { 38465 componentStack: stack !== null ? stack : '' 38466 }); 38467 38468 { 38469 if (typeof getDerivedStateFromError !== 'function') { 38470 // If componentDidCatch is the only error boundary method defined, 38471 // then it needs to call setState to recover from errors. 38472 // If no state update is scheduled then the boundary will swallow the error. 38473 if (!includesSomeLane(fiber.lanes, SyncLane)) { 38474 error('%s: Error boundaries should implement getDerivedStateFromError(). ' + 'In that method, return a state update to display an error message or fallback UI.', getComponentNameFromFiber(fiber) || 'Unknown'); 38475 } 38476 } 38477 } 38478 }; 38479 } 38480 38481 return update; 38482} 38483 38484function attachPingListener(root, wakeable, lanes) { 38485 // Attach a ping listener 38486 // 38487 // The data might resolve before we have a chance to commit the fallback. Or, 38488 // in the case of a refresh, we'll never commit a fallback. So we need to 38489 // attach a listener now. When it resolves ("pings"), we can decide whether to 38490 // try rendering the tree again. 38491 // 38492 // Only attach a listener if one does not already exist for the lanes 38493 // we're currently rendering (which acts like a "thread ID" here). 38494 // 38495 // We only need to do this in concurrent mode. Legacy Suspense always 38496 // commits fallbacks synchronously, so there are no pings. 38497 var pingCache = root.pingCache; 38498 var threadIDs; 38499 38500 if (pingCache === null) { 38501 pingCache = root.pingCache = new PossiblyWeakMap$1(); 38502 threadIDs = new Set(); 38503 pingCache.set(wakeable, threadIDs); 38504 } else { 38505 threadIDs = pingCache.get(wakeable); 38506 38507 if (threadIDs === undefined) { 38508 threadIDs = new Set(); 38509 pingCache.set(wakeable, threadIDs); 38510 } 38511 } 38512 38513 if (!threadIDs.has(lanes)) { 38514 // Memoize using the thread ID to prevent redundant listeners. 38515 threadIDs.add(lanes); 38516 var ping = pingSuspendedRoot.bind(null, root, wakeable, lanes); 38517 38518 { 38519 if (isDevToolsPresent) { 38520 // If we have pending work still, restore the original updaters 38521 restorePendingUpdaters(root, lanes); 38522 } 38523 } 38524 38525 wakeable.then(ping, ping); 38526 } 38527} 38528 38529function attachRetryListener(suspenseBoundary, root, wakeable, lanes) { 38530 // Retry listener 38531 // 38532 // If the fallback does commit, we need to attach a different type of 38533 // listener. This one schedules an update on the Suspense boundary to turn 38534 // the fallback state off. 38535 // 38536 // Stash the wakeable on the boundary fiber so we can access it in the 38537 // commit phase. 38538 // 38539 // When the wakeable resolves, we'll attempt to render the boundary 38540 // again ("retry"). 38541 var wakeables = suspenseBoundary.updateQueue; 38542 38543 if (wakeables === null) { 38544 var updateQueue = new Set(); 38545 updateQueue.add(wakeable); 38546 suspenseBoundary.updateQueue = updateQueue; 38547 } else { 38548 wakeables.add(wakeable); 38549 } 38550} 38551 38552function resetSuspendedComponent(sourceFiber, rootRenderLanes) { 38553 // A legacy mode Suspense quirk, only relevant to hook components. 38554 38555 38556 var tag = sourceFiber.tag; 38557 38558 if ((sourceFiber.mode & ConcurrentMode) === NoMode && (tag === FunctionComponent || tag === ForwardRef || tag === SimpleMemoComponent)) { 38559 var currentSource = sourceFiber.alternate; 38560 38561 if (currentSource) { 38562 sourceFiber.updateQueue = currentSource.updateQueue; 38563 sourceFiber.memoizedState = currentSource.memoizedState; 38564 sourceFiber.lanes = currentSource.lanes; 38565 } else { 38566 sourceFiber.updateQueue = null; 38567 sourceFiber.memoizedState = null; 38568 } 38569 } 38570} 38571 38572function getNearestSuspenseBoundaryToCapture(returnFiber) { 38573 var node = returnFiber; 38574 38575 do { 38576 if (node.tag === SuspenseComponent && shouldCaptureSuspense(node)) { 38577 return node; 38578 } // This boundary already captured during this render. Continue to the next 38579 // boundary. 38580 38581 38582 node = node.return; 38583 } while (node !== null); 38584 38585 return null; 38586} 38587 38588function markSuspenseBoundaryShouldCapture(suspenseBoundary, returnFiber, sourceFiber, root, rootRenderLanes) { 38589 // This marks a Suspense boundary so that when we're unwinding the stack, 38590 // it captures the suspended "exception" and does a second (fallback) pass. 38591 if ((suspenseBoundary.mode & ConcurrentMode) === NoMode) { 38592 // Legacy Mode Suspense 38593 // 38594 // If the boundary is in legacy mode, we should *not* 38595 // suspend the commit. Pretend as if the suspended component rendered 38596 // null and keep rendering. When the Suspense boundary completes, 38597 // we'll do a second pass to render the fallback. 38598 if (suspenseBoundary === returnFiber) { 38599 // Special case where we suspended while reconciling the children of 38600 // a Suspense boundary's inner Offscreen wrapper fiber. This happens 38601 // when a React.lazy component is a direct child of a 38602 // Suspense boundary. 38603 // 38604 // Suspense boundaries are implemented as multiple fibers, but they 38605 // are a single conceptual unit. The legacy mode behavior where we 38606 // pretend the suspended fiber committed as `null` won't work, 38607 // because in this case the "suspended" fiber is the inner 38608 // Offscreen wrapper. 38609 // 38610 // Because the contents of the boundary haven't started rendering 38611 // yet (i.e. nothing in the tree has partially rendered) we can 38612 // switch to the regular, concurrent mode behavior: mark the 38613 // boundary with ShouldCapture and enter the unwind phase. 38614 suspenseBoundary.flags |= ShouldCapture; 38615 } else { 38616 suspenseBoundary.flags |= DidCapture; 38617 sourceFiber.flags |= ForceUpdateForLegacySuspense; // We're going to commit this fiber even though it didn't complete. 38618 // But we shouldn't call any lifecycle methods or callbacks. Remove 38619 // all lifecycle effect tags. 38620 38621 sourceFiber.flags &= ~(LifecycleEffectMask | Incomplete); 38622 38623 if (sourceFiber.tag === ClassComponent) { 38624 var currentSourceFiber = sourceFiber.alternate; 38625 38626 if (currentSourceFiber === null) { 38627 // This is a new mount. Change the tag so it's not mistaken for a 38628 // completed class component. For example, we should not call 38629 // componentWillUnmount if it is deleted. 38630 sourceFiber.tag = IncompleteClassComponent; 38631 } else { 38632 // When we try rendering again, we should not reuse the current fiber, 38633 // since it's known to be in an inconsistent state. Use a force update to 38634 // prevent a bail out. 38635 var update = createUpdate(NoTimestamp, SyncLane); 38636 update.tag = ForceUpdate; 38637 enqueueUpdate(sourceFiber, update, SyncLane); 38638 } 38639 } // The source fiber did not complete. Mark it with Sync priority to 38640 // indicate that it still has pending work. 38641 38642 38643 sourceFiber.lanes = mergeLanes(sourceFiber.lanes, SyncLane); 38644 } 38645 38646 return suspenseBoundary; 38647 } // Confirmed that the boundary is in a concurrent mode tree. Continue 38648 // with the normal suspend path. 38649 // 38650 // After this we'll use a set of heuristics to determine whether this 38651 // render pass will run to completion or restart or "suspend" the commit. 38652 // The actual logic for this is spread out in different places. 38653 // 38654 // This first principle is that if we're going to suspend when we complete 38655 // a root, then we should also restart if we get an update or ping that 38656 // might unsuspend it, and vice versa. The only reason to suspend is 38657 // because you think you might want to restart before committing. However, 38658 // it doesn't make sense to restart only while in the period we're suspended. 38659 // 38660 // Restarting too aggressively is also not good because it starves out any 38661 // intermediate loading state. So we use heuristics to determine when. 38662 // Suspense Heuristics 38663 // 38664 // If nothing threw a Promise or all the same fallbacks are already showing, 38665 // then don't suspend/restart. 38666 // 38667 // If this is an initial render of a new tree of Suspense boundaries and 38668 // those trigger a fallback, then don't suspend/restart. We want to ensure 38669 // that we can show the initial loading state as quickly as possible. 38670 // 38671 // If we hit a "Delayed" case, such as when we'd switch from content back into 38672 // a fallback, then we should always suspend/restart. Transitions apply 38673 // to this case. If none is defined, JND is used instead. 38674 // 38675 // If we're already showing a fallback and it gets "retried", allowing us to show 38676 // another level, but there's still an inner boundary that would show a fallback, 38677 // then we suspend/restart for 500ms since the last time we showed a fallback 38678 // anywhere in the tree. This effectively throttles progressive loading into a 38679 // consistent train of commits. This also gives us an opportunity to restart to 38680 // get to the completed state slightly earlier. 38681 // 38682 // If there's ambiguity due to batching it's resolved in preference of: 38683 // 1) "delayed", 2) "initial render", 3) "retry". 38684 // 38685 // We want to ensure that a "busy" state doesn't get force committed. We want to 38686 // ensure that new initial loading states can commit as soon as possible. 38687 38688 38689 suspenseBoundary.flags |= ShouldCapture; // TODO: I think we can remove this, since we now use `DidCapture` in 38690 // the begin phase to prevent an early bailout. 38691 38692 suspenseBoundary.lanes = rootRenderLanes; 38693 return suspenseBoundary; 38694} 38695 38696function throwException(root, returnFiber, sourceFiber, value, rootRenderLanes) { 38697 // The source fiber did not complete. 38698 sourceFiber.flags |= Incomplete; 38699 38700 { 38701 if (isDevToolsPresent) { 38702 // If we have pending work still, restore the original updaters 38703 restorePendingUpdaters(root, rootRenderLanes); 38704 } 38705 } 38706 38707 if (value !== null && typeof value === 'object' && typeof value.then === 'function') { 38708 // This is a wakeable. The component suspended. 38709 var wakeable = value; 38710 resetSuspendedComponent(sourceFiber); 38711 38712 { 38713 if (getIsHydrating() && sourceFiber.mode & ConcurrentMode) { 38714 markDidThrowWhileHydratingDEV(); 38715 } 38716 } 38717 38718 38719 var suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber); 38720 38721 if (suspenseBoundary !== null) { 38722 suspenseBoundary.flags &= ~ForceClientRender; 38723 markSuspenseBoundaryShouldCapture(suspenseBoundary, returnFiber, sourceFiber, root, rootRenderLanes); // We only attach ping listeners in concurrent mode. Legacy Suspense always 38724 // commits fallbacks synchronously, so there are no pings. 38725 38726 if (suspenseBoundary.mode & ConcurrentMode) { 38727 attachPingListener(root, wakeable, rootRenderLanes); 38728 } 38729 38730 attachRetryListener(suspenseBoundary, root, wakeable); 38731 return; 38732 } else { 38733 // No boundary was found. Unless this is a sync update, this is OK. 38734 // We can suspend and wait for more data to arrive. 38735 if (!includesSyncLane(rootRenderLanes)) { 38736 // This is not a sync update. Suspend. Since we're not activating a 38737 // Suspense boundary, this will unwind all the way to the root without 38738 // performing a second pass to render a fallback. (This is arguably how 38739 // refresh transitions should work, too, since we're not going to commit 38740 // the fallbacks anyway.) 38741 // 38742 // This case also applies to initial hydration. 38743 attachPingListener(root, wakeable, rootRenderLanes); 38744 renderDidSuspendDelayIfPossible(); 38745 return; 38746 } // This is a sync/discrete update. We treat this case like an error 38747 // because discrete renders are expected to produce a complete tree 38748 // synchronously to maintain consistency with external state. 38749 38750 38751 var uncaughtSuspenseError = new Error('A component suspended while responding to synchronous input. This ' + 'will cause the UI to be replaced with a loading indicator. To ' + 'fix, updates that suspend should be wrapped ' + 'with startTransition.'); // If we're outside a transition, fall through to the regular error path. 38752 // The error will be caught by the nearest suspense boundary. 38753 38754 value = uncaughtSuspenseError; 38755 } 38756 } else { 38757 // This is a regular error, not a Suspense wakeable. 38758 if (getIsHydrating() && sourceFiber.mode & ConcurrentMode) { 38759 markDidThrowWhileHydratingDEV(); 38760 38761 var _suspenseBoundary = getNearestSuspenseBoundaryToCapture(returnFiber); // If the error was thrown during hydration, we may be able to recover by 38762 // discarding the dehydrated content and switching to a client render. 38763 // Instead of surfacing the error, find the nearest Suspense boundary 38764 // and render it again without hydration. 38765 38766 38767 if (_suspenseBoundary !== null) { 38768 if ((_suspenseBoundary.flags & ShouldCapture) === NoFlags) { 38769 // Set a flag to indicate that we should try rendering the normal 38770 // children again, not the fallback. 38771 _suspenseBoundary.flags |= ForceClientRender; 38772 } 38773 38774 markSuspenseBoundaryShouldCapture(_suspenseBoundary, returnFiber, sourceFiber, root, rootRenderLanes); // Even though the user may not be affected by this error, we should 38775 // still log it so it can be fixed. 38776 38777 queueHydrationError(createCapturedValueAtFiber(value, sourceFiber)); 38778 return; 38779 } 38780 } 38781 } 38782 38783 value = createCapturedValueAtFiber(value, sourceFiber); 38784 renderDidError(value); // We didn't find a boundary that could handle this type of exception. Start 38785 // over and traverse parent path again, this time treating the exception 38786 // as an error. 38787 38788 var workInProgress = returnFiber; 38789 38790 do { 38791 switch (workInProgress.tag) { 38792 case HostRoot: 38793 { 38794 var _errorInfo = value; 38795 workInProgress.flags |= ShouldCapture; 38796 var lane = pickArbitraryLane(rootRenderLanes); 38797 workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); 38798 var update = createRootErrorUpdate(workInProgress, _errorInfo, lane); 38799 enqueueCapturedUpdate(workInProgress, update); 38800 return; 38801 } 38802 38803 case ClassComponent: 38804 // Capture and retry 38805 var errorInfo = value; 38806 var ctor = workInProgress.type; 38807 var instance = workInProgress.stateNode; 38808 38809 if ((workInProgress.flags & DidCapture) === NoFlags && (typeof ctor.getDerivedStateFromError === 'function' || instance !== null && typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance))) { 38810 workInProgress.flags |= ShouldCapture; 38811 38812 var _lane = pickArbitraryLane(rootRenderLanes); 38813 38814 workInProgress.lanes = mergeLanes(workInProgress.lanes, _lane); // Schedule the error boundary to re-render using updated state 38815 38816 var _update = createClassErrorUpdate(workInProgress, errorInfo, _lane); 38817 38818 enqueueCapturedUpdate(workInProgress, _update); 38819 return; 38820 } 38821 38822 break; 38823 } 38824 38825 workInProgress = workInProgress.return; 38826 } while (workInProgress !== null); 38827} 38828 38829function getSuspendedCache() { 38830 { 38831 return null; 38832 } // This function is called when a Suspense boundary suspends. It returns the 38833} 38834 38835var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; 38836var didReceiveUpdate = false; 38837var didWarnAboutBadClass; 38838var didWarnAboutModulePatternComponent; 38839var didWarnAboutContextTypeOnFunctionComponent; 38840var didWarnAboutGetDerivedStateOnFunctionComponent; 38841var didWarnAboutFunctionRefs; 38842var didWarnAboutReassigningProps; 38843var didWarnAboutRevealOrder; 38844var didWarnAboutTailOptions; 38845var didWarnAboutDefaultPropsOnFunctionComponent; 38846 38847{ 38848 didWarnAboutBadClass = {}; 38849 didWarnAboutModulePatternComponent = {}; 38850 didWarnAboutContextTypeOnFunctionComponent = {}; 38851 didWarnAboutGetDerivedStateOnFunctionComponent = {}; 38852 didWarnAboutFunctionRefs = {}; 38853 didWarnAboutReassigningProps = false; 38854 didWarnAboutRevealOrder = {}; 38855 didWarnAboutTailOptions = {}; 38856 didWarnAboutDefaultPropsOnFunctionComponent = {}; 38857} 38858 38859function reconcileChildren(current, workInProgress, nextChildren, renderLanes) { 38860 if (current === null) { 38861 // If this is a fresh new component that hasn't been rendered yet, we 38862 // won't update its child set by applying minimal side-effects. Instead, 38863 // we will add them all to the child before it gets rendered. That means 38864 // we can optimize this reconciliation pass by not tracking side-effects. 38865 workInProgress.child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); 38866 } else { 38867 // If the current child is the same as the work in progress, it means that 38868 // we haven't yet started any work on these children. Therefore, we use 38869 // the clone algorithm to create a copy of all the current children. 38870 // If we had any progressed work already, that is invalid at this point so 38871 // let's throw it out. 38872 workInProgress.child = reconcileChildFibers(workInProgress, current.child, nextChildren, renderLanes); 38873 } 38874} 38875 38876function forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes) { 38877 // This function is fork of reconcileChildren. It's used in cases where we 38878 // want to reconcile without matching against the existing set. This has the 38879 // effect of all current children being unmounted; even if the type and key 38880 // are the same, the old child is unmounted and a new child is created. 38881 // 38882 // To do this, we're going to go through the reconcile algorithm twice. In 38883 // the first pass, we schedule a deletion for all the current children by 38884 // passing null. 38885 workInProgress.child = reconcileChildFibers(workInProgress, current.child, null, renderLanes); // In the second pass, we mount the new children. The trick here is that we 38886 // pass null in place of where we usually pass the current child set. This has 38887 // the effect of remounting all children regardless of whether their 38888 // identities match. 38889 38890 workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes); 38891} 38892 38893function updateForwardRef(current, workInProgress, Component, nextProps, renderLanes) { 38894 // TODO: current can be non-null here even if the component 38895 // hasn't yet mounted. This happens after the first render suspends. 38896 // We'll need to figure out if this is fine or can cause issues. 38897 { 38898 if (workInProgress.type !== workInProgress.elementType) { 38899 // Lazy component props can't be validated in createElement 38900 // because they're only guaranteed to be resolved here. 38901 var innerPropTypes = Component.propTypes; 38902 38903 if (innerPropTypes) { 38904 checkPropTypes(innerPropTypes, nextProps, // Resolved props 38905 'prop', getComponentNameFromType(Component)); 38906 } 38907 } 38908 } 38909 38910 var render = Component.render; 38911 var ref = workInProgress.ref; // The rest is a fork of updateFunctionComponent 38912 38913 var nextChildren; 38914 var hasId; 38915 prepareToReadContext(workInProgress, renderLanes); 38916 38917 { 38918 markComponentRenderStarted(workInProgress); 38919 } 38920 38921 { 38922 ReactCurrentOwner$1.current = workInProgress; 38923 setIsRendering(true); 38924 nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes); 38925 hasId = checkDidRenderIdHook(); 38926 38927 if ( workInProgress.mode & StrictLegacyMode) { 38928 setIsStrictModeForDevtools(true); 38929 38930 try { 38931 nextChildren = renderWithHooks(current, workInProgress, render, nextProps, ref, renderLanes); 38932 hasId = checkDidRenderIdHook(); 38933 } finally { 38934 setIsStrictModeForDevtools(false); 38935 } 38936 } 38937 38938 setIsRendering(false); 38939 } 38940 38941 { 38942 markComponentRenderStopped(); 38943 } 38944 38945 if (current !== null && !didReceiveUpdate) { 38946 bailoutHooks(current, workInProgress, renderLanes); 38947 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); 38948 } 38949 38950 if (getIsHydrating() && hasId) { 38951 pushMaterializedTreeId(workInProgress); 38952 } // React DevTools reads this flag. 38953 38954 38955 workInProgress.flags |= PerformedWork; 38956 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 38957 return workInProgress.child; 38958} 38959 38960function updateMemoComponent(current, workInProgress, Component, nextProps, renderLanes) { 38961 if (current === null) { 38962 var type = Component.type; 38963 38964 if (isSimpleFunctionComponent(type) && Component.compare === null && // SimpleMemoComponent codepath doesn't resolve outer props either. 38965 Component.defaultProps === undefined) { 38966 var resolvedType = type; 38967 38968 { 38969 resolvedType = resolveFunctionForHotReloading(type); 38970 } // If this is a plain function component without default props, 38971 // and with only the default shallow comparison, we upgrade it 38972 // to a SimpleMemoComponent to allow fast path updates. 38973 38974 38975 workInProgress.tag = SimpleMemoComponent; 38976 workInProgress.type = resolvedType; 38977 38978 { 38979 validateFunctionComponentInDev(workInProgress, type); 38980 } 38981 38982 return updateSimpleMemoComponent(current, workInProgress, resolvedType, nextProps, renderLanes); 38983 } 38984 38985 { 38986 var innerPropTypes = type.propTypes; 38987 38988 if (innerPropTypes) { 38989 // Inner memo component props aren't currently validated in createElement. 38990 // We could move it there, but we'd still need this for lazy code path. 38991 checkPropTypes(innerPropTypes, nextProps, // Resolved props 38992 'prop', getComponentNameFromType(type)); 38993 } 38994 38995 if ( Component.defaultProps !== undefined) { 38996 var componentName = getComponentNameFromType(type) || 'Unknown'; 38997 38998 if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) { 38999 error('%s: Support for defaultProps will be removed from memo components ' + 'in a future major release. Use JavaScript default parameters instead.', componentName); 39000 39001 didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true; 39002 } 39003 } 39004 } 39005 39006 var child = createFiberFromTypeAndProps(Component.type, null, nextProps, workInProgress, workInProgress.mode, renderLanes); 39007 child.ref = workInProgress.ref; 39008 child.return = workInProgress; 39009 workInProgress.child = child; 39010 return child; 39011 } 39012 39013 { 39014 var _type = Component.type; 39015 var _innerPropTypes = _type.propTypes; 39016 39017 if (_innerPropTypes) { 39018 // Inner memo component props aren't currently validated in createElement. 39019 // We could move it there, but we'd still need this for lazy code path. 39020 checkPropTypes(_innerPropTypes, nextProps, // Resolved props 39021 'prop', getComponentNameFromType(_type)); 39022 } 39023 } 39024 39025 var currentChild = current.child; // This is always exactly one child 39026 39027 var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current, renderLanes); 39028 39029 if (!hasScheduledUpdateOrContext) { 39030 // This will be the props with resolved defaultProps, 39031 // unlike current.memoizedProps which will be the unresolved ones. 39032 var prevProps = currentChild.memoizedProps; // Default to shallow comparison 39033 39034 var compare = Component.compare; 39035 compare = compare !== null ? compare : shallowEqual; 39036 39037 if (compare(prevProps, nextProps) && current.ref === workInProgress.ref) { 39038 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); 39039 } 39040 } // React DevTools reads this flag. 39041 39042 39043 workInProgress.flags |= PerformedWork; 39044 var newChild = createWorkInProgress(currentChild, nextProps); 39045 newChild.ref = workInProgress.ref; 39046 newChild.return = workInProgress; 39047 workInProgress.child = newChild; 39048 return newChild; 39049} 39050 39051function updateSimpleMemoComponent(current, workInProgress, Component, nextProps, renderLanes) { 39052 // TODO: current can be non-null here even if the component 39053 // hasn't yet mounted. This happens when the inner render suspends. 39054 // We'll need to figure out if this is fine or can cause issues. 39055 { 39056 if (workInProgress.type !== workInProgress.elementType) { 39057 // Lazy component props can't be validated in createElement 39058 // because they're only guaranteed to be resolved here. 39059 var outerMemoType = workInProgress.elementType; 39060 39061 if (outerMemoType.$$typeof === REACT_LAZY_TYPE) { 39062 // We warn when you define propTypes on lazy() 39063 // so let's just skip over it to find memo() outer wrapper. 39064 // Inner props for memo are validated later. 39065 var lazyComponent = outerMemoType; 39066 var payload = lazyComponent._payload; 39067 var init = lazyComponent._init; 39068 39069 try { 39070 outerMemoType = init(payload); 39071 } catch (x) { 39072 outerMemoType = null; 39073 } // Inner propTypes will be validated in the function component path. 39074 39075 39076 var outerPropTypes = outerMemoType && outerMemoType.propTypes; 39077 39078 if (outerPropTypes) { 39079 checkPropTypes(outerPropTypes, nextProps, // Resolved (SimpleMemoComponent has no defaultProps) 39080 'prop', getComponentNameFromType(outerMemoType)); 39081 } 39082 } 39083 } 39084 } 39085 39086 if (current !== null) { 39087 var prevProps = current.memoizedProps; 39088 39089 if (shallowEqual(prevProps, nextProps) && current.ref === workInProgress.ref && ( // Prevent bailout if the implementation changed due to hot reload. 39090 workInProgress.type === current.type )) { 39091 didReceiveUpdate = false; // The props are shallowly equal. Reuse the previous props object, like we 39092 // would during a normal fiber bailout. 39093 // 39094 // We don't have strong guarantees that the props object is referentially 39095 // equal during updates where we can't bail out anyway â like if the props 39096 // are shallowly equal, but there's a local state or context update in the 39097 // same batch. 39098 // 39099 // However, as a principle, we should aim to make the behavior consistent 39100 // across different ways of memoizing a component. For example, React.memo 39101 // has a different internal Fiber layout if you pass a normal function 39102 // component (SimpleMemoComponent) versus if you pass a different type 39103 // like forwardRef (MemoComponent). But this is an implementation detail. 39104 // Wrapping a component in forwardRef (or React.lazy, etc) shouldn't 39105 // affect whether the props object is reused during a bailout. 39106 39107 workInProgress.pendingProps = nextProps = prevProps; 39108 39109 if (!checkScheduledUpdateOrContext(current, renderLanes)) { 39110 // The pending lanes were cleared at the beginning of beginWork. We're 39111 // about to bail out, but there might be other lanes that weren't 39112 // included in the current render. Usually, the priority level of the 39113 // remaining updates is accumulated during the evaluation of the 39114 // component (i.e. when processing the update queue). But since since 39115 // we're bailing out early *without* evaluating the component, we need 39116 // to account for it here, too. Reset to the value of the current fiber. 39117 // NOTE: This only applies to SimpleMemoComponent, not MemoComponent, 39118 // because a MemoComponent fiber does not have hooks or an update queue; 39119 // rather, it wraps around an inner component, which may or may not 39120 // contains hooks. 39121 // TODO: Move the reset at in beginWork out of the common path so that 39122 // this is no longer necessary. 39123 workInProgress.lanes = current.lanes; 39124 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); 39125 } else if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) { 39126 // This is a special case that only exists for legacy mode. 39127 // See https://github.com/facebook/react/pull/19216. 39128 didReceiveUpdate = true; 39129 } 39130 } 39131 } 39132 39133 return updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes); 39134} 39135 39136function updateOffscreenComponent(current, workInProgress, renderLanes) { 39137 var nextProps = workInProgress.pendingProps; 39138 var nextChildren = nextProps.children; 39139 var prevState = current !== null ? current.memoizedState : null; 39140 39141 if (nextProps.mode === 'hidden' || enableLegacyHidden ) { 39142 // Rendering a hidden tree. 39143 if ((workInProgress.mode & ConcurrentMode) === NoMode) { 39144 // In legacy sync mode, don't defer the subtree. Render it now. 39145 // TODO: Consider how Offscreen should work with transitions in the future 39146 var nextState = { 39147 baseLanes: NoLanes, 39148 cachePool: null, 39149 transitions: null 39150 }; 39151 workInProgress.memoizedState = nextState; 39152 39153 pushRenderLanes(workInProgress, renderLanes); 39154 } else if (!includesSomeLane(renderLanes, OffscreenLane)) { 39155 var spawnedCachePool = null; // We're hidden, and we're not rendering at Offscreen. We will bail out 39156 // and resume this tree later. 39157 39158 var nextBaseLanes; 39159 39160 if (prevState !== null) { 39161 var prevBaseLanes = prevState.baseLanes; 39162 nextBaseLanes = mergeLanes(prevBaseLanes, renderLanes); 39163 } else { 39164 nextBaseLanes = renderLanes; 39165 } // Schedule this fiber to re-render at offscreen priority. Then bailout. 39166 39167 39168 workInProgress.lanes = workInProgress.childLanes = laneToLanes(OffscreenLane); 39169 var _nextState = { 39170 baseLanes: nextBaseLanes, 39171 cachePool: spawnedCachePool, 39172 transitions: null 39173 }; 39174 workInProgress.memoizedState = _nextState; 39175 workInProgress.updateQueue = null; 39176 // to avoid a push/pop misalignment. 39177 39178 39179 pushRenderLanes(workInProgress, nextBaseLanes); 39180 39181 return null; 39182 } else { 39183 // This is the second render. The surrounding visible content has already 39184 // committed. Now we resume rendering the hidden tree. 39185 // Rendering at offscreen, so we can clear the base lanes. 39186 var _nextState2 = { 39187 baseLanes: NoLanes, 39188 cachePool: null, 39189 transitions: null 39190 }; 39191 workInProgress.memoizedState = _nextState2; // Push the lanes that were skipped when we bailed out. 39192 39193 var subtreeRenderLanes = prevState !== null ? prevState.baseLanes : renderLanes; 39194 39195 pushRenderLanes(workInProgress, subtreeRenderLanes); 39196 } 39197 } else { 39198 // Rendering a visible tree. 39199 var _subtreeRenderLanes; 39200 39201 if (prevState !== null) { 39202 // We're going from hidden -> visible. 39203 _subtreeRenderLanes = mergeLanes(prevState.baseLanes, renderLanes); 39204 39205 workInProgress.memoizedState = null; 39206 } else { 39207 // We weren't previously hidden, and we still aren't, so there's nothing 39208 // special to do. Need to push to the stack regardless, though, to avoid 39209 // a push/pop misalignment. 39210 _subtreeRenderLanes = renderLanes; 39211 } 39212 39213 pushRenderLanes(workInProgress, _subtreeRenderLanes); 39214 } 39215 39216 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 39217 return workInProgress.child; 39218} // Note: These happen to have identical begin phases, for now. We shouldn't hold 39219 39220function updateFragment(current, workInProgress, renderLanes) { 39221 var nextChildren = workInProgress.pendingProps; 39222 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 39223 return workInProgress.child; 39224} 39225 39226function updateMode(current, workInProgress, renderLanes) { 39227 var nextChildren = workInProgress.pendingProps.children; 39228 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 39229 return workInProgress.child; 39230} 39231 39232function updateProfiler(current, workInProgress, renderLanes) { 39233 { 39234 workInProgress.flags |= Update; 39235 39236 { 39237 // Reset effect durations for the next eventual effect phase. 39238 // These are reset during render to allow the DevTools commit hook a chance to read them, 39239 var stateNode = workInProgress.stateNode; 39240 stateNode.effectDuration = 0; 39241 stateNode.passiveEffectDuration = 0; 39242 } 39243 } 39244 39245 var nextProps = workInProgress.pendingProps; 39246 var nextChildren = nextProps.children; 39247 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 39248 return workInProgress.child; 39249} 39250 39251function markRef(current, workInProgress) { 39252 var ref = workInProgress.ref; 39253 39254 if (current === null && ref !== null || current !== null && current.ref !== ref) { 39255 // Schedule a Ref effect 39256 workInProgress.flags |= Ref; 39257 39258 { 39259 workInProgress.flags |= RefStatic; 39260 } 39261 } 39262} 39263 39264function updateFunctionComponent(current, workInProgress, Component, nextProps, renderLanes) { 39265 { 39266 if (workInProgress.type !== workInProgress.elementType) { 39267 // Lazy component props can't be validated in createElement 39268 // because they're only guaranteed to be resolved here. 39269 var innerPropTypes = Component.propTypes; 39270 39271 if (innerPropTypes) { 39272 checkPropTypes(innerPropTypes, nextProps, // Resolved props 39273 'prop', getComponentNameFromType(Component)); 39274 } 39275 } 39276 } 39277 39278 var context; 39279 39280 { 39281 var unmaskedContext = getUnmaskedContext(workInProgress, Component, true); 39282 context = getMaskedContext(workInProgress, unmaskedContext); 39283 } 39284 39285 var nextChildren; 39286 var hasId; 39287 prepareToReadContext(workInProgress, renderLanes); 39288 39289 { 39290 markComponentRenderStarted(workInProgress); 39291 } 39292 39293 { 39294 ReactCurrentOwner$1.current = workInProgress; 39295 setIsRendering(true); 39296 nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); 39297 hasId = checkDidRenderIdHook(); 39298 39299 if ( workInProgress.mode & StrictLegacyMode) { 39300 setIsStrictModeForDevtools(true); 39301 39302 try { 39303 nextChildren = renderWithHooks(current, workInProgress, Component, nextProps, context, renderLanes); 39304 hasId = checkDidRenderIdHook(); 39305 } finally { 39306 setIsStrictModeForDevtools(false); 39307 } 39308 } 39309 39310 setIsRendering(false); 39311 } 39312 39313 { 39314 markComponentRenderStopped(); 39315 } 39316 39317 if (current !== null && !didReceiveUpdate) { 39318 bailoutHooks(current, workInProgress, renderLanes); 39319 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); 39320 } 39321 39322 if (getIsHydrating() && hasId) { 39323 pushMaterializedTreeId(workInProgress); 39324 } // React DevTools reads this flag. 39325 39326 39327 workInProgress.flags |= PerformedWork; 39328 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 39329 return workInProgress.child; 39330} 39331 39332function updateClassComponent(current, workInProgress, Component, nextProps, renderLanes) { 39333 { 39334 // This is used by DevTools to force a boundary to error. 39335 switch (shouldError(workInProgress)) { 39336 case false: 39337 { 39338 var _instance = workInProgress.stateNode; 39339 var ctor = workInProgress.type; // TODO This way of resetting the error boundary state is a hack. 39340 // Is there a better way to do this? 39341 39342 var tempInstance = new ctor(workInProgress.memoizedProps, _instance.context); 39343 var state = tempInstance.state; 39344 39345 _instance.updater.enqueueSetState(_instance, state, null); 39346 39347 break; 39348 } 39349 39350 case true: 39351 { 39352 workInProgress.flags |= DidCapture; 39353 workInProgress.flags |= ShouldCapture; // eslint-disable-next-line react-internal/prod-error-codes 39354 39355 var error$1 = new Error('Simulated error coming from DevTools'); 39356 var lane = pickArbitraryLane(renderLanes); 39357 workInProgress.lanes = mergeLanes(workInProgress.lanes, lane); // Schedule the error boundary to re-render using updated state 39358 39359 var update = createClassErrorUpdate(workInProgress, createCapturedValueAtFiber(error$1, workInProgress), lane); 39360 enqueueCapturedUpdate(workInProgress, update); 39361 break; 39362 } 39363 } 39364 39365 if (workInProgress.type !== workInProgress.elementType) { 39366 // Lazy component props can't be validated in createElement 39367 // because they're only guaranteed to be resolved here. 39368 var innerPropTypes = Component.propTypes; 39369 39370 if (innerPropTypes) { 39371 checkPropTypes(innerPropTypes, nextProps, // Resolved props 39372 'prop', getComponentNameFromType(Component)); 39373 } 39374 } 39375 } // Push context providers early to prevent context stack mismatches. 39376 // During mounting we don't know the child context yet as the instance doesn't exist. 39377 // We will invalidate the child context in finishClassComponent() right after rendering. 39378 39379 39380 var hasContext; 39381 39382 if (isContextProvider(Component)) { 39383 hasContext = true; 39384 pushContextProvider(workInProgress); 39385 } else { 39386 hasContext = false; 39387 } 39388 39389 prepareToReadContext(workInProgress, renderLanes); 39390 var instance = workInProgress.stateNode; 39391 var shouldUpdate; 39392 39393 if (instance === null) { 39394 resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress); // In the initial pass we might need to construct the instance. 39395 39396 constructClassInstance(workInProgress, Component, nextProps); 39397 mountClassInstance(workInProgress, Component, nextProps, renderLanes); 39398 shouldUpdate = true; 39399 } else if (current === null) { 39400 // In a resume, we'll already have an instance we can reuse. 39401 shouldUpdate = resumeMountClassInstance(workInProgress, Component, nextProps, renderLanes); 39402 } else { 39403 shouldUpdate = updateClassInstance(current, workInProgress, Component, nextProps, renderLanes); 39404 } 39405 39406 var nextUnitOfWork = finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes); 39407 39408 { 39409 var inst = workInProgress.stateNode; 39410 39411 if (shouldUpdate && inst.props !== nextProps) { 39412 if (!didWarnAboutReassigningProps) { 39413 error('It looks like %s is reassigning its own `this.props` while rendering. ' + 'This is not supported and can lead to confusing bugs.', getComponentNameFromFiber(workInProgress) || 'a component'); 39414 } 39415 39416 didWarnAboutReassigningProps = true; 39417 } 39418 } 39419 39420 return nextUnitOfWork; 39421} 39422 39423function finishClassComponent(current, workInProgress, Component, shouldUpdate, hasContext, renderLanes) { 39424 // Refs should update even if shouldComponentUpdate returns false 39425 markRef(current, workInProgress); 39426 var didCaptureError = (workInProgress.flags & DidCapture) !== NoFlags; 39427 39428 if (!shouldUpdate && !didCaptureError) { 39429 // Context providers should defer to sCU for rendering 39430 if (hasContext) { 39431 invalidateContextProvider(workInProgress, Component, false); 39432 } 39433 39434 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); 39435 } 39436 39437 var instance = workInProgress.stateNode; // Rerender 39438 39439 ReactCurrentOwner$1.current = workInProgress; 39440 var nextChildren; 39441 39442 if (didCaptureError && typeof Component.getDerivedStateFromError !== 'function') { 39443 // If we captured an error, but getDerivedStateFromError is not defined, 39444 // unmount all the children. componentDidCatch will schedule an update to 39445 // re-render a fallback. This is temporary until we migrate everyone to 39446 // the new API. 39447 // TODO: Warn in a future release. 39448 nextChildren = null; 39449 39450 { 39451 stopProfilerTimerIfRunning(); 39452 } 39453 } else { 39454 { 39455 markComponentRenderStarted(workInProgress); 39456 } 39457 39458 { 39459 setIsRendering(true); 39460 nextChildren = instance.render(); 39461 39462 if ( workInProgress.mode & StrictLegacyMode) { 39463 setIsStrictModeForDevtools(true); 39464 39465 try { 39466 instance.render(); 39467 } finally { 39468 setIsStrictModeForDevtools(false); 39469 } 39470 } 39471 39472 setIsRendering(false); 39473 } 39474 39475 { 39476 markComponentRenderStopped(); 39477 } 39478 } // React DevTools reads this flag. 39479 39480 39481 workInProgress.flags |= PerformedWork; 39482 39483 if (current !== null && didCaptureError) { 39484 // If we're recovering from an error, reconcile without reusing any of 39485 // the existing children. Conceptually, the normal children and the children 39486 // that are shown on error are two different sets, so we shouldn't reuse 39487 // normal children even if their identities match. 39488 forceUnmountCurrentAndReconcile(current, workInProgress, nextChildren, renderLanes); 39489 } else { 39490 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 39491 } // Memoize state using the values we just used to render. 39492 // TODO: Restructure so we never read values from the instance. 39493 39494 39495 workInProgress.memoizedState = instance.state; // The context might have changed so we need to recalculate it. 39496 39497 if (hasContext) { 39498 invalidateContextProvider(workInProgress, Component, true); 39499 } 39500 39501 return workInProgress.child; 39502} 39503 39504function pushHostRootContext(workInProgress) { 39505 var root = workInProgress.stateNode; 39506 39507 if (root.pendingContext) { 39508 pushTopLevelContextObject(workInProgress, root.pendingContext, root.pendingContext !== root.context); 39509 } else if (root.context) { 39510 // Should always be set 39511 pushTopLevelContextObject(workInProgress, root.context, false); 39512 } 39513 39514 pushHostContainer(workInProgress, root.containerInfo); 39515} 39516 39517function updateHostRoot(current, workInProgress, renderLanes) { 39518 pushHostRootContext(workInProgress); 39519 39520 if (current === null) { 39521 throw new Error('Should have a current fiber. This is a bug in React.'); 39522 } 39523 39524 var nextProps = workInProgress.pendingProps; 39525 var prevState = workInProgress.memoizedState; 39526 var prevChildren = prevState.element; 39527 cloneUpdateQueue(current, workInProgress); 39528 processUpdateQueue(workInProgress, nextProps, null, renderLanes); 39529 var nextState = workInProgress.memoizedState; 39530 var root = workInProgress.stateNode; 39531 // being called "element". 39532 39533 39534 var nextChildren = nextState.element; 39535 39536 if ( prevState.isDehydrated) { 39537 // This is a hydration root whose shell has not yet hydrated. We should 39538 // attempt to hydrate. 39539 // Flip isDehydrated to false to indicate that when this render 39540 // finishes, the root will no longer be dehydrated. 39541 var overrideState = { 39542 element: nextChildren, 39543 isDehydrated: false, 39544 cache: nextState.cache, 39545 pendingSuspenseBoundaries: nextState.pendingSuspenseBoundaries, 39546 transitions: nextState.transitions 39547 }; 39548 var updateQueue = workInProgress.updateQueue; // `baseState` can always be the last state because the root doesn't 39549 // have reducer functions so it doesn't need rebasing. 39550 39551 updateQueue.baseState = overrideState; 39552 workInProgress.memoizedState = overrideState; 39553 39554 if (workInProgress.flags & ForceClientRender) { 39555 // Something errored during a previous attempt to hydrate the shell, so we 39556 // forced a client render. 39557 var recoverableError = createCapturedValueAtFiber(new Error('There was an error while hydrating. Because the error happened outside ' + 'of a Suspense boundary, the entire root will switch to ' + 'client rendering.'), workInProgress); 39558 return mountHostRootWithoutHydrating(current, workInProgress, nextChildren, renderLanes, recoverableError); 39559 } else if (nextChildren !== prevChildren) { 39560 var _recoverableError = createCapturedValueAtFiber(new Error('This root received an early update, before anything was able ' + 'hydrate. Switched the entire root to client rendering.'), workInProgress); 39561 39562 return mountHostRootWithoutHydrating(current, workInProgress, nextChildren, renderLanes, _recoverableError); 39563 } else { 39564 // The outermost shell has not hydrated yet. Start hydrating. 39565 enterHydrationState(workInProgress); 39566 39567 var child = mountChildFibers(workInProgress, null, nextChildren, renderLanes); 39568 workInProgress.child = child; 39569 var node = child; 39570 39571 while (node) { 39572 // Mark each child as hydrating. This is a fast path to know whether this 39573 // tree is part of a hydrating tree. This is used to determine if a child 39574 // node has fully mounted yet, and for scheduling event replaying. 39575 // Conceptually this is similar to Placement in that a new subtree is 39576 // inserted into the React tree here. It just happens to not need DOM 39577 // mutations because it already exists. 39578 node.flags = node.flags & ~Placement | Hydrating; 39579 node = node.sibling; 39580 } 39581 } 39582 } else { 39583 // Root is not dehydrated. Either this is a client-only root, or it 39584 // already hydrated. 39585 resetHydrationState(); 39586 39587 if (nextChildren === prevChildren) { 39588 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); 39589 } 39590 39591 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 39592 } 39593 39594 return workInProgress.child; 39595} 39596 39597function mountHostRootWithoutHydrating(current, workInProgress, nextChildren, renderLanes, recoverableError) { 39598 // Revert to client rendering. 39599 resetHydrationState(); 39600 queueHydrationError(recoverableError); 39601 workInProgress.flags |= ForceClientRender; 39602 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 39603 return workInProgress.child; 39604} 39605 39606function updateHostComponent(current, workInProgress, renderLanes) { 39607 pushHostContext(workInProgress); 39608 39609 if (current === null) { 39610 tryToClaimNextHydratableInstance(workInProgress); 39611 } 39612 39613 var type = workInProgress.type; 39614 var nextProps = workInProgress.pendingProps; 39615 var prevProps = current !== null ? current.memoizedProps : null; 39616 var nextChildren = nextProps.children; 39617 var isDirectTextChild = shouldSetTextContent(type, nextProps); 39618 39619 if (isDirectTextChild) { 39620 // We special case a direct text child of a host node. This is a common 39621 // case. We won't handle it as a reified child. We will instead handle 39622 // this in the host environment that also has access to this prop. That 39623 // avoids allocating another HostText fiber and traversing it. 39624 nextChildren = null; 39625 } else if (prevProps !== null && shouldSetTextContent(type, prevProps)) { 39626 // If we're switching from a direct text child to a normal child, or to 39627 // empty, we need to schedule the text content to be reset. 39628 workInProgress.flags |= ContentReset; 39629 } 39630 39631 markRef(current, workInProgress); 39632 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 39633 return workInProgress.child; 39634} 39635 39636function updateHostText(current, workInProgress) { 39637 if (current === null) { 39638 tryToClaimNextHydratableInstance(workInProgress); 39639 } // Nothing to do here. This is terminal. We'll do the completion step 39640 // immediately after. 39641 39642 39643 return null; 39644} 39645 39646function mountLazyComponent(_current, workInProgress, elementType, renderLanes) { 39647 resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); 39648 var props = workInProgress.pendingProps; 39649 var lazyComponent = elementType; 39650 var payload = lazyComponent._payload; 39651 var init = lazyComponent._init; 39652 var Component = init(payload); // Store the unwrapped component in the type. 39653 39654 workInProgress.type = Component; 39655 var resolvedTag = workInProgress.tag = resolveLazyComponentTag(Component); 39656 var resolvedProps = resolveDefaultProps(Component, props); 39657 var child; 39658 39659 switch (resolvedTag) { 39660 case FunctionComponent: 39661 { 39662 { 39663 validateFunctionComponentInDev(workInProgress, Component); 39664 workInProgress.type = Component = resolveFunctionForHotReloading(Component); 39665 } 39666 39667 child = updateFunctionComponent(null, workInProgress, Component, resolvedProps, renderLanes); 39668 return child; 39669 } 39670 39671 case ClassComponent: 39672 { 39673 { 39674 workInProgress.type = Component = resolveClassForHotReloading(Component); 39675 } 39676 39677 child = updateClassComponent(null, workInProgress, Component, resolvedProps, renderLanes); 39678 return child; 39679 } 39680 39681 case ForwardRef: 39682 { 39683 { 39684 workInProgress.type = Component = resolveForwardRefForHotReloading(Component); 39685 } 39686 39687 child = updateForwardRef(null, workInProgress, Component, resolvedProps, renderLanes); 39688 return child; 39689 } 39690 39691 case MemoComponent: 39692 { 39693 { 39694 if (workInProgress.type !== workInProgress.elementType) { 39695 var outerPropTypes = Component.propTypes; 39696 39697 if (outerPropTypes) { 39698 checkPropTypes(outerPropTypes, resolvedProps, // Resolved for outer only 39699 'prop', getComponentNameFromType(Component)); 39700 } 39701 } 39702 } 39703 39704 child = updateMemoComponent(null, workInProgress, Component, resolveDefaultProps(Component.type, resolvedProps), // The inner type can have defaults too 39705 renderLanes); 39706 return child; 39707 } 39708 } 39709 39710 var hint = ''; 39711 39712 { 39713 if (Component !== null && typeof Component === 'object' && Component.$$typeof === REACT_LAZY_TYPE) { 39714 hint = ' Did you wrap a component in React.lazy() more than once?'; 39715 } 39716 } // This message intentionally doesn't mention ForwardRef or MemoComponent 39717 // because the fact that it's a separate type of work is an 39718 // implementation detail. 39719 39720 39721 throw new Error("Element type is invalid. Received a promise that resolves to: " + Component + ". " + ("Lazy element type must resolve to a class or function." + hint)); 39722} 39723 39724function mountIncompleteClassComponent(_current, workInProgress, Component, nextProps, renderLanes) { 39725 resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); // Promote the fiber to a class and try rendering again. 39726 39727 workInProgress.tag = ClassComponent; // The rest of this function is a fork of `updateClassComponent` 39728 // Push context providers early to prevent context stack mismatches. 39729 // During mounting we don't know the child context yet as the instance doesn't exist. 39730 // We will invalidate the child context in finishClassComponent() right after rendering. 39731 39732 var hasContext; 39733 39734 if (isContextProvider(Component)) { 39735 hasContext = true; 39736 pushContextProvider(workInProgress); 39737 } else { 39738 hasContext = false; 39739 } 39740 39741 prepareToReadContext(workInProgress, renderLanes); 39742 constructClassInstance(workInProgress, Component, nextProps); 39743 mountClassInstance(workInProgress, Component, nextProps, renderLanes); 39744 return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes); 39745} 39746 39747function mountIndeterminateComponent(_current, workInProgress, Component, renderLanes) { 39748 resetSuspendedCurrentOnMountInLegacyMode(_current, workInProgress); 39749 var props = workInProgress.pendingProps; 39750 var context; 39751 39752 { 39753 var unmaskedContext = getUnmaskedContext(workInProgress, Component, false); 39754 context = getMaskedContext(workInProgress, unmaskedContext); 39755 } 39756 39757 prepareToReadContext(workInProgress, renderLanes); 39758 var value; 39759 var hasId; 39760 39761 { 39762 markComponentRenderStarted(workInProgress); 39763 } 39764 39765 { 39766 if (Component.prototype && typeof Component.prototype.render === 'function') { 39767 var componentName = getComponentNameFromType(Component) || 'Unknown'; 39768 39769 if (!didWarnAboutBadClass[componentName]) { 39770 error("The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName); 39771 39772 didWarnAboutBadClass[componentName] = true; 39773 } 39774 } 39775 39776 if (workInProgress.mode & StrictLegacyMode) { 39777 ReactStrictModeWarnings.recordLegacyContextWarning(workInProgress, null); 39778 } 39779 39780 setIsRendering(true); 39781 ReactCurrentOwner$1.current = workInProgress; 39782 value = renderWithHooks(null, workInProgress, Component, props, context, renderLanes); 39783 hasId = checkDidRenderIdHook(); 39784 setIsRendering(false); 39785 } 39786 39787 { 39788 markComponentRenderStopped(); 39789 } // React DevTools reads this flag. 39790 39791 39792 workInProgress.flags |= PerformedWork; 39793 39794 { 39795 // Support for module components is deprecated and is removed behind a flag. 39796 // Whether or not it would crash later, we want to show a good message in DEV first. 39797 if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { 39798 var _componentName = getComponentNameFromType(Component) || 'Unknown'; 39799 39800 if (!didWarnAboutModulePatternComponent[_componentName]) { 39801 error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName, _componentName, _componentName); 39802 39803 didWarnAboutModulePatternComponent[_componentName] = true; 39804 } 39805 } 39806 } 39807 39808 if ( // Run these checks in production only if the flag is off. 39809 // Eventually we'll delete this branch altogether. 39810 typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { 39811 { 39812 var _componentName2 = getComponentNameFromType(Component) || 'Unknown'; 39813 39814 if (!didWarnAboutModulePatternComponent[_componentName2]) { 39815 error('The <%s /> component appears to be a function component that returns a class instance. ' + 'Change %s to a class that extends React.Component instead. ' + "If you can't use a class try assigning the prototype on the function as a workaround. " + "`%s.prototype = React.Component.prototype`. Don't use an arrow function since it " + 'cannot be called with `new` by React.', _componentName2, _componentName2, _componentName2); 39816 39817 didWarnAboutModulePatternComponent[_componentName2] = true; 39818 } 39819 } // Proceed under the assumption that this is a class instance 39820 39821 39822 workInProgress.tag = ClassComponent; // Throw out any hooks that were used. 39823 39824 workInProgress.memoizedState = null; 39825 workInProgress.updateQueue = null; // Push context providers early to prevent context stack mismatches. 39826 // During mounting we don't know the child context yet as the instance doesn't exist. 39827 // We will invalidate the child context in finishClassComponent() right after rendering. 39828 39829 var hasContext = false; 39830 39831 if (isContextProvider(Component)) { 39832 hasContext = true; 39833 pushContextProvider(workInProgress); 39834 } else { 39835 hasContext = false; 39836 } 39837 39838 workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null; 39839 initializeUpdateQueue(workInProgress); 39840 adoptClassInstance(workInProgress, value); 39841 mountClassInstance(workInProgress, Component, props, renderLanes); 39842 return finishClassComponent(null, workInProgress, Component, true, hasContext, renderLanes); 39843 } else { 39844 // Proceed under the assumption that this is a function component 39845 workInProgress.tag = FunctionComponent; 39846 39847 { 39848 39849 if ( workInProgress.mode & StrictLegacyMode) { 39850 setIsStrictModeForDevtools(true); 39851 39852 try { 39853 value = renderWithHooks(null, workInProgress, Component, props, context, renderLanes); 39854 hasId = checkDidRenderIdHook(); 39855 } finally { 39856 setIsStrictModeForDevtools(false); 39857 } 39858 } 39859 } 39860 39861 if (getIsHydrating() && hasId) { 39862 pushMaterializedTreeId(workInProgress); 39863 } 39864 39865 reconcileChildren(null, workInProgress, value, renderLanes); 39866 39867 { 39868 validateFunctionComponentInDev(workInProgress, Component); 39869 } 39870 39871 return workInProgress.child; 39872 } 39873} 39874 39875function validateFunctionComponentInDev(workInProgress, Component) { 39876 { 39877 if (Component) { 39878 if (Component.childContextTypes) { 39879 error('%s(...): childContextTypes cannot be defined on a function component.', Component.displayName || Component.name || 'Component'); 39880 } 39881 } 39882 39883 if (workInProgress.ref !== null) { 39884 var info = ''; 39885 var ownerName = getCurrentFiberOwnerNameInDevOrNull(); 39886 39887 if (ownerName) { 39888 info += '\n\nCheck the render method of `' + ownerName + '`.'; 39889 } 39890 39891 var warningKey = ownerName || ''; 39892 var debugSource = workInProgress._debugSource; 39893 39894 if (debugSource) { 39895 warningKey = debugSource.fileName + ':' + debugSource.lineNumber; 39896 } 39897 39898 if (!didWarnAboutFunctionRefs[warningKey]) { 39899 didWarnAboutFunctionRefs[warningKey] = true; 39900 39901 error('Function components cannot be given refs. ' + 'Attempts to access this ref will fail. ' + 'Did you mean to use React.forwardRef()?%s', info); 39902 } 39903 } 39904 39905 if ( Component.defaultProps !== undefined) { 39906 var componentName = getComponentNameFromType(Component) || 'Unknown'; 39907 39908 if (!didWarnAboutDefaultPropsOnFunctionComponent[componentName]) { 39909 error('%s: Support for defaultProps will be removed from function components ' + 'in a future major release. Use JavaScript default parameters instead.', componentName); 39910 39911 didWarnAboutDefaultPropsOnFunctionComponent[componentName] = true; 39912 } 39913 } 39914 39915 if (typeof Component.getDerivedStateFromProps === 'function') { 39916 var _componentName3 = getComponentNameFromType(Component) || 'Unknown'; 39917 39918 if (!didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3]) { 39919 error('%s: Function components do not support getDerivedStateFromProps.', _componentName3); 39920 39921 didWarnAboutGetDerivedStateOnFunctionComponent[_componentName3] = true; 39922 } 39923 } 39924 39925 if (typeof Component.contextType === 'object' && Component.contextType !== null) { 39926 var _componentName4 = getComponentNameFromType(Component) || 'Unknown'; 39927 39928 if (!didWarnAboutContextTypeOnFunctionComponent[_componentName4]) { 39929 error('%s: Function components do not support contextType.', _componentName4); 39930 39931 didWarnAboutContextTypeOnFunctionComponent[_componentName4] = true; 39932 } 39933 } 39934 } 39935} 39936 39937var SUSPENDED_MARKER = { 39938 dehydrated: null, 39939 treeContext: null, 39940 retryLane: NoLane 39941}; 39942 39943function mountSuspenseOffscreenState(renderLanes) { 39944 return { 39945 baseLanes: renderLanes, 39946 cachePool: getSuspendedCache(), 39947 transitions: null 39948 }; 39949} 39950 39951function updateSuspenseOffscreenState(prevOffscreenState, renderLanes) { 39952 var cachePool = null; 39953 39954 return { 39955 baseLanes: mergeLanes(prevOffscreenState.baseLanes, renderLanes), 39956 cachePool: cachePool, 39957 transitions: prevOffscreenState.transitions 39958 }; 39959} // TODO: Probably should inline this back 39960 39961 39962function shouldRemainOnFallback(suspenseContext, current, workInProgress, renderLanes) { 39963 // If we're already showing a fallback, there are cases where we need to 39964 // remain on that fallback regardless of whether the content has resolved. 39965 // For example, SuspenseList coordinates when nested content appears. 39966 if (current !== null) { 39967 var suspenseState = current.memoizedState; 39968 39969 if (suspenseState === null) { 39970 // Currently showing content. Don't hide it, even if ForceSuspenseFallback 39971 // is true. More precise name might be "ForceRemainSuspenseFallback". 39972 // Note: This is a factoring smell. Can't remain on a fallback if there's 39973 // no fallback to remain on. 39974 return false; 39975 } 39976 } // Not currently showing content. Consult the Suspense context. 39977 39978 39979 return hasSuspenseContext(suspenseContext, ForceSuspenseFallback); 39980} 39981 39982function getRemainingWorkInPrimaryTree(current, renderLanes) { 39983 // TODO: Should not remove render lanes that were pinged during this render 39984 return removeLanes(current.childLanes, renderLanes); 39985} 39986 39987function updateSuspenseComponent(current, workInProgress, renderLanes) { 39988 var nextProps = workInProgress.pendingProps; // This is used by DevTools to force a boundary to suspend. 39989 39990 { 39991 if (shouldSuspend(workInProgress)) { 39992 workInProgress.flags |= DidCapture; 39993 } 39994 } 39995 39996 var suspenseContext = suspenseStackCursor.current; 39997 var showFallback = false; 39998 var didSuspend = (workInProgress.flags & DidCapture) !== NoFlags; 39999 40000 if (didSuspend || shouldRemainOnFallback(suspenseContext, current)) { 40001 // Something in this boundary's subtree already suspended. Switch to 40002 // rendering the fallback children. 40003 showFallback = true; 40004 workInProgress.flags &= ~DidCapture; 40005 } else { 40006 // Attempting the main content 40007 if (current === null || current.memoizedState !== null) { 40008 // This is a new mount or this boundary is already showing a fallback state. 40009 // Mark this subtree context as having at least one invisible parent that could 40010 // handle the fallback state. 40011 // Avoided boundaries are not considered since they cannot handle preferred fallback states. 40012 { 40013 suspenseContext = addSubtreeSuspenseContext(suspenseContext, InvisibleParentSuspenseContext); 40014 } 40015 } 40016 } 40017 40018 suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); 40019 pushSuspenseContext(workInProgress, suspenseContext); // OK, the next part is confusing. We're about to reconcile the Suspense 40020 // boundary's children. This involves some custom reconciliation logic. Two 40021 // main reasons this is so complicated. 40022 // 40023 // First, Legacy Mode has different semantics for backwards compatibility. The 40024 // primary tree will commit in an inconsistent state, so when we do the 40025 // second pass to render the fallback, we do some exceedingly, uh, clever 40026 // hacks to make that not totally break. Like transferring effects and 40027 // deletions from hidden tree. In Concurrent Mode, it's much simpler, 40028 // because we bailout on the primary tree completely and leave it in its old 40029 // state, no effects. Same as what we do for Offscreen (except that 40030 // Offscreen doesn't have the first render pass). 40031 // 40032 // Second is hydration. During hydration, the Suspense fiber has a slightly 40033 // different layout, where the child points to a dehydrated fragment, which 40034 // contains the DOM rendered by the server. 40035 // 40036 // Third, even if you set all that aside, Suspense is like error boundaries in 40037 // that we first we try to render one tree, and if that fails, we render again 40038 // and switch to a different tree. Like a try/catch block. So we have to track 40039 // which branch we're currently rendering. Ideally we would model this using 40040 // a stack. 40041 40042 if (current === null) { 40043 // Initial mount 40044 // Special path for hydration 40045 // If we're currently hydrating, try to hydrate this boundary. 40046 tryToClaimNextHydratableInstance(workInProgress); // This could've been a dehydrated suspense component. 40047 40048 var suspenseState = workInProgress.memoizedState; 40049 40050 if (suspenseState !== null) { 40051 var dehydrated = suspenseState.dehydrated; 40052 40053 if (dehydrated !== null) { 40054 return mountDehydratedSuspenseComponent(workInProgress, dehydrated); 40055 } 40056 } 40057 40058 var nextPrimaryChildren = nextProps.children; 40059 var nextFallbackChildren = nextProps.fallback; 40060 40061 if (showFallback) { 40062 var fallbackFragment = mountSuspenseFallbackChildren(workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes); 40063 var primaryChildFragment = workInProgress.child; 40064 primaryChildFragment.memoizedState = mountSuspenseOffscreenState(renderLanes); 40065 workInProgress.memoizedState = SUSPENDED_MARKER; 40066 40067 return fallbackFragment; 40068 } else { 40069 return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren); 40070 } 40071 } else { 40072 // This is an update. 40073 // Special path for hydration 40074 var prevState = current.memoizedState; 40075 40076 if (prevState !== null) { 40077 var _dehydrated = prevState.dehydrated; 40078 40079 if (_dehydrated !== null) { 40080 return updateDehydratedSuspenseComponent(current, workInProgress, didSuspend, nextProps, _dehydrated, prevState, renderLanes); 40081 } 40082 } 40083 40084 if (showFallback) { 40085 var _nextFallbackChildren = nextProps.fallback; 40086 var _nextPrimaryChildren = nextProps.children; 40087 var fallbackChildFragment = updateSuspenseFallbackChildren(current, workInProgress, _nextPrimaryChildren, _nextFallbackChildren, renderLanes); 40088 var _primaryChildFragment2 = workInProgress.child; 40089 var prevOffscreenState = current.child.memoizedState; 40090 _primaryChildFragment2.memoizedState = prevOffscreenState === null ? mountSuspenseOffscreenState(renderLanes) : updateSuspenseOffscreenState(prevOffscreenState, renderLanes); 40091 40092 _primaryChildFragment2.childLanes = getRemainingWorkInPrimaryTree(current, renderLanes); 40093 workInProgress.memoizedState = SUSPENDED_MARKER; 40094 return fallbackChildFragment; 40095 } else { 40096 var _nextPrimaryChildren2 = nextProps.children; 40097 40098 var _primaryChildFragment3 = updateSuspensePrimaryChildren(current, workInProgress, _nextPrimaryChildren2, renderLanes); 40099 40100 workInProgress.memoizedState = null; 40101 return _primaryChildFragment3; 40102 } 40103 } 40104} 40105 40106function mountSuspensePrimaryChildren(workInProgress, primaryChildren, renderLanes) { 40107 var mode = workInProgress.mode; 40108 var primaryChildProps = { 40109 mode: 'visible', 40110 children: primaryChildren 40111 }; 40112 var primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, mode); 40113 primaryChildFragment.return = workInProgress; 40114 workInProgress.child = primaryChildFragment; 40115 return primaryChildFragment; 40116} 40117 40118function mountSuspenseFallbackChildren(workInProgress, primaryChildren, fallbackChildren, renderLanes) { 40119 var mode = workInProgress.mode; 40120 var progressedPrimaryFragment = workInProgress.child; 40121 var primaryChildProps = { 40122 mode: 'hidden', 40123 children: primaryChildren 40124 }; 40125 var primaryChildFragment; 40126 var fallbackChildFragment; 40127 40128 if ((mode & ConcurrentMode) === NoMode && progressedPrimaryFragment !== null) { 40129 // In legacy mode, we commit the primary tree as if it successfully 40130 // completed, even though it's in an inconsistent state. 40131 primaryChildFragment = progressedPrimaryFragment; 40132 primaryChildFragment.childLanes = NoLanes; 40133 primaryChildFragment.pendingProps = primaryChildProps; 40134 40135 if ( workInProgress.mode & ProfileMode) { 40136 // Reset the durations from the first pass so they aren't included in the 40137 // final amounts. This seems counterintuitive, since we're intentionally 40138 // not measuring part of the render phase, but this makes it match what we 40139 // do in Concurrent Mode. 40140 primaryChildFragment.actualDuration = 0; 40141 primaryChildFragment.actualStartTime = -1; 40142 primaryChildFragment.selfBaseDuration = 0; 40143 primaryChildFragment.treeBaseDuration = 0; 40144 } 40145 40146 fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); 40147 } else { 40148 primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, mode); 40149 fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); 40150 } 40151 40152 primaryChildFragment.return = workInProgress; 40153 fallbackChildFragment.return = workInProgress; 40154 primaryChildFragment.sibling = fallbackChildFragment; 40155 workInProgress.child = primaryChildFragment; 40156 return fallbackChildFragment; 40157} 40158 40159function mountWorkInProgressOffscreenFiber(offscreenProps, mode, renderLanes) { 40160 // The props argument to `createFiberFromOffscreen` is `any` typed, so we use 40161 // this wrapper function to constrain it. 40162 return createFiberFromOffscreen(offscreenProps, mode, NoLanes, null); 40163} 40164 40165function updateWorkInProgressOffscreenFiber(current, offscreenProps) { 40166 // The props argument to `createWorkInProgress` is `any` typed, so we use this 40167 // wrapper function to constrain it. 40168 return createWorkInProgress(current, offscreenProps); 40169} 40170 40171function updateSuspensePrimaryChildren(current, workInProgress, primaryChildren, renderLanes) { 40172 var currentPrimaryChildFragment = current.child; 40173 var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; 40174 var primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, { 40175 mode: 'visible', 40176 children: primaryChildren 40177 }); 40178 40179 if ((workInProgress.mode & ConcurrentMode) === NoMode) { 40180 primaryChildFragment.lanes = renderLanes; 40181 } 40182 40183 primaryChildFragment.return = workInProgress; 40184 primaryChildFragment.sibling = null; 40185 40186 if (currentFallbackChildFragment !== null) { 40187 // Delete the fallback child fragment 40188 var deletions = workInProgress.deletions; 40189 40190 if (deletions === null) { 40191 workInProgress.deletions = [currentFallbackChildFragment]; 40192 workInProgress.flags |= ChildDeletion; 40193 } else { 40194 deletions.push(currentFallbackChildFragment); 40195 } 40196 } 40197 40198 workInProgress.child = primaryChildFragment; 40199 return primaryChildFragment; 40200} 40201 40202function updateSuspenseFallbackChildren(current, workInProgress, primaryChildren, fallbackChildren, renderLanes) { 40203 var mode = workInProgress.mode; 40204 var currentPrimaryChildFragment = current.child; 40205 var currentFallbackChildFragment = currentPrimaryChildFragment.sibling; 40206 var primaryChildProps = { 40207 mode: 'hidden', 40208 children: primaryChildren 40209 }; 40210 var primaryChildFragment; 40211 40212 if ( // In legacy mode, we commit the primary tree as if it successfully 40213 // completed, even though it's in an inconsistent state. 40214 (mode & ConcurrentMode) === NoMode && // Make sure we're on the second pass, i.e. the primary child fragment was 40215 // already cloned. In legacy mode, the only case where this isn't true is 40216 // when DevTools forces us to display a fallback; we skip the first render 40217 // pass entirely and go straight to rendering the fallback. (In Concurrent 40218 // Mode, SuspenseList can also trigger this scenario, but this is a legacy- 40219 // only codepath.) 40220 workInProgress.child !== currentPrimaryChildFragment) { 40221 var progressedPrimaryFragment = workInProgress.child; 40222 primaryChildFragment = progressedPrimaryFragment; 40223 primaryChildFragment.childLanes = NoLanes; 40224 primaryChildFragment.pendingProps = primaryChildProps; 40225 40226 if ( workInProgress.mode & ProfileMode) { 40227 // Reset the durations from the first pass so they aren't included in the 40228 // final amounts. This seems counterintuitive, since we're intentionally 40229 // not measuring part of the render phase, but this makes it match what we 40230 // do in Concurrent Mode. 40231 primaryChildFragment.actualDuration = 0; 40232 primaryChildFragment.actualStartTime = -1; 40233 primaryChildFragment.selfBaseDuration = currentPrimaryChildFragment.selfBaseDuration; 40234 primaryChildFragment.treeBaseDuration = currentPrimaryChildFragment.treeBaseDuration; 40235 } // The fallback fiber was added as a deletion during the first pass. 40236 // However, since we're going to remain on the fallback, we no longer want 40237 // to delete it. 40238 40239 40240 workInProgress.deletions = null; 40241 } else { 40242 primaryChildFragment = updateWorkInProgressOffscreenFiber(currentPrimaryChildFragment, primaryChildProps); // Since we're reusing a current tree, we need to reuse the flags, too. 40243 // (We don't do this in legacy mode, because in legacy mode we don't re-use 40244 // the current tree; see previous branch.) 40245 40246 primaryChildFragment.subtreeFlags = currentPrimaryChildFragment.subtreeFlags & StaticMask; 40247 } 40248 40249 var fallbackChildFragment; 40250 40251 if (currentFallbackChildFragment !== null) { 40252 fallbackChildFragment = createWorkInProgress(currentFallbackChildFragment, fallbackChildren); 40253 } else { 40254 fallbackChildFragment = createFiberFromFragment(fallbackChildren, mode, renderLanes, null); // Needs a placement effect because the parent (the Suspense boundary) already 40255 // mounted but this is a new fiber. 40256 40257 fallbackChildFragment.flags |= Placement; 40258 } 40259 40260 fallbackChildFragment.return = workInProgress; 40261 primaryChildFragment.return = workInProgress; 40262 primaryChildFragment.sibling = fallbackChildFragment; 40263 workInProgress.child = primaryChildFragment; 40264 return fallbackChildFragment; 40265} 40266 40267function retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes, recoverableError) { 40268 // Falling back to client rendering. Because this has performance 40269 // implications, it's considered a recoverable error, even though the user 40270 // likely won't observe anything wrong with the UI. 40271 // 40272 // The error is passed in as an argument to enforce that every caller provide 40273 // a custom message, or explicitly opt out (currently the only path that opts 40274 // out is legacy mode; every concurrent path provides an error). 40275 if (recoverableError !== null) { 40276 queueHydrationError(recoverableError); 40277 } // This will add the old fiber to the deletion list 40278 40279 40280 reconcileChildFibers(workInProgress, current.child, null, renderLanes); // We're now not suspended nor dehydrated. 40281 40282 var nextProps = workInProgress.pendingProps; 40283 var primaryChildren = nextProps.children; 40284 var primaryChildFragment = mountSuspensePrimaryChildren(workInProgress, primaryChildren); // Needs a placement effect because the parent (the Suspense boundary) already 40285 // mounted but this is a new fiber. 40286 40287 primaryChildFragment.flags |= Placement; 40288 workInProgress.memoizedState = null; 40289 return primaryChildFragment; 40290} 40291 40292function mountSuspenseFallbackAfterRetryWithoutHydrating(current, workInProgress, primaryChildren, fallbackChildren, renderLanes) { 40293 var fiberMode = workInProgress.mode; 40294 var primaryChildProps = { 40295 mode: 'visible', 40296 children: primaryChildren 40297 }; 40298 var primaryChildFragment = mountWorkInProgressOffscreenFiber(primaryChildProps, fiberMode); 40299 var fallbackChildFragment = createFiberFromFragment(fallbackChildren, fiberMode, renderLanes, null); // Needs a placement effect because the parent (the Suspense 40300 // boundary) already mounted but this is a new fiber. 40301 40302 fallbackChildFragment.flags |= Placement; 40303 primaryChildFragment.return = workInProgress; 40304 fallbackChildFragment.return = workInProgress; 40305 primaryChildFragment.sibling = fallbackChildFragment; 40306 workInProgress.child = primaryChildFragment; 40307 40308 if ((workInProgress.mode & ConcurrentMode) !== NoMode) { 40309 // We will have dropped the effect list which contains the 40310 // deletion. We need to reconcile to delete the current child. 40311 reconcileChildFibers(workInProgress, current.child, null, renderLanes); 40312 } 40313 40314 return fallbackChildFragment; 40315} 40316 40317function mountDehydratedSuspenseComponent(workInProgress, suspenseInstance, renderLanes) { 40318 // During the first pass, we'll bail out and not drill into the children. 40319 // Instead, we'll leave the content in place and try to hydrate it later. 40320 if ((workInProgress.mode & ConcurrentMode) === NoMode) { 40321 { 40322 error('Cannot hydrate Suspense in legacy mode. Switch from ' + 'ReactDOM.hydrate(element, container) to ' + 'ReactDOMClient.hydrateRoot(container, <App />)' + '.render(element) or remove the Suspense components from ' + 'the server rendered components.'); 40323 } 40324 40325 workInProgress.lanes = laneToLanes(SyncLane); 40326 } else if (isSuspenseInstanceFallback(suspenseInstance)) { 40327 // This is a client-only boundary. Since we won't get any content from the server 40328 // for this, we need to schedule that at a higher priority based on when it would 40329 // have timed out. In theory we could render it in this pass but it would have the 40330 // wrong priority associated with it and will prevent hydration of parent path. 40331 // Instead, we'll leave work left on it to render it in a separate commit. 40332 // TODO This time should be the time at which the server rendered response that is 40333 // a parent to this boundary was displayed. However, since we currently don't have 40334 // a protocol to transfer that time, we'll just estimate it by using the current 40335 // time. This will mean that Suspense timeouts are slightly shifted to later than 40336 // they should be. 40337 // Schedule a normal pri update to render this content. 40338 workInProgress.lanes = laneToLanes(DefaultHydrationLane); 40339 } else { 40340 // We'll continue hydrating the rest at offscreen priority since we'll already 40341 // be showing the right content coming from the server, it is no rush. 40342 workInProgress.lanes = laneToLanes(OffscreenLane); 40343 } 40344 40345 return null; 40346} 40347 40348function updateDehydratedSuspenseComponent(current, workInProgress, didSuspend, nextProps, suspenseInstance, suspenseState, renderLanes) { 40349 if (!didSuspend) { 40350 // This is the first render pass. Attempt to hydrate. 40351 // We should never be hydrating at this point because it is the first pass, 40352 // but after we've already committed once. 40353 warnIfHydrating(); 40354 40355 if ((workInProgress.mode & ConcurrentMode) === NoMode) { 40356 return retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes, // TODO: When we delete legacy mode, we should make this error argument 40357 // required â every concurrent mode path that causes hydration to 40358 // de-opt to client rendering should have an error message. 40359 null); 40360 } 40361 40362 if (isSuspenseInstanceFallback(suspenseInstance)) { 40363 // This boundary is in a permanent fallback state. In this case, we'll never 40364 // get an update and we'll never be able to hydrate the final content. Let's just try the 40365 // client side render instead. 40366 var digest, message, stack; 40367 40368 { 40369 var _getSuspenseInstanceF = getSuspenseInstanceFallbackErrorDetails(suspenseInstance); 40370 40371 digest = _getSuspenseInstanceF.digest; 40372 message = _getSuspenseInstanceF.message; 40373 stack = _getSuspenseInstanceF.stack; 40374 } 40375 40376 var error; 40377 40378 if (message) { 40379 // eslint-disable-next-line react-internal/prod-error-codes 40380 error = new Error(message); 40381 } else { 40382 error = new Error('The server could not finish this Suspense boundary, likely ' + 'due to an error during server rendering. Switched to ' + 'client rendering.'); 40383 } 40384 40385 var capturedValue = createCapturedValue(error, digest, stack); 40386 return retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes, capturedValue); 40387 } 40388 // any context has changed, we need to treat is as if the input might have changed. 40389 40390 40391 var hasContextChanged = includesSomeLane(renderLanes, current.childLanes); 40392 40393 if (didReceiveUpdate || hasContextChanged) { 40394 // This boundary has changed since the first render. This means that we are now unable to 40395 // hydrate it. We might still be able to hydrate it using a higher priority lane. 40396 var root = getWorkInProgressRoot(); 40397 40398 if (root !== null) { 40399 var attemptHydrationAtLane = getBumpedLaneForHydration(root, renderLanes); 40400 40401 if (attemptHydrationAtLane !== NoLane && attemptHydrationAtLane !== suspenseState.retryLane) { 40402 // Intentionally mutating since this render will get interrupted. This 40403 // is one of the very rare times where we mutate the current tree 40404 // during the render phase. 40405 suspenseState.retryLane = attemptHydrationAtLane; // TODO: Ideally this would inherit the event time of the current render 40406 40407 var eventTime = NoTimestamp; 40408 enqueueConcurrentRenderForLane(current, attemptHydrationAtLane); 40409 scheduleUpdateOnFiber(root, current, attemptHydrationAtLane, eventTime); 40410 } 40411 } // If we have scheduled higher pri work above, this will probably just abort the render 40412 // since we now have higher priority work, but in case it doesn't, we need to prepare to 40413 // render something, if we time out. Even if that requires us to delete everything and 40414 // skip hydration. 40415 // Delay having to do this as long as the suspense timeout allows us. 40416 40417 40418 renderDidSuspendDelayIfPossible(); 40419 40420 var _capturedValue = createCapturedValue(new Error('This Suspense boundary received an update before it finished ' + 'hydrating. This caused the boundary to switch to client rendering. ' + 'The usual way to fix this is to wrap the original update ' + 'in startTransition.')); 40421 40422 return retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes, _capturedValue); 40423 } else if (isSuspenseInstancePending(suspenseInstance)) { 40424 // This component is still pending more data from the server, so we can't hydrate its 40425 // content. We treat it as if this component suspended itself. It might seem as if 40426 // we could just try to render it client-side instead. However, this will perform a 40427 // lot of unnecessary work and is unlikely to complete since it often will suspend 40428 // on missing data anyway. Additionally, the server might be able to render more 40429 // than we can on the client yet. In that case we'd end up with more fallback states 40430 // on the client than if we just leave it alone. If the server times out or errors 40431 // these should update this boundary to the permanent Fallback state instead. 40432 // Mark it as having captured (i.e. suspended). 40433 workInProgress.flags |= DidCapture; // Leave the child in place. I.e. the dehydrated fragment. 40434 40435 workInProgress.child = current.child; // Register a callback to retry this boundary once the server has sent the result. 40436 40437 var retry = retryDehydratedSuspenseBoundary.bind(null, current); 40438 registerSuspenseInstanceRetry(suspenseInstance, retry); 40439 return null; 40440 } else { 40441 // This is the first attempt. 40442 reenterHydrationStateFromDehydratedSuspenseInstance(workInProgress, suspenseInstance, suspenseState.treeContext); 40443 var primaryChildren = nextProps.children; 40444 var primaryChildFragment = mountSuspensePrimaryChildren(workInProgress, primaryChildren); // Mark the children as hydrating. This is a fast path to know whether this 40445 // tree is part of a hydrating tree. This is used to determine if a child 40446 // node has fully mounted yet, and for scheduling event replaying. 40447 // Conceptually this is similar to Placement in that a new subtree is 40448 // inserted into the React tree here. It just happens to not need DOM 40449 // mutations because it already exists. 40450 40451 primaryChildFragment.flags |= Hydrating; 40452 return primaryChildFragment; 40453 } 40454 } else { 40455 // This is the second render pass. We already attempted to hydrated, but 40456 // something either suspended or errored. 40457 if (workInProgress.flags & ForceClientRender) { 40458 // Something errored during hydration. Try again without hydrating. 40459 workInProgress.flags &= ~ForceClientRender; 40460 40461 var _capturedValue2 = createCapturedValue(new Error('There was an error while hydrating this Suspense boundary. ' + 'Switched to client rendering.')); 40462 40463 return retrySuspenseComponentWithoutHydrating(current, workInProgress, renderLanes, _capturedValue2); 40464 } else if (workInProgress.memoizedState !== null) { 40465 // Something suspended and we should still be in dehydrated mode. 40466 // Leave the existing child in place. 40467 workInProgress.child = current.child; // The dehydrated completion pass expects this flag to be there 40468 // but the normal suspense pass doesn't. 40469 40470 workInProgress.flags |= DidCapture; 40471 return null; 40472 } else { 40473 // Suspended but we should no longer be in dehydrated mode. 40474 // Therefore we now have to render the fallback. 40475 var nextPrimaryChildren = nextProps.children; 40476 var nextFallbackChildren = nextProps.fallback; 40477 var fallbackChildFragment = mountSuspenseFallbackAfterRetryWithoutHydrating(current, workInProgress, nextPrimaryChildren, nextFallbackChildren, renderLanes); 40478 var _primaryChildFragment4 = workInProgress.child; 40479 _primaryChildFragment4.memoizedState = mountSuspenseOffscreenState(renderLanes); 40480 workInProgress.memoizedState = SUSPENDED_MARKER; 40481 return fallbackChildFragment; 40482 } 40483 } 40484} 40485 40486function scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) { 40487 fiber.lanes = mergeLanes(fiber.lanes, renderLanes); 40488 var alternate = fiber.alternate; 40489 40490 if (alternate !== null) { 40491 alternate.lanes = mergeLanes(alternate.lanes, renderLanes); 40492 } 40493 40494 scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot); 40495} 40496 40497function propagateSuspenseContextChange(workInProgress, firstChild, renderLanes) { 40498 // Mark any Suspense boundaries with fallbacks as having work to do. 40499 // If they were previously forced into fallbacks, they may now be able 40500 // to unblock. 40501 var node = firstChild; 40502 40503 while (node !== null) { 40504 if (node.tag === SuspenseComponent) { 40505 var state = node.memoizedState; 40506 40507 if (state !== null) { 40508 scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress); 40509 } 40510 } else if (node.tag === SuspenseListComponent) { 40511 // If the tail is hidden there might not be an Suspense boundaries 40512 // to schedule work on. In this case we have to schedule it on the 40513 // list itself. 40514 // We don't have to traverse to the children of the list since 40515 // the list will propagate the change when it rerenders. 40516 scheduleSuspenseWorkOnFiber(node, renderLanes, workInProgress); 40517 } else if (node.child !== null) { 40518 node.child.return = node; 40519 node = node.child; 40520 continue; 40521 } 40522 40523 if (node === workInProgress) { 40524 return; 40525 } 40526 40527 while (node.sibling === null) { 40528 if (node.return === null || node.return === workInProgress) { 40529 return; 40530 } 40531 40532 node = node.return; 40533 } 40534 40535 node.sibling.return = node.return; 40536 node = node.sibling; 40537 } 40538} 40539 40540function findLastContentRow(firstChild) { 40541 // This is going to find the last row among these children that is already 40542 // showing content on the screen, as opposed to being in fallback state or 40543 // new. If a row has multiple Suspense boundaries, any of them being in the 40544 // fallback state, counts as the whole row being in a fallback state. 40545 // Note that the "rows" will be workInProgress, but any nested children 40546 // will still be current since we haven't rendered them yet. The mounted 40547 // order may not be the same as the new order. We use the new order. 40548 var row = firstChild; 40549 var lastContentRow = null; 40550 40551 while (row !== null) { 40552 var currentRow = row.alternate; // New rows can't be content rows. 40553 40554 if (currentRow !== null && findFirstSuspended(currentRow) === null) { 40555 lastContentRow = row; 40556 } 40557 40558 row = row.sibling; 40559 } 40560 40561 return lastContentRow; 40562} 40563 40564function validateRevealOrder(revealOrder) { 40565 { 40566 if (revealOrder !== undefined && revealOrder !== 'forwards' && revealOrder !== 'backwards' && revealOrder !== 'together' && !didWarnAboutRevealOrder[revealOrder]) { 40567 didWarnAboutRevealOrder[revealOrder] = true; 40568 40569 if (typeof revealOrder === 'string') { 40570 switch (revealOrder.toLowerCase()) { 40571 case 'together': 40572 case 'forwards': 40573 case 'backwards': 40574 { 40575 error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'Use lowercase "%s" instead.', revealOrder, revealOrder.toLowerCase()); 40576 40577 break; 40578 } 40579 40580 case 'forward': 40581 case 'backward': 40582 { 40583 error('"%s" is not a valid value for revealOrder on <SuspenseList />. ' + 'React uses the -s suffix in the spelling. Use "%ss" instead.', revealOrder, revealOrder.toLowerCase()); 40584 40585 break; 40586 } 40587 40588 default: 40589 error('"%s" is not a supported revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder); 40590 40591 break; 40592 } 40593 } else { 40594 error('%s is not a supported value for revealOrder on <SuspenseList />. ' + 'Did you mean "together", "forwards" or "backwards"?', revealOrder); 40595 } 40596 } 40597 } 40598} 40599 40600function validateTailOptions(tailMode, revealOrder) { 40601 { 40602 if (tailMode !== undefined && !didWarnAboutTailOptions[tailMode]) { 40603 if (tailMode !== 'collapsed' && tailMode !== 'hidden') { 40604 didWarnAboutTailOptions[tailMode] = true; 40605 40606 error('"%s" is not a supported value for tail on <SuspenseList />. ' + 'Did you mean "collapsed" or "hidden"?', tailMode); 40607 } else if (revealOrder !== 'forwards' && revealOrder !== 'backwards') { 40608 didWarnAboutTailOptions[tailMode] = true; 40609 40610 error('<SuspenseList tail="%s" /> is only valid if revealOrder is ' + '"forwards" or "backwards". ' + 'Did you mean to specify revealOrder="forwards"?', tailMode); 40611 } 40612 } 40613 } 40614} 40615 40616function validateSuspenseListNestedChild(childSlot, index) { 40617 { 40618 var isAnArray = isArray(childSlot); 40619 var isIterable = !isAnArray && typeof getIteratorFn(childSlot) === 'function'; 40620 40621 if (isAnArray || isIterable) { 40622 var type = isAnArray ? 'array' : 'iterable'; 40623 40624 error('A nested %s was passed to row #%s in <SuspenseList />. Wrap it in ' + 'an additional SuspenseList to configure its revealOrder: ' + '<SuspenseList revealOrder=...> ... ' + '<SuspenseList revealOrder=...>{%s}</SuspenseList> ... ' + '</SuspenseList>', type, index, type); 40625 40626 return false; 40627 } 40628 } 40629 40630 return true; 40631} 40632 40633function validateSuspenseListChildren(children, revealOrder) { 40634 { 40635 if ((revealOrder === 'forwards' || revealOrder === 'backwards') && children !== undefined && children !== null && children !== false) { 40636 if (isArray(children)) { 40637 for (var i = 0; i < children.length; i++) { 40638 if (!validateSuspenseListNestedChild(children[i], i)) { 40639 return; 40640 } 40641 } 40642 } else { 40643 var iteratorFn = getIteratorFn(children); 40644 40645 if (typeof iteratorFn === 'function') { 40646 var childrenIterator = iteratorFn.call(children); 40647 40648 if (childrenIterator) { 40649 var step = childrenIterator.next(); 40650 var _i = 0; 40651 40652 for (; !step.done; step = childrenIterator.next()) { 40653 if (!validateSuspenseListNestedChild(step.value, _i)) { 40654 return; 40655 } 40656 40657 _i++; 40658 } 40659 } 40660 } else { 40661 error('A single row was passed to a <SuspenseList revealOrder="%s" />. ' + 'This is not useful since it needs multiple rows. ' + 'Did you mean to pass multiple children or an array?', revealOrder); 40662 } 40663 } 40664 } 40665 } 40666} 40667 40668function initSuspenseListRenderState(workInProgress, isBackwards, tail, lastContentRow, tailMode) { 40669 var renderState = workInProgress.memoizedState; 40670 40671 if (renderState === null) { 40672 workInProgress.memoizedState = { 40673 isBackwards: isBackwards, 40674 rendering: null, 40675 renderingStartTime: 0, 40676 last: lastContentRow, 40677 tail: tail, 40678 tailMode: tailMode 40679 }; 40680 } else { 40681 // We can reuse the existing object from previous renders. 40682 renderState.isBackwards = isBackwards; 40683 renderState.rendering = null; 40684 renderState.renderingStartTime = 0; 40685 renderState.last = lastContentRow; 40686 renderState.tail = tail; 40687 renderState.tailMode = tailMode; 40688 } 40689} // This can end up rendering this component multiple passes. 40690// The first pass splits the children fibers into two sets. A head and tail. 40691// We first render the head. If anything is in fallback state, we do another 40692// pass through beginWork to rerender all children (including the tail) with 40693// the force suspend context. If the first render didn't have anything in 40694// in fallback state. Then we render each row in the tail one-by-one. 40695// That happens in the completeWork phase without going back to beginWork. 40696 40697 40698function updateSuspenseListComponent(current, workInProgress, renderLanes) { 40699 var nextProps = workInProgress.pendingProps; 40700 var revealOrder = nextProps.revealOrder; 40701 var tailMode = nextProps.tail; 40702 var newChildren = nextProps.children; 40703 validateRevealOrder(revealOrder); 40704 validateTailOptions(tailMode, revealOrder); 40705 validateSuspenseListChildren(newChildren, revealOrder); 40706 reconcileChildren(current, workInProgress, newChildren, renderLanes); 40707 var suspenseContext = suspenseStackCursor.current; 40708 var shouldForceFallback = hasSuspenseContext(suspenseContext, ForceSuspenseFallback); 40709 40710 if (shouldForceFallback) { 40711 suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); 40712 workInProgress.flags |= DidCapture; 40713 } else { 40714 var didSuspendBefore = current !== null && (current.flags & DidCapture) !== NoFlags; 40715 40716 if (didSuspendBefore) { 40717 // If we previously forced a fallback, we need to schedule work 40718 // on any nested boundaries to let them know to try to render 40719 // again. This is the same as context updating. 40720 propagateSuspenseContextChange(workInProgress, workInProgress.child, renderLanes); 40721 } 40722 40723 suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); 40724 } 40725 40726 pushSuspenseContext(workInProgress, suspenseContext); 40727 40728 if ((workInProgress.mode & ConcurrentMode) === NoMode) { 40729 // In legacy mode, SuspenseList doesn't work so we just 40730 // use make it a noop by treating it as the default revealOrder. 40731 workInProgress.memoizedState = null; 40732 } else { 40733 switch (revealOrder) { 40734 case 'forwards': 40735 { 40736 var lastContentRow = findLastContentRow(workInProgress.child); 40737 var tail; 40738 40739 if (lastContentRow === null) { 40740 // The whole list is part of the tail. 40741 // TODO: We could fast path by just rendering the tail now. 40742 tail = workInProgress.child; 40743 workInProgress.child = null; 40744 } else { 40745 // Disconnect the tail rows after the content row. 40746 // We're going to render them separately later. 40747 tail = lastContentRow.sibling; 40748 lastContentRow.sibling = null; 40749 } 40750 40751 initSuspenseListRenderState(workInProgress, false, // isBackwards 40752 tail, lastContentRow, tailMode); 40753 break; 40754 } 40755 40756 case 'backwards': 40757 { 40758 // We're going to find the first row that has existing content. 40759 // At the same time we're going to reverse the list of everything 40760 // we pass in the meantime. That's going to be our tail in reverse 40761 // order. 40762 var _tail = null; 40763 var row = workInProgress.child; 40764 workInProgress.child = null; 40765 40766 while (row !== null) { 40767 var currentRow = row.alternate; // New rows can't be content rows. 40768 40769 if (currentRow !== null && findFirstSuspended(currentRow) === null) { 40770 // This is the beginning of the main content. 40771 workInProgress.child = row; 40772 break; 40773 } 40774 40775 var nextRow = row.sibling; 40776 row.sibling = _tail; 40777 _tail = row; 40778 row = nextRow; 40779 } // TODO: If workInProgress.child is null, we can continue on the tail immediately. 40780 40781 40782 initSuspenseListRenderState(workInProgress, true, // isBackwards 40783 _tail, null, // last 40784 tailMode); 40785 break; 40786 } 40787 40788 case 'together': 40789 { 40790 initSuspenseListRenderState(workInProgress, false, // isBackwards 40791 null, // tail 40792 null, // last 40793 undefined); 40794 break; 40795 } 40796 40797 default: 40798 { 40799 // The default reveal order is the same as not having 40800 // a boundary. 40801 workInProgress.memoizedState = null; 40802 } 40803 } 40804 } 40805 40806 return workInProgress.child; 40807} 40808 40809function updatePortalComponent(current, workInProgress, renderLanes) { 40810 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); 40811 var nextChildren = workInProgress.pendingProps; 40812 40813 if (current === null) { 40814 // Portals are special because we don't append the children during mount 40815 // but at commit. Therefore we need to track insertions which the normal 40816 // flow doesn't do during mount. This doesn't happen at the root because 40817 // the root always starts with a "current" with a null child. 40818 // TODO: Consider unifying this with how the root works. 40819 workInProgress.child = reconcileChildFibers(workInProgress, null, nextChildren, renderLanes); 40820 } else { 40821 reconcileChildren(current, workInProgress, nextChildren, renderLanes); 40822 } 40823 40824 return workInProgress.child; 40825} 40826 40827var hasWarnedAboutUsingNoValuePropOnContextProvider = false; 40828 40829function updateContextProvider(current, workInProgress, renderLanes) { 40830 var providerType = workInProgress.type; 40831 var context = providerType._context; 40832 var newProps = workInProgress.pendingProps; 40833 var oldProps = workInProgress.memoizedProps; 40834 var newValue = newProps.value; 40835 40836 { 40837 if (!('value' in newProps)) { 40838 if (!hasWarnedAboutUsingNoValuePropOnContextProvider) { 40839 hasWarnedAboutUsingNoValuePropOnContextProvider = true; 40840 40841 error('The `value` prop is required for the `<Context.Provider>`. Did you misspell it or forget to pass it?'); 40842 } 40843 } 40844 40845 var providerPropTypes = workInProgress.type.propTypes; 40846 40847 if (providerPropTypes) { 40848 checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider'); 40849 } 40850 } 40851 40852 pushProvider(workInProgress, context, newValue); 40853 40854 { 40855 if (oldProps !== null) { 40856 var oldValue = oldProps.value; 40857 40858 if (objectIs(oldValue, newValue)) { 40859 // No change. Bailout early if children are the same. 40860 if (oldProps.children === newProps.children && !hasContextChanged()) { 40861 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); 40862 } 40863 } else { 40864 // The context value changed. Search for matching consumers and schedule 40865 // them to update. 40866 propagateContextChange(workInProgress, context, renderLanes); 40867 } 40868 } 40869 } 40870 40871 var newChildren = newProps.children; 40872 reconcileChildren(current, workInProgress, newChildren, renderLanes); 40873 return workInProgress.child; 40874} 40875 40876var hasWarnedAboutUsingContextAsConsumer = false; 40877 40878function updateContextConsumer(current, workInProgress, renderLanes) { 40879 var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In 40880 // DEV mode, we create a separate object for Context.Consumer that acts 40881 // like a proxy to Context. This proxy object adds unnecessary code in PROD 40882 // so we use the old behaviour (Context.Consumer references Context) to 40883 // reduce size and overhead. The separate object references context via 40884 // a property called "_context", which also gives us the ability to check 40885 // in DEV mode if this property exists or not and warn if it does not. 40886 40887 { 40888 if (context._context === undefined) { 40889 // This may be because it's a Context (rather than a Consumer). 40890 // Or it may be because it's older React where they're the same thing. 40891 // We only want to warn if we're sure it's a new React. 40892 if (context !== context.Consumer) { 40893 if (!hasWarnedAboutUsingContextAsConsumer) { 40894 hasWarnedAboutUsingContextAsConsumer = true; 40895 40896 error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?'); 40897 } 40898 } 40899 } else { 40900 context = context._context; 40901 } 40902 } 40903 40904 var newProps = workInProgress.pendingProps; 40905 var render = newProps.children; 40906 40907 { 40908 if (typeof render !== 'function') { 40909 error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.'); 40910 } 40911 } 40912 40913 prepareToReadContext(workInProgress, renderLanes); 40914 var newValue = readContext(context); 40915 40916 { 40917 markComponentRenderStarted(workInProgress); 40918 } 40919 40920 var newChildren; 40921 40922 { 40923 ReactCurrentOwner$1.current = workInProgress; 40924 setIsRendering(true); 40925 newChildren = render(newValue); 40926 setIsRendering(false); 40927 } 40928 40929 { 40930 markComponentRenderStopped(); 40931 } // React DevTools reads this flag. 40932 40933 40934 workInProgress.flags |= PerformedWork; 40935 reconcileChildren(current, workInProgress, newChildren, renderLanes); 40936 return workInProgress.child; 40937} 40938 40939function markWorkInProgressReceivedUpdate() { 40940 didReceiveUpdate = true; 40941} 40942 40943function resetSuspendedCurrentOnMountInLegacyMode(current, workInProgress) { 40944 if ((workInProgress.mode & ConcurrentMode) === NoMode) { 40945 if (current !== null) { 40946 // A lazy component only mounts if it suspended inside a non- 40947 // concurrent tree, in an inconsistent state. We want to treat it like 40948 // a new mount, even though an empty version of it already committed. 40949 // Disconnect the alternate pointers. 40950 current.alternate = null; 40951 workInProgress.alternate = null; // Since this is conceptually a new fiber, schedule a Placement effect 40952 40953 workInProgress.flags |= Placement; 40954 } 40955 } 40956} 40957 40958function bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) { 40959 if (current !== null) { 40960 // Reuse previous dependencies 40961 workInProgress.dependencies = current.dependencies; 40962 } 40963 40964 { 40965 // Don't update "base" render times for bailouts. 40966 stopProfilerTimerIfRunning(); 40967 } 40968 40969 markSkippedUpdateLanes(workInProgress.lanes); // Check if the children have any pending work. 40970 40971 if (!includesSomeLane(renderLanes, workInProgress.childLanes)) { 40972 // The children don't have any work either. We can skip them. 40973 // TODO: Once we add back resuming, we should check if the children are 40974 // a work-in-progress set. If so, we need to transfer their effects. 40975 { 40976 return null; 40977 } 40978 } // This fiber doesn't have work, but its subtree does. Clone the child 40979 // fibers and continue. 40980 40981 40982 cloneChildFibers(current, workInProgress); 40983 return workInProgress.child; 40984} 40985 40986function remountFiber(current, oldWorkInProgress, newWorkInProgress) { 40987 { 40988 var returnFiber = oldWorkInProgress.return; 40989 40990 if (returnFiber === null) { 40991 // eslint-disable-next-line react-internal/prod-error-codes 40992 throw new Error('Cannot swap the root fiber.'); 40993 } // Disconnect from the old current. 40994 // It will get deleted. 40995 40996 40997 current.alternate = null; 40998 oldWorkInProgress.alternate = null; // Connect to the new tree. 40999 41000 newWorkInProgress.index = oldWorkInProgress.index; 41001 newWorkInProgress.sibling = oldWorkInProgress.sibling; 41002 newWorkInProgress.return = oldWorkInProgress.return; 41003 newWorkInProgress.ref = oldWorkInProgress.ref; // Replace the child/sibling pointers above it. 41004 41005 if (oldWorkInProgress === returnFiber.child) { 41006 returnFiber.child = newWorkInProgress; 41007 } else { 41008 var prevSibling = returnFiber.child; 41009 41010 if (prevSibling === null) { 41011 // eslint-disable-next-line react-internal/prod-error-codes 41012 throw new Error('Expected parent to have a child.'); 41013 } 41014 41015 while (prevSibling.sibling !== oldWorkInProgress) { 41016 prevSibling = prevSibling.sibling; 41017 41018 if (prevSibling === null) { 41019 // eslint-disable-next-line react-internal/prod-error-codes 41020 throw new Error('Expected to find the previous sibling.'); 41021 } 41022 } 41023 41024 prevSibling.sibling = newWorkInProgress; 41025 } // Delete the old fiber and place the new one. 41026 // Since the old fiber is disconnected, we have to schedule it manually. 41027 41028 41029 var deletions = returnFiber.deletions; 41030 41031 if (deletions === null) { 41032 returnFiber.deletions = [current]; 41033 returnFiber.flags |= ChildDeletion; 41034 } else { 41035 deletions.push(current); 41036 } 41037 41038 newWorkInProgress.flags |= Placement; // Restart work from the new fiber. 41039 41040 return newWorkInProgress; 41041 } 41042} 41043 41044function checkScheduledUpdateOrContext(current, renderLanes) { 41045 // Before performing an early bailout, we must check if there are pending 41046 // updates or context. 41047 var updateLanes = current.lanes; 41048 41049 if (includesSomeLane(updateLanes, renderLanes)) { 41050 return true; 41051 } // No pending update, but because context is propagated lazily, we need 41052 41053 return false; 41054} 41055 41056function attemptEarlyBailoutIfNoScheduledUpdate(current, workInProgress, renderLanes) { 41057 // This fiber does not have any pending work. Bailout without entering 41058 // the begin phase. There's still some bookkeeping we that needs to be done 41059 // in this optimized path, mostly pushing stuff onto the stack. 41060 switch (workInProgress.tag) { 41061 case HostRoot: 41062 pushHostRootContext(workInProgress); 41063 var root = workInProgress.stateNode; 41064 41065 resetHydrationState(); 41066 break; 41067 41068 case HostComponent: 41069 pushHostContext(workInProgress); 41070 break; 41071 41072 case ClassComponent: 41073 { 41074 var Component = workInProgress.type; 41075 41076 if (isContextProvider(Component)) { 41077 pushContextProvider(workInProgress); 41078 } 41079 41080 break; 41081 } 41082 41083 case HostPortal: 41084 pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo); 41085 break; 41086 41087 case ContextProvider: 41088 { 41089 var newValue = workInProgress.memoizedProps.value; 41090 var context = workInProgress.type._context; 41091 pushProvider(workInProgress, context, newValue); 41092 break; 41093 } 41094 41095 case Profiler: 41096 { 41097 // Profiler should only call onRender when one of its descendants actually rendered. 41098 var hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); 41099 41100 if (hasChildWork) { 41101 workInProgress.flags |= Update; 41102 } 41103 41104 { 41105 // Reset effect durations for the next eventual effect phase. 41106 // These are reset during render to allow the DevTools commit hook a chance to read them, 41107 var stateNode = workInProgress.stateNode; 41108 stateNode.effectDuration = 0; 41109 stateNode.passiveEffectDuration = 0; 41110 } 41111 } 41112 41113 break; 41114 41115 case SuspenseComponent: 41116 { 41117 var state = workInProgress.memoizedState; 41118 41119 if (state !== null) { 41120 if (state.dehydrated !== null) { 41121 pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // We know that this component will suspend again because if it has 41122 // been unsuspended it has committed as a resolved Suspense component. 41123 // If it needs to be retried, it should have work scheduled on it. 41124 41125 workInProgress.flags |= DidCapture; // We should never render the children of a dehydrated boundary until we 41126 // upgrade it. We return null instead of bailoutOnAlreadyFinishedWork. 41127 41128 return null; 41129 } // If this boundary is currently timed out, we need to decide 41130 // whether to retry the primary children, or to skip over it and 41131 // go straight to the fallback. Check the priority of the primary 41132 // child fragment. 41133 41134 41135 var primaryChildFragment = workInProgress.child; 41136 var primaryChildLanes = primaryChildFragment.childLanes; 41137 41138 if (includesSomeLane(renderLanes, primaryChildLanes)) { 41139 // The primary children have pending work. Use the normal path 41140 // to attempt to render the primary children again. 41141 return updateSuspenseComponent(current, workInProgress, renderLanes); 41142 } else { 41143 // The primary child fragment does not have pending work marked 41144 // on it 41145 pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); // The primary children do not have pending work with sufficient 41146 // priority. Bailout. 41147 41148 var child = bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); 41149 41150 if (child !== null) { 41151 // The fallback children have pending work. Skip over the 41152 // primary children and work on the fallback. 41153 return child.sibling; 41154 } else { 41155 // Note: We can return `null` here because we already checked 41156 // whether there were nested context consumers, via the call to 41157 // `bailoutOnAlreadyFinishedWork` above. 41158 return null; 41159 } 41160 } 41161 } else { 41162 pushSuspenseContext(workInProgress, setDefaultShallowSuspenseContext(suspenseStackCursor.current)); 41163 } 41164 41165 break; 41166 } 41167 41168 case SuspenseListComponent: 41169 { 41170 var didSuspendBefore = (current.flags & DidCapture) !== NoFlags; 41171 41172 var _hasChildWork = includesSomeLane(renderLanes, workInProgress.childLanes); 41173 41174 if (didSuspendBefore) { 41175 if (_hasChildWork) { 41176 // If something was in fallback state last time, and we have all the 41177 // same children then we're still in progressive loading state. 41178 // Something might get unblocked by state updates or retries in the 41179 // tree which will affect the tail. So we need to use the normal 41180 // path to compute the correct tail. 41181 return updateSuspenseListComponent(current, workInProgress, renderLanes); 41182 } // If none of the children had any work, that means that none of 41183 // them got retried so they'll still be blocked in the same way 41184 // as before. We can fast bail out. 41185 41186 41187 workInProgress.flags |= DidCapture; 41188 } // If nothing suspended before and we're rendering the same children, 41189 // then the tail doesn't matter. Anything new that suspends will work 41190 // in the "together" mode, so we can continue from the state we had. 41191 41192 41193 var renderState = workInProgress.memoizedState; 41194 41195 if (renderState !== null) { 41196 // Reset to the "together" mode in case we've started a different 41197 // update in the past but didn't complete it. 41198 renderState.rendering = null; 41199 renderState.tail = null; 41200 renderState.lastEffect = null; 41201 } 41202 41203 pushSuspenseContext(workInProgress, suspenseStackCursor.current); 41204 41205 if (_hasChildWork) { 41206 break; 41207 } else { 41208 // If none of the children had any work, that means that none of 41209 // them got retried so they'll still be blocked in the same way 41210 // as before. We can fast bail out. 41211 return null; 41212 } 41213 } 41214 41215 case OffscreenComponent: 41216 case LegacyHiddenComponent: 41217 { 41218 // Need to check if the tree still needs to be deferred. This is 41219 // almost identical to the logic used in the normal update path, 41220 // so we'll just enter that. The only difference is we'll bail out 41221 // at the next level instead of this one, because the child props 41222 // have not changed. Which is fine. 41223 // TODO: Probably should refactor `beginWork` to split the bailout 41224 // path from the normal path. I'm tempted to do a labeled break here 41225 // but I won't :) 41226 workInProgress.lanes = NoLanes; 41227 return updateOffscreenComponent(current, workInProgress, renderLanes); 41228 } 41229 } 41230 41231 return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes); 41232} 41233 41234function beginWork(current, workInProgress, renderLanes) { 41235 { 41236 if (workInProgress._debugNeedsRemount && current !== null) { 41237 // This will restart the begin phase with a new fiber. 41238 return remountFiber(current, workInProgress, createFiberFromTypeAndProps(workInProgress.type, workInProgress.key, workInProgress.pendingProps, workInProgress._debugOwner || null, workInProgress.mode, workInProgress.lanes)); 41239 } 41240 } 41241 41242 if (current !== null) { 41243 var oldProps = current.memoizedProps; 41244 var newProps = workInProgress.pendingProps; 41245 41246 if (oldProps !== newProps || hasContextChanged() || ( // Force a re-render if the implementation changed due to hot reload: 41247 workInProgress.type !== current.type )) { 41248 // If props or context changed, mark the fiber as having performed work. 41249 // This may be unset if the props are determined to be equal later (memo). 41250 didReceiveUpdate = true; 41251 } else { 41252 // Neither props nor legacy context changes. Check if there's a pending 41253 // update or context change. 41254 var hasScheduledUpdateOrContext = checkScheduledUpdateOrContext(current, renderLanes); 41255 41256 if (!hasScheduledUpdateOrContext && // If this is the second pass of an error or suspense boundary, there 41257 // may not be work scheduled on `current`, so we check for this flag. 41258 (workInProgress.flags & DidCapture) === NoFlags) { 41259 // No pending updates or context. Bail out now. 41260 didReceiveUpdate = false; 41261 return attemptEarlyBailoutIfNoScheduledUpdate(current, workInProgress, renderLanes); 41262 } 41263 41264 if ((current.flags & ForceUpdateForLegacySuspense) !== NoFlags) { 41265 // This is a special case that only exists for legacy mode. 41266 // See https://github.com/facebook/react/pull/19216. 41267 didReceiveUpdate = true; 41268 } else { 41269 // An update was scheduled on this fiber, but there are no new props 41270 // nor legacy context. Set this to false. If an update queue or context 41271 // consumer produces a changed value, it will set this to true. Otherwise, 41272 // the component will assume the children have not changed and bail out. 41273 didReceiveUpdate = false; 41274 } 41275 } 41276 } else { 41277 didReceiveUpdate = false; 41278 41279 if (getIsHydrating() && isForkedChild(workInProgress)) { 41280 // Check if this child belongs to a list of muliple children in 41281 // its parent. 41282 // 41283 // In a true multi-threaded implementation, we would render children on 41284 // parallel threads. This would represent the beginning of a new render 41285 // thread for this subtree. 41286 // 41287 // We only use this for id generation during hydration, which is why the 41288 // logic is located in this special branch. 41289 var slotIndex = workInProgress.index; 41290 var numberOfForks = getForksAtLevel(); 41291 pushTreeId(workInProgress, numberOfForks, slotIndex); 41292 } 41293 } // Before entering the begin phase, clear pending update priority. 41294 // TODO: This assumes that we're about to evaluate the component and process 41295 // the update queue. However, there's an exception: SimpleMemoComponent 41296 // sometimes bails out later in the begin phase. This indicates that we should 41297 // move this assignment out of the common path and into each branch. 41298 41299 41300 workInProgress.lanes = NoLanes; 41301 41302 switch (workInProgress.tag) { 41303 case IndeterminateComponent: 41304 { 41305 return mountIndeterminateComponent(current, workInProgress, workInProgress.type, renderLanes); 41306 } 41307 41308 case LazyComponent: 41309 { 41310 var elementType = workInProgress.elementType; 41311 return mountLazyComponent(current, workInProgress, elementType, renderLanes); 41312 } 41313 41314 case FunctionComponent: 41315 { 41316 var Component = workInProgress.type; 41317 var unresolvedProps = workInProgress.pendingProps; 41318 var resolvedProps = workInProgress.elementType === Component ? unresolvedProps : resolveDefaultProps(Component, unresolvedProps); 41319 return updateFunctionComponent(current, workInProgress, Component, resolvedProps, renderLanes); 41320 } 41321 41322 case ClassComponent: 41323 { 41324 var _Component = workInProgress.type; 41325 var _unresolvedProps = workInProgress.pendingProps; 41326 41327 var _resolvedProps = workInProgress.elementType === _Component ? _unresolvedProps : resolveDefaultProps(_Component, _unresolvedProps); 41328 41329 return updateClassComponent(current, workInProgress, _Component, _resolvedProps, renderLanes); 41330 } 41331 41332 case HostRoot: 41333 return updateHostRoot(current, workInProgress, renderLanes); 41334 41335 case HostComponent: 41336 return updateHostComponent(current, workInProgress, renderLanes); 41337 41338 case HostText: 41339 return updateHostText(current, workInProgress); 41340 41341 case SuspenseComponent: 41342 return updateSuspenseComponent(current, workInProgress, renderLanes); 41343 41344 case HostPortal: 41345 return updatePortalComponent(current, workInProgress, renderLanes); 41346 41347 case ForwardRef: 41348 { 41349 var type = workInProgress.type; 41350 var _unresolvedProps2 = workInProgress.pendingProps; 41351 41352 var _resolvedProps2 = workInProgress.elementType === type ? _unresolvedProps2 : resolveDefaultProps(type, _unresolvedProps2); 41353 41354 return updateForwardRef(current, workInProgress, type, _resolvedProps2, renderLanes); 41355 } 41356 41357 case Fragment: 41358 return updateFragment(current, workInProgress, renderLanes); 41359 41360 case Mode: 41361 return updateMode(current, workInProgress, renderLanes); 41362 41363 case Profiler: 41364 return updateProfiler(current, workInProgress, renderLanes); 41365 41366 case ContextProvider: 41367 return updateContextProvider(current, workInProgress, renderLanes); 41368 41369 case ContextConsumer: 41370 return updateContextConsumer(current, workInProgress, renderLanes); 41371 41372 case MemoComponent: 41373 { 41374 var _type2 = workInProgress.type; 41375 var _unresolvedProps3 = workInProgress.pendingProps; // Resolve outer props first, then resolve inner props. 41376 41377 var _resolvedProps3 = resolveDefaultProps(_type2, _unresolvedProps3); 41378 41379 { 41380 if (workInProgress.type !== workInProgress.elementType) { 41381 var outerPropTypes = _type2.propTypes; 41382 41383 if (outerPropTypes) { 41384 checkPropTypes(outerPropTypes, _resolvedProps3, // Resolved for outer only 41385 'prop', getComponentNameFromType(_type2)); 41386 } 41387 } 41388 } 41389 41390 _resolvedProps3 = resolveDefaultProps(_type2.type, _resolvedProps3); 41391 return updateMemoComponent(current, workInProgress, _type2, _resolvedProps3, renderLanes); 41392 } 41393 41394 case SimpleMemoComponent: 41395 { 41396 return updateSimpleMemoComponent(current, workInProgress, workInProgress.type, workInProgress.pendingProps, renderLanes); 41397 } 41398 41399 case IncompleteClassComponent: 41400 { 41401 var _Component2 = workInProgress.type; 41402 var _unresolvedProps4 = workInProgress.pendingProps; 41403 41404 var _resolvedProps4 = workInProgress.elementType === _Component2 ? _unresolvedProps4 : resolveDefaultProps(_Component2, _unresolvedProps4); 41405 41406 return mountIncompleteClassComponent(current, workInProgress, _Component2, _resolvedProps4, renderLanes); 41407 } 41408 41409 case SuspenseListComponent: 41410 { 41411 return updateSuspenseListComponent(current, workInProgress, renderLanes); 41412 } 41413 41414 case ScopeComponent: 41415 { 41416 41417 break; 41418 } 41419 41420 case OffscreenComponent: 41421 { 41422 return updateOffscreenComponent(current, workInProgress, renderLanes); 41423 } 41424 } 41425 41426 throw new Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in " + 'React. Please file an issue.'); 41427} 41428 41429function markUpdate(workInProgress) { 41430 // Tag the fiber with an update effect. This turns a Placement into 41431 // a PlacementAndUpdate. 41432 workInProgress.flags |= Update; 41433} 41434 41435function markRef$1(workInProgress) { 41436 workInProgress.flags |= Ref; 41437 41438 { 41439 workInProgress.flags |= RefStatic; 41440 } 41441} 41442 41443var appendAllChildren; 41444var updateHostContainer; 41445var updateHostComponent$1; 41446var updateHostText$1; 41447 41448{ 41449 // Mutation mode 41450 appendAllChildren = function (parent, workInProgress, needsVisibilityToggle, isHidden) { 41451 // We only have the top Fiber that was created but we need recurse down its 41452 // children to find all the terminal nodes. 41453 var node = workInProgress.child; 41454 41455 while (node !== null) { 41456 if (node.tag === HostComponent || node.tag === HostText) { 41457 appendInitialChild(parent, node.stateNode); 41458 } else if (node.tag === HostPortal) ; else if (node.child !== null) { 41459 node.child.return = node; 41460 node = node.child; 41461 continue; 41462 } 41463 41464 if (node === workInProgress) { 41465 return; 41466 } 41467 41468 while (node.sibling === null) { 41469 if (node.return === null || node.return === workInProgress) { 41470 return; 41471 } 41472 41473 node = node.return; 41474 } 41475 41476 node.sibling.return = node.return; 41477 node = node.sibling; 41478 } 41479 }; 41480 41481 updateHostContainer = function (current, workInProgress) {// Noop 41482 }; 41483 41484 updateHostComponent$1 = function (current, workInProgress, type, newProps, rootContainerInstance) { 41485 // If we have an alternate, that means this is an update and we need to 41486 // schedule a side-effect to do the updates. 41487 var oldProps = current.memoizedProps; 41488 41489 if (oldProps === newProps) { 41490 // In mutation mode, this is sufficient for a bailout because 41491 // we won't touch this node even if children changed. 41492 return; 41493 } // If we get updated because one of our children updated, we don't 41494 // have newProps so we'll have to reuse them. 41495 // TODO: Split the update API as separate for the props vs. children. 41496 // Even better would be if children weren't special cased at all tho. 41497 41498 41499 var instance = workInProgress.stateNode; 41500 var currentHostContext = getHostContext(); // TODO: Experiencing an error where oldProps is null. Suggests a host 41501 // component is hitting the resume path. Figure out why. Possibly 41502 // related to `hidden`. 41503 41504 var updatePayload = prepareUpdate(instance, type, oldProps, newProps, rootContainerInstance, currentHostContext); // TODO: Type this specific to this type of component. 41505 41506 workInProgress.updateQueue = updatePayload; // If the update payload indicates that there is a change or if there 41507 // is a new ref we mark this as an update. All the work is done in commitWork. 41508 41509 if (updatePayload) { 41510 markUpdate(workInProgress); 41511 } 41512 }; 41513 41514 updateHostText$1 = function (current, workInProgress, oldText, newText) { 41515 // If the text differs, mark it as an update. All the work in done in commitWork. 41516 if (oldText !== newText) { 41517 markUpdate(workInProgress); 41518 } 41519 }; 41520} 41521 41522function cutOffTailIfNeeded(renderState, hasRenderedATailFallback) { 41523 if (getIsHydrating()) { 41524 // If we're hydrating, we should consume as many items as we can 41525 // so we don't leave any behind. 41526 return; 41527 } 41528 41529 switch (renderState.tailMode) { 41530 case 'hidden': 41531 { 41532 // Any insertions at the end of the tail list after this point 41533 // should be invisible. If there are already mounted boundaries 41534 // anything before them are not considered for collapsing. 41535 // Therefore we need to go through the whole tail to find if 41536 // there are any. 41537 var tailNode = renderState.tail; 41538 var lastTailNode = null; 41539 41540 while (tailNode !== null) { 41541 if (tailNode.alternate !== null) { 41542 lastTailNode = tailNode; 41543 } 41544 41545 tailNode = tailNode.sibling; 41546 } // Next we're simply going to delete all insertions after the 41547 // last rendered item. 41548 41549 41550 if (lastTailNode === null) { 41551 // All remaining items in the tail are insertions. 41552 renderState.tail = null; 41553 } else { 41554 // Detach the insertion after the last node that was already 41555 // inserted. 41556 lastTailNode.sibling = null; 41557 } 41558 41559 break; 41560 } 41561 41562 case 'collapsed': 41563 { 41564 // Any insertions at the end of the tail list after this point 41565 // should be invisible. If there are already mounted boundaries 41566 // anything before them are not considered for collapsing. 41567 // Therefore we need to go through the whole tail to find if 41568 // there are any. 41569 var _tailNode = renderState.tail; 41570 var _lastTailNode = null; 41571 41572 while (_tailNode !== null) { 41573 if (_tailNode.alternate !== null) { 41574 _lastTailNode = _tailNode; 41575 } 41576 41577 _tailNode = _tailNode.sibling; 41578 } // Next we're simply going to delete all insertions after the 41579 // last rendered item. 41580 41581 41582 if (_lastTailNode === null) { 41583 // All remaining items in the tail are insertions. 41584 if (!hasRenderedATailFallback && renderState.tail !== null) { 41585 // We suspended during the head. We want to show at least one 41586 // row at the tail. So we'll keep on and cut off the rest. 41587 renderState.tail.sibling = null; 41588 } else { 41589 renderState.tail = null; 41590 } 41591 } else { 41592 // Detach the insertion after the last node that was already 41593 // inserted. 41594 _lastTailNode.sibling = null; 41595 } 41596 41597 break; 41598 } 41599 } 41600} 41601 41602function bubbleProperties(completedWork) { 41603 var didBailout = completedWork.alternate !== null && completedWork.alternate.child === completedWork.child; 41604 var newChildLanes = NoLanes; 41605 var subtreeFlags = NoFlags; 41606 41607 if (!didBailout) { 41608 // Bubble up the earliest expiration time. 41609 if ( (completedWork.mode & ProfileMode) !== NoMode) { 41610 // In profiling mode, resetChildExpirationTime is also used to reset 41611 // profiler durations. 41612 var actualDuration = completedWork.actualDuration; 41613 var treeBaseDuration = completedWork.selfBaseDuration; 41614 var child = completedWork.child; 41615 41616 while (child !== null) { 41617 newChildLanes = mergeLanes(newChildLanes, mergeLanes(child.lanes, child.childLanes)); 41618 subtreeFlags |= child.subtreeFlags; 41619 subtreeFlags |= child.flags; // When a fiber is cloned, its actualDuration is reset to 0. This value will 41620 // only be updated if work is done on the fiber (i.e. it doesn't bailout). 41621 // When work is done, it should bubble to the parent's actualDuration. If 41622 // the fiber has not been cloned though, (meaning no work was done), then 41623 // this value will reflect the amount of time spent working on a previous 41624 // render. In that case it should not bubble. We determine whether it was 41625 // cloned by comparing the child pointer. 41626 41627 actualDuration += child.actualDuration; 41628 treeBaseDuration += child.treeBaseDuration; 41629 child = child.sibling; 41630 } 41631 41632 completedWork.actualDuration = actualDuration; 41633 completedWork.treeBaseDuration = treeBaseDuration; 41634 } else { 41635 var _child = completedWork.child; 41636 41637 while (_child !== null) { 41638 newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child.lanes, _child.childLanes)); 41639 subtreeFlags |= _child.subtreeFlags; 41640 subtreeFlags |= _child.flags; // Update the return pointer so the tree is consistent. This is a code 41641 // smell because it assumes the commit phase is never concurrent with 41642 // the render phase. Will address during refactor to alternate model. 41643 41644 _child.return = completedWork; 41645 _child = _child.sibling; 41646 } 41647 } 41648 41649 completedWork.subtreeFlags |= subtreeFlags; 41650 } else { 41651 // Bubble up the earliest expiration time. 41652 if ( (completedWork.mode & ProfileMode) !== NoMode) { 41653 // In profiling mode, resetChildExpirationTime is also used to reset 41654 // profiler durations. 41655 var _treeBaseDuration = completedWork.selfBaseDuration; 41656 var _child2 = completedWork.child; 41657 41658 while (_child2 !== null) { 41659 newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child2.lanes, _child2.childLanes)); // "Static" flags share the lifetime of the fiber/hook they belong to, 41660 // so we should bubble those up even during a bailout. All the other 41661 // flags have a lifetime only of a single render + commit, so we should 41662 // ignore them. 41663 41664 subtreeFlags |= _child2.subtreeFlags & StaticMask; 41665 subtreeFlags |= _child2.flags & StaticMask; 41666 _treeBaseDuration += _child2.treeBaseDuration; 41667 _child2 = _child2.sibling; 41668 } 41669 41670 completedWork.treeBaseDuration = _treeBaseDuration; 41671 } else { 41672 var _child3 = completedWork.child; 41673 41674 while (_child3 !== null) { 41675 newChildLanes = mergeLanes(newChildLanes, mergeLanes(_child3.lanes, _child3.childLanes)); // "Static" flags share the lifetime of the fiber/hook they belong to, 41676 // so we should bubble those up even during a bailout. All the other 41677 // flags have a lifetime only of a single render + commit, so we should 41678 // ignore them. 41679 41680 subtreeFlags |= _child3.subtreeFlags & StaticMask; 41681 subtreeFlags |= _child3.flags & StaticMask; // Update the return pointer so the tree is consistent. This is a code 41682 // smell because it assumes the commit phase is never concurrent with 41683 // the render phase. Will address during refactor to alternate model. 41684 41685 _child3.return = completedWork; 41686 _child3 = _child3.sibling; 41687 } 41688 } 41689 41690 completedWork.subtreeFlags |= subtreeFlags; 41691 } 41692 41693 completedWork.childLanes = newChildLanes; 41694 return didBailout; 41695} 41696 41697function completeDehydratedSuspenseBoundary(current, workInProgress, nextState) { 41698 if (hasUnhydratedTailNodes() && (workInProgress.mode & ConcurrentMode) !== NoMode && (workInProgress.flags & DidCapture) === NoFlags) { 41699 warnIfUnhydratedTailNodes(workInProgress); 41700 resetHydrationState(); 41701 workInProgress.flags |= ForceClientRender | Incomplete | ShouldCapture; 41702 return false; 41703 } 41704 41705 var wasHydrated = popHydrationState(workInProgress); 41706 41707 if (nextState !== null && nextState.dehydrated !== null) { 41708 // We might be inside a hydration state the first time we're picking up this 41709 // Suspense boundary, and also after we've reentered it for further hydration. 41710 if (current === null) { 41711 if (!wasHydrated) { 41712 throw new Error('A dehydrated suspense component was completed without a hydrated node. ' + 'This is probably a bug in React.'); 41713 } 41714 41715 prepareToHydrateHostSuspenseInstance(workInProgress); 41716 bubbleProperties(workInProgress); 41717 41718 { 41719 if ((workInProgress.mode & ProfileMode) !== NoMode) { 41720 var isTimedOutSuspense = nextState !== null; 41721 41722 if (isTimedOutSuspense) { 41723 // Don't count time spent in a timed out Suspense subtree as part of the base duration. 41724 var primaryChildFragment = workInProgress.child; 41725 41726 if (primaryChildFragment !== null) { 41727 // $FlowFixMe Flow doesn't support type casting in combination with the -= operator 41728 workInProgress.treeBaseDuration -= primaryChildFragment.treeBaseDuration; 41729 } 41730 } 41731 } 41732 } 41733 41734 return false; 41735 } else { 41736 // We might have reentered this boundary to hydrate it. If so, we need to reset the hydration 41737 // state since we're now exiting out of it. popHydrationState doesn't do that for us. 41738 resetHydrationState(); 41739 41740 if ((workInProgress.flags & DidCapture) === NoFlags) { 41741 // This boundary did not suspend so it's now hydrated and unsuspended. 41742 workInProgress.memoizedState = null; 41743 } // If nothing suspended, we need to schedule an effect to mark this boundary 41744 // as having hydrated so events know that they're free to be invoked. 41745 // It's also a signal to replay events and the suspense callback. 41746 // If something suspended, schedule an effect to attach retry listeners. 41747 // So we might as well always mark this. 41748 41749 41750 workInProgress.flags |= Update; 41751 bubbleProperties(workInProgress); 41752 41753 { 41754 if ((workInProgress.mode & ProfileMode) !== NoMode) { 41755 var _isTimedOutSuspense = nextState !== null; 41756 41757 if (_isTimedOutSuspense) { 41758 // Don't count time spent in a timed out Suspense subtree as part of the base duration. 41759 var _primaryChildFragment = workInProgress.child; 41760 41761 if (_primaryChildFragment !== null) { 41762 // $FlowFixMe Flow doesn't support type casting in combination with the -= operator 41763 workInProgress.treeBaseDuration -= _primaryChildFragment.treeBaseDuration; 41764 } 41765 } 41766 } 41767 } 41768 41769 return false; 41770 } 41771 } else { 41772 // Successfully completed this tree. If this was a forced client render, 41773 // there may have been recoverable errors during first hydration 41774 // attempt. If so, add them to a queue so we can log them in the 41775 // commit phase. 41776 upgradeHydrationErrorsToRecoverable(); // Fall through to normal Suspense path 41777 41778 return true; 41779 } 41780} 41781 41782function completeWork(current, workInProgress, renderLanes) { 41783 var newProps = workInProgress.pendingProps; // Note: This intentionally doesn't check if we're hydrating because comparing 41784 // to the current tree provider fiber is just as fast and less error-prone. 41785 // Ideally we would have a special version of the work loop only 41786 // for hydration. 41787 41788 popTreeContext(workInProgress); 41789 41790 switch (workInProgress.tag) { 41791 case IndeterminateComponent: 41792 case LazyComponent: 41793 case SimpleMemoComponent: 41794 case FunctionComponent: 41795 case ForwardRef: 41796 case Fragment: 41797 case Mode: 41798 case Profiler: 41799 case ContextConsumer: 41800 case MemoComponent: 41801 bubbleProperties(workInProgress); 41802 return null; 41803 41804 case ClassComponent: 41805 { 41806 var Component = workInProgress.type; 41807 41808 if (isContextProvider(Component)) { 41809 popContext(workInProgress); 41810 } 41811 41812 bubbleProperties(workInProgress); 41813 return null; 41814 } 41815 41816 case HostRoot: 41817 { 41818 var fiberRoot = workInProgress.stateNode; 41819 popHostContainer(workInProgress); 41820 popTopLevelContextObject(workInProgress); 41821 resetWorkInProgressVersions(); 41822 41823 if (fiberRoot.pendingContext) { 41824 fiberRoot.context = fiberRoot.pendingContext; 41825 fiberRoot.pendingContext = null; 41826 } 41827 41828 if (current === null || current.child === null) { 41829 // If we hydrated, pop so that we can delete any remaining children 41830 // that weren't hydrated. 41831 var wasHydrated = popHydrationState(workInProgress); 41832 41833 if (wasHydrated) { 41834 // If we hydrated, then we'll need to schedule an update for 41835 // the commit side-effects on the root. 41836 markUpdate(workInProgress); 41837 } else { 41838 if (current !== null) { 41839 var prevState = current.memoizedState; 41840 41841 if ( // Check if this is a client root 41842 !prevState.isDehydrated || // Check if we reverted to client rendering (e.g. due to an error) 41843 (workInProgress.flags & ForceClientRender) !== NoFlags) { 41844 // Schedule an effect to clear this container at the start of the 41845 // next commit. This handles the case of React rendering into a 41846 // container with previous children. It's also safe to do for 41847 // updates too, because current.child would only be null if the 41848 // previous render was null (so the container would already 41849 // be empty). 41850 workInProgress.flags |= Snapshot; // If this was a forced client render, there may have been 41851 // recoverable errors during first hydration attempt. If so, add 41852 // them to a queue so we can log them in the commit phase. 41853 41854 upgradeHydrationErrorsToRecoverable(); 41855 } 41856 } 41857 } 41858 } 41859 41860 updateHostContainer(current, workInProgress); 41861 bubbleProperties(workInProgress); 41862 41863 return null; 41864 } 41865 41866 case HostComponent: 41867 { 41868 popHostContext(workInProgress); 41869 var rootContainerInstance = getRootHostContainer(); 41870 var type = workInProgress.type; 41871 41872 if (current !== null && workInProgress.stateNode != null) { 41873 updateHostComponent$1(current, workInProgress, type, newProps, rootContainerInstance); 41874 41875 if (current.ref !== workInProgress.ref) { 41876 markRef$1(workInProgress); 41877 } 41878 } else { 41879 if (!newProps) { 41880 if (workInProgress.stateNode === null) { 41881 throw new Error('We must have new props for new mounts. This error is likely ' + 'caused by a bug in React. Please file an issue.'); 41882 } // This can happen when we abort work. 41883 41884 41885 bubbleProperties(workInProgress); 41886 return null; 41887 } 41888 41889 var currentHostContext = getHostContext(); // TODO: Move createInstance to beginWork and keep it on a context 41890 // "stack" as the parent. Then append children as we go in beginWork 41891 // or completeWork depending on whether we want to add them top->down or 41892 // bottom->up. Top->down is faster in IE11. 41893 41894 var _wasHydrated = popHydrationState(workInProgress); 41895 41896 if (_wasHydrated) { 41897 // TODO: Move this and createInstance step into the beginPhase 41898 // to consolidate. 41899 if (prepareToHydrateHostInstance(workInProgress, rootContainerInstance, currentHostContext)) { 41900 // If changes to the hydrated node need to be applied at the 41901 // commit-phase we mark this as such. 41902 markUpdate(workInProgress); 41903 } 41904 } else { 41905 var instance = createInstance(type, newProps, rootContainerInstance, currentHostContext, workInProgress); 41906 appendAllChildren(instance, workInProgress, false, false); 41907 workInProgress.stateNode = instance; // Certain renderers require commit-time effects for initial mount. 41908 // (eg DOM renderer supports auto-focus for certain elements). 41909 // Make sure such renderers get scheduled for later work. 41910 41911 if (finalizeInitialChildren(instance, type, newProps, rootContainerInstance)) { 41912 markUpdate(workInProgress); 41913 } 41914 } 41915 41916 if (workInProgress.ref !== null) { 41917 // If there is a ref on a host node we need to schedule a callback 41918 markRef$1(workInProgress); 41919 } 41920 } 41921 41922 bubbleProperties(workInProgress); 41923 return null; 41924 } 41925 41926 case HostText: 41927 { 41928 var newText = newProps; 41929 41930 if (current && workInProgress.stateNode != null) { 41931 var oldText = current.memoizedProps; // If we have an alternate, that means this is an update and we need 41932 // to schedule a side-effect to do the updates. 41933 41934 updateHostText$1(current, workInProgress, oldText, newText); 41935 } else { 41936 if (typeof newText !== 'string') { 41937 if (workInProgress.stateNode === null) { 41938 throw new Error('We must have new props for new mounts. This error is likely ' + 'caused by a bug in React. Please file an issue.'); 41939 } // This can happen when we abort work. 41940 41941 } 41942 41943 var _rootContainerInstance = getRootHostContainer(); 41944 41945 var _currentHostContext = getHostContext(); 41946 41947 var _wasHydrated2 = popHydrationState(workInProgress); 41948 41949 if (_wasHydrated2) { 41950 if (prepareToHydrateHostTextInstance(workInProgress)) { 41951 markUpdate(workInProgress); 41952 } 41953 } else { 41954 workInProgress.stateNode = createTextInstance(newText, _rootContainerInstance, _currentHostContext, workInProgress); 41955 } 41956 } 41957 41958 bubbleProperties(workInProgress); 41959 return null; 41960 } 41961 41962 case SuspenseComponent: 41963 { 41964 popSuspenseContext(workInProgress); 41965 var nextState = workInProgress.memoizedState; // Special path for dehydrated boundaries. We may eventually move this 41966 // to its own fiber type so that we can add other kinds of hydration 41967 // boundaries that aren't associated with a Suspense tree. In anticipation 41968 // of such a refactor, all the hydration logic is contained in 41969 // this branch. 41970 41971 if (current === null || current.memoizedState !== null && current.memoizedState.dehydrated !== null) { 41972 var fallthroughToNormalSuspensePath = completeDehydratedSuspenseBoundary(current, workInProgress, nextState); 41973 41974 if (!fallthroughToNormalSuspensePath) { 41975 if (workInProgress.flags & ShouldCapture) { 41976 // Special case. There were remaining unhydrated nodes. We treat 41977 // this as a mismatch. Revert to client rendering. 41978 return workInProgress; 41979 } else { 41980 // Did not finish hydrating, either because this is the initial 41981 // render or because something suspended. 41982 return null; 41983 } 41984 } // Continue with the normal Suspense path. 41985 41986 } 41987 41988 if ((workInProgress.flags & DidCapture) !== NoFlags) { 41989 // Something suspended. Re-render with the fallback children. 41990 workInProgress.lanes = renderLanes; // Do not reset the effect list. 41991 41992 if ( (workInProgress.mode & ProfileMode) !== NoMode) { 41993 transferActualDuration(workInProgress); 41994 } // Don't bubble properties in this case. 41995 41996 41997 return workInProgress; 41998 } 41999 42000 var nextDidTimeout = nextState !== null; 42001 var prevDidTimeout = current !== null && current.memoizedState !== null; 42002 // a passive effect, which is when we process the transitions 42003 42004 42005 if (nextDidTimeout !== prevDidTimeout) { 42006 // an effect to toggle the subtree's visibility. When we switch from 42007 // fallback -> primary, the inner Offscreen fiber schedules this effect 42008 // as part of its normal complete phase. But when we switch from 42009 // primary -> fallback, the inner Offscreen fiber does not have a complete 42010 // phase. So we need to schedule its effect here. 42011 // 42012 // We also use this flag to connect/disconnect the effects, but the same 42013 // logic applies: when re-connecting, the Offscreen fiber's complete 42014 // phase will handle scheduling the effect. It's only when the fallback 42015 // is active that we have to do anything special. 42016 42017 42018 if (nextDidTimeout) { 42019 var _offscreenFiber2 = workInProgress.child; 42020 _offscreenFiber2.flags |= Visibility; // TODO: This will still suspend a synchronous tree if anything 42021 // in the concurrent tree already suspended during this render. 42022 // This is a known bug. 42023 42024 if ((workInProgress.mode & ConcurrentMode) !== NoMode) { 42025 // TODO: Move this back to throwException because this is too late 42026 // if this is a large tree which is common for initial loads. We 42027 // don't know if we should restart a render or not until we get 42028 // this marker, and this is too late. 42029 // If this render already had a ping or lower pri updates, 42030 // and this is the first time we know we're going to suspend we 42031 // should be able to immediately restart from within throwException. 42032 var hasInvisibleChildContext = current === null && (workInProgress.memoizedProps.unstable_avoidThisFallback !== true || !enableSuspenseAvoidThisFallback); 42033 42034 if (hasInvisibleChildContext || hasSuspenseContext(suspenseStackCursor.current, InvisibleParentSuspenseContext)) { 42035 // If this was in an invisible tree or a new render, then showing 42036 // this boundary is ok. 42037 renderDidSuspend(); 42038 } else { 42039 // Otherwise, we're going to have to hide content so we should 42040 // suspend for longer if possible. 42041 renderDidSuspendDelayIfPossible(); 42042 } 42043 } 42044 } 42045 } 42046 42047 var wakeables = workInProgress.updateQueue; 42048 42049 if (wakeables !== null) { 42050 // Schedule an effect to attach a retry listener to the promise. 42051 // TODO: Move to passive phase 42052 workInProgress.flags |= Update; 42053 } 42054 42055 bubbleProperties(workInProgress); 42056 42057 { 42058 if ((workInProgress.mode & ProfileMode) !== NoMode) { 42059 if (nextDidTimeout) { 42060 // Don't count time spent in a timed out Suspense subtree as part of the base duration. 42061 var primaryChildFragment = workInProgress.child; 42062 42063 if (primaryChildFragment !== null) { 42064 // $FlowFixMe Flow doesn't support type casting in combination with the -= operator 42065 workInProgress.treeBaseDuration -= primaryChildFragment.treeBaseDuration; 42066 } 42067 } 42068 } 42069 } 42070 42071 return null; 42072 } 42073 42074 case HostPortal: 42075 popHostContainer(workInProgress); 42076 updateHostContainer(current, workInProgress); 42077 42078 if (current === null) { 42079 preparePortalMount(workInProgress.stateNode.containerInfo); 42080 } 42081 42082 bubbleProperties(workInProgress); 42083 return null; 42084 42085 case ContextProvider: 42086 // Pop provider fiber 42087 var context = workInProgress.type._context; 42088 popProvider(context, workInProgress); 42089 bubbleProperties(workInProgress); 42090 return null; 42091 42092 case IncompleteClassComponent: 42093 { 42094 // Same as class component case. I put it down here so that the tags are 42095 // sequential to ensure this switch is compiled to a jump table. 42096 var _Component = workInProgress.type; 42097 42098 if (isContextProvider(_Component)) { 42099 popContext(workInProgress); 42100 } 42101 42102 bubbleProperties(workInProgress); 42103 return null; 42104 } 42105 42106 case SuspenseListComponent: 42107 { 42108 popSuspenseContext(workInProgress); 42109 var renderState = workInProgress.memoizedState; 42110 42111 if (renderState === null) { 42112 // We're running in the default, "independent" mode. 42113 // We don't do anything in this mode. 42114 bubbleProperties(workInProgress); 42115 return null; 42116 } 42117 42118 var didSuspendAlready = (workInProgress.flags & DidCapture) !== NoFlags; 42119 var renderedTail = renderState.rendering; 42120 42121 if (renderedTail === null) { 42122 // We just rendered the head. 42123 if (!didSuspendAlready) { 42124 // This is the first pass. We need to figure out if anything is still 42125 // suspended in the rendered set. 42126 // If new content unsuspended, but there's still some content that 42127 // didn't. Then we need to do a second pass that forces everything 42128 // to keep showing their fallbacks. 42129 // We might be suspended if something in this render pass suspended, or 42130 // something in the previous committed pass suspended. Otherwise, 42131 // there's no chance so we can skip the expensive call to 42132 // findFirstSuspended. 42133 var cannotBeSuspended = renderHasNotSuspendedYet() && (current === null || (current.flags & DidCapture) === NoFlags); 42134 42135 if (!cannotBeSuspended) { 42136 var row = workInProgress.child; 42137 42138 while (row !== null) { 42139 var suspended = findFirstSuspended(row); 42140 42141 if (suspended !== null) { 42142 didSuspendAlready = true; 42143 workInProgress.flags |= DidCapture; 42144 cutOffTailIfNeeded(renderState, false); // If this is a newly suspended tree, it might not get committed as 42145 // part of the second pass. In that case nothing will subscribe to 42146 // its thenables. Instead, we'll transfer its thenables to the 42147 // SuspenseList so that it can retry if they resolve. 42148 // There might be multiple of these in the list but since we're 42149 // going to wait for all of them anyway, it doesn't really matter 42150 // which ones gets to ping. In theory we could get clever and keep 42151 // track of how many dependencies remain but it gets tricky because 42152 // in the meantime, we can add/remove/change items and dependencies. 42153 // We might bail out of the loop before finding any but that 42154 // doesn't matter since that means that the other boundaries that 42155 // we did find already has their listeners attached. 42156 42157 var newThenables = suspended.updateQueue; 42158 42159 if (newThenables !== null) { 42160 workInProgress.updateQueue = newThenables; 42161 workInProgress.flags |= Update; 42162 } // Rerender the whole list, but this time, we'll force fallbacks 42163 // to stay in place. 42164 // Reset the effect flags before doing the second pass since that's now invalid. 42165 // Reset the child fibers to their original state. 42166 42167 42168 workInProgress.subtreeFlags = NoFlags; 42169 resetChildFibers(workInProgress, renderLanes); // Set up the Suspense Context to force suspense and immediately 42170 // rerender the children. 42171 42172 pushSuspenseContext(workInProgress, setShallowSuspenseContext(suspenseStackCursor.current, ForceSuspenseFallback)); // Don't bubble properties in this case. 42173 42174 return workInProgress.child; 42175 } 42176 42177 row = row.sibling; 42178 } 42179 } 42180 42181 if (renderState.tail !== null && now() > getRenderTargetTime()) { 42182 // We have already passed our CPU deadline but we still have rows 42183 // left in the tail. We'll just give up further attempts to render 42184 // the main content and only render fallbacks. 42185 workInProgress.flags |= DidCapture; 42186 didSuspendAlready = true; 42187 cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this 42188 // to get it started back up to attempt the next item. While in terms 42189 // of priority this work has the same priority as this current render, 42190 // it's not part of the same transition once the transition has 42191 // committed. If it's sync, we still want to yield so that it can be 42192 // painted. Conceptually, this is really the same as pinging. 42193 // We can use any RetryLane even if it's the one currently rendering 42194 // since we're leaving it behind on this node. 42195 42196 workInProgress.lanes = SomeRetryLane; 42197 } 42198 } else { 42199 cutOffTailIfNeeded(renderState, false); 42200 } // Next we're going to render the tail. 42201 42202 } else { 42203 // Append the rendered row to the child list. 42204 if (!didSuspendAlready) { 42205 var _suspended = findFirstSuspended(renderedTail); 42206 42207 if (_suspended !== null) { 42208 workInProgress.flags |= DidCapture; 42209 didSuspendAlready = true; // Ensure we transfer the update queue to the parent so that it doesn't 42210 // get lost if this row ends up dropped during a second pass. 42211 42212 var _newThenables = _suspended.updateQueue; 42213 42214 if (_newThenables !== null) { 42215 workInProgress.updateQueue = _newThenables; 42216 workInProgress.flags |= Update; 42217 } 42218 42219 cutOffTailIfNeeded(renderState, true); // This might have been modified. 42220 42221 if (renderState.tail === null && renderState.tailMode === 'hidden' && !renderedTail.alternate && !getIsHydrating() // We don't cut it if we're hydrating. 42222 ) { 42223 // We're done. 42224 bubbleProperties(workInProgress); 42225 return null; 42226 } 42227 } else if ( // The time it took to render last row is greater than the remaining 42228 // time we have to render. So rendering one more row would likely 42229 // exceed it. 42230 now() * 2 - renderState.renderingStartTime > getRenderTargetTime() && renderLanes !== OffscreenLane) { 42231 // We have now passed our CPU deadline and we'll just give up further 42232 // attempts to render the main content and only render fallbacks. 42233 // The assumption is that this is usually faster. 42234 workInProgress.flags |= DidCapture; 42235 didSuspendAlready = true; 42236 cutOffTailIfNeeded(renderState, false); // Since nothing actually suspended, there will nothing to ping this 42237 // to get it started back up to attempt the next item. While in terms 42238 // of priority this work has the same priority as this current render, 42239 // it's not part of the same transition once the transition has 42240 // committed. If it's sync, we still want to yield so that it can be 42241 // painted. Conceptually, this is really the same as pinging. 42242 // We can use any RetryLane even if it's the one currently rendering 42243 // since we're leaving it behind on this node. 42244 42245 workInProgress.lanes = SomeRetryLane; 42246 } 42247 } 42248 42249 if (renderState.isBackwards) { 42250 // The effect list of the backwards tail will have been added 42251 // to the end. This breaks the guarantee that life-cycles fire in 42252 // sibling order but that isn't a strong guarantee promised by React. 42253 // Especially since these might also just pop in during future commits. 42254 // Append to the beginning of the list. 42255 renderedTail.sibling = workInProgress.child; 42256 workInProgress.child = renderedTail; 42257 } else { 42258 var previousSibling = renderState.last; 42259 42260 if (previousSibling !== null) { 42261 previousSibling.sibling = renderedTail; 42262 } else { 42263 workInProgress.child = renderedTail; 42264 } 42265 42266 renderState.last = renderedTail; 42267 } 42268 } 42269 42270 if (renderState.tail !== null) { 42271 // We still have tail rows to render. 42272 // Pop a row. 42273 var next = renderState.tail; 42274 renderState.rendering = next; 42275 renderState.tail = next.sibling; 42276 renderState.renderingStartTime = now(); 42277 next.sibling = null; // Restore the context. 42278 // TODO: We can probably just avoid popping it instead and only 42279 // setting it the first time we go from not suspended to suspended. 42280 42281 var suspenseContext = suspenseStackCursor.current; 42282 42283 if (didSuspendAlready) { 42284 suspenseContext = setShallowSuspenseContext(suspenseContext, ForceSuspenseFallback); 42285 } else { 42286 suspenseContext = setDefaultShallowSuspenseContext(suspenseContext); 42287 } 42288 42289 pushSuspenseContext(workInProgress, suspenseContext); // Do a pass over the next row. 42290 // Don't bubble properties in this case. 42291 42292 return next; 42293 } 42294 42295 bubbleProperties(workInProgress); 42296 return null; 42297 } 42298 42299 case ScopeComponent: 42300 { 42301 42302 break; 42303 } 42304 42305 case OffscreenComponent: 42306 case LegacyHiddenComponent: 42307 { 42308 popRenderLanes(workInProgress); 42309 var _nextState = workInProgress.memoizedState; 42310 var nextIsHidden = _nextState !== null; 42311 42312 if (current !== null) { 42313 var _prevState = current.memoizedState; 42314 var prevIsHidden = _prevState !== null; 42315 42316 if (prevIsHidden !== nextIsHidden && ( // LegacyHidden doesn't do any hiding â it only pre-renders. 42317 !enableLegacyHidden )) { 42318 workInProgress.flags |= Visibility; 42319 } 42320 } 42321 42322 if (!nextIsHidden || (workInProgress.mode & ConcurrentMode) === NoMode) { 42323 bubbleProperties(workInProgress); 42324 } else { 42325 // Don't bubble properties for hidden children unless we're rendering 42326 // at offscreen priority. 42327 if (includesSomeLane(subtreeRenderLanes, OffscreenLane)) { 42328 bubbleProperties(workInProgress); 42329 42330 { 42331 // Check if there was an insertion or update in the hidden subtree. 42332 // If so, we need to hide those nodes in the commit phase, so 42333 // schedule a visibility effect. 42334 if ( workInProgress.subtreeFlags & (Placement | Update)) { 42335 workInProgress.flags |= Visibility; 42336 } 42337 } 42338 } 42339 } 42340 return null; 42341 } 42342 42343 case CacheComponent: 42344 { 42345 42346 return null; 42347 } 42348 42349 case TracingMarkerComponent: 42350 { 42351 42352 return null; 42353 } 42354 } 42355 42356 throw new Error("Unknown unit of work tag (" + workInProgress.tag + "). This error is likely caused by a bug in " + 'React. Please file an issue.'); 42357} 42358 42359function unwindWork(current, workInProgress, renderLanes) { 42360 // Note: This intentionally doesn't check if we're hydrating because comparing 42361 // to the current tree provider fiber is just as fast and less error-prone. 42362 // Ideally we would have a special version of the work loop only 42363 // for hydration. 42364 popTreeContext(workInProgress); 42365 42366 switch (workInProgress.tag) { 42367 case ClassComponent: 42368 { 42369 var Component = workInProgress.type; 42370 42371 if (isContextProvider(Component)) { 42372 popContext(workInProgress); 42373 } 42374 42375 var flags = workInProgress.flags; 42376 42377 if (flags & ShouldCapture) { 42378 workInProgress.flags = flags & ~ShouldCapture | DidCapture; 42379 42380 if ( (workInProgress.mode & ProfileMode) !== NoMode) { 42381 transferActualDuration(workInProgress); 42382 } 42383 42384 return workInProgress; 42385 } 42386 42387 return null; 42388 } 42389 42390 case HostRoot: 42391 { 42392 var root = workInProgress.stateNode; 42393 popHostContainer(workInProgress); 42394 popTopLevelContextObject(workInProgress); 42395 resetWorkInProgressVersions(); 42396 var _flags = workInProgress.flags; 42397 42398 if ((_flags & ShouldCapture) !== NoFlags && (_flags & DidCapture) === NoFlags) { 42399 // There was an error during render that wasn't captured by a suspense 42400 // boundary. Do a second pass on the root to unmount the children. 42401 workInProgress.flags = _flags & ~ShouldCapture | DidCapture; 42402 return workInProgress; 42403 } // We unwound to the root without completing it. Exit. 42404 42405 42406 return null; 42407 } 42408 42409 case HostComponent: 42410 { 42411 // TODO: popHydrationState 42412 popHostContext(workInProgress); 42413 return null; 42414 } 42415 42416 case SuspenseComponent: 42417 { 42418 popSuspenseContext(workInProgress); 42419 var suspenseState = workInProgress.memoizedState; 42420 42421 if (suspenseState !== null && suspenseState.dehydrated !== null) { 42422 if (workInProgress.alternate === null) { 42423 throw new Error('Threw in newly mounted dehydrated component. This is likely a bug in ' + 'React. Please file an issue.'); 42424 } 42425 42426 resetHydrationState(); 42427 } 42428 42429 var _flags2 = workInProgress.flags; 42430 42431 if (_flags2 & ShouldCapture) { 42432 workInProgress.flags = _flags2 & ~ShouldCapture | DidCapture; // Captured a suspense effect. Re-render the boundary. 42433 42434 if ( (workInProgress.mode & ProfileMode) !== NoMode) { 42435 transferActualDuration(workInProgress); 42436 } 42437 42438 return workInProgress; 42439 } 42440 42441 return null; 42442 } 42443 42444 case SuspenseListComponent: 42445 { 42446 popSuspenseContext(workInProgress); // SuspenseList doesn't actually catch anything. It should've been 42447 // caught by a nested boundary. If not, it should bubble through. 42448 42449 return null; 42450 } 42451 42452 case HostPortal: 42453 popHostContainer(workInProgress); 42454 return null; 42455 42456 case ContextProvider: 42457 var context = workInProgress.type._context; 42458 popProvider(context, workInProgress); 42459 return null; 42460 42461 case OffscreenComponent: 42462 case LegacyHiddenComponent: 42463 popRenderLanes(workInProgress); 42464 return null; 42465 42466 case CacheComponent: 42467 42468 return null; 42469 42470 default: 42471 return null; 42472 } 42473} 42474 42475function unwindInterruptedWork(current, interruptedWork, renderLanes) { 42476 // Note: This intentionally doesn't check if we're hydrating because comparing 42477 // to the current tree provider fiber is just as fast and less error-prone. 42478 // Ideally we would have a special version of the work loop only 42479 // for hydration. 42480 popTreeContext(interruptedWork); 42481 42482 switch (interruptedWork.tag) { 42483 case ClassComponent: 42484 { 42485 var childContextTypes = interruptedWork.type.childContextTypes; 42486 42487 if (childContextTypes !== null && childContextTypes !== undefined) { 42488 popContext(interruptedWork); 42489 } 42490 42491 break; 42492 } 42493 42494 case HostRoot: 42495 { 42496 var root = interruptedWork.stateNode; 42497 popHostContainer(interruptedWork); 42498 popTopLevelContextObject(interruptedWork); 42499 resetWorkInProgressVersions(); 42500 break; 42501 } 42502 42503 case HostComponent: 42504 { 42505 popHostContext(interruptedWork); 42506 break; 42507 } 42508 42509 case HostPortal: 42510 popHostContainer(interruptedWork); 42511 break; 42512 42513 case SuspenseComponent: 42514 popSuspenseContext(interruptedWork); 42515 break; 42516 42517 case SuspenseListComponent: 42518 popSuspenseContext(interruptedWork); 42519 break; 42520 42521 case ContextProvider: 42522 var context = interruptedWork.type._context; 42523 popProvider(context, interruptedWork); 42524 break; 42525 42526 case OffscreenComponent: 42527 case LegacyHiddenComponent: 42528 popRenderLanes(interruptedWork); 42529 break; 42530 } 42531} 42532 42533var didWarnAboutUndefinedSnapshotBeforeUpdate = null; 42534 42535{ 42536 didWarnAboutUndefinedSnapshotBeforeUpdate = new Set(); 42537} // Used during the commit phase to track the state of the Offscreen component stack. 42538// Allows us to avoid traversing the return path to find the nearest Offscreen ancestor. 42539// Only used when enableSuspenseLayoutEffectSemantics is enabled. 42540 42541 42542var offscreenSubtreeIsHidden = false; 42543var offscreenSubtreeWasHidden = false; 42544var PossiblyWeakSet = typeof WeakSet === 'function' ? WeakSet : Set; 42545var nextEffect = null; // Used for Profiling builds to track updaters. 42546 42547var inProgressLanes = null; 42548var inProgressRoot = null; 42549function reportUncaughtErrorInDEV(error) { 42550 // Wrapping each small part of the commit phase into a guarded 42551 // callback is a bit too slow (https://github.com/facebook/react/pull/21666). 42552 // But we rely on it to surface errors to DEV tools like overlays 42553 // (https://github.com/facebook/react/issues/21712). 42554 // As a compromise, rethrow only caught errors in a guard. 42555 { 42556 invokeGuardedCallback(null, function () { 42557 throw error; 42558 }); 42559 clearCaughtError(); 42560 } 42561} 42562 42563var callComponentWillUnmountWithTimer = function (current, instance) { 42564 instance.props = current.memoizedProps; 42565 instance.state = current.memoizedState; 42566 42567 if ( current.mode & ProfileMode) { 42568 try { 42569 startLayoutEffectTimer(); 42570 instance.componentWillUnmount(); 42571 } finally { 42572 recordLayoutEffectDuration(current); 42573 } 42574 } else { 42575 instance.componentWillUnmount(); 42576 } 42577}; // Capture errors so they don't interrupt mounting. 42578 42579 42580function safelyCallCommitHookLayoutEffectListMount(current, nearestMountedAncestor) { 42581 try { 42582 commitHookEffectListMount(Layout, current); 42583 } catch (error) { 42584 captureCommitPhaseError(current, nearestMountedAncestor, error); 42585 } 42586} // Capture errors so they don't interrupt unmounting. 42587 42588 42589function safelyCallComponentWillUnmount(current, nearestMountedAncestor, instance) { 42590 try { 42591 callComponentWillUnmountWithTimer(current, instance); 42592 } catch (error) { 42593 captureCommitPhaseError(current, nearestMountedAncestor, error); 42594 } 42595} // Capture errors so they don't interrupt mounting. 42596 42597 42598function safelyCallComponentDidMount(current, nearestMountedAncestor, instance) { 42599 try { 42600 instance.componentDidMount(); 42601 } catch (error) { 42602 captureCommitPhaseError(current, nearestMountedAncestor, error); 42603 } 42604} // Capture errors so they don't interrupt mounting. 42605 42606 42607function safelyAttachRef(current, nearestMountedAncestor) { 42608 try { 42609 commitAttachRef(current); 42610 } catch (error) { 42611 captureCommitPhaseError(current, nearestMountedAncestor, error); 42612 } 42613} 42614 42615function safelyDetachRef(current, nearestMountedAncestor) { 42616 var ref = current.ref; 42617 42618 if (ref !== null) { 42619 if (typeof ref === 'function') { 42620 var retVal; 42621 42622 try { 42623 if (enableProfilerTimer && enableProfilerCommitHooks && current.mode & ProfileMode) { 42624 try { 42625 startLayoutEffectTimer(); 42626 retVal = ref(null); 42627 } finally { 42628 recordLayoutEffectDuration(current); 42629 } 42630 } else { 42631 retVal = ref(null); 42632 } 42633 } catch (error) { 42634 captureCommitPhaseError(current, nearestMountedAncestor, error); 42635 } 42636 42637 { 42638 if (typeof retVal === 'function') { 42639 error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(current)); 42640 } 42641 } 42642 } else { 42643 ref.current = null; 42644 } 42645 } 42646} 42647 42648function safelyCallDestroy(current, nearestMountedAncestor, destroy) { 42649 try { 42650 destroy(); 42651 } catch (error) { 42652 captureCommitPhaseError(current, nearestMountedAncestor, error); 42653 } 42654} 42655 42656var focusedInstanceHandle = null; 42657var shouldFireAfterActiveInstanceBlur = false; 42658function commitBeforeMutationEffects(root, firstChild) { 42659 focusedInstanceHandle = prepareForCommit(root.containerInfo); 42660 nextEffect = firstChild; 42661 commitBeforeMutationEffects_begin(); // We no longer need to track the active instance fiber 42662 42663 var shouldFire = shouldFireAfterActiveInstanceBlur; 42664 shouldFireAfterActiveInstanceBlur = false; 42665 focusedInstanceHandle = null; 42666 return shouldFire; 42667} 42668 42669function commitBeforeMutationEffects_begin() { 42670 while (nextEffect !== null) { 42671 var fiber = nextEffect; // This phase is only used for beforeActiveInstanceBlur. 42672 42673 var child = fiber.child; 42674 42675 if ((fiber.subtreeFlags & BeforeMutationMask) !== NoFlags && child !== null) { 42676 child.return = fiber; 42677 nextEffect = child; 42678 } else { 42679 commitBeforeMutationEffects_complete(); 42680 } 42681 } 42682} 42683 42684function commitBeforeMutationEffects_complete() { 42685 while (nextEffect !== null) { 42686 var fiber = nextEffect; 42687 setCurrentFiber(fiber); 42688 42689 try { 42690 commitBeforeMutationEffectsOnFiber(fiber); 42691 } catch (error) { 42692 captureCommitPhaseError(fiber, fiber.return, error); 42693 } 42694 42695 resetCurrentFiber(); 42696 var sibling = fiber.sibling; 42697 42698 if (sibling !== null) { 42699 sibling.return = fiber.return; 42700 nextEffect = sibling; 42701 return; 42702 } 42703 42704 nextEffect = fiber.return; 42705 } 42706} 42707 42708function commitBeforeMutationEffectsOnFiber(finishedWork) { 42709 var current = finishedWork.alternate; 42710 var flags = finishedWork.flags; 42711 42712 if ((flags & Snapshot) !== NoFlags) { 42713 setCurrentFiber(finishedWork); 42714 42715 switch (finishedWork.tag) { 42716 case FunctionComponent: 42717 case ForwardRef: 42718 case SimpleMemoComponent: 42719 { 42720 break; 42721 } 42722 42723 case ClassComponent: 42724 { 42725 if (current !== null) { 42726 var prevProps = current.memoizedProps; 42727 var prevState = current.memoizedState; 42728 var instance = finishedWork.stateNode; // We could update instance props and state here, 42729 // but instead we rely on them being set during last render. 42730 // TODO: revisit this when we implement resuming. 42731 42732 { 42733 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { 42734 if (instance.props !== finishedWork.memoizedProps) { 42735 error('Expected %s props to match memoized props before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); 42736 } 42737 42738 if (instance.state !== finishedWork.memoizedState) { 42739 error('Expected %s state to match memoized state before ' + 'getSnapshotBeforeUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); 42740 } 42741 } 42742 } 42743 42744 var snapshot = instance.getSnapshotBeforeUpdate(finishedWork.elementType === finishedWork.type ? prevProps : resolveDefaultProps(finishedWork.type, prevProps), prevState); 42745 42746 { 42747 var didWarnSet = didWarnAboutUndefinedSnapshotBeforeUpdate; 42748 42749 if (snapshot === undefined && !didWarnSet.has(finishedWork.type)) { 42750 didWarnSet.add(finishedWork.type); 42751 42752 error('%s.getSnapshotBeforeUpdate(): A snapshot value (or null) ' + 'must be returned. You have returned undefined.', getComponentNameFromFiber(finishedWork)); 42753 } 42754 } 42755 42756 instance.__reactInternalSnapshotBeforeUpdate = snapshot; 42757 } 42758 42759 break; 42760 } 42761 42762 case HostRoot: 42763 { 42764 { 42765 var root = finishedWork.stateNode; 42766 clearContainer(root.containerInfo); 42767 } 42768 42769 break; 42770 } 42771 42772 case HostComponent: 42773 case HostText: 42774 case HostPortal: 42775 case IncompleteClassComponent: 42776 // Nothing to do for these component types 42777 break; 42778 42779 default: 42780 { 42781 throw new Error('This unit of work tag should not have side-effects. This error is ' + 'likely caused by a bug in React. Please file an issue.'); 42782 } 42783 } 42784 42785 resetCurrentFiber(); 42786 } 42787} 42788 42789function commitHookEffectListUnmount(flags, finishedWork, nearestMountedAncestor) { 42790 var updateQueue = finishedWork.updateQueue; 42791 var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; 42792 42793 if (lastEffect !== null) { 42794 var firstEffect = lastEffect.next; 42795 var effect = firstEffect; 42796 42797 do { 42798 if ((effect.tag & flags) === flags) { 42799 // Unmount 42800 var destroy = effect.destroy; 42801 effect.destroy = undefined; 42802 42803 if (destroy !== undefined) { 42804 { 42805 if ((flags & Passive$1) !== NoFlags$1) { 42806 markComponentPassiveEffectUnmountStarted(finishedWork); 42807 } else if ((flags & Layout) !== NoFlags$1) { 42808 markComponentLayoutEffectUnmountStarted(finishedWork); 42809 } 42810 } 42811 42812 { 42813 if ((flags & Insertion) !== NoFlags$1) { 42814 setIsRunningInsertionEffect(true); 42815 } 42816 } 42817 42818 safelyCallDestroy(finishedWork, nearestMountedAncestor, destroy); 42819 42820 { 42821 if ((flags & Insertion) !== NoFlags$1) { 42822 setIsRunningInsertionEffect(false); 42823 } 42824 } 42825 42826 { 42827 if ((flags & Passive$1) !== NoFlags$1) { 42828 markComponentPassiveEffectUnmountStopped(); 42829 } else if ((flags & Layout) !== NoFlags$1) { 42830 markComponentLayoutEffectUnmountStopped(); 42831 } 42832 } 42833 } 42834 } 42835 42836 effect = effect.next; 42837 } while (effect !== firstEffect); 42838 } 42839} 42840 42841function commitHookEffectListMount(flags, finishedWork) { 42842 var updateQueue = finishedWork.updateQueue; 42843 var lastEffect = updateQueue !== null ? updateQueue.lastEffect : null; 42844 42845 if (lastEffect !== null) { 42846 var firstEffect = lastEffect.next; 42847 var effect = firstEffect; 42848 42849 do { 42850 if ((effect.tag & flags) === flags) { 42851 { 42852 if ((flags & Passive$1) !== NoFlags$1) { 42853 markComponentPassiveEffectMountStarted(finishedWork); 42854 } else if ((flags & Layout) !== NoFlags$1) { 42855 markComponentLayoutEffectMountStarted(finishedWork); 42856 } 42857 } // Mount 42858 42859 42860 var create = effect.create; 42861 42862 { 42863 if ((flags & Insertion) !== NoFlags$1) { 42864 setIsRunningInsertionEffect(true); 42865 } 42866 } 42867 42868 effect.destroy = create(); 42869 42870 { 42871 if ((flags & Insertion) !== NoFlags$1) { 42872 setIsRunningInsertionEffect(false); 42873 } 42874 } 42875 42876 { 42877 if ((flags & Passive$1) !== NoFlags$1) { 42878 markComponentPassiveEffectMountStopped(); 42879 } else if ((flags & Layout) !== NoFlags$1) { 42880 markComponentLayoutEffectMountStopped(); 42881 } 42882 } 42883 42884 { 42885 var destroy = effect.destroy; 42886 42887 if (destroy !== undefined && typeof destroy !== 'function') { 42888 var hookName = void 0; 42889 42890 if ((effect.tag & Layout) !== NoFlags) { 42891 hookName = 'useLayoutEffect'; 42892 } else if ((effect.tag & Insertion) !== NoFlags) { 42893 hookName = 'useInsertionEffect'; 42894 } else { 42895 hookName = 'useEffect'; 42896 } 42897 42898 var addendum = void 0; 42899 42900 if (destroy === null) { 42901 addendum = ' You returned null. If your effect does not require clean ' + 'up, return undefined (or nothing).'; 42902 } else if (typeof destroy.then === 'function') { 42903 addendum = '\n\nIt looks like you wrote ' + hookName + '(async () => ...) or returned a Promise. ' + 'Instead, write the async function inside your effect ' + 'and call it immediately:\n\n' + hookName + '(() => {\n' + ' async function fetchData() {\n' + ' // You can await here\n' + ' const response = await MyAPI.getData(someId);\n' + ' // ...\n' + ' }\n' + ' fetchData();\n' + "}, [someId]); // Or [] if effect doesn't need props or state\n\n" + 'Learn more about data fetching with Hooks: https://reactjs.org/link/hooks-data-fetching'; 42904 } else { 42905 addendum = ' You returned: ' + destroy; 42906 } 42907 42908 error('%s must not return anything besides a function, ' + 'which is used for clean-up.%s', hookName, addendum); 42909 } 42910 } 42911 } 42912 42913 effect = effect.next; 42914 } while (effect !== firstEffect); 42915 } 42916} 42917 42918function commitPassiveEffectDurations(finishedRoot, finishedWork) { 42919 { 42920 // Only Profilers with work in their subtree will have an Update effect scheduled. 42921 if ((finishedWork.flags & Update) !== NoFlags) { 42922 switch (finishedWork.tag) { 42923 case Profiler: 42924 { 42925 var passiveEffectDuration = finishedWork.stateNode.passiveEffectDuration; 42926 var _finishedWork$memoize = finishedWork.memoizedProps, 42927 id = _finishedWork$memoize.id, 42928 onPostCommit = _finishedWork$memoize.onPostCommit; // This value will still reflect the previous commit phase. 42929 // It does not get reset until the start of the next commit phase. 42930 42931 var commitTime = getCommitTime(); 42932 var phase = finishedWork.alternate === null ? 'mount' : 'update'; 42933 42934 { 42935 if (isCurrentUpdateNested()) { 42936 phase = 'nested-update'; 42937 } 42938 } 42939 42940 if (typeof onPostCommit === 'function') { 42941 onPostCommit(id, phase, passiveEffectDuration, commitTime); 42942 } // Bubble times to the next nearest ancestor Profiler. 42943 // After we process that Profiler, we'll bubble further up. 42944 42945 42946 var parentFiber = finishedWork.return; 42947 42948 outer: while (parentFiber !== null) { 42949 switch (parentFiber.tag) { 42950 case HostRoot: 42951 var root = parentFiber.stateNode; 42952 root.passiveEffectDuration += passiveEffectDuration; 42953 break outer; 42954 42955 case Profiler: 42956 var parentStateNode = parentFiber.stateNode; 42957 parentStateNode.passiveEffectDuration += passiveEffectDuration; 42958 break outer; 42959 } 42960 42961 parentFiber = parentFiber.return; 42962 } 42963 42964 break; 42965 } 42966 } 42967 } 42968 } 42969} 42970 42971function commitLayoutEffectOnFiber(finishedRoot, current, finishedWork, committedLanes) { 42972 if ((finishedWork.flags & LayoutMask) !== NoFlags) { 42973 switch (finishedWork.tag) { 42974 case FunctionComponent: 42975 case ForwardRef: 42976 case SimpleMemoComponent: 42977 { 42978 if ( !offscreenSubtreeWasHidden) { 42979 // At this point layout effects have already been destroyed (during mutation phase). 42980 // This is done to prevent sibling component effects from interfering with each other, 42981 // e.g. a destroy function in one component should never override a ref set 42982 // by a create function in another component during the same commit. 42983 if ( finishedWork.mode & ProfileMode) { 42984 try { 42985 startLayoutEffectTimer(); 42986 commitHookEffectListMount(Layout | HasEffect, finishedWork); 42987 } finally { 42988 recordLayoutEffectDuration(finishedWork); 42989 } 42990 } else { 42991 commitHookEffectListMount(Layout | HasEffect, finishedWork); 42992 } 42993 } 42994 42995 break; 42996 } 42997 42998 case ClassComponent: 42999 { 43000 var instance = finishedWork.stateNode; 43001 43002 if (finishedWork.flags & Update) { 43003 if (!offscreenSubtreeWasHidden) { 43004 if (current === null) { 43005 // We could update instance props and state here, 43006 // but instead we rely on them being set during last render. 43007 // TODO: revisit this when we implement resuming. 43008 { 43009 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { 43010 if (instance.props !== finishedWork.memoizedProps) { 43011 error('Expected %s props to match memoized props before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); 43012 } 43013 43014 if (instance.state !== finishedWork.memoizedState) { 43015 error('Expected %s state to match memoized state before ' + 'componentDidMount. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); 43016 } 43017 } 43018 } 43019 43020 if ( finishedWork.mode & ProfileMode) { 43021 try { 43022 startLayoutEffectTimer(); 43023 instance.componentDidMount(); 43024 } finally { 43025 recordLayoutEffectDuration(finishedWork); 43026 } 43027 } else { 43028 instance.componentDidMount(); 43029 } 43030 } else { 43031 var prevProps = finishedWork.elementType === finishedWork.type ? current.memoizedProps : resolveDefaultProps(finishedWork.type, current.memoizedProps); 43032 var prevState = current.memoizedState; // We could update instance props and state here, 43033 // but instead we rely on them being set during last render. 43034 // TODO: revisit this when we implement resuming. 43035 43036 { 43037 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { 43038 if (instance.props !== finishedWork.memoizedProps) { 43039 error('Expected %s props to match memoized props before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); 43040 } 43041 43042 if (instance.state !== finishedWork.memoizedState) { 43043 error('Expected %s state to match memoized state before ' + 'componentDidUpdate. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); 43044 } 43045 } 43046 } 43047 43048 if ( finishedWork.mode & ProfileMode) { 43049 try { 43050 startLayoutEffectTimer(); 43051 instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); 43052 } finally { 43053 recordLayoutEffectDuration(finishedWork); 43054 } 43055 } else { 43056 instance.componentDidUpdate(prevProps, prevState, instance.__reactInternalSnapshotBeforeUpdate); 43057 } 43058 } 43059 } 43060 } // TODO: I think this is now always non-null by the time it reaches the 43061 // commit phase. Consider removing the type check. 43062 43063 43064 var updateQueue = finishedWork.updateQueue; 43065 43066 if (updateQueue !== null) { 43067 { 43068 if (finishedWork.type === finishedWork.elementType && !didWarnAboutReassigningProps) { 43069 if (instance.props !== finishedWork.memoizedProps) { 43070 error('Expected %s props to match memoized props before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.props`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); 43071 } 43072 43073 if (instance.state !== finishedWork.memoizedState) { 43074 error('Expected %s state to match memoized state before ' + 'processing the update queue. ' + 'This might either be because of a bug in React, or because ' + 'a component reassigns its own `this.state`. ' + 'Please file an issue.', getComponentNameFromFiber(finishedWork) || 'instance'); 43075 } 43076 } 43077 } // We could update instance props and state here, 43078 // but instead we rely on them being set during last render. 43079 // TODO: revisit this when we implement resuming. 43080 43081 43082 commitUpdateQueue(finishedWork, updateQueue, instance); 43083 } 43084 43085 break; 43086 } 43087 43088 case HostRoot: 43089 { 43090 // TODO: I think this is now always non-null by the time it reaches the 43091 // commit phase. Consider removing the type check. 43092 var _updateQueue = finishedWork.updateQueue; 43093 43094 if (_updateQueue !== null) { 43095 var _instance = null; 43096 43097 if (finishedWork.child !== null) { 43098 switch (finishedWork.child.tag) { 43099 case HostComponent: 43100 _instance = getPublicInstance(finishedWork.child.stateNode); 43101 break; 43102 43103 case ClassComponent: 43104 _instance = finishedWork.child.stateNode; 43105 break; 43106 } 43107 } 43108 43109 commitUpdateQueue(finishedWork, _updateQueue, _instance); 43110 } 43111 43112 break; 43113 } 43114 43115 case HostComponent: 43116 { 43117 var _instance2 = finishedWork.stateNode; // Renderers may schedule work to be done after host components are mounted 43118 // (eg DOM renderer may schedule auto-focus for inputs and form controls). 43119 // These effects should only be committed when components are first mounted, 43120 // aka when there is no current/alternate. 43121 43122 if (current === null && finishedWork.flags & Update) { 43123 var type = finishedWork.type; 43124 var props = finishedWork.memoizedProps; 43125 commitMount(_instance2, type, props); 43126 } 43127 43128 break; 43129 } 43130 43131 case HostText: 43132 { 43133 // We have no life-cycles associated with text. 43134 break; 43135 } 43136 43137 case HostPortal: 43138 { 43139 // We have no life-cycles associated with portals. 43140 break; 43141 } 43142 43143 case Profiler: 43144 { 43145 { 43146 var _finishedWork$memoize2 = finishedWork.memoizedProps, 43147 onCommit = _finishedWork$memoize2.onCommit, 43148 onRender = _finishedWork$memoize2.onRender; 43149 var effectDuration = finishedWork.stateNode.effectDuration; 43150 var commitTime = getCommitTime(); 43151 var phase = current === null ? 'mount' : 'update'; 43152 43153 { 43154 if (isCurrentUpdateNested()) { 43155 phase = 'nested-update'; 43156 } 43157 } 43158 43159 if (typeof onRender === 'function') { 43160 onRender(finishedWork.memoizedProps.id, phase, finishedWork.actualDuration, finishedWork.treeBaseDuration, finishedWork.actualStartTime, commitTime); 43161 } 43162 43163 { 43164 if (typeof onCommit === 'function') { 43165 onCommit(finishedWork.memoizedProps.id, phase, effectDuration, commitTime); 43166 } // Schedule a passive effect for this Profiler to call onPostCommit hooks. 43167 // This effect should be scheduled even if there is no onPostCommit callback for this Profiler, 43168 // because the effect is also where times bubble to parent Profilers. 43169 43170 43171 enqueuePendingPassiveProfilerEffect(finishedWork); // Propagate layout effect durations to the next nearest Profiler ancestor. 43172 // Do not reset these values until the next render so DevTools has a chance to read them first. 43173 43174 var parentFiber = finishedWork.return; 43175 43176 outer: while (parentFiber !== null) { 43177 switch (parentFiber.tag) { 43178 case HostRoot: 43179 var root = parentFiber.stateNode; 43180 root.effectDuration += effectDuration; 43181 break outer; 43182 43183 case Profiler: 43184 var parentStateNode = parentFiber.stateNode; 43185 parentStateNode.effectDuration += effectDuration; 43186 break outer; 43187 } 43188 43189 parentFiber = parentFiber.return; 43190 } 43191 } 43192 } 43193 43194 break; 43195 } 43196 43197 case SuspenseComponent: 43198 { 43199 commitSuspenseHydrationCallbacks(finishedRoot, finishedWork); 43200 break; 43201 } 43202 43203 case SuspenseListComponent: 43204 case IncompleteClassComponent: 43205 case ScopeComponent: 43206 case OffscreenComponent: 43207 case LegacyHiddenComponent: 43208 case TracingMarkerComponent: 43209 { 43210 break; 43211 } 43212 43213 default: 43214 throw new Error('This unit of work tag should not have side-effects. This error is ' + 'likely caused by a bug in React. Please file an issue.'); 43215 } 43216 } 43217 43218 if ( !offscreenSubtreeWasHidden) { 43219 { 43220 if (finishedWork.flags & Ref) { 43221 commitAttachRef(finishedWork); 43222 } 43223 } 43224 } 43225} 43226 43227function reappearLayoutEffectsOnFiber(node) { 43228 // Turn on layout effects in a tree that previously disappeared. 43229 // TODO (Offscreen) Check: flags & LayoutStatic 43230 switch (node.tag) { 43231 case FunctionComponent: 43232 case ForwardRef: 43233 case SimpleMemoComponent: 43234 { 43235 if ( node.mode & ProfileMode) { 43236 try { 43237 startLayoutEffectTimer(); 43238 safelyCallCommitHookLayoutEffectListMount(node, node.return); 43239 } finally { 43240 recordLayoutEffectDuration(node); 43241 } 43242 } else { 43243 safelyCallCommitHookLayoutEffectListMount(node, node.return); 43244 } 43245 43246 break; 43247 } 43248 43249 case ClassComponent: 43250 { 43251 var instance = node.stateNode; 43252 43253 if (typeof instance.componentDidMount === 'function') { 43254 safelyCallComponentDidMount(node, node.return, instance); 43255 } 43256 43257 safelyAttachRef(node, node.return); 43258 break; 43259 } 43260 43261 case HostComponent: 43262 { 43263 safelyAttachRef(node, node.return); 43264 break; 43265 } 43266 } 43267} 43268 43269function hideOrUnhideAllChildren(finishedWork, isHidden) { 43270 // Only hide or unhide the top-most host nodes. 43271 var hostSubtreeRoot = null; 43272 43273 { 43274 // We only have the top Fiber that was inserted but we need to recurse down its 43275 // children to find all the terminal nodes. 43276 var node = finishedWork; 43277 43278 while (true) { 43279 if (node.tag === HostComponent) { 43280 if (hostSubtreeRoot === null) { 43281 hostSubtreeRoot = node; 43282 43283 try { 43284 var instance = node.stateNode; 43285 43286 if (isHidden) { 43287 hideInstance(instance); 43288 } else { 43289 unhideInstance(node.stateNode, node.memoizedProps); 43290 } 43291 } catch (error) { 43292 captureCommitPhaseError(finishedWork, finishedWork.return, error); 43293 } 43294 } 43295 } else if (node.tag === HostText) { 43296 if (hostSubtreeRoot === null) { 43297 try { 43298 var _instance3 = node.stateNode; 43299 43300 if (isHidden) { 43301 hideTextInstance(_instance3); 43302 } else { 43303 unhideTextInstance(_instance3, node.memoizedProps); 43304 } 43305 } catch (error) { 43306 captureCommitPhaseError(finishedWork, finishedWork.return, error); 43307 } 43308 } 43309 } else if ((node.tag === OffscreenComponent || node.tag === LegacyHiddenComponent) && node.memoizedState !== null && node !== finishedWork) ; else if (node.child !== null) { 43310 node.child.return = node; 43311 node = node.child; 43312 continue; 43313 } 43314 43315 if (node === finishedWork) { 43316 return; 43317 } 43318 43319 while (node.sibling === null) { 43320 if (node.return === null || node.return === finishedWork) { 43321 return; 43322 } 43323 43324 if (hostSubtreeRoot === node) { 43325 hostSubtreeRoot = null; 43326 } 43327 43328 node = node.return; 43329 } 43330 43331 if (hostSubtreeRoot === node) { 43332 hostSubtreeRoot = null; 43333 } 43334 43335 node.sibling.return = node.return; 43336 node = node.sibling; 43337 } 43338 } 43339} 43340 43341function commitAttachRef(finishedWork) { 43342 var ref = finishedWork.ref; 43343 43344 if (ref !== null) { 43345 var instance = finishedWork.stateNode; 43346 var instanceToUse; 43347 43348 switch (finishedWork.tag) { 43349 case HostComponent: 43350 instanceToUse = getPublicInstance(instance); 43351 break; 43352 43353 default: 43354 instanceToUse = instance; 43355 } // Moved outside to ensure DCE works with this flag 43356 43357 if (typeof ref === 'function') { 43358 var retVal; 43359 43360 if ( finishedWork.mode & ProfileMode) { 43361 try { 43362 startLayoutEffectTimer(); 43363 retVal = ref(instanceToUse); 43364 } finally { 43365 recordLayoutEffectDuration(finishedWork); 43366 } 43367 } else { 43368 retVal = ref(instanceToUse); 43369 } 43370 43371 { 43372 if (typeof retVal === 'function') { 43373 error('Unexpected return value from a callback ref in %s. ' + 'A callback ref should not return a function.', getComponentNameFromFiber(finishedWork)); 43374 } 43375 } 43376 } else { 43377 { 43378 if (!ref.hasOwnProperty('current')) { 43379 error('Unexpected ref object provided for %s. ' + 'Use either a ref-setter function or React.createRef().', getComponentNameFromFiber(finishedWork)); 43380 } 43381 } 43382 43383 ref.current = instanceToUse; 43384 } 43385 } 43386} 43387 43388function detachFiberMutation(fiber) { 43389 // Cut off the return pointer to disconnect it from the tree. 43390 // This enables us to detect and warn against state updates on an unmounted component. 43391 // It also prevents events from bubbling from within disconnected components. 43392 // 43393 // Ideally, we should also clear the child pointer of the parent alternate to let this 43394 // get GC:ed but we don't know which for sure which parent is the current 43395 // one so we'll settle for GC:ing the subtree of this child. 43396 // This child itself will be GC:ed when the parent updates the next time. 43397 // 43398 // Note that we can't clear child or sibling pointers yet. 43399 // They're needed for passive effects and for findDOMNode. 43400 // We defer those fields, and all other cleanup, to the passive phase (see detachFiberAfterEffects). 43401 // 43402 // Don't reset the alternate yet, either. We need that so we can detach the 43403 // alternate's fields in the passive phase. Clearing the return pointer is 43404 // sufficient for findDOMNode semantics. 43405 var alternate = fiber.alternate; 43406 43407 if (alternate !== null) { 43408 alternate.return = null; 43409 } 43410 43411 fiber.return = null; 43412} 43413 43414function detachFiberAfterEffects(fiber) { 43415 var alternate = fiber.alternate; 43416 43417 if (alternate !== null) { 43418 fiber.alternate = null; 43419 detachFiberAfterEffects(alternate); 43420 } // Note: Defensively using negation instead of < in case 43421 // `deletedTreeCleanUpLevel` is undefined. 43422 43423 43424 { 43425 // Clear cyclical Fiber fields. This level alone is designed to roughly 43426 // approximate the planned Fiber refactor. In that world, `setState` will be 43427 // bound to a special "instance" object instead of a Fiber. The Instance 43428 // object will not have any of these fields. It will only be connected to 43429 // the fiber tree via a single link at the root. So if this level alone is 43430 // sufficient to fix memory issues, that bodes well for our plans. 43431 fiber.child = null; 43432 fiber.deletions = null; 43433 fiber.sibling = null; // The `stateNode` is cyclical because on host nodes it points to the host 43434 // tree, which has its own pointers to children, parents, and siblings. 43435 // The other host nodes also point back to fibers, so we should detach that 43436 // one, too. 43437 43438 if (fiber.tag === HostComponent) { 43439 var hostInstance = fiber.stateNode; 43440 43441 if (hostInstance !== null) { 43442 detachDeletedInstance(hostInstance); 43443 } 43444 } 43445 43446 fiber.stateNode = null; // I'm intentionally not clearing the `return` field in this level. We 43447 // already disconnect the `return` pointer at the root of the deleted 43448 // subtree (in `detachFiberMutation`). Besides, `return` by itself is not 43449 // cyclical â it's only cyclical when combined with `child`, `sibling`, and 43450 // `alternate`. But we'll clear it in the next level anyway, just in case. 43451 43452 { 43453 fiber._debugOwner = null; 43454 } 43455 43456 { 43457 // Theoretically, nothing in here should be necessary, because we already 43458 // disconnected the fiber from the tree. So even if something leaks this 43459 // particular fiber, it won't leak anything else 43460 // 43461 // The purpose of this branch is to be super aggressive so we can measure 43462 // if there's any difference in memory impact. If there is, that could 43463 // indicate a React leak we don't know about. 43464 fiber.return = null; 43465 fiber.dependencies = null; 43466 fiber.memoizedProps = null; 43467 fiber.memoizedState = null; 43468 fiber.pendingProps = null; 43469 fiber.stateNode = null; // TODO: Move to `commitPassiveUnmountInsideDeletedTreeOnFiber` instead. 43470 43471 fiber.updateQueue = null; 43472 } 43473 } 43474} 43475 43476function getHostParentFiber(fiber) { 43477 var parent = fiber.return; 43478 43479 while (parent !== null) { 43480 if (isHostParent(parent)) { 43481 return parent; 43482 } 43483 43484 parent = parent.return; 43485 } 43486 43487 throw new Error('Expected to find a host parent. This error is likely caused by a bug ' + 'in React. Please file an issue.'); 43488} 43489 43490function isHostParent(fiber) { 43491 return fiber.tag === HostComponent || fiber.tag === HostRoot || fiber.tag === HostPortal; 43492} 43493 43494function getHostSibling(fiber) { 43495 // We're going to search forward into the tree until we find a sibling host 43496 // node. Unfortunately, if multiple insertions are done in a row we have to 43497 // search past them. This leads to exponential search for the next sibling. 43498 // TODO: Find a more efficient way to do this. 43499 var node = fiber; 43500 43501 siblings: while (true) { 43502 // If we didn't find anything, let's try the next sibling. 43503 while (node.sibling === null) { 43504 if (node.return === null || isHostParent(node.return)) { 43505 // If we pop out of the root or hit the parent the fiber we are the 43506 // last sibling. 43507 return null; 43508 } 43509 43510 node = node.return; 43511 } 43512 43513 node.sibling.return = node.return; 43514 node = node.sibling; 43515 43516 while (node.tag !== HostComponent && node.tag !== HostText && node.tag !== DehydratedFragment) { 43517 // If it is not host node and, we might have a host node inside it. 43518 // Try to search down until we find one. 43519 if (node.flags & Placement) { 43520 // If we don't have a child, try the siblings instead. 43521 continue siblings; 43522 } // If we don't have a child, try the siblings instead. 43523 // We also skip portals because they are not part of this host tree. 43524 43525 43526 if (node.child === null || node.tag === HostPortal) { 43527 continue siblings; 43528 } else { 43529 node.child.return = node; 43530 node = node.child; 43531 } 43532 } // Check if this host node is stable or about to be placed. 43533 43534 43535 if (!(node.flags & Placement)) { 43536 // Found it! 43537 return node.stateNode; 43538 } 43539 } 43540} 43541 43542function commitPlacement(finishedWork) { 43543 43544 43545 var parentFiber = getHostParentFiber(finishedWork); // Note: these two variables *must* always be updated together. 43546 43547 switch (parentFiber.tag) { 43548 case HostComponent: 43549 { 43550 var parent = parentFiber.stateNode; 43551 43552 if (parentFiber.flags & ContentReset) { 43553 // Reset the text content of the parent before doing any insertions 43554 resetTextContent(parent); // Clear ContentReset from the effect tag 43555 43556 parentFiber.flags &= ~ContentReset; 43557 } 43558 43559 var before = getHostSibling(finishedWork); // We only have the top Fiber that was inserted but we need to recurse down its 43560 // children to find all the terminal nodes. 43561 43562 insertOrAppendPlacementNode(finishedWork, before, parent); 43563 break; 43564 } 43565 43566 case HostRoot: 43567 case HostPortal: 43568 { 43569 var _parent = parentFiber.stateNode.containerInfo; 43570 43571 var _before = getHostSibling(finishedWork); 43572 43573 insertOrAppendPlacementNodeIntoContainer(finishedWork, _before, _parent); 43574 break; 43575 } 43576 // eslint-disable-next-line-no-fallthrough 43577 43578 default: 43579 throw new Error('Invalid host parent fiber. This error is likely caused by a bug ' + 'in React. Please file an issue.'); 43580 } 43581} 43582 43583function insertOrAppendPlacementNodeIntoContainer(node, before, parent) { 43584 var tag = node.tag; 43585 var isHost = tag === HostComponent || tag === HostText; 43586 43587 if (isHost) { 43588 var stateNode = node.stateNode; 43589 43590 if (before) { 43591 insertInContainerBefore(parent, stateNode, before); 43592 } else { 43593 appendChildToContainer(parent, stateNode); 43594 } 43595 } else if (tag === HostPortal) ; else { 43596 var child = node.child; 43597 43598 if (child !== null) { 43599 insertOrAppendPlacementNodeIntoContainer(child, before, parent); 43600 var sibling = child.sibling; 43601 43602 while (sibling !== null) { 43603 insertOrAppendPlacementNodeIntoContainer(sibling, before, parent); 43604 sibling = sibling.sibling; 43605 } 43606 } 43607 } 43608} 43609 43610function insertOrAppendPlacementNode(node, before, parent) { 43611 var tag = node.tag; 43612 var isHost = tag === HostComponent || tag === HostText; 43613 43614 if (isHost) { 43615 var stateNode = node.stateNode; 43616 43617 if (before) { 43618 insertBefore(parent, stateNode, before); 43619 } else { 43620 appendChild(parent, stateNode); 43621 } 43622 } else if (tag === HostPortal) ; else { 43623 var child = node.child; 43624 43625 if (child !== null) { 43626 insertOrAppendPlacementNode(child, before, parent); 43627 var sibling = child.sibling; 43628 43629 while (sibling !== null) { 43630 insertOrAppendPlacementNode(sibling, before, parent); 43631 sibling = sibling.sibling; 43632 } 43633 } 43634 } 43635} // These are tracked on the stack as we recursively traverse a 43636// deleted subtree. 43637// TODO: Update these during the whole mutation phase, not just during 43638// a deletion. 43639 43640 43641var hostParent = null; 43642var hostParentIsContainer = false; 43643 43644function commitDeletionEffects(root, returnFiber, deletedFiber) { 43645 { 43646 // We only have the top Fiber that was deleted but we need to recurse down its 43647 // children to find all the terminal nodes. 43648 // Recursively delete all host nodes from the parent, detach refs, clean 43649 // up mounted layout effects, and call componentWillUnmount. 43650 // We only need to remove the topmost host child in each branch. But then we 43651 // still need to keep traversing to unmount effects, refs, and cWU. TODO: We 43652 // could split this into two separate traversals functions, where the second 43653 // one doesn't include any removeChild logic. This is maybe the same 43654 // function as "disappearLayoutEffects" (or whatever that turns into after 43655 // the layout phase is refactored to use recursion). 43656 // Before starting, find the nearest host parent on the stack so we know 43657 // which instance/container to remove the children from. 43658 // TODO: Instead of searching up the fiber return path on every deletion, we 43659 // can track the nearest host component on the JS stack as we traverse the 43660 // tree during the commit phase. This would make insertions faster, too. 43661 var parent = returnFiber; 43662 43663 findParent: while (parent !== null) { 43664 switch (parent.tag) { 43665 case HostComponent: 43666 { 43667 hostParent = parent.stateNode; 43668 hostParentIsContainer = false; 43669 break findParent; 43670 } 43671 43672 case HostRoot: 43673 { 43674 hostParent = parent.stateNode.containerInfo; 43675 hostParentIsContainer = true; 43676 break findParent; 43677 } 43678 43679 case HostPortal: 43680 { 43681 hostParent = parent.stateNode.containerInfo; 43682 hostParentIsContainer = true; 43683 break findParent; 43684 } 43685 } 43686 43687 parent = parent.return; 43688 } 43689 43690 if (hostParent === null) { 43691 throw new Error('Expected to find a host parent. This error is likely caused by ' + 'a bug in React. Please file an issue.'); 43692 } 43693 43694 commitDeletionEffectsOnFiber(root, returnFiber, deletedFiber); 43695 hostParent = null; 43696 hostParentIsContainer = false; 43697 } 43698 43699 detachFiberMutation(deletedFiber); 43700} 43701 43702function recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, parent) { 43703 // TODO: Use a static flag to skip trees that don't have unmount effects 43704 var child = parent.child; 43705 43706 while (child !== null) { 43707 commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, child); 43708 child = child.sibling; 43709 } 43710} 43711 43712function commitDeletionEffectsOnFiber(finishedRoot, nearestMountedAncestor, deletedFiber) { 43713 onCommitUnmount(deletedFiber); // The cases in this outer switch modify the stack before they traverse 43714 // into their subtree. There are simpler cases in the inner switch 43715 // that don't modify the stack. 43716 43717 switch (deletedFiber.tag) { 43718 case HostComponent: 43719 { 43720 if (!offscreenSubtreeWasHidden) { 43721 safelyDetachRef(deletedFiber, nearestMountedAncestor); 43722 } // Intentional fallthrough to next branch 43723 43724 } 43725 // eslint-disable-next-line-no-fallthrough 43726 43727 case HostText: 43728 { 43729 // We only need to remove the nearest host child. Set the host parent 43730 // to `null` on the stack to indicate that nested children don't 43731 // need to be removed. 43732 { 43733 var prevHostParent = hostParent; 43734 var prevHostParentIsContainer = hostParentIsContainer; 43735 hostParent = null; 43736 recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); 43737 hostParent = prevHostParent; 43738 hostParentIsContainer = prevHostParentIsContainer; 43739 43740 if (hostParent !== null) { 43741 // Now that all the child effects have unmounted, we can remove the 43742 // node from the tree. 43743 if (hostParentIsContainer) { 43744 removeChildFromContainer(hostParent, deletedFiber.stateNode); 43745 } else { 43746 removeChild(hostParent, deletedFiber.stateNode); 43747 } 43748 } 43749 } 43750 43751 return; 43752 } 43753 43754 case DehydratedFragment: 43755 { 43756 // Delete the dehydrated suspense boundary and all of its content. 43757 43758 43759 { 43760 if (hostParent !== null) { 43761 if (hostParentIsContainer) { 43762 clearSuspenseBoundaryFromContainer(hostParent, deletedFiber.stateNode); 43763 } else { 43764 clearSuspenseBoundary(hostParent, deletedFiber.stateNode); 43765 } 43766 } 43767 } 43768 43769 return; 43770 } 43771 43772 case HostPortal: 43773 { 43774 { 43775 // When we go into a portal, it becomes the parent to remove from. 43776 var _prevHostParent = hostParent; 43777 var _prevHostParentIsContainer = hostParentIsContainer; 43778 hostParent = deletedFiber.stateNode.containerInfo; 43779 hostParentIsContainer = true; 43780 recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); 43781 hostParent = _prevHostParent; 43782 hostParentIsContainer = _prevHostParentIsContainer; 43783 } 43784 43785 return; 43786 } 43787 43788 case FunctionComponent: 43789 case ForwardRef: 43790 case MemoComponent: 43791 case SimpleMemoComponent: 43792 { 43793 if (!offscreenSubtreeWasHidden) { 43794 var updateQueue = deletedFiber.updateQueue; 43795 43796 if (updateQueue !== null) { 43797 var lastEffect = updateQueue.lastEffect; 43798 43799 if (lastEffect !== null) { 43800 var firstEffect = lastEffect.next; 43801 var effect = firstEffect; 43802 43803 do { 43804 var _effect = effect, 43805 destroy = _effect.destroy, 43806 tag = _effect.tag; 43807 43808 if (destroy !== undefined) { 43809 if ((tag & Insertion) !== NoFlags$1) { 43810 safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy); 43811 } else if ((tag & Layout) !== NoFlags$1) { 43812 { 43813 markComponentLayoutEffectUnmountStarted(deletedFiber); 43814 } 43815 43816 if ( deletedFiber.mode & ProfileMode) { 43817 startLayoutEffectTimer(); 43818 safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy); 43819 recordLayoutEffectDuration(deletedFiber); 43820 } else { 43821 safelyCallDestroy(deletedFiber, nearestMountedAncestor, destroy); 43822 } 43823 43824 { 43825 markComponentLayoutEffectUnmountStopped(); 43826 } 43827 } 43828 } 43829 43830 effect = effect.next; 43831 } while (effect !== firstEffect); 43832 } 43833 } 43834 } 43835 43836 recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); 43837 return; 43838 } 43839 43840 case ClassComponent: 43841 { 43842 if (!offscreenSubtreeWasHidden) { 43843 safelyDetachRef(deletedFiber, nearestMountedAncestor); 43844 var instance = deletedFiber.stateNode; 43845 43846 if (typeof instance.componentWillUnmount === 'function') { 43847 safelyCallComponentWillUnmount(deletedFiber, nearestMountedAncestor, instance); 43848 } 43849 } 43850 43851 recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); 43852 return; 43853 } 43854 43855 case ScopeComponent: 43856 { 43857 43858 recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); 43859 return; 43860 } 43861 43862 case OffscreenComponent: 43863 { 43864 if ( // TODO: Remove this dead flag 43865 deletedFiber.mode & ConcurrentMode) { 43866 // If this offscreen component is hidden, we already unmounted it. Before 43867 // deleting the children, track that it's already unmounted so that we 43868 // don't attempt to unmount the effects again. 43869 // TODO: If the tree is hidden, in most cases we should be able to skip 43870 // over the nested children entirely. An exception is we haven't yet found 43871 // the topmost host node to delete, which we already track on the stack. 43872 // But the other case is portals, which need to be detached no matter how 43873 // deeply they are nested. We should use a subtree flag to track whether a 43874 // subtree includes a nested portal. 43875 var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; 43876 offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || deletedFiber.memoizedState !== null; 43877 recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); 43878 offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; 43879 } else { 43880 recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); 43881 } 43882 43883 break; 43884 } 43885 43886 default: 43887 { 43888 recursivelyTraverseDeletionEffects(finishedRoot, nearestMountedAncestor, deletedFiber); 43889 return; 43890 } 43891 } 43892} 43893 43894function commitSuspenseCallback(finishedWork) { 43895 // TODO: Move this to passive phase 43896 var newState = finishedWork.memoizedState; 43897} 43898 43899function commitSuspenseHydrationCallbacks(finishedRoot, finishedWork) { 43900 43901 var newState = finishedWork.memoizedState; 43902 43903 if (newState === null) { 43904 var current = finishedWork.alternate; 43905 43906 if (current !== null) { 43907 var prevState = current.memoizedState; 43908 43909 if (prevState !== null) { 43910 var suspenseInstance = prevState.dehydrated; 43911 43912 if (suspenseInstance !== null) { 43913 commitHydratedSuspenseInstance(suspenseInstance); 43914 } 43915 } 43916 } 43917 } 43918} 43919 43920function attachSuspenseRetryListeners(finishedWork) { 43921 // If this boundary just timed out, then it will have a set of wakeables. 43922 // For each wakeable, attach a listener so that when it resolves, React 43923 // attempts to re-render the boundary in the primary (pre-timeout) state. 43924 var wakeables = finishedWork.updateQueue; 43925 43926 if (wakeables !== null) { 43927 finishedWork.updateQueue = null; 43928 var retryCache = finishedWork.stateNode; 43929 43930 if (retryCache === null) { 43931 retryCache = finishedWork.stateNode = new PossiblyWeakSet(); 43932 } 43933 43934 wakeables.forEach(function (wakeable) { 43935 // Memoize using the boundary fiber to prevent redundant listeners. 43936 var retry = resolveRetryWakeable.bind(null, finishedWork, wakeable); 43937 43938 if (!retryCache.has(wakeable)) { 43939 retryCache.add(wakeable); 43940 43941 { 43942 if (isDevToolsPresent) { 43943 if (inProgressLanes !== null && inProgressRoot !== null) { 43944 // If we have pending work still, associate the original updaters with it. 43945 restorePendingUpdaters(inProgressRoot, inProgressLanes); 43946 } else { 43947 throw Error('Expected finished root and lanes to be set. This is a bug in React.'); 43948 } 43949 } 43950 } 43951 43952 wakeable.then(retry, retry); 43953 } 43954 }); 43955 } 43956} // This function detects when a Suspense boundary goes from visible to hidden. 43957function commitMutationEffects(root, finishedWork, committedLanes) { 43958 inProgressLanes = committedLanes; 43959 inProgressRoot = root; 43960 setCurrentFiber(finishedWork); 43961 commitMutationEffectsOnFiber(finishedWork, root); 43962 setCurrentFiber(finishedWork); 43963 inProgressLanes = null; 43964 inProgressRoot = null; 43965} 43966 43967function recursivelyTraverseMutationEffects(root, parentFiber, lanes) { 43968 // Deletions effects can be scheduled on any fiber type. They need to happen 43969 // before the children effects hae fired. 43970 var deletions = parentFiber.deletions; 43971 43972 if (deletions !== null) { 43973 for (var i = 0; i < deletions.length; i++) { 43974 var childToDelete = deletions[i]; 43975 43976 try { 43977 commitDeletionEffects(root, parentFiber, childToDelete); 43978 } catch (error) { 43979 captureCommitPhaseError(childToDelete, parentFiber, error); 43980 } 43981 } 43982 } 43983 43984 var prevDebugFiber = getCurrentFiber(); 43985 43986 if (parentFiber.subtreeFlags & MutationMask) { 43987 var child = parentFiber.child; 43988 43989 while (child !== null) { 43990 setCurrentFiber(child); 43991 commitMutationEffectsOnFiber(child, root); 43992 child = child.sibling; 43993 } 43994 } 43995 43996 setCurrentFiber(prevDebugFiber); 43997} 43998 43999function commitMutationEffectsOnFiber(finishedWork, root, lanes) { 44000 var current = finishedWork.alternate; 44001 var flags = finishedWork.flags; // The effect flag should be checked *after* we refine the type of fiber, 44002 // because the fiber tag is more specific. An exception is any flag related 44003 // to reconcilation, because those can be set on all fiber types. 44004 44005 switch (finishedWork.tag) { 44006 case FunctionComponent: 44007 case ForwardRef: 44008 case MemoComponent: 44009 case SimpleMemoComponent: 44010 { 44011 recursivelyTraverseMutationEffects(root, finishedWork); 44012 commitReconciliationEffects(finishedWork); 44013 44014 if (flags & Update) { 44015 try { 44016 commitHookEffectListUnmount(Insertion | HasEffect, finishedWork, finishedWork.return); 44017 commitHookEffectListMount(Insertion | HasEffect, finishedWork); 44018 } catch (error) { 44019 captureCommitPhaseError(finishedWork, finishedWork.return, error); 44020 } // Layout effects are destroyed during the mutation phase so that all 44021 // destroy functions for all fibers are called before any create functions. 44022 // This prevents sibling component effects from interfering with each other, 44023 // e.g. a destroy function in one component should never override a ref set 44024 // by a create function in another component during the same commit. 44025 44026 44027 if ( finishedWork.mode & ProfileMode) { 44028 try { 44029 startLayoutEffectTimer(); 44030 commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return); 44031 } catch (error) { 44032 captureCommitPhaseError(finishedWork, finishedWork.return, error); 44033 } 44034 44035 recordLayoutEffectDuration(finishedWork); 44036 } else { 44037 try { 44038 commitHookEffectListUnmount(Layout | HasEffect, finishedWork, finishedWork.return); 44039 } catch (error) { 44040 captureCommitPhaseError(finishedWork, finishedWork.return, error); 44041 } 44042 } 44043 } 44044 44045 return; 44046 } 44047 44048 case ClassComponent: 44049 { 44050 recursivelyTraverseMutationEffects(root, finishedWork); 44051 commitReconciliationEffects(finishedWork); 44052 44053 if (flags & Ref) { 44054 if (current !== null) { 44055 safelyDetachRef(current, current.return); 44056 } 44057 } 44058 44059 return; 44060 } 44061 44062 case HostComponent: 44063 { 44064 recursivelyTraverseMutationEffects(root, finishedWork); 44065 commitReconciliationEffects(finishedWork); 44066 44067 if (flags & Ref) { 44068 if (current !== null) { 44069 safelyDetachRef(current, current.return); 44070 } 44071 } 44072 44073 { 44074 // TODO: ContentReset gets cleared by the children during the commit 44075 // phase. This is a refactor hazard because it means we must read 44076 // flags the flags after `commitReconciliationEffects` has already run; 44077 // the order matters. We should refactor so that ContentReset does not 44078 // rely on mutating the flag during commit. Like by setting a flag 44079 // during the render phase instead. 44080 if (finishedWork.flags & ContentReset) { 44081 var instance = finishedWork.stateNode; 44082 44083 try { 44084 resetTextContent(instance); 44085 } catch (error) { 44086 captureCommitPhaseError(finishedWork, finishedWork.return, error); 44087 } 44088 } 44089 44090 if (flags & Update) { 44091 var _instance4 = finishedWork.stateNode; 44092 44093 if (_instance4 != null) { 44094 // Commit the work prepared earlier. 44095 var newProps = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps 44096 // as the newProps. The updatePayload will contain the real change in 44097 // this case. 44098 44099 var oldProps = current !== null ? current.memoizedProps : newProps; 44100 var type = finishedWork.type; // TODO: Type the updateQueue to be specific to host components. 44101 44102 var updatePayload = finishedWork.updateQueue; 44103 finishedWork.updateQueue = null; 44104 44105 if (updatePayload !== null) { 44106 try { 44107 commitUpdate(_instance4, updatePayload, type, oldProps, newProps, finishedWork); 44108 } catch (error) { 44109 captureCommitPhaseError(finishedWork, finishedWork.return, error); 44110 } 44111 } 44112 } 44113 } 44114 } 44115 44116 return; 44117 } 44118 44119 case HostText: 44120 { 44121 recursivelyTraverseMutationEffects(root, finishedWork); 44122 commitReconciliationEffects(finishedWork); 44123 44124 if (flags & Update) { 44125 { 44126 if (finishedWork.stateNode === null) { 44127 throw new Error('This should have a text node initialized. This error is likely ' + 'caused by a bug in React. Please file an issue.'); 44128 } 44129 44130 var textInstance = finishedWork.stateNode; 44131 var newText = finishedWork.memoizedProps; // For hydration we reuse the update path but we treat the oldProps 44132 // as the newProps. The updatePayload will contain the real change in 44133 // this case. 44134 44135 var oldText = current !== null ? current.memoizedProps : newText; 44136 44137 try { 44138 commitTextUpdate(textInstance, oldText, newText); 44139 } catch (error) { 44140 captureCommitPhaseError(finishedWork, finishedWork.return, error); 44141 } 44142 } 44143 } 44144 44145 return; 44146 } 44147 44148 case HostRoot: 44149 { 44150 recursivelyTraverseMutationEffects(root, finishedWork); 44151 commitReconciliationEffects(finishedWork); 44152 44153 if (flags & Update) { 44154 { 44155 if (current !== null) { 44156 var prevRootState = current.memoizedState; 44157 44158 if (prevRootState.isDehydrated) { 44159 try { 44160 commitHydratedContainer(root.containerInfo); 44161 } catch (error) { 44162 captureCommitPhaseError(finishedWork, finishedWork.return, error); 44163 } 44164 } 44165 } 44166 } 44167 } 44168 44169 return; 44170 } 44171 44172 case HostPortal: 44173 { 44174 recursivelyTraverseMutationEffects(root, finishedWork); 44175 commitReconciliationEffects(finishedWork); 44176 44177 return; 44178 } 44179 44180 case SuspenseComponent: 44181 { 44182 recursivelyTraverseMutationEffects(root, finishedWork); 44183 commitReconciliationEffects(finishedWork); 44184 var offscreenFiber = finishedWork.child; 44185 44186 if (offscreenFiber.flags & Visibility) { 44187 var offscreenInstance = offscreenFiber.stateNode; 44188 var newState = offscreenFiber.memoizedState; 44189 var isHidden = newState !== null; // Track the current state on the Offscreen instance so we can 44190 // read it during an event 44191 44192 offscreenInstance.isHidden = isHidden; 44193 44194 if (isHidden) { 44195 var wasHidden = offscreenFiber.alternate !== null && offscreenFiber.alternate.memoizedState !== null; 44196 44197 if (!wasHidden) { 44198 // TODO: Move to passive phase 44199 markCommitTimeOfFallback(); 44200 } 44201 } 44202 } 44203 44204 if (flags & Update) { 44205 try { 44206 commitSuspenseCallback(finishedWork); 44207 } catch (error) { 44208 captureCommitPhaseError(finishedWork, finishedWork.return, error); 44209 } 44210 44211 attachSuspenseRetryListeners(finishedWork); 44212 } 44213 44214 return; 44215 } 44216 44217 case OffscreenComponent: 44218 { 44219 var _wasHidden = current !== null && current.memoizedState !== null; 44220 44221 if ( // TODO: Remove this dead flag 44222 finishedWork.mode & ConcurrentMode) { 44223 // Before committing the children, track on the stack whether this 44224 // offscreen subtree was already hidden, so that we don't unmount the 44225 // effects again. 44226 var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; 44227 offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden || _wasHidden; 44228 recursivelyTraverseMutationEffects(root, finishedWork); 44229 offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; 44230 } else { 44231 recursivelyTraverseMutationEffects(root, finishedWork); 44232 } 44233 44234 commitReconciliationEffects(finishedWork); 44235 44236 if (flags & Visibility) { 44237 var _offscreenInstance = finishedWork.stateNode; 44238 var _newState = finishedWork.memoizedState; 44239 44240 var _isHidden = _newState !== null; 44241 44242 var offscreenBoundary = finishedWork; // Track the current state on the Offscreen instance so we can 44243 // read it during an event 44244 44245 _offscreenInstance.isHidden = _isHidden; 44246 44247 { 44248 if (_isHidden) { 44249 if (!_wasHidden) { 44250 if ((offscreenBoundary.mode & ConcurrentMode) !== NoMode) { 44251 nextEffect = offscreenBoundary; 44252 var offscreenChild = offscreenBoundary.child; 44253 44254 while (offscreenChild !== null) { 44255 nextEffect = offscreenChild; 44256 disappearLayoutEffects_begin(offscreenChild); 44257 offscreenChild = offscreenChild.sibling; 44258 } 44259 } 44260 } 44261 } 44262 } 44263 44264 { 44265 // TODO: This needs to run whenever there's an insertion or update 44266 // inside a hidden Offscreen tree. 44267 hideOrUnhideAllChildren(offscreenBoundary, _isHidden); 44268 } 44269 } 44270 44271 return; 44272 } 44273 44274 case SuspenseListComponent: 44275 { 44276 recursivelyTraverseMutationEffects(root, finishedWork); 44277 commitReconciliationEffects(finishedWork); 44278 44279 if (flags & Update) { 44280 attachSuspenseRetryListeners(finishedWork); 44281 } 44282 44283 return; 44284 } 44285 44286 case ScopeComponent: 44287 { 44288 44289 return; 44290 } 44291 44292 default: 44293 { 44294 recursivelyTraverseMutationEffects(root, finishedWork); 44295 commitReconciliationEffects(finishedWork); 44296 return; 44297 } 44298 } 44299} 44300 44301function commitReconciliationEffects(finishedWork) { 44302 // Placement effects (insertions, reorders) can be scheduled on any fiber 44303 // type. They needs to happen after the children effects have fired, but 44304 // before the effects on this fiber have fired. 44305 var flags = finishedWork.flags; 44306 44307 if (flags & Placement) { 44308 try { 44309 commitPlacement(finishedWork); 44310 } catch (error) { 44311 captureCommitPhaseError(finishedWork, finishedWork.return, error); 44312 } // Clear the "placement" from effect tag so that we know that this is 44313 // inserted, before any life-cycles like componentDidMount gets called. 44314 // TODO: findDOMNode doesn't rely on this any more but isMounted does 44315 // and isMounted is deprecated anyway so we should be able to kill this. 44316 44317 44318 finishedWork.flags &= ~Placement; 44319 } 44320 44321 if (flags & Hydrating) { 44322 finishedWork.flags &= ~Hydrating; 44323 } 44324} 44325 44326function commitLayoutEffects(finishedWork, root, committedLanes) { 44327 inProgressLanes = committedLanes; 44328 inProgressRoot = root; 44329 nextEffect = finishedWork; 44330 commitLayoutEffects_begin(finishedWork, root, committedLanes); 44331 inProgressLanes = null; 44332 inProgressRoot = null; 44333} 44334 44335function commitLayoutEffects_begin(subtreeRoot, root, committedLanes) { 44336 // Suspense layout effects semantics don't change for legacy roots. 44337 var isModernRoot = (subtreeRoot.mode & ConcurrentMode) !== NoMode; 44338 44339 while (nextEffect !== null) { 44340 var fiber = nextEffect; 44341 var firstChild = fiber.child; 44342 44343 if ( fiber.tag === OffscreenComponent && isModernRoot) { 44344 // Keep track of the current Offscreen stack's state. 44345 var isHidden = fiber.memoizedState !== null; 44346 var newOffscreenSubtreeIsHidden = isHidden || offscreenSubtreeIsHidden; 44347 44348 if (newOffscreenSubtreeIsHidden) { 44349 // The Offscreen tree is hidden. Skip over its layout effects. 44350 commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); 44351 continue; 44352 } else { 44353 // TODO (Offscreen) Also check: subtreeFlags & LayoutMask 44354 var current = fiber.alternate; 44355 var wasHidden = current !== null && current.memoizedState !== null; 44356 var newOffscreenSubtreeWasHidden = wasHidden || offscreenSubtreeWasHidden; 44357 var prevOffscreenSubtreeIsHidden = offscreenSubtreeIsHidden; 44358 var prevOffscreenSubtreeWasHidden = offscreenSubtreeWasHidden; // Traverse the Offscreen subtree with the current Offscreen as the root. 44359 44360 offscreenSubtreeIsHidden = newOffscreenSubtreeIsHidden; 44361 offscreenSubtreeWasHidden = newOffscreenSubtreeWasHidden; 44362 44363 if (offscreenSubtreeWasHidden && !prevOffscreenSubtreeWasHidden) { 44364 // This is the root of a reappearing boundary. Turn its layout effects 44365 // back on. 44366 nextEffect = fiber; 44367 reappearLayoutEffects_begin(fiber); 44368 } 44369 44370 var child = firstChild; 44371 44372 while (child !== null) { 44373 nextEffect = child; 44374 commitLayoutEffects_begin(child, // New root; bubble back up to here and stop. 44375 root, committedLanes); 44376 child = child.sibling; 44377 } // Restore Offscreen state and resume in our-progress traversal. 44378 44379 44380 nextEffect = fiber; 44381 offscreenSubtreeIsHidden = prevOffscreenSubtreeIsHidden; 44382 offscreenSubtreeWasHidden = prevOffscreenSubtreeWasHidden; 44383 commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); 44384 continue; 44385 } 44386 } 44387 44388 if ((fiber.subtreeFlags & LayoutMask) !== NoFlags && firstChild !== null) { 44389 firstChild.return = fiber; 44390 nextEffect = firstChild; 44391 } else { 44392 commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes); 44393 } 44394 } 44395} 44396 44397function commitLayoutMountEffects_complete(subtreeRoot, root, committedLanes) { 44398 while (nextEffect !== null) { 44399 var fiber = nextEffect; 44400 44401 if ((fiber.flags & LayoutMask) !== NoFlags) { 44402 var current = fiber.alternate; 44403 setCurrentFiber(fiber); 44404 44405 try { 44406 commitLayoutEffectOnFiber(root, current, fiber, committedLanes); 44407 } catch (error) { 44408 captureCommitPhaseError(fiber, fiber.return, error); 44409 } 44410 44411 resetCurrentFiber(); 44412 } 44413 44414 if (fiber === subtreeRoot) { 44415 nextEffect = null; 44416 return; 44417 } 44418 44419 var sibling = fiber.sibling; 44420 44421 if (sibling !== null) { 44422 sibling.return = fiber.return; 44423 nextEffect = sibling; 44424 return; 44425 } 44426 44427 nextEffect = fiber.return; 44428 } 44429} 44430 44431function disappearLayoutEffects_begin(subtreeRoot) { 44432 while (nextEffect !== null) { 44433 var fiber = nextEffect; 44434 var firstChild = fiber.child; // TODO (Offscreen) Check: flags & (RefStatic | LayoutStatic) 44435 44436 switch (fiber.tag) { 44437 case FunctionComponent: 44438 case ForwardRef: 44439 case MemoComponent: 44440 case SimpleMemoComponent: 44441 { 44442 if ( fiber.mode & ProfileMode) { 44443 try { 44444 startLayoutEffectTimer(); 44445 commitHookEffectListUnmount(Layout, fiber, fiber.return); 44446 } finally { 44447 recordLayoutEffectDuration(fiber); 44448 } 44449 } else { 44450 commitHookEffectListUnmount(Layout, fiber, fiber.return); 44451 } 44452 44453 break; 44454 } 44455 44456 case ClassComponent: 44457 { 44458 // TODO (Offscreen) Check: flags & RefStatic 44459 safelyDetachRef(fiber, fiber.return); 44460 var instance = fiber.stateNode; 44461 44462 if (typeof instance.componentWillUnmount === 'function') { 44463 safelyCallComponentWillUnmount(fiber, fiber.return, instance); 44464 } 44465 44466 break; 44467 } 44468 44469 case HostComponent: 44470 { 44471 safelyDetachRef(fiber, fiber.return); 44472 break; 44473 } 44474 44475 case OffscreenComponent: 44476 { 44477 // Check if this is a 44478 var isHidden = fiber.memoizedState !== null; 44479 44480 if (isHidden) { 44481 // Nested Offscreen tree is already hidden. Don't disappear 44482 // its effects. 44483 disappearLayoutEffects_complete(subtreeRoot); 44484 continue; 44485 } 44486 44487 break; 44488 } 44489 } // TODO (Offscreen) Check: subtreeFlags & LayoutStatic 44490 44491 44492 if (firstChild !== null) { 44493 firstChild.return = fiber; 44494 nextEffect = firstChild; 44495 } else { 44496 disappearLayoutEffects_complete(subtreeRoot); 44497 } 44498 } 44499} 44500 44501function disappearLayoutEffects_complete(subtreeRoot) { 44502 while (nextEffect !== null) { 44503 var fiber = nextEffect; 44504 44505 if (fiber === subtreeRoot) { 44506 nextEffect = null; 44507 return; 44508 } 44509 44510 var sibling = fiber.sibling; 44511 44512 if (sibling !== null) { 44513 sibling.return = fiber.return; 44514 nextEffect = sibling; 44515 return; 44516 } 44517 44518 nextEffect = fiber.return; 44519 } 44520} 44521 44522function reappearLayoutEffects_begin(subtreeRoot) { 44523 while (nextEffect !== null) { 44524 var fiber = nextEffect; 44525 var firstChild = fiber.child; 44526 44527 if (fiber.tag === OffscreenComponent) { 44528 var isHidden = fiber.memoizedState !== null; 44529 44530 if (isHidden) { 44531 // Nested Offscreen tree is still hidden. Don't re-appear its effects. 44532 reappearLayoutEffects_complete(subtreeRoot); 44533 continue; 44534 } 44535 } // TODO (Offscreen) Check: subtreeFlags & LayoutStatic 44536 44537 44538 if (firstChild !== null) { 44539 // This node may have been reused from a previous render, so we can't 44540 // assume its return pointer is correct. 44541 firstChild.return = fiber; 44542 nextEffect = firstChild; 44543 } else { 44544 reappearLayoutEffects_complete(subtreeRoot); 44545 } 44546 } 44547} 44548 44549function reappearLayoutEffects_complete(subtreeRoot) { 44550 while (nextEffect !== null) { 44551 var fiber = nextEffect; // TODO (Offscreen) Check: flags & LayoutStatic 44552 44553 setCurrentFiber(fiber); 44554 44555 try { 44556 reappearLayoutEffectsOnFiber(fiber); 44557 } catch (error) { 44558 captureCommitPhaseError(fiber, fiber.return, error); 44559 } 44560 44561 resetCurrentFiber(); 44562 44563 if (fiber === subtreeRoot) { 44564 nextEffect = null; 44565 return; 44566 } 44567 44568 var sibling = fiber.sibling; 44569 44570 if (sibling !== null) { 44571 // This node may have been reused from a previous render, so we can't 44572 // assume its return pointer is correct. 44573 sibling.return = fiber.return; 44574 nextEffect = sibling; 44575 return; 44576 } 44577 44578 nextEffect = fiber.return; 44579 } 44580} 44581 44582function commitPassiveMountEffects(root, finishedWork, committedLanes, committedTransitions) { 44583 nextEffect = finishedWork; 44584 commitPassiveMountEffects_begin(finishedWork, root, committedLanes, committedTransitions); 44585} 44586 44587function commitPassiveMountEffects_begin(subtreeRoot, root, committedLanes, committedTransitions) { 44588 while (nextEffect !== null) { 44589 var fiber = nextEffect; 44590 var firstChild = fiber.child; 44591 44592 if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && firstChild !== null) { 44593 firstChild.return = fiber; 44594 nextEffect = firstChild; 44595 } else { 44596 commitPassiveMountEffects_complete(subtreeRoot, root, committedLanes, committedTransitions); 44597 } 44598 } 44599} 44600 44601function commitPassiveMountEffects_complete(subtreeRoot, root, committedLanes, committedTransitions) { 44602 while (nextEffect !== null) { 44603 var fiber = nextEffect; 44604 44605 if ((fiber.flags & Passive) !== NoFlags) { 44606 setCurrentFiber(fiber); 44607 44608 try { 44609 commitPassiveMountOnFiber(root, fiber, committedLanes, committedTransitions); 44610 } catch (error) { 44611 captureCommitPhaseError(fiber, fiber.return, error); 44612 } 44613 44614 resetCurrentFiber(); 44615 } 44616 44617 if (fiber === subtreeRoot) { 44618 nextEffect = null; 44619 return; 44620 } 44621 44622 var sibling = fiber.sibling; 44623 44624 if (sibling !== null) { 44625 sibling.return = fiber.return; 44626 nextEffect = sibling; 44627 return; 44628 } 44629 44630 nextEffect = fiber.return; 44631 } 44632} 44633 44634function commitPassiveMountOnFiber(finishedRoot, finishedWork, committedLanes, committedTransitions) { 44635 switch (finishedWork.tag) { 44636 case FunctionComponent: 44637 case ForwardRef: 44638 case SimpleMemoComponent: 44639 { 44640 if ( finishedWork.mode & ProfileMode) { 44641 startPassiveEffectTimer(); 44642 44643 try { 44644 commitHookEffectListMount(Passive$1 | HasEffect, finishedWork); 44645 } finally { 44646 recordPassiveEffectDuration(finishedWork); 44647 } 44648 } else { 44649 commitHookEffectListMount(Passive$1 | HasEffect, finishedWork); 44650 } 44651 44652 break; 44653 } 44654 } 44655} 44656 44657function commitPassiveUnmountEffects(firstChild) { 44658 nextEffect = firstChild; 44659 commitPassiveUnmountEffects_begin(); 44660} 44661 44662function commitPassiveUnmountEffects_begin() { 44663 while (nextEffect !== null) { 44664 var fiber = nextEffect; 44665 var child = fiber.child; 44666 44667 if ((nextEffect.flags & ChildDeletion) !== NoFlags) { 44668 var deletions = fiber.deletions; 44669 44670 if (deletions !== null) { 44671 for (var i = 0; i < deletions.length; i++) { 44672 var fiberToDelete = deletions[i]; 44673 nextEffect = fiberToDelete; 44674 commitPassiveUnmountEffectsInsideOfDeletedTree_begin(fiberToDelete, fiber); 44675 } 44676 44677 { 44678 // A fiber was deleted from this parent fiber, but it's still part of 44679 // the previous (alternate) parent fiber's list of children. Because 44680 // children are a linked list, an earlier sibling that's still alive 44681 // will be connected to the deleted fiber via its `alternate`: 44682 // 44683 // live fiber 44684 // --alternate--> previous live fiber 44685 // --sibling--> deleted fiber 44686 // 44687 // We can't disconnect `alternate` on nodes that haven't been deleted 44688 // yet, but we can disconnect the `sibling` and `child` pointers. 44689 var previousFiber = fiber.alternate; 44690 44691 if (previousFiber !== null) { 44692 var detachedChild = previousFiber.child; 44693 44694 if (detachedChild !== null) { 44695 previousFiber.child = null; 44696 44697 do { 44698 var detachedSibling = detachedChild.sibling; 44699 detachedChild.sibling = null; 44700 detachedChild = detachedSibling; 44701 } while (detachedChild !== null); 44702 } 44703 } 44704 } 44705 44706 nextEffect = fiber; 44707 } 44708 } 44709 44710 if ((fiber.subtreeFlags & PassiveMask) !== NoFlags && child !== null) { 44711 child.return = fiber; 44712 nextEffect = child; 44713 } else { 44714 commitPassiveUnmountEffects_complete(); 44715 } 44716 } 44717} 44718 44719function commitPassiveUnmountEffects_complete() { 44720 while (nextEffect !== null) { 44721 var fiber = nextEffect; 44722 44723 if ((fiber.flags & Passive) !== NoFlags) { 44724 setCurrentFiber(fiber); 44725 commitPassiveUnmountOnFiber(fiber); 44726 resetCurrentFiber(); 44727 } 44728 44729 var sibling = fiber.sibling; 44730 44731 if (sibling !== null) { 44732 sibling.return = fiber.return; 44733 nextEffect = sibling; 44734 return; 44735 } 44736 44737 nextEffect = fiber.return; 44738 } 44739} 44740 44741function commitPassiveUnmountOnFiber(finishedWork) { 44742 switch (finishedWork.tag) { 44743 case FunctionComponent: 44744 case ForwardRef: 44745 case SimpleMemoComponent: 44746 { 44747 if ( finishedWork.mode & ProfileMode) { 44748 startPassiveEffectTimer(); 44749 commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return); 44750 recordPassiveEffectDuration(finishedWork); 44751 } else { 44752 commitHookEffectListUnmount(Passive$1 | HasEffect, finishedWork, finishedWork.return); 44753 } 44754 44755 break; 44756 } 44757 } 44758} 44759 44760function commitPassiveUnmountEffectsInsideOfDeletedTree_begin(deletedSubtreeRoot, nearestMountedAncestor) { 44761 while (nextEffect !== null) { 44762 var fiber = nextEffect; // Deletion effects fire in parent -> child order 44763 // TODO: Check if fiber has a PassiveStatic flag 44764 44765 setCurrentFiber(fiber); 44766 commitPassiveUnmountInsideDeletedTreeOnFiber(fiber, nearestMountedAncestor); 44767 resetCurrentFiber(); 44768 var child = fiber.child; // TODO: Only traverse subtree if it has a PassiveStatic flag. (But, if we 44769 // do this, still need to handle `deletedTreeCleanUpLevel` correctly.) 44770 44771 if (child !== null) { 44772 child.return = fiber; 44773 nextEffect = child; 44774 } else { 44775 commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot); 44776 } 44777 } 44778} 44779 44780function commitPassiveUnmountEffectsInsideOfDeletedTree_complete(deletedSubtreeRoot) { 44781 while (nextEffect !== null) { 44782 var fiber = nextEffect; 44783 var sibling = fiber.sibling; 44784 var returnFiber = fiber.return; 44785 44786 { 44787 // Recursively traverse the entire deleted tree and clean up fiber fields. 44788 // This is more aggressive than ideal, and the long term goal is to only 44789 // have to detach the deleted tree at the root. 44790 detachFiberAfterEffects(fiber); 44791 44792 if (fiber === deletedSubtreeRoot) { 44793 nextEffect = null; 44794 return; 44795 } 44796 } 44797 44798 if (sibling !== null) { 44799 sibling.return = returnFiber; 44800 nextEffect = sibling; 44801 return; 44802 } 44803 44804 nextEffect = returnFiber; 44805 } 44806} 44807 44808function commitPassiveUnmountInsideDeletedTreeOnFiber(current, nearestMountedAncestor) { 44809 switch (current.tag) { 44810 case FunctionComponent: 44811 case ForwardRef: 44812 case SimpleMemoComponent: 44813 { 44814 if ( current.mode & ProfileMode) { 44815 startPassiveEffectTimer(); 44816 commitHookEffectListUnmount(Passive$1, current, nearestMountedAncestor); 44817 recordPassiveEffectDuration(current); 44818 } else { 44819 commitHookEffectListUnmount(Passive$1, current, nearestMountedAncestor); 44820 } 44821 44822 break; 44823 } 44824 } 44825} // TODO: Reuse reappearLayoutEffects traversal here? 44826 44827 44828function invokeLayoutEffectMountInDEV(fiber) { 44829 { 44830 // We don't need to re-check StrictEffectsMode here. 44831 // This function is only called if that check has already passed. 44832 switch (fiber.tag) { 44833 case FunctionComponent: 44834 case ForwardRef: 44835 case SimpleMemoComponent: 44836 { 44837 try { 44838 commitHookEffectListMount(Layout | HasEffect, fiber); 44839 } catch (error) { 44840 captureCommitPhaseError(fiber, fiber.return, error); 44841 } 44842 44843 break; 44844 } 44845 44846 case ClassComponent: 44847 { 44848 var instance = fiber.stateNode; 44849 44850 try { 44851 instance.componentDidMount(); 44852 } catch (error) { 44853 captureCommitPhaseError(fiber, fiber.return, error); 44854 } 44855 44856 break; 44857 } 44858 } 44859 } 44860} 44861 44862function invokePassiveEffectMountInDEV(fiber) { 44863 { 44864 // We don't need to re-check StrictEffectsMode here. 44865 // This function is only called if that check has already passed. 44866 switch (fiber.tag) { 44867 case FunctionComponent: 44868 case ForwardRef: 44869 case SimpleMemoComponent: 44870 { 44871 try { 44872 commitHookEffectListMount(Passive$1 | HasEffect, fiber); 44873 } catch (error) { 44874 captureCommitPhaseError(fiber, fiber.return, error); 44875 } 44876 44877 break; 44878 } 44879 } 44880 } 44881} 44882 44883function invokeLayoutEffectUnmountInDEV(fiber) { 44884 { 44885 // We don't need to re-check StrictEffectsMode here. 44886 // This function is only called if that check has already passed. 44887 switch (fiber.tag) { 44888 case FunctionComponent: 44889 case ForwardRef: 44890 case SimpleMemoComponent: 44891 { 44892 try { 44893 commitHookEffectListUnmount(Layout | HasEffect, fiber, fiber.return); 44894 } catch (error) { 44895 captureCommitPhaseError(fiber, fiber.return, error); 44896 } 44897 44898 break; 44899 } 44900 44901 case ClassComponent: 44902 { 44903 var instance = fiber.stateNode; 44904 44905 if (typeof instance.componentWillUnmount === 'function') { 44906 safelyCallComponentWillUnmount(fiber, fiber.return, instance); 44907 } 44908 44909 break; 44910 } 44911 } 44912 } 44913} 44914 44915function invokePassiveEffectUnmountInDEV(fiber) { 44916 { 44917 // We don't need to re-check StrictEffectsMode here. 44918 // This function is only called if that check has already passed. 44919 switch (fiber.tag) { 44920 case FunctionComponent: 44921 case ForwardRef: 44922 case SimpleMemoComponent: 44923 { 44924 try { 44925 commitHookEffectListUnmount(Passive$1 | HasEffect, fiber, fiber.return); 44926 } catch (error) { 44927 captureCommitPhaseError(fiber, fiber.return, error); 44928 } 44929 } 44930 } 44931 } 44932} 44933 44934var COMPONENT_TYPE = 0; 44935var HAS_PSEUDO_CLASS_TYPE = 1; 44936var ROLE_TYPE = 2; 44937var TEST_NAME_TYPE = 3; 44938var TEXT_TYPE = 4; 44939 44940if (typeof Symbol === 'function' && Symbol.for) { 44941 var symbolFor = Symbol.for; 44942 COMPONENT_TYPE = symbolFor('selector.component'); 44943 HAS_PSEUDO_CLASS_TYPE = symbolFor('selector.has_pseudo_class'); 44944 ROLE_TYPE = symbolFor('selector.role'); 44945 TEST_NAME_TYPE = symbolFor('selector.test_id'); 44946 TEXT_TYPE = symbolFor('selector.text'); 44947} 44948var commitHooks = []; 44949function onCommitRoot$1() { 44950 { 44951 commitHooks.forEach(function (commitHook) { 44952 return commitHook(); 44953 }); 44954 } 44955} 44956 44957var ReactCurrentActQueue = ReactSharedInternals.ReactCurrentActQueue; 44958function isLegacyActEnvironment(fiber) { 44959 { 44960 // Legacy mode. We preserve the behavior of React 17's act. It assumes an 44961 // act environment whenever `jest` is defined, but you can still turn off 44962 // spurious warnings by setting IS_REACT_ACT_ENVIRONMENT explicitly 44963 // to false. 44964 var isReactActEnvironmentGlobal = // $FlowExpectedError â Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global 44965 typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined' ? IS_REACT_ACT_ENVIRONMENT : undefined; // $FlowExpectedError - Flow doesn't know about jest 44966 44967 var jestIsDefined = typeof jest !== 'undefined'; 44968 return jestIsDefined && isReactActEnvironmentGlobal !== false; 44969 } 44970} 44971function isConcurrentActEnvironment() { 44972 { 44973 var isReactActEnvironmentGlobal = // $FlowExpectedError â Flow doesn't know about IS_REACT_ACT_ENVIRONMENT global 44974 typeof IS_REACT_ACT_ENVIRONMENT !== 'undefined' ? IS_REACT_ACT_ENVIRONMENT : undefined; 44975 44976 if (!isReactActEnvironmentGlobal && ReactCurrentActQueue.current !== null) { 44977 // TODO: Include link to relevant documentation page. 44978 error('The current testing environment is not configured to support ' + 'act(...)'); 44979 } 44980 44981 return isReactActEnvironmentGlobal; 44982 } 44983} 44984 44985var ceil = Math.ceil; 44986var ReactCurrentDispatcher$2 = ReactSharedInternals.ReactCurrentDispatcher, 44987 ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner, 44988 ReactCurrentBatchConfig$3 = ReactSharedInternals.ReactCurrentBatchConfig, 44989 ReactCurrentActQueue$1 = ReactSharedInternals.ReactCurrentActQueue; 44990var NoContext = 44991/* */ 449920; 44993var BatchedContext = 44994/* */ 449951; 44996var RenderContext = 44997/* */ 449982; 44999var CommitContext = 45000/* */ 450014; 45002var RootInProgress = 0; 45003var RootFatalErrored = 1; 45004var RootErrored = 2; 45005var RootSuspended = 3; 45006var RootSuspendedWithDelay = 4; 45007var RootCompleted = 5; 45008var RootDidNotComplete = 6; // Describes where we are in the React execution stack 45009 45010var executionContext = NoContext; // The root we're working on 45011 45012var workInProgressRoot = null; // The fiber we're working on 45013 45014var workInProgress = null; // The lanes we're rendering 45015 45016var workInProgressRootRenderLanes = NoLanes; // Stack that allows components to change the render lanes for its subtree 45017// This is a superset of the lanes we started working on at the root. The only 45018// case where it's different from `workInProgressRootRenderLanes` is when we 45019// enter a subtree that is hidden and needs to be unhidden: Suspense and 45020// Offscreen component. 45021// 45022// Most things in the work loop should deal with workInProgressRootRenderLanes. 45023// Most things in begin/complete phases should deal with subtreeRenderLanes. 45024 45025var subtreeRenderLanes = NoLanes; 45026var subtreeRenderLanesCursor = createCursor(NoLanes); // Whether to root completed, errored, suspended, etc. 45027 45028var workInProgressRootExitStatus = RootInProgress; // A fatal error, if one is thrown 45029 45030var workInProgressRootFatalError = null; // "Included" lanes refer to lanes that were worked on during this render. It's 45031// slightly different than `renderLanes` because `renderLanes` can change as you 45032// enter and exit an Offscreen tree. This value is the combination of all render 45033// lanes for the entire render phase. 45034 45035var workInProgressRootIncludedLanes = NoLanes; // The work left over by components that were visited during this render. Only 45036// includes unprocessed updates, not work in bailed out children. 45037 45038var workInProgressRootSkippedLanes = NoLanes; // Lanes that were updated (in an interleaved event) during this render. 45039 45040var workInProgressRootInterleavedUpdatedLanes = NoLanes; // Lanes that were updated during the render phase (*not* an interleaved event). 45041 45042var workInProgressRootPingedLanes = NoLanes; // Errors that are thrown during the render phase. 45043 45044var workInProgressRootConcurrentErrors = null; // These are errors that we recovered from without surfacing them to the UI. 45045// We will log them once the tree commits. 45046 45047var workInProgressRootRecoverableErrors = null; // The most recent time we committed a fallback. This lets us ensure a train 45048// model where we don't commit new loading states in too quick succession. 45049 45050var globalMostRecentFallbackTime = 0; 45051var FALLBACK_THROTTLE_MS = 500; // The absolute time for when we should start giving up on rendering 45052// more and prefer CPU suspense heuristics instead. 45053 45054var workInProgressRootRenderTargetTime = Infinity; // How long a render is supposed to take before we start following CPU 45055// suspense heuristics and opt out of rendering more content. 45056 45057var RENDER_TIMEOUT_MS = 500; 45058var workInProgressTransitions = null; 45059 45060function resetRenderTimer() { 45061 workInProgressRootRenderTargetTime = now() + RENDER_TIMEOUT_MS; 45062} 45063 45064function getRenderTargetTime() { 45065 return workInProgressRootRenderTargetTime; 45066} 45067var hasUncaughtError = false; 45068var firstUncaughtError = null; 45069var legacyErrorBoundariesThatAlreadyFailed = null; // Only used when enableProfilerNestedUpdateScheduledHook is true; 45070var rootDoesHavePassiveEffects = false; 45071var rootWithPendingPassiveEffects = null; 45072var pendingPassiveEffectsLanes = NoLanes; 45073var pendingPassiveProfilerEffects = []; 45074var pendingPassiveTransitions = null; // Use these to prevent an infinite loop of nested updates 45075 45076var NESTED_UPDATE_LIMIT = 50; 45077var nestedUpdateCount = 0; 45078var rootWithNestedUpdates = null; 45079var isFlushingPassiveEffects = false; 45080var didScheduleUpdateDuringPassiveEffects = false; 45081var NESTED_PASSIVE_UPDATE_LIMIT = 50; 45082var nestedPassiveUpdateCount = 0; 45083var rootWithPassiveNestedUpdates = null; // If two updates are scheduled within the same event, we should treat their 45084// event times as simultaneous, even if the actual clock time has advanced 45085// between the first and second call. 45086 45087var currentEventTime = NoTimestamp; 45088var currentEventTransitionLane = NoLanes; 45089var isRunningInsertionEffect = false; 45090function getWorkInProgressRoot() { 45091 return workInProgressRoot; 45092} 45093function requestEventTime() { 45094 if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { 45095 // We're inside React, so it's fine to read the actual time. 45096 return now(); 45097 } // We're not inside React, so we may be in the middle of a browser event. 45098 45099 45100 if (currentEventTime !== NoTimestamp) { 45101 // Use the same start time for all updates until we enter React again. 45102 return currentEventTime; 45103 } // This is the first update since React yielded. Compute a new start time. 45104 45105 45106 currentEventTime = now(); 45107 return currentEventTime; 45108} 45109function requestUpdateLane(fiber) { 45110 // Special cases 45111 var mode = fiber.mode; 45112 45113 if ((mode & ConcurrentMode) === NoMode) { 45114 return SyncLane; 45115 } else if ( (executionContext & RenderContext) !== NoContext && workInProgressRootRenderLanes !== NoLanes) { 45116 // This is a render phase update. These are not officially supported. The 45117 // old behavior is to give this the same "thread" (lanes) as 45118 // whatever is currently rendering. So if you call `setState` on a component 45119 // that happens later in the same render, it will flush. Ideally, we want to 45120 // remove the special case and treat them as if they came from an 45121 // interleaved event. Regardless, this pattern is not officially supported. 45122 // This behavior is only a fallback. The flag only exists until we can roll 45123 // out the setState warning, since existing code might accidentally rely on 45124 // the current behavior. 45125 return pickArbitraryLane(workInProgressRootRenderLanes); 45126 } 45127 45128 var isTransition = requestCurrentTransition() !== NoTransition; 45129 45130 if (isTransition) { 45131 if ( ReactCurrentBatchConfig$3.transition !== null) { 45132 var transition = ReactCurrentBatchConfig$3.transition; 45133 45134 if (!transition._updatedFibers) { 45135 transition._updatedFibers = new Set(); 45136 } 45137 45138 transition._updatedFibers.add(fiber); 45139 } // The algorithm for assigning an update to a lane should be stable for all 45140 // updates at the same priority within the same event. To do this, the 45141 // inputs to the algorithm must be the same. 45142 // 45143 // The trick we use is to cache the first of each of these inputs within an 45144 // event. Then reset the cached values once we can be sure the event is 45145 // over. Our heuristic for that is whenever we enter a concurrent work loop. 45146 45147 45148 if (currentEventTransitionLane === NoLane) { 45149 // All transitions within the same event are assigned the same lane. 45150 currentEventTransitionLane = claimNextTransitionLane(); 45151 } 45152 45153 return currentEventTransitionLane; 45154 } // Updates originating inside certain React methods, like flushSync, have 45155 // their priority set by tracking it with a context variable. 45156 // 45157 // The opaque type returned by the host config is internally a lane, so we can 45158 // use that directly. 45159 // TODO: Move this type conversion to the event priority module. 45160 45161 45162 var updateLane = getCurrentUpdatePriority(); 45163 45164 if (updateLane !== NoLane) { 45165 return updateLane; 45166 } // This update originated outside React. Ask the host environment for an 45167 // appropriate priority, based on the type of event. 45168 // 45169 // The opaque type returned by the host config is internally a lane, so we can 45170 // use that directly. 45171 // TODO: Move this type conversion to the event priority module. 45172 45173 45174 var eventLane = getCurrentEventPriority(); 45175 return eventLane; 45176} 45177 45178function requestRetryLane(fiber) { 45179 // This is a fork of `requestUpdateLane` designed specifically for Suspense 45180 // "retries" â a special update that attempts to flip a Suspense boundary 45181 // from its placeholder state to its primary/resolved state. 45182 // Special cases 45183 var mode = fiber.mode; 45184 45185 if ((mode & ConcurrentMode) === NoMode) { 45186 return SyncLane; 45187 } 45188 45189 return claimNextRetryLane(); 45190} 45191 45192function scheduleUpdateOnFiber(root, fiber, lane, eventTime) { 45193 checkForNestedUpdates(); 45194 45195 { 45196 if (isRunningInsertionEffect) { 45197 error('useInsertionEffect must not schedule updates.'); 45198 } 45199 } 45200 45201 { 45202 if (isFlushingPassiveEffects) { 45203 didScheduleUpdateDuringPassiveEffects = true; 45204 } 45205 } // Mark that the root has a pending update. 45206 45207 45208 markRootUpdated(root, lane, eventTime); 45209 45210 if ((executionContext & RenderContext) !== NoLanes && root === workInProgressRoot) { 45211 // This update was dispatched during the render phase. This is a mistake 45212 // if the update originates from user space (with the exception of local 45213 // hook updates, which are handled differently and don't reach this 45214 // function), but there are some internal React features that use this as 45215 // an implementation detail, like selective hydration. 45216 warnAboutRenderPhaseUpdatesInDEV(fiber); // Track lanes that were updated during the render phase 45217 } else { 45218 // This is a normal update, scheduled from outside the render phase. For 45219 // example, during an input event. 45220 { 45221 if (isDevToolsPresent) { 45222 addFiberToLanesMap(root, fiber, lane); 45223 } 45224 } 45225 45226 warnIfUpdatesNotWrappedWithActDEV(fiber); 45227 45228 if (root === workInProgressRoot) { 45229 // Received an update to a tree that's in the middle of rendering. Mark 45230 // that there was an interleaved update work on this root. Unless the 45231 // `deferRenderPhaseUpdateToNextBatch` flag is off and this is a render 45232 // phase update. In that case, we don't treat render phase updates as if 45233 // they were interleaved, for backwards compat reasons. 45234 if ( (executionContext & RenderContext) === NoContext) { 45235 workInProgressRootInterleavedUpdatedLanes = mergeLanes(workInProgressRootInterleavedUpdatedLanes, lane); 45236 } 45237 45238 if (workInProgressRootExitStatus === RootSuspendedWithDelay) { 45239 // The root already suspended with a delay, which means this render 45240 // definitely won't finish. Since we have a new update, let's mark it as 45241 // suspended now, right before marking the incoming update. This has the 45242 // effect of interrupting the current render and switching to the update. 45243 // TODO: Make sure this doesn't override pings that happen while we've 45244 // already started rendering. 45245 markRootSuspended$1(root, workInProgressRootRenderLanes); 45246 } 45247 } 45248 45249 ensureRootIsScheduled(root, eventTime); 45250 45251 if (lane === SyncLane && executionContext === NoContext && (fiber.mode & ConcurrentMode) === NoMode && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. 45252 !( ReactCurrentActQueue$1.isBatchingLegacy)) { 45253 // Flush the synchronous work now, unless we're already working or inside 45254 // a batch. This is intentionally inside scheduleUpdateOnFiber instead of 45255 // scheduleCallbackForFiber to preserve the ability to schedule a callback 45256 // without immediately flushing it. We only do this for user-initiated 45257 // updates, to preserve historical behavior of legacy mode. 45258 resetRenderTimer(); 45259 flushSyncCallbacksOnlyInLegacyMode(); 45260 } 45261 } 45262} 45263function scheduleInitialHydrationOnRoot(root, lane, eventTime) { 45264 // This is a special fork of scheduleUpdateOnFiber that is only used to 45265 // schedule the initial hydration of a root that has just been created. Most 45266 // of the stuff in scheduleUpdateOnFiber can be skipped. 45267 // 45268 // The main reason for this separate path, though, is to distinguish the 45269 // initial children from subsequent updates. In fully client-rendered roots 45270 // (createRoot instead of hydrateRoot), all top-level renders are modeled as 45271 // updates, but hydration roots are special because the initial render must 45272 // match what was rendered on the server. 45273 var current = root.current; 45274 current.lanes = lane; 45275 markRootUpdated(root, lane, eventTime); 45276 ensureRootIsScheduled(root, eventTime); 45277} 45278function isUnsafeClassRenderPhaseUpdate(fiber) { 45279 // Check if this is a render phase update. Only called by class components, 45280 // which special (deprecated) behavior for UNSAFE_componentWillReceive props. 45281 return (// TODO: Remove outdated deferRenderPhaseUpdateToNextBatch experiment. We 45282 // decided not to enable it. 45283 (executionContext & RenderContext) !== NoContext 45284 ); 45285} // Use this function to schedule a task for a root. There's only one task per 45286// root; if a task was already scheduled, we'll check to make sure the priority 45287// of the existing task is the same as the priority of the next level that the 45288// root has work on. This function is called on every update, and right before 45289// exiting a task. 45290 45291function ensureRootIsScheduled(root, currentTime) { 45292 var existingCallbackNode = root.callbackNode; // Check if any lanes are being starved by other work. If so, mark them as 45293 // expired so we know to work on those next. 45294 45295 markStarvedLanesAsExpired(root, currentTime); // Determine the next lanes to work on, and their priority. 45296 45297 var nextLanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); 45298 45299 if (nextLanes === NoLanes) { 45300 // Special case: There's nothing to work on. 45301 if (existingCallbackNode !== null) { 45302 cancelCallback$1(existingCallbackNode); 45303 } 45304 45305 root.callbackNode = null; 45306 root.callbackPriority = NoLane; 45307 return; 45308 } // We use the highest priority lane to represent the priority of the callback. 45309 45310 45311 var newCallbackPriority = getHighestPriorityLane(nextLanes); // Check if there's an existing task. We may be able to reuse it. 45312 45313 var existingCallbackPriority = root.callbackPriority; 45314 45315 if (existingCallbackPriority === newCallbackPriority && // Special case related to `act`. If the currently scheduled task is a 45316 // Scheduler task, rather than an `act` task, cancel it and re-scheduled 45317 // on the `act` queue. 45318 !( ReactCurrentActQueue$1.current !== null && existingCallbackNode !== fakeActCallbackNode)) { 45319 { 45320 // If we're going to re-use an existing task, it needs to exist. 45321 // Assume that discrete update microtasks are non-cancellable and null. 45322 // TODO: Temporary until we confirm this warning is not fired. 45323 if (existingCallbackNode == null && existingCallbackPriority !== SyncLane) { 45324 error('Expected scheduled callback to exist. This error is likely caused by a bug in React. Please file an issue.'); 45325 } 45326 } // The priority hasn't changed. We can reuse the existing task. Exit. 45327 45328 45329 return; 45330 } 45331 45332 if (existingCallbackNode != null) { 45333 // Cancel the existing callback. We'll schedule a new one below. 45334 cancelCallback$1(existingCallbackNode); 45335 } // Schedule a new callback. 45336 45337 45338 var newCallbackNode; 45339 45340 if (newCallbackPriority === SyncLane) { 45341 // Special case: Sync React callbacks are scheduled on a special 45342 // internal queue 45343 if (root.tag === LegacyRoot) { 45344 if ( ReactCurrentActQueue$1.isBatchingLegacy !== null) { 45345 ReactCurrentActQueue$1.didScheduleLegacyUpdate = true; 45346 } 45347 45348 scheduleLegacySyncCallback(performSyncWorkOnRoot.bind(null, root)); 45349 } else { 45350 scheduleSyncCallback(performSyncWorkOnRoot.bind(null, root)); 45351 } 45352 45353 { 45354 // Flush the queue in a microtask. 45355 if ( ReactCurrentActQueue$1.current !== null) { 45356 // Inside `act`, use our internal `act` queue so that these get flushed 45357 // at the end of the current scope even when using the sync version 45358 // of `act`. 45359 ReactCurrentActQueue$1.current.push(flushSyncCallbacks); 45360 } else { 45361 scheduleMicrotask(function () { 45362 // In Safari, appending an iframe forces microtasks to run. 45363 // https://github.com/facebook/react/issues/22459 45364 // We don't support running callbacks in the middle of render 45365 // or commit so we need to check against that. 45366 if ((executionContext & (RenderContext | CommitContext)) === NoContext) { 45367 // Note that this would still prematurely flush the callbacks 45368 // if this happens outside render or commit phase (e.g. in an event). 45369 flushSyncCallbacks(); 45370 } 45371 }); 45372 } 45373 } 45374 45375 newCallbackNode = null; 45376 } else { 45377 var schedulerPriorityLevel; 45378 45379 switch (lanesToEventPriority(nextLanes)) { 45380 case DiscreteEventPriority: 45381 schedulerPriorityLevel = ImmediatePriority; 45382 break; 45383 45384 case ContinuousEventPriority: 45385 schedulerPriorityLevel = UserBlockingPriority; 45386 break; 45387 45388 case DefaultEventPriority: 45389 schedulerPriorityLevel = NormalPriority; 45390 break; 45391 45392 case IdleEventPriority: 45393 schedulerPriorityLevel = IdlePriority; 45394 break; 45395 45396 default: 45397 schedulerPriorityLevel = NormalPriority; 45398 break; 45399 } 45400 45401 newCallbackNode = scheduleCallback$1(schedulerPriorityLevel, performConcurrentWorkOnRoot.bind(null, root)); 45402 } 45403 45404 root.callbackPriority = newCallbackPriority; 45405 root.callbackNode = newCallbackNode; 45406} // This is the entry point for every concurrent task, i.e. anything that 45407// goes through Scheduler. 45408 45409 45410function performConcurrentWorkOnRoot(root, didTimeout) { 45411 { 45412 resetNestedUpdateFlag(); 45413 } // Since we know we're in a React event, we can clear the current 45414 // event time. The next update will compute a new event time. 45415 45416 45417 currentEventTime = NoTimestamp; 45418 currentEventTransitionLane = NoLanes; 45419 45420 if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { 45421 throw new Error('Should not already be working.'); 45422 } // Flush any pending passive effects before deciding which lanes to work on, 45423 // in case they schedule additional work. 45424 45425 45426 var originalCallbackNode = root.callbackNode; 45427 var didFlushPassiveEffects = flushPassiveEffects(); 45428 45429 if (didFlushPassiveEffects) { 45430 // Something in the passive effect phase may have canceled the current task. 45431 // Check if the task node for this root was changed. 45432 if (root.callbackNode !== originalCallbackNode) { 45433 // The current task was canceled. Exit. We don't need to call 45434 // `ensureRootIsScheduled` because the check above implies either that 45435 // there's a new task, or that there's no remaining work on this root. 45436 return null; 45437 } 45438 } // Determine the next lanes to work on, using the fields stored 45439 // on the root. 45440 45441 45442 var lanes = getNextLanes(root, root === workInProgressRoot ? workInProgressRootRenderLanes : NoLanes); 45443 45444 if (lanes === NoLanes) { 45445 // Defensive coding. This is never expected to happen. 45446 return null; 45447 } // We disable time-slicing in some cases: if the work has been CPU-bound 45448 // for too long ("expired" work, to prevent starvation), or we're in 45449 // sync-updates-by-default mode. 45450 // TODO: We only check `didTimeout` defensively, to account for a Scheduler 45451 // bug we're still investigating. Once the bug in Scheduler is fixed, 45452 // we can remove this, since we track expiration ourselves. 45453 45454 45455 var shouldTimeSlice = !includesBlockingLane(root, lanes) && !includesExpiredLane(root, lanes) && ( !didTimeout); 45456 var exitStatus = shouldTimeSlice ? renderRootConcurrent(root, lanes) : renderRootSync(root, lanes); 45457 45458 if (exitStatus !== RootInProgress) { 45459 if (exitStatus === RootErrored) { 45460 // If something threw an error, try rendering one more time. We'll 45461 // render synchronously to block concurrent data mutations, and we'll 45462 // includes all pending updates are included. If it still fails after 45463 // the second attempt, we'll give up and commit the resulting tree. 45464 var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 45465 45466 if (errorRetryLanes !== NoLanes) { 45467 lanes = errorRetryLanes; 45468 exitStatus = recoverFromConcurrentError(root, errorRetryLanes); 45469 } 45470 } 45471 45472 if (exitStatus === RootFatalErrored) { 45473 var fatalError = workInProgressRootFatalError; 45474 prepareFreshStack(root, NoLanes); 45475 markRootSuspended$1(root, lanes); 45476 ensureRootIsScheduled(root, now()); 45477 throw fatalError; 45478 } 45479 45480 if (exitStatus === RootDidNotComplete) { 45481 // The render unwound without completing the tree. This happens in special 45482 // cases where need to exit the current render without producing a 45483 // consistent tree or committing. 45484 // 45485 // This should only happen during a concurrent render, not a discrete or 45486 // synchronous update. We should have already checked for this when we 45487 // unwound the stack. 45488 markRootSuspended$1(root, lanes); 45489 } else { 45490 // The render completed. 45491 // Check if this render may have yielded to a concurrent event, and if so, 45492 // confirm that any newly rendered stores are consistent. 45493 // TODO: It's possible that even a concurrent render may never have yielded 45494 // to the main thread, if it was fast enough, or if it expired. We could 45495 // skip the consistency check in that case, too. 45496 var renderWasConcurrent = !includesBlockingLane(root, lanes); 45497 var finishedWork = root.current.alternate; 45498 45499 if (renderWasConcurrent && !isRenderConsistentWithExternalStores(finishedWork)) { 45500 // A store was mutated in an interleaved event. Render again, 45501 // synchronously, to block further mutations. 45502 exitStatus = renderRootSync(root, lanes); // We need to check again if something threw 45503 45504 if (exitStatus === RootErrored) { 45505 var _errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 45506 45507 if (_errorRetryLanes !== NoLanes) { 45508 lanes = _errorRetryLanes; 45509 exitStatus = recoverFromConcurrentError(root, _errorRetryLanes); // We assume the tree is now consistent because we didn't yield to any 45510 // concurrent events. 45511 } 45512 } 45513 45514 if (exitStatus === RootFatalErrored) { 45515 var _fatalError = workInProgressRootFatalError; 45516 prepareFreshStack(root, NoLanes); 45517 markRootSuspended$1(root, lanes); 45518 ensureRootIsScheduled(root, now()); 45519 throw _fatalError; 45520 } 45521 } // We now have a consistent tree. The next step is either to commit it, 45522 // or, if something suspended, wait to commit it after a timeout. 45523 45524 45525 root.finishedWork = finishedWork; 45526 root.finishedLanes = lanes; 45527 finishConcurrentRender(root, exitStatus, lanes); 45528 } 45529 } 45530 45531 ensureRootIsScheduled(root, now()); 45532 45533 if (root.callbackNode === originalCallbackNode) { 45534 // The task node scheduled for this root is the same one that's 45535 // currently executed. Need to return a continuation. 45536 return performConcurrentWorkOnRoot.bind(null, root); 45537 } 45538 45539 return null; 45540} 45541 45542function recoverFromConcurrentError(root, errorRetryLanes) { 45543 // If an error occurred during hydration, discard server response and fall 45544 // back to client side render. 45545 // Before rendering again, save the errors from the previous attempt. 45546 var errorsFromFirstAttempt = workInProgressRootConcurrentErrors; 45547 45548 if (isRootDehydrated(root)) { 45549 // The shell failed to hydrate. Set a flag to force a client rendering 45550 // during the next attempt. To do this, we call prepareFreshStack now 45551 // to create the root work-in-progress fiber. This is a bit weird in terms 45552 // of factoring, because it relies on renderRootSync not calling 45553 // prepareFreshStack again in the call below, which happens because the 45554 // root and lanes haven't changed. 45555 // 45556 // TODO: I think what we should do is set ForceClientRender inside 45557 // throwException, like we do for nested Suspense boundaries. The reason 45558 // it's here instead is so we can switch to the synchronous work loop, too. 45559 // Something to consider for a future refactor. 45560 var rootWorkInProgress = prepareFreshStack(root, errorRetryLanes); 45561 rootWorkInProgress.flags |= ForceClientRender; 45562 45563 { 45564 errorHydratingContainer(root.containerInfo); 45565 } 45566 } 45567 45568 var exitStatus = renderRootSync(root, errorRetryLanes); 45569 45570 if (exitStatus !== RootErrored) { 45571 // Successfully finished rendering on retry 45572 // The errors from the failed first attempt have been recovered. Add 45573 // them to the collection of recoverable errors. We'll log them in the 45574 // commit phase. 45575 var errorsFromSecondAttempt = workInProgressRootRecoverableErrors; 45576 workInProgressRootRecoverableErrors = errorsFromFirstAttempt; // The errors from the second attempt should be queued after the errors 45577 // from the first attempt, to preserve the causal sequence. 45578 45579 if (errorsFromSecondAttempt !== null) { 45580 queueRecoverableErrors(errorsFromSecondAttempt); 45581 } 45582 } 45583 45584 return exitStatus; 45585} 45586 45587function queueRecoverableErrors(errors) { 45588 if (workInProgressRootRecoverableErrors === null) { 45589 workInProgressRootRecoverableErrors = errors; 45590 } else { 45591 workInProgressRootRecoverableErrors.push.apply(workInProgressRootRecoverableErrors, errors); 45592 } 45593} 45594 45595function finishConcurrentRender(root, exitStatus, lanes) { 45596 switch (exitStatus) { 45597 case RootInProgress: 45598 case RootFatalErrored: 45599 { 45600 throw new Error('Root did not complete. This is a bug in React.'); 45601 } 45602 // Flow knows about invariant, so it complains if I add a break 45603 // statement, but eslint doesn't know about invariant, so it complains 45604 // if I do. eslint-disable-next-line no-fallthrough 45605 45606 case RootErrored: 45607 { 45608 // We should have already attempted to retry this tree. If we reached 45609 // this point, it errored again. Commit it. 45610 commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); 45611 break; 45612 } 45613 45614 case RootSuspended: 45615 { 45616 markRootSuspended$1(root, lanes); // We have an acceptable loading state. We need to figure out if we 45617 // should immediately commit it or wait a bit. 45618 45619 if (includesOnlyRetries(lanes) && // do not delay if we're inside an act() scope 45620 !shouldForceFlushFallbacksInDEV()) { 45621 // This render only included retries, no updates. Throttle committing 45622 // retries so that we don't show too many loading states too quickly. 45623 var msUntilTimeout = globalMostRecentFallbackTime + FALLBACK_THROTTLE_MS - now(); // Don't bother with a very short suspense time. 45624 45625 if (msUntilTimeout > 10) { 45626 var nextLanes = getNextLanes(root, NoLanes); 45627 45628 if (nextLanes !== NoLanes) { 45629 // There's additional work on this root. 45630 break; 45631 } 45632 45633 var suspendedLanes = root.suspendedLanes; 45634 45635 if (!isSubsetOfLanes(suspendedLanes, lanes)) { 45636 // We should prefer to render the fallback of at the last 45637 // suspended level. Ping the last suspended level to try 45638 // rendering it again. 45639 // FIXME: What if the suspended lanes are Idle? Should not restart. 45640 var eventTime = requestEventTime(); 45641 markRootPinged(root, suspendedLanes); 45642 break; 45643 } // The render is suspended, it hasn't timed out, and there's no 45644 // lower priority work to do. Instead of committing the fallback 45645 // immediately, wait for more data to arrive. 45646 45647 45648 root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root, workInProgressRootRecoverableErrors, workInProgressTransitions), msUntilTimeout); 45649 break; 45650 } 45651 } // The work expired. Commit immediately. 45652 45653 45654 commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); 45655 break; 45656 } 45657 45658 case RootSuspendedWithDelay: 45659 { 45660 markRootSuspended$1(root, lanes); 45661 45662 if (includesOnlyTransitions(lanes)) { 45663 // This is a transition, so we should exit without committing a 45664 // placeholder and without scheduling a timeout. Delay indefinitely 45665 // until we receive more data. 45666 break; 45667 } 45668 45669 if (!shouldForceFlushFallbacksInDEV()) { 45670 // This is not a transition, but we did trigger an avoided state. 45671 // Schedule a placeholder to display after a short delay, using the Just 45672 // Noticeable Difference. 45673 // TODO: Is the JND optimization worth the added complexity? If this is 45674 // the only reason we track the event time, then probably not. 45675 // Consider removing. 45676 var mostRecentEventTime = getMostRecentEventTime(root, lanes); 45677 var eventTimeMs = mostRecentEventTime; 45678 var timeElapsedMs = now() - eventTimeMs; 45679 45680 var _msUntilTimeout = jnd(timeElapsedMs) - timeElapsedMs; // Don't bother with a very short suspense time. 45681 45682 45683 if (_msUntilTimeout > 10) { 45684 // Instead of committing the fallback immediately, wait for more data 45685 // to arrive. 45686 root.timeoutHandle = scheduleTimeout(commitRoot.bind(null, root, workInProgressRootRecoverableErrors, workInProgressTransitions), _msUntilTimeout); 45687 break; 45688 } 45689 } // Commit the placeholder. 45690 45691 45692 commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); 45693 break; 45694 } 45695 45696 case RootCompleted: 45697 { 45698 // The work completed. Ready to commit. 45699 commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); 45700 break; 45701 } 45702 45703 default: 45704 { 45705 throw new Error('Unknown root exit status.'); 45706 } 45707 } 45708} 45709 45710function isRenderConsistentWithExternalStores(finishedWork) { 45711 // Search the rendered tree for external store reads, and check whether the 45712 // stores were mutated in a concurrent event. Intentionally using an iterative 45713 // loop instead of recursion so we can exit early. 45714 var node = finishedWork; 45715 45716 while (true) { 45717 if (node.flags & StoreConsistency) { 45718 var updateQueue = node.updateQueue; 45719 45720 if (updateQueue !== null) { 45721 var checks = updateQueue.stores; 45722 45723 if (checks !== null) { 45724 for (var i = 0; i < checks.length; i++) { 45725 var check = checks[i]; 45726 var getSnapshot = check.getSnapshot; 45727 var renderedValue = check.value; 45728 45729 try { 45730 if (!objectIs(getSnapshot(), renderedValue)) { 45731 // Found an inconsistent store. 45732 return false; 45733 } 45734 } catch (error) { 45735 // If `getSnapshot` throws, return `false`. This will schedule 45736 // a re-render, and the error will be rethrown during render. 45737 return false; 45738 } 45739 } 45740 } 45741 } 45742 } 45743 45744 var child = node.child; 45745 45746 if (node.subtreeFlags & StoreConsistency && child !== null) { 45747 child.return = node; 45748 node = child; 45749 continue; 45750 } 45751 45752 if (node === finishedWork) { 45753 return true; 45754 } 45755 45756 while (node.sibling === null) { 45757 if (node.return === null || node.return === finishedWork) { 45758 return true; 45759 } 45760 45761 node = node.return; 45762 } 45763 45764 node.sibling.return = node.return; 45765 node = node.sibling; 45766 } // Flow doesn't know this is unreachable, but eslint does 45767 // eslint-disable-next-line no-unreachable 45768 45769 45770 return true; 45771} 45772 45773function markRootSuspended$1(root, suspendedLanes) { 45774 // When suspending, we should always exclude lanes that were pinged or (more 45775 // rarely, since we try to avoid it) updated during the render phase. 45776 // TODO: Lol maybe there's a better way to factor this besides this 45777 // obnoxiously named function :) 45778 suspendedLanes = removeLanes(suspendedLanes, workInProgressRootPingedLanes); 45779 suspendedLanes = removeLanes(suspendedLanes, workInProgressRootInterleavedUpdatedLanes); 45780 markRootSuspended(root, suspendedLanes); 45781} // This is the entry point for synchronous tasks that don't go 45782// through Scheduler 45783 45784 45785function performSyncWorkOnRoot(root) { 45786 { 45787 syncNestedUpdateFlag(); 45788 } 45789 45790 if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { 45791 throw new Error('Should not already be working.'); 45792 } 45793 45794 flushPassiveEffects(); 45795 var lanes = getNextLanes(root, NoLanes); 45796 45797 if (!includesSomeLane(lanes, SyncLane)) { 45798 // There's no remaining sync work left. 45799 ensureRootIsScheduled(root, now()); 45800 return null; 45801 } 45802 45803 var exitStatus = renderRootSync(root, lanes); 45804 45805 if (root.tag !== LegacyRoot && exitStatus === RootErrored) { 45806 // If something threw an error, try rendering one more time. We'll render 45807 // synchronously to block concurrent data mutations, and we'll includes 45808 // all pending updates are included. If it still fails after the second 45809 // attempt, we'll give up and commit the resulting tree. 45810 var errorRetryLanes = getLanesToRetrySynchronouslyOnError(root); 45811 45812 if (errorRetryLanes !== NoLanes) { 45813 lanes = errorRetryLanes; 45814 exitStatus = recoverFromConcurrentError(root, errorRetryLanes); 45815 } 45816 } 45817 45818 if (exitStatus === RootFatalErrored) { 45819 var fatalError = workInProgressRootFatalError; 45820 prepareFreshStack(root, NoLanes); 45821 markRootSuspended$1(root, lanes); 45822 ensureRootIsScheduled(root, now()); 45823 throw fatalError; 45824 } 45825 45826 if (exitStatus === RootDidNotComplete) { 45827 throw new Error('Root did not complete. This is a bug in React.'); 45828 } // We now have a consistent tree. Because this is a sync render, we 45829 // will commit it even if something suspended. 45830 45831 45832 var finishedWork = root.current.alternate; 45833 root.finishedWork = finishedWork; 45834 root.finishedLanes = lanes; 45835 commitRoot(root, workInProgressRootRecoverableErrors, workInProgressTransitions); // Before exiting, make sure there's a callback scheduled for the next 45836 // pending level. 45837 45838 ensureRootIsScheduled(root, now()); 45839 return null; 45840} 45841 45842function flushRoot(root, lanes) { 45843 if (lanes !== NoLanes) { 45844 markRootEntangled(root, mergeLanes(lanes, SyncLane)); 45845 ensureRootIsScheduled(root, now()); 45846 45847 if ((executionContext & (RenderContext | CommitContext)) === NoContext) { 45848 resetRenderTimer(); 45849 flushSyncCallbacks(); 45850 } 45851 } 45852} 45853function batchedUpdates$1(fn, a) { 45854 var prevExecutionContext = executionContext; 45855 executionContext |= BatchedContext; 45856 45857 try { 45858 return fn(a); 45859 } finally { 45860 executionContext = prevExecutionContext; // If there were legacy sync updates, flush them at the end of the outer 45861 // most batchedUpdates-like method. 45862 45863 if (executionContext === NoContext && // Treat `act` as if it's inside `batchedUpdates`, even in legacy mode. 45864 !( ReactCurrentActQueue$1.isBatchingLegacy)) { 45865 resetRenderTimer(); 45866 flushSyncCallbacksOnlyInLegacyMode(); 45867 } 45868 } 45869} 45870function discreteUpdates(fn, a, b, c, d) { 45871 var previousPriority = getCurrentUpdatePriority(); 45872 var prevTransition = ReactCurrentBatchConfig$3.transition; 45873 45874 try { 45875 ReactCurrentBatchConfig$3.transition = null; 45876 setCurrentUpdatePriority(DiscreteEventPriority); 45877 return fn(a, b, c, d); 45878 } finally { 45879 setCurrentUpdatePriority(previousPriority); 45880 ReactCurrentBatchConfig$3.transition = prevTransition; 45881 45882 if (executionContext === NoContext) { 45883 resetRenderTimer(); 45884 } 45885 } 45886} // Overload the definition to the two valid signatures. 45887// Warning, this opts-out of checking the function body. 45888 45889// eslint-disable-next-line no-redeclare 45890function flushSync(fn) { 45891 // In legacy mode, we flush pending passive effects at the beginning of the 45892 // next event, not at the end of the previous one. 45893 if (rootWithPendingPassiveEffects !== null && rootWithPendingPassiveEffects.tag === LegacyRoot && (executionContext & (RenderContext | CommitContext)) === NoContext) { 45894 flushPassiveEffects(); 45895 } 45896 45897 var prevExecutionContext = executionContext; 45898 executionContext |= BatchedContext; 45899 var prevTransition = ReactCurrentBatchConfig$3.transition; 45900 var previousPriority = getCurrentUpdatePriority(); 45901 45902 try { 45903 ReactCurrentBatchConfig$3.transition = null; 45904 setCurrentUpdatePriority(DiscreteEventPriority); 45905 45906 if (fn) { 45907 return fn(); 45908 } else { 45909 return undefined; 45910 } 45911 } finally { 45912 setCurrentUpdatePriority(previousPriority); 45913 ReactCurrentBatchConfig$3.transition = prevTransition; 45914 executionContext = prevExecutionContext; // Flush the immediate callbacks that were scheduled during this batch. 45915 // Note that this will happen even if batchedUpdates is higher up 45916 // the stack. 45917 45918 if ((executionContext & (RenderContext | CommitContext)) === NoContext) { 45919 flushSyncCallbacks(); 45920 } 45921 } 45922} 45923function isAlreadyRendering() { 45924 // Used by the renderer to print a warning if certain APIs are called from 45925 // the wrong context. 45926 return (executionContext & (RenderContext | CommitContext)) !== NoContext; 45927} 45928function pushRenderLanes(fiber, lanes) { 45929 push(subtreeRenderLanesCursor, subtreeRenderLanes, fiber); 45930 subtreeRenderLanes = mergeLanes(subtreeRenderLanes, lanes); 45931 workInProgressRootIncludedLanes = mergeLanes(workInProgressRootIncludedLanes, lanes); 45932} 45933function popRenderLanes(fiber) { 45934 subtreeRenderLanes = subtreeRenderLanesCursor.current; 45935 pop(subtreeRenderLanesCursor, fiber); 45936} 45937 45938function prepareFreshStack(root, lanes) { 45939 root.finishedWork = null; 45940 root.finishedLanes = NoLanes; 45941 var timeoutHandle = root.timeoutHandle; 45942 45943 if (timeoutHandle !== noTimeout) { 45944 // The root previous suspended and scheduled a timeout to commit a fallback 45945 // state. Now that we have additional work, cancel the timeout. 45946 root.timeoutHandle = noTimeout; // $FlowFixMe Complains noTimeout is not a TimeoutID, despite the check above 45947 45948 cancelTimeout(timeoutHandle); 45949 } 45950 45951 if (workInProgress !== null) { 45952 var interruptedWork = workInProgress.return; 45953 45954 while (interruptedWork !== null) { 45955 var current = interruptedWork.alternate; 45956 unwindInterruptedWork(current, interruptedWork); 45957 interruptedWork = interruptedWork.return; 45958 } 45959 } 45960 45961 workInProgressRoot = root; 45962 var rootWorkInProgress = createWorkInProgress(root.current, null); 45963 workInProgress = rootWorkInProgress; 45964 workInProgressRootRenderLanes = subtreeRenderLanes = workInProgressRootIncludedLanes = lanes; 45965 workInProgressRootExitStatus = RootInProgress; 45966 workInProgressRootFatalError = null; 45967 workInProgressRootSkippedLanes = NoLanes; 45968 workInProgressRootInterleavedUpdatedLanes = NoLanes; 45969 workInProgressRootPingedLanes = NoLanes; 45970 workInProgressRootConcurrentErrors = null; 45971 workInProgressRootRecoverableErrors = null; 45972 finishQueueingConcurrentUpdates(); 45973 45974 { 45975 ReactStrictModeWarnings.discardPendingWarnings(); 45976 } 45977 45978 return rootWorkInProgress; 45979} 45980 45981function handleError(root, thrownValue) { 45982 do { 45983 var erroredWork = workInProgress; 45984 45985 try { 45986 // Reset module-level state that was set during the render phase. 45987 resetContextDependencies(); 45988 resetHooksAfterThrow(); 45989 resetCurrentFiber(); // TODO: I found and added this missing line while investigating a 45990 // separate issue. Write a regression test using string refs. 45991 45992 ReactCurrentOwner$2.current = null; 45993 45994 if (erroredWork === null || erroredWork.return === null) { 45995 // Expected to be working on a non-root fiber. This is a fatal error 45996 // because there's no ancestor that can handle it; the root is 45997 // supposed to capture all errors that weren't caught by an error 45998 // boundary. 45999 workInProgressRootExitStatus = RootFatalErrored; 46000 workInProgressRootFatalError = thrownValue; // Set `workInProgress` to null. This represents advancing to the next 46001 // sibling, or the parent if there are no siblings. But since the root 46002 // has no siblings nor a parent, we set it to null. Usually this is 46003 // handled by `completeUnitOfWork` or `unwindWork`, but since we're 46004 // intentionally not calling those, we need set it here. 46005 // TODO: Consider calling `unwindWork` to pop the contexts. 46006 46007 workInProgress = null; 46008 return; 46009 } 46010 46011 if (enableProfilerTimer && erroredWork.mode & ProfileMode) { 46012 // Record the time spent rendering before an error was thrown. This 46013 // avoids inaccurate Profiler durations in the case of a 46014 // suspended render. 46015 stopProfilerTimerIfRunningAndRecordDelta(erroredWork, true); 46016 } 46017 46018 if (enableSchedulingProfiler) { 46019 markComponentRenderStopped(); 46020 46021 if (thrownValue !== null && typeof thrownValue === 'object' && typeof thrownValue.then === 'function') { 46022 var wakeable = thrownValue; 46023 markComponentSuspended(erroredWork, wakeable, workInProgressRootRenderLanes); 46024 } else { 46025 markComponentErrored(erroredWork, thrownValue, workInProgressRootRenderLanes); 46026 } 46027 } 46028 46029 throwException(root, erroredWork.return, erroredWork, thrownValue, workInProgressRootRenderLanes); 46030 completeUnitOfWork(erroredWork); 46031 } catch (yetAnotherThrownValue) { 46032 // Something in the return path also threw. 46033 thrownValue = yetAnotherThrownValue; 46034 46035 if (workInProgress === erroredWork && erroredWork !== null) { 46036 // If this boundary has already errored, then we had trouble processing 46037 // the error. Bubble it to the next boundary. 46038 erroredWork = erroredWork.return; 46039 workInProgress = erroredWork; 46040 } else { 46041 erroredWork = workInProgress; 46042 } 46043 46044 continue; 46045 } // Return to the normal work loop. 46046 46047 46048 return; 46049 } while (true); 46050} 46051 46052function pushDispatcher() { 46053 var prevDispatcher = ReactCurrentDispatcher$2.current; 46054 ReactCurrentDispatcher$2.current = ContextOnlyDispatcher; 46055 46056 if (prevDispatcher === null) { 46057 // The React isomorphic package does not include a default dispatcher. 46058 // Instead the first renderer will lazily attach one, in order to give 46059 // nicer error messages. 46060 return ContextOnlyDispatcher; 46061 } else { 46062 return prevDispatcher; 46063 } 46064} 46065 46066function popDispatcher(prevDispatcher) { 46067 ReactCurrentDispatcher$2.current = prevDispatcher; 46068} 46069 46070function markCommitTimeOfFallback() { 46071 globalMostRecentFallbackTime = now(); 46072} 46073function markSkippedUpdateLanes(lane) { 46074 workInProgressRootSkippedLanes = mergeLanes(lane, workInProgressRootSkippedLanes); 46075} 46076function renderDidSuspend() { 46077 if (workInProgressRootExitStatus === RootInProgress) { 46078 workInProgressRootExitStatus = RootSuspended; 46079 } 46080} 46081function renderDidSuspendDelayIfPossible() { 46082 if (workInProgressRootExitStatus === RootInProgress || workInProgressRootExitStatus === RootSuspended || workInProgressRootExitStatus === RootErrored) { 46083 workInProgressRootExitStatus = RootSuspendedWithDelay; 46084 } // Check if there are updates that we skipped tree that might have unblocked 46085 // this render. 46086 46087 46088 if (workInProgressRoot !== null && (includesNonIdleWork(workInProgressRootSkippedLanes) || includesNonIdleWork(workInProgressRootInterleavedUpdatedLanes))) { 46089 // Mark the current render as suspended so that we switch to working on 46090 // the updates that were skipped. Usually we only suspend at the end of 46091 // the render phase. 46092 // TODO: We should probably always mark the root as suspended immediately 46093 // (inside this function), since by suspending at the end of the render 46094 // phase introduces a potential mistake where we suspend lanes that were 46095 // pinged or updated while we were rendering. 46096 markRootSuspended$1(workInProgressRoot, workInProgressRootRenderLanes); 46097 } 46098} 46099function renderDidError(error) { 46100 if (workInProgressRootExitStatus !== RootSuspendedWithDelay) { 46101 workInProgressRootExitStatus = RootErrored; 46102 } 46103 46104 if (workInProgressRootConcurrentErrors === null) { 46105 workInProgressRootConcurrentErrors = [error]; 46106 } else { 46107 workInProgressRootConcurrentErrors.push(error); 46108 } 46109} // Called during render to determine if anything has suspended. 46110// Returns false if we're not sure. 46111 46112function renderHasNotSuspendedYet() { 46113 // If something errored or completed, we can't really be sure, 46114 // so those are false. 46115 return workInProgressRootExitStatus === RootInProgress; 46116} 46117 46118function renderRootSync(root, lanes) { 46119 var prevExecutionContext = executionContext; 46120 executionContext |= RenderContext; 46121 var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack 46122 // and prepare a fresh one. Otherwise we'll continue where we left off. 46123 46124 if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { 46125 { 46126 if (isDevToolsPresent) { 46127 var memoizedUpdaters = root.memoizedUpdaters; 46128 46129 if (memoizedUpdaters.size > 0) { 46130 restorePendingUpdaters(root, workInProgressRootRenderLanes); 46131 memoizedUpdaters.clear(); 46132 } // At this point, move Fibers that scheduled the upcoming work from the Map to the Set. 46133 // If we bailout on this work, we'll move them back (like above). 46134 // It's important to move them now in case the work spawns more work at the same priority with different updaters. 46135 // That way we can keep the current update and future updates separate. 46136 46137 46138 movePendingFibersToMemoized(root, lanes); 46139 } 46140 } 46141 46142 workInProgressTransitions = getTransitionsForLanes(); 46143 prepareFreshStack(root, lanes); 46144 } 46145 46146 { 46147 markRenderStarted(lanes); 46148 } 46149 46150 do { 46151 try { 46152 workLoopSync(); 46153 break; 46154 } catch (thrownValue) { 46155 handleError(root, thrownValue); 46156 } 46157 } while (true); 46158 46159 resetContextDependencies(); 46160 executionContext = prevExecutionContext; 46161 popDispatcher(prevDispatcher); 46162 46163 if (workInProgress !== null) { 46164 // This is a sync render, so we should have finished the whole tree. 46165 throw new Error('Cannot commit an incomplete root. This error is likely caused by a ' + 'bug in React. Please file an issue.'); 46166 } 46167 46168 { 46169 markRenderStopped(); 46170 } // Set this to null to indicate there's no in-progress render. 46171 46172 46173 workInProgressRoot = null; 46174 workInProgressRootRenderLanes = NoLanes; 46175 return workInProgressRootExitStatus; 46176} // The work loop is an extremely hot path. Tell Closure not to inline it. 46177 46178/** @noinline */ 46179 46180 46181function workLoopSync() { 46182 // Already timed out, so perform work without checking if we need to yield. 46183 while (workInProgress !== null) { 46184 performUnitOfWork(workInProgress); 46185 } 46186} 46187 46188function renderRootConcurrent(root, lanes) { 46189 var prevExecutionContext = executionContext; 46190 executionContext |= RenderContext; 46191 var prevDispatcher = pushDispatcher(); // If the root or lanes have changed, throw out the existing stack 46192 // and prepare a fresh one. Otherwise we'll continue where we left off. 46193 46194 if (workInProgressRoot !== root || workInProgressRootRenderLanes !== lanes) { 46195 { 46196 if (isDevToolsPresent) { 46197 var memoizedUpdaters = root.memoizedUpdaters; 46198 46199 if (memoizedUpdaters.size > 0) { 46200 restorePendingUpdaters(root, workInProgressRootRenderLanes); 46201 memoizedUpdaters.clear(); 46202 } // At this point, move Fibers that scheduled the upcoming work from the Map to the Set. 46203 // If we bailout on this work, we'll move them back (like above). 46204 // It's important to move them now in case the work spawns more work at the same priority with different updaters. 46205 // That way we can keep the current update and future updates separate. 46206 46207 46208 movePendingFibersToMemoized(root, lanes); 46209 } 46210 } 46211 46212 workInProgressTransitions = getTransitionsForLanes(); 46213 resetRenderTimer(); 46214 prepareFreshStack(root, lanes); 46215 } 46216 46217 { 46218 markRenderStarted(lanes); 46219 } 46220 46221 do { 46222 try { 46223 workLoopConcurrent(); 46224 break; 46225 } catch (thrownValue) { 46226 handleError(root, thrownValue); 46227 } 46228 } while (true); 46229 46230 resetContextDependencies(); 46231 popDispatcher(prevDispatcher); 46232 executionContext = prevExecutionContext; 46233 46234 46235 if (workInProgress !== null) { 46236 // Still work remaining. 46237 { 46238 markRenderYielded(); 46239 } 46240 46241 return RootInProgress; 46242 } else { 46243 // Completed the tree. 46244 { 46245 markRenderStopped(); 46246 } // Set this to null to indicate there's no in-progress render. 46247 46248 46249 workInProgressRoot = null; 46250 workInProgressRootRenderLanes = NoLanes; // Return the final exit status. 46251 46252 return workInProgressRootExitStatus; 46253 } 46254} 46255/** @noinline */ 46256 46257 46258function workLoopConcurrent() { 46259 // Perform work until Scheduler asks us to yield 46260 while (workInProgress !== null && !shouldYield()) { 46261 performUnitOfWork(workInProgress); 46262 } 46263} 46264 46265function performUnitOfWork(unitOfWork) { 46266 // The current, flushed, state of this fiber is the alternate. Ideally 46267 // nothing should rely on this, but relying on it here means that we don't 46268 // need an additional field on the work in progress. 46269 var current = unitOfWork.alternate; 46270 setCurrentFiber(unitOfWork); 46271 var next; 46272 46273 if ( (unitOfWork.mode & ProfileMode) !== NoMode) { 46274 startProfilerTimer(unitOfWork); 46275 next = beginWork$1(current, unitOfWork, subtreeRenderLanes); 46276 stopProfilerTimerIfRunningAndRecordDelta(unitOfWork, true); 46277 } else { 46278 next = beginWork$1(current, unitOfWork, subtreeRenderLanes); 46279 } 46280 46281 resetCurrentFiber(); 46282 unitOfWork.memoizedProps = unitOfWork.pendingProps; 46283 46284 if (next === null) { 46285 // If this doesn't spawn new work, complete the current work. 46286 completeUnitOfWork(unitOfWork); 46287 } else { 46288 workInProgress = next; 46289 } 46290 46291 ReactCurrentOwner$2.current = null; 46292} 46293 46294function completeUnitOfWork(unitOfWork) { 46295 // Attempt to complete the current unit of work, then move to the next 46296 // sibling. If there are no more siblings, return to the parent fiber. 46297 var completedWork = unitOfWork; 46298 46299 do { 46300 // The current, flushed, state of this fiber is the alternate. Ideally 46301 // nothing should rely on this, but relying on it here means that we don't 46302 // need an additional field on the work in progress. 46303 var current = completedWork.alternate; 46304 var returnFiber = completedWork.return; // Check if the work completed or if something threw. 46305 46306 if ((completedWork.flags & Incomplete) === NoFlags) { 46307 setCurrentFiber(completedWork); 46308 var next = void 0; 46309 46310 if ( (completedWork.mode & ProfileMode) === NoMode) { 46311 next = completeWork(current, completedWork, subtreeRenderLanes); 46312 } else { 46313 startProfilerTimer(completedWork); 46314 next = completeWork(current, completedWork, subtreeRenderLanes); // Update render duration assuming we didn't error. 46315 46316 stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); 46317 } 46318 46319 resetCurrentFiber(); 46320 46321 if (next !== null) { 46322 // Completing this fiber spawned new work. Work on that next. 46323 workInProgress = next; 46324 return; 46325 } 46326 } else { 46327 // This fiber did not complete because something threw. Pop values off 46328 // the stack without entering the complete phase. If this is a boundary, 46329 // capture values if possible. 46330 var _next = unwindWork(current, completedWork); // Because this fiber did not complete, don't reset its lanes. 46331 46332 46333 if (_next !== null) { 46334 // If completing this work spawned new work, do that next. We'll come 46335 // back here again. 46336 // Since we're restarting, remove anything that is not a host effect 46337 // from the effect tag. 46338 _next.flags &= HostEffectMask; 46339 workInProgress = _next; 46340 return; 46341 } 46342 46343 if ( (completedWork.mode & ProfileMode) !== NoMode) { 46344 // Record the render duration for the fiber that errored. 46345 stopProfilerTimerIfRunningAndRecordDelta(completedWork, false); // Include the time spent working on failed children before continuing. 46346 46347 var actualDuration = completedWork.actualDuration; 46348 var child = completedWork.child; 46349 46350 while (child !== null) { 46351 actualDuration += child.actualDuration; 46352 child = child.sibling; 46353 } 46354 46355 completedWork.actualDuration = actualDuration; 46356 } 46357 46358 if (returnFiber !== null) { 46359 // Mark the parent fiber as incomplete and clear its subtree flags. 46360 returnFiber.flags |= Incomplete; 46361 returnFiber.subtreeFlags = NoFlags; 46362 returnFiber.deletions = null; 46363 } else { 46364 // We've unwound all the way to the root. 46365 workInProgressRootExitStatus = RootDidNotComplete; 46366 workInProgress = null; 46367 return; 46368 } 46369 } 46370 46371 var siblingFiber = completedWork.sibling; 46372 46373 if (siblingFiber !== null) { 46374 // If there is more work to do in this returnFiber, do that next. 46375 workInProgress = siblingFiber; 46376 return; 46377 } // Otherwise, return to the parent 46378 46379 46380 completedWork = returnFiber; // Update the next thing we're working on in case something throws. 46381 46382 workInProgress = completedWork; 46383 } while (completedWork !== null); // We've reached the root. 46384 46385 46386 if (workInProgressRootExitStatus === RootInProgress) { 46387 workInProgressRootExitStatus = RootCompleted; 46388 } 46389} 46390 46391function commitRoot(root, recoverableErrors, transitions) { 46392 // TODO: This no longer makes any sense. We already wrap the mutation and 46393 // layout phases. Should be able to remove. 46394 var previousUpdateLanePriority = getCurrentUpdatePriority(); 46395 var prevTransition = ReactCurrentBatchConfig$3.transition; 46396 46397 try { 46398 ReactCurrentBatchConfig$3.transition = null; 46399 setCurrentUpdatePriority(DiscreteEventPriority); 46400 commitRootImpl(root, recoverableErrors, transitions, previousUpdateLanePriority); 46401 } finally { 46402 ReactCurrentBatchConfig$3.transition = prevTransition; 46403 setCurrentUpdatePriority(previousUpdateLanePriority); 46404 } 46405 46406 return null; 46407} 46408 46409function commitRootImpl(root, recoverableErrors, transitions, renderPriorityLevel) { 46410 do { 46411 // `flushPassiveEffects` will call `flushSyncUpdateQueue` at the end, which 46412 // means `flushPassiveEffects` will sometimes result in additional 46413 // passive effects. So we need to keep flushing in a loop until there are 46414 // no more pending effects. 46415 // TODO: Might be better if `flushPassiveEffects` did not automatically 46416 // flush synchronous work at the end, to avoid factoring hazards like this. 46417 flushPassiveEffects(); 46418 } while (rootWithPendingPassiveEffects !== null); 46419 46420 flushRenderPhaseStrictModeWarningsInDEV(); 46421 46422 if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { 46423 throw new Error('Should not already be working.'); 46424 } 46425 46426 var finishedWork = root.finishedWork; 46427 var lanes = root.finishedLanes; 46428 46429 { 46430 markCommitStarted(lanes); 46431 } 46432 46433 if (finishedWork === null) { 46434 46435 { 46436 markCommitStopped(); 46437 } 46438 46439 return null; 46440 } else { 46441 { 46442 if (lanes === NoLanes) { 46443 error('root.finishedLanes should not be empty during a commit. This is a ' + 'bug in React.'); 46444 } 46445 } 46446 } 46447 46448 root.finishedWork = null; 46449 root.finishedLanes = NoLanes; 46450 46451 if (finishedWork === root.current) { 46452 throw new Error('Cannot commit the same tree as before. This error is likely caused by ' + 'a bug in React. Please file an issue.'); 46453 } // commitRoot never returns a continuation; it always finishes synchronously. 46454 // So we can clear these now to allow a new callback to be scheduled. 46455 46456 46457 root.callbackNode = null; 46458 root.callbackPriority = NoLane; // Update the first and last pending times on this root. The new first 46459 // pending time is whatever is left on the root fiber. 46460 46461 var remainingLanes = mergeLanes(finishedWork.lanes, finishedWork.childLanes); 46462 markRootFinished(root, remainingLanes); 46463 46464 if (root === workInProgressRoot) { 46465 // We can reset these now that they are finished. 46466 workInProgressRoot = null; 46467 workInProgress = null; 46468 workInProgressRootRenderLanes = NoLanes; 46469 } // If there are pending passive effects, schedule a callback to process them. 46470 // Do this as early as possible, so it is queued before anything else that 46471 // might get scheduled in the commit phase. (See #16714.) 46472 // TODO: Delete all other places that schedule the passive effect callback 46473 // They're redundant. 46474 46475 46476 if ((finishedWork.subtreeFlags & PassiveMask) !== NoFlags || (finishedWork.flags & PassiveMask) !== NoFlags) { 46477 if (!rootDoesHavePassiveEffects) { 46478 rootDoesHavePassiveEffects = true; 46479 // to store it in pendingPassiveTransitions until they get processed 46480 // We need to pass this through as an argument to commitRoot 46481 // because workInProgressTransitions might have changed between 46482 // the previous render and commit if we throttle the commit 46483 // with setTimeout 46484 46485 pendingPassiveTransitions = transitions; 46486 scheduleCallback$1(NormalPriority, function () { 46487 flushPassiveEffects(); // This render triggered passive effects: release the root cache pool 46488 // *after* passive effects fire to avoid freeing a cache pool that may 46489 // be referenced by a node in the tree (HostRoot, Cache boundary etc) 46490 46491 return null; 46492 }); 46493 } 46494 } // Check if there are any effects in the whole tree. 46495 // TODO: This is left over from the effect list implementation, where we had 46496 // to check for the existence of `firstEffect` to satisfy Flow. I think the 46497 // only other reason this optimization exists is because it affects profiling. 46498 // Reconsider whether this is necessary. 46499 46500 46501 var subtreeHasEffects = (finishedWork.subtreeFlags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags; 46502 var rootHasEffect = (finishedWork.flags & (BeforeMutationMask | MutationMask | LayoutMask | PassiveMask)) !== NoFlags; 46503 46504 if (subtreeHasEffects || rootHasEffect) { 46505 var prevTransition = ReactCurrentBatchConfig$3.transition; 46506 ReactCurrentBatchConfig$3.transition = null; 46507 var previousPriority = getCurrentUpdatePriority(); 46508 setCurrentUpdatePriority(DiscreteEventPriority); 46509 var prevExecutionContext = executionContext; 46510 executionContext |= CommitContext; // Reset this to null before calling lifecycles 46511 46512 ReactCurrentOwner$2.current = null; // The commit phase is broken into several sub-phases. We do a separate pass 46513 // of the effect list for each phase: all mutation effects come before all 46514 // layout effects, and so on. 46515 // The first phase a "before mutation" phase. We use this phase to read the 46516 // state of the host tree right before we mutate it. This is where 46517 // getSnapshotBeforeUpdate is called. 46518 46519 var shouldFireAfterActiveInstanceBlur = commitBeforeMutationEffects(root, finishedWork); 46520 46521 { 46522 // Mark the current commit time to be shared by all Profilers in this 46523 // batch. This enables them to be grouped later. 46524 recordCommitTime(); 46525 } 46526 46527 46528 commitMutationEffects(root, finishedWork, lanes); 46529 46530 resetAfterCommit(root.containerInfo); // The work-in-progress tree is now the current tree. This must come after 46531 // the mutation phase, so that the previous tree is still current during 46532 // componentWillUnmount, but before the layout phase, so that the finished 46533 // work is current during componentDidMount/Update. 46534 46535 root.current = finishedWork; // The next phase is the layout phase, where we call effects that read 46536 46537 { 46538 markLayoutEffectsStarted(lanes); 46539 } 46540 46541 commitLayoutEffects(finishedWork, root, lanes); 46542 46543 { 46544 markLayoutEffectsStopped(); 46545 } 46546 // opportunity to paint. 46547 46548 46549 requestPaint(); 46550 executionContext = prevExecutionContext; // Reset the priority to the previous non-sync value. 46551 46552 setCurrentUpdatePriority(previousPriority); 46553 ReactCurrentBatchConfig$3.transition = prevTransition; 46554 } else { 46555 // No effects. 46556 root.current = finishedWork; // Measure these anyway so the flamegraph explicitly shows that there were 46557 // no effects. 46558 // TODO: Maybe there's a better way to report this. 46559 46560 { 46561 recordCommitTime(); 46562 } 46563 } 46564 46565 var rootDidHavePassiveEffects = rootDoesHavePassiveEffects; 46566 46567 if (rootDoesHavePassiveEffects) { 46568 // This commit has passive effects. Stash a reference to them. But don't 46569 // schedule a callback until after flushing layout work. 46570 rootDoesHavePassiveEffects = false; 46571 rootWithPendingPassiveEffects = root; 46572 pendingPassiveEffectsLanes = lanes; 46573 } else { 46574 46575 { 46576 nestedPassiveUpdateCount = 0; 46577 rootWithPassiveNestedUpdates = null; 46578 } 46579 } // Read this again, since an effect might have updated it 46580 46581 46582 remainingLanes = root.pendingLanes; // Check if there's remaining work on this root 46583 // TODO: This is part of the `componentDidCatch` implementation. Its purpose 46584 // is to detect whether something might have called setState inside 46585 // `componentDidCatch`. The mechanism is known to be flawed because `setState` 46586 // inside `componentDidCatch` is itself flawed â that's why we recommend 46587 // `getDerivedStateFromError` instead. However, it could be improved by 46588 // checking if remainingLanes includes Sync work, instead of whether there's 46589 // any work remaining at all (which would also include stuff like Suspense 46590 // retries or transitions). It's been like this for a while, though, so fixing 46591 // it probably isn't that urgent. 46592 46593 if (remainingLanes === NoLanes) { 46594 // If there's no remaining work, we can clear the set of already failed 46595 // error boundaries. 46596 legacyErrorBoundariesThatAlreadyFailed = null; 46597 } 46598 46599 { 46600 if (!rootDidHavePassiveEffects) { 46601 commitDoubleInvokeEffectsInDEV(root.current, false); 46602 } 46603 } 46604 46605 onCommitRoot(finishedWork.stateNode, renderPriorityLevel); 46606 46607 { 46608 if (isDevToolsPresent) { 46609 root.memoizedUpdaters.clear(); 46610 } 46611 } 46612 46613 { 46614 onCommitRoot$1(); 46615 } // Always call this before exiting `commitRoot`, to ensure that any 46616 // additional work on this root is scheduled. 46617 46618 46619 ensureRootIsScheduled(root, now()); 46620 46621 if (recoverableErrors !== null) { 46622 // There were errors during this render, but recovered from them without 46623 // needing to surface it to the UI. We log them here. 46624 var onRecoverableError = root.onRecoverableError; 46625 46626 for (var i = 0; i < recoverableErrors.length; i++) { 46627 var recoverableError = recoverableErrors[i]; 46628 var componentStack = recoverableError.stack; 46629 var digest = recoverableError.digest; 46630 onRecoverableError(recoverableError.value, { 46631 componentStack: componentStack, 46632 digest: digest 46633 }); 46634 } 46635 } 46636 46637 if (hasUncaughtError) { 46638 hasUncaughtError = false; 46639 var error$1 = firstUncaughtError; 46640 firstUncaughtError = null; 46641 throw error$1; 46642 } // If the passive effects are the result of a discrete render, flush them 46643 // synchronously at the end of the current task so that the result is 46644 // immediately observable. Otherwise, we assume that they are not 46645 // order-dependent and do not need to be observed by external systems, so we 46646 // can wait until after paint. 46647 // TODO: We can optimize this by not scheduling the callback earlier. Since we 46648 // currently schedule the callback in multiple places, will wait until those 46649 // are consolidated. 46650 46651 46652 if (includesSomeLane(pendingPassiveEffectsLanes, SyncLane) && root.tag !== LegacyRoot) { 46653 flushPassiveEffects(); 46654 } // Read this again, since a passive effect might have updated it 46655 46656 46657 remainingLanes = root.pendingLanes; 46658 46659 if (includesSomeLane(remainingLanes, SyncLane)) { 46660 { 46661 markNestedUpdateScheduled(); 46662 } // Count the number of times the root synchronously re-renders without 46663 // finishing. If there are too many, it indicates an infinite update loop. 46664 46665 46666 if (root === rootWithNestedUpdates) { 46667 nestedUpdateCount++; 46668 } else { 46669 nestedUpdateCount = 0; 46670 rootWithNestedUpdates = root; 46671 } 46672 } else { 46673 nestedUpdateCount = 0; 46674 } // If layout work was scheduled, flush it now. 46675 46676 46677 flushSyncCallbacks(); 46678 46679 { 46680 markCommitStopped(); 46681 } 46682 46683 return null; 46684} 46685 46686function flushPassiveEffects() { 46687 // Returns whether passive effects were flushed. 46688 // TODO: Combine this check with the one in flushPassiveEFfectsImpl. We should 46689 // probably just combine the two functions. I believe they were only separate 46690 // in the first place because we used to wrap it with 46691 // `Scheduler.runWithPriority`, which accepts a function. But now we track the 46692 // priority within React itself, so we can mutate the variable directly. 46693 if (rootWithPendingPassiveEffects !== null) { 46694 var renderPriority = lanesToEventPriority(pendingPassiveEffectsLanes); 46695 var priority = lowerEventPriority(DefaultEventPriority, renderPriority); 46696 var prevTransition = ReactCurrentBatchConfig$3.transition; 46697 var previousPriority = getCurrentUpdatePriority(); 46698 46699 try { 46700 ReactCurrentBatchConfig$3.transition = null; 46701 setCurrentUpdatePriority(priority); 46702 return flushPassiveEffectsImpl(); 46703 } finally { 46704 setCurrentUpdatePriority(previousPriority); 46705 ReactCurrentBatchConfig$3.transition = prevTransition; // Once passive effects have run for the tree - giving components a 46706 } 46707 } 46708 46709 return false; 46710} 46711function enqueuePendingPassiveProfilerEffect(fiber) { 46712 { 46713 pendingPassiveProfilerEffects.push(fiber); 46714 46715 if (!rootDoesHavePassiveEffects) { 46716 rootDoesHavePassiveEffects = true; 46717 scheduleCallback$1(NormalPriority, function () { 46718 flushPassiveEffects(); 46719 return null; 46720 }); 46721 } 46722 } 46723} 46724 46725function flushPassiveEffectsImpl() { 46726 if (rootWithPendingPassiveEffects === null) { 46727 return false; 46728 } // Cache and clear the transitions flag 46729 46730 46731 var transitions = pendingPassiveTransitions; 46732 pendingPassiveTransitions = null; 46733 var root = rootWithPendingPassiveEffects; 46734 var lanes = pendingPassiveEffectsLanes; 46735 rootWithPendingPassiveEffects = null; // TODO: This is sometimes out of sync with rootWithPendingPassiveEffects. 46736 // Figure out why and fix it. It's not causing any known issues (probably 46737 // because it's only used for profiling), but it's a refactor hazard. 46738 46739 pendingPassiveEffectsLanes = NoLanes; 46740 46741 if ((executionContext & (RenderContext | CommitContext)) !== NoContext) { 46742 throw new Error('Cannot flush passive effects while already rendering.'); 46743 } 46744 46745 { 46746 isFlushingPassiveEffects = true; 46747 didScheduleUpdateDuringPassiveEffects = false; 46748 } 46749 46750 { 46751 markPassiveEffectsStarted(lanes); 46752 } 46753 46754 var prevExecutionContext = executionContext; 46755 executionContext |= CommitContext; 46756 commitPassiveUnmountEffects(root.current); 46757 commitPassiveMountEffects(root, root.current, lanes, transitions); // TODO: Move to commitPassiveMountEffects 46758 46759 { 46760 var profilerEffects = pendingPassiveProfilerEffects; 46761 pendingPassiveProfilerEffects = []; 46762 46763 for (var i = 0; i < profilerEffects.length; i++) { 46764 var _fiber = profilerEffects[i]; 46765 commitPassiveEffectDurations(root, _fiber); 46766 } 46767 } 46768 46769 { 46770 markPassiveEffectsStopped(); 46771 } 46772 46773 { 46774 commitDoubleInvokeEffectsInDEV(root.current, true); 46775 } 46776 46777 executionContext = prevExecutionContext; 46778 flushSyncCallbacks(); 46779 46780 { 46781 // If additional passive effects were scheduled, increment a counter. If this 46782 // exceeds the limit, we'll fire a warning. 46783 if (didScheduleUpdateDuringPassiveEffects) { 46784 if (root === rootWithPassiveNestedUpdates) { 46785 nestedPassiveUpdateCount++; 46786 } else { 46787 nestedPassiveUpdateCount = 0; 46788 rootWithPassiveNestedUpdates = root; 46789 } 46790 } else { 46791 nestedPassiveUpdateCount = 0; 46792 } 46793 46794 isFlushingPassiveEffects = false; 46795 didScheduleUpdateDuringPassiveEffects = false; 46796 } // TODO: Move to commitPassiveMountEffects 46797 46798 46799 onPostCommitRoot(root); 46800 46801 { 46802 var stateNode = root.current.stateNode; 46803 stateNode.effectDuration = 0; 46804 stateNode.passiveEffectDuration = 0; 46805 } 46806 46807 return true; 46808} 46809 46810function isAlreadyFailedLegacyErrorBoundary(instance) { 46811 return legacyErrorBoundariesThatAlreadyFailed !== null && legacyErrorBoundariesThatAlreadyFailed.has(instance); 46812} 46813function markLegacyErrorBoundaryAsFailed(instance) { 46814 if (legacyErrorBoundariesThatAlreadyFailed === null) { 46815 legacyErrorBoundariesThatAlreadyFailed = new Set([instance]); 46816 } else { 46817 legacyErrorBoundariesThatAlreadyFailed.add(instance); 46818 } 46819} 46820 46821function prepareToThrowUncaughtError(error) { 46822 if (!hasUncaughtError) { 46823 hasUncaughtError = true; 46824 firstUncaughtError = error; 46825 } 46826} 46827 46828var onUncaughtError = prepareToThrowUncaughtError; 46829 46830function captureCommitPhaseErrorOnRoot(rootFiber, sourceFiber, error) { 46831 var errorInfo = createCapturedValueAtFiber(error, sourceFiber); 46832 var update = createRootErrorUpdate(rootFiber, errorInfo, SyncLane); 46833 var root = enqueueUpdate(rootFiber, update, SyncLane); 46834 var eventTime = requestEventTime(); 46835 46836 if (root !== null) { 46837 markRootUpdated(root, SyncLane, eventTime); 46838 ensureRootIsScheduled(root, eventTime); 46839 } 46840} 46841 46842function captureCommitPhaseError(sourceFiber, nearestMountedAncestor, error$1) { 46843 { 46844 reportUncaughtErrorInDEV(error$1); 46845 setIsRunningInsertionEffect(false); 46846 } 46847 46848 if (sourceFiber.tag === HostRoot) { 46849 // Error was thrown at the root. There is no parent, so the root 46850 // itself should capture it. 46851 captureCommitPhaseErrorOnRoot(sourceFiber, sourceFiber, error$1); 46852 return; 46853 } 46854 46855 var fiber = null; 46856 46857 { 46858 fiber = nearestMountedAncestor; 46859 } 46860 46861 while (fiber !== null) { 46862 if (fiber.tag === HostRoot) { 46863 captureCommitPhaseErrorOnRoot(fiber, sourceFiber, error$1); 46864 return; 46865 } else if (fiber.tag === ClassComponent) { 46866 var ctor = fiber.type; 46867 var instance = fiber.stateNode; 46868 46869 if (typeof ctor.getDerivedStateFromError === 'function' || typeof instance.componentDidCatch === 'function' && !isAlreadyFailedLegacyErrorBoundary(instance)) { 46870 var errorInfo = createCapturedValueAtFiber(error$1, sourceFiber); 46871 var update = createClassErrorUpdate(fiber, errorInfo, SyncLane); 46872 var root = enqueueUpdate(fiber, update, SyncLane); 46873 var eventTime = requestEventTime(); 46874 46875 if (root !== null) { 46876 markRootUpdated(root, SyncLane, eventTime); 46877 ensureRootIsScheduled(root, eventTime); 46878 } 46879 46880 return; 46881 } 46882 } 46883 46884 fiber = fiber.return; 46885 } 46886 46887 { 46888 // TODO: Until we re-land skipUnmountedBoundaries (see #20147), this warning 46889 // will fire for errors that are thrown by destroy functions inside deleted 46890 // trees. What it should instead do is propagate the error to the parent of 46891 // the deleted tree. In the meantime, do not add this warning to the 46892 // allowlist; this is only for our internal use. 46893 error('Internal React error: Attempted to capture a commit phase error ' + 'inside a detached tree. This indicates a bug in React. Likely ' + 'causes include deleting the same fiber more than once, committing an ' + 'already-finished tree, or an inconsistent return pointer.\n\n' + 'Error message:\n\n%s', error$1); 46894 } 46895} 46896function pingSuspendedRoot(root, wakeable, pingedLanes) { 46897 var pingCache = root.pingCache; 46898 46899 if (pingCache !== null) { 46900 // The wakeable resolved, so we no longer need to memoize, because it will 46901 // never be thrown again. 46902 pingCache.delete(wakeable); 46903 } 46904 46905 var eventTime = requestEventTime(); 46906 markRootPinged(root, pingedLanes); 46907 warnIfSuspenseResolutionNotWrappedWithActDEV(root); 46908 46909 if (workInProgressRoot === root && isSubsetOfLanes(workInProgressRootRenderLanes, pingedLanes)) { 46910 // Received a ping at the same priority level at which we're currently 46911 // rendering. We might want to restart this render. This should mirror 46912 // the logic of whether or not a root suspends once it completes. 46913 // TODO: If we're rendering sync either due to Sync, Batched or expired, 46914 // we should probably never restart. 46915 // If we're suspended with delay, or if it's a retry, we'll always suspend 46916 // so we can always restart. 46917 if (workInProgressRootExitStatus === RootSuspendedWithDelay || workInProgressRootExitStatus === RootSuspended && includesOnlyRetries(workInProgressRootRenderLanes) && now() - globalMostRecentFallbackTime < FALLBACK_THROTTLE_MS) { 46918 // Restart from the root. 46919 prepareFreshStack(root, NoLanes); 46920 } else { 46921 // Even though we can't restart right now, we might get an 46922 // opportunity later. So we mark this render as having a ping. 46923 workInProgressRootPingedLanes = mergeLanes(workInProgressRootPingedLanes, pingedLanes); 46924 } 46925 } 46926 46927 ensureRootIsScheduled(root, eventTime); 46928} 46929 46930function retryTimedOutBoundary(boundaryFiber, retryLane) { 46931 // The boundary fiber (a Suspense component or SuspenseList component) 46932 // previously was rendered in its fallback state. One of the promises that 46933 // suspended it has resolved, which means at least part of the tree was 46934 // likely unblocked. Try rendering again, at a new lanes. 46935 if (retryLane === NoLane) { 46936 // TODO: Assign this to `suspenseState.retryLane`? to avoid 46937 // unnecessary entanglement? 46938 retryLane = requestRetryLane(boundaryFiber); 46939 } // TODO: Special case idle priority? 46940 46941 46942 var eventTime = requestEventTime(); 46943 var root = enqueueConcurrentRenderForLane(boundaryFiber, retryLane); 46944 46945 if (root !== null) { 46946 markRootUpdated(root, retryLane, eventTime); 46947 ensureRootIsScheduled(root, eventTime); 46948 } 46949} 46950 46951function retryDehydratedSuspenseBoundary(boundaryFiber) { 46952 var suspenseState = boundaryFiber.memoizedState; 46953 var retryLane = NoLane; 46954 46955 if (suspenseState !== null) { 46956 retryLane = suspenseState.retryLane; 46957 } 46958 46959 retryTimedOutBoundary(boundaryFiber, retryLane); 46960} 46961function resolveRetryWakeable(boundaryFiber, wakeable) { 46962 var retryLane = NoLane; // Default 46963 46964 var retryCache; 46965 46966 switch (boundaryFiber.tag) { 46967 case SuspenseComponent: 46968 retryCache = boundaryFiber.stateNode; 46969 var suspenseState = boundaryFiber.memoizedState; 46970 46971 if (suspenseState !== null) { 46972 retryLane = suspenseState.retryLane; 46973 } 46974 46975 break; 46976 46977 case SuspenseListComponent: 46978 retryCache = boundaryFiber.stateNode; 46979 break; 46980 46981 default: 46982 throw new Error('Pinged unknown suspense boundary type. ' + 'This is probably a bug in React.'); 46983 } 46984 46985 if (retryCache !== null) { 46986 // The wakeable resolved, so we no longer need to memoize, because it will 46987 // never be thrown again. 46988 retryCache.delete(wakeable); 46989 } 46990 46991 retryTimedOutBoundary(boundaryFiber, retryLane); 46992} // Computes the next Just Noticeable Difference (JND) boundary. 46993// The theory is that a person can't tell the difference between small differences in time. 46994// Therefore, if we wait a bit longer than necessary that won't translate to a noticeable 46995// difference in the experience. However, waiting for longer might mean that we can avoid 46996// showing an intermediate loading state. The longer we have already waited, the harder it 46997// is to tell small differences in time. Therefore, the longer we've already waited, 46998// the longer we can wait additionally. At some point we have to give up though. 46999// We pick a train model where the next boundary commits at a consistent schedule. 47000// These particular numbers are vague estimates. We expect to adjust them based on research. 47001 47002function jnd(timeElapsed) { 47003 return timeElapsed < 120 ? 120 : timeElapsed < 480 ? 480 : timeElapsed < 1080 ? 1080 : timeElapsed < 1920 ? 1920 : timeElapsed < 3000 ? 3000 : timeElapsed < 4320 ? 4320 : ceil(timeElapsed / 1960) * 1960; 47004} 47005 47006function checkForNestedUpdates() { 47007 if (nestedUpdateCount > NESTED_UPDATE_LIMIT) { 47008 nestedUpdateCount = 0; 47009 rootWithNestedUpdates = null; 47010 throw new Error('Maximum update depth exceeded. This can happen when a component ' + 'repeatedly calls setState inside componentWillUpdate or ' + 'componentDidUpdate. React limits the number of nested updates to ' + 'prevent infinite loops.'); 47011 } 47012 47013 { 47014 if (nestedPassiveUpdateCount > NESTED_PASSIVE_UPDATE_LIMIT) { 47015 nestedPassiveUpdateCount = 0; 47016 rootWithPassiveNestedUpdates = null; 47017 47018 error('Maximum update depth exceeded. This can happen when a component ' + "calls setState inside useEffect, but useEffect either doesn't " + 'have a dependency array, or one of the dependencies changes on ' + 'every render.'); 47019 } 47020 } 47021} 47022 47023function flushRenderPhaseStrictModeWarningsInDEV() { 47024 { 47025 ReactStrictModeWarnings.flushLegacyContextWarning(); 47026 47027 { 47028 ReactStrictModeWarnings.flushPendingUnsafeLifecycleWarnings(); 47029 } 47030 } 47031} 47032 47033function commitDoubleInvokeEffectsInDEV(fiber, hasPassiveEffects) { 47034 { 47035 // TODO (StrictEffects) Should we set a marker on the root if it contains strict effects 47036 // so we don't traverse unnecessarily? similar to subtreeFlags but just at the root level. 47037 // Maybe not a big deal since this is DEV only behavior. 47038 setCurrentFiber(fiber); 47039 invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectUnmountInDEV); 47040 47041 if (hasPassiveEffects) { 47042 invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectUnmountInDEV); 47043 } 47044 47045 invokeEffectsInDev(fiber, MountLayoutDev, invokeLayoutEffectMountInDEV); 47046 47047 if (hasPassiveEffects) { 47048 invokeEffectsInDev(fiber, MountPassiveDev, invokePassiveEffectMountInDEV); 47049 } 47050 47051 resetCurrentFiber(); 47052 } 47053} 47054 47055function invokeEffectsInDev(firstChild, fiberFlags, invokeEffectFn) { 47056 { 47057 // We don't need to re-check StrictEffectsMode here. 47058 // This function is only called if that check has already passed. 47059 var current = firstChild; 47060 var subtreeRoot = null; 47061 47062 while (current !== null) { 47063 var primarySubtreeFlag = current.subtreeFlags & fiberFlags; 47064 47065 if (current !== subtreeRoot && current.child !== null && primarySubtreeFlag !== NoFlags) { 47066 current = current.child; 47067 } else { 47068 if ((current.flags & fiberFlags) !== NoFlags) { 47069 invokeEffectFn(current); 47070 } 47071 47072 if (current.sibling !== null) { 47073 current = current.sibling; 47074 } else { 47075 current = subtreeRoot = current.return; 47076 } 47077 } 47078 } 47079 } 47080} 47081 47082var didWarnStateUpdateForNotYetMountedComponent = null; 47083function warnAboutUpdateOnNotYetMountedFiberInDEV(fiber) { 47084 { 47085 if ((executionContext & RenderContext) !== NoContext) { 47086 // We let the other warning about render phase updates deal with this one. 47087 return; 47088 } 47089 47090 if (!(fiber.mode & ConcurrentMode)) { 47091 return; 47092 } 47093 47094 var tag = fiber.tag; 47095 47096 if (tag !== IndeterminateComponent && tag !== HostRoot && tag !== ClassComponent && tag !== FunctionComponent && tag !== ForwardRef && tag !== MemoComponent && tag !== SimpleMemoComponent) { 47097 // Only warn for user-defined components, not internal ones like Suspense. 47098 return; 47099 } // We show the whole stack but dedupe on the top component's name because 47100 // the problematic code almost always lies inside that component. 47101 47102 47103 var componentName = getComponentNameFromFiber(fiber) || 'ReactComponent'; 47104 47105 if (didWarnStateUpdateForNotYetMountedComponent !== null) { 47106 if (didWarnStateUpdateForNotYetMountedComponent.has(componentName)) { 47107 return; 47108 } 47109 47110 didWarnStateUpdateForNotYetMountedComponent.add(componentName); 47111 } else { 47112 didWarnStateUpdateForNotYetMountedComponent = new Set([componentName]); 47113 } 47114 47115 var previousFiber = current; 47116 47117 try { 47118 setCurrentFiber(fiber); 47119 47120 error("Can't perform a React state update on a component that hasn't mounted yet. " + 'This indicates that you have a side-effect in your render function that ' + 'asynchronously later calls tries to update the component. Move this work to ' + 'useEffect instead.'); 47121 } finally { 47122 if (previousFiber) { 47123 setCurrentFiber(fiber); 47124 } else { 47125 resetCurrentFiber(); 47126 } 47127 } 47128 } 47129} 47130var beginWork$1; 47131 47132{ 47133 var dummyFiber = null; 47134 47135 beginWork$1 = function (current, unitOfWork, lanes) { 47136 // If a component throws an error, we replay it again in a synchronously 47137 // dispatched event, so that the debugger will treat it as an uncaught 47138 // error See ReactErrorUtils for more information. 47139 // Before entering the begin phase, copy the work-in-progress onto a dummy 47140 // fiber. If beginWork throws, we'll use this to reset the state. 47141 var originalWorkInProgressCopy = assignFiberPropertiesInDEV(dummyFiber, unitOfWork); 47142 47143 try { 47144 return beginWork(current, unitOfWork, lanes); 47145 } catch (originalError) { 47146 if (didSuspendOrErrorWhileHydratingDEV() || originalError !== null && typeof originalError === 'object' && typeof originalError.then === 'function') { 47147 // Don't replay promises. 47148 // Don't replay errors if we are hydrating and have already suspended or handled an error 47149 throw originalError; 47150 } // Keep this code in sync with handleError; any changes here must have 47151 // corresponding changes there. 47152 47153 47154 resetContextDependencies(); 47155 resetHooksAfterThrow(); // Don't reset current debug fiber, since we're about to work on the 47156 // same fiber again. 47157 // Unwind the failed stack frame 47158 47159 unwindInterruptedWork(current, unitOfWork); // Restore the original properties of the fiber. 47160 47161 assignFiberPropertiesInDEV(unitOfWork, originalWorkInProgressCopy); 47162 47163 if ( unitOfWork.mode & ProfileMode) { 47164 // Reset the profiler timer. 47165 startProfilerTimer(unitOfWork); 47166 } // Run beginWork again. 47167 47168 47169 invokeGuardedCallback(null, beginWork, null, current, unitOfWork, lanes); 47170 47171 if (hasCaughtError()) { 47172 var replayError = clearCaughtError(); 47173 47174 if (typeof replayError === 'object' && replayError !== null && replayError._suppressLogging && typeof originalError === 'object' && originalError !== null && !originalError._suppressLogging) { 47175 // If suppressed, let the flag carry over to the original error which is the one we'll rethrow. 47176 originalError._suppressLogging = true; 47177 } 47178 } // We always throw the original error in case the second render pass is not idempotent. 47179 // This can happen if a memoized function or CommonJS module doesn't throw after first invocation. 47180 47181 47182 throw originalError; 47183 } 47184 }; 47185} 47186 47187var didWarnAboutUpdateInRender = false; 47188var didWarnAboutUpdateInRenderForAnotherComponent; 47189 47190{ 47191 didWarnAboutUpdateInRenderForAnotherComponent = new Set(); 47192} 47193 47194function warnAboutRenderPhaseUpdatesInDEV(fiber) { 47195 { 47196 if (isRendering && !getIsUpdatingOpaqueValueInRenderPhaseInDEV()) { 47197 switch (fiber.tag) { 47198 case FunctionComponent: 47199 case ForwardRef: 47200 case SimpleMemoComponent: 47201 { 47202 var renderingComponentName = workInProgress && getComponentNameFromFiber(workInProgress) || 'Unknown'; // Dedupe by the rendering component because it's the one that needs to be fixed. 47203 47204 var dedupeKey = renderingComponentName; 47205 47206 if (!didWarnAboutUpdateInRenderForAnotherComponent.has(dedupeKey)) { 47207 didWarnAboutUpdateInRenderForAnotherComponent.add(dedupeKey); 47208 var setStateComponentName = getComponentNameFromFiber(fiber) || 'Unknown'; 47209 47210 error('Cannot update a component (`%s`) while rendering a ' + 'different component (`%s`). To locate the bad setState() call inside `%s`, ' + 'follow the stack trace as described in https://reactjs.org/link/setstate-in-render', setStateComponentName, renderingComponentName, renderingComponentName); 47211 } 47212 47213 break; 47214 } 47215 47216 case ClassComponent: 47217 { 47218 if (!didWarnAboutUpdateInRender) { 47219 error('Cannot update during an existing state transition (such as ' + 'within `render`). Render methods should be a pure ' + 'function of props and state.'); 47220 47221 didWarnAboutUpdateInRender = true; 47222 } 47223 47224 break; 47225 } 47226 } 47227 } 47228 } 47229} 47230 47231function restorePendingUpdaters(root, lanes) { 47232 { 47233 if (isDevToolsPresent) { 47234 var memoizedUpdaters = root.memoizedUpdaters; 47235 memoizedUpdaters.forEach(function (schedulingFiber) { 47236 addFiberToLanesMap(root, schedulingFiber, lanes); 47237 }); // This function intentionally does not clear memoized updaters. 47238 // Those may still be relevant to the current commit 47239 // and a future one (e.g. Suspense). 47240 } 47241 } 47242} 47243var fakeActCallbackNode = {}; 47244 47245function scheduleCallback$1(priorityLevel, callback) { 47246 { 47247 // If we're currently inside an `act` scope, bypass Scheduler and push to 47248 // the `act` queue instead. 47249 var actQueue = ReactCurrentActQueue$1.current; 47250 47251 if (actQueue !== null) { 47252 actQueue.push(callback); 47253 return fakeActCallbackNode; 47254 } else { 47255 return scheduleCallback(priorityLevel, callback); 47256 } 47257 } 47258} 47259 47260function cancelCallback$1(callbackNode) { 47261 if ( callbackNode === fakeActCallbackNode) { 47262 return; 47263 } // In production, always call Scheduler. This function will be stripped out. 47264 47265 47266 return cancelCallback(callbackNode); 47267} 47268 47269function shouldForceFlushFallbacksInDEV() { 47270 // Never force flush in production. This function should get stripped out. 47271 return ReactCurrentActQueue$1.current !== null; 47272} 47273 47274function warnIfUpdatesNotWrappedWithActDEV(fiber) { 47275 { 47276 if (fiber.mode & ConcurrentMode) { 47277 if (!isConcurrentActEnvironment()) { 47278 // Not in an act environment. No need to warn. 47279 return; 47280 } 47281 } else { 47282 // Legacy mode has additional cases where we suppress a warning. 47283 if (!isLegacyActEnvironment()) { 47284 // Not in an act environment. No need to warn. 47285 return; 47286 } 47287 47288 if (executionContext !== NoContext) { 47289 // Legacy mode doesn't warn if the update is batched, i.e. 47290 // batchedUpdates or flushSync. 47291 return; 47292 } 47293 47294 if (fiber.tag !== FunctionComponent && fiber.tag !== ForwardRef && fiber.tag !== SimpleMemoComponent) { 47295 // For backwards compatibility with pre-hooks code, legacy mode only 47296 // warns for updates that originate from a hook. 47297 return; 47298 } 47299 } 47300 47301 if (ReactCurrentActQueue$1.current === null) { 47302 var previousFiber = current; 47303 47304 try { 47305 setCurrentFiber(fiber); 47306 47307 error('An update to %s inside a test was not wrapped in act(...).\n\n' + 'When testing, code that causes React state updates should be ' + 'wrapped into act(...):\n\n' + 'act(() => {\n' + ' /* fire events that update state */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act', getComponentNameFromFiber(fiber)); 47308 } finally { 47309 if (previousFiber) { 47310 setCurrentFiber(fiber); 47311 } else { 47312 resetCurrentFiber(); 47313 } 47314 } 47315 } 47316 } 47317} 47318 47319function warnIfSuspenseResolutionNotWrappedWithActDEV(root) { 47320 { 47321 if (root.tag !== LegacyRoot && isConcurrentActEnvironment() && ReactCurrentActQueue$1.current === null) { 47322 error('A suspended resource finished loading inside a test, but the event ' + 'was not wrapped in act(...).\n\n' + 'When testing, code that resolves suspended data should be wrapped ' + 'into act(...):\n\n' + 'act(() => {\n' + ' /* finish loading suspended data */\n' + '});\n' + '/* assert on the output */\n\n' + "This ensures that you're testing the behavior the user would see " + 'in the browser.' + ' Learn more at https://reactjs.org/link/wrap-tests-with-act'); 47323 } 47324 } 47325} 47326 47327function setIsRunningInsertionEffect(isRunning) { 47328 { 47329 isRunningInsertionEffect = isRunning; 47330 } 47331} 47332 47333/* eslint-disable react-internal/prod-error-codes */ 47334var resolveFamily = null; // $FlowFixMe Flow gets confused by a WeakSet feature check below. 47335 47336var failedBoundaries = null; 47337var setRefreshHandler = function (handler) { 47338 { 47339 resolveFamily = handler; 47340 } 47341}; 47342function resolveFunctionForHotReloading(type) { 47343 { 47344 if (resolveFamily === null) { 47345 // Hot reloading is disabled. 47346 return type; 47347 } 47348 47349 var family = resolveFamily(type); 47350 47351 if (family === undefined) { 47352 return type; 47353 } // Use the latest known implementation. 47354 47355 47356 return family.current; 47357 } 47358} 47359function resolveClassForHotReloading(type) { 47360 // No implementation differences. 47361 return resolveFunctionForHotReloading(type); 47362} 47363function resolveForwardRefForHotReloading(type) { 47364 { 47365 if (resolveFamily === null) { 47366 // Hot reloading is disabled. 47367 return type; 47368 } 47369 47370 var family = resolveFamily(type); 47371 47372 if (family === undefined) { 47373 // Check if we're dealing with a real forwardRef. Don't want to crash early. 47374 if (type !== null && type !== undefined && typeof type.render === 'function') { 47375 // ForwardRef is special because its resolved .type is an object, 47376 // but it's possible that we only have its inner render function in the map. 47377 // If that inner render function is different, we'll build a new forwardRef type. 47378 var currentRender = resolveFunctionForHotReloading(type.render); 47379 47380 if (type.render !== currentRender) { 47381 var syntheticType = { 47382 $$typeof: REACT_FORWARD_REF_TYPE, 47383 render: currentRender 47384 }; 47385 47386 if (type.displayName !== undefined) { 47387 syntheticType.displayName = type.displayName; 47388 } 47389 47390 return syntheticType; 47391 } 47392 } 47393 47394 return type; 47395 } // Use the latest known implementation. 47396 47397 47398 return family.current; 47399 } 47400} 47401function isCompatibleFamilyForHotReloading(fiber, element) { 47402 { 47403 if (resolveFamily === null) { 47404 // Hot reloading is disabled. 47405 return false; 47406 } 47407 47408 var prevType = fiber.elementType; 47409 var nextType = element.type; // If we got here, we know types aren't === equal. 47410 47411 var needsCompareFamilies = false; 47412 var $$typeofNextType = typeof nextType === 'object' && nextType !== null ? nextType.$$typeof : null; 47413 47414 switch (fiber.tag) { 47415 case ClassComponent: 47416 { 47417 if (typeof nextType === 'function') { 47418 needsCompareFamilies = true; 47419 } 47420 47421 break; 47422 } 47423 47424 case FunctionComponent: 47425 { 47426 if (typeof nextType === 'function') { 47427 needsCompareFamilies = true; 47428 } else if ($$typeofNextType === REACT_LAZY_TYPE) { 47429 // We don't know the inner type yet. 47430 // We're going to assume that the lazy inner type is stable, 47431 // and so it is sufficient to avoid reconciling it away. 47432 // We're not going to unwrap or actually use the new lazy type. 47433 needsCompareFamilies = true; 47434 } 47435 47436 break; 47437 } 47438 47439 case ForwardRef: 47440 { 47441 if ($$typeofNextType === REACT_FORWARD_REF_TYPE) { 47442 needsCompareFamilies = true; 47443 } else if ($$typeofNextType === REACT_LAZY_TYPE) { 47444 needsCompareFamilies = true; 47445 } 47446 47447 break; 47448 } 47449 47450 case MemoComponent: 47451 case SimpleMemoComponent: 47452 { 47453 if ($$typeofNextType === REACT_MEMO_TYPE) { 47454 // TODO: if it was but can no longer be simple, 47455 // we shouldn't set this. 47456 needsCompareFamilies = true; 47457 } else if ($$typeofNextType === REACT_LAZY_TYPE) { 47458 needsCompareFamilies = true; 47459 } 47460 47461 break; 47462 } 47463 47464 default: 47465 return false; 47466 } // Check if both types have a family and it's the same one. 47467 47468 47469 if (needsCompareFamilies) { 47470 // Note: memo() and forwardRef() we'll compare outer rather than inner type. 47471 // This means both of them need to be registered to preserve state. 47472 // If we unwrapped and compared the inner types for wrappers instead, 47473 // then we would risk falsely saying two separate memo(Foo) 47474 // calls are equivalent because they wrap the same Foo function. 47475 var prevFamily = resolveFamily(prevType); 47476 47477 if (prevFamily !== undefined && prevFamily === resolveFamily(nextType)) { 47478 return true; 47479 } 47480 } 47481 47482 return false; 47483 } 47484} 47485function markFailedErrorBoundaryForHotReloading(fiber) { 47486 { 47487 if (resolveFamily === null) { 47488 // Hot reloading is disabled. 47489 return; 47490 } 47491 47492 if (typeof WeakSet !== 'function') { 47493 return; 47494 } 47495 47496 if (failedBoundaries === null) { 47497 failedBoundaries = new WeakSet(); 47498 } 47499 47500 failedBoundaries.add(fiber); 47501 } 47502} 47503var scheduleRefresh = function (root, update) { 47504 { 47505 if (resolveFamily === null) { 47506 // Hot reloading is disabled. 47507 return; 47508 } 47509 47510 var staleFamilies = update.staleFamilies, 47511 updatedFamilies = update.updatedFamilies; 47512 flushPassiveEffects(); 47513 flushSync(function () { 47514 scheduleFibersWithFamiliesRecursively(root.current, updatedFamilies, staleFamilies); 47515 }); 47516 } 47517}; 47518var scheduleRoot = function (root, element) { 47519 { 47520 if (root.context !== emptyContextObject) { 47521 // Super edge case: root has a legacy _renderSubtree context 47522 // but we don't know the parentComponent so we can't pass it. 47523 // Just ignore. We'll delete this with _renderSubtree code path later. 47524 return; 47525 } 47526 47527 flushPassiveEffects(); 47528 flushSync(function () { 47529 updateContainer(element, root, null, null); 47530 }); 47531 } 47532}; 47533 47534function scheduleFibersWithFamiliesRecursively(fiber, updatedFamilies, staleFamilies) { 47535 { 47536 var alternate = fiber.alternate, 47537 child = fiber.child, 47538 sibling = fiber.sibling, 47539 tag = fiber.tag, 47540 type = fiber.type; 47541 var candidateType = null; 47542 47543 switch (tag) { 47544 case FunctionComponent: 47545 case SimpleMemoComponent: 47546 case ClassComponent: 47547 candidateType = type; 47548 break; 47549 47550 case ForwardRef: 47551 candidateType = type.render; 47552 break; 47553 } 47554 47555 if (resolveFamily === null) { 47556 throw new Error('Expected resolveFamily to be set during hot reload.'); 47557 } 47558 47559 var needsRender = false; 47560 var needsRemount = false; 47561 47562 if (candidateType !== null) { 47563 var family = resolveFamily(candidateType); 47564 47565 if (family !== undefined) { 47566 if (staleFamilies.has(family)) { 47567 needsRemount = true; 47568 } else if (updatedFamilies.has(family)) { 47569 if (tag === ClassComponent) { 47570 needsRemount = true; 47571 } else { 47572 needsRender = true; 47573 } 47574 } 47575 } 47576 } 47577 47578 if (failedBoundaries !== null) { 47579 if (failedBoundaries.has(fiber) || alternate !== null && failedBoundaries.has(alternate)) { 47580 needsRemount = true; 47581 } 47582 } 47583 47584 if (needsRemount) { 47585 fiber._debugNeedsRemount = true; 47586 } 47587 47588 if (needsRemount || needsRender) { 47589 var _root = enqueueConcurrentRenderForLane(fiber, SyncLane); 47590 47591 if (_root !== null) { 47592 scheduleUpdateOnFiber(_root, fiber, SyncLane, NoTimestamp); 47593 } 47594 } 47595 47596 if (child !== null && !needsRemount) { 47597 scheduleFibersWithFamiliesRecursively(child, updatedFamilies, staleFamilies); 47598 } 47599 47600 if (sibling !== null) { 47601 scheduleFibersWithFamiliesRecursively(sibling, updatedFamilies, staleFamilies); 47602 } 47603 } 47604} 47605 47606var findHostInstancesForRefresh = function (root, families) { 47607 { 47608 var hostInstances = new Set(); 47609 var types = new Set(families.map(function (family) { 47610 return family.current; 47611 })); 47612 findHostInstancesForMatchingFibersRecursively(root.current, types, hostInstances); 47613 return hostInstances; 47614 } 47615}; 47616 47617function findHostInstancesForMatchingFibersRecursively(fiber, types, hostInstances) { 47618 { 47619 var child = fiber.child, 47620 sibling = fiber.sibling, 47621 tag = fiber.tag, 47622 type = fiber.type; 47623 var candidateType = null; 47624 47625 switch (tag) { 47626 case FunctionComponent: 47627 case SimpleMemoComponent: 47628 case ClassComponent: 47629 candidateType = type; 47630 break; 47631 47632 case ForwardRef: 47633 candidateType = type.render; 47634 break; 47635 } 47636 47637 var didMatch = false; 47638 47639 if (candidateType !== null) { 47640 if (types.has(candidateType)) { 47641 didMatch = true; 47642 } 47643 } 47644 47645 if (didMatch) { 47646 // We have a match. This only drills down to the closest host components. 47647 // There's no need to search deeper because for the purpose of giving 47648 // visual feedback, "flashing" outermost parent rectangles is sufficient. 47649 findHostInstancesForFiberShallowly(fiber, hostInstances); 47650 } else { 47651 // If there's no match, maybe there will be one further down in the child tree. 47652 if (child !== null) { 47653 findHostInstancesForMatchingFibersRecursively(child, types, hostInstances); 47654 } 47655 } 47656 47657 if (sibling !== null) { 47658 findHostInstancesForMatchingFibersRecursively(sibling, types, hostInstances); 47659 } 47660 } 47661} 47662 47663function findHostInstancesForFiberShallowly(fiber, hostInstances) { 47664 { 47665 var foundHostInstances = findChildHostInstancesForFiberShallowly(fiber, hostInstances); 47666 47667 if (foundHostInstances) { 47668 return; 47669 } // If we didn't find any host children, fallback to closest host parent. 47670 47671 47672 var node = fiber; 47673 47674 while (true) { 47675 switch (node.tag) { 47676 case HostComponent: 47677 hostInstances.add(node.stateNode); 47678 return; 47679 47680 case HostPortal: 47681 hostInstances.add(node.stateNode.containerInfo); 47682 return; 47683 47684 case HostRoot: 47685 hostInstances.add(node.stateNode.containerInfo); 47686 return; 47687 } 47688 47689 if (node.return === null) { 47690 throw new Error('Expected to reach root first.'); 47691 } 47692 47693 node = node.return; 47694 } 47695 } 47696} 47697 47698function findChildHostInstancesForFiberShallowly(fiber, hostInstances) { 47699 { 47700 var node = fiber; 47701 var foundHostInstances = false; 47702 47703 while (true) { 47704 if (node.tag === HostComponent) { 47705 // We got a match. 47706 foundHostInstances = true; 47707 hostInstances.add(node.stateNode); // There may still be more, so keep searching. 47708 } else if (node.child !== null) { 47709 node.child.return = node; 47710 node = node.child; 47711 continue; 47712 } 47713 47714 if (node === fiber) { 47715 return foundHostInstances; 47716 } 47717 47718 while (node.sibling === null) { 47719 if (node.return === null || node.return === fiber) { 47720 return foundHostInstances; 47721 } 47722 47723 node = node.return; 47724 } 47725 47726 node.sibling.return = node.return; 47727 node = node.sibling; 47728 } 47729 } 47730 47731 return false; 47732} 47733 47734var hasBadMapPolyfill; 47735 47736{ 47737 hasBadMapPolyfill = false; 47738 47739 try { 47740 var nonExtensibleObject = Object.preventExtensions({}); 47741 /* eslint-disable no-new */ 47742 47743 new Map([[nonExtensibleObject, null]]); 47744 new Set([nonExtensibleObject]); 47745 /* eslint-enable no-new */ 47746 } catch (e) { 47747 // TODO: Consider warning about bad polyfills 47748 hasBadMapPolyfill = true; 47749 } 47750} 47751 47752function FiberNode(tag, pendingProps, key, mode) { 47753 // Instance 47754 this.tag = tag; 47755 this.key = key; 47756 this.elementType = null; 47757 this.type = null; 47758 this.stateNode = null; // Fiber 47759 47760 this.return = null; 47761 this.child = null; 47762 this.sibling = null; 47763 this.index = 0; 47764 this.ref = null; 47765 this.pendingProps = pendingProps; 47766 this.memoizedProps = null; 47767 this.updateQueue = null; 47768 this.memoizedState = null; 47769 this.dependencies = null; 47770 this.mode = mode; // Effects 47771 47772 this.flags = NoFlags; 47773 this.subtreeFlags = NoFlags; 47774 this.deletions = null; 47775 this.lanes = NoLanes; 47776 this.childLanes = NoLanes; 47777 this.alternate = null; 47778 47779 { 47780 // Note: The following is done to avoid a v8 performance cliff. 47781 // 47782 // Initializing the fields below to smis and later updating them with 47783 // double values will cause Fibers to end up having separate shapes. 47784 // This behavior/bug has something to do with Object.preventExtension(). 47785 // Fortunately this only impacts DEV builds. 47786 // Unfortunately it makes React unusably slow for some applications. 47787 // To work around this, initialize the fields below with doubles. 47788 // 47789 // Learn more about this here: 47790 // https://github.com/facebook/react/issues/14365 47791 // https://bugs.chromium.org/p/v8/issues/detail?id=8538 47792 this.actualDuration = Number.NaN; 47793 this.actualStartTime = Number.NaN; 47794 this.selfBaseDuration = Number.NaN; 47795 this.treeBaseDuration = Number.NaN; // It's okay to replace the initial doubles with smis after initialization. 47796 // This won't trigger the performance cliff mentioned above, 47797 // and it simplifies other profiler code (including DevTools). 47798 47799 this.actualDuration = 0; 47800 this.actualStartTime = -1; 47801 this.selfBaseDuration = 0; 47802 this.treeBaseDuration = 0; 47803 } 47804 47805 { 47806 // This isn't directly used but is handy for debugging internals: 47807 this._debugSource = null; 47808 this._debugOwner = null; 47809 this._debugNeedsRemount = false; 47810 this._debugHookTypes = null; 47811 47812 if (!hasBadMapPolyfill && typeof Object.preventExtensions === 'function') { 47813 Object.preventExtensions(this); 47814 } 47815 } 47816} // This is a constructor function, rather than a POJO constructor, still 47817// please ensure we do the following: 47818// 1) Nobody should add any instance methods on this. Instance methods can be 47819// more difficult to predict when they get optimized and they are almost 47820// never inlined properly in static compilers. 47821// 2) Nobody should rely on `instanceof Fiber` for type testing. We should 47822// always know when it is a fiber. 47823// 3) We might want to experiment with using numeric keys since they are easier 47824// to optimize in a non-JIT environment. 47825// 4) We can easily go from a constructor to a createFiber object literal if that 47826// is faster. 47827// 5) It should be easy to port this to a C struct and keep a C implementation 47828// compatible. 47829 47830 47831var createFiber = function (tag, pendingProps, key, mode) { 47832 // $FlowFixMe: the shapes are exact here but Flow doesn't like constructors 47833 return new FiberNode(tag, pendingProps, key, mode); 47834}; 47835 47836function shouldConstruct$1(Component) { 47837 var prototype = Component.prototype; 47838 return !!(prototype && prototype.isReactComponent); 47839} 47840 47841function isSimpleFunctionComponent(type) { 47842 return typeof type === 'function' && !shouldConstruct$1(type) && type.defaultProps === undefined; 47843} 47844function resolveLazyComponentTag(Component) { 47845 if (typeof Component === 'function') { 47846 return shouldConstruct$1(Component) ? ClassComponent : FunctionComponent; 47847 } else if (Component !== undefined && Component !== null) { 47848 var $$typeof = Component.$$typeof; 47849 47850 if ($$typeof === REACT_FORWARD_REF_TYPE) { 47851 return ForwardRef; 47852 } 47853 47854 if ($$typeof === REACT_MEMO_TYPE) { 47855 return MemoComponent; 47856 } 47857 } 47858 47859 return IndeterminateComponent; 47860} // This is used to create an alternate fiber to do work on. 47861 47862function createWorkInProgress(current, pendingProps) { 47863 var workInProgress = current.alternate; 47864 47865 if (workInProgress === null) { 47866 // We use a double buffering pooling technique because we know that we'll 47867 // only ever need at most two versions of a tree. We pool the "other" unused 47868 // node that we're free to reuse. This is lazily created to avoid allocating 47869 // extra objects for things that are never updated. It also allow us to 47870 // reclaim the extra memory if needed. 47871 workInProgress = createFiber(current.tag, pendingProps, current.key, current.mode); 47872 workInProgress.elementType = current.elementType; 47873 workInProgress.type = current.type; 47874 workInProgress.stateNode = current.stateNode; 47875 47876 { 47877 // DEV-only fields 47878 workInProgress._debugSource = current._debugSource; 47879 workInProgress._debugOwner = current._debugOwner; 47880 workInProgress._debugHookTypes = current._debugHookTypes; 47881 } 47882 47883 workInProgress.alternate = current; 47884 current.alternate = workInProgress; 47885 } else { 47886 workInProgress.pendingProps = pendingProps; // Needed because Blocks store data on type. 47887 47888 workInProgress.type = current.type; // We already have an alternate. 47889 // Reset the effect tag. 47890 47891 workInProgress.flags = NoFlags; // The effects are no longer valid. 47892 47893 workInProgress.subtreeFlags = NoFlags; 47894 workInProgress.deletions = null; 47895 47896 { 47897 // We intentionally reset, rather than copy, actualDuration & actualStartTime. 47898 // This prevents time from endlessly accumulating in new commits. 47899 // This has the downside of resetting values for different priority renders, 47900 // But works for yielding (the common case) and should support resuming. 47901 workInProgress.actualDuration = 0; 47902 workInProgress.actualStartTime = -1; 47903 } 47904 } // Reset all effects except static ones. 47905 // Static effects are not specific to a render. 47906 47907 47908 workInProgress.flags = current.flags & StaticMask; 47909 workInProgress.childLanes = current.childLanes; 47910 workInProgress.lanes = current.lanes; 47911 workInProgress.child = current.child; 47912 workInProgress.memoizedProps = current.memoizedProps; 47913 workInProgress.memoizedState = current.memoizedState; 47914 workInProgress.updateQueue = current.updateQueue; // Clone the dependencies object. This is mutated during the render phase, so 47915 // it cannot be shared with the current fiber. 47916 47917 var currentDependencies = current.dependencies; 47918 workInProgress.dependencies = currentDependencies === null ? null : { 47919 lanes: currentDependencies.lanes, 47920 firstContext: currentDependencies.firstContext 47921 }; // These will be overridden during the parent's reconciliation 47922 47923 workInProgress.sibling = current.sibling; 47924 workInProgress.index = current.index; 47925 workInProgress.ref = current.ref; 47926 47927 { 47928 workInProgress.selfBaseDuration = current.selfBaseDuration; 47929 workInProgress.treeBaseDuration = current.treeBaseDuration; 47930 } 47931 47932 { 47933 workInProgress._debugNeedsRemount = current._debugNeedsRemount; 47934 47935 switch (workInProgress.tag) { 47936 case IndeterminateComponent: 47937 case FunctionComponent: 47938 case SimpleMemoComponent: 47939 workInProgress.type = resolveFunctionForHotReloading(current.type); 47940 break; 47941 47942 case ClassComponent: 47943 workInProgress.type = resolveClassForHotReloading(current.type); 47944 break; 47945 47946 case ForwardRef: 47947 workInProgress.type = resolveForwardRefForHotReloading(current.type); 47948 break; 47949 } 47950 } 47951 47952 return workInProgress; 47953} // Used to reuse a Fiber for a second pass. 47954 47955function resetWorkInProgress(workInProgress, renderLanes) { 47956 // This resets the Fiber to what createFiber or createWorkInProgress would 47957 // have set the values to before during the first pass. Ideally this wouldn't 47958 // be necessary but unfortunately many code paths reads from the workInProgress 47959 // when they should be reading from current and writing to workInProgress. 47960 // We assume pendingProps, index, key, ref, return are still untouched to 47961 // avoid doing another reconciliation. 47962 // Reset the effect flags but keep any Placement tags, since that's something 47963 // that child fiber is setting, not the reconciliation. 47964 workInProgress.flags &= StaticMask | Placement; // The effects are no longer valid. 47965 47966 var current = workInProgress.alternate; 47967 47968 if (current === null) { 47969 // Reset to createFiber's initial values. 47970 workInProgress.childLanes = NoLanes; 47971 workInProgress.lanes = renderLanes; 47972 workInProgress.child = null; 47973 workInProgress.subtreeFlags = NoFlags; 47974 workInProgress.memoizedProps = null; 47975 workInProgress.memoizedState = null; 47976 workInProgress.updateQueue = null; 47977 workInProgress.dependencies = null; 47978 workInProgress.stateNode = null; 47979 47980 { 47981 // Note: We don't reset the actualTime counts. It's useful to accumulate 47982 // actual time across multiple render passes. 47983 workInProgress.selfBaseDuration = 0; 47984 workInProgress.treeBaseDuration = 0; 47985 } 47986 } else { 47987 // Reset to the cloned values that createWorkInProgress would've. 47988 workInProgress.childLanes = current.childLanes; 47989 workInProgress.lanes = current.lanes; 47990 workInProgress.child = current.child; 47991 workInProgress.subtreeFlags = NoFlags; 47992 workInProgress.deletions = null; 47993 workInProgress.memoizedProps = current.memoizedProps; 47994 workInProgress.memoizedState = current.memoizedState; 47995 workInProgress.updateQueue = current.updateQueue; // Needed because Blocks store data on type. 47996 47997 workInProgress.type = current.type; // Clone the dependencies object. This is mutated during the render phase, so 47998 // it cannot be shared with the current fiber. 47999 48000 var currentDependencies = current.dependencies; 48001 workInProgress.dependencies = currentDependencies === null ? null : { 48002 lanes: currentDependencies.lanes, 48003 firstContext: currentDependencies.firstContext 48004 }; 48005 48006 { 48007 // Note: We don't reset the actualTime counts. It's useful to accumulate 48008 // actual time across multiple render passes. 48009 workInProgress.selfBaseDuration = current.selfBaseDuration; 48010 workInProgress.treeBaseDuration = current.treeBaseDuration; 48011 } 48012 } 48013 48014 return workInProgress; 48015} 48016function createHostRootFiber(tag, isStrictMode, concurrentUpdatesByDefaultOverride) { 48017 var mode; 48018 48019 if (tag === ConcurrentRoot) { 48020 mode = ConcurrentMode; 48021 48022 if (isStrictMode === true) { 48023 mode |= StrictLegacyMode; 48024 48025 { 48026 mode |= StrictEffectsMode; 48027 } 48028 } 48029 } else { 48030 mode = NoMode; 48031 } 48032 48033 if ( isDevToolsPresent) { 48034 // Always collect profile timings when DevTools are present. 48035 // This enables DevTools to start capturing timing at any pointâ 48036 // Without some nodes in the tree having empty base times. 48037 mode |= ProfileMode; 48038 } 48039 48040 return createFiber(HostRoot, null, null, mode); 48041} 48042function createFiberFromTypeAndProps(type, // React$ElementType 48043key, pendingProps, owner, mode, lanes) { 48044 var fiberTag = IndeterminateComponent; // The resolved type is set if we know what the final type will be. I.e. it's not lazy. 48045 48046 var resolvedType = type; 48047 48048 if (typeof type === 'function') { 48049 if (shouldConstruct$1(type)) { 48050 fiberTag = ClassComponent; 48051 48052 { 48053 resolvedType = resolveClassForHotReloading(resolvedType); 48054 } 48055 } else { 48056 { 48057 resolvedType = resolveFunctionForHotReloading(resolvedType); 48058 } 48059 } 48060 } else if (typeof type === 'string') { 48061 fiberTag = HostComponent; 48062 } else { 48063 getTag: switch (type) { 48064 case REACT_FRAGMENT_TYPE: 48065 return createFiberFromFragment(pendingProps.children, mode, lanes, key); 48066 48067 case REACT_STRICT_MODE_TYPE: 48068 fiberTag = Mode; 48069 mode |= StrictLegacyMode; 48070 48071 if ( (mode & ConcurrentMode) !== NoMode) { 48072 // Strict effects should never run on legacy roots 48073 mode |= StrictEffectsMode; 48074 } 48075 48076 break; 48077 48078 case REACT_PROFILER_TYPE: 48079 return createFiberFromProfiler(pendingProps, mode, lanes, key); 48080 48081 case REACT_SUSPENSE_TYPE: 48082 return createFiberFromSuspense(pendingProps, mode, lanes, key); 48083 48084 case REACT_SUSPENSE_LIST_TYPE: 48085 return createFiberFromSuspenseList(pendingProps, mode, lanes, key); 48086 48087 case REACT_OFFSCREEN_TYPE: 48088 return createFiberFromOffscreen(pendingProps, mode, lanes, key); 48089 48090 case REACT_LEGACY_HIDDEN_TYPE: 48091 48092 // eslint-disable-next-line no-fallthrough 48093 48094 case REACT_SCOPE_TYPE: 48095 48096 // eslint-disable-next-line no-fallthrough 48097 48098 case REACT_CACHE_TYPE: 48099 48100 // eslint-disable-next-line no-fallthrough 48101 48102 case REACT_TRACING_MARKER_TYPE: 48103 48104 // eslint-disable-next-line no-fallthrough 48105 48106 case REACT_DEBUG_TRACING_MODE_TYPE: 48107 48108 // eslint-disable-next-line no-fallthrough 48109 48110 default: 48111 { 48112 if (typeof type === 'object' && type !== null) { 48113 switch (type.$$typeof) { 48114 case REACT_PROVIDER_TYPE: 48115 fiberTag = ContextProvider; 48116 break getTag; 48117 48118 case REACT_CONTEXT_TYPE: 48119 // This is a consumer 48120 fiberTag = ContextConsumer; 48121 break getTag; 48122 48123 case REACT_FORWARD_REF_TYPE: 48124 fiberTag = ForwardRef; 48125 48126 { 48127 resolvedType = resolveForwardRefForHotReloading(resolvedType); 48128 } 48129 48130 break getTag; 48131 48132 case REACT_MEMO_TYPE: 48133 fiberTag = MemoComponent; 48134 break getTag; 48135 48136 case REACT_LAZY_TYPE: 48137 fiberTag = LazyComponent; 48138 resolvedType = null; 48139 break getTag; 48140 } 48141 } 48142 48143 var info = ''; 48144 48145 { 48146 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { 48147 info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and " + 'named imports.'; 48148 } 48149 48150 var ownerName = owner ? getComponentNameFromFiber(owner) : null; 48151 48152 if (ownerName) { 48153 info += '\n\nCheck the render method of `' + ownerName + '`.'; 48154 } 48155 } 48156 48157 throw new Error('Element type is invalid: expected a string (for built-in ' + 'components) or a class/function (for composite components) ' + ("but got: " + (type == null ? type : typeof type) + "." + info)); 48158 } 48159 } 48160 } 48161 48162 var fiber = createFiber(fiberTag, pendingProps, key, mode); 48163 fiber.elementType = type; 48164 fiber.type = resolvedType; 48165 fiber.lanes = lanes; 48166 48167 { 48168 fiber._debugOwner = owner; 48169 } 48170 48171 return fiber; 48172} 48173function createFiberFromElement(element, mode, lanes) { 48174 var owner = null; 48175 48176 { 48177 owner = element._owner; 48178 } 48179 48180 var type = element.type; 48181 var key = element.key; 48182 var pendingProps = element.props; 48183 var fiber = createFiberFromTypeAndProps(type, key, pendingProps, owner, mode, lanes); 48184 48185 { 48186 fiber._debugSource = element._source; 48187 fiber._debugOwner = element._owner; 48188 } 48189 48190 return fiber; 48191} 48192function createFiberFromFragment(elements, mode, lanes, key) { 48193 var fiber = createFiber(Fragment, elements, key, mode); 48194 fiber.lanes = lanes; 48195 return fiber; 48196} 48197 48198function createFiberFromProfiler(pendingProps, mode, lanes, key) { 48199 { 48200 if (typeof pendingProps.id !== 'string') { 48201 error('Profiler must specify an "id" of type `string` as a prop. Received the type `%s` instead.', typeof pendingProps.id); 48202 } 48203 } 48204 48205 var fiber = createFiber(Profiler, pendingProps, key, mode | ProfileMode); 48206 fiber.elementType = REACT_PROFILER_TYPE; 48207 fiber.lanes = lanes; 48208 48209 { 48210 fiber.stateNode = { 48211 effectDuration: 0, 48212 passiveEffectDuration: 0 48213 }; 48214 } 48215 48216 return fiber; 48217} 48218 48219function createFiberFromSuspense(pendingProps, mode, lanes, key) { 48220 var fiber = createFiber(SuspenseComponent, pendingProps, key, mode); 48221 fiber.elementType = REACT_SUSPENSE_TYPE; 48222 fiber.lanes = lanes; 48223 return fiber; 48224} 48225function createFiberFromSuspenseList(pendingProps, mode, lanes, key) { 48226 var fiber = createFiber(SuspenseListComponent, pendingProps, key, mode); 48227 fiber.elementType = REACT_SUSPENSE_LIST_TYPE; 48228 fiber.lanes = lanes; 48229 return fiber; 48230} 48231function createFiberFromOffscreen(pendingProps, mode, lanes, key) { 48232 var fiber = createFiber(OffscreenComponent, pendingProps, key, mode); 48233 fiber.elementType = REACT_OFFSCREEN_TYPE; 48234 fiber.lanes = lanes; 48235 var primaryChildInstance = { 48236 isHidden: false 48237 }; 48238 fiber.stateNode = primaryChildInstance; 48239 return fiber; 48240} 48241function createFiberFromText(content, mode, lanes) { 48242 var fiber = createFiber(HostText, content, null, mode); 48243 fiber.lanes = lanes; 48244 return fiber; 48245} 48246function createFiberFromHostInstanceForDeletion() { 48247 var fiber = createFiber(HostComponent, null, null, NoMode); 48248 fiber.elementType = 'DELETED'; 48249 return fiber; 48250} 48251function createFiberFromDehydratedFragment(dehydratedNode) { 48252 var fiber = createFiber(DehydratedFragment, null, null, NoMode); 48253 fiber.stateNode = dehydratedNode; 48254 return fiber; 48255} 48256function createFiberFromPortal(portal, mode, lanes) { 48257 var pendingProps = portal.children !== null ? portal.children : []; 48258 var fiber = createFiber(HostPortal, pendingProps, portal.key, mode); 48259 fiber.lanes = lanes; 48260 fiber.stateNode = { 48261 containerInfo: portal.containerInfo, 48262 pendingChildren: null, 48263 // Used by persistent updates 48264 implementation: portal.implementation 48265 }; 48266 return fiber; 48267} // Used for stashing WIP properties to replay failed work in DEV. 48268 48269function assignFiberPropertiesInDEV(target, source) { 48270 if (target === null) { 48271 // This Fiber's initial properties will always be overwritten. 48272 // We only use a Fiber to ensure the same hidden class so DEV isn't slow. 48273 target = createFiber(IndeterminateComponent, null, null, NoMode); 48274 } // This is intentionally written as a list of all properties. 48275 // We tried to use Object.assign() instead but this is called in 48276 // the hottest path, and Object.assign() was too slow: 48277 // https://github.com/facebook/react/issues/12502 48278 // This code is DEV-only so size is not a concern. 48279 48280 48281 target.tag = source.tag; 48282 target.key = source.key; 48283 target.elementType = source.elementType; 48284 target.type = source.type; 48285 target.stateNode = source.stateNode; 48286 target.return = source.return; 48287 target.child = source.child; 48288 target.sibling = source.sibling; 48289 target.index = source.index; 48290 target.ref = source.ref; 48291 target.pendingProps = source.pendingProps; 48292 target.memoizedProps = source.memoizedProps; 48293 target.updateQueue = source.updateQueue; 48294 target.memoizedState = source.memoizedState; 48295 target.dependencies = source.dependencies; 48296 target.mode = source.mode; 48297 target.flags = source.flags; 48298 target.subtreeFlags = source.subtreeFlags; 48299 target.deletions = source.deletions; 48300 target.lanes = source.lanes; 48301 target.childLanes = source.childLanes; 48302 target.alternate = source.alternate; 48303 48304 { 48305 target.actualDuration = source.actualDuration; 48306 target.actualStartTime = source.actualStartTime; 48307 target.selfBaseDuration = source.selfBaseDuration; 48308 target.treeBaseDuration = source.treeBaseDuration; 48309 } 48310 48311 target._debugSource = source._debugSource; 48312 target._debugOwner = source._debugOwner; 48313 target._debugNeedsRemount = source._debugNeedsRemount; 48314 target._debugHookTypes = source._debugHookTypes; 48315 return target; 48316} 48317 48318function FiberRootNode(containerInfo, tag, hydrate, identifierPrefix, onRecoverableError) { 48319 this.tag = tag; 48320 this.containerInfo = containerInfo; 48321 this.pendingChildren = null; 48322 this.current = null; 48323 this.pingCache = null; 48324 this.finishedWork = null; 48325 this.timeoutHandle = noTimeout; 48326 this.context = null; 48327 this.pendingContext = null; 48328 this.callbackNode = null; 48329 this.callbackPriority = NoLane; 48330 this.eventTimes = createLaneMap(NoLanes); 48331 this.expirationTimes = createLaneMap(NoTimestamp); 48332 this.pendingLanes = NoLanes; 48333 this.suspendedLanes = NoLanes; 48334 this.pingedLanes = NoLanes; 48335 this.expiredLanes = NoLanes; 48336 this.mutableReadLanes = NoLanes; 48337 this.finishedLanes = NoLanes; 48338 this.entangledLanes = NoLanes; 48339 this.entanglements = createLaneMap(NoLanes); 48340 this.identifierPrefix = identifierPrefix; 48341 this.onRecoverableError = onRecoverableError; 48342 48343 { 48344 this.mutableSourceEagerHydrationData = null; 48345 } 48346 48347 { 48348 this.effectDuration = 0; 48349 this.passiveEffectDuration = 0; 48350 } 48351 48352 { 48353 this.memoizedUpdaters = new Set(); 48354 var pendingUpdatersLaneMap = this.pendingUpdatersLaneMap = []; 48355 48356 for (var _i = 0; _i < TotalLanes; _i++) { 48357 pendingUpdatersLaneMap.push(new Set()); 48358 } 48359 } 48360 48361 { 48362 switch (tag) { 48363 case ConcurrentRoot: 48364 this._debugRootType = hydrate ? 'hydrateRoot()' : 'createRoot()'; 48365 break; 48366 48367 case LegacyRoot: 48368 this._debugRootType = hydrate ? 'hydrate()' : 'render()'; 48369 break; 48370 } 48371 } 48372} 48373 48374function createFiberRoot(containerInfo, tag, hydrate, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, // TODO: We have several of these arguments that are conceptually part of the 48375// host config, but because they are passed in at runtime, we have to thread 48376// them through the root constructor. Perhaps we should put them all into a 48377// single type, like a DynamicHostConfig that is defined by the renderer. 48378identifierPrefix, onRecoverableError, transitionCallbacks) { 48379 var root = new FiberRootNode(containerInfo, tag, hydrate, identifierPrefix, onRecoverableError); 48380 // stateNode is any. 48381 48382 48383 var uninitializedFiber = createHostRootFiber(tag, isStrictMode); 48384 root.current = uninitializedFiber; 48385 uninitializedFiber.stateNode = root; 48386 48387 { 48388 var _initialState = { 48389 element: initialChildren, 48390 isDehydrated: hydrate, 48391 cache: null, 48392 // not enabled yet 48393 transitions: null, 48394 pendingSuspenseBoundaries: null 48395 }; 48396 uninitializedFiber.memoizedState = _initialState; 48397 } 48398 48399 initializeUpdateQueue(uninitializedFiber); 48400 return root; 48401} 48402 48403var ReactVersion = '18.3.1'; 48404 48405function createPortal(children, containerInfo, // TODO: figure out the API for cross-renderer implementation. 48406implementation) { 48407 var key = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null; 48408 48409 { 48410 checkKeyStringCoercion(key); 48411 } 48412 48413 return { 48414 // This tag allow us to uniquely identify this as a React Portal 48415 $$typeof: REACT_PORTAL_TYPE, 48416 key: key == null ? null : '' + key, 48417 children: children, 48418 containerInfo: containerInfo, 48419 implementation: implementation 48420 }; 48421} 48422 48423var didWarnAboutNestedUpdates; 48424var didWarnAboutFindNodeInStrictMode; 48425 48426{ 48427 didWarnAboutNestedUpdates = false; 48428 didWarnAboutFindNodeInStrictMode = {}; 48429} 48430 48431function getContextForSubtree(parentComponent) { 48432 if (!parentComponent) { 48433 return emptyContextObject; 48434 } 48435 48436 var fiber = get(parentComponent); 48437 var parentContext = findCurrentUnmaskedContext(fiber); 48438 48439 if (fiber.tag === ClassComponent) { 48440 var Component = fiber.type; 48441 48442 if (isContextProvider(Component)) { 48443 return processChildContext(fiber, Component, parentContext); 48444 } 48445 } 48446 48447 return parentContext; 48448} 48449 48450function findHostInstanceWithWarning(component, methodName) { 48451 { 48452 var fiber = get(component); 48453 48454 if (fiber === undefined) { 48455 if (typeof component.render === 'function') { 48456 throw new Error('Unable to find node on an unmounted component.'); 48457 } else { 48458 var keys = Object.keys(component).join(','); 48459 throw new Error("Argument appears to not be a ReactComponent. Keys: " + keys); 48460 } 48461 } 48462 48463 var hostFiber = findCurrentHostFiber(fiber); 48464 48465 if (hostFiber === null) { 48466 return null; 48467 } 48468 48469 if (hostFiber.mode & StrictLegacyMode) { 48470 var componentName = getComponentNameFromFiber(fiber) || 'Component'; 48471 48472 if (!didWarnAboutFindNodeInStrictMode[componentName]) { 48473 didWarnAboutFindNodeInStrictMode[componentName] = true; 48474 var previousFiber = current; 48475 48476 try { 48477 setCurrentFiber(hostFiber); 48478 48479 if (fiber.mode & StrictLegacyMode) { 48480 error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which is inside StrictMode. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-find-node', methodName, methodName, componentName); 48481 } else { 48482 error('%s is deprecated in StrictMode. ' + '%s was passed an instance of %s which renders StrictMode children. ' + 'Instead, add a ref directly to the element you want to reference. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-find-node', methodName, methodName, componentName); 48483 } 48484 } finally { 48485 // Ideally this should reset to previous but this shouldn't be called in 48486 // render and there's another warning for that anyway. 48487 if (previousFiber) { 48488 setCurrentFiber(previousFiber); 48489 } else { 48490 resetCurrentFiber(); 48491 } 48492 } 48493 } 48494 } 48495 48496 return hostFiber.stateNode; 48497 } 48498} 48499 48500function createContainer(containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) { 48501 var hydrate = false; 48502 var initialChildren = null; 48503 return createFiberRoot(containerInfo, tag, hydrate, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); 48504} 48505function createHydrationContainer(initialChildren, // TODO: Remove `callback` when we delete legacy mode. 48506callback, containerInfo, tag, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError, transitionCallbacks) { 48507 var hydrate = true; 48508 var root = createFiberRoot(containerInfo, tag, hydrate, initialChildren, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); // TODO: Move this to FiberRoot constructor 48509 48510 root.context = getContextForSubtree(null); // Schedule the initial render. In a hydration root, this is different from 48511 // a regular update because the initial render must match was was rendered 48512 // on the server. 48513 // NOTE: This update intentionally doesn't have a payload. We're only using 48514 // the update to schedule work on the root fiber (and, for legacy roots, to 48515 // enqueue the callback if one is provided). 48516 48517 var current = root.current; 48518 var eventTime = requestEventTime(); 48519 var lane = requestUpdateLane(current); 48520 var update = createUpdate(eventTime, lane); 48521 update.callback = callback !== undefined && callback !== null ? callback : null; 48522 enqueueUpdate(current, update, lane); 48523 scheduleInitialHydrationOnRoot(root, lane, eventTime); 48524 return root; 48525} 48526function updateContainer(element, container, parentComponent, callback) { 48527 { 48528 onScheduleRoot(container, element); 48529 } 48530 48531 var current$1 = container.current; 48532 var eventTime = requestEventTime(); 48533 var lane = requestUpdateLane(current$1); 48534 48535 { 48536 markRenderScheduled(lane); 48537 } 48538 48539 var context = getContextForSubtree(parentComponent); 48540 48541 if (container.context === null) { 48542 container.context = context; 48543 } else { 48544 container.pendingContext = context; 48545 } 48546 48547 { 48548 if (isRendering && current !== null && !didWarnAboutNestedUpdates) { 48549 didWarnAboutNestedUpdates = true; 48550 48551 error('Render methods should be a pure function of props and state; ' + 'triggering nested component updates from render is not allowed. ' + 'If necessary, trigger nested updates in componentDidUpdate.\n\n' + 'Check the render method of %s.', getComponentNameFromFiber(current) || 'Unknown'); 48552 } 48553 } 48554 48555 var update = createUpdate(eventTime, lane); // Caution: React DevTools currently depends on this property 48556 // being called "element". 48557 48558 update.payload = { 48559 element: element 48560 }; 48561 callback = callback === undefined ? null : callback; 48562 48563 if (callback !== null) { 48564 { 48565 if (typeof callback !== 'function') { 48566 error('render(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callback); 48567 } 48568 } 48569 48570 update.callback = callback; 48571 } 48572 48573 var root = enqueueUpdate(current$1, update, lane); 48574 48575 if (root !== null) { 48576 scheduleUpdateOnFiber(root, current$1, lane, eventTime); 48577 entangleTransitions(root, current$1, lane); 48578 } 48579 48580 return lane; 48581} 48582function getPublicRootInstance(container) { 48583 var containerFiber = container.current; 48584 48585 if (!containerFiber.child) { 48586 return null; 48587 } 48588 48589 switch (containerFiber.child.tag) { 48590 case HostComponent: 48591 return getPublicInstance(containerFiber.child.stateNode); 48592 48593 default: 48594 return containerFiber.child.stateNode; 48595 } 48596} 48597function attemptSynchronousHydration$1(fiber) { 48598 switch (fiber.tag) { 48599 case HostRoot: 48600 { 48601 var root = fiber.stateNode; 48602 48603 if (isRootDehydrated(root)) { 48604 // Flush the first scheduled "update". 48605 var lanes = getHighestPriorityPendingLanes(root); 48606 flushRoot(root, lanes); 48607 } 48608 48609 break; 48610 } 48611 48612 case SuspenseComponent: 48613 { 48614 flushSync(function () { 48615 var root = enqueueConcurrentRenderForLane(fiber, SyncLane); 48616 48617 if (root !== null) { 48618 var eventTime = requestEventTime(); 48619 scheduleUpdateOnFiber(root, fiber, SyncLane, eventTime); 48620 } 48621 }); // If we're still blocked after this, we need to increase 48622 // the priority of any promises resolving within this 48623 // boundary so that they next attempt also has higher pri. 48624 48625 var retryLane = SyncLane; 48626 markRetryLaneIfNotHydrated(fiber, retryLane); 48627 break; 48628 } 48629 } 48630} 48631 48632function markRetryLaneImpl(fiber, retryLane) { 48633 var suspenseState = fiber.memoizedState; 48634 48635 if (suspenseState !== null && suspenseState.dehydrated !== null) { 48636 suspenseState.retryLane = higherPriorityLane(suspenseState.retryLane, retryLane); 48637 } 48638} // Increases the priority of thenables when they resolve within this boundary. 48639 48640 48641function markRetryLaneIfNotHydrated(fiber, retryLane) { 48642 markRetryLaneImpl(fiber, retryLane); 48643 var alternate = fiber.alternate; 48644 48645 if (alternate) { 48646 markRetryLaneImpl(alternate, retryLane); 48647 } 48648} 48649function attemptContinuousHydration$1(fiber) { 48650 if (fiber.tag !== SuspenseComponent) { 48651 // We ignore HostRoots here because we can't increase 48652 // their priority and they should not suspend on I/O, 48653 // since you have to wrap anything that might suspend in 48654 // Suspense. 48655 return; 48656 } 48657 48658 var lane = SelectiveHydrationLane; 48659 var root = enqueueConcurrentRenderForLane(fiber, lane); 48660 48661 if (root !== null) { 48662 var eventTime = requestEventTime(); 48663 scheduleUpdateOnFiber(root, fiber, lane, eventTime); 48664 } 48665 48666 markRetryLaneIfNotHydrated(fiber, lane); 48667} 48668function attemptHydrationAtCurrentPriority$1(fiber) { 48669 if (fiber.tag !== SuspenseComponent) { 48670 // We ignore HostRoots here because we can't increase 48671 // their priority other than synchronously flush it. 48672 return; 48673 } 48674 48675 var lane = requestUpdateLane(fiber); 48676 var root = enqueueConcurrentRenderForLane(fiber, lane); 48677 48678 if (root !== null) { 48679 var eventTime = requestEventTime(); 48680 scheduleUpdateOnFiber(root, fiber, lane, eventTime); 48681 } 48682 48683 markRetryLaneIfNotHydrated(fiber, lane); 48684} 48685function findHostInstanceWithNoPortals(fiber) { 48686 var hostFiber = findCurrentHostFiberWithNoPortals(fiber); 48687 48688 if (hostFiber === null) { 48689 return null; 48690 } 48691 48692 return hostFiber.stateNode; 48693} 48694 48695var shouldErrorImpl = function (fiber) { 48696 return null; 48697}; 48698 48699function shouldError(fiber) { 48700 return shouldErrorImpl(fiber); 48701} 48702 48703var shouldSuspendImpl = function (fiber) { 48704 return false; 48705}; 48706 48707function shouldSuspend(fiber) { 48708 return shouldSuspendImpl(fiber); 48709} 48710var overrideHookState = null; 48711var overrideHookStateDeletePath = null; 48712var overrideHookStateRenamePath = null; 48713var overrideProps = null; 48714var overridePropsDeletePath = null; 48715var overridePropsRenamePath = null; 48716var scheduleUpdate = null; 48717var setErrorHandler = null; 48718var setSuspenseHandler = null; 48719 48720{ 48721 var copyWithDeleteImpl = function (obj, path, index) { 48722 var key = path[index]; 48723 var updated = isArray(obj) ? obj.slice() : assign({}, obj); 48724 48725 if (index + 1 === path.length) { 48726 if (isArray(updated)) { 48727 updated.splice(key, 1); 48728 } else { 48729 delete updated[key]; 48730 } 48731 48732 return updated; 48733 } // $FlowFixMe number or string is fine here 48734 48735 48736 updated[key] = copyWithDeleteImpl(obj[key], path, index + 1); 48737 return updated; 48738 }; 48739 48740 var copyWithDelete = function (obj, path) { 48741 return copyWithDeleteImpl(obj, path, 0); 48742 }; 48743 48744 var copyWithRenameImpl = function (obj, oldPath, newPath, index) { 48745 var oldKey = oldPath[index]; 48746 var updated = isArray(obj) ? obj.slice() : assign({}, obj); 48747 48748 if (index + 1 === oldPath.length) { 48749 var newKey = newPath[index]; // $FlowFixMe number or string is fine here 48750 48751 updated[newKey] = updated[oldKey]; 48752 48753 if (isArray(updated)) { 48754 updated.splice(oldKey, 1); 48755 } else { 48756 delete updated[oldKey]; 48757 } 48758 } else { 48759 // $FlowFixMe number or string is fine here 48760 updated[oldKey] = copyWithRenameImpl( // $FlowFixMe number or string is fine here 48761 obj[oldKey], oldPath, newPath, index + 1); 48762 } 48763 48764 return updated; 48765 }; 48766 48767 var copyWithRename = function (obj, oldPath, newPath) { 48768 if (oldPath.length !== newPath.length) { 48769 warn('copyWithRename() expects paths of the same length'); 48770 48771 return; 48772 } else { 48773 for (var i = 0; i < newPath.length - 1; i++) { 48774 if (oldPath[i] !== newPath[i]) { 48775 warn('copyWithRename() expects paths to be the same except for the deepest key'); 48776 48777 return; 48778 } 48779 } 48780 } 48781 48782 return copyWithRenameImpl(obj, oldPath, newPath, 0); 48783 }; 48784 48785 var copyWithSetImpl = function (obj, path, index, value) { 48786 if (index >= path.length) { 48787 return value; 48788 } 48789 48790 var key = path[index]; 48791 var updated = isArray(obj) ? obj.slice() : assign({}, obj); // $FlowFixMe number or string is fine here 48792 48793 updated[key] = copyWithSetImpl(obj[key], path, index + 1, value); 48794 return updated; 48795 }; 48796 48797 var copyWithSet = function (obj, path, value) { 48798 return copyWithSetImpl(obj, path, 0, value); 48799 }; 48800 48801 var findHook = function (fiber, id) { 48802 // For now, the "id" of stateful hooks is just the stateful hook index. 48803 // This may change in the future with e.g. nested hooks. 48804 var currentHook = fiber.memoizedState; 48805 48806 while (currentHook !== null && id > 0) { 48807 currentHook = currentHook.next; 48808 id--; 48809 } 48810 48811 return currentHook; 48812 }; // Support DevTools editable values for useState and useReducer. 48813 48814 48815 overrideHookState = function (fiber, id, path, value) { 48816 var hook = findHook(fiber, id); 48817 48818 if (hook !== null) { 48819 var newState = copyWithSet(hook.memoizedState, path, value); 48820 hook.memoizedState = newState; 48821 hook.baseState = newState; // We aren't actually adding an update to the queue, 48822 // because there is no update we can add for useReducer hooks that won't trigger an error. 48823 // (There's no appropriate action type for DevTools overrides.) 48824 // As a result though, React will see the scheduled update as a noop and bailout. 48825 // Shallow cloning props works as a workaround for now to bypass the bailout check. 48826 48827 fiber.memoizedProps = assign({}, fiber.memoizedProps); 48828 var root = enqueueConcurrentRenderForLane(fiber, SyncLane); 48829 48830 if (root !== null) { 48831 scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); 48832 } 48833 } 48834 }; 48835 48836 overrideHookStateDeletePath = function (fiber, id, path) { 48837 var hook = findHook(fiber, id); 48838 48839 if (hook !== null) { 48840 var newState = copyWithDelete(hook.memoizedState, path); 48841 hook.memoizedState = newState; 48842 hook.baseState = newState; // We aren't actually adding an update to the queue, 48843 // because there is no update we can add for useReducer hooks that won't trigger an error. 48844 // (There's no appropriate action type for DevTools overrides.) 48845 // As a result though, React will see the scheduled update as a noop and bailout. 48846 // Shallow cloning props works as a workaround for now to bypass the bailout check. 48847 48848 fiber.memoizedProps = assign({}, fiber.memoizedProps); 48849 var root = enqueueConcurrentRenderForLane(fiber, SyncLane); 48850 48851 if (root !== null) { 48852 scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); 48853 } 48854 } 48855 }; 48856 48857 overrideHookStateRenamePath = function (fiber, id, oldPath, newPath) { 48858 var hook = findHook(fiber, id); 48859 48860 if (hook !== null) { 48861 var newState = copyWithRename(hook.memoizedState, oldPath, newPath); 48862 hook.memoizedState = newState; 48863 hook.baseState = newState; // We aren't actually adding an update to the queue, 48864 // because there is no update we can add for useReducer hooks that won't trigger an error. 48865 // (There's no appropriate action type for DevTools overrides.) 48866 // As a result though, React will see the scheduled update as a noop and bailout. 48867 // Shallow cloning props works as a workaround for now to bypass the bailout check. 48868 48869 fiber.memoizedProps = assign({}, fiber.memoizedProps); 48870 var root = enqueueConcurrentRenderForLane(fiber, SyncLane); 48871 48872 if (root !== null) { 48873 scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); 48874 } 48875 } 48876 }; // Support DevTools props for function components, forwardRef, memo, host components, etc. 48877 48878 48879 overrideProps = function (fiber, path, value) { 48880 fiber.pendingProps = copyWithSet(fiber.memoizedProps, path, value); 48881 48882 if (fiber.alternate) { 48883 fiber.alternate.pendingProps = fiber.pendingProps; 48884 } 48885 48886 var root = enqueueConcurrentRenderForLane(fiber, SyncLane); 48887 48888 if (root !== null) { 48889 scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); 48890 } 48891 }; 48892 48893 overridePropsDeletePath = function (fiber, path) { 48894 fiber.pendingProps = copyWithDelete(fiber.memoizedProps, path); 48895 48896 if (fiber.alternate) { 48897 fiber.alternate.pendingProps = fiber.pendingProps; 48898 } 48899 48900 var root = enqueueConcurrentRenderForLane(fiber, SyncLane); 48901 48902 if (root !== null) { 48903 scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); 48904 } 48905 }; 48906 48907 overridePropsRenamePath = function (fiber, oldPath, newPath) { 48908 fiber.pendingProps = copyWithRename(fiber.memoizedProps, oldPath, newPath); 48909 48910 if (fiber.alternate) { 48911 fiber.alternate.pendingProps = fiber.pendingProps; 48912 } 48913 48914 var root = enqueueConcurrentRenderForLane(fiber, SyncLane); 48915 48916 if (root !== null) { 48917 scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); 48918 } 48919 }; 48920 48921 scheduleUpdate = function (fiber) { 48922 var root = enqueueConcurrentRenderForLane(fiber, SyncLane); 48923 48924 if (root !== null) { 48925 scheduleUpdateOnFiber(root, fiber, SyncLane, NoTimestamp); 48926 } 48927 }; 48928 48929 setErrorHandler = function (newShouldErrorImpl) { 48930 shouldErrorImpl = newShouldErrorImpl; 48931 }; 48932 48933 setSuspenseHandler = function (newShouldSuspendImpl) { 48934 shouldSuspendImpl = newShouldSuspendImpl; 48935 }; 48936} 48937 48938function findHostInstanceByFiber(fiber) { 48939 var hostFiber = findCurrentHostFiber(fiber); 48940 48941 if (hostFiber === null) { 48942 return null; 48943 } 48944 48945 return hostFiber.stateNode; 48946} 48947 48948function emptyFindFiberByHostInstance(instance) { 48949 return null; 48950} 48951 48952function getCurrentFiberForDevTools() { 48953 return current; 48954} 48955 48956function injectIntoDevTools(devToolsConfig) { 48957 var findFiberByHostInstance = devToolsConfig.findFiberByHostInstance; 48958 var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; 48959 return injectInternals({ 48960 bundleType: devToolsConfig.bundleType, 48961 version: devToolsConfig.version, 48962 rendererPackageName: devToolsConfig.rendererPackageName, 48963 rendererConfig: devToolsConfig.rendererConfig, 48964 overrideHookState: overrideHookState, 48965 overrideHookStateDeletePath: overrideHookStateDeletePath, 48966 overrideHookStateRenamePath: overrideHookStateRenamePath, 48967 overrideProps: overrideProps, 48968 overridePropsDeletePath: overridePropsDeletePath, 48969 overridePropsRenamePath: overridePropsRenamePath, 48970 setErrorHandler: setErrorHandler, 48971 setSuspenseHandler: setSuspenseHandler, 48972 scheduleUpdate: scheduleUpdate, 48973 currentDispatcherRef: ReactCurrentDispatcher, 48974 findHostInstanceByFiber: findHostInstanceByFiber, 48975 findFiberByHostInstance: findFiberByHostInstance || emptyFindFiberByHostInstance, 48976 // React Refresh 48977 findHostInstancesForRefresh: findHostInstancesForRefresh , 48978 scheduleRefresh: scheduleRefresh , 48979 scheduleRoot: scheduleRoot , 48980 setRefreshHandler: setRefreshHandler , 48981 // Enables DevTools to append owner stacks to error messages in DEV mode. 48982 getCurrentFiber: getCurrentFiberForDevTools , 48983 // Enables DevTools to detect reconciler version rather than renderer version 48984 // which may not match for third party renderers. 48985 reconcilerVersion: ReactVersion 48986 }); 48987} 48988 48989/* global reportError */ 48990 48991var defaultOnRecoverableError = typeof reportError === 'function' ? // In modern browsers, reportError will dispatch an error event, 48992// emulating an uncaught JavaScript error. 48993reportError : function (error) { 48994 // In older browsers and test environments, fallback to console.error. 48995 // eslint-disable-next-line react-internal/no-production-logging 48996 console['error'](error); 48997}; 48998 48999function ReactDOMRoot(internalRoot) { 49000 this._internalRoot = internalRoot; 49001} 49002 49003ReactDOMHydrationRoot.prototype.render = ReactDOMRoot.prototype.render = function (children) { 49004 var root = this._internalRoot; 49005 49006 if (root === null) { 49007 throw new Error('Cannot update an unmounted root.'); 49008 } 49009 49010 { 49011 if (typeof arguments[1] === 'function') { 49012 error('render(...): does not support the second callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().'); 49013 } else if (isValidContainer(arguments[1])) { 49014 error('You passed a container to the second argument of root.render(...). ' + "You don't need to pass it again since you already passed it to create the root."); 49015 } else if (typeof arguments[1] !== 'undefined') { 49016 error('You passed a second argument to root.render(...) but it only accepts ' + 'one argument.'); 49017 } 49018 49019 var container = root.containerInfo; 49020 49021 if (container.nodeType !== COMMENT_NODE) { 49022 var hostInstance = findHostInstanceWithNoPortals(root.current); 49023 49024 if (hostInstance) { 49025 if (hostInstance.parentNode !== container) { 49026 error('render(...): It looks like the React-rendered content of the ' + 'root container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + "root.unmount() to empty a root's container."); 49027 } 49028 } 49029 } 49030 } 49031 49032 updateContainer(children, root, null, null); 49033}; 49034 49035ReactDOMHydrationRoot.prototype.unmount = ReactDOMRoot.prototype.unmount = function () { 49036 { 49037 if (typeof arguments[0] === 'function') { 49038 error('unmount(...): does not support a callback argument. ' + 'To execute a side effect after rendering, declare it in a component body with useEffect().'); 49039 } 49040 } 49041 49042 var root = this._internalRoot; 49043 49044 if (root !== null) { 49045 this._internalRoot = null; 49046 var container = root.containerInfo; 49047 49048 { 49049 if (isAlreadyRendering()) { 49050 error('Attempted to synchronously unmount a root while React was already ' + 'rendering. React cannot finish unmounting the root until the ' + 'current render has completed, which may lead to a race condition.'); 49051 } 49052 } 49053 49054 flushSync(function () { 49055 updateContainer(null, root, null, null); 49056 }); 49057 unmarkContainerAsRoot(container); 49058 } 49059}; 49060 49061function createRoot(container, options) { 49062 if (!isValidContainer(container)) { 49063 throw new Error('createRoot(...): Target container is not a DOM element.'); 49064 } 49065 49066 warnIfReactDOMContainerInDEV(container); 49067 var isStrictMode = false; 49068 var concurrentUpdatesByDefaultOverride = false; 49069 var identifierPrefix = ''; 49070 var onRecoverableError = defaultOnRecoverableError; 49071 var transitionCallbacks = null; 49072 49073 if (options !== null && options !== undefined) { 49074 { 49075 if (options.hydrate) { 49076 warn('hydrate through createRoot is deprecated. Use ReactDOMClient.hydrateRoot(container, <App />) instead.'); 49077 } else { 49078 if (typeof options === 'object' && options !== null && options.$$typeof === REACT_ELEMENT_TYPE) { 49079 error('You passed a JSX element to createRoot. You probably meant to ' + 'call root.render instead. ' + 'Example usage:\n\n' + ' let root = createRoot(domContainer);\n' + ' root.render(<App />);'); 49080 } 49081 } 49082 } 49083 49084 if (options.unstable_strictMode === true) { 49085 isStrictMode = true; 49086 } 49087 49088 if (options.identifierPrefix !== undefined) { 49089 identifierPrefix = options.identifierPrefix; 49090 } 49091 49092 if (options.onRecoverableError !== undefined) { 49093 onRecoverableError = options.onRecoverableError; 49094 } 49095 49096 if (options.transitionCallbacks !== undefined) { 49097 transitionCallbacks = options.transitionCallbacks; 49098 } 49099 } 49100 49101 var root = createContainer(container, ConcurrentRoot, null, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); 49102 markContainerAsRoot(root.current, container); 49103 var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; 49104 listenToAllSupportedEvents(rootContainerElement); 49105 return new ReactDOMRoot(root); 49106} 49107 49108function ReactDOMHydrationRoot(internalRoot) { 49109 this._internalRoot = internalRoot; 49110} 49111 49112function scheduleHydration(target) { 49113 if (target) { 49114 queueExplicitHydrationTarget(target); 49115 } 49116} 49117 49118ReactDOMHydrationRoot.prototype.unstable_scheduleHydration = scheduleHydration; 49119function hydrateRoot(container, initialChildren, options) { 49120 if (!isValidContainer(container)) { 49121 throw new Error('hydrateRoot(...): Target container is not a DOM element.'); 49122 } 49123 49124 warnIfReactDOMContainerInDEV(container); 49125 49126 { 49127 if (initialChildren === undefined) { 49128 error('Must provide initial children as second argument to hydrateRoot. ' + 'Example usage: hydrateRoot(domContainer, <App />)'); 49129 } 49130 } // For now we reuse the whole bag of options since they contain 49131 // the hydration callbacks. 49132 49133 49134 var hydrationCallbacks = options != null ? options : null; // TODO: Delete this option 49135 49136 var mutableSources = options != null && options.hydratedSources || null; 49137 var isStrictMode = false; 49138 var concurrentUpdatesByDefaultOverride = false; 49139 var identifierPrefix = ''; 49140 var onRecoverableError = defaultOnRecoverableError; 49141 49142 if (options !== null && options !== undefined) { 49143 if (options.unstable_strictMode === true) { 49144 isStrictMode = true; 49145 } 49146 49147 if (options.identifierPrefix !== undefined) { 49148 identifierPrefix = options.identifierPrefix; 49149 } 49150 49151 if (options.onRecoverableError !== undefined) { 49152 onRecoverableError = options.onRecoverableError; 49153 } 49154 } 49155 49156 var root = createHydrationContainer(initialChildren, null, container, ConcurrentRoot, hydrationCallbacks, isStrictMode, concurrentUpdatesByDefaultOverride, identifierPrefix, onRecoverableError); 49157 markContainerAsRoot(root.current, container); // This can't be a comment node since hydration doesn't work on comment nodes anyway. 49158 49159 listenToAllSupportedEvents(container); 49160 49161 if (mutableSources) { 49162 for (var i = 0; i < mutableSources.length; i++) { 49163 var mutableSource = mutableSources[i]; 49164 registerMutableSourceForHydration(root, mutableSource); 49165 } 49166 } 49167 49168 return new ReactDOMHydrationRoot(root); 49169} 49170function isValidContainer(node) { 49171 return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || !disableCommentsAsDOMContainers )); 49172} // TODO: Remove this function which also includes comment nodes. 49173// We only use it in places that are currently more relaxed. 49174 49175function isValidContainerLegacy(node) { 49176 return !!(node && (node.nodeType === ELEMENT_NODE || node.nodeType === DOCUMENT_NODE || node.nodeType === DOCUMENT_FRAGMENT_NODE || node.nodeType === COMMENT_NODE && node.nodeValue === ' react-mount-point-unstable ')); 49177} 49178 49179function warnIfReactDOMContainerInDEV(container) { 49180 { 49181 if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === 'BODY') { 49182 error('createRoot(): Creating roots directly with document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try using a container element created ' + 'for your app.'); 49183 } 49184 49185 if (isContainerMarkedAsRoot(container)) { 49186 if (container._reactRootContainer) { 49187 error('You are calling ReactDOMClient.createRoot() on a container that was previously ' + 'passed to ReactDOM.render(). This is not supported.'); 49188 } else { 49189 error('You are calling ReactDOMClient.createRoot() on a container that ' + 'has already been passed to createRoot() before. Instead, call ' + 'root.render() on the existing root instead if you want to update it.'); 49190 } 49191 } 49192 } 49193} 49194 49195var ReactCurrentOwner$3 = ReactSharedInternals.ReactCurrentOwner; 49196var topLevelUpdateWarnings; 49197 49198{ 49199 topLevelUpdateWarnings = function (container) { 49200 if (container._reactRootContainer && container.nodeType !== COMMENT_NODE) { 49201 var hostInstance = findHostInstanceWithNoPortals(container._reactRootContainer.current); 49202 49203 if (hostInstance) { 49204 if (hostInstance.parentNode !== container) { 49205 error('render(...): It looks like the React-rendered content of this ' + 'container was removed without using React. This is not ' + 'supported and will cause errors. Instead, call ' + 'ReactDOM.unmountComponentAtNode to empty a container.'); 49206 } 49207 } 49208 } 49209 49210 var isRootRenderedBySomeReact = !!container._reactRootContainer; 49211 var rootEl = getReactRootElementInContainer(container); 49212 var hasNonRootReactChild = !!(rootEl && getInstanceFromNode(rootEl)); 49213 49214 if (hasNonRootReactChild && !isRootRenderedBySomeReact) { 49215 error('render(...): Replacing React-rendered children with a new root ' + 'component. If you intended to update the children of this node, ' + 'you should instead have the existing children update their state ' + 'and render the new components instead of calling ReactDOM.render.'); 49216 } 49217 49218 if (container.nodeType === ELEMENT_NODE && container.tagName && container.tagName.toUpperCase() === 'BODY') { 49219 error('render(): Rendering components directly into document.body is ' + 'discouraged, since its children are often manipulated by third-party ' + 'scripts and browser extensions. This may lead to subtle ' + 'reconciliation issues. Try rendering into a container element created ' + 'for your app.'); 49220 } 49221 }; 49222} 49223 49224function getReactRootElementInContainer(container) { 49225 if (!container) { 49226 return null; 49227 } 49228 49229 if (container.nodeType === DOCUMENT_NODE) { 49230 return container.documentElement; 49231 } else { 49232 return container.firstChild; 49233 } 49234} 49235 49236function noopOnRecoverableError() {// This isn't reachable because onRecoverableError isn't called in the 49237 // legacy API. 49238} 49239 49240function legacyCreateRootFromDOMContainer(container, initialChildren, parentComponent, callback, isHydrationContainer) { 49241 if (isHydrationContainer) { 49242 if (typeof callback === 'function') { 49243 var originalCallback = callback; 49244 49245 callback = function () { 49246 var instance = getPublicRootInstance(root); 49247 originalCallback.call(instance); 49248 }; 49249 } 49250 49251 var root = createHydrationContainer(initialChildren, callback, container, LegacyRoot, null, // hydrationCallbacks 49252 false, // isStrictMode 49253 false, // concurrentUpdatesByDefaultOverride, 49254 '', // identifierPrefix 49255 noopOnRecoverableError); 49256 container._reactRootContainer = root; 49257 markContainerAsRoot(root.current, container); 49258 var rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; 49259 listenToAllSupportedEvents(rootContainerElement); 49260 flushSync(); 49261 return root; 49262 } else { 49263 // First clear any existing content. 49264 var rootSibling; 49265 49266 while (rootSibling = container.lastChild) { 49267 container.removeChild(rootSibling); 49268 } 49269 49270 if (typeof callback === 'function') { 49271 var _originalCallback = callback; 49272 49273 callback = function () { 49274 var instance = getPublicRootInstance(_root); 49275 49276 _originalCallback.call(instance); 49277 }; 49278 } 49279 49280 var _root = createContainer(container, LegacyRoot, null, // hydrationCallbacks 49281 false, // isStrictMode 49282 false, // concurrentUpdatesByDefaultOverride, 49283 '', // identifierPrefix 49284 noopOnRecoverableError); 49285 49286 container._reactRootContainer = _root; 49287 markContainerAsRoot(_root.current, container); 49288 49289 var _rootContainerElement = container.nodeType === COMMENT_NODE ? container.parentNode : container; 49290 49291 listenToAllSupportedEvents(_rootContainerElement); // Initial mount should not be batched. 49292 49293 flushSync(function () { 49294 updateContainer(initialChildren, _root, parentComponent, callback); 49295 }); 49296 return _root; 49297 } 49298} 49299 49300function warnOnInvalidCallback$1(callback, callerName) { 49301 { 49302 if (callback !== null && typeof callback !== 'function') { 49303 error('%s(...): Expected the last optional `callback` argument to be a ' + 'function. Instead received: %s.', callerName, callback); 49304 } 49305 } 49306} 49307 49308function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) { 49309 { 49310 topLevelUpdateWarnings(container); 49311 warnOnInvalidCallback$1(callback === undefined ? null : callback, 'render'); 49312 } 49313 49314 var maybeRoot = container._reactRootContainer; 49315 var root; 49316 49317 if (!maybeRoot) { 49318 // Initial mount 49319 root = legacyCreateRootFromDOMContainer(container, children, parentComponent, callback, forceHydrate); 49320 } else { 49321 root = maybeRoot; 49322 49323 if (typeof callback === 'function') { 49324 var originalCallback = callback; 49325 49326 callback = function () { 49327 var instance = getPublicRootInstance(root); 49328 originalCallback.call(instance); 49329 }; 49330 } // Update 49331 49332 49333 updateContainer(children, root, parentComponent, callback); 49334 } 49335 49336 return getPublicRootInstance(root); 49337} 49338 49339var didWarnAboutFindDOMNode = false; 49340function findDOMNode(componentOrElement) { 49341 { 49342 if (!didWarnAboutFindDOMNode) { 49343 didWarnAboutFindDOMNode = true; 49344 49345 error('findDOMNode is deprecated and will be removed in the next major ' + 'release. Instead, add a ref directly to the element you want ' + 'to reference. Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-find-node'); 49346 } 49347 49348 var owner = ReactCurrentOwner$3.current; 49349 49350 if (owner !== null && owner.stateNode !== null) { 49351 var warnedAboutRefsInRender = owner.stateNode._warnedAboutRefsInRender; 49352 49353 if (!warnedAboutRefsInRender) { 49354 error('%s is accessing findDOMNode inside its render(). ' + 'render() should be a pure function of props and state. It should ' + 'never access something that requires stale data from the previous ' + 'render, such as refs. Move this logic to componentDidMount and ' + 'componentDidUpdate instead.', getComponentNameFromType(owner.type) || 'A component'); 49355 } 49356 49357 owner.stateNode._warnedAboutRefsInRender = true; 49358 } 49359 } 49360 49361 if (componentOrElement == null) { 49362 return null; 49363 } 49364 49365 if (componentOrElement.nodeType === ELEMENT_NODE) { 49366 return componentOrElement; 49367 } 49368 49369 { 49370 return findHostInstanceWithWarning(componentOrElement, 'findDOMNode'); 49371 } 49372} 49373function hydrate(element, container, callback) { 49374 { 49375 error('ReactDOM.hydrate is no longer supported in React 18. Use hydrateRoot ' + 'instead. Until you switch to the new API, your app will behave as ' + "if it's running React 17. Learn " + 'more: https://reactjs.org/link/switch-to-createroot'); 49376 } 49377 49378 if (!isValidContainerLegacy(container)) { 49379 throw new Error('Target container is not a DOM element.'); 49380 } 49381 49382 { 49383 var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; 49384 49385 if (isModernRoot) { 49386 error('You are calling ReactDOM.hydrate() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. ' + 'Did you mean to call hydrateRoot(container, element)?'); 49387 } 49388 } // TODO: throw or warn if we couldn't hydrate? 49389 49390 49391 return legacyRenderSubtreeIntoContainer(null, element, container, true, callback); 49392} 49393function render(element, container, callback) { 49394 { 49395 error('ReactDOM.render is no longer supported in React 18. Use createRoot ' + 'instead. Until you switch to the new API, your app will behave as ' + "if it's running React 17. Learn " + 'more: https://reactjs.org/link/switch-to-createroot'); 49396 } 49397 49398 if (!isValidContainerLegacy(container)) { 49399 throw new Error('Target container is not a DOM element.'); 49400 } 49401 49402 { 49403 var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; 49404 49405 if (isModernRoot) { 49406 error('You are calling ReactDOM.render() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. ' + 'Did you mean to call root.render(element)?'); 49407 } 49408 } 49409 49410 return legacyRenderSubtreeIntoContainer(null, element, container, false, callback); 49411} 49412function unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) { 49413 { 49414 error('ReactDOM.unstable_renderSubtreeIntoContainer() is no longer supported ' + 'in React 18. Consider using a portal instead. Until you switch to ' + "the createRoot API, your app will behave as if it's running React " + '17. Learn more: https://reactjs.org/link/switch-to-createroot'); 49415 } 49416 49417 if (!isValidContainerLegacy(containerNode)) { 49418 throw new Error('Target container is not a DOM element.'); 49419 } 49420 49421 if (parentComponent == null || !has(parentComponent)) { 49422 throw new Error('parentComponent must be a valid React Component'); 49423 } 49424 49425 return legacyRenderSubtreeIntoContainer(parentComponent, element, containerNode, false, callback); 49426} 49427var didWarnAboutUnmountComponentAtNode = false; 49428function unmountComponentAtNode(container) { 49429 { 49430 if (!didWarnAboutUnmountComponentAtNode) { 49431 didWarnAboutUnmountComponentAtNode = true; 49432 49433 error('unmountComponentAtNode is deprecated and will be removed in the ' + 'next major release. Switch to the createRoot API. Learn ' + 'more: https://reactjs.org/link/switch-to-createroot'); 49434 } 49435 } 49436 49437 if (!isValidContainerLegacy(container)) { 49438 throw new Error('unmountComponentAtNode(...): Target container is not a DOM element.'); 49439 } 49440 49441 { 49442 var isModernRoot = isContainerMarkedAsRoot(container) && container._reactRootContainer === undefined; 49443 49444 if (isModernRoot) { 49445 error('You are calling ReactDOM.unmountComponentAtNode() on a container that was previously ' + 'passed to ReactDOMClient.createRoot(). This is not supported. Did you mean to call root.unmount()?'); 49446 } 49447 } 49448 49449 if (container._reactRootContainer) { 49450 { 49451 var rootEl = getReactRootElementInContainer(container); 49452 var renderedByDifferentReact = rootEl && !getInstanceFromNode(rootEl); 49453 49454 if (renderedByDifferentReact) { 49455 error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by another copy of React.'); 49456 } 49457 } // Unmount should not be batched. 49458 49459 49460 flushSync(function () { 49461 legacyRenderSubtreeIntoContainer(null, null, container, false, function () { 49462 // $FlowFixMe This should probably use `delete container._reactRootContainer` 49463 container._reactRootContainer = null; 49464 unmarkContainerAsRoot(container); 49465 }); 49466 }); // If you call unmountComponentAtNode twice in quick succession, you'll 49467 // get `true` twice. That's probably fine? 49468 49469 return true; 49470 } else { 49471 { 49472 var _rootEl = getReactRootElementInContainer(container); 49473 49474 var hasNonRootReactChild = !!(_rootEl && getInstanceFromNode(_rootEl)); // Check if the container itself is a React root node. 49475 49476 var isContainerReactRoot = container.nodeType === ELEMENT_NODE && isValidContainerLegacy(container.parentNode) && !!container.parentNode._reactRootContainer; 49477 49478 if (hasNonRootReactChild) { 49479 error("unmountComponentAtNode(): The node you're attempting to unmount " + 'was rendered by React and is not a top-level container. %s', isContainerReactRoot ? 'You may have accidentally passed in a React root node instead ' + 'of its container.' : 'Instead, have the parent component update its state and ' + 'rerender in order to remove this component.'); 49480 } 49481 } 49482 49483 return false; 49484 } 49485} 49486 49487setAttemptSynchronousHydration(attemptSynchronousHydration$1); 49488setAttemptContinuousHydration(attemptContinuousHydration$1); 49489setAttemptHydrationAtCurrentPriority(attemptHydrationAtCurrentPriority$1); 49490setGetCurrentUpdatePriority(getCurrentUpdatePriority); 49491setAttemptHydrationAtPriority(runWithPriority); 49492 49493{ 49494 if (typeof Map !== 'function' || // $FlowIssue Flow incorrectly thinks Map has no prototype 49495 Map.prototype == null || typeof Map.prototype.forEach !== 'function' || typeof Set !== 'function' || // $FlowIssue Flow incorrectly thinks Set has no prototype 49496 Set.prototype == null || typeof Set.prototype.clear !== 'function' || typeof Set.prototype.forEach !== 'function') { 49497 error('React depends on Map and Set built-in types. Make sure that you load a ' + 'polyfill in older browsers. https://reactjs.org/link/react-polyfills'); 49498 } 49499} 49500 49501setRestoreImplementation(restoreControlledState$3); 49502setBatchingImplementation(batchedUpdates$1, discreteUpdates, flushSync); 49503 49504function createPortal$1(children, container) { 49505 var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; 49506 49507 if (!isValidContainer(container)) { 49508 throw new Error('Target container is not a DOM element.'); 49509 } // TODO: pass ReactDOM portal implementation as third argument 49510 // $FlowFixMe The Flow type is opaque but there's no way to actually create it. 49511 49512 49513 return createPortal(children, container, null, key); 49514} 49515 49516function renderSubtreeIntoContainer(parentComponent, element, containerNode, callback) { 49517 return unstable_renderSubtreeIntoContainer(parentComponent, element, containerNode, callback); 49518} 49519 49520var Internals = { 49521 usingClientEntryPoint: false, 49522 // Keep in sync with ReactTestUtils.js. 49523 // This is an array for better minification. 49524 Events: [getInstanceFromNode, getNodeFromInstance, getFiberCurrentPropsFromNode, enqueueStateRestore, restoreStateIfNeeded, batchedUpdates$1] 49525}; 49526 49527function createRoot$1(container, options) { 49528 { 49529 if (!Internals.usingClientEntryPoint && !false) { 49530 error('You are importing createRoot from "react-dom" which is not supported. ' + 'You should instead import it from "react-dom/client".'); 49531 } 49532 } 49533 49534 return createRoot(container, options); 49535} 49536 49537function hydrateRoot$1(container, initialChildren, options) { 49538 { 49539 if (!Internals.usingClientEntryPoint && !false) { 49540 error('You are importing hydrateRoot from "react-dom" which is not supported. ' + 'You should instead import it from "react-dom/client".'); 49541 } 49542 } 49543 49544 return hydrateRoot(container, initialChildren, options); 49545} // Overload the definition to the two valid signatures. 49546// Warning, this opts-out of checking the function body. 49547 49548 49549// eslint-disable-next-line no-redeclare 49550function flushSync$1(fn) { 49551 { 49552 if (isAlreadyRendering()) { 49553 error('flushSync was called from inside a lifecycle method. React cannot ' + 'flush when React is already rendering. Consider moving this call to ' + 'a scheduler task or micro task.'); 49554 } 49555 } 49556 49557 return flushSync(fn); 49558} 49559var foundDevTools = injectIntoDevTools({ 49560 findFiberByHostInstance: getClosestInstanceFromNode, 49561 bundleType: 1 , 49562 version: ReactVersion, 49563 rendererPackageName: 'react-dom' 49564}); 49565 49566{ 49567 if (!foundDevTools && canUseDOM && window.top === window.self) { 49568 // If we're in Chrome or Firefox, provide a download link if not installed. 49569 if (navigator.userAgent.indexOf('Chrome') > -1 && navigator.userAgent.indexOf('Edge') === -1 || navigator.userAgent.indexOf('Firefox') > -1) { 49570 var protocol = window.location.protocol; // Don't warn in exotic cases like chrome-extension://. 49571 49572 if (/^(https?|file):$/.test(protocol)) { 49573 // eslint-disable-next-line react-internal/no-production-logging 49574 console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://reactjs.org/link/react-devtools' + (protocol === 'file:' ? '\nYou might need to use a local HTTP server (instead of file://): ' + 'https://reactjs.org/link/react-devtools-faq' : ''), 'font-weight:bold'); 49575 } 49576 } 49577 } 49578} 49579 49580exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = Internals; 49581exports.createPortal = createPortal$1; 49582exports.createRoot = createRoot$1; 49583exports.findDOMNode = findDOMNode; 49584exports.flushSync = flushSync$1; 49585exports.hydrate = hydrate; 49586exports.hydrateRoot = hydrateRoot$1; 49587exports.render = render; 49588exports.unmountComponentAtNode = unmountComponentAtNode; 49589exports.unstable_batchedUpdates = batchedUpdates$1; 49590exports.unstable_renderSubtreeIntoContainer = renderSubtreeIntoContainer; 49591exports.version = ReactVersion; 49592 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 49593if ( 49594 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 49595 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === 49596 'function' 49597) { 49598 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); 49599} 49600 49601 })(); 49602} 49603 49604 49605/***/ }), 49606
vendor: 833 bytes, lines 49607-49639
49607/***/ "./node_modules/react-dom/client.js": 49608/*!******************************************!*\ 49609 !*** ./node_modules/react-dom/client.js ***! 49610 \******************************************/ 49611/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 49612 49613"use strict"; 49614 49615 49616var m = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); 49617if (false) {} else { 49618 var i = m.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 49619 exports.createRoot = function(c, o) { 49620 i.usingClientEntryPoint = true; 49621 try { 49622 return m.createRoot(c, o); 49623 } finally { 49624 i.usingClientEntryPoint = false; 49625 } 49626 }; 49627 exports.hydrateRoot = function(c, h, o) { 49628 i.usingClientEntryPoint = true; 49629 try { 49630 return m.hydrateRoot(c, h, o); 49631 } finally { 49632 i.usingClientEntryPoint = false; 49633 } 49634 }; 49635} 49636 49637 49638/***/ }), 49639
vendor: 1,428 bytes, lines 49640-49683
49640/***/ "./node_modules/react-dom/index.js": 49641/*!*****************************************!*\ 49642 !*** ./node_modules/react-dom/index.js ***! 49643 \*****************************************/ 49644/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 49645 49646"use strict"; 49647 49648 49649function checkDCE() { 49650 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 49651 if ( 49652 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' || 49653 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function' 49654 ) { 49655 return; 49656 } 49657 if (true) { 49658 // This branch is unreachable because this function is only called 49659 // in production, but the condition is true only in development. 49660 // Therefore if the branch is still here, dead code elimination wasn't 49661 // properly applied. 49662 // Don't change the message. React DevTools relies on it. Also make sure 49663 // this message doesn't occur elsewhere in this function, or it will cause 49664 // a false positive. 49665 throw new Error('^_^'); 49666 } 49667 try { 49668 // Verify that the code above has been dead code eliminated (DCE'd). 49669 __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE); 49670 } catch (err) { 49671 // DevTools shouldn't crash React, no matter what. 49672 // We should still report in case we break this code. 49673 console.error(err); 49674 } 49675} 49676 49677if (false) {} else { 49678 module.exports = __webpack_require__(/*! ./cjs/react-dom.development.js */ "./node_modules/react-dom/cjs/react-dom.development.js"); 49679} 49680 49681 49682/***/ }), 49683
vendor: 7,643 bytes, lines 49684-49915
49684/***/ "./node_modules/react-is/cjs/react-is.development.js": 49685/*!***********************************************************!*\ 49686 !*** ./node_modules/react-is/cjs/react-is.development.js ***! 49687 \***********************************************************/ 49688/***/ ((__unused_webpack_module, exports) => { 49689 49690"use strict"; 49691/** 49692 * @license React 49693 * react-is.development.js 49694 * 49695 * Copyright (c) Facebook, Inc. and its affiliates. 49696 * 49697 * This source code is licensed under the MIT license found in the 49698 * LICENSE file in the root directory of this source tree. 49699 */ 49700 49701 49702 49703if (true) { 49704 (function() { 49705'use strict'; 49706 49707// ATTENTION 49708// When adding new symbols to this file, 49709// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' 49710// The Symbol used to tag the ReactElement-like types. 49711var REACT_ELEMENT_TYPE = Symbol.for('react.element'); 49712var REACT_PORTAL_TYPE = Symbol.for('react.portal'); 49713var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); 49714var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); 49715var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); 49716var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); 49717var REACT_CONTEXT_TYPE = Symbol.for('react.context'); 49718var REACT_SERVER_CONTEXT_TYPE = Symbol.for('react.server_context'); 49719var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); 49720var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); 49721var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); 49722var REACT_MEMO_TYPE = Symbol.for('react.memo'); 49723var REACT_LAZY_TYPE = Symbol.for('react.lazy'); 49724var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); 49725 49726// ----------------------------------------------------------------------------- 49727 49728var enableScopeAPI = false; // Experimental Create Event Handle API. 49729var enableCacheElement = false; 49730var enableTransitionTracing = false; // No known bugs, but needs performance testing 49731 49732var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber 49733// stuff. Intended to enable React core members to more easily debug scheduling 49734// issues in DEV builds. 49735 49736var enableDebugTracing = false; // Track which Fiber(s) schedule render work. 49737 49738var REACT_MODULE_REFERENCE; 49739 49740{ 49741 REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); 49742} 49743 49744function isValidElementType(type) { 49745 if (typeof type === 'string' || typeof type === 'function') { 49746 return true; 49747 } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). 49748 49749 49750 if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { 49751 return true; 49752 } 49753 49754 if (typeof type === 'object' && type !== null) { 49755 if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object 49756 // types supported by any Flight configuration anywhere since 49757 // we don't know which Flight build this will end up being used 49758 // with. 49759 type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { 49760 return true; 49761 } 49762 } 49763 49764 return false; 49765} 49766 49767function typeOf(object) { 49768 if (typeof object === 'object' && object !== null) { 49769 var $$typeof = object.$$typeof; 49770 49771 switch ($$typeof) { 49772 case REACT_ELEMENT_TYPE: 49773 var type = object.type; 49774 49775 switch (type) { 49776 case REACT_FRAGMENT_TYPE: 49777 case REACT_PROFILER_TYPE: 49778 case REACT_STRICT_MODE_TYPE: 49779 case REACT_SUSPENSE_TYPE: 49780 case REACT_SUSPENSE_LIST_TYPE: 49781 return type; 49782 49783 default: 49784 var $$typeofType = type && type.$$typeof; 49785 49786 switch ($$typeofType) { 49787 case REACT_SERVER_CONTEXT_TYPE: 49788 case REACT_CONTEXT_TYPE: 49789 case REACT_FORWARD_REF_TYPE: 49790 case REACT_LAZY_TYPE: 49791 case REACT_MEMO_TYPE: 49792 case REACT_PROVIDER_TYPE: 49793 return $$typeofType; 49794 49795 default: 49796 return $$typeof; 49797 } 49798 49799 } 49800 49801 case REACT_PORTAL_TYPE: 49802 return $$typeof; 49803 } 49804 } 49805 49806 return undefined; 49807} 49808var ContextConsumer = REACT_CONTEXT_TYPE; 49809var ContextProvider = REACT_PROVIDER_TYPE; 49810var Element = REACT_ELEMENT_TYPE; 49811var ForwardRef = REACT_FORWARD_REF_TYPE; 49812var Fragment = REACT_FRAGMENT_TYPE; 49813var Lazy = REACT_LAZY_TYPE; 49814var Memo = REACT_MEMO_TYPE; 49815var Portal = REACT_PORTAL_TYPE; 49816var Profiler = REACT_PROFILER_TYPE; 49817var StrictMode = REACT_STRICT_MODE_TYPE; 49818var Suspense = REACT_SUSPENSE_TYPE; 49819var SuspenseList = REACT_SUSPENSE_LIST_TYPE; 49820var hasWarnedAboutDeprecatedIsAsyncMode = false; 49821var hasWarnedAboutDeprecatedIsConcurrentMode = false; // AsyncMode should be deprecated 49822 49823function isAsyncMode(object) { 49824 { 49825 if (!hasWarnedAboutDeprecatedIsAsyncMode) { 49826 hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint 49827 49828 console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); 49829 } 49830 } 49831 49832 return false; 49833} 49834function isConcurrentMode(object) { 49835 { 49836 if (!hasWarnedAboutDeprecatedIsConcurrentMode) { 49837 hasWarnedAboutDeprecatedIsConcurrentMode = true; // Using console['warn'] to evade Babel and ESLint 49838 49839 console['warn']('The ReactIs.isConcurrentMode() alias has been deprecated, ' + 'and will be removed in React 18+.'); 49840 } 49841 } 49842 49843 return false; 49844} 49845function isContextConsumer(object) { 49846 return typeOf(object) === REACT_CONTEXT_TYPE; 49847} 49848function isContextProvider(object) { 49849 return typeOf(object) === REACT_PROVIDER_TYPE; 49850} 49851function isElement(object) { 49852 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 49853} 49854function isForwardRef(object) { 49855 return typeOf(object) === REACT_FORWARD_REF_TYPE; 49856} 49857function isFragment(object) { 49858 return typeOf(object) === REACT_FRAGMENT_TYPE; 49859} 49860function isLazy(object) { 49861 return typeOf(object) === REACT_LAZY_TYPE; 49862} 49863function isMemo(object) { 49864 return typeOf(object) === REACT_MEMO_TYPE; 49865} 49866function isPortal(object) { 49867 return typeOf(object) === REACT_PORTAL_TYPE; 49868} 49869function isProfiler(object) { 49870 return typeOf(object) === REACT_PROFILER_TYPE; 49871} 49872function isStrictMode(object) { 49873 return typeOf(object) === REACT_STRICT_MODE_TYPE; 49874} 49875function isSuspense(object) { 49876 return typeOf(object) === REACT_SUSPENSE_TYPE; 49877} 49878function isSuspenseList(object) { 49879 return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; 49880} 49881 49882exports.ContextConsumer = ContextConsumer; 49883exports.ContextProvider = ContextProvider; 49884exports.Element = Element; 49885exports.ForwardRef = ForwardRef; 49886exports.Fragment = Fragment; 49887exports.Lazy = Lazy; 49888exports.Memo = Memo; 49889exports.Portal = Portal; 49890exports.Profiler = Profiler; 49891exports.StrictMode = StrictMode; 49892exports.Suspense = Suspense; 49893exports.SuspenseList = SuspenseList; 49894exports.isAsyncMode = isAsyncMode; 49895exports.isConcurrentMode = isConcurrentMode; 49896exports.isContextConsumer = isContextConsumer; 49897exports.isContextProvider = isContextProvider; 49898exports.isElement = isElement; 49899exports.isForwardRef = isForwardRef; 49900exports.isFragment = isFragment; 49901exports.isLazy = isLazy; 49902exports.isMemo = isMemo; 49903exports.isPortal = isPortal; 49904exports.isProfiler = isProfiler; 49905exports.isStrictMode = isStrictMode; 49906exports.isSuspense = isSuspense; 49907exports.isSuspenseList = isSuspenseList; 49908exports.isValidElementType = isValidElementType; 49909exports.typeOf = typeOf; 49910 })(); 49911} 49912 49913 49914/***/ }), 49915
vendor: 432 bytes, lines 49916-49931
49916/***/ "./node_modules/react-is/index.js": 49917/*!****************************************!*\ 49918 !*** ./node_modules/react-is/index.js ***! 49919 \****************************************/ 49920/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 49921 49922"use strict"; 49923 49924 49925if (false) {} else { 49926 module.exports = __webpack_require__(/*! ./cjs/react-is.development.js */ "./node_modules/react-is/cjs/react-is.development.js"); 49927} 49928 49929 49930/***/ }), 49931
vendor: 1,860 bytes, lines 49932-49976
49932/***/ "./node_modules/react-redux/es/components/Context.js": 49933/*!***********************************************************!*\ 49934 !*** ./node_modules/react-redux/es/components/Context.js ***! 49935 \***********************************************************/ 49936/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 49937 49938"use strict"; 49939__webpack_require__.r(__webpack_exports__); 49940/* harmony export */ __webpack_require__.d(__webpack_exports__, { 49941/* harmony export */ ReactReduxContext: () => (/* binding */ ReactReduxContext), 49942/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 49943/* harmony export */ }); 49944/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 49945/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 49946 49947const ContextKey = Symbol.for(`react-redux-context`); 49948const gT = typeof globalThis !== "undefined" ? globalThis : 49949/* fall back to a per-module scope (pre-8.1 behaviour) if `globalThis` is not available */ 49950{}; 49951 49952function getContext() { 49953 var _gT$ContextKey; 49954 49955 if (!react__WEBPACK_IMPORTED_MODULE_0__.createContext) return {}; 49956 const contextMap = (_gT$ContextKey = gT[ContextKey]) != null ? _gT$ContextKey : gT[ContextKey] = new Map(); 49957 let realContext = contextMap.get(react__WEBPACK_IMPORTED_MODULE_0__.createContext); 49958 49959 if (!realContext) { 49960 realContext = react__WEBPACK_IMPORTED_MODULE_0__.createContext(null); 49961 49962 if (true) { 49963 realContext.displayName = 'ReactRedux'; 49964 } 49965 49966 contextMap.set(react__WEBPACK_IMPORTED_MODULE_0__.createContext, realContext); 49967 } 49968 49969 return realContext; 49970} 49971 49972const ReactReduxContext = /*#__PURE__*/getContext(); 49973/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ReactReduxContext); 49974 49975/***/ }), 49976
vendor: 2,932 bytes, lines 49977-50043
49977/***/ "./node_modules/react-redux/es/components/Provider.js": 49978/*!************************************************************!*\ 49979 !*** ./node_modules/react-redux/es/components/Provider.js ***! 49980 \************************************************************/ 49981/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 49982 49983"use strict"; 49984__webpack_require__.r(__webpack_exports__); 49985/* harmony export */ __webpack_require__.d(__webpack_exports__, { 49986/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 49987/* harmony export */ }); 49988/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 49989/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 49990/* harmony import */ var _Context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Context */ "./node_modules/react-redux/es/components/Context.js"); 49991/* harmony import */ var _utils_Subscription__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/Subscription */ "./node_modules/react-redux/es/utils/Subscription.js"); 49992/* harmony import */ var _utils_useIsomorphicLayoutEffect__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/useIsomorphicLayoutEffect */ "./node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js"); 49993 49994 49995 49996 49997 49998function Provider({ 49999 store, 50000 context, 50001 children, 50002 serverState, 50003 stabilityCheck = 'once', 50004 noopCheck = 'once' 50005}) { 50006 const contextValue = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => { 50007 const subscription = (0,_utils_Subscription__WEBPACK_IMPORTED_MODULE_2__.createSubscription)(store); 50008 return { 50009 store, 50010 subscription, 50011 getServerState: serverState ? () => serverState : undefined, 50012 stabilityCheck, 50013 noopCheck 50014 }; 50015 }, [store, serverState, stabilityCheck, noopCheck]); 50016 const previousState = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(() => store.getState(), [store]); 50017 (0,_utils_useIsomorphicLayoutEffect__WEBPACK_IMPORTED_MODULE_3__.useIsomorphicLayoutEffect)(() => { 50018 const { 50019 subscription 50020 } = contextValue; 50021 subscription.onStateChange = subscription.notifyNestedSubs; 50022 subscription.trySubscribe(); 50023 50024 if (previousState !== store.getState()) { 50025 subscription.notifyNestedSubs(); 50026 } 50027 50028 return () => { 50029 subscription.tryUnsubscribe(); 50030 subscription.onStateChange = undefined; 50031 }; 50032 }, [contextValue, previousState]); 50033 const Context = context || _Context__WEBPACK_IMPORTED_MODULE_1__.ReactReduxContext; // @ts-ignore 'AnyAction' is assignable to the constraint of type 'A', but 'A' could be instantiated with a different subtype 50034 50035 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Context.Provider, { 50036 value: contextValue 50037 }, children); 50038} 50039 50040/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Provider); 50041 50042/***/ }), 50043
vendor: 24,404 bytes, lines 50044-50485
50044/***/ "./node_modules/react-redux/es/components/connect.js": 50045/*!***********************************************************!*\ 50046 !*** ./node_modules/react-redux/es/components/connect.js ***! 50047 \***********************************************************/ 50048/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50049 50050"use strict"; 50051__webpack_require__.r(__webpack_exports__); 50052/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50053/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), 50054/* harmony export */ initializeConnect: () => (/* binding */ initializeConnect) 50055/* harmony export */ }); 50056/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); 50057/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js"); 50058/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! hoist-non-react-statics */ "./node_modules/hoist-non-react-statics/dist/hoist-non-react-statics.cjs.js"); 50059/* harmony import */ var hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_2__); 50060/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 50061/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); 50062/* harmony import */ var react_is__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js"); 50063/* harmony import */ var _connect_selectorFactory__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../connect/selectorFactory */ "./node_modules/react-redux/es/connect/selectorFactory.js"); 50064/* harmony import */ var _connect_mapDispatchToProps__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../connect/mapDispatchToProps */ "./node_modules/react-redux/es/connect/mapDispatchToProps.js"); 50065/* harmony import */ var _connect_mapStateToProps__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../connect/mapStateToProps */ "./node_modules/react-redux/es/connect/mapStateToProps.js"); 50066/* harmony import */ var _connect_mergeProps__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../connect/mergeProps */ "./node_modules/react-redux/es/connect/mergeProps.js"); 50067/* harmony import */ var _utils_Subscription__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../utils/Subscription */ "./node_modules/react-redux/es/utils/Subscription.js"); 50068/* harmony import */ var _utils_useIsomorphicLayoutEffect__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../utils/useIsomorphicLayoutEffect */ "./node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js"); 50069/* harmony import */ var _utils_shallowEqual__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../utils/shallowEqual */ "./node_modules/react-redux/es/utils/shallowEqual.js"); 50070/* harmony import */ var _utils_warning__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../utils/warning */ "./node_modules/react-redux/es/utils/warning.js"); 50071/* harmony import */ var _Context__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./Context */ "./node_modules/react-redux/es/components/Context.js"); 50072/* harmony import */ var _utils_useSyncExternalStore__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../utils/useSyncExternalStore */ "./node_modules/react-redux/es/utils/useSyncExternalStore.js"); 50073 50074 50075const _excluded = ["reactReduxForwardedRef"]; 50076 50077/* eslint-disable valid-jsdoc, @typescript-eslint/no-unused-vars */ 50078 50079 50080 50081 50082 50083 50084 50085 50086 50087 50088 50089 50090 50091let useSyncExternalStore = _utils_useSyncExternalStore__WEBPACK_IMPORTED_MODULE_14__.notInitialized; 50092const initializeConnect = fn => { 50093 useSyncExternalStore = fn; 50094}; // Define some constant arrays just to avoid re-creating these 50095 50096const EMPTY_ARRAY = [null, 0]; 50097const NO_SUBSCRIPTION_ARRAY = [null, null]; // Attempts to stringify whatever not-really-a-component value we were given 50098// for logging in an error message 50099 50100const stringifyComponent = Comp => { 50101 try { 50102 return JSON.stringify(Comp); 50103 } catch (err) { 50104 return String(Comp); 50105 } 50106}; 50107 50108// This is "just" a `useLayoutEffect`, but with two modifications: 50109// - we need to fall back to `useEffect` in SSR to avoid annoying warnings 50110// - we extract this to a separate function to avoid closing over values 50111// and causing memory leaks 50112function useIsomorphicLayoutEffectWithArgs(effectFunc, effectArgs, dependencies) { 50113 (0,_utils_useIsomorphicLayoutEffect__WEBPACK_IMPORTED_MODULE_10__.useIsomorphicLayoutEffect)(() => effectFunc(...effectArgs), dependencies); 50114} // Effect callback, extracted: assign the latest props values to refs for later usage 50115 50116 50117function captureWrapperProps(lastWrapperProps, lastChildProps, renderIsScheduled, wrapperProps, // actualChildProps: unknown, 50118childPropsFromStoreUpdate, notifyNestedSubs) { 50119 // We want to capture the wrapper props and child props we used for later comparisons 50120 lastWrapperProps.current = wrapperProps; 50121 renderIsScheduled.current = false; // If the render was from a store update, clear out that reference and cascade the subscriber update 50122 50123 if (childPropsFromStoreUpdate.current) { 50124 childPropsFromStoreUpdate.current = null; 50125 notifyNestedSubs(); 50126 } 50127} // Effect callback, extracted: subscribe to the Redux store or nearest connected ancestor, 50128// check for updates after dispatched actions, and trigger re-renders. 50129 50130 50131function subscribeUpdates(shouldHandleStateChanges, store, subscription, childPropsSelector, lastWrapperProps, lastChildProps, renderIsScheduled, isMounted, childPropsFromStoreUpdate, notifyNestedSubs, // forceComponentUpdateDispatch: React.Dispatch<any>, 50132additionalSubscribeListener) { 50133 // If we're not subscribed to the store, nothing to do here 50134 if (!shouldHandleStateChanges) return () => {}; // Capture values for checking if and when this component unmounts 50135 50136 let didUnsubscribe = false; 50137 let lastThrownError = null; // We'll run this callback every time a store subscription update propagates to this component 50138 50139 const checkForUpdates = () => { 50140 if (didUnsubscribe || !isMounted.current) { 50141 // Don't run stale listeners. 50142 // Redux doesn't guarantee unsubscriptions happen until next dispatch. 50143 return; 50144 } // TODO We're currently calling getState ourselves here, rather than letting `uSES` do it 50145 50146 50147 const latestStoreState = store.getState(); 50148 let newChildProps, error; 50149 50150 try { 50151 // Actually run the selector with the most recent store state and wrapper props 50152 // to determine what the child props should be 50153 newChildProps = childPropsSelector(latestStoreState, lastWrapperProps.current); 50154 } catch (e) { 50155 error = e; 50156 lastThrownError = e; 50157 } 50158 50159 if (!error) { 50160 lastThrownError = null; 50161 } // If the child props haven't changed, nothing to do here - cascade the subscription update 50162 50163 50164 if (newChildProps === lastChildProps.current) { 50165 if (!renderIsScheduled.current) { 50166 notifyNestedSubs(); 50167 } 50168 } else { 50169 // Save references to the new child props. Note that we track the "child props from store update" 50170 // as a ref instead of a useState/useReducer because we need a way to determine if that value has 50171 // been processed. If this went into useState/useReducer, we couldn't clear out the value without 50172 // forcing another re-render, which we don't want. 50173 lastChildProps.current = newChildProps; 50174 childPropsFromStoreUpdate.current = newChildProps; 50175 renderIsScheduled.current = true; // TODO This is hacky and not how `uSES` is meant to be used 50176 // Trigger the React `useSyncExternalStore` subscriber 50177 50178 additionalSubscribeListener(); 50179 } 50180 }; // Actually subscribe to the nearest connected ancestor (or store) 50181 50182 50183 subscription.onStateChange = checkForUpdates; 50184 subscription.trySubscribe(); // Pull data from the store after first render in case the store has 50185 // changed since we began. 50186 50187 checkForUpdates(); 50188 50189 const unsubscribeWrapper = () => { 50190 didUnsubscribe = true; 50191 subscription.tryUnsubscribe(); 50192 subscription.onStateChange = null; 50193 50194 if (lastThrownError) { 50195 // It's possible that we caught an error due to a bad mapState function, but the 50196 // parent re-rendered without this component and we're about to unmount. 50197 // This shouldn't happen as long as we do top-down subscriptions correctly, but 50198 // if we ever do those wrong, this throw will surface the error in our tests. 50199 // In that case, throw the error from here so it doesn't get lost. 50200 throw lastThrownError; 50201 } 50202 }; 50203 50204 return unsubscribeWrapper; 50205} // Reducer initial state creation for our update reducer 50206 50207 50208const initStateUpdates = () => EMPTY_ARRAY; 50209 50210function strictEqual(a, b) { 50211 return a === b; 50212} 50213/** 50214 * Infers the type of props that a connector will inject into a component. 50215 */ 50216 50217 50218let hasWarnedAboutDeprecatedPureOption = false; 50219/** 50220 * Connects a React component to a Redux store. 50221 * 50222 * - Without arguments, just wraps the component, without changing the behavior / props 50223 * 50224 * - If 2 params are passed (3rd param, mergeProps, is skipped), default behavior 50225 * is to override ownProps (as stated in the docs), so what remains is everything that's 50226 * not a state or dispatch prop 50227 * 50228 * - When 3rd param is passed, we don't know if ownProps propagate and whether they 50229 * should be valid component props, because it depends on mergeProps implementation. 50230 * As such, it is the user's responsibility to extend ownProps interface from state or 50231 * dispatch props or both when applicable 50232 * 50233 * @param mapStateToProps A function that extracts values from state 50234 * @param mapDispatchToProps Setup for dispatching actions 50235 * @param mergeProps Optional callback to merge state and dispatch props together 50236 * @param options Options for configuring the connection 50237 * 50238 */ 50239 50240function connect(mapStateToProps, mapDispatchToProps, mergeProps, { 50241 // The `pure` option has been removed, so TS doesn't like us destructuring this to check its existence. 50242 // @ts-ignore 50243 pure, 50244 areStatesEqual = strictEqual, 50245 areOwnPropsEqual = _utils_shallowEqual__WEBPACK_IMPORTED_MODULE_11__["default"], 50246 areStatePropsEqual = _utils_shallowEqual__WEBPACK_IMPORTED_MODULE_11__["default"], 50247 areMergedPropsEqual = _utils_shallowEqual__WEBPACK_IMPORTED_MODULE_11__["default"], 50248 // use React's forwardRef to expose a ref of the wrapped component 50249 forwardRef = false, 50250 // the context consumer to use 50251 context = _Context__WEBPACK_IMPORTED_MODULE_13__.ReactReduxContext 50252} = {}) { 50253 if (true) { 50254 if (pure !== undefined && !hasWarnedAboutDeprecatedPureOption) { 50255 hasWarnedAboutDeprecatedPureOption = true; 50256 (0,_utils_warning__WEBPACK_IMPORTED_MODULE_12__["default"])('The `pure` option has been removed. `connect` is now always a "pure/memoized" component'); 50257 } 50258 } 50259 50260 const Context = context; 50261 const initMapStateToProps = (0,_connect_mapStateToProps__WEBPACK_IMPORTED_MODULE_7__.mapStateToPropsFactory)(mapStateToProps); 50262 const initMapDispatchToProps = (0,_connect_mapDispatchToProps__WEBPACK_IMPORTED_MODULE_6__.mapDispatchToPropsFactory)(mapDispatchToProps); 50263 const initMergeProps = (0,_connect_mergeProps__WEBPACK_IMPORTED_MODULE_8__.mergePropsFactory)(mergeProps); 50264 const shouldHandleStateChanges = Boolean(mapStateToProps); 50265 50266 const wrapWithConnect = WrappedComponent => { 50267 if ( true && !(0,react_is__WEBPACK_IMPORTED_MODULE_4__.isValidElementType)(WrappedComponent)) { 50268 throw new Error(`You must pass a component to the function returned by connect. Instead received ${stringifyComponent(WrappedComponent)}`); 50269 } 50270 50271 const wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component'; 50272 const displayName = `Connect(${wrappedComponentName})`; 50273 const selectorFactoryOptions = { 50274 shouldHandleStateChanges, 50275 displayName, 50276 wrappedComponentName, 50277 WrappedComponent, 50278 // @ts-ignore 50279 initMapStateToProps, 50280 // @ts-ignore 50281 initMapDispatchToProps, 50282 initMergeProps, 50283 areStatesEqual, 50284 areStatePropsEqual, 50285 areOwnPropsEqual, 50286 areMergedPropsEqual 50287 }; 50288 50289 function ConnectFunction(props) { 50290 const [propsContext, reactReduxForwardedRef, wrapperProps] = react__WEBPACK_IMPORTED_MODULE_3__.useMemo(() => { 50291 // Distinguish between actual "data" props that were passed to the wrapper component, 50292 // and values needed to control behavior (forwarded refs, alternate context instances). 50293 // To maintain the wrapperProps object reference, memoize this destructuring. 50294 const { 50295 reactReduxForwardedRef 50296 } = props, 50297 wrapperProps = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_1__["default"])(props, _excluded); 50298 50299 return [props.context, reactReduxForwardedRef, wrapperProps]; 50300 }, [props]); 50301 const ContextToUse = react__WEBPACK_IMPORTED_MODULE_3__.useMemo(() => { 50302 // Users may optionally pass in a custom context instance to use instead of our ReactReduxContext. 50303 // Memoize the check that determines which context instance we should use. 50304 return propsContext && propsContext.Consumer && // @ts-ignore 50305 (0,react_is__WEBPACK_IMPORTED_MODULE_4__.isContextConsumer)( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__.createElement(propsContext.Consumer, null)) ? propsContext : Context; 50306 }, [propsContext, Context]); // Retrieve the store and ancestor subscription via context, if available 50307 50308 const contextValue = react__WEBPACK_IMPORTED_MODULE_3__.useContext(ContextToUse); // The store _must_ exist as either a prop or in context. 50309 // We'll check to see if it _looks_ like a Redux store first. 50310 // This allows us to pass through a `store` prop that is just a plain value. 50311 50312 const didStoreComeFromProps = Boolean(props.store) && Boolean(props.store.getState) && Boolean(props.store.dispatch); 50313 const didStoreComeFromContext = Boolean(contextValue) && Boolean(contextValue.store); 50314 50315 if ( true && !didStoreComeFromProps && !didStoreComeFromContext) { 50316 throw new Error(`Could not find "store" in the context of ` + `"${displayName}". Either wrap the root component in a <Provider>, ` + `or pass a custom React context provider to <Provider> and the corresponding ` + `React context consumer to ${displayName} in connect options.`); 50317 } // Based on the previous check, one of these must be true 50318 50319 50320 const store = didStoreComeFromProps ? props.store : contextValue.store; 50321 const getServerState = didStoreComeFromContext ? contextValue.getServerState : store.getState; 50322 const childPropsSelector = react__WEBPACK_IMPORTED_MODULE_3__.useMemo(() => { 50323 // The child props selector needs the store reference as an input. 50324 // Re-create this selector whenever the store changes. 50325 return (0,_connect_selectorFactory__WEBPACK_IMPORTED_MODULE_5__["default"])(store.dispatch, selectorFactoryOptions); 50326 }, [store]); 50327 const [subscription, notifyNestedSubs] = react__WEBPACK_IMPORTED_MODULE_3__.useMemo(() => { 50328 if (!shouldHandleStateChanges) return NO_SUBSCRIPTION_ARRAY; // This Subscription's source should match where store came from: props vs. context. A component 50329 // connected to the store via props shouldn't use subscription from context, or vice versa. 50330 50331 const subscription = (0,_utils_Subscription__WEBPACK_IMPORTED_MODULE_9__.createSubscription)(store, didStoreComeFromProps ? undefined : contextValue.subscription); // `notifyNestedSubs` is duplicated to handle the case where the component is unmounted in 50332 // the middle of the notification loop, where `subscription` will then be null. This can 50333 // probably be avoided if Subscription's listeners logic is changed to not call listeners 50334 // that have been unsubscribed in the middle of the notification loop. 50335 50336 const notifyNestedSubs = subscription.notifyNestedSubs.bind(subscription); 50337 return [subscription, notifyNestedSubs]; 50338 }, [store, didStoreComeFromProps, contextValue]); // Determine what {store, subscription} value should be put into nested context, if necessary, 50339 // and memoize that value to avoid unnecessary context updates. 50340 50341 const overriddenContextValue = react__WEBPACK_IMPORTED_MODULE_3__.useMemo(() => { 50342 if (didStoreComeFromProps) { 50343 // This component is directly subscribed to a store from props. 50344 // We don't want descendants reading from this store - pass down whatever 50345 // the existing context value is from the nearest connected ancestor. 50346 return contextValue; 50347 } // Otherwise, put this component's subscription instance into context, so that 50348 // connected descendants won't update until after this component is done 50349 50350 50351 return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, contextValue, { 50352 subscription 50353 }); 50354 }, [didStoreComeFromProps, contextValue, subscription]); // Set up refs to coordinate values between the subscription effect and the render logic 50355 50356 const lastChildProps = react__WEBPACK_IMPORTED_MODULE_3__.useRef(); 50357 const lastWrapperProps = react__WEBPACK_IMPORTED_MODULE_3__.useRef(wrapperProps); 50358 const childPropsFromStoreUpdate = react__WEBPACK_IMPORTED_MODULE_3__.useRef(); 50359 const renderIsScheduled = react__WEBPACK_IMPORTED_MODULE_3__.useRef(false); 50360 const isProcessingDispatch = react__WEBPACK_IMPORTED_MODULE_3__.useRef(false); 50361 const isMounted = react__WEBPACK_IMPORTED_MODULE_3__.useRef(false); 50362 const latestSubscriptionCallbackError = react__WEBPACK_IMPORTED_MODULE_3__.useRef(); 50363 (0,_utils_useIsomorphicLayoutEffect__WEBPACK_IMPORTED_MODULE_10__.useIsomorphicLayoutEffect)(() => { 50364 isMounted.current = true; 50365 return () => { 50366 isMounted.current = false; 50367 }; 50368 }, []); 50369 const actualChildPropsSelector = react__WEBPACK_IMPORTED_MODULE_3__.useMemo(() => { 50370 const selector = () => { 50371 // Tricky logic here: 50372 // - This render may have been triggered by a Redux store update that produced new child props 50373 // - However, we may have gotten new wrapper props after that 50374 // If we have new child props, and the same wrapper props, we know we should use the new child props as-is. 50375 // But, if we have new wrapper props, those might change the child props, so we have to recalculate things. 50376 // So, we'll use the child props from store update only if the wrapper props are the same as last time. 50377 if (childPropsFromStoreUpdate.current && wrapperProps === lastWrapperProps.current) { 50378 return childPropsFromStoreUpdate.current; 50379 } // TODO We're reading the store directly in render() here. Bad idea? 50380 // This will likely cause Bad Things (TM) to happen in Concurrent Mode. 50381 // Note that we do this because on renders _not_ caused by store updates, we need the latest store state 50382 // to determine what the child props should be. 50383 50384 50385 return childPropsSelector(store.getState(), wrapperProps); 50386 }; 50387 50388 return selector; 50389 }, [store, wrapperProps]); // We need this to execute synchronously every time we re-render. However, React warns 50390 // about useLayoutEffect in SSR, so we try to detect environment and fall back to 50391 // just useEffect instead to avoid the warning, since neither will run anyway. 50392 50393 const subscribeForReact = react__WEBPACK_IMPORTED_MODULE_3__.useMemo(() => { 50394 const subscribe = reactListener => { 50395 if (!subscription) { 50396 return () => {}; 50397 } 50398 50399 return subscribeUpdates(shouldHandleStateChanges, store, subscription, // @ts-ignore 50400 childPropsSelector, lastWrapperProps, lastChildProps, renderIsScheduled, isMounted, childPropsFromStoreUpdate, notifyNestedSubs, reactListener); 50401 }; 50402 50403 return subscribe; 50404 }, [subscription]); 50405 useIsomorphicLayoutEffectWithArgs(captureWrapperProps, [lastWrapperProps, lastChildProps, renderIsScheduled, wrapperProps, childPropsFromStoreUpdate, notifyNestedSubs]); 50406 let actualChildProps; 50407 50408 try { 50409 actualChildProps = useSyncExternalStore( // TODO We're passing through a big wrapper that does a bunch of extra side effects besides subscribing 50410 subscribeForReact, // TODO This is incredibly hacky. We've already processed the store update and calculated new child props, 50411 // TODO and we're just passing that through so it triggers a re-render for us rather than relying on `uSES`. 50412 actualChildPropsSelector, getServerState ? () => childPropsSelector(getServerState(), wrapperProps) : actualChildPropsSelector); 50413 } catch (err) { 50414 if (latestSubscriptionCallbackError.current) { 50415 ; 50416 err.message += `\nThe error may be correlated with this previous error:\n${latestSubscriptionCallbackError.current.stack}\n\n`; 50417 } 50418 50419 throw err; 50420 } 50421 50422 (0,_utils_useIsomorphicLayoutEffect__WEBPACK_IMPORTED_MODULE_10__.useIsomorphicLayoutEffect)(() => { 50423 latestSubscriptionCallbackError.current = undefined; 50424 childPropsFromStoreUpdate.current = undefined; 50425 lastChildProps.current = actualChildProps; 50426 }); // Now that all that's done, we can finally try to actually render the child component. 50427 // We memoize the elements for the rendered child component as an optimization. 50428 50429 const renderedWrappedComponent = react__WEBPACK_IMPORTED_MODULE_3__.useMemo(() => { 50430 return ( 50431 /*#__PURE__*/ 50432 // @ts-ignore 50433 react__WEBPACK_IMPORTED_MODULE_3__.createElement(WrappedComponent, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, actualChildProps, { 50434 ref: reactReduxForwardedRef 50435 })) 50436 ); 50437 }, [reactReduxForwardedRef, WrappedComponent, actualChildProps]); // If React sees the exact same element reference as last time, it bails out of re-rendering 50438 // that child, same as if it was wrapped in React.memo() or returned false from shouldComponentUpdate. 50439 50440 const renderedChild = react__WEBPACK_IMPORTED_MODULE_3__.useMemo(() => { 50441 if (shouldHandleStateChanges) { 50442 // If this component is subscribed to store updates, we need to pass its own 50443 // subscription instance down to our descendants. That means rendering the same 50444 // Context instance, and putting a different value into the context. 50445 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__.createElement(ContextToUse.Provider, { 50446 value: overriddenContextValue 50447 }, renderedWrappedComponent); 50448 } 50449 50450 return renderedWrappedComponent; 50451 }, [ContextToUse, renderedWrappedComponent, overriddenContextValue]); 50452 return renderedChild; 50453 } 50454 50455 const _Connect = react__WEBPACK_IMPORTED_MODULE_3__.memo(ConnectFunction); 50456 50457 // Add a hacky cast to get the right output type 50458 const Connect = _Connect; 50459 Connect.WrappedComponent = WrappedComponent; 50460 Connect.displayName = ConnectFunction.displayName = displayName; 50461 50462 if (forwardRef) { 50463 const _forwarded = react__WEBPACK_IMPORTED_MODULE_3__.forwardRef(function forwardConnectRef(props, ref) { 50464 // @ts-ignore 50465 return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__.createElement(Connect, (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, props, { 50466 reactReduxForwardedRef: ref 50467 })); 50468 }); 50469 50470 const forwarded = _forwarded; 50471 forwarded.displayName = displayName; 50472 forwarded.WrappedComponent = WrappedComponent; 50473 return hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_2___default()(forwarded, WrappedComponent); 50474 } 50475 50476 return hoist_non_react_statics__WEBPACK_IMPORTED_MODULE_2___default()(Connect, WrappedComponent); 50477 }; 50478 50479 return wrapWithConnect; 50480} 50481 50482/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (connect); 50483 50484/***/ }), 50485
vendor: 846 bytes, lines 50486-50504
50486/***/ "./node_modules/react-redux/es/connect/invalidArgFactory.js": 50487/*!******************************************************************!*\ 50488 !*** ./node_modules/react-redux/es/connect/invalidArgFactory.js ***! 50489 \******************************************************************/ 50490/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50491 50492"use strict"; 50493__webpack_require__.r(__webpack_exports__); 50494/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50495/* harmony export */ createInvalidArgFactory: () => (/* binding */ createInvalidArgFactory) 50496/* harmony export */ }); 50497function createInvalidArgFactory(arg, name) { 50498 return (dispatch, options) => { 50499 throw new Error(`Invalid value of type ${typeof arg} for ${name} argument when connecting component ${options.wrappedComponentName}.`); 50500 }; 50501} 50502 50503/***/ }), 50504
vendor: 1,944 bytes, lines 50505-50531
50505/***/ "./node_modules/react-redux/es/connect/mapDispatchToProps.js": 50506/*!*******************************************************************!*\ 50507 !*** ./node_modules/react-redux/es/connect/mapDispatchToProps.js ***! 50508 \*******************************************************************/ 50509/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50510 50511"use strict"; 50512__webpack_require__.r(__webpack_exports__); 50513/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50514/* harmony export */ mapDispatchToPropsFactory: () => (/* binding */ mapDispatchToPropsFactory) 50515/* harmony export */ }); 50516/* harmony import */ var _utils_bindActionCreators__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/bindActionCreators */ "./node_modules/react-redux/es/utils/bindActionCreators.js"); 50517/* harmony import */ var _wrapMapToProps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./wrapMapToProps */ "./node_modules/react-redux/es/connect/wrapMapToProps.js"); 50518/* harmony import */ var _invalidArgFactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./invalidArgFactory */ "./node_modules/react-redux/es/connect/invalidArgFactory.js"); 50519 50520 50521 50522function mapDispatchToPropsFactory(mapDispatchToProps) { 50523 return mapDispatchToProps && typeof mapDispatchToProps === 'object' ? (0,_wrapMapToProps__WEBPACK_IMPORTED_MODULE_1__.wrapMapToPropsConstant)(dispatch => // @ts-ignore 50524 (0,_utils_bindActionCreators__WEBPACK_IMPORTED_MODULE_0__["default"])(mapDispatchToProps, dispatch)) : !mapDispatchToProps ? (0,_wrapMapToProps__WEBPACK_IMPORTED_MODULE_1__.wrapMapToPropsConstant)(dispatch => ({ 50525 dispatch 50526 })) : typeof mapDispatchToProps === 'function' ? // @ts-ignore 50527 (0,_wrapMapToProps__WEBPACK_IMPORTED_MODULE_1__.wrapMapToPropsFunc)(mapDispatchToProps, 'mapDispatchToProps') : (0,_invalidArgFactory__WEBPACK_IMPORTED_MODULE_2__.createInvalidArgFactory)(mapDispatchToProps, 'mapDispatchToProps'); 50528} 50529 50530/***/ }), 50531
vendor: 1,414 bytes, lines 50532-50553
50532/***/ "./node_modules/react-redux/es/connect/mapStateToProps.js": 50533/*!****************************************************************!*\ 50534 !*** ./node_modules/react-redux/es/connect/mapStateToProps.js ***! 50535 \****************************************************************/ 50536/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50537 50538"use strict"; 50539__webpack_require__.r(__webpack_exports__); 50540/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50541/* harmony export */ mapStateToPropsFactory: () => (/* binding */ mapStateToPropsFactory) 50542/* harmony export */ }); 50543/* harmony import */ var _wrapMapToProps__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./wrapMapToProps */ "./node_modules/react-redux/es/connect/wrapMapToProps.js"); 50544/* harmony import */ var _invalidArgFactory__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./invalidArgFactory */ "./node_modules/react-redux/es/connect/invalidArgFactory.js"); 50545 50546 50547function mapStateToPropsFactory(mapStateToProps) { 50548 return !mapStateToProps ? (0,_wrapMapToProps__WEBPACK_IMPORTED_MODULE_0__.wrapMapToPropsConstant)(() => ({})) : typeof mapStateToProps === 'function' ? // @ts-ignore 50549 (0,_wrapMapToProps__WEBPACK_IMPORTED_MODULE_0__.wrapMapToPropsFunc)(mapStateToProps, 'mapStateToProps') : (0,_invalidArgFactory__WEBPACK_IMPORTED_MODULE_1__.createInvalidArgFactory)(mapStateToProps, 'mapStateToProps'); 50550} 50551 50552/***/ }), 50553
vendor: 2,539 bytes, lines 50554-50604
50554/***/ "./node_modules/react-redux/es/connect/mergeProps.js": 50555/*!***********************************************************!*\ 50556 !*** ./node_modules/react-redux/es/connect/mergeProps.js ***! 50557 \***********************************************************/ 50558/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50559 50560"use strict"; 50561__webpack_require__.r(__webpack_exports__); 50562/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50563/* harmony export */ defaultMergeProps: () => (/* binding */ defaultMergeProps), 50564/* harmony export */ mergePropsFactory: () => (/* binding */ mergePropsFactory), 50565/* harmony export */ wrapMergePropsFunc: () => (/* binding */ wrapMergePropsFunc) 50566/* harmony export */ }); 50567/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "./node_modules/@babel/runtime/helpers/esm/extends.js"); 50568/* harmony import */ var _utils_verifyPlainObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../utils/verifyPlainObject */ "./node_modules/react-redux/es/utils/verifyPlainObject.js"); 50569/* harmony import */ var _invalidArgFactory__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./invalidArgFactory */ "./node_modules/react-redux/es/connect/invalidArgFactory.js"); 50570 50571 50572 50573function defaultMergeProps(stateProps, dispatchProps, ownProps) { 50574 // @ts-ignore 50575 return (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({}, ownProps, stateProps, dispatchProps); 50576} 50577function wrapMergePropsFunc(mergeProps) { 50578 return function initMergePropsProxy(dispatch, { 50579 displayName, 50580 areMergedPropsEqual 50581 }) { 50582 let hasRunOnce = false; 50583 let mergedProps; 50584 return function mergePropsProxy(stateProps, dispatchProps, ownProps) { 50585 const nextMergedProps = mergeProps(stateProps, dispatchProps, ownProps); 50586 50587 if (hasRunOnce) { 50588 if (!areMergedPropsEqual(nextMergedProps, mergedProps)) mergedProps = nextMergedProps; 50589 } else { 50590 hasRunOnce = true; 50591 mergedProps = nextMergedProps; 50592 if (true) (0,_utils_verifyPlainObject__WEBPACK_IMPORTED_MODULE_1__["default"])(mergedProps, displayName, 'mergeProps'); 50593 } 50594 50595 return mergedProps; 50596 }; 50597 }; 50598} 50599function mergePropsFactory(mergeProps) { 50600 return !mergeProps ? () => defaultMergeProps : typeof mergeProps === 'function' ? wrapMergePropsFunc(mergeProps) : (0,_invalidArgFactory__WEBPACK_IMPORTED_MODULE_2__.createInvalidArgFactory)(mergeProps, 'mergeProps'); 50601} 50602 50603/***/ }), 50604
vendor: 4,391 bytes, lines 50605-50705
50605/***/ "./node_modules/react-redux/es/connect/selectorFactory.js": 50606/*!****************************************************************!*\ 50607 !*** ./node_modules/react-redux/es/connect/selectorFactory.js ***! 50608 \****************************************************************/ 50609/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50610 50611"use strict"; 50612__webpack_require__.r(__webpack_exports__); 50613/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50614/* harmony export */ "default": () => (/* binding */ finalPropsSelectorFactory), 50615/* harmony export */ pureFinalPropsSelectorFactory: () => (/* binding */ pureFinalPropsSelectorFactory) 50616/* harmony export */ }); 50617/* harmony import */ var _babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutPropertiesLoose */ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js"); 50618/* harmony import */ var _verifySubselectors__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./verifySubselectors */ "./node_modules/react-redux/es/connect/verifySubselectors.js"); 50619 50620const _excluded = ["initMapStateToProps", "initMapDispatchToProps", "initMergeProps"]; 50621 50622function pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, { 50623 areStatesEqual, 50624 areOwnPropsEqual, 50625 areStatePropsEqual 50626}) { 50627 let hasRunAtLeastOnce = false; 50628 let state; 50629 let ownProps; 50630 let stateProps; 50631 let dispatchProps; 50632 let mergedProps; 50633 50634 function handleFirstCall(firstState, firstOwnProps) { 50635 state = firstState; 50636 ownProps = firstOwnProps; 50637 stateProps = mapStateToProps(state, ownProps); 50638 dispatchProps = mapDispatchToProps(dispatch, ownProps); 50639 mergedProps = mergeProps(stateProps, dispatchProps, ownProps); 50640 hasRunAtLeastOnce = true; 50641 return mergedProps; 50642 } 50643 50644 function handleNewPropsAndNewState() { 50645 stateProps = mapStateToProps(state, ownProps); 50646 if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps); 50647 mergedProps = mergeProps(stateProps, dispatchProps, ownProps); 50648 return mergedProps; 50649 } 50650 50651 function handleNewProps() { 50652 if (mapStateToProps.dependsOnOwnProps) stateProps = mapStateToProps(state, ownProps); 50653 if (mapDispatchToProps.dependsOnOwnProps) dispatchProps = mapDispatchToProps(dispatch, ownProps); 50654 mergedProps = mergeProps(stateProps, dispatchProps, ownProps); 50655 return mergedProps; 50656 } 50657 50658 function handleNewState() { 50659 const nextStateProps = mapStateToProps(state, ownProps); 50660 const statePropsChanged = !areStatePropsEqual(nextStateProps, stateProps); 50661 stateProps = nextStateProps; 50662 if (statePropsChanged) mergedProps = mergeProps(stateProps, dispatchProps, ownProps); 50663 return mergedProps; 50664 } 50665 50666 function handleSubsequentCalls(nextState, nextOwnProps) { 50667 const propsChanged = !areOwnPropsEqual(nextOwnProps, ownProps); 50668 const stateChanged = !areStatesEqual(nextState, state, nextOwnProps, ownProps); 50669 state = nextState; 50670 ownProps = nextOwnProps; 50671 if (propsChanged && stateChanged) return handleNewPropsAndNewState(); 50672 if (propsChanged) return handleNewProps(); 50673 if (stateChanged) return handleNewState(); 50674 return mergedProps; 50675 } 50676 50677 return function pureFinalPropsSelector(nextState, nextOwnProps) { 50678 return hasRunAtLeastOnce ? handleSubsequentCalls(nextState, nextOwnProps) : handleFirstCall(nextState, nextOwnProps); 50679 }; 50680} 50681// TODO: Add more comments 50682// The selector returned by selectorFactory will memoize its results, 50683// allowing connect's shouldComponentUpdate to return false if final 50684// props have not changed. 50685function finalPropsSelectorFactory(dispatch, _ref) { 50686 let { 50687 initMapStateToProps, 50688 initMapDispatchToProps, 50689 initMergeProps 50690 } = _ref, 50691 options = (0,_babel_runtime_helpers_esm_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__["default"])(_ref, _excluded); 50692 50693 const mapStateToProps = initMapStateToProps(dispatch, options); 50694 const mapDispatchToProps = initMapDispatchToProps(dispatch, options); 50695 const mergeProps = initMergeProps(dispatch, options); 50696 50697 if (true) { 50698 (0,_verifySubselectors__WEBPACK_IMPORTED_MODULE_1__["default"])(mapStateToProps, mapDispatchToProps, mergeProps); 50699 } 50700 50701 return pureFinalPropsSelectorFactory(mapStateToProps, mapDispatchToProps, mergeProps, dispatch, options); 50702} 50703 50704/***/ }), 50705
vendor: 1,456 bytes, lines 50706-50737
50706/***/ "./node_modules/react-redux/es/connect/verifySubselectors.js": 50707/*!*******************************************************************!*\ 50708 !*** ./node_modules/react-redux/es/connect/verifySubselectors.js ***! 50709 \*******************************************************************/ 50710/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50711 50712"use strict"; 50713__webpack_require__.r(__webpack_exports__); 50714/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50715/* harmony export */ "default": () => (/* binding */ verifySubselectors) 50716/* harmony export */ }); 50717/* harmony import */ var _utils_warning__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/warning */ "./node_modules/react-redux/es/utils/warning.js"); 50718 50719 50720function verify(selector, methodName) { 50721 if (!selector) { 50722 throw new Error(`Unexpected value for ${methodName} in connect.`); 50723 } else if (methodName === 'mapStateToProps' || methodName === 'mapDispatchToProps') { 50724 if (!Object.prototype.hasOwnProperty.call(selector, 'dependsOnOwnProps')) { 50725 (0,_utils_warning__WEBPACK_IMPORTED_MODULE_0__["default"])(`The selector for ${methodName} of connect did not specify a value for dependsOnOwnProps.`); 50726 } 50727 } 50728} 50729 50730function verifySubselectors(mapStateToProps, mapDispatchToProps, mergeProps) { 50731 verify(mapStateToProps, 'mapStateToProps'); 50732 verify(mapDispatchToProps, 'mapDispatchToProps'); 50733 verify(mergeProps, 'mergeProps'); 50734} 50735 50736/***/ }), 50737
vendor: 3,970 bytes, lines 50738-50824
50738/***/ "./node_modules/react-redux/es/connect/wrapMapToProps.js": 50739/*!***************************************************************!*\ 50740 !*** ./node_modules/react-redux/es/connect/wrapMapToProps.js ***! 50741 \***************************************************************/ 50742/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50743 50744"use strict"; 50745__webpack_require__.r(__webpack_exports__); 50746/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50747/* harmony export */ getDependsOnOwnProps: () => (/* binding */ getDependsOnOwnProps), 50748/* harmony export */ wrapMapToPropsConstant: () => (/* binding */ wrapMapToPropsConstant), 50749/* harmony export */ wrapMapToPropsFunc: () => (/* binding */ wrapMapToPropsFunc) 50750/* harmony export */ }); 50751/* harmony import */ var _utils_verifyPlainObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../utils/verifyPlainObject */ "./node_modules/react-redux/es/utils/verifyPlainObject.js"); 50752 50753function wrapMapToPropsConstant( // * Note: 50754// It seems that the dispatch argument 50755// could be a dispatch function in some cases (ex: whenMapDispatchToPropsIsMissing) 50756// and a state object in some others (ex: whenMapStateToPropsIsMissing) 50757// eslint-disable-next-line no-unused-vars 50758getConstant) { 50759 return function initConstantSelector(dispatch) { 50760 const constant = getConstant(dispatch); 50761 50762 function constantSelector() { 50763 return constant; 50764 } 50765 50766 constantSelector.dependsOnOwnProps = false; 50767 return constantSelector; 50768 }; 50769} // dependsOnOwnProps is used by createMapToPropsProxy to determine whether to pass props as args 50770// to the mapToProps function being wrapped. It is also used by makePurePropsSelector to determine 50771// whether mapToProps needs to be invoked when props have changed. 50772// 50773// A length of one signals that mapToProps does not depend on props from the parent component. 50774// A length of zero is assumed to mean mapToProps is getting args via arguments or ...args and 50775// therefore not reporting its length accurately.. 50776// TODO Can this get pulled out so that we can subscribe directly to the store if we don't need ownProps? 50777 50778function getDependsOnOwnProps(mapToProps) { 50779 return mapToProps.dependsOnOwnProps ? Boolean(mapToProps.dependsOnOwnProps) : mapToProps.length !== 1; 50780} // Used by whenMapStateToPropsIsFunction and whenMapDispatchToPropsIsFunction, 50781// this function wraps mapToProps in a proxy function which does several things: 50782// 50783// * Detects whether the mapToProps function being called depends on props, which 50784// is used by selectorFactory to decide if it should reinvoke on props changes. 50785// 50786// * On first call, handles mapToProps if returns another function, and treats that 50787// new function as the true mapToProps for subsequent calls. 50788// 50789// * On first call, verifies the first result is a plain object, in order to warn 50790// the developer that their mapToProps function is not returning a valid result. 50791// 50792 50793function wrapMapToPropsFunc(mapToProps, methodName) { 50794 return function initProxySelector(dispatch, { 50795 displayName 50796 }) { 50797 const proxy = function mapToPropsProxy(stateOrDispatch, ownProps) { 50798 return proxy.dependsOnOwnProps ? proxy.mapToProps(stateOrDispatch, ownProps) : proxy.mapToProps(stateOrDispatch, undefined); 50799 }; // allow detectFactoryAndVerify to get ownProps 50800 50801 50802 proxy.dependsOnOwnProps = true; 50803 50804 proxy.mapToProps = function detectFactoryAndVerify(stateOrDispatch, ownProps) { 50805 proxy.mapToProps = mapToProps; 50806 proxy.dependsOnOwnProps = getDependsOnOwnProps(mapToProps); 50807 let props = proxy(stateOrDispatch, ownProps); 50808 50809 if (typeof props === 'function') { 50810 proxy.mapToProps = props; 50811 proxy.dependsOnOwnProps = getDependsOnOwnProps(props); 50812 props = proxy(stateOrDispatch, ownProps); 50813 } 50814 50815 if (true) (0,_utils_verifyPlainObject__WEBPACK_IMPORTED_MODULE_0__["default"])(props, displayName, methodName); 50816 return props; 50817 }; 50818 50819 return proxy; 50820 }; 50821} 50822 50823/***/ }), 50824
vendor: 3,129 bytes, lines 50825-50864
50825/***/ "./node_modules/react-redux/es/exports.js": 50826/*!************************************************!*\ 50827 !*** ./node_modules/react-redux/es/exports.js ***! 50828 \************************************************/ 50829/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50830 50831"use strict"; 50832__webpack_require__.r(__webpack_exports__); 50833/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50834/* harmony export */ Provider: () => (/* reexport safe */ _components_Provider__WEBPACK_IMPORTED_MODULE_0__["default"]), 50835/* harmony export */ ReactReduxContext: () => (/* reexport safe */ _components_Context__WEBPACK_IMPORTED_MODULE_2__.ReactReduxContext), 50836/* harmony export */ connect: () => (/* reexport safe */ _components_connect__WEBPACK_IMPORTED_MODULE_1__["default"]), 50837/* harmony export */ createDispatchHook: () => (/* reexport safe */ _hooks_useDispatch__WEBPACK_IMPORTED_MODULE_3__.createDispatchHook), 50838/* harmony export */ createSelectorHook: () => (/* reexport safe */ _hooks_useSelector__WEBPACK_IMPORTED_MODULE_4__.createSelectorHook), 50839/* harmony export */ createStoreHook: () => (/* reexport safe */ _hooks_useStore__WEBPACK_IMPORTED_MODULE_5__.createStoreHook), 50840/* harmony export */ shallowEqual: () => (/* reexport safe */ _utils_shallowEqual__WEBPACK_IMPORTED_MODULE_6__["default"]), 50841/* harmony export */ useDispatch: () => (/* reexport safe */ _hooks_useDispatch__WEBPACK_IMPORTED_MODULE_3__.useDispatch), 50842/* harmony export */ useSelector: () => (/* reexport safe */ _hooks_useSelector__WEBPACK_IMPORTED_MODULE_4__.useSelector), 50843/* harmony export */ useStore: () => (/* reexport safe */ _hooks_useStore__WEBPACK_IMPORTED_MODULE_5__.useStore) 50844/* harmony export */ }); 50845/* harmony import */ var _components_Provider__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components/Provider */ "./node_modules/react-redux/es/components/Provider.js"); 50846/* harmony import */ var _components_connect__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components/connect */ "./node_modules/react-redux/es/components/connect.js"); 50847/* harmony import */ var _components_Context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./components/Context */ "./node_modules/react-redux/es/components/Context.js"); 50848/* harmony import */ var _hooks_useDispatch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./hooks/useDispatch */ "./node_modules/react-redux/es/hooks/useDispatch.js"); 50849/* harmony import */ var _hooks_useSelector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hooks/useSelector */ "./node_modules/react-redux/es/hooks/useSelector.js"); 50850/* harmony import */ var _hooks_useStore__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./hooks/useStore */ "./node_modules/react-redux/es/hooks/useStore.js"); 50851/* harmony import */ var _utils_shallowEqual__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./utils/shallowEqual */ "./node_modules/react-redux/es/utils/shallowEqual.js"); 50852/* harmony import */ var _types__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./types */ "./node_modules/react-redux/es/types.js"); 50853 50854 50855 50856 50857 50858 50859 50860 50861 50862 50863/***/ }), 50864
vendor: 2,347 bytes, lines 50865-50922
50865/***/ "./node_modules/react-redux/es/hooks/useDispatch.js": 50866/*!**********************************************************!*\ 50867 !*** ./node_modules/react-redux/es/hooks/useDispatch.js ***! 50868 \**********************************************************/ 50869/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50870 50871"use strict"; 50872__webpack_require__.r(__webpack_exports__); 50873/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50874/* harmony export */ createDispatchHook: () => (/* binding */ createDispatchHook), 50875/* harmony export */ useDispatch: () => (/* binding */ useDispatch) 50876/* harmony export */ }); 50877/* harmony import */ var _components_Context__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Context */ "./node_modules/react-redux/es/components/Context.js"); 50878/* harmony import */ var _useStore__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useStore */ "./node_modules/react-redux/es/hooks/useStore.js"); 50879 50880 50881/** 50882 * Hook factory, which creates a `useDispatch` hook bound to a given context. 50883 * 50884 * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`. 50885 * @returns {Function} A `useDispatch` hook bound to the specified context. 50886 */ 50887 50888function createDispatchHook(context = _components_Context__WEBPACK_IMPORTED_MODULE_0__.ReactReduxContext) { 50889 const useStore = // @ts-ignore 50890 context === _components_Context__WEBPACK_IMPORTED_MODULE_0__.ReactReduxContext ? _useStore__WEBPACK_IMPORTED_MODULE_1__.useStore : (0,_useStore__WEBPACK_IMPORTED_MODULE_1__.createStoreHook)(context); 50891 return function useDispatch() { 50892 const store = useStore(); // @ts-ignore 50893 50894 return store.dispatch; 50895 }; 50896} 50897/** 50898 * A hook to access the redux `dispatch` function. 50899 * 50900 * @returns {any|function} redux store's `dispatch` function 50901 * 50902 * @example 50903 * 50904 * import React, { useCallback } from 'react' 50905 * import { useDispatch } from 'react-redux' 50906 * 50907 * export const CounterComponent = ({ value }) => { 50908 * const dispatch = useDispatch() 50909 * const increaseCounter = useCallback(() => dispatch({ type: 'increase-counter' }), []) 50910 * return ( 50911 * <div> 50912 * <span>{value}</span> 50913 * <button onClick={increaseCounter}>Increase counter</button> 50914 * </div> 50915 * ) 50916 * } 50917 */ 50918 50919const useDispatch = /*#__PURE__*/createDispatchHook(); 50920 50921/***/ }), 50922
vendor: 2,428 bytes, lines 50923-50979
50923/***/ "./node_modules/react-redux/es/hooks/useReduxContext.js": 50924/*!**************************************************************!*\ 50925 !*** ./node_modules/react-redux/es/hooks/useReduxContext.js ***! 50926 \**************************************************************/ 50927/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50928 50929"use strict"; 50930__webpack_require__.r(__webpack_exports__); 50931/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50932/* harmony export */ createReduxContextHook: () => (/* binding */ createReduxContextHook), 50933/* harmony export */ useReduxContext: () => (/* binding */ useReduxContext) 50934/* harmony export */ }); 50935/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 50936/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 50937/* harmony import */ var _components_Context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/Context */ "./node_modules/react-redux/es/components/Context.js"); 50938 50939 50940 50941/** 50942 * Hook factory, which creates a `useReduxContext` hook bound to a given context. This is a low-level 50943 * hook that you should usually not need to call directly. 50944 * 50945 * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`. 50946 * @returns {Function} A `useReduxContext` hook bound to the specified context. 50947 */ 50948function createReduxContextHook(context = _components_Context__WEBPACK_IMPORTED_MODULE_1__.ReactReduxContext) { 50949 return function useReduxContext() { 50950 const contextValue = (0,react__WEBPACK_IMPORTED_MODULE_0__.useContext)(context); 50951 50952 if ( true && !contextValue) { 50953 throw new Error('could not find react-redux context value; please ensure the component is wrapped in a <Provider>'); 50954 } 50955 50956 return contextValue; 50957 }; 50958} 50959/** 50960 * A hook to access the value of the `ReactReduxContext`. This is a low-level 50961 * hook that you should usually not need to call directly. 50962 * 50963 * @returns {any} the value of the `ReactReduxContext` 50964 * 50965 * @example 50966 * 50967 * import React from 'react' 50968 * import { useReduxContext } from 'react-redux' 50969 * 50970 * export const CounterComponent = () => { 50971 * const { store } = useReduxContext() 50972 * return <div>{store.getState()}</div> 50973 * } 50974 */ 50975 50976const useReduxContext = /*#__PURE__*/createReduxContextHook(); 50977 50978/***/ }), 50979
vendor: 6,784 bytes, lines 50980-51141
50980/***/ "./node_modules/react-redux/es/hooks/useSelector.js": 50981/*!**********************************************************!*\ 50982 !*** ./node_modules/react-redux/es/hooks/useSelector.js ***! 50983 \**********************************************************/ 50984/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 50985 50986"use strict"; 50987__webpack_require__.r(__webpack_exports__); 50988/* harmony export */ __webpack_require__.d(__webpack_exports__, { 50989/* harmony export */ createSelectorHook: () => (/* binding */ createSelectorHook), 50990/* harmony export */ initializeUseSelector: () => (/* binding */ initializeUseSelector), 50991/* harmony export */ useSelector: () => (/* binding */ useSelector) 50992/* harmony export */ }); 50993/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 50994/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 50995/* harmony import */ var _useReduxContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useReduxContext */ "./node_modules/react-redux/es/hooks/useReduxContext.js"); 50996/* harmony import */ var _components_Context__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../components/Context */ "./node_modules/react-redux/es/components/Context.js"); 50997/* harmony import */ var _utils_useSyncExternalStore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../utils/useSyncExternalStore */ "./node_modules/react-redux/es/utils/useSyncExternalStore.js"); 50998 50999 51000 51001 51002let useSyncExternalStoreWithSelector = _utils_useSyncExternalStore__WEBPACK_IMPORTED_MODULE_3__.notInitialized; 51003const initializeUseSelector = fn => { 51004 useSyncExternalStoreWithSelector = fn; 51005}; 51006 51007const refEquality = (a, b) => a === b; 51008/** 51009 * Hook factory, which creates a `useSelector` hook bound to a given context. 51010 * 51011 * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`. 51012 * @returns {Function} A `useSelector` hook bound to the specified context. 51013 */ 51014 51015 51016function createSelectorHook(context = _components_Context__WEBPACK_IMPORTED_MODULE_2__.ReactReduxContext) { 51017 const useReduxContext = context === _components_Context__WEBPACK_IMPORTED_MODULE_2__.ReactReduxContext ? _useReduxContext__WEBPACK_IMPORTED_MODULE_1__.useReduxContext : (0,_useReduxContext__WEBPACK_IMPORTED_MODULE_1__.createReduxContextHook)(context); 51018 return function useSelector(selector, equalityFnOrOptions = {}) { 51019 const { 51020 equalityFn = refEquality, 51021 stabilityCheck = undefined, 51022 noopCheck = undefined 51023 } = typeof equalityFnOrOptions === 'function' ? { 51024 equalityFn: equalityFnOrOptions 51025 } : equalityFnOrOptions; 51026 51027 if (true) { 51028 if (!selector) { 51029 throw new Error(`You must pass a selector to useSelector`); 51030 } 51031 51032 if (typeof selector !== 'function') { 51033 throw new Error(`You must pass a function as a selector to useSelector`); 51034 } 51035 51036 if (typeof equalityFn !== 'function') { 51037 throw new Error(`You must pass a function as an equality function to useSelector`); 51038 } 51039 } 51040 51041 const { 51042 store, 51043 subscription, 51044 getServerState, 51045 stabilityCheck: globalStabilityCheck, 51046 noopCheck: globalNoopCheck 51047 } = useReduxContext(); 51048 const firstRun = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(true); 51049 const wrappedSelector = (0,react__WEBPACK_IMPORTED_MODULE_0__.useCallback)({ 51050 [selector.name](state) { 51051 const selected = selector(state); 51052 51053 if (true) { 51054 const finalStabilityCheck = typeof stabilityCheck === 'undefined' ? globalStabilityCheck : stabilityCheck; 51055 51056 if (finalStabilityCheck === 'always' || finalStabilityCheck === 'once' && firstRun.current) { 51057 const toCompare = selector(state); 51058 51059 if (!equalityFn(selected, toCompare)) { 51060 let stack = undefined; 51061 51062 try { 51063 throw new Error(); 51064 } catch (e) { 51065 ; 51066 ({ 51067 stack 51068 } = e); 51069 } 51070 51071 console.warn('Selector ' + (selector.name || 'unknown') + ' returned a different result when called with the same parameters. This can lead to unnecessary rerenders.' + '\nSelectors that return a new reference (such as an object or an array) should be memoized: https://redux.js.org/usage/deriving-data-selectors#optimizing-selectors-with-memoization', { 51072 state, 51073 selected, 51074 selected2: toCompare, 51075 stack 51076 }); 51077 } 51078 } 51079 51080 const finalNoopCheck = typeof noopCheck === 'undefined' ? globalNoopCheck : noopCheck; 51081 51082 if (finalNoopCheck === 'always' || finalNoopCheck === 'once' && firstRun.current) { 51083 // @ts-ignore 51084 if (selected === state) { 51085 let stack = undefined; 51086 51087 try { 51088 throw new Error(); 51089 } catch (e) { 51090 ; 51091 ({ 51092 stack 51093 } = e); 51094 } 51095 51096 console.warn('Selector ' + (selector.name || 'unknown') + ' returned the root state when called. This can lead to unnecessary rerenders.' + '\nSelectors that return the entire state are almost certainly a mistake, as they will cause a rerender whenever *anything* in state changes.', { 51097 stack 51098 }); 51099 } 51100 } 51101 51102 if (firstRun.current) firstRun.current = false; 51103 } 51104 51105 return selected; 51106 } 51107 51108 }[selector.name], [selector, globalStabilityCheck, stabilityCheck]); 51109 const selectedState = useSyncExternalStoreWithSelector(subscription.addNestedSub, store.getState, getServerState || store.getState, wrappedSelector, equalityFn); 51110 (0,react__WEBPACK_IMPORTED_MODULE_0__.useDebugValue)(selectedState); 51111 return selectedState; 51112 }; 51113} 51114/** 51115 * A hook to access the redux store's state. This hook takes a selector function 51116 * as an argument. The selector is called with the store state. 51117 * 51118 * This hook takes an optional equality comparison function as the second parameter 51119 * that allows you to customize the way the selected state is compared to determine 51120 * whether the component needs to be re-rendered. 51121 * 51122 * @param {Function} selector the selector function 51123 * @param {Function=} equalityFn the function that will be used to determine equality 51124 * 51125 * @returns {any} the selected state 51126 * 51127 * @example 51128 * 51129 * import React from 'react' 51130 * import { useSelector } from 'react-redux' 51131 * 51132 * export const CounterComponent = () => { 51133 * const counter = useSelector(state => state.counter) 51134 * return <div>{counter}</div> 51135 * } 51136 */ 51137 51138const useSelector = /*#__PURE__*/createSelectorHook(); 51139 51140/***/ }), 51141
vendor: 2,111 bytes, lines 51142-51196
51142/***/ "./node_modules/react-redux/es/hooks/useStore.js": 51143/*!*******************************************************!*\ 51144 !*** ./node_modules/react-redux/es/hooks/useStore.js ***! 51145 \*******************************************************/ 51146/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51147 51148"use strict"; 51149__webpack_require__.r(__webpack_exports__); 51150/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51151/* harmony export */ createStoreHook: () => (/* binding */ createStoreHook), 51152/* harmony export */ useStore: () => (/* binding */ useStore) 51153/* harmony export */ }); 51154/* harmony import */ var _components_Context__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/Context */ "./node_modules/react-redux/es/components/Context.js"); 51155/* harmony import */ var _useReduxContext__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./useReduxContext */ "./node_modules/react-redux/es/hooks/useReduxContext.js"); 51156 51157 51158/** 51159 * Hook factory, which creates a `useStore` hook bound to a given context. 51160 * 51161 * @param {React.Context} [context=ReactReduxContext] Context passed to your `<Provider>`. 51162 * @returns {Function} A `useStore` hook bound to the specified context. 51163 */ 51164 51165function createStoreHook(context = _components_Context__WEBPACK_IMPORTED_MODULE_0__.ReactReduxContext) { 51166 const useReduxContext = // @ts-ignore 51167 context === _components_Context__WEBPACK_IMPORTED_MODULE_0__.ReactReduxContext ? _useReduxContext__WEBPACK_IMPORTED_MODULE_1__.useReduxContext : // @ts-ignore 51168 (0,_useReduxContext__WEBPACK_IMPORTED_MODULE_1__.createReduxContextHook)(context); 51169 return function useStore() { 51170 const { 51171 store 51172 } = useReduxContext(); // @ts-ignore 51173 51174 return store; 51175 }; 51176} 51177/** 51178 * A hook to access the redux store. 51179 * 51180 * @returns {any} the redux store 51181 * 51182 * @example 51183 * 51184 * import React from 'react' 51185 * import { useStore } from 'react-redux' 51186 * 51187 * export const ExampleComponent = () => { 51188 * const store = useStore() 51189 * return <div>{store.getState()}</div> 51190 * } 51191 */ 51192 51193const useStore = /*#__PURE__*/createStoreHook(); 51194 51195/***/ }), 51196
vendor: 3,881 bytes, lines 51197-51243
51197/***/ "./node_modules/react-redux/es/index.js": 51198/*!**********************************************!*\ 51199 !*** ./node_modules/react-redux/es/index.js ***! 51200 \**********************************************/ 51201/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51202 51203"use strict"; 51204__webpack_require__.r(__webpack_exports__); 51205/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51206/* harmony export */ Provider: () => (/* reexport safe */ _exports__WEBPACK_IMPORTED_MODULE_6__.Provider), 51207/* harmony export */ ReactReduxContext: () => (/* reexport safe */ _exports__WEBPACK_IMPORTED_MODULE_6__.ReactReduxContext), 51208/* harmony export */ batch: () => (/* reexport safe */ _utils_reactBatchedUpdates__WEBPACK_IMPORTED_MODULE_2__.unstable_batchedUpdates), 51209/* harmony export */ connect: () => (/* reexport safe */ _exports__WEBPACK_IMPORTED_MODULE_6__.connect), 51210/* harmony export */ createDispatchHook: () => (/* reexport safe */ _exports__WEBPACK_IMPORTED_MODULE_6__.createDispatchHook), 51211/* harmony export */ createSelectorHook: () => (/* reexport safe */ _exports__WEBPACK_IMPORTED_MODULE_6__.createSelectorHook), 51212/* harmony export */ createStoreHook: () => (/* reexport safe */ _exports__WEBPACK_IMPORTED_MODULE_6__.createStoreHook), 51213/* harmony export */ shallowEqual: () => (/* reexport safe */ _exports__WEBPACK_IMPORTED_MODULE_6__.shallowEqual), 51214/* harmony export */ useDispatch: () => (/* reexport safe */ _exports__WEBPACK_IMPORTED_MODULE_6__.useDispatch), 51215/* harmony export */ useSelector: () => (/* reexport safe */ _exports__WEBPACK_IMPORTED_MODULE_6__.useSelector), 51216/* harmony export */ useStore: () => (/* reexport safe */ _exports__WEBPACK_IMPORTED_MODULE_6__.useStore) 51217/* harmony export */ }); 51218/* harmony import */ var use_sync_external_store_shim__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! use-sync-external-store/shim */ "./node_modules/use-sync-external-store/shim/index.js"); 51219/* harmony import */ var use_sync_external_store_shim_with_selector__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! use-sync-external-store/shim/with-selector */ "./node_modules/use-sync-external-store/shim/with-selector.js"); 51220/* harmony import */ var _utils_reactBatchedUpdates__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./utils/reactBatchedUpdates */ "./node_modules/react-redux/es/utils/reactBatchedUpdates.js"); 51221/* harmony import */ var _utils_batch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./utils/batch */ "./node_modules/react-redux/es/utils/batch.js"); 51222/* harmony import */ var _hooks_useSelector__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./hooks/useSelector */ "./node_modules/react-redux/es/hooks/useSelector.js"); 51223/* harmony import */ var _components_connect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./components/connect */ "./node_modules/react-redux/es/components/connect.js"); 51224/* harmony import */ var _exports__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./exports */ "./node_modules/react-redux/es/exports.js"); 51225// The primary entry point assumes we're working with standard ReactDOM/RN, but 51226// older versions that do not include `useSyncExternalStore` (React 16.9 - 17.x). 51227// Because of that, the useSyncExternalStore compat shim is needed. 51228 51229 51230 51231 51232 51233 51234(0,_hooks_useSelector__WEBPACK_IMPORTED_MODULE_4__.initializeUseSelector)(use_sync_external_store_shim_with_selector__WEBPACK_IMPORTED_MODULE_1__.useSyncExternalStoreWithSelector); 51235(0,_components_connect__WEBPACK_IMPORTED_MODULE_5__.initializeConnect)(use_sync_external_store_shim__WEBPACK_IMPORTED_MODULE_0__.useSyncExternalStore); // Enable batched updates in our subscriptions for use 51236// with standard React renderers (ReactDOM, React Native) 51237 51238(0,_utils_batch__WEBPACK_IMPORTED_MODULE_3__.setBatch)(_utils_reactBatchedUpdates__WEBPACK_IMPORTED_MODULE_2__.unstable_batchedUpdates); 51239 51240 51241 51242/***/ }), 51243
vendor: 355 bytes, lines 51244-51255
51244/***/ "./node_modules/react-redux/es/types.js": 51245/*!**********************************************!*\ 51246 !*** ./node_modules/react-redux/es/types.js ***! 51247 \**********************************************/ 51248/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51249 51250"use strict"; 51251__webpack_require__.r(__webpack_exports__); 51252 51253 51254/***/ }), 51255
vendor: 4,101 bytes, lines 51256-51428
51256/***/ "./node_modules/react-redux/es/utils/Subscription.js": 51257/*!***********************************************************!*\ 51258 !*** ./node_modules/react-redux/es/utils/Subscription.js ***! 51259 \***********************************************************/ 51260/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51261 51262"use strict"; 51263__webpack_require__.r(__webpack_exports__); 51264/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51265/* harmony export */ createSubscription: () => (/* binding */ createSubscription) 51266/* harmony export */ }); 51267/* harmony import */ var _batch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./batch */ "./node_modules/react-redux/es/utils/batch.js"); 51268 // encapsulates the subscription logic for connecting a component to the redux store, as 51269// well as nesting subscriptions of descendant components, so that we can ensure the 51270// ancestor components re-render before descendants 51271 51272function createListenerCollection() { 51273 const batch = (0,_batch__WEBPACK_IMPORTED_MODULE_0__.getBatch)(); 51274 let first = null; 51275 let last = null; 51276 return { 51277 clear() { 51278 first = null; 51279 last = null; 51280 }, 51281 51282 notify() { 51283 batch(() => { 51284 let listener = first; 51285 51286 while (listener) { 51287 listener.callback(); 51288 listener = listener.next; 51289 } 51290 }); 51291 }, 51292 51293 get() { 51294 let listeners = []; 51295 let listener = first; 51296 51297 while (listener) { 51298 listeners.push(listener); 51299 listener = listener.next; 51300 } 51301 51302 return listeners; 51303 }, 51304 51305 subscribe(callback) { 51306 let isSubscribed = true; 51307 let listener = last = { 51308 callback, 51309 next: null, 51310 prev: last 51311 }; 51312 51313 if (listener.prev) { 51314 listener.prev.next = listener; 51315 } else { 51316 first = listener; 51317 } 51318 51319 return function unsubscribe() { 51320 if (!isSubscribed || first === null) return; 51321 isSubscribed = false; 51322 51323 if (listener.next) { 51324 listener.next.prev = listener.prev; 51325 } else { 51326 last = listener.prev; 51327 } 51328 51329 if (listener.prev) { 51330 listener.prev.next = listener.next; 51331 } else { 51332 first = listener.next; 51333 } 51334 }; 51335 } 51336 51337 }; 51338} 51339 51340const nullListeners = { 51341 notify() {}, 51342 51343 get: () => [] 51344}; 51345function createSubscription(store, parentSub) { 51346 let unsubscribe; 51347 let listeners = nullListeners; // Reasons to keep the subscription active 51348 51349 let subscriptionsAmount = 0; // Is this specific subscription subscribed (or only nested ones?) 51350 51351 let selfSubscribed = false; 51352 51353 function addNestedSub(listener) { 51354 trySubscribe(); 51355 const cleanupListener = listeners.subscribe(listener); // cleanup nested sub 51356 51357 let removed = false; 51358 return () => { 51359 if (!removed) { 51360 removed = true; 51361 cleanupListener(); 51362 tryUnsubscribe(); 51363 } 51364 }; 51365 } 51366 51367 function notifyNestedSubs() { 51368 listeners.notify(); 51369 } 51370 51371 function handleChangeWrapper() { 51372 if (subscription.onStateChange) { 51373 subscription.onStateChange(); 51374 } 51375 } 51376 51377 function isSubscribed() { 51378 return selfSubscribed; 51379 } 51380 51381 function trySubscribe() { 51382 subscriptionsAmount++; 51383 51384 if (!unsubscribe) { 51385 unsubscribe = parentSub ? parentSub.addNestedSub(handleChangeWrapper) : store.subscribe(handleChangeWrapper); 51386 listeners = createListenerCollection(); 51387 } 51388 } 51389 51390 function tryUnsubscribe() { 51391 subscriptionsAmount--; 51392 51393 if (unsubscribe && subscriptionsAmount === 0) { 51394 unsubscribe(); 51395 unsubscribe = undefined; 51396 listeners.clear(); 51397 listeners = nullListeners; 51398 } 51399 } 51400 51401 function trySubscribeSelf() { 51402 if (!selfSubscribed) { 51403 selfSubscribed = true; 51404 trySubscribe(); 51405 } 51406 } 51407 51408 function tryUnsubscribeSelf() { 51409 if (selfSubscribed) { 51410 selfSubscribed = false; 51411 tryUnsubscribe(); 51412 } 51413 } 51414 51415 const subscription = { 51416 addNestedSub, 51417 notifyNestedSubs, 51418 handleChangeWrapper, 51419 isSubscribed, 51420 trySubscribe: trySubscribeSelf, 51421 tryUnsubscribe: tryUnsubscribeSelf, 51422 getListeners: () => listeners 51423 }; 51424 return subscription; 51425} 51426 51427/***/ }), 51428
vendor: 944 bytes, lines 51429-51453
51429/***/ "./node_modules/react-redux/es/utils/batch.js": 51430/*!****************************************************!*\ 51431 !*** ./node_modules/react-redux/es/utils/batch.js ***! 51432 \****************************************************/ 51433/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51434 51435"use strict"; 51436__webpack_require__.r(__webpack_exports__); 51437/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51438/* harmony export */ getBatch: () => (/* binding */ getBatch), 51439/* harmony export */ setBatch: () => (/* binding */ setBatch) 51440/* harmony export */ }); 51441// Default to a dummy "batch" implementation that just runs the callback 51442function defaultNoopBatch(callback) { 51443 callback(); 51444} 51445 51446let batch = defaultNoopBatch; // Allow injecting another batching function later 51447 51448const setBatch = newBatch => batch = newBatch; // Supply a getter just to skip dealing with ESM bindings 51449 51450const getBatch = () => batch; 51451 51452/***/ }), 51453
vendor: 943 bytes, lines 51454-51480
51454/***/ "./node_modules/react-redux/es/utils/bindActionCreators.js": 51455/*!*****************************************************************!*\ 51456 !*** ./node_modules/react-redux/es/utils/bindActionCreators.js ***! 51457 \*****************************************************************/ 51458/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51459 51460"use strict"; 51461__webpack_require__.r(__webpack_exports__); 51462/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51463/* harmony export */ "default": () => (/* binding */ bindActionCreators) 51464/* harmony export */ }); 51465function bindActionCreators(actionCreators, dispatch) { 51466 const boundActionCreators = {}; 51467 51468 for (const key in actionCreators) { 51469 const actionCreator = actionCreators[key]; 51470 51471 if (typeof actionCreator === 'function') { 51472 boundActionCreators[key] = (...args) => dispatch(actionCreator(...args)); 51473 } 51474 } 51475 51476 return boundActionCreators; 51477} 51478 51479/***/ }), 51480
vendor: 1,033 bytes, lines 51481-51510
51481/***/ "./node_modules/react-redux/es/utils/isPlainObject.js": 51482/*!************************************************************!*\ 51483 !*** ./node_modules/react-redux/es/utils/isPlainObject.js ***! 51484 \************************************************************/ 51485/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51486 51487"use strict"; 51488__webpack_require__.r(__webpack_exports__); 51489/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51490/* harmony export */ "default": () => (/* binding */ isPlainObject) 51491/* harmony export */ }); 51492/** 51493 * @param {any} obj The object to inspect. 51494 * @returns {boolean} True if the argument appears to be a plain object. 51495 */ 51496function isPlainObject(obj) { 51497 if (typeof obj !== 'object' || obj === null) return false; 51498 let proto = Object.getPrototypeOf(obj); 51499 if (proto === null) return true; 51500 let baseProto = proto; 51501 51502 while (Object.getPrototypeOf(baseProto) !== null) { 51503 baseProto = Object.getPrototypeOf(baseProto); 51504 } 51505 51506 return proto === baseProto; 51507} 51508 51509/***/ }), 51510
vendor: 806 bytes, lines 51511-51526
51511/***/ "./node_modules/react-redux/es/utils/reactBatchedUpdates.js": 51512/*!******************************************************************!*\ 51513 !*** ./node_modules/react-redux/es/utils/reactBatchedUpdates.js ***! 51514 \******************************************************************/ 51515/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51516 51517"use strict"; 51518__webpack_require__.r(__webpack_exports__); 51519/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51520/* harmony export */ unstable_batchedUpdates: () => (/* reexport safe */ react_dom__WEBPACK_IMPORTED_MODULE_0__.unstable_batchedUpdates) 51521/* harmony export */ }); 51522/* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react-dom */ "./node_modules/react-dom/index.js"); 51523 51524 51525/***/ }), 51526
vendor: 1,210 bytes, lines 51527-51567
51527/***/ "./node_modules/react-redux/es/utils/shallowEqual.js": 51528/*!***********************************************************!*\ 51529 !*** ./node_modules/react-redux/es/utils/shallowEqual.js ***! 51530 \***********************************************************/ 51531/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51532 51533"use strict"; 51534__webpack_require__.r(__webpack_exports__); 51535/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51536/* harmony export */ "default": () => (/* binding */ shallowEqual) 51537/* harmony export */ }); 51538function is(x, y) { 51539 if (x === y) { 51540 return x !== 0 || y !== 0 || 1 / x === 1 / y; 51541 } else { 51542 return x !== x && y !== y; 51543 } 51544} 51545 51546function shallowEqual(objA, objB) { 51547 if (is(objA, objB)) return true; 51548 51549 if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { 51550 return false; 51551 } 51552 51553 const keysA = Object.keys(objA); 51554 const keysB = Object.keys(objB); 51555 if (keysA.length !== keysB.length) return false; 51556 51557 for (let i = 0; i < keysA.length; i++) { 51558 if (!Object.prototype.hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) { 51559 return false; 51560 } 51561 } 51562 51563 return true; 51564} 51565 51566/***/ }), 51567
vendor: 1,963 bytes, lines 51568-51596
51568/***/ "./node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js": 51569/*!************************************************************************!*\ 51570 !*** ./node_modules/react-redux/es/utils/useIsomorphicLayoutEffect.js ***! 51571 \************************************************************************/ 51572/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51573 51574"use strict"; 51575__webpack_require__.r(__webpack_exports__); 51576/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51577/* harmony export */ canUseDOM: () => (/* binding */ canUseDOM), 51578/* harmony export */ useIsomorphicLayoutEffect: () => (/* binding */ useIsomorphicLayoutEffect) 51579/* harmony export */ }); 51580/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 51581/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); 51582 // React currently throws a warning when using useLayoutEffect on the server. 51583// To get around it, we can conditionally useEffect on the server (no-op) and 51584// useLayoutEffect in the browser. We need useLayoutEffect to ensure the store 51585// subscription callback always has the selector from the latest render commit 51586// available, otherwise a store update may happen between render and the effect, 51587// which may cause missed updates; we also must ensure the store subscription 51588// is created synchronously, otherwise a store update may occur before the 51589// subscription is created and an inconsistent state may be observed 51590// Matches logic in React's `shared/ExecutionEnvironment` file 51591 51592const canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); 51593const useIsomorphicLayoutEffect = canUseDOM ? react__WEBPACK_IMPORTED_MODULE_0__.useLayoutEffect : react__WEBPACK_IMPORTED_MODULE_0__.useEffect; 51594 51595/***/ }), 51596
vendor: 683 bytes, lines 51597-51613
51597/***/ "./node_modules/react-redux/es/utils/useSyncExternalStore.js": 51598/*!*******************************************************************!*\ 51599 !*** ./node_modules/react-redux/es/utils/useSyncExternalStore.js ***! 51600 \*******************************************************************/ 51601/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51602 51603"use strict"; 51604__webpack_require__.r(__webpack_exports__); 51605/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51606/* harmony export */ notInitialized: () => (/* binding */ notInitialized) 51607/* harmony export */ }); 51608const notInitialized = () => { 51609 throw new Error('uSES not initialized!'); 51610}; 51611 51612/***/ }), 51613
vendor: 1,210 bytes, lines 51614-51636
51614/***/ "./node_modules/react-redux/es/utils/verifyPlainObject.js": 51615/*!****************************************************************!*\ 51616 !*** ./node_modules/react-redux/es/utils/verifyPlainObject.js ***! 51617 \****************************************************************/ 51618/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51619 51620"use strict"; 51621__webpack_require__.r(__webpack_exports__); 51622/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51623/* harmony export */ "default": () => (/* binding */ verifyPlainObject) 51624/* harmony export */ }); 51625/* harmony import */ var _isPlainObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isPlainObject */ "./node_modules/react-redux/es/utils/isPlainObject.js"); 51626/* harmony import */ var _warning__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./warning */ "./node_modules/react-redux/es/utils/warning.js"); 51627 51628 51629function verifyPlainObject(value, displayName, methodName) { 51630 if (!(0,_isPlainObject__WEBPACK_IMPORTED_MODULE_0__["default"])(value)) { 51631 (0,_warning__WEBPACK_IMPORTED_MODULE_1__["default"])(`${methodName}() in ${displayName} must return a plain object. Instead received ${value}.`); 51632 } 51633} 51634 51635/***/ }), 51636
vendor: 1,172 bytes, lines 51637-51674
51637/***/ "./node_modules/react-redux/es/utils/warning.js": 51638/*!******************************************************!*\ 51639 !*** ./node_modules/react-redux/es/utils/warning.js ***! 51640 \******************************************************/ 51641/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 51642 51643"use strict"; 51644__webpack_require__.r(__webpack_exports__); 51645/* harmony export */ __webpack_require__.d(__webpack_exports__, { 51646/* harmony export */ "default": () => (/* binding */ warning) 51647/* harmony export */ }); 51648/** 51649 * Prints a warning in the console if it exists. 51650 * 51651 * @param {String} message The warning message. 51652 * @returns {void} 51653 */ 51654function warning(message) { 51655 /* eslint-disable no-console */ 51656 if (typeof console !== 'undefined' && typeof console.error === 'function') { 51657 console.error(message); 51658 } 51659 /* eslint-enable no-console */ 51660 51661 51662 try { 51663 // This error was thrown as a convenience so that if you enable 51664 // "break on all exceptions" in your console, 51665 // it would pause the execution at this line. 51666 throw new Error(message); 51667 /* eslint-disable no-empty */ 51668 } catch (e) {} 51669 /* eslint-enable no-empty */ 51670 51671} 51672 51673/***/ }), 51674
vendor: 43,078 bytes, lines 51675-53018
51675/***/ "./node_modules/react/cjs/react-jsx-runtime.development.js": 51676/*!*****************************************************************!*\ 51677 !*** ./node_modules/react/cjs/react-jsx-runtime.development.js ***! 51678 \*****************************************************************/ 51679/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 51680 51681"use strict"; 51682/** 51683 * @license React 51684 * react-jsx-runtime.development.js 51685 * 51686 * Copyright (c) Facebook, Inc. and its affiliates. 51687 * 51688 * This source code is licensed under the MIT license found in the 51689 * LICENSE file in the root directory of this source tree. 51690 */ 51691 51692 51693 51694if (true) { 51695 (function() { 51696'use strict'; 51697 51698var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 51699 51700// ATTENTION 51701// When adding new symbols to this file, 51702// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' 51703// The Symbol used to tag the ReactElement-like types. 51704var REACT_ELEMENT_TYPE = Symbol.for('react.element'); 51705var REACT_PORTAL_TYPE = Symbol.for('react.portal'); 51706var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); 51707var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); 51708var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); 51709var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); 51710var REACT_CONTEXT_TYPE = Symbol.for('react.context'); 51711var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); 51712var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); 51713var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); 51714var REACT_MEMO_TYPE = Symbol.for('react.memo'); 51715var REACT_LAZY_TYPE = Symbol.for('react.lazy'); 51716var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); 51717var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; 51718var FAUX_ITERATOR_SYMBOL = '@@iterator'; 51719function getIteratorFn(maybeIterable) { 51720 if (maybeIterable === null || typeof maybeIterable !== 'object') { 51721 return null; 51722 } 51723 51724 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; 51725 51726 if (typeof maybeIterator === 'function') { 51727 return maybeIterator; 51728 } 51729 51730 return null; 51731} 51732 51733var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 51734 51735function error(format) { 51736 { 51737 { 51738 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 51739 args[_key2 - 1] = arguments[_key2]; 51740 } 51741 51742 printWarning('error', format, args); 51743 } 51744 } 51745} 51746 51747function printWarning(level, format, args) { 51748 // When changing this logic, you might want to also 51749 // update consoleWithStackDev.www.js as well. 51750 { 51751 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; 51752 var stack = ReactDebugCurrentFrame.getStackAddendum(); 51753 51754 if (stack !== '') { 51755 format += '%s'; 51756 args = args.concat([stack]); 51757 } // eslint-disable-next-line react-internal/safe-string-coercion 51758 51759 51760 var argsWithFormat = args.map(function (item) { 51761 return String(item); 51762 }); // Careful: RN currently depends on this prefix 51763 51764 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it 51765 // breaks IE9: https://github.com/facebook/react/issues/13610 51766 // eslint-disable-next-line react-internal/no-production-logging 51767 51768 Function.prototype.apply.call(console[level], console, argsWithFormat); 51769 } 51770} 51771 51772// ----------------------------------------------------------------------------- 51773 51774var enableScopeAPI = false; // Experimental Create Event Handle API. 51775var enableCacheElement = false; 51776var enableTransitionTracing = false; // No known bugs, but needs performance testing 51777 51778var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber 51779// stuff. Intended to enable React core members to more easily debug scheduling 51780// issues in DEV builds. 51781 51782var enableDebugTracing = false; // Track which Fiber(s) schedule render work. 51783 51784var REACT_MODULE_REFERENCE; 51785 51786{ 51787 REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); 51788} 51789 51790function isValidElementType(type) { 51791 if (typeof type === 'string' || typeof type === 'function') { 51792 return true; 51793 } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). 51794 51795 51796 if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { 51797 return true; 51798 } 51799 51800 if (typeof type === 'object' && type !== null) { 51801 if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object 51802 // types supported by any Flight configuration anywhere since 51803 // we don't know which Flight build this will end up being used 51804 // with. 51805 type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { 51806 return true; 51807 } 51808 } 51809 51810 return false; 51811} 51812 51813function getWrappedName(outerType, innerType, wrapperName) { 51814 var displayName = outerType.displayName; 51815 51816 if (displayName) { 51817 return displayName; 51818 } 51819 51820 var functionName = innerType.displayName || innerType.name || ''; 51821 return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; 51822} // Keep in sync with react-reconciler/getComponentNameFromFiber 51823 51824 51825function getContextName(type) { 51826 return type.displayName || 'Context'; 51827} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. 51828 51829 51830function getComponentNameFromType(type) { 51831 if (type == null) { 51832 // Host root, text node or just invalid type. 51833 return null; 51834 } 51835 51836 { 51837 if (typeof type.tag === 'number') { 51838 error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); 51839 } 51840 } 51841 51842 if (typeof type === 'function') { 51843 return type.displayName || type.name || null; 51844 } 51845 51846 if (typeof type === 'string') { 51847 return type; 51848 } 51849 51850 switch (type) { 51851 case REACT_FRAGMENT_TYPE: 51852 return 'Fragment'; 51853 51854 case REACT_PORTAL_TYPE: 51855 return 'Portal'; 51856 51857 case REACT_PROFILER_TYPE: 51858 return 'Profiler'; 51859 51860 case REACT_STRICT_MODE_TYPE: 51861 return 'StrictMode'; 51862 51863 case REACT_SUSPENSE_TYPE: 51864 return 'Suspense'; 51865 51866 case REACT_SUSPENSE_LIST_TYPE: 51867 return 'SuspenseList'; 51868 51869 } 51870 51871 if (typeof type === 'object') { 51872 switch (type.$$typeof) { 51873 case REACT_CONTEXT_TYPE: 51874 var context = type; 51875 return getContextName(context) + '.Consumer'; 51876 51877 case REACT_PROVIDER_TYPE: 51878 var provider = type; 51879 return getContextName(provider._context) + '.Provider'; 51880 51881 case REACT_FORWARD_REF_TYPE: 51882 return getWrappedName(type, type.render, 'ForwardRef'); 51883 51884 case REACT_MEMO_TYPE: 51885 var outerName = type.displayName || null; 51886 51887 if (outerName !== null) { 51888 return outerName; 51889 } 51890 51891 return getComponentNameFromType(type.type) || 'Memo'; 51892 51893 case REACT_LAZY_TYPE: 51894 { 51895 var lazyComponent = type; 51896 var payload = lazyComponent._payload; 51897 var init = lazyComponent._init; 51898 51899 try { 51900 return getComponentNameFromType(init(payload)); 51901 } catch (x) { 51902 return null; 51903 } 51904 } 51905 51906 // eslint-disable-next-line no-fallthrough 51907 } 51908 } 51909 51910 return null; 51911} 51912 51913var assign = Object.assign; 51914 51915// Helpers to patch console.logs to avoid logging during side-effect free 51916// replaying on render function. This currently only patches the object 51917// lazily which won't cover if the log function was extracted eagerly. 51918// We could also eagerly patch the method. 51919var disabledDepth = 0; 51920var prevLog; 51921var prevInfo; 51922var prevWarn; 51923var prevError; 51924var prevGroup; 51925var prevGroupCollapsed; 51926var prevGroupEnd; 51927 51928function disabledLog() {} 51929 51930disabledLog.__reactDisabledLog = true; 51931function disableLogs() { 51932 { 51933 if (disabledDepth === 0) { 51934 /* eslint-disable react-internal/no-production-logging */ 51935 prevLog = console.log; 51936 prevInfo = console.info; 51937 prevWarn = console.warn; 51938 prevError = console.error; 51939 prevGroup = console.group; 51940 prevGroupCollapsed = console.groupCollapsed; 51941 prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 51942 51943 var props = { 51944 configurable: true, 51945 enumerable: true, 51946 value: disabledLog, 51947 writable: true 51948 }; // $FlowFixMe Flow thinks console is immutable. 51949 51950 Object.defineProperties(console, { 51951 info: props, 51952 log: props, 51953 warn: props, 51954 error: props, 51955 group: props, 51956 groupCollapsed: props, 51957 groupEnd: props 51958 }); 51959 /* eslint-enable react-internal/no-production-logging */ 51960 } 51961 51962 disabledDepth++; 51963 } 51964} 51965function reenableLogs() { 51966 { 51967 disabledDepth--; 51968 51969 if (disabledDepth === 0) { 51970 /* eslint-disable react-internal/no-production-logging */ 51971 var props = { 51972 configurable: true, 51973 enumerable: true, 51974 writable: true 51975 }; // $FlowFixMe Flow thinks console is immutable. 51976 51977 Object.defineProperties(console, { 51978 log: assign({}, props, { 51979 value: prevLog 51980 }), 51981 info: assign({}, props, { 51982 value: prevInfo 51983 }), 51984 warn: assign({}, props, { 51985 value: prevWarn 51986 }), 51987 error: assign({}, props, { 51988 value: prevError 51989 }), 51990 group: assign({}, props, { 51991 value: prevGroup 51992 }), 51993 groupCollapsed: assign({}, props, { 51994 value: prevGroupCollapsed 51995 }), 51996 groupEnd: assign({}, props, { 51997 value: prevGroupEnd 51998 }) 51999 }); 52000 /* eslint-enable react-internal/no-production-logging */ 52001 } 52002 52003 if (disabledDepth < 0) { 52004 error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); 52005 } 52006 } 52007} 52008 52009var ReactCurrentDispatcher = ReactSharedInternals.ReactCurrentDispatcher; 52010var prefix; 52011function describeBuiltInComponentFrame(name, source, ownerFn) { 52012 { 52013 if (prefix === undefined) { 52014 // Extract the VM specific prefix used by each line. 52015 try { 52016 throw Error(); 52017 } catch (x) { 52018 var match = x.stack.trim().match(/\n( *(at )?)/); 52019 prefix = match && match[1] || ''; 52020 } 52021 } // We use the prefix to ensure our stacks line up with native stack frames. 52022 52023 52024 return '\n' + prefix + name; 52025 } 52026} 52027var reentry = false; 52028var componentFrameCache; 52029 52030{ 52031 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; 52032 componentFrameCache = new PossiblyWeakMap(); 52033} 52034 52035function describeNativeComponentFrame(fn, construct) { 52036 // If something asked for a stack inside a fake render, it should get ignored. 52037 if ( !fn || reentry) { 52038 return ''; 52039 } 52040 52041 { 52042 var frame = componentFrameCache.get(fn); 52043 52044 if (frame !== undefined) { 52045 return frame; 52046 } 52047 } 52048 52049 var control; 52050 reentry = true; 52051 var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. 52052 52053 Error.prepareStackTrace = undefined; 52054 var previousDispatcher; 52055 52056 { 52057 previousDispatcher = ReactCurrentDispatcher.current; // Set the dispatcher in DEV because this might be call in the render function 52058 // for warnings. 52059 52060 ReactCurrentDispatcher.current = null; 52061 disableLogs(); 52062 } 52063 52064 try { 52065 // This should throw. 52066 if (construct) { 52067 // Something should be setting the props in the constructor. 52068 var Fake = function () { 52069 throw Error(); 52070 }; // $FlowFixMe 52071 52072 52073 Object.defineProperty(Fake.prototype, 'props', { 52074 set: function () { 52075 // We use a throwing setter instead of frozen or non-writable props 52076 // because that won't throw in a non-strict mode function. 52077 throw Error(); 52078 } 52079 }); 52080 52081 if (typeof Reflect === 'object' && Reflect.construct) { 52082 // We construct a different control for this case to include any extra 52083 // frames added by the construct call. 52084 try { 52085 Reflect.construct(Fake, []); 52086 } catch (x) { 52087 control = x; 52088 } 52089 52090 Reflect.construct(fn, [], Fake); 52091 } else { 52092 try { 52093 Fake.call(); 52094 } catch (x) { 52095 control = x; 52096 } 52097 52098 fn.call(Fake.prototype); 52099 } 52100 } else { 52101 try { 52102 throw Error(); 52103 } catch (x) { 52104 control = x; 52105 } 52106 52107 fn(); 52108 } 52109 } catch (sample) { 52110 // This is inlined manually because closure doesn't do it for us. 52111 if (sample && control && typeof sample.stack === 'string') { 52112 // This extracts the first frame from the sample that isn't also in the control. 52113 // Skipping one frame that we assume is the frame that calls the two. 52114 var sampleLines = sample.stack.split('\n'); 52115 var controlLines = control.stack.split('\n'); 52116 var s = sampleLines.length - 1; 52117 var c = controlLines.length - 1; 52118 52119 while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { 52120 // We expect at least one stack frame to be shared. 52121 // Typically this will be the root most one. However, stack frames may be 52122 // cut off due to maximum stack limits. In this case, one maybe cut off 52123 // earlier than the other. We assume that the sample is longer or the same 52124 // and there for cut off earlier. So we should find the root most frame in 52125 // the sample somewhere in the control. 52126 c--; 52127 } 52128 52129 for (; s >= 1 && c >= 0; s--, c--) { 52130 // Next we find the first one that isn't the same which should be the 52131 // frame that called our sample function and the control. 52132 if (sampleLines[s] !== controlLines[c]) { 52133 // In V8, the first line is describing the message but other VMs don't. 52134 // If we're about to return the first line, and the control is also on the same 52135 // line, that's a pretty good indicator that our sample threw at same line as 52136 // the control. I.e. before we entered the sample frame. So we ignore this result. 52137 // This can happen if you passed a class to function component, or non-function. 52138 if (s !== 1 || c !== 1) { 52139 do { 52140 s--; 52141 c--; // We may still have similar intermediate frames from the construct call. 52142 // The next one that isn't the same should be our match though. 52143 52144 if (c < 0 || sampleLines[s] !== controlLines[c]) { 52145 // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. 52146 var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>" 52147 // but we have a user-provided "displayName" 52148 // splice it in to make the stack more readable. 52149 52150 52151 if (fn.displayName && _frame.includes('<anonymous>')) { 52152 _frame = _frame.replace('<anonymous>', fn.displayName); 52153 } 52154 52155 { 52156 if (typeof fn === 'function') { 52157 componentFrameCache.set(fn, _frame); 52158 } 52159 } // Return the line we found. 52160 52161 52162 return _frame; 52163 } 52164 } while (s >= 1 && c >= 0); 52165 } 52166 52167 break; 52168 } 52169 } 52170 } 52171 } finally { 52172 reentry = false; 52173 52174 { 52175 ReactCurrentDispatcher.current = previousDispatcher; 52176 reenableLogs(); 52177 } 52178 52179 Error.prepareStackTrace = previousPrepareStackTrace; 52180 } // Fallback to just using the name if we couldn't make it throw. 52181 52182 52183 var name = fn ? fn.displayName || fn.name : ''; 52184 var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; 52185 52186 { 52187 if (typeof fn === 'function') { 52188 componentFrameCache.set(fn, syntheticFrame); 52189 } 52190 } 52191 52192 return syntheticFrame; 52193} 52194function describeFunctionComponentFrame(fn, source, ownerFn) { 52195 { 52196 return describeNativeComponentFrame(fn, false); 52197 } 52198} 52199 52200function shouldConstruct(Component) { 52201 var prototype = Component.prototype; 52202 return !!(prototype && prototype.isReactComponent); 52203} 52204 52205function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { 52206 52207 if (type == null) { 52208 return ''; 52209 } 52210 52211 if (typeof type === 'function') { 52212 { 52213 return describeNativeComponentFrame(type, shouldConstruct(type)); 52214 } 52215 } 52216 52217 if (typeof type === 'string') { 52218 return describeBuiltInComponentFrame(type); 52219 } 52220 52221 switch (type) { 52222 case REACT_SUSPENSE_TYPE: 52223 return describeBuiltInComponentFrame('Suspense'); 52224 52225 case REACT_SUSPENSE_LIST_TYPE: 52226 return describeBuiltInComponentFrame('SuspenseList'); 52227 } 52228 52229 if (typeof type === 'object') { 52230 switch (type.$$typeof) { 52231 case REACT_FORWARD_REF_TYPE: 52232 return describeFunctionComponentFrame(type.render); 52233 52234 case REACT_MEMO_TYPE: 52235 // Memo may contain any component type so we recursively resolve it. 52236 return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); 52237 52238 case REACT_LAZY_TYPE: 52239 { 52240 var lazyComponent = type; 52241 var payload = lazyComponent._payload; 52242 var init = lazyComponent._init; 52243 52244 try { 52245 // Lazy may contain any component type so we recursively resolve it. 52246 return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); 52247 } catch (x) {} 52248 } 52249 } 52250 } 52251 52252 return ''; 52253} 52254 52255var hasOwnProperty = Object.prototype.hasOwnProperty; 52256 52257var loggedTypeFailures = {}; 52258var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; 52259 52260function setCurrentlyValidatingElement(element) { 52261 { 52262 if (element) { 52263 var owner = element._owner; 52264 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); 52265 ReactDebugCurrentFrame.setExtraStackFrame(stack); 52266 } else { 52267 ReactDebugCurrentFrame.setExtraStackFrame(null); 52268 } 52269 } 52270} 52271 52272function checkPropTypes(typeSpecs, values, location, componentName, element) { 52273 { 52274 // $FlowFixMe This is okay but Flow doesn't know it. 52275 var has = Function.call.bind(hasOwnProperty); 52276 52277 for (var typeSpecName in typeSpecs) { 52278 if (has(typeSpecs, typeSpecName)) { 52279 var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to 52280 // fail the render phase where it didn't fail before. So we log it. 52281 // After these have been cleaned up, we'll let them throw. 52282 52283 try { 52284 // This is intentionally an invariant that gets caught. It's the same 52285 // behavior as without this statement except with a better message. 52286 if (typeof typeSpecs[typeSpecName] !== 'function') { 52287 // eslint-disable-next-line react-internal/prod-error-codes 52288 var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); 52289 err.name = 'Invariant Violation'; 52290 throw err; 52291 } 52292 52293 error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); 52294 } catch (ex) { 52295 error$1 = ex; 52296 } 52297 52298 if (error$1 && !(error$1 instanceof Error)) { 52299 setCurrentlyValidatingElement(element); 52300 52301 error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); 52302 52303 setCurrentlyValidatingElement(null); 52304 } 52305 52306 if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { 52307 // Only monitor this failure once because there tends to be a lot of the 52308 // same error. 52309 loggedTypeFailures[error$1.message] = true; 52310 setCurrentlyValidatingElement(element); 52311 52312 error('Failed %s type: %s', location, error$1.message); 52313 52314 setCurrentlyValidatingElement(null); 52315 } 52316 } 52317 } 52318 } 52319} 52320 52321var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare 52322 52323function isArray(a) { 52324 return isArrayImpl(a); 52325} 52326 52327/* 52328 * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol 52329 * and Temporal.* types. See https://github.com/facebook/react/pull/22064. 52330 * 52331 * The functions in this module will throw an easier-to-understand, 52332 * easier-to-debug exception with a clear errors message message explaining the 52333 * problem. (Instead of a confusing exception thrown inside the implementation 52334 * of the `value` object). 52335 */ 52336// $FlowFixMe only called in DEV, so void return is not possible. 52337function typeName(value) { 52338 { 52339 // toStringTag is needed for namespaced types like Temporal.Instant 52340 var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; 52341 var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; 52342 return type; 52343 } 52344} // $FlowFixMe only called in DEV, so void return is not possible. 52345 52346 52347function willCoercionThrow(value) { 52348 { 52349 try { 52350 testStringCoercion(value); 52351 return false; 52352 } catch (e) { 52353 return true; 52354 } 52355 } 52356} 52357 52358function testStringCoercion(value) { 52359 // If you ended up here by following an exception call stack, here's what's 52360 // happened: you supplied an object or symbol value to React (as a prop, key, 52361 // DOM attribute, CSS property, string ref, etc.) and when React tried to 52362 // coerce it to a string using `'' + value`, an exception was thrown. 52363 // 52364 // The most common types that will cause this exception are `Symbol` instances 52365 // and Temporal objects like `Temporal.Instant`. But any object that has a 52366 // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this 52367 // exception. (Library authors do this to prevent users from using built-in 52368 // numeric operators like `+` or comparison operators like `>=` because custom 52369 // methods are needed to perform accurate arithmetic or comparison.) 52370 // 52371 // To fix the problem, coerce this object or symbol value to a string before 52372 // passing it to React. The most reliable way is usually `String(value)`. 52373 // 52374 // To find which value is throwing, check the browser or debugger console. 52375 // Before this exception was thrown, there should be `console.error` output 52376 // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the 52377 // problem and how that type was used: key, atrribute, input value prop, etc. 52378 // In most cases, this console output also shows the component and its 52379 // ancestor components where the exception happened. 52380 // 52381 // eslint-disable-next-line react-internal/safe-string-coercion 52382 return '' + value; 52383} 52384function checkKeyStringCoercion(value) { 52385 { 52386 if (willCoercionThrow(value)) { 52387 error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); 52388 52389 return testStringCoercion(value); // throw (to help callers find troubleshooting comments) 52390 } 52391 } 52392} 52393 52394var ReactCurrentOwner = ReactSharedInternals.ReactCurrentOwner; 52395var RESERVED_PROPS = { 52396 key: true, 52397 ref: true, 52398 __self: true, 52399 __source: true 52400}; 52401var specialPropKeyWarningShown; 52402var specialPropRefWarningShown; 52403var didWarnAboutStringRefs; 52404 52405{ 52406 didWarnAboutStringRefs = {}; 52407} 52408 52409function hasValidRef(config) { 52410 { 52411 if (hasOwnProperty.call(config, 'ref')) { 52412 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; 52413 52414 if (getter && getter.isReactWarning) { 52415 return false; 52416 } 52417 } 52418 } 52419 52420 return config.ref !== undefined; 52421} 52422 52423function hasValidKey(config) { 52424 { 52425 if (hasOwnProperty.call(config, 'key')) { 52426 var getter = Object.getOwnPropertyDescriptor(config, 'key').get; 52427 52428 if (getter && getter.isReactWarning) { 52429 return false; 52430 } 52431 } 52432 } 52433 52434 return config.key !== undefined; 52435} 52436 52437function warnIfStringRefCannotBeAutoConverted(config, self) { 52438 { 52439 if (typeof config.ref === 'string' && ReactCurrentOwner.current && self && ReactCurrentOwner.current.stateNode !== self) { 52440 var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); 52441 52442 if (!didWarnAboutStringRefs[componentName]) { 52443 error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', getComponentNameFromType(ReactCurrentOwner.current.type), config.ref); 52444 52445 didWarnAboutStringRefs[componentName] = true; 52446 } 52447 } 52448 } 52449} 52450 52451function defineKeyPropWarningGetter(props, displayName) { 52452 { 52453 var warnAboutAccessingKey = function () { 52454 if (!specialPropKeyWarningShown) { 52455 specialPropKeyWarningShown = true; 52456 52457 error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); 52458 } 52459 }; 52460 52461 warnAboutAccessingKey.isReactWarning = true; 52462 Object.defineProperty(props, 'key', { 52463 get: warnAboutAccessingKey, 52464 configurable: true 52465 }); 52466 } 52467} 52468 52469function defineRefPropWarningGetter(props, displayName) { 52470 { 52471 var warnAboutAccessingRef = function () { 52472 if (!specialPropRefWarningShown) { 52473 specialPropRefWarningShown = true; 52474 52475 error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); 52476 } 52477 }; 52478 52479 warnAboutAccessingRef.isReactWarning = true; 52480 Object.defineProperty(props, 'ref', { 52481 get: warnAboutAccessingRef, 52482 configurable: true 52483 }); 52484 } 52485} 52486/** 52487 * Factory method to create a new React element. This no longer adheres to 52488 * the class pattern, so do not use new to call it. Also, instanceof check 52489 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check 52490 * if something is a React Element. 52491 * 52492 * @param {*} type 52493 * @param {*} props 52494 * @param {*} key 52495 * @param {string|object} ref 52496 * @param {*} owner 52497 * @param {*} self A *temporary* helper to detect places where `this` is 52498 * different from the `owner` when React.createElement is called, so that we 52499 * can warn. We want to get rid of owner and replace string `ref`s with arrow 52500 * functions, and as long as `this` and owner are the same, there will be no 52501 * change in behavior. 52502 * @param {*} source An annotation object (added by a transpiler or otherwise) 52503 * indicating filename, line number, and/or other information. 52504 * @internal 52505 */ 52506 52507 52508var ReactElement = function (type, key, ref, self, source, owner, props) { 52509 var element = { 52510 // This tag allows us to uniquely identify this as a React Element 52511 $$typeof: REACT_ELEMENT_TYPE, 52512 // Built-in properties that belong on the element 52513 type: type, 52514 key: key, 52515 ref: ref, 52516 props: props, 52517 // Record the component responsible for creating this element. 52518 _owner: owner 52519 }; 52520 52521 { 52522 // The validation flag is currently mutative. We put it on 52523 // an external backing store so that we can freeze the whole object. 52524 // This can be replaced with a WeakMap once they are implemented in 52525 // commonly used development environments. 52526 element._store = {}; // To make comparing ReactElements easier for testing purposes, we make 52527 // the validation flag non-enumerable (where possible, which should 52528 // include every environment we run tests in), so the test framework 52529 // ignores it. 52530 52531 Object.defineProperty(element._store, 'validated', { 52532 configurable: false, 52533 enumerable: false, 52534 writable: true, 52535 value: false 52536 }); // self and source are DEV only properties. 52537 52538 Object.defineProperty(element, '_self', { 52539 configurable: false, 52540 enumerable: false, 52541 writable: false, 52542 value: self 52543 }); // Two elements created in two different places should be considered 52544 // equal for testing purposes and therefore we hide it from enumeration. 52545 52546 Object.defineProperty(element, '_source', { 52547 configurable: false, 52548 enumerable: false, 52549 writable: false, 52550 value: source 52551 }); 52552 52553 if (Object.freeze) { 52554 Object.freeze(element.props); 52555 Object.freeze(element); 52556 } 52557 } 52558 52559 return element; 52560}; 52561/** 52562 * https://github.com/reactjs/rfcs/pull/107 52563 * @param {*} type 52564 * @param {object} props 52565 * @param {string} key 52566 */ 52567 52568function jsxDEV(type, config, maybeKey, source, self) { 52569 { 52570 var propName; // Reserved names are extracted 52571 52572 var props = {}; 52573 var key = null; 52574 var ref = null; // Currently, key can be spread in as a prop. This causes a potential 52575 // issue if key is also explicitly declared (ie. <div {...props} key="Hi" /> 52576 // or <div key="Hi" {...props} /> ). We want to deprecate key spread, 52577 // but as an intermediary step, we will use jsxDEV for everything except 52578 // <div {...props} key="Hi" />, because we aren't currently able to tell if 52579 // key is explicitly declared to be undefined or not. 52580 52581 if (maybeKey !== undefined) { 52582 { 52583 checkKeyStringCoercion(maybeKey); 52584 } 52585 52586 key = '' + maybeKey; 52587 } 52588 52589 if (hasValidKey(config)) { 52590 { 52591 checkKeyStringCoercion(config.key); 52592 } 52593 52594 key = '' + config.key; 52595 } 52596 52597 if (hasValidRef(config)) { 52598 ref = config.ref; 52599 warnIfStringRefCannotBeAutoConverted(config, self); 52600 } // Remaining properties are added to a new props object 52601 52602 52603 for (propName in config) { 52604 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { 52605 props[propName] = config[propName]; 52606 } 52607 } // Resolve default props 52608 52609 52610 if (type && type.defaultProps) { 52611 var defaultProps = type.defaultProps; 52612 52613 for (propName in defaultProps) { 52614 if (props[propName] === undefined) { 52615 props[propName] = defaultProps[propName]; 52616 } 52617 } 52618 } 52619 52620 if (key || ref) { 52621 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; 52622 52623 if (key) { 52624 defineKeyPropWarningGetter(props, displayName); 52625 } 52626 52627 if (ref) { 52628 defineRefPropWarningGetter(props, displayName); 52629 } 52630 } 52631 52632 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); 52633 } 52634} 52635 52636var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner; 52637var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; 52638 52639function setCurrentlyValidatingElement$1(element) { 52640 { 52641 if (element) { 52642 var owner = element._owner; 52643 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); 52644 ReactDebugCurrentFrame$1.setExtraStackFrame(stack); 52645 } else { 52646 ReactDebugCurrentFrame$1.setExtraStackFrame(null); 52647 } 52648 } 52649} 52650 52651var propTypesMisspellWarningShown; 52652 52653{ 52654 propTypesMisspellWarningShown = false; 52655} 52656/** 52657 * Verifies the object is a ReactElement. 52658 * See https://reactjs.org/docs/react-api.html#isvalidelement 52659 * @param {?object} object 52660 * @return {boolean} True if `object` is a ReactElement. 52661 * @final 52662 */ 52663 52664 52665function isValidElement(object) { 52666 { 52667 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 52668 } 52669} 52670 52671function getDeclarationErrorAddendum() { 52672 { 52673 if (ReactCurrentOwner$1.current) { 52674 var name = getComponentNameFromType(ReactCurrentOwner$1.current.type); 52675 52676 if (name) { 52677 return '\n\nCheck the render method of `' + name + '`.'; 52678 } 52679 } 52680 52681 return ''; 52682 } 52683} 52684 52685function getSourceInfoErrorAddendum(source) { 52686 { 52687 if (source !== undefined) { 52688 var fileName = source.fileName.replace(/^.*[\\\/]/, ''); 52689 var lineNumber = source.lineNumber; 52690 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; 52691 } 52692 52693 return ''; 52694 } 52695} 52696/** 52697 * Warn if there's no key explicitly set on dynamic arrays of children or 52698 * object keys are not valid. This allows us to keep track of children between 52699 * updates. 52700 */ 52701 52702 52703var ownerHasKeyUseWarning = {}; 52704 52705function getCurrentComponentErrorInfo(parentType) { 52706 { 52707 var info = getDeclarationErrorAddendum(); 52708 52709 if (!info) { 52710 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; 52711 52712 if (parentName) { 52713 info = "\n\nCheck the top-level render call using <" + parentName + ">."; 52714 } 52715 } 52716 52717 return info; 52718 } 52719} 52720/** 52721 * Warn if the element doesn't have an explicit key assigned to it. 52722 * This element is in an array. The array could grow and shrink or be 52723 * reordered. All children that haven't already been validated are required to 52724 * have a "key" property assigned to it. Error statuses are cached so a warning 52725 * will only be shown once. 52726 * 52727 * @internal 52728 * @param {ReactElement} element Element that requires a key. 52729 * @param {*} parentType element's parent's type. 52730 */ 52731 52732 52733function validateExplicitKey(element, parentType) { 52734 { 52735 if (!element._store || element._store.validated || element.key != null) { 52736 return; 52737 } 52738 52739 element._store.validated = true; 52740 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); 52741 52742 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { 52743 return; 52744 } 52745 52746 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a 52747 // property, it may be the creator of the child that's responsible for 52748 // assigning it a key. 52749 52750 var childOwner = ''; 52751 52752 if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) { 52753 // Give the component that originally created this child. 52754 childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; 52755 } 52756 52757 setCurrentlyValidatingElement$1(element); 52758 52759 error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); 52760 52761 setCurrentlyValidatingElement$1(null); 52762 } 52763} 52764/** 52765 * Ensure that every element either is passed in a static location, in an 52766 * array with an explicit keys property defined, or in an object literal 52767 * with valid key property. 52768 * 52769 * @internal 52770 * @param {ReactNode} node Statically passed child of any type. 52771 * @param {*} parentType node's parent's type. 52772 */ 52773 52774 52775function validateChildKeys(node, parentType) { 52776 { 52777 if (typeof node !== 'object') { 52778 return; 52779 } 52780 52781 if (isArray(node)) { 52782 for (var i = 0; i < node.length; i++) { 52783 var child = node[i]; 52784 52785 if (isValidElement(child)) { 52786 validateExplicitKey(child, parentType); 52787 } 52788 } 52789 } else if (isValidElement(node)) { 52790 // This element was passed in a valid location. 52791 if (node._store) { 52792 node._store.validated = true; 52793 } 52794 } else if (node) { 52795 var iteratorFn = getIteratorFn(node); 52796 52797 if (typeof iteratorFn === 'function') { 52798 // Entry iterators used to provide implicit keys, 52799 // but now we print a separate warning for them later. 52800 if (iteratorFn !== node.entries) { 52801 var iterator = iteratorFn.call(node); 52802 var step; 52803 52804 while (!(step = iterator.next()).done) { 52805 if (isValidElement(step.value)) { 52806 validateExplicitKey(step.value, parentType); 52807 } 52808 } 52809 } 52810 } 52811 } 52812 } 52813} 52814/** 52815 * Given an element, validate that its props follow the propTypes definition, 52816 * provided by the type. 52817 * 52818 * @param {ReactElement} element 52819 */ 52820 52821 52822function validatePropTypes(element) { 52823 { 52824 var type = element.type; 52825 52826 if (type === null || type === undefined || typeof type === 'string') { 52827 return; 52828 } 52829 52830 var propTypes; 52831 52832 if (typeof type === 'function') { 52833 propTypes = type.propTypes; 52834 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. 52835 // Inner props are checked in the reconciler. 52836 type.$$typeof === REACT_MEMO_TYPE)) { 52837 propTypes = type.propTypes; 52838 } else { 52839 return; 52840 } 52841 52842 if (propTypes) { 52843 // Intentionally inside to avoid triggering lazy initializers: 52844 var name = getComponentNameFromType(type); 52845 checkPropTypes(propTypes, element.props, 'prop', name, element); 52846 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { 52847 propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: 52848 52849 var _name = getComponentNameFromType(type); 52850 52851 error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); 52852 } 52853 52854 if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { 52855 error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); 52856 } 52857 } 52858} 52859/** 52860 * Given a fragment, validate that it can only be provided with fragment props 52861 * @param {ReactElement} fragment 52862 */ 52863 52864 52865function validateFragmentProps(fragment) { 52866 { 52867 var keys = Object.keys(fragment.props); 52868 52869 for (var i = 0; i < keys.length; i++) { 52870 var key = keys[i]; 52871 52872 if (key !== 'children' && key !== 'key') { 52873 setCurrentlyValidatingElement$1(fragment); 52874 52875 error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); 52876 52877 setCurrentlyValidatingElement$1(null); 52878 break; 52879 } 52880 } 52881 52882 if (fragment.ref !== null) { 52883 setCurrentlyValidatingElement$1(fragment); 52884 52885 error('Invalid attribute `ref` supplied to `React.Fragment`.'); 52886 52887 setCurrentlyValidatingElement$1(null); 52888 } 52889 } 52890} 52891 52892var didWarnAboutKeySpread = {}; 52893function jsxWithValidation(type, props, key, isStaticChildren, source, self) { 52894 { 52895 var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to 52896 // succeed and there will likely be errors in render. 52897 52898 if (!validType) { 52899 var info = ''; 52900 52901 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { 52902 info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; 52903 } 52904 52905 var sourceInfo = getSourceInfoErrorAddendum(source); 52906 52907 if (sourceInfo) { 52908 info += sourceInfo; 52909 } else { 52910 info += getDeclarationErrorAddendum(); 52911 } 52912 52913 var typeString; 52914 52915 if (type === null) { 52916 typeString = 'null'; 52917 } else if (isArray(type)) { 52918 typeString = 'array'; 52919 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { 52920 typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; 52921 info = ' Did you accidentally export a JSX literal instead of a component?'; 52922 } else { 52923 typeString = typeof type; 52924 } 52925 52926 error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); 52927 } 52928 52929 var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used. 52930 // TODO: Drop this when these are no longer allowed as the type argument. 52931 52932 if (element == null) { 52933 return element; 52934 } // Skip key warning if the type isn't valid since our key validation logic 52935 // doesn't expect a non-string/function type and can throw confusing errors. 52936 // We don't want exception behavior to differ between dev and prod. 52937 // (Rendering will throw with a helpful message and as soon as the type is 52938 // fixed, the key warnings will appear.) 52939 52940 52941 if (validType) { 52942 var children = props.children; 52943 52944 if (children !== undefined) { 52945 if (isStaticChildren) { 52946 if (isArray(children)) { 52947 for (var i = 0; i < children.length; i++) { 52948 validateChildKeys(children[i], type); 52949 } 52950 52951 if (Object.freeze) { 52952 Object.freeze(children); 52953 } 52954 } else { 52955 error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.'); 52956 } 52957 } else { 52958 validateChildKeys(children, type); 52959 } 52960 } 52961 } 52962 52963 { 52964 if (hasOwnProperty.call(props, 'key')) { 52965 var componentName = getComponentNameFromType(type); 52966 var keys = Object.keys(props).filter(function (k) { 52967 return k !== 'key'; 52968 }); 52969 var beforeExample = keys.length > 0 ? '{key: someKey, ' + keys.join(': ..., ') + ': ...}' : '{key: someKey}'; 52970 52971 if (!didWarnAboutKeySpread[componentName + beforeExample]) { 52972 var afterExample = keys.length > 0 ? '{' + keys.join(': ..., ') + ': ...}' : '{}'; 52973 52974 error('A props object containing a "key" prop is being spread into JSX:\n' + ' let props = %s;\n' + ' <%s {...props} />\n' + 'React keys must be passed directly to JSX without using spread:\n' + ' let props = %s;\n' + ' <%s key={someKey} {...props} />', beforeExample, componentName, afterExample, componentName); 52975 52976 didWarnAboutKeySpread[componentName + beforeExample] = true; 52977 } 52978 } 52979 } 52980 52981 if (type === REACT_FRAGMENT_TYPE) { 52982 validateFragmentProps(element); 52983 } else { 52984 validatePropTypes(element); 52985 } 52986 52987 return element; 52988 } 52989} // These two functions exist to still get child warnings in dev 52990// even with the prod transform. This means that jsxDEV is purely 52991// opt-in behavior for better messages but that we won't stop 52992// giving you warnings if you use production apis. 52993 52994function jsxWithValidationStatic(type, props, key) { 52995 { 52996 return jsxWithValidation(type, props, key, true); 52997 } 52998} 52999function jsxWithValidationDynamic(type, props, key) { 53000 { 53001 return jsxWithValidation(type, props, key, false); 53002 } 53003} 53004 53005var jsx = jsxWithValidationDynamic ; // we may want to special case jsxs internally to take advantage of static children. 53006// for now we can ship identical prod functions 53007 53008var jsxs = jsxWithValidationStatic ; 53009 53010exports.Fragment = REACT_FRAGMENT_TYPE; 53011exports.jsx = jsx; 53012exports.jsxs = jsxs; 53013 })(); 53014} 53015 53016 53017/***/ }), 53018
vendor: 88,052 bytes, lines 53019-55771
53019/***/ "./node_modules/react/cjs/react.development.js": 53020/*!*****************************************************!*\ 53021 !*** ./node_modules/react/cjs/react.development.js ***! 53022 \*****************************************************/ 53023/***/ ((module, exports, __webpack_require__) => { 53024 53025"use strict"; 53026/* module decorator */ module = __webpack_require__.nmd(module); 53027/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 53028/** 53029 * @license React 53030 * react.development.js 53031 * 53032 * Copyright (c) Facebook, Inc. and its affiliates. 53033 * 53034 * This source code is licensed under the MIT license found in the 53035 * LICENSE file in the root directory of this source tree. 53036 */ 53037 53038 53039 53040if (true) { 53041 (function() { 53042 53043 'use strict'; 53044 53045/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 53046if ( 53047 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 53048 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === 53049 'function' 53050) { 53051 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); 53052} 53053 var ReactVersion = '18.3.1'; 53054 53055// ATTENTION 53056// When adding new symbols to this file, 53057// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols' 53058// The Symbol used to tag the ReactElement-like types. 53059var REACT_ELEMENT_TYPE = Symbol.for('react.element'); 53060var REACT_PORTAL_TYPE = Symbol.for('react.portal'); 53061var REACT_FRAGMENT_TYPE = Symbol.for('react.fragment'); 53062var REACT_STRICT_MODE_TYPE = Symbol.for('react.strict_mode'); 53063var REACT_PROFILER_TYPE = Symbol.for('react.profiler'); 53064var REACT_PROVIDER_TYPE = Symbol.for('react.provider'); 53065var REACT_CONTEXT_TYPE = Symbol.for('react.context'); 53066var REACT_FORWARD_REF_TYPE = Symbol.for('react.forward_ref'); 53067var REACT_SUSPENSE_TYPE = Symbol.for('react.suspense'); 53068var REACT_SUSPENSE_LIST_TYPE = Symbol.for('react.suspense_list'); 53069var REACT_MEMO_TYPE = Symbol.for('react.memo'); 53070var REACT_LAZY_TYPE = Symbol.for('react.lazy'); 53071var REACT_OFFSCREEN_TYPE = Symbol.for('react.offscreen'); 53072var MAYBE_ITERATOR_SYMBOL = Symbol.iterator; 53073var FAUX_ITERATOR_SYMBOL = '@@iterator'; 53074function getIteratorFn(maybeIterable) { 53075 if (maybeIterable === null || typeof maybeIterable !== 'object') { 53076 return null; 53077 } 53078 53079 var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]; 53080 53081 if (typeof maybeIterator === 'function') { 53082 return maybeIterator; 53083 } 53084 53085 return null; 53086} 53087 53088/** 53089 * Keeps track of the current dispatcher. 53090 */ 53091var ReactCurrentDispatcher = { 53092 /** 53093 * @internal 53094 * @type {ReactComponent} 53095 */ 53096 current: null 53097}; 53098 53099/** 53100 * Keeps track of the current batch's configuration such as how long an update 53101 * should suspend for if it needs to. 53102 */ 53103var ReactCurrentBatchConfig = { 53104 transition: null 53105}; 53106 53107var ReactCurrentActQueue = { 53108 current: null, 53109 // Used to reproduce behavior of `batchedUpdates` in legacy mode. 53110 isBatchingLegacy: false, 53111 didScheduleLegacyUpdate: false 53112}; 53113 53114/** 53115 * Keeps track of the current owner. 53116 * 53117 * The current owner is the component who should own any components that are 53118 * currently being constructed. 53119 */ 53120var ReactCurrentOwner = { 53121 /** 53122 * @internal 53123 * @type {ReactComponent} 53124 */ 53125 current: null 53126}; 53127 53128var ReactDebugCurrentFrame = {}; 53129var currentExtraStackFrame = null; 53130function setExtraStackFrame(stack) { 53131 { 53132 currentExtraStackFrame = stack; 53133 } 53134} 53135 53136{ 53137 ReactDebugCurrentFrame.setExtraStackFrame = function (stack) { 53138 { 53139 currentExtraStackFrame = stack; 53140 } 53141 }; // Stack implementation injected by the current renderer. 53142 53143 53144 ReactDebugCurrentFrame.getCurrentStack = null; 53145 53146 ReactDebugCurrentFrame.getStackAddendum = function () { 53147 var stack = ''; // Add an extra top frame while an element is being validated 53148 53149 if (currentExtraStackFrame) { 53150 stack += currentExtraStackFrame; 53151 } // Delegate to the injected renderer-specific implementation 53152 53153 53154 var impl = ReactDebugCurrentFrame.getCurrentStack; 53155 53156 if (impl) { 53157 stack += impl() || ''; 53158 } 53159 53160 return stack; 53161 }; 53162} 53163 53164// ----------------------------------------------------------------------------- 53165 53166var enableScopeAPI = false; // Experimental Create Event Handle API. 53167var enableCacheElement = false; 53168var enableTransitionTracing = false; // No known bugs, but needs performance testing 53169 53170var enableLegacyHidden = false; // Enables unstable_avoidThisFallback feature in Fiber 53171// stuff. Intended to enable React core members to more easily debug scheduling 53172// issues in DEV builds. 53173 53174var enableDebugTracing = false; // Track which Fiber(s) schedule render work. 53175 53176var ReactSharedInternals = { 53177 ReactCurrentDispatcher: ReactCurrentDispatcher, 53178 ReactCurrentBatchConfig: ReactCurrentBatchConfig, 53179 ReactCurrentOwner: ReactCurrentOwner 53180}; 53181 53182{ 53183 ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame; 53184 ReactSharedInternals.ReactCurrentActQueue = ReactCurrentActQueue; 53185} 53186 53187// by calls to these methods by a Babel plugin. 53188// 53189// In PROD (or in packages without access to React internals), 53190// they are left as they are instead. 53191 53192function warn(format) { 53193 { 53194 { 53195 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 53196 args[_key - 1] = arguments[_key]; 53197 } 53198 53199 printWarning('warn', format, args); 53200 } 53201 } 53202} 53203function error(format) { 53204 { 53205 { 53206 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 53207 args[_key2 - 1] = arguments[_key2]; 53208 } 53209 53210 printWarning('error', format, args); 53211 } 53212 } 53213} 53214 53215function printWarning(level, format, args) { 53216 // When changing this logic, you might want to also 53217 // update consoleWithStackDev.www.js as well. 53218 { 53219 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; 53220 var stack = ReactDebugCurrentFrame.getStackAddendum(); 53221 53222 if (stack !== '') { 53223 format += '%s'; 53224 args = args.concat([stack]); 53225 } // eslint-disable-next-line react-internal/safe-string-coercion 53226 53227 53228 var argsWithFormat = args.map(function (item) { 53229 return String(item); 53230 }); // Careful: RN currently depends on this prefix 53231 53232 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it 53233 // breaks IE9: https://github.com/facebook/react/issues/13610 53234 // eslint-disable-next-line react-internal/no-production-logging 53235 53236 Function.prototype.apply.call(console[level], console, argsWithFormat); 53237 } 53238} 53239 53240var didWarnStateUpdateForUnmountedComponent = {}; 53241 53242function warnNoop(publicInstance, callerName) { 53243 { 53244 var _constructor = publicInstance.constructor; 53245 var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass'; 53246 var warningKey = componentName + "." + callerName; 53247 53248 if (didWarnStateUpdateForUnmountedComponent[warningKey]) { 53249 return; 53250 } 53251 53252 error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName); 53253 53254 didWarnStateUpdateForUnmountedComponent[warningKey] = true; 53255 } 53256} 53257/** 53258 * This is the abstract API for an update queue. 53259 */ 53260 53261 53262var ReactNoopUpdateQueue = { 53263 /** 53264 * Checks whether or not this composite component is mounted. 53265 * @param {ReactClass} publicInstance The instance we want to test. 53266 * @return {boolean} True if mounted, false otherwise. 53267 * @protected 53268 * @final 53269 */ 53270 isMounted: function (publicInstance) { 53271 return false; 53272 }, 53273 53274 /** 53275 * Forces an update. This should only be invoked when it is known with 53276 * certainty that we are **not** in a DOM transaction. 53277 * 53278 * You may want to call this when you know that some deeper aspect of the 53279 * component's state has changed but `setState` was not called. 53280 * 53281 * This will not invoke `shouldComponentUpdate`, but it will invoke 53282 * `componentWillUpdate` and `componentDidUpdate`. 53283 * 53284 * @param {ReactClass} publicInstance The instance that should rerender. 53285 * @param {?function} callback Called after component is updated. 53286 * @param {?string} callerName name of the calling function in the public API. 53287 * @internal 53288 */ 53289 enqueueForceUpdate: function (publicInstance, callback, callerName) { 53290 warnNoop(publicInstance, 'forceUpdate'); 53291 }, 53292 53293 /** 53294 * Replaces all of the state. Always use this or `setState` to mutate state. 53295 * You should treat `this.state` as immutable. 53296 * 53297 * There is no guarantee that `this.state` will be immediately updated, so 53298 * accessing `this.state` after calling this method may return the old value. 53299 * 53300 * @param {ReactClass} publicInstance The instance that should rerender. 53301 * @param {object} completeState Next state. 53302 * @param {?function} callback Called after component is updated. 53303 * @param {?string} callerName name of the calling function in the public API. 53304 * @internal 53305 */ 53306 enqueueReplaceState: function (publicInstance, completeState, callback, callerName) { 53307 warnNoop(publicInstance, 'replaceState'); 53308 }, 53309 53310 /** 53311 * Sets a subset of the state. This only exists because _pendingState is 53312 * internal. This provides a merging strategy that is not available to deep 53313 * properties which is confusing. TODO: Expose pendingState or don't use it 53314 * during the merge. 53315 * 53316 * @param {ReactClass} publicInstance The instance that should rerender. 53317 * @param {object} partialState Next partial state to be merged with state. 53318 * @param {?function} callback Called after component is updated. 53319 * @param {?string} Name of the calling function in the public API. 53320 * @internal 53321 */ 53322 enqueueSetState: function (publicInstance, partialState, callback, callerName) { 53323 warnNoop(publicInstance, 'setState'); 53324 } 53325}; 53326 53327var assign = Object.assign; 53328 53329var emptyObject = {}; 53330 53331{ 53332 Object.freeze(emptyObject); 53333} 53334/** 53335 * Base class helpers for the updating state of a component. 53336 */ 53337 53338 53339function Component(props, context, updater) { 53340 this.props = props; 53341 this.context = context; // If a component has string refs, we will assign a different object later. 53342 53343 this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the 53344 // renderer. 53345 53346 this.updater = updater || ReactNoopUpdateQueue; 53347} 53348 53349Component.prototype.isReactComponent = {}; 53350/** 53351 * Sets a subset of the state. Always use this to mutate 53352 * state. You should treat `this.state` as immutable. 53353 * 53354 * There is no guarantee that `this.state` will be immediately updated, so 53355 * accessing `this.state` after calling this method may return the old value. 53356 * 53357 * There is no guarantee that calls to `setState` will run synchronously, 53358 * as they may eventually be batched together. You can provide an optional 53359 * callback that will be executed when the call to setState is actually 53360 * completed. 53361 * 53362 * When a function is provided to setState, it will be called at some point in 53363 * the future (not synchronously). It will be called with the up to date 53364 * component arguments (state, props, context). These values can be different 53365 * from this.* because your function may be called after receiveProps but before 53366 * shouldComponentUpdate, and this new state, props, and context will not yet be 53367 * assigned to this. 53368 * 53369 * @param {object|function} partialState Next partial state or function to 53370 * produce next partial state to be merged with current state. 53371 * @param {?function} callback Called after state is updated. 53372 * @final 53373 * @protected 53374 */ 53375 53376Component.prototype.setState = function (partialState, callback) { 53377 if (typeof partialState !== 'object' && typeof partialState !== 'function' && partialState != null) { 53378 throw new Error('setState(...): takes an object of state variables to update or a ' + 'function which returns an object of state variables.'); 53379 } 53380 53381 this.updater.enqueueSetState(this, partialState, callback, 'setState'); 53382}; 53383/** 53384 * Forces an update. This should only be invoked when it is known with 53385 * certainty that we are **not** in a DOM transaction. 53386 * 53387 * You may want to call this when you know that some deeper aspect of the 53388 * component's state has changed but `setState` was not called. 53389 * 53390 * This will not invoke `shouldComponentUpdate`, but it will invoke 53391 * `componentWillUpdate` and `componentDidUpdate`. 53392 * 53393 * @param {?function} callback Called after update is complete. 53394 * @final 53395 * @protected 53396 */ 53397 53398 53399Component.prototype.forceUpdate = function (callback) { 53400 this.updater.enqueueForceUpdate(this, callback, 'forceUpdate'); 53401}; 53402/** 53403 * Deprecated APIs. These APIs used to exist on classic React classes but since 53404 * we would like to deprecate them, we're not going to move them over to this 53405 * modern base class. Instead, we define a getter that warns if it's accessed. 53406 */ 53407 53408 53409{ 53410 var deprecatedAPIs = { 53411 isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'], 53412 replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).'] 53413 }; 53414 53415 var defineDeprecationWarning = function (methodName, info) { 53416 Object.defineProperty(Component.prototype, methodName, { 53417 get: function () { 53418 warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]); 53419 53420 return undefined; 53421 } 53422 }); 53423 }; 53424 53425 for (var fnName in deprecatedAPIs) { 53426 if (deprecatedAPIs.hasOwnProperty(fnName)) { 53427 defineDeprecationWarning(fnName, deprecatedAPIs[fnName]); 53428 } 53429 } 53430} 53431 53432function ComponentDummy() {} 53433 53434ComponentDummy.prototype = Component.prototype; 53435/** 53436 * Convenience component with default shallow equality check for sCU. 53437 */ 53438 53439function PureComponent(props, context, updater) { 53440 this.props = props; 53441 this.context = context; // If a component has string refs, we will assign a different object later. 53442 53443 this.refs = emptyObject; 53444 this.updater = updater || ReactNoopUpdateQueue; 53445} 53446 53447var pureComponentPrototype = PureComponent.prototype = new ComponentDummy(); 53448pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods. 53449 53450assign(pureComponentPrototype, Component.prototype); 53451pureComponentPrototype.isPureReactComponent = true; 53452 53453// an immutable object with a single mutable value 53454function createRef() { 53455 var refObject = { 53456 current: null 53457 }; 53458 53459 { 53460 Object.seal(refObject); 53461 } 53462 53463 return refObject; 53464} 53465 53466var isArrayImpl = Array.isArray; // eslint-disable-next-line no-redeclare 53467 53468function isArray(a) { 53469 return isArrayImpl(a); 53470} 53471 53472/* 53473 * The `'' + value` pattern (used in in perf-sensitive code) throws for Symbol 53474 * and Temporal.* types. See https://github.com/facebook/react/pull/22064. 53475 * 53476 * The functions in this module will throw an easier-to-understand, 53477 * easier-to-debug exception with a clear errors message message explaining the 53478 * problem. (Instead of a confusing exception thrown inside the implementation 53479 * of the `value` object). 53480 */ 53481// $FlowFixMe only called in DEV, so void return is not possible. 53482function typeName(value) { 53483 { 53484 // toStringTag is needed for namespaced types like Temporal.Instant 53485 var hasToStringTag = typeof Symbol === 'function' && Symbol.toStringTag; 53486 var type = hasToStringTag && value[Symbol.toStringTag] || value.constructor.name || 'Object'; 53487 return type; 53488 } 53489} // $FlowFixMe only called in DEV, so void return is not possible. 53490 53491 53492function willCoercionThrow(value) { 53493 { 53494 try { 53495 testStringCoercion(value); 53496 return false; 53497 } catch (e) { 53498 return true; 53499 } 53500 } 53501} 53502 53503function testStringCoercion(value) { 53504 // If you ended up here by following an exception call stack, here's what's 53505 // happened: you supplied an object or symbol value to React (as a prop, key, 53506 // DOM attribute, CSS property, string ref, etc.) and when React tried to 53507 // coerce it to a string using `'' + value`, an exception was thrown. 53508 // 53509 // The most common types that will cause this exception are `Symbol` instances 53510 // and Temporal objects like `Temporal.Instant`. But any object that has a 53511 // `valueOf` or `[Symbol.toPrimitive]` method that throws will also cause this 53512 // exception. (Library authors do this to prevent users from using built-in 53513 // numeric operators like `+` or comparison operators like `>=` because custom 53514 // methods are needed to perform accurate arithmetic or comparison.) 53515 // 53516 // To fix the problem, coerce this object or symbol value to a string before 53517 // passing it to React. The most reliable way is usually `String(value)`. 53518 // 53519 // To find which value is throwing, check the browser or debugger console. 53520 // Before this exception was thrown, there should be `console.error` output 53521 // that shows the type (Symbol, Temporal.PlainDate, etc.) that caused the 53522 // problem and how that type was used: key, atrribute, input value prop, etc. 53523 // In most cases, this console output also shows the component and its 53524 // ancestor components where the exception happened. 53525 // 53526 // eslint-disable-next-line react-internal/safe-string-coercion 53527 return '' + value; 53528} 53529function checkKeyStringCoercion(value) { 53530 { 53531 if (willCoercionThrow(value)) { 53532 error('The provided key is an unsupported type %s.' + ' This value must be coerced to a string before before using it here.', typeName(value)); 53533 53534 return testStringCoercion(value); // throw (to help callers find troubleshooting comments) 53535 } 53536 } 53537} 53538 53539function getWrappedName(outerType, innerType, wrapperName) { 53540 var displayName = outerType.displayName; 53541 53542 if (displayName) { 53543 return displayName; 53544 } 53545 53546 var functionName = innerType.displayName || innerType.name || ''; 53547 return functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName; 53548} // Keep in sync with react-reconciler/getComponentNameFromFiber 53549 53550 53551function getContextName(type) { 53552 return type.displayName || 'Context'; 53553} // Note that the reconciler package should generally prefer to use getComponentNameFromFiber() instead. 53554 53555 53556function getComponentNameFromType(type) { 53557 if (type == null) { 53558 // Host root, text node or just invalid type. 53559 return null; 53560 } 53561 53562 { 53563 if (typeof type.tag === 'number') { 53564 error('Received an unexpected object in getComponentNameFromType(). ' + 'This is likely a bug in React. Please file an issue.'); 53565 } 53566 } 53567 53568 if (typeof type === 'function') { 53569 return type.displayName || type.name || null; 53570 } 53571 53572 if (typeof type === 'string') { 53573 return type; 53574 } 53575 53576 switch (type) { 53577 case REACT_FRAGMENT_TYPE: 53578 return 'Fragment'; 53579 53580 case REACT_PORTAL_TYPE: 53581 return 'Portal'; 53582 53583 case REACT_PROFILER_TYPE: 53584 return 'Profiler'; 53585 53586 case REACT_STRICT_MODE_TYPE: 53587 return 'StrictMode'; 53588 53589 case REACT_SUSPENSE_TYPE: 53590 return 'Suspense'; 53591 53592 case REACT_SUSPENSE_LIST_TYPE: 53593 return 'SuspenseList'; 53594 53595 } 53596 53597 if (typeof type === 'object') { 53598 switch (type.$$typeof) { 53599 case REACT_CONTEXT_TYPE: 53600 var context = type; 53601 return getContextName(context) + '.Consumer'; 53602 53603 case REACT_PROVIDER_TYPE: 53604 var provider = type; 53605 return getContextName(provider._context) + '.Provider'; 53606 53607 case REACT_FORWARD_REF_TYPE: 53608 return getWrappedName(type, type.render, 'ForwardRef'); 53609 53610 case REACT_MEMO_TYPE: 53611 var outerName = type.displayName || null; 53612 53613 if (outerName !== null) { 53614 return outerName; 53615 } 53616 53617 return getComponentNameFromType(type.type) || 'Memo'; 53618 53619 case REACT_LAZY_TYPE: 53620 { 53621 var lazyComponent = type; 53622 var payload = lazyComponent._payload; 53623 var init = lazyComponent._init; 53624 53625 try { 53626 return getComponentNameFromType(init(payload)); 53627 } catch (x) { 53628 return null; 53629 } 53630 } 53631 53632 // eslint-disable-next-line no-fallthrough 53633 } 53634 } 53635 53636 return null; 53637} 53638 53639var hasOwnProperty = Object.prototype.hasOwnProperty; 53640 53641var RESERVED_PROPS = { 53642 key: true, 53643 ref: true, 53644 __self: true, 53645 __source: true 53646}; 53647var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs; 53648 53649{ 53650 didWarnAboutStringRefs = {}; 53651} 53652 53653function hasValidRef(config) { 53654 { 53655 if (hasOwnProperty.call(config, 'ref')) { 53656 var getter = Object.getOwnPropertyDescriptor(config, 'ref').get; 53657 53658 if (getter && getter.isReactWarning) { 53659 return false; 53660 } 53661 } 53662 } 53663 53664 return config.ref !== undefined; 53665} 53666 53667function hasValidKey(config) { 53668 { 53669 if (hasOwnProperty.call(config, 'key')) { 53670 var getter = Object.getOwnPropertyDescriptor(config, 'key').get; 53671 53672 if (getter && getter.isReactWarning) { 53673 return false; 53674 } 53675 } 53676 } 53677 53678 return config.key !== undefined; 53679} 53680 53681function defineKeyPropWarningGetter(props, displayName) { 53682 var warnAboutAccessingKey = function () { 53683 { 53684 if (!specialPropKeyWarningShown) { 53685 specialPropKeyWarningShown = true; 53686 53687 error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); 53688 } 53689 } 53690 }; 53691 53692 warnAboutAccessingKey.isReactWarning = true; 53693 Object.defineProperty(props, 'key', { 53694 get: warnAboutAccessingKey, 53695 configurable: true 53696 }); 53697} 53698 53699function defineRefPropWarningGetter(props, displayName) { 53700 var warnAboutAccessingRef = function () { 53701 { 53702 if (!specialPropRefWarningShown) { 53703 specialPropRefWarningShown = true; 53704 53705 error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName); 53706 } 53707 } 53708 }; 53709 53710 warnAboutAccessingRef.isReactWarning = true; 53711 Object.defineProperty(props, 'ref', { 53712 get: warnAboutAccessingRef, 53713 configurable: true 53714 }); 53715} 53716 53717function warnIfStringRefCannotBeAutoConverted(config) { 53718 { 53719 if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) { 53720 var componentName = getComponentNameFromType(ReactCurrentOwner.current.type); 53721 53722 if (!didWarnAboutStringRefs[componentName]) { 53723 error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref); 53724 53725 didWarnAboutStringRefs[componentName] = true; 53726 } 53727 } 53728 } 53729} 53730/** 53731 * Factory method to create a new React element. This no longer adheres to 53732 * the class pattern, so do not use new to call it. Also, instanceof check 53733 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check 53734 * if something is a React Element. 53735 * 53736 * @param {*} type 53737 * @param {*} props 53738 * @param {*} key 53739 * @param {string|object} ref 53740 * @param {*} owner 53741 * @param {*} self A *temporary* helper to detect places where `this` is 53742 * different from the `owner` when React.createElement is called, so that we 53743 * can warn. We want to get rid of owner and replace string `ref`s with arrow 53744 * functions, and as long as `this` and owner are the same, there will be no 53745 * change in behavior. 53746 * @param {*} source An annotation object (added by a transpiler or otherwise) 53747 * indicating filename, line number, and/or other information. 53748 * @internal 53749 */ 53750 53751 53752var ReactElement = function (type, key, ref, self, source, owner, props) { 53753 var element = { 53754 // This tag allows us to uniquely identify this as a React Element 53755 $$typeof: REACT_ELEMENT_TYPE, 53756 // Built-in properties that belong on the element 53757 type: type, 53758 key: key, 53759 ref: ref, 53760 props: props, 53761 // Record the component responsible for creating this element. 53762 _owner: owner 53763 }; 53764 53765 { 53766 // The validation flag is currently mutative. We put it on 53767 // an external backing store so that we can freeze the whole object. 53768 // This can be replaced with a WeakMap once they are implemented in 53769 // commonly used development environments. 53770 element._store = {}; // To make comparing ReactElements easier for testing purposes, we make 53771 // the validation flag non-enumerable (where possible, which should 53772 // include every environment we run tests in), so the test framework 53773 // ignores it. 53774 53775 Object.defineProperty(element._store, 'validated', { 53776 configurable: false, 53777 enumerable: false, 53778 writable: true, 53779 value: false 53780 }); // self and source are DEV only properties. 53781 53782 Object.defineProperty(element, '_self', { 53783 configurable: false, 53784 enumerable: false, 53785 writable: false, 53786 value: self 53787 }); // Two elements created in two different places should be considered 53788 // equal for testing purposes and therefore we hide it from enumeration. 53789 53790 Object.defineProperty(element, '_source', { 53791 configurable: false, 53792 enumerable: false, 53793 writable: false, 53794 value: source 53795 }); 53796 53797 if (Object.freeze) { 53798 Object.freeze(element.props); 53799 Object.freeze(element); 53800 } 53801 } 53802 53803 return element; 53804}; 53805/** 53806 * Create and return a new ReactElement of the given type. 53807 * See https://reactjs.org/docs/react-api.html#createelement 53808 */ 53809 53810function createElement(type, config, children) { 53811 var propName; // Reserved names are extracted 53812 53813 var props = {}; 53814 var key = null; 53815 var ref = null; 53816 var self = null; 53817 var source = null; 53818 53819 if (config != null) { 53820 if (hasValidRef(config)) { 53821 ref = config.ref; 53822 53823 { 53824 warnIfStringRefCannotBeAutoConverted(config); 53825 } 53826 } 53827 53828 if (hasValidKey(config)) { 53829 { 53830 checkKeyStringCoercion(config.key); 53831 } 53832 53833 key = '' + config.key; 53834 } 53835 53836 self = config.__self === undefined ? null : config.__self; 53837 source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object 53838 53839 for (propName in config) { 53840 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { 53841 props[propName] = config[propName]; 53842 } 53843 } 53844 } // Children can be more than one argument, and those are transferred onto 53845 // the newly allocated props object. 53846 53847 53848 var childrenLength = arguments.length - 2; 53849 53850 if (childrenLength === 1) { 53851 props.children = children; 53852 } else if (childrenLength > 1) { 53853 var childArray = Array(childrenLength); 53854 53855 for (var i = 0; i < childrenLength; i++) { 53856 childArray[i] = arguments[i + 2]; 53857 } 53858 53859 { 53860 if (Object.freeze) { 53861 Object.freeze(childArray); 53862 } 53863 } 53864 53865 props.children = childArray; 53866 } // Resolve default props 53867 53868 53869 if (type && type.defaultProps) { 53870 var defaultProps = type.defaultProps; 53871 53872 for (propName in defaultProps) { 53873 if (props[propName] === undefined) { 53874 props[propName] = defaultProps[propName]; 53875 } 53876 } 53877 } 53878 53879 { 53880 if (key || ref) { 53881 var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type; 53882 53883 if (key) { 53884 defineKeyPropWarningGetter(props, displayName); 53885 } 53886 53887 if (ref) { 53888 defineRefPropWarningGetter(props, displayName); 53889 } 53890 } 53891 } 53892 53893 return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props); 53894} 53895function cloneAndReplaceKey(oldElement, newKey) { 53896 var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props); 53897 return newElement; 53898} 53899/** 53900 * Clone and return a new ReactElement using element as the starting point. 53901 * See https://reactjs.org/docs/react-api.html#cloneelement 53902 */ 53903 53904function cloneElement(element, config, children) { 53905 if (element === null || element === undefined) { 53906 throw new Error("React.cloneElement(...): The argument must be a React element, but you passed " + element + "."); 53907 } 53908 53909 var propName; // Original props are copied 53910 53911 var props = assign({}, element.props); // Reserved names are extracted 53912 53913 var key = element.key; 53914 var ref = element.ref; // Self is preserved since the owner is preserved. 53915 53916 var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a 53917 // transpiler, and the original source is probably a better indicator of the 53918 // true owner. 53919 53920 var source = element._source; // Owner will be preserved, unless ref is overridden 53921 53922 var owner = element._owner; 53923 53924 if (config != null) { 53925 if (hasValidRef(config)) { 53926 // Silently steal the ref from the parent. 53927 ref = config.ref; 53928 owner = ReactCurrentOwner.current; 53929 } 53930 53931 if (hasValidKey(config)) { 53932 { 53933 checkKeyStringCoercion(config.key); 53934 } 53935 53936 key = '' + config.key; 53937 } // Remaining properties override existing props 53938 53939 53940 var defaultProps; 53941 53942 if (element.type && element.type.defaultProps) { 53943 defaultProps = element.type.defaultProps; 53944 } 53945 53946 for (propName in config) { 53947 if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) { 53948 if (config[propName] === undefined && defaultProps !== undefined) { 53949 // Resolve default props 53950 props[propName] = defaultProps[propName]; 53951 } else { 53952 props[propName] = config[propName]; 53953 } 53954 } 53955 } 53956 } // Children can be more than one argument, and those are transferred onto 53957 // the newly allocated props object. 53958 53959 53960 var childrenLength = arguments.length - 2; 53961 53962 if (childrenLength === 1) { 53963 props.children = children; 53964 } else if (childrenLength > 1) { 53965 var childArray = Array(childrenLength); 53966 53967 for (var i = 0; i < childrenLength; i++) { 53968 childArray[i] = arguments[i + 2]; 53969 } 53970 53971 props.children = childArray; 53972 } 53973 53974 return ReactElement(element.type, key, ref, self, source, owner, props); 53975} 53976/** 53977 * Verifies the object is a ReactElement. 53978 * See https://reactjs.org/docs/react-api.html#isvalidelement 53979 * @param {?object} object 53980 * @return {boolean} True if `object` is a ReactElement. 53981 * @final 53982 */ 53983 53984function isValidElement(object) { 53985 return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; 53986} 53987 53988var SEPARATOR = '.'; 53989var SUBSEPARATOR = ':'; 53990/** 53991 * Escape and wrap key so it is safe to use as a reactid 53992 * 53993 * @param {string} key to be escaped. 53994 * @return {string} the escaped key. 53995 */ 53996 53997function escape(key) { 53998 var escapeRegex = /[=:]/g; 53999 var escaperLookup = { 54000 '=': '=0', 54001 ':': '=2' 54002 }; 54003 var escapedString = key.replace(escapeRegex, function (match) { 54004 return escaperLookup[match]; 54005 }); 54006 return '$' + escapedString; 54007} 54008/** 54009 * TODO: Test that a single child and an array with one item have the same key 54010 * pattern. 54011 */ 54012 54013 54014var didWarnAboutMaps = false; 54015var userProvidedKeyEscapeRegex = /\/+/g; 54016 54017function escapeUserProvidedKey(text) { 54018 return text.replace(userProvidedKeyEscapeRegex, '$&/'); 54019} 54020/** 54021 * Generate a key string that identifies a element within a set. 54022 * 54023 * @param {*} element A element that could contain a manual key. 54024 * @param {number} index Index that is used if a manual key is not provided. 54025 * @return {string} 54026 */ 54027 54028 54029function getElementKey(element, index) { 54030 // Do some typechecking here since we call this blindly. We want to ensure 54031 // that we don't block potential future ES APIs. 54032 if (typeof element === 'object' && element !== null && element.key != null) { 54033 // Explicit key 54034 { 54035 checkKeyStringCoercion(element.key); 54036 } 54037 54038 return escape('' + element.key); 54039 } // Implicit key determined by the index in the set 54040 54041 54042 return index.toString(36); 54043} 54044 54045function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) { 54046 var type = typeof children; 54047 54048 if (type === 'undefined' || type === 'boolean') { 54049 // All of the above are perceived as null. 54050 children = null; 54051 } 54052 54053 var invokeCallback = false; 54054 54055 if (children === null) { 54056 invokeCallback = true; 54057 } else { 54058 switch (type) { 54059 case 'string': 54060 case 'number': 54061 invokeCallback = true; 54062 break; 54063 54064 case 'object': 54065 switch (children.$$typeof) { 54066 case REACT_ELEMENT_TYPE: 54067 case REACT_PORTAL_TYPE: 54068 invokeCallback = true; 54069 } 54070 54071 } 54072 } 54073 54074 if (invokeCallback) { 54075 var _child = children; 54076 var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array 54077 // so that it's consistent if the number of children grows: 54078 54079 var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar; 54080 54081 if (isArray(mappedChild)) { 54082 var escapedChildKey = ''; 54083 54084 if (childKey != null) { 54085 escapedChildKey = escapeUserProvidedKey(childKey) + '/'; 54086 } 54087 54088 mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) { 54089 return c; 54090 }); 54091 } else if (mappedChild != null) { 54092 if (isValidElement(mappedChild)) { 54093 { 54094 // The `if` statement here prevents auto-disabling of the safe 54095 // coercion ESLint rule, so we must manually disable it below. 54096 // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key 54097 if (mappedChild.key && (!_child || _child.key !== mappedChild.key)) { 54098 checkKeyStringCoercion(mappedChild.key); 54099 } 54100 } 54101 54102 mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as 54103 // traverseAllChildren used to do for objects as children 54104 escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key 54105 mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number 54106 // eslint-disable-next-line react-internal/safe-string-coercion 54107 escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey); 54108 } 54109 54110 array.push(mappedChild); 54111 } 54112 54113 return 1; 54114 } 54115 54116 var child; 54117 var nextName; 54118 var subtreeCount = 0; // Count of children found in the current subtree. 54119 54120 var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR; 54121 54122 if (isArray(children)) { 54123 for (var i = 0; i < children.length; i++) { 54124 child = children[i]; 54125 nextName = nextNamePrefix + getElementKey(child, i); 54126 subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); 54127 } 54128 } else { 54129 var iteratorFn = getIteratorFn(children); 54130 54131 if (typeof iteratorFn === 'function') { 54132 var iterableChildren = children; 54133 54134 { 54135 // Warn about using Maps as children 54136 if (iteratorFn === iterableChildren.entries) { 54137 if (!didWarnAboutMaps) { 54138 warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.'); 54139 } 54140 54141 didWarnAboutMaps = true; 54142 } 54143 } 54144 54145 var iterator = iteratorFn.call(iterableChildren); 54146 var step; 54147 var ii = 0; 54148 54149 while (!(step = iterator.next()).done) { 54150 child = step.value; 54151 nextName = nextNamePrefix + getElementKey(child, ii++); 54152 subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback); 54153 } 54154 } else if (type === 'object') { 54155 // eslint-disable-next-line react-internal/safe-string-coercion 54156 var childrenString = String(children); 54157 throw new Error("Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). " + 'If you meant to render a collection of children, use an array ' + 'instead.'); 54158 } 54159 } 54160 54161 return subtreeCount; 54162} 54163 54164/** 54165 * Maps children that are typically specified as `props.children`. 54166 * 54167 * See https://reactjs.org/docs/react-api.html#reactchildrenmap 54168 * 54169 * The provided mapFunction(child, index) will be called for each 54170 * leaf child. 54171 * 54172 * @param {?*} children Children tree container. 54173 * @param {function(*, int)} func The map function. 54174 * @param {*} context Context for mapFunction. 54175 * @return {object} Object containing the ordered map of results. 54176 */ 54177function mapChildren(children, func, context) { 54178 if (children == null) { 54179 return children; 54180 } 54181 54182 var result = []; 54183 var count = 0; 54184 mapIntoArray(children, result, '', '', function (child) { 54185 return func.call(context, child, count++); 54186 }); 54187 return result; 54188} 54189/** 54190 * Count the number of children that are typically specified as 54191 * `props.children`. 54192 * 54193 * See https://reactjs.org/docs/react-api.html#reactchildrencount 54194 * 54195 * @param {?*} children Children tree container. 54196 * @return {number} The number of children. 54197 */ 54198 54199 54200function countChildren(children) { 54201 var n = 0; 54202 mapChildren(children, function () { 54203 n++; // Don't return anything 54204 }); 54205 return n; 54206} 54207 54208/** 54209 * Iterates through children that are typically specified as `props.children`. 54210 * 54211 * See https://reactjs.org/docs/react-api.html#reactchildrenforeach 54212 * 54213 * The provided forEachFunc(child, index) will be called for each 54214 * leaf child. 54215 * 54216 * @param {?*} children Children tree container. 54217 * @param {function(*, int)} forEachFunc 54218 * @param {*} forEachContext Context for forEachContext. 54219 */ 54220function forEachChildren(children, forEachFunc, forEachContext) { 54221 mapChildren(children, function () { 54222 forEachFunc.apply(this, arguments); // Don't return anything. 54223 }, forEachContext); 54224} 54225/** 54226 * Flatten a children object (typically specified as `props.children`) and 54227 * return an array with appropriately re-keyed children. 54228 * 54229 * See https://reactjs.org/docs/react-api.html#reactchildrentoarray 54230 */ 54231 54232 54233function toArray(children) { 54234 return mapChildren(children, function (child) { 54235 return child; 54236 }) || []; 54237} 54238/** 54239 * Returns the first child in a collection of children and verifies that there 54240 * is only one child in the collection. 54241 * 54242 * See https://reactjs.org/docs/react-api.html#reactchildrenonly 54243 * 54244 * The current implementation of this function assumes that a single child gets 54245 * passed without a wrapper, but the purpose of this helper function is to 54246 * abstract away the particular structure of children. 54247 * 54248 * @param {?object} children Child collection structure. 54249 * @return {ReactElement} The first and only `ReactElement` contained in the 54250 * structure. 54251 */ 54252 54253 54254function onlyChild(children) { 54255 if (!isValidElement(children)) { 54256 throw new Error('React.Children.only expected to receive a single React element child.'); 54257 } 54258 54259 return children; 54260} 54261 54262function createContext(defaultValue) { 54263 // TODO: Second argument used to be an optional `calculateChangedBits` 54264 // function. Warn to reserve for future use? 54265 var context = { 54266 $$typeof: REACT_CONTEXT_TYPE, 54267 // As a workaround to support multiple concurrent renderers, we categorize 54268 // some renderers as primary and others as secondary. We only expect 54269 // there to be two concurrent renderers at most: React Native (primary) and 54270 // Fabric (secondary); React DOM (primary) and React ART (secondary). 54271 // Secondary renderers store their context values on separate fields. 54272 _currentValue: defaultValue, 54273 _currentValue2: defaultValue, 54274 // Used to track how many concurrent renderers this context currently 54275 // supports within in a single renderer. Such as parallel server rendering. 54276 _threadCount: 0, 54277 // These are circular 54278 Provider: null, 54279 Consumer: null, 54280 // Add these to use same hidden class in VM as ServerContext 54281 _defaultValue: null, 54282 _globalName: null 54283 }; 54284 context.Provider = { 54285 $$typeof: REACT_PROVIDER_TYPE, 54286 _context: context 54287 }; 54288 var hasWarnedAboutUsingNestedContextConsumers = false; 54289 var hasWarnedAboutUsingConsumerProvider = false; 54290 var hasWarnedAboutDisplayNameOnConsumer = false; 54291 54292 { 54293 // A separate object, but proxies back to the original context object for 54294 // backwards compatibility. It has a different $$typeof, so we can properly 54295 // warn for the incorrect usage of Context as a Consumer. 54296 var Consumer = { 54297 $$typeof: REACT_CONTEXT_TYPE, 54298 _context: context 54299 }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here 54300 54301 Object.defineProperties(Consumer, { 54302 Provider: { 54303 get: function () { 54304 if (!hasWarnedAboutUsingConsumerProvider) { 54305 hasWarnedAboutUsingConsumerProvider = true; 54306 54307 error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?'); 54308 } 54309 54310 return context.Provider; 54311 }, 54312 set: function (_Provider) { 54313 context.Provider = _Provider; 54314 } 54315 }, 54316 _currentValue: { 54317 get: function () { 54318 return context._currentValue; 54319 }, 54320 set: function (_currentValue) { 54321 context._currentValue = _currentValue; 54322 } 54323 }, 54324 _currentValue2: { 54325 get: function () { 54326 return context._currentValue2; 54327 }, 54328 set: function (_currentValue2) { 54329 context._currentValue2 = _currentValue2; 54330 } 54331 }, 54332 _threadCount: { 54333 get: function () { 54334 return context._threadCount; 54335 }, 54336 set: function (_threadCount) { 54337 context._threadCount = _threadCount; 54338 } 54339 }, 54340 Consumer: { 54341 get: function () { 54342 if (!hasWarnedAboutUsingNestedContextConsumers) { 54343 hasWarnedAboutUsingNestedContextConsumers = true; 54344 54345 error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?'); 54346 } 54347 54348 return context.Consumer; 54349 } 54350 }, 54351 displayName: { 54352 get: function () { 54353 return context.displayName; 54354 }, 54355 set: function (displayName) { 54356 if (!hasWarnedAboutDisplayNameOnConsumer) { 54357 warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName); 54358 54359 hasWarnedAboutDisplayNameOnConsumer = true; 54360 } 54361 } 54362 } 54363 }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty 54364 54365 context.Consumer = Consumer; 54366 } 54367 54368 { 54369 context._currentRenderer = null; 54370 context._currentRenderer2 = null; 54371 } 54372 54373 return context; 54374} 54375 54376var Uninitialized = -1; 54377var Pending = 0; 54378var Resolved = 1; 54379var Rejected = 2; 54380 54381function lazyInitializer(payload) { 54382 if (payload._status === Uninitialized) { 54383 var ctor = payload._result; 54384 var thenable = ctor(); // Transition to the next state. 54385 // This might throw either because it's missing or throws. If so, we treat it 54386 // as still uninitialized and try again next time. Which is the same as what 54387 // happens if the ctor or any wrappers processing the ctor throws. This might 54388 // end up fixing it if the resolution was a concurrency bug. 54389 54390 thenable.then(function (moduleObject) { 54391 if (payload._status === Pending || payload._status === Uninitialized) { 54392 // Transition to the next state. 54393 var resolved = payload; 54394 resolved._status = Resolved; 54395 resolved._result = moduleObject; 54396 } 54397 }, function (error) { 54398 if (payload._status === Pending || payload._status === Uninitialized) { 54399 // Transition to the next state. 54400 var rejected = payload; 54401 rejected._status = Rejected; 54402 rejected._result = error; 54403 } 54404 }); 54405 54406 if (payload._status === Uninitialized) { 54407 // In case, we're still uninitialized, then we're waiting for the thenable 54408 // to resolve. Set it as pending in the meantime. 54409 var pending = payload; 54410 pending._status = Pending; 54411 pending._result = thenable; 54412 } 54413 } 54414 54415 if (payload._status === Resolved) { 54416 var moduleObject = payload._result; 54417 54418 { 54419 if (moduleObject === undefined) { 54420 error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. 54421 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))\n\n" + 'Did you accidentally put curly braces around the import?', moduleObject); 54422 } 54423 } 54424 54425 { 54426 if (!('default' in moduleObject)) { 54427 error('lazy: Expected the result of a dynamic imp' + 'ort() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies. 54428 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject); 54429 } 54430 } 54431 54432 return moduleObject.default; 54433 } else { 54434 throw payload._result; 54435 } 54436} 54437 54438function lazy(ctor) { 54439 var payload = { 54440 // We use these fields to store the result. 54441 _status: Uninitialized, 54442 _result: ctor 54443 }; 54444 var lazyType = { 54445 $$typeof: REACT_LAZY_TYPE, 54446 _payload: payload, 54447 _init: lazyInitializer 54448 }; 54449 54450 { 54451 // In production, this would just set it on the object. 54452 var defaultProps; 54453 var propTypes; // $FlowFixMe 54454 54455 Object.defineProperties(lazyType, { 54456 defaultProps: { 54457 configurable: true, 54458 get: function () { 54459 return defaultProps; 54460 }, 54461 set: function (newDefaultProps) { 54462 error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); 54463 54464 defaultProps = newDefaultProps; // Match production behavior more closely: 54465 // $FlowFixMe 54466 54467 Object.defineProperty(lazyType, 'defaultProps', { 54468 enumerable: true 54469 }); 54470 } 54471 }, 54472 propTypes: { 54473 configurable: true, 54474 get: function () { 54475 return propTypes; 54476 }, 54477 set: function (newPropTypes) { 54478 error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); 54479 54480 propTypes = newPropTypes; // Match production behavior more closely: 54481 // $FlowFixMe 54482 54483 Object.defineProperty(lazyType, 'propTypes', { 54484 enumerable: true 54485 }); 54486 } 54487 } 54488 }); 54489 } 54490 54491 return lazyType; 54492} 54493 54494function forwardRef(render) { 54495 { 54496 if (render != null && render.$$typeof === REACT_MEMO_TYPE) { 54497 error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); 54498 } else if (typeof render !== 'function') { 54499 error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); 54500 } else { 54501 if (render.length !== 0 && render.length !== 2) { 54502 error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); 54503 } 54504 } 54505 54506 if (render != null) { 54507 if (render.defaultProps != null || render.propTypes != null) { 54508 error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); 54509 } 54510 } 54511 } 54512 54513 var elementType = { 54514 $$typeof: REACT_FORWARD_REF_TYPE, 54515 render: render 54516 }; 54517 54518 { 54519 var ownName; 54520 Object.defineProperty(elementType, 'displayName', { 54521 enumerable: false, 54522 configurable: true, 54523 get: function () { 54524 return ownName; 54525 }, 54526 set: function (name) { 54527 ownName = name; // The inner component shouldn't inherit this display name in most cases, 54528 // because the component may be used elsewhere. 54529 // But it's nice for anonymous functions to inherit the name, 54530 // so that our component-stack generation logic will display their frames. 54531 // An anonymous function generally suggests a pattern like: 54532 // React.forwardRef((props, ref) => {...}); 54533 // This kind of inner function is not used elsewhere so the side effect is okay. 54534 54535 if (!render.name && !render.displayName) { 54536 render.displayName = name; 54537 } 54538 } 54539 }); 54540 } 54541 54542 return elementType; 54543} 54544 54545var REACT_MODULE_REFERENCE; 54546 54547{ 54548 REACT_MODULE_REFERENCE = Symbol.for('react.module.reference'); 54549} 54550 54551function isValidElementType(type) { 54552 if (typeof type === 'string' || typeof type === 'function') { 54553 return true; 54554 } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill). 54555 54556 54557 if (type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing ) { 54558 return true; 54559 } 54560 54561 if (typeof type === 'object' && type !== null) { 54562 if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object 54563 // types supported by any Flight configuration anywhere since 54564 // we don't know which Flight build this will end up being used 54565 // with. 54566 type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== undefined) { 54567 return true; 54568 } 54569 } 54570 54571 return false; 54572} 54573 54574function memo(type, compare) { 54575 { 54576 if (!isValidElementType(type)) { 54577 error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type); 54578 } 54579 } 54580 54581 var elementType = { 54582 $$typeof: REACT_MEMO_TYPE, 54583 type: type, 54584 compare: compare === undefined ? null : compare 54585 }; 54586 54587 { 54588 var ownName; 54589 Object.defineProperty(elementType, 'displayName', { 54590 enumerable: false, 54591 configurable: true, 54592 get: function () { 54593 return ownName; 54594 }, 54595 set: function (name) { 54596 ownName = name; // The inner component shouldn't inherit this display name in most cases, 54597 // because the component may be used elsewhere. 54598 // But it's nice for anonymous functions to inherit the name, 54599 // so that our component-stack generation logic will display their frames. 54600 // An anonymous function generally suggests a pattern like: 54601 // React.memo((props) => {...}); 54602 // This kind of inner function is not used elsewhere so the side effect is okay. 54603 54604 if (!type.name && !type.displayName) { 54605 type.displayName = name; 54606 } 54607 } 54608 }); 54609 } 54610 54611 return elementType; 54612} 54613 54614function resolveDispatcher() { 54615 var dispatcher = ReactCurrentDispatcher.current; 54616 54617 { 54618 if (dispatcher === null) { 54619 error('Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for' + ' one of the following reasons:\n' + '1. You might have mismatching versions of React and the renderer (such as React DOM)\n' + '2. You might be breaking the Rules of Hooks\n' + '3. You might have more than one copy of React in the same app\n' + 'See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.'); 54620 } 54621 } // Will result in a null access error if accessed outside render phase. We 54622 // intentionally don't throw our own error because this is in a hot path. 54623 // Also helps ensure this is inlined. 54624 54625 54626 return dispatcher; 54627} 54628function useContext(Context) { 54629 var dispatcher = resolveDispatcher(); 54630 54631 { 54632 // TODO: add a more generic warning for invalid values. 54633 if (Context._context !== undefined) { 54634 var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs 54635 // and nobody should be using this in existing code. 54636 54637 if (realContext.Consumer === Context) { 54638 error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?'); 54639 } else if (realContext.Provider === Context) { 54640 error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?'); 54641 } 54642 } 54643 } 54644 54645 return dispatcher.useContext(Context); 54646} 54647function useState(initialState) { 54648 var dispatcher = resolveDispatcher(); 54649 return dispatcher.useState(initialState); 54650} 54651function useReducer(reducer, initialArg, init) { 54652 var dispatcher = resolveDispatcher(); 54653 return dispatcher.useReducer(reducer, initialArg, init); 54654} 54655function useRef(initialValue) { 54656 var dispatcher = resolveDispatcher(); 54657 return dispatcher.useRef(initialValue); 54658} 54659function useEffect(create, deps) { 54660 var dispatcher = resolveDispatcher(); 54661 return dispatcher.useEffect(create, deps); 54662} 54663function useInsertionEffect(create, deps) { 54664 var dispatcher = resolveDispatcher(); 54665 return dispatcher.useInsertionEffect(create, deps); 54666} 54667function useLayoutEffect(create, deps) { 54668 var dispatcher = resolveDispatcher(); 54669 return dispatcher.useLayoutEffect(create, deps); 54670} 54671function useCallback(callback, deps) { 54672 var dispatcher = resolveDispatcher(); 54673 return dispatcher.useCallback(callback, deps); 54674} 54675function useMemo(create, deps) { 54676 var dispatcher = resolveDispatcher(); 54677 return dispatcher.useMemo(create, deps); 54678} 54679function useImperativeHandle(ref, create, deps) { 54680 var dispatcher = resolveDispatcher(); 54681 return dispatcher.useImperativeHandle(ref, create, deps); 54682} 54683function useDebugValue(value, formatterFn) { 54684 { 54685 var dispatcher = resolveDispatcher(); 54686 return dispatcher.useDebugValue(value, formatterFn); 54687 } 54688} 54689function useTransition() { 54690 var dispatcher = resolveDispatcher(); 54691 return dispatcher.useTransition(); 54692} 54693function useDeferredValue(value) { 54694 var dispatcher = resolveDispatcher(); 54695 return dispatcher.useDeferredValue(value); 54696} 54697function useId() { 54698 var dispatcher = resolveDispatcher(); 54699 return dispatcher.useId(); 54700} 54701function useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) { 54702 var dispatcher = resolveDispatcher(); 54703 return dispatcher.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot); 54704} 54705 54706// Helpers to patch console.logs to avoid logging during side-effect free 54707// replaying on render function. This currently only patches the object 54708// lazily which won't cover if the log function was extracted eagerly. 54709// We could also eagerly patch the method. 54710var disabledDepth = 0; 54711var prevLog; 54712var prevInfo; 54713var prevWarn; 54714var prevError; 54715var prevGroup; 54716var prevGroupCollapsed; 54717var prevGroupEnd; 54718 54719function disabledLog() {} 54720 54721disabledLog.__reactDisabledLog = true; 54722function disableLogs() { 54723 { 54724 if (disabledDepth === 0) { 54725 /* eslint-disable react-internal/no-production-logging */ 54726 prevLog = console.log; 54727 prevInfo = console.info; 54728 prevWarn = console.warn; 54729 prevError = console.error; 54730 prevGroup = console.group; 54731 prevGroupCollapsed = console.groupCollapsed; 54732 prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099 54733 54734 var props = { 54735 configurable: true, 54736 enumerable: true, 54737 value: disabledLog, 54738 writable: true 54739 }; // $FlowFixMe Flow thinks console is immutable. 54740 54741 Object.defineProperties(console, { 54742 info: props, 54743 log: props, 54744 warn: props, 54745 error: props, 54746 group: props, 54747 groupCollapsed: props, 54748 groupEnd: props 54749 }); 54750 /* eslint-enable react-internal/no-production-logging */ 54751 } 54752 54753 disabledDepth++; 54754 } 54755} 54756function reenableLogs() { 54757 { 54758 disabledDepth--; 54759 54760 if (disabledDepth === 0) { 54761 /* eslint-disable react-internal/no-production-logging */ 54762 var props = { 54763 configurable: true, 54764 enumerable: true, 54765 writable: true 54766 }; // $FlowFixMe Flow thinks console is immutable. 54767 54768 Object.defineProperties(console, { 54769 log: assign({}, props, { 54770 value: prevLog 54771 }), 54772 info: assign({}, props, { 54773 value: prevInfo 54774 }), 54775 warn: assign({}, props, { 54776 value: prevWarn 54777 }), 54778 error: assign({}, props, { 54779 value: prevError 54780 }), 54781 group: assign({}, props, { 54782 value: prevGroup 54783 }), 54784 groupCollapsed: assign({}, props, { 54785 value: prevGroupCollapsed 54786 }), 54787 groupEnd: assign({}, props, { 54788 value: prevGroupEnd 54789 }) 54790 }); 54791 /* eslint-enable react-internal/no-production-logging */ 54792 } 54793 54794 if (disabledDepth < 0) { 54795 error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.'); 54796 } 54797 } 54798} 54799 54800var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher; 54801var prefix; 54802function describeBuiltInComponentFrame(name, source, ownerFn) { 54803 { 54804 if (prefix === undefined) { 54805 // Extract the VM specific prefix used by each line. 54806 try { 54807 throw Error(); 54808 } catch (x) { 54809 var match = x.stack.trim().match(/\n( *(at )?)/); 54810 prefix = match && match[1] || ''; 54811 } 54812 } // We use the prefix to ensure our stacks line up with native stack frames. 54813 54814 54815 return '\n' + prefix + name; 54816 } 54817} 54818var reentry = false; 54819var componentFrameCache; 54820 54821{ 54822 var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map; 54823 componentFrameCache = new PossiblyWeakMap(); 54824} 54825 54826function describeNativeComponentFrame(fn, construct) { 54827 // If something asked for a stack inside a fake render, it should get ignored. 54828 if ( !fn || reentry) { 54829 return ''; 54830 } 54831 54832 { 54833 var frame = componentFrameCache.get(fn); 54834 54835 if (frame !== undefined) { 54836 return frame; 54837 } 54838 } 54839 54840 var control; 54841 reentry = true; 54842 var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined. 54843 54844 Error.prepareStackTrace = undefined; 54845 var previousDispatcher; 54846 54847 { 54848 previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function 54849 // for warnings. 54850 54851 ReactCurrentDispatcher$1.current = null; 54852 disableLogs(); 54853 } 54854 54855 try { 54856 // This should throw. 54857 if (construct) { 54858 // Something should be setting the props in the constructor. 54859 var Fake = function () { 54860 throw Error(); 54861 }; // $FlowFixMe 54862 54863 54864 Object.defineProperty(Fake.prototype, 'props', { 54865 set: function () { 54866 // We use a throwing setter instead of frozen or non-writable props 54867 // because that won't throw in a non-strict mode function. 54868 throw Error(); 54869 } 54870 }); 54871 54872 if (typeof Reflect === 'object' && Reflect.construct) { 54873 // We construct a different control for this case to include any extra 54874 // frames added by the construct call. 54875 try { 54876 Reflect.construct(Fake, []); 54877 } catch (x) { 54878 control = x; 54879 } 54880 54881 Reflect.construct(fn, [], Fake); 54882 } else { 54883 try { 54884 Fake.call(); 54885 } catch (x) { 54886 control = x; 54887 } 54888 54889 fn.call(Fake.prototype); 54890 } 54891 } else { 54892 try { 54893 throw Error(); 54894 } catch (x) { 54895 control = x; 54896 } 54897 54898 fn(); 54899 } 54900 } catch (sample) { 54901 // This is inlined manually because closure doesn't do it for us. 54902 if (sample && control && typeof sample.stack === 'string') { 54903 // This extracts the first frame from the sample that isn't also in the control. 54904 // Skipping one frame that we assume is the frame that calls the two. 54905 var sampleLines = sample.stack.split('\n'); 54906 var controlLines = control.stack.split('\n'); 54907 var s = sampleLines.length - 1; 54908 var c = controlLines.length - 1; 54909 54910 while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) { 54911 // We expect at least one stack frame to be shared. 54912 // Typically this will be the root most one. However, stack frames may be 54913 // cut off due to maximum stack limits. In this case, one maybe cut off 54914 // earlier than the other. We assume that the sample is longer or the same 54915 // and there for cut off earlier. So we should find the root most frame in 54916 // the sample somewhere in the control. 54917 c--; 54918 } 54919 54920 for (; s >= 1 && c >= 0; s--, c--) { 54921 // Next we find the first one that isn't the same which should be the 54922 // frame that called our sample function and the control. 54923 if (sampleLines[s] !== controlLines[c]) { 54924 // In V8, the first line is describing the message but other VMs don't. 54925 // If we're about to return the first line, and the control is also on the same 54926 // line, that's a pretty good indicator that our sample threw at same line as 54927 // the control. I.e. before we entered the sample frame. So we ignore this result. 54928 // This can happen if you passed a class to function component, or non-function. 54929 if (s !== 1 || c !== 1) { 54930 do { 54931 s--; 54932 c--; // We may still have similar intermediate frames from the construct call. 54933 // The next one that isn't the same should be our match though. 54934 54935 if (c < 0 || sampleLines[s] !== controlLines[c]) { 54936 // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier. 54937 var _frame = '\n' + sampleLines[s].replace(' at new ', ' at '); // If our component frame is labeled "<anonymous>" 54938 // but we have a user-provided "displayName" 54939 // splice it in to make the stack more readable. 54940 54941 54942 if (fn.displayName && _frame.includes('<anonymous>')) { 54943 _frame = _frame.replace('<anonymous>', fn.displayName); 54944 } 54945 54946 { 54947 if (typeof fn === 'function') { 54948 componentFrameCache.set(fn, _frame); 54949 } 54950 } // Return the line we found. 54951 54952 54953 return _frame; 54954 } 54955 } while (s >= 1 && c >= 0); 54956 } 54957 54958 break; 54959 } 54960 } 54961 } 54962 } finally { 54963 reentry = false; 54964 54965 { 54966 ReactCurrentDispatcher$1.current = previousDispatcher; 54967 reenableLogs(); 54968 } 54969 54970 Error.prepareStackTrace = previousPrepareStackTrace; 54971 } // Fallback to just using the name if we couldn't make it throw. 54972 54973 54974 var name = fn ? fn.displayName || fn.name : ''; 54975 var syntheticFrame = name ? describeBuiltInComponentFrame(name) : ''; 54976 54977 { 54978 if (typeof fn === 'function') { 54979 componentFrameCache.set(fn, syntheticFrame); 54980 } 54981 } 54982 54983 return syntheticFrame; 54984} 54985function describeFunctionComponentFrame(fn, source, ownerFn) { 54986 { 54987 return describeNativeComponentFrame(fn, false); 54988 } 54989} 54990 54991function shouldConstruct(Component) { 54992 var prototype = Component.prototype; 54993 return !!(prototype && prototype.isReactComponent); 54994} 54995 54996function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) { 54997 54998 if (type == null) { 54999 return ''; 55000 } 55001 55002 if (typeof type === 'function') { 55003 { 55004 return describeNativeComponentFrame(type, shouldConstruct(type)); 55005 } 55006 } 55007 55008 if (typeof type === 'string') { 55009 return describeBuiltInComponentFrame(type); 55010 } 55011 55012 switch (type) { 55013 case REACT_SUSPENSE_TYPE: 55014 return describeBuiltInComponentFrame('Suspense'); 55015 55016 case REACT_SUSPENSE_LIST_TYPE: 55017 return describeBuiltInComponentFrame('SuspenseList'); 55018 } 55019 55020 if (typeof type === 'object') { 55021 switch (type.$$typeof) { 55022 case REACT_FORWARD_REF_TYPE: 55023 return describeFunctionComponentFrame(type.render); 55024 55025 case REACT_MEMO_TYPE: 55026 // Memo may contain any component type so we recursively resolve it. 55027 return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn); 55028 55029 case REACT_LAZY_TYPE: 55030 { 55031 var lazyComponent = type; 55032 var payload = lazyComponent._payload; 55033 var init = lazyComponent._init; 55034 55035 try { 55036 // Lazy may contain any component type so we recursively resolve it. 55037 return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn); 55038 } catch (x) {} 55039 } 55040 } 55041 } 55042 55043 return ''; 55044} 55045 55046var loggedTypeFailures = {}; 55047var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame; 55048 55049function setCurrentlyValidatingElement(element) { 55050 { 55051 if (element) { 55052 var owner = element._owner; 55053 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); 55054 ReactDebugCurrentFrame$1.setExtraStackFrame(stack); 55055 } else { 55056 ReactDebugCurrentFrame$1.setExtraStackFrame(null); 55057 } 55058 } 55059} 55060 55061function checkPropTypes(typeSpecs, values, location, componentName, element) { 55062 { 55063 // $FlowFixMe This is okay but Flow doesn't know it. 55064 var has = Function.call.bind(hasOwnProperty); 55065 55066 for (var typeSpecName in typeSpecs) { 55067 if (has(typeSpecs, typeSpecName)) { 55068 var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to 55069 // fail the render phase where it didn't fail before. So we log it. 55070 // After these have been cleaned up, we'll let them throw. 55071 55072 try { 55073 // This is intentionally an invariant that gets caught. It's the same 55074 // behavior as without this statement except with a better message. 55075 if (typeof typeSpecs[typeSpecName] !== 'function') { 55076 // eslint-disable-next-line react-internal/prod-error-codes 55077 var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'); 55078 err.name = 'Invariant Violation'; 55079 throw err; 55080 } 55081 55082 error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED'); 55083 } catch (ex) { 55084 error$1 = ex; 55085 } 55086 55087 if (error$1 && !(error$1 instanceof Error)) { 55088 setCurrentlyValidatingElement(element); 55089 55090 error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1); 55091 55092 setCurrentlyValidatingElement(null); 55093 } 55094 55095 if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) { 55096 // Only monitor this failure once because there tends to be a lot of the 55097 // same error. 55098 loggedTypeFailures[error$1.message] = true; 55099 setCurrentlyValidatingElement(element); 55100 55101 error('Failed %s type: %s', location, error$1.message); 55102 55103 setCurrentlyValidatingElement(null); 55104 } 55105 } 55106 } 55107 } 55108} 55109 55110function setCurrentlyValidatingElement$1(element) { 55111 { 55112 if (element) { 55113 var owner = element._owner; 55114 var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null); 55115 setExtraStackFrame(stack); 55116 } else { 55117 setExtraStackFrame(null); 55118 } 55119 } 55120} 55121 55122var propTypesMisspellWarningShown; 55123 55124{ 55125 propTypesMisspellWarningShown = false; 55126} 55127 55128function getDeclarationErrorAddendum() { 55129 if (ReactCurrentOwner.current) { 55130 var name = getComponentNameFromType(ReactCurrentOwner.current.type); 55131 55132 if (name) { 55133 return '\n\nCheck the render method of `' + name + '`.'; 55134 } 55135 } 55136 55137 return ''; 55138} 55139 55140function getSourceInfoErrorAddendum(source) { 55141 if (source !== undefined) { 55142 var fileName = source.fileName.replace(/^.*[\\\/]/, ''); 55143 var lineNumber = source.lineNumber; 55144 return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.'; 55145 } 55146 55147 return ''; 55148} 55149 55150function getSourceInfoErrorAddendumForProps(elementProps) { 55151 if (elementProps !== null && elementProps !== undefined) { 55152 return getSourceInfoErrorAddendum(elementProps.__source); 55153 } 55154 55155 return ''; 55156} 55157/** 55158 * Warn if there's no key explicitly set on dynamic arrays of children or 55159 * object keys are not valid. This allows us to keep track of children between 55160 * updates. 55161 */ 55162 55163 55164var ownerHasKeyUseWarning = {}; 55165 55166function getCurrentComponentErrorInfo(parentType) { 55167 var info = getDeclarationErrorAddendum(); 55168 55169 if (!info) { 55170 var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name; 55171 55172 if (parentName) { 55173 info = "\n\nCheck the top-level render call using <" + parentName + ">."; 55174 } 55175 } 55176 55177 return info; 55178} 55179/** 55180 * Warn if the element doesn't have an explicit key assigned to it. 55181 * This element is in an array. The array could grow and shrink or be 55182 * reordered. All children that haven't already been validated are required to 55183 * have a "key" property assigned to it. Error statuses are cached so a warning 55184 * will only be shown once. 55185 * 55186 * @internal 55187 * @param {ReactElement} element Element that requires a key. 55188 * @param {*} parentType element's parent's type. 55189 */ 55190 55191 55192function validateExplicitKey(element, parentType) { 55193 if (!element._store || element._store.validated || element.key != null) { 55194 return; 55195 } 55196 55197 element._store.validated = true; 55198 var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType); 55199 55200 if (ownerHasKeyUseWarning[currentComponentErrorInfo]) { 55201 return; 55202 } 55203 55204 ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a 55205 // property, it may be the creator of the child that's responsible for 55206 // assigning it a key. 55207 55208 var childOwner = ''; 55209 55210 if (element && element._owner && element._owner !== ReactCurrentOwner.current) { 55211 // Give the component that originally created this child. 55212 childOwner = " It was passed a child from " + getComponentNameFromType(element._owner.type) + "."; 55213 } 55214 55215 { 55216 setCurrentlyValidatingElement$1(element); 55217 55218 error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner); 55219 55220 setCurrentlyValidatingElement$1(null); 55221 } 55222} 55223/** 55224 * Ensure that every element either is passed in a static location, in an 55225 * array with an explicit keys property defined, or in an object literal 55226 * with valid key property. 55227 * 55228 * @internal 55229 * @param {ReactNode} node Statically passed child of any type. 55230 * @param {*} parentType node's parent's type. 55231 */ 55232 55233 55234function validateChildKeys(node, parentType) { 55235 if (typeof node !== 'object') { 55236 return; 55237 } 55238 55239 if (isArray(node)) { 55240 for (var i = 0; i < node.length; i++) { 55241 var child = node[i]; 55242 55243 if (isValidElement(child)) { 55244 validateExplicitKey(child, parentType); 55245 } 55246 } 55247 } else if (isValidElement(node)) { 55248 // This element was passed in a valid location. 55249 if (node._store) { 55250 node._store.validated = true; 55251 } 55252 } else if (node) { 55253 var iteratorFn = getIteratorFn(node); 55254 55255 if (typeof iteratorFn === 'function') { 55256 // Entry iterators used to provide implicit keys, 55257 // but now we print a separate warning for them later. 55258 if (iteratorFn !== node.entries) { 55259 var iterator = iteratorFn.call(node); 55260 var step; 55261 55262 while (!(step = iterator.next()).done) { 55263 if (isValidElement(step.value)) { 55264 validateExplicitKey(step.value, parentType); 55265 } 55266 } 55267 } 55268 } 55269 } 55270} 55271/** 55272 * Given an element, validate that its props follow the propTypes definition, 55273 * provided by the type. 55274 * 55275 * @param {ReactElement} element 55276 */ 55277 55278 55279function validatePropTypes(element) { 55280 { 55281 var type = element.type; 55282 55283 if (type === null || type === undefined || typeof type === 'string') { 55284 return; 55285 } 55286 55287 var propTypes; 55288 55289 if (typeof type === 'function') { 55290 propTypes = type.propTypes; 55291 } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here. 55292 // Inner props are checked in the reconciler. 55293 type.$$typeof === REACT_MEMO_TYPE)) { 55294 propTypes = type.propTypes; 55295 } else { 55296 return; 55297 } 55298 55299 if (propTypes) { 55300 // Intentionally inside to avoid triggering lazy initializers: 55301 var name = getComponentNameFromType(type); 55302 checkPropTypes(propTypes, element.props, 'prop', name, element); 55303 } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) { 55304 propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers: 55305 55306 var _name = getComponentNameFromType(type); 55307 55308 error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown'); 55309 } 55310 55311 if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) { 55312 error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.'); 55313 } 55314 } 55315} 55316/** 55317 * Given a fragment, validate that it can only be provided with fragment props 55318 * @param {ReactElement} fragment 55319 */ 55320 55321 55322function validateFragmentProps(fragment) { 55323 { 55324 var keys = Object.keys(fragment.props); 55325 55326 for (var i = 0; i < keys.length; i++) { 55327 var key = keys[i]; 55328 55329 if (key !== 'children' && key !== 'key') { 55330 setCurrentlyValidatingElement$1(fragment); 55331 55332 error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key); 55333 55334 setCurrentlyValidatingElement$1(null); 55335 break; 55336 } 55337 } 55338 55339 if (fragment.ref !== null) { 55340 setCurrentlyValidatingElement$1(fragment); 55341 55342 error('Invalid attribute `ref` supplied to `React.Fragment`.'); 55343 55344 setCurrentlyValidatingElement$1(null); 55345 } 55346 } 55347} 55348function createElementWithValidation(type, props, children) { 55349 var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to 55350 // succeed and there will likely be errors in render. 55351 55352 if (!validType) { 55353 var info = ''; 55354 55355 if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) { 55356 info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports."; 55357 } 55358 55359 var sourceInfo = getSourceInfoErrorAddendumForProps(props); 55360 55361 if (sourceInfo) { 55362 info += sourceInfo; 55363 } else { 55364 info += getDeclarationErrorAddendum(); 55365 } 55366 55367 var typeString; 55368 55369 if (type === null) { 55370 typeString = 'null'; 55371 } else if (isArray(type)) { 55372 typeString = 'array'; 55373 } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) { 55374 typeString = "<" + (getComponentNameFromType(type.type) || 'Unknown') + " />"; 55375 info = ' Did you accidentally export a JSX literal instead of a component?'; 55376 } else { 55377 typeString = typeof type; 55378 } 55379 55380 { 55381 error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info); 55382 } 55383 } 55384 55385 var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used. 55386 // TODO: Drop this when these are no longer allowed as the type argument. 55387 55388 if (element == null) { 55389 return element; 55390 } // Skip key warning if the type isn't valid since our key validation logic 55391 // doesn't expect a non-string/function type and can throw confusing errors. 55392 // We don't want exception behavior to differ between dev and prod. 55393 // (Rendering will throw with a helpful message and as soon as the type is 55394 // fixed, the key warnings will appear.) 55395 55396 55397 if (validType) { 55398 for (var i = 2; i < arguments.length; i++) { 55399 validateChildKeys(arguments[i], type); 55400 } 55401 } 55402 55403 if (type === REACT_FRAGMENT_TYPE) { 55404 validateFragmentProps(element); 55405 } else { 55406 validatePropTypes(element); 55407 } 55408 55409 return element; 55410} 55411var didWarnAboutDeprecatedCreateFactory = false; 55412function createFactoryWithValidation(type) { 55413 var validatedFactory = createElementWithValidation.bind(null, type); 55414 validatedFactory.type = type; 55415 55416 { 55417 if (!didWarnAboutDeprecatedCreateFactory) { 55418 didWarnAboutDeprecatedCreateFactory = true; 55419 55420 warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.'); 55421 } // Legacy hook: remove it 55422 55423 55424 Object.defineProperty(validatedFactory, 'type', { 55425 enumerable: false, 55426 get: function () { 55427 warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.'); 55428 55429 Object.defineProperty(this, 'type', { 55430 value: type 55431 }); 55432 return type; 55433 } 55434 }); 55435 } 55436 55437 return validatedFactory; 55438} 55439function cloneElementWithValidation(element, props, children) { 55440 var newElement = cloneElement.apply(this, arguments); 55441 55442 for (var i = 2; i < arguments.length; i++) { 55443 validateChildKeys(arguments[i], newElement.type); 55444 } 55445 55446 validatePropTypes(newElement); 55447 return newElement; 55448} 55449 55450function startTransition(scope, options) { 55451 var prevTransition = ReactCurrentBatchConfig.transition; 55452 ReactCurrentBatchConfig.transition = {}; 55453 var currentTransition = ReactCurrentBatchConfig.transition; 55454 55455 { 55456 ReactCurrentBatchConfig.transition._updatedFibers = new Set(); 55457 } 55458 55459 try { 55460 scope(); 55461 } finally { 55462 ReactCurrentBatchConfig.transition = prevTransition; 55463 55464 { 55465 if (prevTransition === null && currentTransition._updatedFibers) { 55466 var updatedFibersCount = currentTransition._updatedFibers.size; 55467 55468 if (updatedFibersCount > 10) { 55469 warn('Detected a large number of updates inside startTransition. ' + 'If this is due to a subscription please re-write it to use React provided hooks. ' + 'Otherwise concurrent mode guarantees are off the table.'); 55470 } 55471 55472 currentTransition._updatedFibers.clear(); 55473 } 55474 } 55475 } 55476} 55477 55478var didWarnAboutMessageChannel = false; 55479var enqueueTaskImpl = null; 55480function enqueueTask(task) { 55481 if (enqueueTaskImpl === null) { 55482 try { 55483 // read require off the module object to get around the bundlers. 55484 // we don't want them to detect a require and bundle a Node polyfill. 55485 var requireString = ('require' + Math.random()).slice(0, 7); 55486 var nodeRequire = module && module[requireString]; // assuming we're in node, let's try to get node's 55487 // version of setImmediate, bypassing fake timers if any. 55488 55489 enqueueTaskImpl = nodeRequire.call(module, 'timers').setImmediate; 55490 } catch (_err) { 55491 // we're in a browser 55492 // we can't use regular timers because they may still be faked 55493 // so we try MessageChannel+postMessage instead 55494 enqueueTaskImpl = function (callback) { 55495 { 55496 if (didWarnAboutMessageChannel === false) { 55497 didWarnAboutMessageChannel = true; 55498 55499 if (typeof MessageChannel === 'undefined') { 55500 error('This browser does not have a MessageChannel implementation, ' + 'so enqueuing tasks via await act(async () => ...) will fail. ' + 'Please file an issue at https://github.com/facebook/react/issues ' + 'if you encounter this warning.'); 55501 } 55502 } 55503 } 55504 55505 var channel = new MessageChannel(); 55506 channel.port1.onmessage = callback; 55507 channel.port2.postMessage(undefined); 55508 }; 55509 } 55510 } 55511 55512 return enqueueTaskImpl(task); 55513} 55514 55515var actScopeDepth = 0; 55516var didWarnNoAwaitAct = false; 55517function act(callback) { 55518 { 55519 // `act` calls can be nested, so we track the depth. This represents the 55520 // number of `act` scopes on the stack. 55521 var prevActScopeDepth = actScopeDepth; 55522 actScopeDepth++; 55523 55524 if (ReactCurrentActQueue.current === null) { 55525 // This is the outermost `act` scope. Initialize the queue. The reconciler 55526 // will detect the queue and use it instead of Scheduler. 55527 ReactCurrentActQueue.current = []; 55528 } 55529 55530 var prevIsBatchingLegacy = ReactCurrentActQueue.isBatchingLegacy; 55531 var result; 55532 55533 try { 55534 // Used to reproduce behavior of `batchedUpdates` in legacy mode. Only 55535 // set to `true` while the given callback is executed, not for updates 55536 // triggered during an async event, because this is how the legacy 55537 // implementation of `act` behaved. 55538 ReactCurrentActQueue.isBatchingLegacy = true; 55539 result = callback(); // Replicate behavior of original `act` implementation in legacy mode, 55540 // which flushed updates immediately after the scope function exits, even 55541 // if it's an async function. 55542 55543 if (!prevIsBatchingLegacy && ReactCurrentActQueue.didScheduleLegacyUpdate) { 55544 var queue = ReactCurrentActQueue.current; 55545 55546 if (queue !== null) { 55547 ReactCurrentActQueue.didScheduleLegacyUpdate = false; 55548 flushActQueue(queue); 55549 } 55550 } 55551 } catch (error) { 55552 popActScope(prevActScopeDepth); 55553 throw error; 55554 } finally { 55555 ReactCurrentActQueue.isBatchingLegacy = prevIsBatchingLegacy; 55556 } 55557 55558 if (result !== null && typeof result === 'object' && typeof result.then === 'function') { 55559 var thenableResult = result; // The callback is an async function (i.e. returned a promise). Wait 55560 // for it to resolve before exiting the current scope. 55561 55562 var wasAwaited = false; 55563 var thenable = { 55564 then: function (resolve, reject) { 55565 wasAwaited = true; 55566 thenableResult.then(function (returnValue) { 55567 popActScope(prevActScopeDepth); 55568 55569 if (actScopeDepth === 0) { 55570 // We've exited the outermost act scope. Recursively flush the 55571 // queue until there's no remaining work. 55572 recursivelyFlushAsyncActWork(returnValue, resolve, reject); 55573 } else { 55574 resolve(returnValue); 55575 } 55576 }, function (error) { 55577 // The callback threw an error. 55578 popActScope(prevActScopeDepth); 55579 reject(error); 55580 }); 55581 } 55582 }; 55583 55584 { 55585 if (!didWarnNoAwaitAct && typeof Promise !== 'undefined') { 55586 // eslint-disable-next-line no-undef 55587 Promise.resolve().then(function () {}).then(function () { 55588 if (!wasAwaited) { 55589 didWarnNoAwaitAct = true; 55590 55591 error('You called act(async () => ...) without await. ' + 'This could lead to unexpected testing behaviour, ' + 'interleaving multiple act calls and mixing their ' + 'scopes. ' + 'You should - await act(async () => ...);'); 55592 } 55593 }); 55594 } 55595 } 55596 55597 return thenable; 55598 } else { 55599 var returnValue = result; // The callback is not an async function. Exit the current scope 55600 // immediately, without awaiting. 55601 55602 popActScope(prevActScopeDepth); 55603 55604 if (actScopeDepth === 0) { 55605 // Exiting the outermost act scope. Flush the queue. 55606 var _queue = ReactCurrentActQueue.current; 55607 55608 if (_queue !== null) { 55609 flushActQueue(_queue); 55610 ReactCurrentActQueue.current = null; 55611 } // Return a thenable. If the user awaits it, we'll flush again in 55612 // case additional work was scheduled by a microtask. 55613 55614 55615 var _thenable = { 55616 then: function (resolve, reject) { 55617 // Confirm we haven't re-entered another `act` scope, in case 55618 // the user does something weird like await the thenable 55619 // multiple times. 55620 if (ReactCurrentActQueue.current === null) { 55621 // Recursively flush the queue until there's no remaining work. 55622 ReactCurrentActQueue.current = []; 55623 recursivelyFlushAsyncActWork(returnValue, resolve, reject); 55624 } else { 55625 resolve(returnValue); 55626 } 55627 } 55628 }; 55629 return _thenable; 55630 } else { 55631 // Since we're inside a nested `act` scope, the returned thenable 55632 // immediately resolves. The outer scope will flush the queue. 55633 var _thenable2 = { 55634 then: function (resolve, reject) { 55635 resolve(returnValue); 55636 } 55637 }; 55638 return _thenable2; 55639 } 55640 } 55641 } 55642} 55643 55644function popActScope(prevActScopeDepth) { 55645 { 55646 if (prevActScopeDepth !== actScopeDepth - 1) { 55647 error('You seem to have overlapping act() calls, this is not supported. ' + 'Be sure to await previous act() calls before making a new one. '); 55648 } 55649 55650 actScopeDepth = prevActScopeDepth; 55651 } 55652} 55653 55654function recursivelyFlushAsyncActWork(returnValue, resolve, reject) { 55655 { 55656 var queue = ReactCurrentActQueue.current; 55657 55658 if (queue !== null) { 55659 try { 55660 flushActQueue(queue); 55661 enqueueTask(function () { 55662 if (queue.length === 0) { 55663 // No additional work was scheduled. Finish. 55664 ReactCurrentActQueue.current = null; 55665 resolve(returnValue); 55666 } else { 55667 // Keep flushing work until there's none left. 55668 recursivelyFlushAsyncActWork(returnValue, resolve, reject); 55669 } 55670 }); 55671 } catch (error) { 55672 reject(error); 55673 } 55674 } else { 55675 resolve(returnValue); 55676 } 55677 } 55678} 55679 55680var isFlushing = false; 55681 55682function flushActQueue(queue) { 55683 { 55684 if (!isFlushing) { 55685 // Prevent re-entrance. 55686 isFlushing = true; 55687 var i = 0; 55688 55689 try { 55690 for (; i < queue.length; i++) { 55691 var callback = queue[i]; 55692 55693 do { 55694 callback = callback(true); 55695 } while (callback !== null); 55696 } 55697 55698 queue.length = 0; 55699 } catch (error) { 55700 // If something throws, leave the remaining callbacks on the queue. 55701 queue = queue.slice(i + 1); 55702 throw error; 55703 } finally { 55704 isFlushing = false; 55705 } 55706 } 55707 } 55708} 55709 55710var createElement$1 = createElementWithValidation ; 55711var cloneElement$1 = cloneElementWithValidation ; 55712var createFactory = createFactoryWithValidation ; 55713var Children = { 55714 map: mapChildren, 55715 forEach: forEachChildren, 55716 count: countChildren, 55717 toArray: toArray, 55718 only: onlyChild 55719}; 55720 55721exports.Children = Children; 55722exports.Component = Component; 55723exports.Fragment = REACT_FRAGMENT_TYPE; 55724exports.Profiler = REACT_PROFILER_TYPE; 55725exports.PureComponent = PureComponent; 55726exports.StrictMode = REACT_STRICT_MODE_TYPE; 55727exports.Suspense = REACT_SUSPENSE_TYPE; 55728exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals; 55729exports.act = act; 55730exports.cloneElement = cloneElement$1; 55731exports.createContext = createContext; 55732exports.createElement = createElement$1; 55733exports.createFactory = createFactory; 55734exports.createRef = createRef; 55735exports.forwardRef = forwardRef; 55736exports.isValidElement = isValidElement; 55737exports.lazy = lazy; 55738exports.memo = memo; 55739exports.startTransition = startTransition; 55740exports.unstable_act = act; 55741exports.useCallback = useCallback; 55742exports.useContext = useContext; 55743exports.useDebugValue = useDebugValue; 55744exports.useDeferredValue = useDeferredValue; 55745exports.useEffect = useEffect; 55746exports.useId = useId; 55747exports.useImperativeHandle = useImperativeHandle; 55748exports.useInsertionEffect = useInsertionEffect; 55749exports.useLayoutEffect = useLayoutEffect; 55750exports.useMemo = useMemo; 55751exports.useReducer = useReducer; 55752exports.useRef = useRef; 55753exports.useState = useState; 55754exports.useSyncExternalStore = useSyncExternalStore; 55755exports.useTransition = useTransition; 55756exports.version = ReactVersion; 55757 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 55758if ( 55759 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 55760 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === 55761 'function' 55762) { 55763 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); 55764} 55765 55766 })(); 55767} 55768 55769 55770/***/ }), 55771
vendor: 411 bytes, lines 55772-55787
55772/***/ "./node_modules/react/index.js": 55773/*!*************************************!*\ 55774 !*** ./node_modules/react/index.js ***! 55775 \*************************************/ 55776/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 55777 55778"use strict"; 55779 55780 55781if (false) {} else { 55782 module.exports = __webpack_require__(/*! ./cjs/react.development.js */ "./node_modules/react/cjs/react.development.js"); 55783} 55784 55785 55786/***/ }), 55787
vendor: 459 bytes, lines 55788-55803
55788/***/ "./node_modules/react/jsx-runtime.js": 55789/*!*******************************************!*\ 55790 !*** ./node_modules/react/jsx-runtime.js ***! 55791 \*******************************************/ 55792/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 55793 55794"use strict"; 55795 55796 55797if (false) {} else { 55798 module.exports = __webpack_require__(/*! ./cjs/react-jsx-runtime.development.js */ "./node_modules/react/cjs/react-jsx-runtime.development.js"); 55799} 55800 55801 55802/***/ }), 55803
vendor: 1,870 bytes, lines 55804-55849
55804/***/ "./node_modules/redux-thunk/es/index.js": 55805/*!**********************************************!*\ 55806 !*** ./node_modules/redux-thunk/es/index.js ***! 55807 \**********************************************/ 55808/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 55809 55810"use strict"; 55811__webpack_require__.r(__webpack_exports__); 55812/* harmony export */ __webpack_require__.d(__webpack_exports__, { 55813/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 55814/* harmony export */ }); 55815/** A function that accepts a potential "extra argument" value to be injected later, 55816 * and returns an instance of the thunk middleware that uses that value 55817 */ 55818function createThunkMiddleware(extraArgument) { 55819 // Standard Redux middleware definition pattern: 55820 // See: https://redux.js.org/tutorials/fundamentals/part-4-store#writing-custom-middleware 55821 var middleware = function middleware(_ref) { 55822 var dispatch = _ref.dispatch, 55823 getState = _ref.getState; 55824 return function (next) { 55825 return function (action) { 55826 // The thunk middleware looks for any functions that were passed to `store.dispatch`. 55827 // If this "action" is really a function, call it and return the result. 55828 if (typeof action === 'function') { 55829 // Inject the store's `dispatch` and `getState` methods, as well as any "extra arg" 55830 return action(dispatch, getState, extraArgument); 55831 } // Otherwise, pass the action down the middleware chain as usual 55832 55833 55834 return next(action); 55835 }; 55836 }; 55837 }; 55838 55839 return middleware; 55840} 55841 55842var thunk = createThunkMiddleware(); // Attach the factory function so users can create a customized version 55843// with whatever "extra arg" they want to inject into their thunks 55844 55845thunk.withExtraArgument = createThunkMiddleware; 55846/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (thunk); 55847 55848/***/ }), 55849
vendor: 27,324 bytes, lines 55850-56576
55850/***/ "./node_modules/redux/es/redux.js": 55851/*!****************************************!*\ 55852 !*** ./node_modules/redux/es/redux.js ***! 55853 \****************************************/ 55854/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 55855 55856"use strict"; 55857__webpack_require__.r(__webpack_exports__); 55858/* harmony export */ __webpack_require__.d(__webpack_exports__, { 55859/* harmony export */ __DO_NOT_USE__ActionTypes: () => (/* binding */ ActionTypes), 55860/* harmony export */ applyMiddleware: () => (/* binding */ applyMiddleware), 55861/* harmony export */ bindActionCreators: () => (/* binding */ bindActionCreators), 55862/* harmony export */ combineReducers: () => (/* binding */ combineReducers), 55863/* harmony export */ compose: () => (/* binding */ compose), 55864/* harmony export */ createStore: () => (/* binding */ createStore), 55865/* harmony export */ legacy_createStore: () => (/* binding */ legacy_createStore) 55866/* harmony export */ }); 55867/* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js"); 55868 55869 55870/** 55871 * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js 55872 * 55873 * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes 55874 * during build. 55875 * @param {number} code 55876 */ 55877function formatProdErrorMessage(code) { 55878 return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. '; 55879} 55880 55881// Inlined version of the `symbol-observable` polyfill 55882var $$observable = (function () { 55883 return typeof Symbol === 'function' && Symbol.observable || '@@observable'; 55884})(); 55885 55886/** 55887 * These are private action types reserved by Redux. 55888 * For any unknown actions, you must return the current state. 55889 * If the current state is undefined, you must return the initial state. 55890 * Do not reference these action types directly in your code. 55891 */ 55892var randomString = function randomString() { 55893 return Math.random().toString(36).substring(7).split('').join('.'); 55894}; 55895 55896var ActionTypes = { 55897 INIT: "@@redux/INIT" + randomString(), 55898 REPLACE: "@@redux/REPLACE" + randomString(), 55899 PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() { 55900 return "@@redux/PROBE_UNKNOWN_ACTION" + randomString(); 55901 } 55902}; 55903 55904/** 55905 * @param {any} obj The object to inspect. 55906 * @returns {boolean} True if the argument appears to be a plain object. 55907 */ 55908function isPlainObject(obj) { 55909 if (typeof obj !== 'object' || obj === null) return false; 55910 var proto = obj; 55911 55912 while (Object.getPrototypeOf(proto) !== null) { 55913 proto = Object.getPrototypeOf(proto); 55914 } 55915 55916 return Object.getPrototypeOf(obj) === proto; 55917} 55918 55919// Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of 55920function miniKindOf(val) { 55921 if (val === void 0) return 'undefined'; 55922 if (val === null) return 'null'; 55923 var type = typeof val; 55924 55925 switch (type) { 55926 case 'boolean': 55927 case 'string': 55928 case 'number': 55929 case 'symbol': 55930 case 'function': 55931 { 55932 return type; 55933 } 55934 } 55935 55936 if (Array.isArray(val)) return 'array'; 55937 if (isDate(val)) return 'date'; 55938 if (isError(val)) return 'error'; 55939 var constructorName = ctorName(val); 55940 55941 switch (constructorName) { 55942 case 'Symbol': 55943 case 'Promise': 55944 case 'WeakMap': 55945 case 'WeakSet': 55946 case 'Map': 55947 case 'Set': 55948 return constructorName; 55949 } // other 55950 55951 55952 return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); 55953} 55954 55955function ctorName(val) { 55956 return typeof val.constructor === 'function' ? val.constructor.name : null; 55957} 55958 55959function isError(val) { 55960 return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'; 55961} 55962 55963function isDate(val) { 55964 if (val instanceof Date) return true; 55965 return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function'; 55966} 55967 55968function kindOf(val) { 55969 var typeOfVal = typeof val; 55970 55971 if (true) { 55972 typeOfVal = miniKindOf(val); 55973 } 55974 55975 return typeOfVal; 55976} 55977 55978/** 55979 * @deprecated 55980 * 55981 * **We recommend using the `configureStore` method 55982 * of the `@reduxjs/toolkit` package**, which replaces `createStore`. 55983 * 55984 * Redux Toolkit is our recommended approach for writing Redux logic today, 55985 * including store setup, reducers, data fetching, and more. 55986 * 55987 * **For more details, please read this Redux docs page:** 55988 * **https://redux.js.org/introduction/why-rtk-is-redux-today** 55989 * 55990 * `configureStore` from Redux Toolkit is an improved version of `createStore` that 55991 * simplifies setup and helps avoid common bugs. 55992 * 55993 * You should not be using the `redux` core package by itself today, except for learning purposes. 55994 * The `createStore` method from the core `redux` package will not be removed, but we encourage 55995 * all users to migrate to using Redux Toolkit for all Redux code. 55996 * 55997 * If you want to use `createStore` without this visual deprecation warning, use 55998 * the `legacy_createStore` import instead: 55999 * 56000 * `import { legacy_createStore as createStore} from 'redux'` 56001 * 56002 */ 56003 56004function createStore(reducer, preloadedState, enhancer) { 56005 var _ref2; 56006 56007 if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') { 56008 throw new Error( false ? 0 : 'It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function. See https://redux.js.org/tutorials/fundamentals/part-4-store#creating-a-store-with-enhancers for an example.'); 56009 } 56010 56011 if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { 56012 enhancer = preloadedState; 56013 preloadedState = undefined; 56014 } 56015 56016 if (typeof enhancer !== 'undefined') { 56017 if (typeof enhancer !== 'function') { 56018 throw new Error( false ? 0 : "Expected the enhancer to be a function. Instead, received: '" + kindOf(enhancer) + "'"); 56019 } 56020 56021 return enhancer(createStore)(reducer, preloadedState); 56022 } 56023 56024 if (typeof reducer !== 'function') { 56025 throw new Error( false ? 0 : "Expected the root reducer to be a function. Instead, received: '" + kindOf(reducer) + "'"); 56026 } 56027 56028 var currentReducer = reducer; 56029 var currentState = preloadedState; 56030 var currentListeners = []; 56031 var nextListeners = currentListeners; 56032 var isDispatching = false; 56033 /** 56034 * This makes a shallow copy of currentListeners so we can use 56035 * nextListeners as a temporary list while dispatching. 56036 * 56037 * This prevents any bugs around consumers calling 56038 * subscribe/unsubscribe in the middle of a dispatch. 56039 */ 56040 56041 function ensureCanMutateNextListeners() { 56042 if (nextListeners === currentListeners) { 56043 nextListeners = currentListeners.slice(); 56044 } 56045 } 56046 /** 56047 * Reads the state tree managed by the store. 56048 * 56049 * @returns {any} The current state tree of your application. 56050 */ 56051 56052 56053 function getState() { 56054 if (isDispatching) { 56055 throw new Error( false ? 0 : 'You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.'); 56056 } 56057 56058 return currentState; 56059 } 56060 /** 56061 * Adds a change listener. It will be called any time an action is dispatched, 56062 * and some part of the state tree may potentially have changed. You may then 56063 * call `getState()` to read the current state tree inside the callback. 56064 * 56065 * You may call `dispatch()` from a change listener, with the following 56066 * caveats: 56067 * 56068 * 1. The subscriptions are snapshotted just before every `dispatch()` call. 56069 * If you subscribe or unsubscribe while the listeners are being invoked, this 56070 * will not have any effect on the `dispatch()` that is currently in progress. 56071 * However, the next `dispatch()` call, whether nested or not, will use a more 56072 * recent snapshot of the subscription list. 56073 * 56074 * 2. The listener should not expect to see all state changes, as the state 56075 * might have been updated multiple times during a nested `dispatch()` before 56076 * the listener is called. It is, however, guaranteed that all subscribers 56077 * registered before the `dispatch()` started will be called with the latest 56078 * state by the time it exits. 56079 * 56080 * @param {Function} listener A callback to be invoked on every dispatch. 56081 * @returns {Function} A function to remove this change listener. 56082 */ 56083 56084 56085 function subscribe(listener) { 56086 if (typeof listener !== 'function') { 56087 throw new Error( false ? 0 : "Expected the listener to be a function. Instead, received: '" + kindOf(listener) + "'"); 56088 } 56089 56090 if (isDispatching) { 56091 throw new Error( false ? 0 : 'You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.'); 56092 } 56093 56094 var isSubscribed = true; 56095 ensureCanMutateNextListeners(); 56096 nextListeners.push(listener); 56097 return function unsubscribe() { 56098 if (!isSubscribed) { 56099 return; 56100 } 56101 56102 if (isDispatching) { 56103 throw new Error( false ? 0 : 'You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api/store#subscribelistener for more details.'); 56104 } 56105 56106 isSubscribed = false; 56107 ensureCanMutateNextListeners(); 56108 var index = nextListeners.indexOf(listener); 56109 nextListeners.splice(index, 1); 56110 currentListeners = null; 56111 }; 56112 } 56113 /** 56114 * Dispatches an action. It is the only way to trigger a state change. 56115 * 56116 * The `reducer` function, used to create the store, will be called with the 56117 * current state tree and the given `action`. Its return value will 56118 * be considered the **next** state of the tree, and the change listeners 56119 * will be notified. 56120 * 56121 * The base implementation only supports plain object actions. If you want to 56122 * dispatch a Promise, an Observable, a thunk, or something else, you need to 56123 * wrap your store creating function into the corresponding middleware. For 56124 * example, see the documentation for the `redux-thunk` package. Even the 56125 * middleware will eventually dispatch plain object actions using this method. 56126 * 56127 * @param {Object} action A plain object representing âwhat changedâ. It is 56128 * a good idea to keep actions serializable so you can record and replay user 56129 * sessions, or use the time travelling `redux-devtools`. An action must have 56130 * a `type` property which may not be `undefined`. It is a good idea to use 56131 * string constants for action types. 56132 * 56133 * @returns {Object} For convenience, the same action object you dispatched. 56134 * 56135 * Note that, if you use a custom middleware, it may wrap `dispatch()` to 56136 * return something else (for example, a Promise you can await). 56137 */ 56138 56139 56140 function dispatch(action) { 56141 if (!isPlainObject(action)) { 56142 throw new Error( false ? 0 : "Actions must be plain objects. Instead, the actual type was: '" + kindOf(action) + "'. You may need to add middleware to your store setup to handle dispatching other values, such as 'redux-thunk' to handle dispatching functions. See https://redux.js.org/tutorials/fundamentals/part-4-store#middleware and https://redux.js.org/tutorials/fundamentals/part-6-async-logic#using-the-redux-thunk-middleware for examples."); 56143 } 56144 56145 if (typeof action.type === 'undefined') { 56146 throw new Error( false ? 0 : 'Actions may not have an undefined "type" property. You may have misspelled an action type string constant.'); 56147 } 56148 56149 if (isDispatching) { 56150 throw new Error( false ? 0 : 'Reducers may not dispatch actions.'); 56151 } 56152 56153 try { 56154 isDispatching = true; 56155 currentState = currentReducer(currentState, action); 56156 } finally { 56157 isDispatching = false; 56158 } 56159 56160 var listeners = currentListeners = nextListeners; 56161 56162 for (var i = 0; i < listeners.length; i++) { 56163 var listener = listeners[i]; 56164 listener(); 56165 } 56166 56167 return action; 56168 } 56169 /** 56170 * Replaces the reducer currently used by the store to calculate the state. 56171 * 56172 * You might need this if your app implements code splitting and you want to 56173 * load some of the reducers dynamically. You might also need this if you 56174 * implement a hot reloading mechanism for Redux. 56175 * 56176 * @param {Function} nextReducer The reducer for the store to use instead. 56177 * @returns {void} 56178 */ 56179 56180 56181 function replaceReducer(nextReducer) { 56182 if (typeof nextReducer !== 'function') { 56183 throw new Error( false ? 0 : "Expected the nextReducer to be a function. Instead, received: '" + kindOf(nextReducer)); 56184 } 56185 56186 currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT. 56187 // Any reducers that existed in both the new and old rootReducer 56188 // will receive the previous state. This effectively populates 56189 // the new state tree with any relevant data from the old one. 56190 56191 dispatch({ 56192 type: ActionTypes.REPLACE 56193 }); 56194 } 56195 /** 56196 * Interoperability point for observable/reactive libraries. 56197 * @returns {observable} A minimal observable of state changes. 56198 * For more information, see the observable proposal: 56199 * https://github.com/tc39/proposal-observable 56200 */ 56201 56202 56203 function observable() { 56204 var _ref; 56205 56206 var outerSubscribe = subscribe; 56207 return _ref = { 56208 /** 56209 * The minimal observable subscription method. 56210 * @param {Object} observer Any object that can be used as an observer. 56211 * The observer object should have a `next` method. 56212 * @returns {subscription} An object with an `unsubscribe` method that can 56213 * be used to unsubscribe the observable from the store, and prevent further 56214 * emission of values from the observable. 56215 */ 56216 subscribe: function subscribe(observer) { 56217 if (typeof observer !== 'object' || observer === null) { 56218 throw new Error( false ? 0 : "Expected the observer to be an object. Instead, received: '" + kindOf(observer) + "'"); 56219 } 56220 56221 function observeState() { 56222 if (observer.next) { 56223 observer.next(getState()); 56224 } 56225 } 56226 56227 observeState(); 56228 var unsubscribe = outerSubscribe(observeState); 56229 return { 56230 unsubscribe: unsubscribe 56231 }; 56232 } 56233 }, _ref[$$observable] = function () { 56234 return this; 56235 }, _ref; 56236 } // When a store is created, an "INIT" action is dispatched so that every 56237 // reducer returns their initial state. This effectively populates 56238 // the initial state tree. 56239 56240 56241 dispatch({ 56242 type: ActionTypes.INIT 56243 }); 56244 return _ref2 = { 56245 dispatch: dispatch, 56246 subscribe: subscribe, 56247 getState: getState, 56248 replaceReducer: replaceReducer 56249 }, _ref2[$$observable] = observable, _ref2; 56250} 56251/** 56252 * Creates a Redux store that holds the state tree. 56253 * 56254 * **We recommend using `configureStore` from the 56255 * `@reduxjs/toolkit` package**, which replaces `createStore`: 56256 * **https://redux.js.org/introduction/why-rtk-is-redux-today** 56257 * 56258 * The only way to change the data in the store is to call `dispatch()` on it. 56259 * 56260 * There should only be a single store in your app. To specify how different 56261 * parts of the state tree respond to actions, you may combine several reducers 56262 * into a single reducer function by using `combineReducers`. 56263 * 56264 * @param {Function} reducer A function that returns the next state tree, given 56265 * the current state tree and the action to handle. 56266 * 56267 * @param {any} [preloadedState] The initial state. You may optionally specify it 56268 * to hydrate the state from the server in universal apps, or to restore a 56269 * previously serialized user session. 56270 * If you use `combineReducers` to produce the root reducer function, this must be 56271 * an object with the same shape as `combineReducers` keys. 56272 * 56273 * @param {Function} [enhancer] The store enhancer. You may optionally specify it 56274 * to enhance the store with third-party capabilities such as middleware, 56275 * time travel, persistence, etc. The only store enhancer that ships with Redux 56276 * is `applyMiddleware()`. 56277 * 56278 * @returns {Store} A Redux store that lets you read the state, dispatch actions 56279 * and subscribe to changes. 56280 */ 56281 56282var legacy_createStore = createStore; 56283 56284/** 56285 * Prints a warning in the console if it exists. 56286 * 56287 * @param {String} message The warning message. 56288 * @returns {void} 56289 */ 56290function warning(message) { 56291 /* eslint-disable no-console */ 56292 if (typeof console !== 'undefined' && typeof console.error === 'function') { 56293 console.error(message); 56294 } 56295 /* eslint-enable no-console */ 56296 56297 56298 try { 56299 // This error was thrown as a convenience so that if you enable 56300 // "break on all exceptions" in your console, 56301 // it would pause the execution at this line. 56302 throw new Error(message); 56303 } catch (e) {} // eslint-disable-line no-empty 56304 56305} 56306 56307function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) { 56308 var reducerKeys = Object.keys(reducers); 56309 var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer'; 56310 56311 if (reducerKeys.length === 0) { 56312 return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.'; 56313 } 56314 56315 if (!isPlainObject(inputState)) { 56316 return "The " + argumentName + " has unexpected type of \"" + kindOf(inputState) + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\""); 56317 } 56318 56319 var unexpectedKeys = Object.keys(inputState).filter(function (key) { 56320 return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]; 56321 }); 56322 unexpectedKeys.forEach(function (key) { 56323 unexpectedKeyCache[key] = true; 56324 }); 56325 if (action && action.type === ActionTypes.REPLACE) return; 56326 56327 if (unexpectedKeys.length > 0) { 56328 return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored."); 56329 } 56330} 56331 56332function assertReducerShape(reducers) { 56333 Object.keys(reducers).forEach(function (key) { 56334 var reducer = reducers[key]; 56335 var initialState = reducer(undefined, { 56336 type: ActionTypes.INIT 56337 }); 56338 56339 if (typeof initialState === 'undefined') { 56340 throw new Error( false ? 0 : "The slice reducer for key \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined."); 56341 } 56342 56343 if (typeof reducer(undefined, { 56344 type: ActionTypes.PROBE_UNKNOWN_ACTION() 56345 }) === 'undefined') { 56346 throw new Error( false ? 0 : "The slice reducer for key \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle '" + ActionTypes.INIT + "' or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null."); 56347 } 56348 }); 56349} 56350/** 56351 * Turns an object whose values are different reducer functions, into a single 56352 * reducer function. It will call every child reducer, and gather their results 56353 * into a single state object, whose keys correspond to the keys of the passed 56354 * reducer functions. 56355 * 56356 * @param {Object} reducers An object whose values correspond to different 56357 * reducer functions that need to be combined into one. One handy way to obtain 56358 * it is to use ES6 `import * as reducers` syntax. The reducers may never return 56359 * undefined for any action. Instead, they should return their initial state 56360 * if the state passed to them was undefined, and the current state for any 56361 * unrecognized action. 56362 * 56363 * @returns {Function} A reducer function that invokes every reducer inside the 56364 * passed object, and builds a state object with the same shape. 56365 */ 56366 56367 56368function combineReducers(reducers) { 56369 var reducerKeys = Object.keys(reducers); 56370 var finalReducers = {}; 56371 56372 for (var i = 0; i < reducerKeys.length; i++) { 56373 var key = reducerKeys[i]; 56374 56375 if (true) { 56376 if (typeof reducers[key] === 'undefined') { 56377 warning("No reducer provided for key \"" + key + "\""); 56378 } 56379 } 56380 56381 if (typeof reducers[key] === 'function') { 56382 finalReducers[key] = reducers[key]; 56383 } 56384 } 56385 56386 var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same 56387 // keys multiple times. 56388 56389 var unexpectedKeyCache; 56390 56391 if (true) { 56392 unexpectedKeyCache = {}; 56393 } 56394 56395 var shapeAssertionError; 56396 56397 try { 56398 assertReducerShape(finalReducers); 56399 } catch (e) { 56400 shapeAssertionError = e; 56401 } 56402 56403 return function combination(state, action) { 56404 if (state === void 0) { 56405 state = {}; 56406 } 56407 56408 if (shapeAssertionError) { 56409 throw shapeAssertionError; 56410 } 56411 56412 if (true) { 56413 var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache); 56414 56415 if (warningMessage) { 56416 warning(warningMessage); 56417 } 56418 } 56419 56420 var hasChanged = false; 56421 var nextState = {}; 56422 56423 for (var _i = 0; _i < finalReducerKeys.length; _i++) { 56424 var _key = finalReducerKeys[_i]; 56425 var reducer = finalReducers[_key]; 56426 var previousStateForKey = state[_key]; 56427 var nextStateForKey = reducer(previousStateForKey, action); 56428 56429 if (typeof nextStateForKey === 'undefined') { 56430 var actionType = action && action.type; 56431 throw new Error( false ? 0 : "When called with an action of type " + (actionType ? "\"" + String(actionType) + "\"" : '(unknown type)') + ", the slice reducer for key \"" + _key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined."); 56432 } 56433 56434 nextState[_key] = nextStateForKey; 56435 hasChanged = hasChanged || nextStateForKey !== previousStateForKey; 56436 } 56437 56438 hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length; 56439 return hasChanged ? nextState : state; 56440 }; 56441} 56442 56443function bindActionCreator(actionCreator, dispatch) { 56444 return function () { 56445 return dispatch(actionCreator.apply(this, arguments)); 56446 }; 56447} 56448/** 56449 * Turns an object whose values are action creators, into an object with the 56450 * same keys, but with every function wrapped into a `dispatch` call so they 56451 * may be invoked directly. This is just a convenience method, as you can call 56452 * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. 56453 * 56454 * For convenience, you can also pass an action creator as the first argument, 56455 * and get a dispatch wrapped function in return. 56456 * 56457 * @param {Function|Object} actionCreators An object whose values are action 56458 * creator functions. One handy way to obtain it is to use ES6 `import * as` 56459 * syntax. You may also pass a single function. 56460 * 56461 * @param {Function} dispatch The `dispatch` function available on your Redux 56462 * store. 56463 * 56464 * @returns {Function|Object} The object mimicking the original object, but with 56465 * every action creator wrapped into the `dispatch` call. If you passed a 56466 * function as `actionCreators`, the return value will also be a single 56467 * function. 56468 */ 56469 56470 56471function bindActionCreators(actionCreators, dispatch) { 56472 if (typeof actionCreators === 'function') { 56473 return bindActionCreator(actionCreators, dispatch); 56474 } 56475 56476 if (typeof actionCreators !== 'object' || actionCreators === null) { 56477 throw new Error( false ? 0 : "bindActionCreators expected an object or a function, but instead received: '" + kindOf(actionCreators) + "'. " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?"); 56478 } 56479 56480 var boundActionCreators = {}; 56481 56482 for (var key in actionCreators) { 56483 var actionCreator = actionCreators[key]; 56484 56485 if (typeof actionCreator === 'function') { 56486 boundActionCreators[key] = bindActionCreator(actionCreator, dispatch); 56487 } 56488 } 56489 56490 return boundActionCreators; 56491} 56492 56493/** 56494 * Composes single-argument functions from right to left. The rightmost 56495 * function can take multiple arguments as it provides the signature for 56496 * the resulting composite function. 56497 * 56498 * @param {...Function} funcs The functions to compose. 56499 * @returns {Function} A function obtained by composing the argument functions 56500 * from right to left. For example, compose(f, g, h) is identical to doing 56501 * (...args) => f(g(h(...args))). 56502 */ 56503function compose() { 56504 for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) { 56505 funcs[_key] = arguments[_key]; 56506 } 56507 56508 if (funcs.length === 0) { 56509 return function (arg) { 56510 return arg; 56511 }; 56512 } 56513 56514 if (funcs.length === 1) { 56515 return funcs[0]; 56516 } 56517 56518 return funcs.reduce(function (a, b) { 56519 return function () { 56520 return a(b.apply(void 0, arguments)); 56521 }; 56522 }); 56523} 56524 56525/** 56526 * Creates a store enhancer that applies middleware to the dispatch method 56527 * of the Redux store. This is handy for a variety of tasks, such as expressing 56528 * asynchronous actions in a concise manner, or logging every action payload. 56529 * 56530 * See `redux-thunk` package as an example of the Redux middleware. 56531 * 56532 * Because middleware is potentially asynchronous, this should be the first 56533 * store enhancer in the composition chain. 56534 * 56535 * Note that each middleware will be given the `dispatch` and `getState` functions 56536 * as named arguments. 56537 * 56538 * @param {...Function} middlewares The middleware chain to be applied. 56539 * @returns {Function} A store enhancer applying the middleware. 56540 */ 56541 56542function applyMiddleware() { 56543 for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) { 56544 middlewares[_key] = arguments[_key]; 56545 } 56546 56547 return function (createStore) { 56548 return function () { 56549 var store = createStore.apply(void 0, arguments); 56550 56551 var _dispatch = function dispatch() { 56552 throw new Error( false ? 0 : 'Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.'); 56553 }; 56554 56555 var middlewareAPI = { 56556 getState: store.getState, 56557 dispatch: function dispatch() { 56558 return _dispatch.apply(void 0, arguments); 56559 } 56560 }; 56561 var chain = middlewares.map(function (middleware) { 56562 return middleware(middlewareAPI); 56563 }); 56564 _dispatch = compose.apply(void 0, chain)(store.dispatch); 56565 return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, store), {}, { 56566 dispatch: _dispatch 56567 }); 56568 }; 56569 }; 56570} 56571 56572 56573 56574 56575/***/ }), 56576
vendor: 4,456 bytes, lines 56577-56739
56577/***/ "./node_modules/reselect/es/defaultMemoize.js": 56578/*!****************************************************!*\ 56579 !*** ./node_modules/reselect/es/defaultMemoize.js ***! 56580 \****************************************************/ 56581/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 56582 56583"use strict"; 56584__webpack_require__.r(__webpack_exports__); 56585/* harmony export */ __webpack_require__.d(__webpack_exports__, { 56586/* harmony export */ createCacheKeyComparator: () => (/* binding */ createCacheKeyComparator), 56587/* harmony export */ defaultEqualityCheck: () => (/* binding */ defaultEqualityCheck), 56588/* harmony export */ defaultMemoize: () => (/* binding */ defaultMemoize) 56589/* harmony export */ }); 56590// Cache implementation based on Erik Rasmussen's `lru-memoize`: 56591// https://github.com/erikras/lru-memoize 56592var NOT_FOUND = 'NOT_FOUND'; 56593 56594function createSingletonCache(equals) { 56595 var entry; 56596 return { 56597 get: function get(key) { 56598 if (entry && equals(entry.key, key)) { 56599 return entry.value; 56600 } 56601 56602 return NOT_FOUND; 56603 }, 56604 put: function put(key, value) { 56605 entry = { 56606 key: key, 56607 value: value 56608 }; 56609 }, 56610 getEntries: function getEntries() { 56611 return entry ? [entry] : []; 56612 }, 56613 clear: function clear() { 56614 entry = undefined; 56615 } 56616 }; 56617} 56618 56619function createLruCache(maxSize, equals) { 56620 var entries = []; 56621 56622 function get(key) { 56623 var cacheIndex = entries.findIndex(function (entry) { 56624 return equals(key, entry.key); 56625 }); // We found a cached entry 56626 56627 if (cacheIndex > -1) { 56628 var entry = entries[cacheIndex]; // Cached entry not at top of cache, move it to the top 56629 56630 if (cacheIndex > 0) { 56631 entries.splice(cacheIndex, 1); 56632 entries.unshift(entry); 56633 } 56634 56635 return entry.value; 56636 } // No entry found in cache, return sentinel 56637 56638 56639 return NOT_FOUND; 56640 } 56641 56642 function put(key, value) { 56643 if (get(key) === NOT_FOUND) { 56644 // TODO Is unshift slow? 56645 entries.unshift({ 56646 key: key, 56647 value: value 56648 }); 56649 56650 if (entries.length > maxSize) { 56651 entries.pop(); 56652 } 56653 } 56654 } 56655 56656 function getEntries() { 56657 return entries; 56658 } 56659 56660 function clear() { 56661 entries = []; 56662 } 56663 56664 return { 56665 get: get, 56666 put: put, 56667 getEntries: getEntries, 56668 clear: clear 56669 }; 56670} 56671 56672var defaultEqualityCheck = function defaultEqualityCheck(a, b) { 56673 return a === b; 56674}; 56675function createCacheKeyComparator(equalityCheck) { 56676 return function areArgumentsShallowlyEqual(prev, next) { 56677 if (prev === null || next === null || prev.length !== next.length) { 56678 return false; 56679 } // Do this in a for loop (and not a `forEach` or an `every`) so we can determine equality as fast as possible. 56680 56681 56682 var length = prev.length; 56683 56684 for (var i = 0; i < length; i++) { 56685 if (!equalityCheck(prev[i], next[i])) { 56686 return false; 56687 } 56688 } 56689 56690 return true; 56691 }; 56692} 56693// defaultMemoize now supports a configurable cache size with LRU behavior, 56694// and optional comparison of the result value with existing values 56695function defaultMemoize(func, equalityCheckOrOptions) { 56696 var providedOptions = typeof equalityCheckOrOptions === 'object' ? equalityCheckOrOptions : { 56697 equalityCheck: equalityCheckOrOptions 56698 }; 56699 var _providedOptions$equa = providedOptions.equalityCheck, 56700 equalityCheck = _providedOptions$equa === void 0 ? defaultEqualityCheck : _providedOptions$equa, 56701 _providedOptions$maxS = providedOptions.maxSize, 56702 maxSize = _providedOptions$maxS === void 0 ? 1 : _providedOptions$maxS, 56703 resultEqualityCheck = providedOptions.resultEqualityCheck; 56704 var comparator = createCacheKeyComparator(equalityCheck); 56705 var cache = maxSize === 1 ? createSingletonCache(comparator) : createLruCache(maxSize, comparator); // we reference arguments instead of spreading them for performance reasons 56706 56707 function memoized() { 56708 var value = cache.get(arguments); 56709 56710 if (value === NOT_FOUND) { 56711 // @ts-ignore 56712 value = func.apply(null, arguments); 56713 56714 if (resultEqualityCheck) { 56715 var entries = cache.getEntries(); 56716 var matchingEntry = entries.find(function (entry) { 56717 return resultEqualityCheck(entry.value, value); 56718 }); 56719 56720 if (matchingEntry) { 56721 value = matchingEntry.value; 56722 } 56723 } 56724 56725 cache.put(arguments, value); 56726 } 56727 56728 return value; 56729 } 56730 56731 memoized.clearCache = function () { 56732 return cache.clear(); 56733 }; 56734 56735 return memoized; 56736} 56737 56738/***/ }), 56739
vendor: 6,352 bytes, lines 56740-56888
56740/***/ "./node_modules/reselect/es/index.js": 56741/*!*******************************************!*\ 56742 !*** ./node_modules/reselect/es/index.js ***! 56743 \*******************************************/ 56744/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 56745 56746"use strict"; 56747__webpack_require__.r(__webpack_exports__); 56748/* harmony export */ __webpack_require__.d(__webpack_exports__, { 56749/* harmony export */ createSelector: () => (/* binding */ createSelector), 56750/* harmony export */ createSelectorCreator: () => (/* binding */ createSelectorCreator), 56751/* harmony export */ createStructuredSelector: () => (/* binding */ createStructuredSelector), 56752/* harmony export */ defaultEqualityCheck: () => (/* reexport safe */ _defaultMemoize__WEBPACK_IMPORTED_MODULE_0__.defaultEqualityCheck), 56753/* harmony export */ defaultMemoize: () => (/* reexport safe */ _defaultMemoize__WEBPACK_IMPORTED_MODULE_0__.defaultMemoize) 56754/* harmony export */ }); 56755/* harmony import */ var _defaultMemoize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defaultMemoize */ "./node_modules/reselect/es/defaultMemoize.js"); 56756 56757 56758 56759function getDependencies(funcs) { 56760 var dependencies = Array.isArray(funcs[0]) ? funcs[0] : funcs; 56761 56762 if (!dependencies.every(function (dep) { 56763 return typeof dep === 'function'; 56764 })) { 56765 var dependencyTypes = dependencies.map(function (dep) { 56766 return typeof dep === 'function' ? "function " + (dep.name || 'unnamed') + "()" : typeof dep; 56767 }).join(', '); 56768 throw new Error("createSelector expects all input-selectors to be functions, but received the following types: [" + dependencyTypes + "]"); 56769 } 56770 56771 return dependencies; 56772} 56773 56774function createSelectorCreator(memoize) { 56775 for (var _len = arguments.length, memoizeOptionsFromArgs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 56776 memoizeOptionsFromArgs[_key - 1] = arguments[_key]; 56777 } 56778 56779 var createSelector = function createSelector() { 56780 for (var _len2 = arguments.length, funcs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { 56781 funcs[_key2] = arguments[_key2]; 56782 } 56783 56784 var _recomputations = 0; 56785 56786 var _lastResult; // Due to the intricacies of rest params, we can't do an optional arg after `...funcs`. 56787 // So, start by declaring the default value here. 56788 // (And yes, the words 'memoize' and 'options' appear too many times in this next sequence.) 56789 56790 56791 var directlyPassedOptions = { 56792 memoizeOptions: undefined 56793 }; // Normally, the result func or "output selector" is the last arg 56794 56795 var resultFunc = funcs.pop(); // If the result func is actually an _object_, assume it's our options object 56796 56797 if (typeof resultFunc === 'object') { 56798 directlyPassedOptions = resultFunc; // and pop the real result func off 56799 56800 resultFunc = funcs.pop(); 56801 } 56802 56803 if (typeof resultFunc !== 'function') { 56804 throw new Error("createSelector expects an output function after the inputs, but received: [" + typeof resultFunc + "]"); 56805 } // Determine which set of options we're using. Prefer options passed directly, 56806 // but fall back to options given to createSelectorCreator. 56807 56808 56809 var _directlyPassedOption = directlyPassedOptions, 56810 _directlyPassedOption2 = _directlyPassedOption.memoizeOptions, 56811 memoizeOptions = _directlyPassedOption2 === void 0 ? memoizeOptionsFromArgs : _directlyPassedOption2; // Simplifying assumption: it's unlikely that the first options arg of the provided memoizer 56812 // is an array. In most libs I've looked at, it's an equality function or options object. 56813 // Based on that, if `memoizeOptions` _is_ an array, we assume it's a full 56814 // user-provided array of options. Otherwise, it must be just the _first_ arg, and so 56815 // we wrap it in an array so we can apply it. 56816 56817 var finalMemoizeOptions = Array.isArray(memoizeOptions) ? memoizeOptions : [memoizeOptions]; 56818 var dependencies = getDependencies(funcs); 56819 var memoizedResultFunc = memoize.apply(void 0, [function recomputationWrapper() { 56820 _recomputations++; // apply arguments instead of spreading for performance. 56821 56822 return resultFunc.apply(null, arguments); 56823 }].concat(finalMemoizeOptions)); // If a selector is called with the exact same arguments we don't need to traverse our dependencies again. 56824 56825 var selector = memoize(function dependenciesChecker() { 56826 var params = []; 56827 var length = dependencies.length; 56828 56829 for (var i = 0; i < length; i++) { 56830 // apply arguments instead of spreading and mutate a local list of params for performance. 56831 // @ts-ignore 56832 params.push(dependencies[i].apply(null, arguments)); 56833 } // apply arguments instead of spreading for performance. 56834 56835 56836 _lastResult = memoizedResultFunc.apply(null, params); 56837 return _lastResult; 56838 }); 56839 Object.assign(selector, { 56840 resultFunc: resultFunc, 56841 memoizedResultFunc: memoizedResultFunc, 56842 dependencies: dependencies, 56843 lastResult: function lastResult() { 56844 return _lastResult; 56845 }, 56846 recomputations: function recomputations() { 56847 return _recomputations; 56848 }, 56849 resetRecomputations: function resetRecomputations() { 56850 return _recomputations = 0; 56851 } 56852 }); 56853 return selector; 56854 }; // @ts-ignore 56855 56856 56857 return createSelector; 56858} 56859var createSelector = /* #__PURE__ */createSelectorCreator(_defaultMemoize__WEBPACK_IMPORTED_MODULE_0__.defaultMemoize); 56860// Manual definition of state and output arguments 56861var createStructuredSelector = function createStructuredSelector(selectors, selectorCreator) { 56862 if (selectorCreator === void 0) { 56863 selectorCreator = createSelector; 56864 } 56865 56866 if (typeof selectors !== 'object') { 56867 throw new Error('createStructuredSelector expects first argument to be an object ' + ("where each property is a selector, instead received a " + typeof selectors)); 56868 } 56869 56870 var objectKeys = Object.keys(selectors); 56871 var resultSelector = selectorCreator( // @ts-ignore 56872 objectKeys.map(function (key) { 56873 return selectors[key]; 56874 }), function () { 56875 for (var _len3 = arguments.length, values = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { 56876 values[_key3] = arguments[_key3]; 56877 } 56878 56879 return values.reduce(function (composition, value, index) { 56880 composition[objectKeys[index]] = value; 56881 return composition; 56882 }, {}); 56883 }); 56884 return resultSelector; 56885}; 56886 56887/***/ }), 56888
vendor: 17,789 bytes, lines 56889-57533
56889/***/ "./node_modules/scheduler/cjs/scheduler.development.js": 56890/*!*************************************************************!*\ 56891 !*** ./node_modules/scheduler/cjs/scheduler.development.js ***! 56892 \*************************************************************/ 56893/***/ ((__unused_webpack_module, exports) => { 56894 56895"use strict"; 56896/** 56897 * @license React 56898 * scheduler.development.js 56899 * 56900 * Copyright (c) Facebook, Inc. and its affiliates. 56901 * 56902 * This source code is licensed under the MIT license found in the 56903 * LICENSE file in the root directory of this source tree. 56904 */ 56905 56906 56907 56908if (true) { 56909 (function() { 56910 56911 'use strict'; 56912 56913/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 56914if ( 56915 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 56916 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === 56917 'function' 56918) { 56919 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); 56920} 56921 var enableSchedulerDebugging = false; 56922var enableProfiling = false; 56923var frameYieldMs = 5; 56924 56925function push(heap, node) { 56926 var index = heap.length; 56927 heap.push(node); 56928 siftUp(heap, node, index); 56929} 56930function peek(heap) { 56931 return heap.length === 0 ? null : heap[0]; 56932} 56933function pop(heap) { 56934 if (heap.length === 0) { 56935 return null; 56936 } 56937 56938 var first = heap[0]; 56939 var last = heap.pop(); 56940 56941 if (last !== first) { 56942 heap[0] = last; 56943 siftDown(heap, last, 0); 56944 } 56945 56946 return first; 56947} 56948 56949function siftUp(heap, node, i) { 56950 var index = i; 56951 56952 while (index > 0) { 56953 var parentIndex = index - 1 >>> 1; 56954 var parent = heap[parentIndex]; 56955 56956 if (compare(parent, node) > 0) { 56957 // The parent is larger. Swap positions. 56958 heap[parentIndex] = node; 56959 heap[index] = parent; 56960 index = parentIndex; 56961 } else { 56962 // The parent is smaller. Exit. 56963 return; 56964 } 56965 } 56966} 56967 56968function siftDown(heap, node, i) { 56969 var index = i; 56970 var length = heap.length; 56971 var halfLength = length >>> 1; 56972 56973 while (index < halfLength) { 56974 var leftIndex = (index + 1) * 2 - 1; 56975 var left = heap[leftIndex]; 56976 var rightIndex = leftIndex + 1; 56977 var right = heap[rightIndex]; // If the left or right node is smaller, swap with the smaller of those. 56978 56979 if (compare(left, node) < 0) { 56980 if (rightIndex < length && compare(right, left) < 0) { 56981 heap[index] = right; 56982 heap[rightIndex] = node; 56983 index = rightIndex; 56984 } else { 56985 heap[index] = left; 56986 heap[leftIndex] = node; 56987 index = leftIndex; 56988 } 56989 } else if (rightIndex < length && compare(right, node) < 0) { 56990 heap[index] = right; 56991 heap[rightIndex] = node; 56992 index = rightIndex; 56993 } else { 56994 // Neither child is smaller. Exit. 56995 return; 56996 } 56997 } 56998} 56999 57000function compare(a, b) { 57001 // Compare sort index first, then task id. 57002 var diff = a.sortIndex - b.sortIndex; 57003 return diff !== 0 ? diff : a.id - b.id; 57004} 57005 57006// TODO: Use symbols? 57007var ImmediatePriority = 1; 57008var UserBlockingPriority = 2; 57009var NormalPriority = 3; 57010var LowPriority = 4; 57011var IdlePriority = 5; 57012 57013function markTaskErrored(task, ms) { 57014} 57015 57016/* eslint-disable no-var */ 57017 57018var hasPerformanceNow = typeof performance === 'object' && typeof performance.now === 'function'; 57019 57020if (hasPerformanceNow) { 57021 var localPerformance = performance; 57022 57023 exports.unstable_now = function () { 57024 return localPerformance.now(); 57025 }; 57026} else { 57027 var localDate = Date; 57028 var initialTime = localDate.now(); 57029 57030 exports.unstable_now = function () { 57031 return localDate.now() - initialTime; 57032 }; 57033} // Max 31 bit integer. The max integer size in V8 for 32-bit systems. 57034// Math.pow(2, 30) - 1 57035// 0b111111111111111111111111111111 57036 57037 57038var maxSigned31BitInt = 1073741823; // Times out immediately 57039 57040var IMMEDIATE_PRIORITY_TIMEOUT = -1; // Eventually times out 57041 57042var USER_BLOCKING_PRIORITY_TIMEOUT = 250; 57043var NORMAL_PRIORITY_TIMEOUT = 5000; 57044var LOW_PRIORITY_TIMEOUT = 10000; // Never times out 57045 57046var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap 57047 57048var taskQueue = []; 57049var timerQueue = []; // Incrementing id counter. Used to maintain insertion order. 57050 57051var taskIdCounter = 1; // Pausing the scheduler is useful for debugging. 57052var currentTask = null; 57053var currentPriorityLevel = NormalPriority; // This is set while performing work, to prevent re-entrance. 57054 57055var isPerformingWork = false; 57056var isHostCallbackScheduled = false; 57057var isHostTimeoutScheduled = false; // Capture local references to native APIs, in case a polyfill overrides them. 57058 57059var localSetTimeout = typeof setTimeout === 'function' ? setTimeout : null; 57060var localClearTimeout = typeof clearTimeout === 'function' ? clearTimeout : null; 57061var localSetImmediate = typeof setImmediate !== 'undefined' ? setImmediate : null; // IE and Node.js + jsdom 57062 57063var isInputPending = typeof navigator !== 'undefined' && navigator.scheduling !== undefined && navigator.scheduling.isInputPending !== undefined ? navigator.scheduling.isInputPending.bind(navigator.scheduling) : null; 57064 57065function advanceTimers(currentTime) { 57066 // Check for tasks that are no longer delayed and add them to the queue. 57067 var timer = peek(timerQueue); 57068 57069 while (timer !== null) { 57070 if (timer.callback === null) { 57071 // Timer was cancelled. 57072 pop(timerQueue); 57073 } else if (timer.startTime <= currentTime) { 57074 // Timer fired. Transfer to the task queue. 57075 pop(timerQueue); 57076 timer.sortIndex = timer.expirationTime; 57077 push(taskQueue, timer); 57078 } else { 57079 // Remaining timers are pending. 57080 return; 57081 } 57082 57083 timer = peek(timerQueue); 57084 } 57085} 57086 57087function handleTimeout(currentTime) { 57088 isHostTimeoutScheduled = false; 57089 advanceTimers(currentTime); 57090 57091 if (!isHostCallbackScheduled) { 57092 if (peek(taskQueue) !== null) { 57093 isHostCallbackScheduled = true; 57094 requestHostCallback(flushWork); 57095 } else { 57096 var firstTimer = peek(timerQueue); 57097 57098 if (firstTimer !== null) { 57099 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); 57100 } 57101 } 57102 } 57103} 57104 57105function flushWork(hasTimeRemaining, initialTime) { 57106 57107 57108 isHostCallbackScheduled = false; 57109 57110 if (isHostTimeoutScheduled) { 57111 // We scheduled a timeout but it's no longer needed. Cancel it. 57112 isHostTimeoutScheduled = false; 57113 cancelHostTimeout(); 57114 } 57115 57116 isPerformingWork = true; 57117 var previousPriorityLevel = currentPriorityLevel; 57118 57119 try { 57120 if (enableProfiling) { 57121 try { 57122 return workLoop(hasTimeRemaining, initialTime); 57123 } catch (error) { 57124 if (currentTask !== null) { 57125 var currentTime = exports.unstable_now(); 57126 markTaskErrored(currentTask, currentTime); 57127 currentTask.isQueued = false; 57128 } 57129 57130 throw error; 57131 } 57132 } else { 57133 // No catch in prod code path. 57134 return workLoop(hasTimeRemaining, initialTime); 57135 } 57136 } finally { 57137 currentTask = null; 57138 currentPriorityLevel = previousPriorityLevel; 57139 isPerformingWork = false; 57140 } 57141} 57142 57143function workLoop(hasTimeRemaining, initialTime) { 57144 var currentTime = initialTime; 57145 advanceTimers(currentTime); 57146 currentTask = peek(taskQueue); 57147 57148 while (currentTask !== null && !(enableSchedulerDebugging )) { 57149 if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) { 57150 // This currentTask hasn't expired, and we've reached the deadline. 57151 break; 57152 } 57153 57154 var callback = currentTask.callback; 57155 57156 if (typeof callback === 'function') { 57157 currentTask.callback = null; 57158 currentPriorityLevel = currentTask.priorityLevel; 57159 var didUserCallbackTimeout = currentTask.expirationTime <= currentTime; 57160 57161 var continuationCallback = callback(didUserCallbackTimeout); 57162 currentTime = exports.unstable_now(); 57163 57164 if (typeof continuationCallback === 'function') { 57165 currentTask.callback = continuationCallback; 57166 } else { 57167 57168 if (currentTask === peek(taskQueue)) { 57169 pop(taskQueue); 57170 } 57171 } 57172 57173 advanceTimers(currentTime); 57174 } else { 57175 pop(taskQueue); 57176 } 57177 57178 currentTask = peek(taskQueue); 57179 } // Return whether there's additional work 57180 57181 57182 if (currentTask !== null) { 57183 return true; 57184 } else { 57185 var firstTimer = peek(timerQueue); 57186 57187 if (firstTimer !== null) { 57188 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime); 57189 } 57190 57191 return false; 57192 } 57193} 57194 57195function unstable_runWithPriority(priorityLevel, eventHandler) { 57196 switch (priorityLevel) { 57197 case ImmediatePriority: 57198 case UserBlockingPriority: 57199 case NormalPriority: 57200 case LowPriority: 57201 case IdlePriority: 57202 break; 57203 57204 default: 57205 priorityLevel = NormalPriority; 57206 } 57207 57208 var previousPriorityLevel = currentPriorityLevel; 57209 currentPriorityLevel = priorityLevel; 57210 57211 try { 57212 return eventHandler(); 57213 } finally { 57214 currentPriorityLevel = previousPriorityLevel; 57215 } 57216} 57217 57218function unstable_next(eventHandler) { 57219 var priorityLevel; 57220 57221 switch (currentPriorityLevel) { 57222 case ImmediatePriority: 57223 case UserBlockingPriority: 57224 case NormalPriority: 57225 // Shift down to normal priority 57226 priorityLevel = NormalPriority; 57227 break; 57228 57229 default: 57230 // Anything lower than normal priority should remain at the current level. 57231 priorityLevel = currentPriorityLevel; 57232 break; 57233 } 57234 57235 var previousPriorityLevel = currentPriorityLevel; 57236 currentPriorityLevel = priorityLevel; 57237 57238 try { 57239 return eventHandler(); 57240 } finally { 57241 currentPriorityLevel = previousPriorityLevel; 57242 } 57243} 57244 57245function unstable_wrapCallback(callback) { 57246 var parentPriorityLevel = currentPriorityLevel; 57247 return function () { 57248 // This is a fork of runWithPriority, inlined for performance. 57249 var previousPriorityLevel = currentPriorityLevel; 57250 currentPriorityLevel = parentPriorityLevel; 57251 57252 try { 57253 return callback.apply(this, arguments); 57254 } finally { 57255 currentPriorityLevel = previousPriorityLevel; 57256 } 57257 }; 57258} 57259 57260function unstable_scheduleCallback(priorityLevel, callback, options) { 57261 var currentTime = exports.unstable_now(); 57262 var startTime; 57263 57264 if (typeof options === 'object' && options !== null) { 57265 var delay = options.delay; 57266 57267 if (typeof delay === 'number' && delay > 0) { 57268 startTime = currentTime + delay; 57269 } else { 57270 startTime = currentTime; 57271 } 57272 } else { 57273 startTime = currentTime; 57274 } 57275 57276 var timeout; 57277 57278 switch (priorityLevel) { 57279 case ImmediatePriority: 57280 timeout = IMMEDIATE_PRIORITY_TIMEOUT; 57281 break; 57282 57283 case UserBlockingPriority: 57284 timeout = USER_BLOCKING_PRIORITY_TIMEOUT; 57285 break; 57286 57287 case IdlePriority: 57288 timeout = IDLE_PRIORITY_TIMEOUT; 57289 break; 57290 57291 case LowPriority: 57292 timeout = LOW_PRIORITY_TIMEOUT; 57293 break; 57294 57295 case NormalPriority: 57296 default: 57297 timeout = NORMAL_PRIORITY_TIMEOUT; 57298 break; 57299 } 57300 57301 var expirationTime = startTime + timeout; 57302 var newTask = { 57303 id: taskIdCounter++, 57304 callback: callback, 57305 priorityLevel: priorityLevel, 57306 startTime: startTime, 57307 expirationTime: expirationTime, 57308 sortIndex: -1 57309 }; 57310 57311 if (startTime > currentTime) { 57312 // This is a delayed task. 57313 newTask.sortIndex = startTime; 57314 push(timerQueue, newTask); 57315 57316 if (peek(taskQueue) === null && newTask === peek(timerQueue)) { 57317 // All tasks are delayed, and this is the task with the earliest delay. 57318 if (isHostTimeoutScheduled) { 57319 // Cancel an existing timeout. 57320 cancelHostTimeout(); 57321 } else { 57322 isHostTimeoutScheduled = true; 57323 } // Schedule a timeout. 57324 57325 57326 requestHostTimeout(handleTimeout, startTime - currentTime); 57327 } 57328 } else { 57329 newTask.sortIndex = expirationTime; 57330 push(taskQueue, newTask); 57331 // wait until the next time we yield. 57332 57333 57334 if (!isHostCallbackScheduled && !isPerformingWork) { 57335 isHostCallbackScheduled = true; 57336 requestHostCallback(flushWork); 57337 } 57338 } 57339 57340 return newTask; 57341} 57342 57343function unstable_pauseExecution() { 57344} 57345 57346function unstable_continueExecution() { 57347 57348 if (!isHostCallbackScheduled && !isPerformingWork) { 57349 isHostCallbackScheduled = true; 57350 requestHostCallback(flushWork); 57351 } 57352} 57353 57354function unstable_getFirstCallbackNode() { 57355 return peek(taskQueue); 57356} 57357 57358function unstable_cancelCallback(task) { 57359 // remove from the queue because you can't remove arbitrary nodes from an 57360 // array based heap, only the first one.) 57361 57362 57363 task.callback = null; 57364} 57365 57366function unstable_getCurrentPriorityLevel() { 57367 return currentPriorityLevel; 57368} 57369 57370var isMessageLoopRunning = false; 57371var scheduledHostCallback = null; 57372var taskTimeoutID = -1; // Scheduler periodically yields in case there is other work on the main 57373// thread, like user events. By default, it yields multiple times per frame. 57374// It does not attempt to align with frame boundaries, since most tasks don't 57375// need to be frame aligned; for those that do, use requestAnimationFrame. 57376 57377var frameInterval = frameYieldMs; 57378var startTime = -1; 57379 57380function shouldYieldToHost() { 57381 var timeElapsed = exports.unstable_now() - startTime; 57382 57383 if (timeElapsed < frameInterval) { 57384 // The main thread has only been blocked for a really short amount of time; 57385 // smaller than a single frame. Don't yield yet. 57386 return false; 57387 } // The main thread has been blocked for a non-negligible amount of time. We 57388 57389 57390 return true; 57391} 57392 57393function requestPaint() { 57394 57395} 57396 57397function forceFrameRate(fps) { 57398 if (fps < 0 || fps > 125) { 57399 // Using console['error'] to evade Babel and ESLint 57400 console['error']('forceFrameRate takes a positive int between 0 and 125, ' + 'forcing frame rates higher than 125 fps is not supported'); 57401 return; 57402 } 57403 57404 if (fps > 0) { 57405 frameInterval = Math.floor(1000 / fps); 57406 } else { 57407 // reset the framerate 57408 frameInterval = frameYieldMs; 57409 } 57410} 57411 57412var performWorkUntilDeadline = function () { 57413 if (scheduledHostCallback !== null) { 57414 var currentTime = exports.unstable_now(); // Keep track of the start time so we can measure how long the main thread 57415 // has been blocked. 57416 57417 startTime = currentTime; 57418 var hasTimeRemaining = true; // If a scheduler task throws, exit the current browser task so the 57419 // error can be observed. 57420 // 57421 // Intentionally not using a try-catch, since that makes some debugging 57422 // techniques harder. Instead, if `scheduledHostCallback` errors, then 57423 // `hasMoreWork` will remain true, and we'll continue the work loop. 57424 57425 var hasMoreWork = true; 57426 57427 try { 57428 hasMoreWork = scheduledHostCallback(hasTimeRemaining, currentTime); 57429 } finally { 57430 if (hasMoreWork) { 57431 // If there's more work, schedule the next message event at the end 57432 // of the preceding one. 57433 schedulePerformWorkUntilDeadline(); 57434 } else { 57435 isMessageLoopRunning = false; 57436 scheduledHostCallback = null; 57437 } 57438 } 57439 } else { 57440 isMessageLoopRunning = false; 57441 } // Yielding to the browser will give it a chance to paint, so we can 57442}; 57443 57444var schedulePerformWorkUntilDeadline; 57445 57446if (typeof localSetImmediate === 'function') { 57447 // Node.js and old IE. 57448 // There's a few reasons for why we prefer setImmediate. 57449 // 57450 // Unlike MessageChannel, it doesn't prevent a Node.js process from exiting. 57451 // (Even though this is a DOM fork of the Scheduler, you could get here 57452 // with a mix of Node.js 15+, which has a MessageChannel, and jsdom.) 57453 // https://github.com/facebook/react/issues/20756 57454 // 57455 // But also, it runs earlier which is the semantic we want. 57456 // If other browsers ever implement it, it's better to use it. 57457 // Although both of these would be inferior to native scheduling. 57458 schedulePerformWorkUntilDeadline = function () { 57459 localSetImmediate(performWorkUntilDeadline); 57460 }; 57461} else if (typeof MessageChannel !== 'undefined') { 57462 // DOM and Worker environments. 57463 // We prefer MessageChannel because of the 4ms setTimeout clamping. 57464 var channel = new MessageChannel(); 57465 var port = channel.port2; 57466 channel.port1.onmessage = performWorkUntilDeadline; 57467 57468 schedulePerformWorkUntilDeadline = function () { 57469 port.postMessage(null); 57470 }; 57471} else { 57472 // We should only fallback here in non-browser environments. 57473 schedulePerformWorkUntilDeadline = function () { 57474 localSetTimeout(performWorkUntilDeadline, 0); 57475 }; 57476} 57477 57478function requestHostCallback(callback) { 57479 scheduledHostCallback = callback; 57480 57481 if (!isMessageLoopRunning) { 57482 isMessageLoopRunning = true; 57483 schedulePerformWorkUntilDeadline(); 57484 } 57485} 57486 57487function requestHostTimeout(callback, ms) { 57488 taskTimeoutID = localSetTimeout(function () { 57489 callback(exports.unstable_now()); 57490 }, ms); 57491} 57492 57493function cancelHostTimeout() { 57494 localClearTimeout(taskTimeoutID); 57495 taskTimeoutID = -1; 57496} 57497 57498var unstable_requestPaint = requestPaint; 57499var unstable_Profiling = null; 57500 57501exports.unstable_IdlePriority = IdlePriority; 57502exports.unstable_ImmediatePriority = ImmediatePriority; 57503exports.unstable_LowPriority = LowPriority; 57504exports.unstable_NormalPriority = NormalPriority; 57505exports.unstable_Profiling = unstable_Profiling; 57506exports.unstable_UserBlockingPriority = UserBlockingPriority; 57507exports.unstable_cancelCallback = unstable_cancelCallback; 57508exports.unstable_continueExecution = unstable_continueExecution; 57509exports.unstable_forceFrameRate = forceFrameRate; 57510exports.unstable_getCurrentPriorityLevel = unstable_getCurrentPriorityLevel; 57511exports.unstable_getFirstCallbackNode = unstable_getFirstCallbackNode; 57512exports.unstable_next = unstable_next; 57513exports.unstable_pauseExecution = unstable_pauseExecution; 57514exports.unstable_requestPaint = unstable_requestPaint; 57515exports.unstable_runWithPriority = unstable_runWithPriority; 57516exports.unstable_scheduleCallback = unstable_scheduleCallback; 57517exports.unstable_shouldYield = shouldYieldToHost; 57518exports.unstable_wrapCallback = unstable_wrapCallback; 57519 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 57520if ( 57521 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 57522 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === 57523 'function' 57524) { 57525 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); 57526} 57527 57528 })(); 57529} 57530 57531 57532/***/ }), 57533
vendor: 439 bytes, lines 57534-57549
57534/***/ "./node_modules/scheduler/index.js": 57535/*!*****************************************!*\ 57536 !*** ./node_modules/scheduler/index.js ***! 57537 \*****************************************/ 57538/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 57539 57540"use strict"; 57541 57542 57543if (false) {} else { 57544 module.exports = __webpack_require__(/*! ./cjs/scheduler.development.js */ "./node_modules/scheduler/cjs/scheduler.development.js"); 57545} 57546 57547 57548/***/ }), 57549
vendor: 25,736 bytes, lines 57550-58316
57550/***/ "./node_modules/sticky-sidebar/dist/sticky-sidebar.js": 57551/*!************************************************************!*\ 57552 !*** ./node_modules/sticky-sidebar/dist/sticky-sidebar.js ***! 57553 \************************************************************/ 57554/***/ (function(module) { 57555 57556(function (global, factory) { 57557 true ? module.exports = factory() : 57558 0; 57559}(this, (function () { 'use strict'; 57560 57561var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 57562 57563function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 57564 57565/** 57566 * Sticky Sidebar JavaScript Plugin. 57567 * @version 3.3.1 57568 * @author Ahmed Bouhuolia <[email protected]> 57569 * @license The MIT License (MIT) 57570 */ 57571var StickySidebar = function () { 57572 57573 // --------------------------------- 57574 // # Define Constants 57575 // --------------------------------- 57576 // 57577 var EVENT_KEY = '.stickySidebar'; 57578 var DEFAULTS = { 57579 57580 /** 57581 * Additional top spacing of the element when it becomes sticky. 57582 * @type {Numeric|Function} 57583 */ 57584 topSpacing: 0, 57585 57586 /** 57587 * Additional bottom spacing of the element when it becomes sticky. 57588 * @type {Numeric|Function} 57589 */ 57590 bottomSpacing: 0, 57591 57592 /** 57593 * Container sidebar selector to know what the beginning and end of sticky element. 57594 * @type {String|False} 57595 */ 57596 containerSelector: false, 57597 57598 /** 57599 * Inner wrapper selector. 57600 * @type {String} 57601 */ 57602 innerWrapperSelector: '.inner-wrapper-sticky', 57603 57604 /** 57605 * The name of CSS class to apply to elements when they have become stuck. 57606 * @type {String|False} 57607 */ 57608 stickyClass: 'is-affixed', 57609 57610 /** 57611 * Detect when sidebar and its container change height so re-calculate their dimensions. 57612 * @type {Boolean} 57613 */ 57614 resizeSensor: true, 57615 57616 /** 57617 * The sidebar returns to its normal position if its width below this value. 57618 * @type {Numeric} 57619 */ 57620 minWidth: false 57621 }; 57622 57623 // --------------------------------- 57624 // # Class Definition 57625 // --------------------------------- 57626 // 57627 /** 57628 * Sticky Sidebar Class. 57629 * @public 57630 */ 57631 57632 var StickySidebar = function () { 57633 57634 /** 57635 * Sticky Sidebar Constructor. 57636 * @constructor 57637 * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector. 57638 * @param {Object} options - The options of sticky sidebar. 57639 */ 57640 function StickySidebar(sidebar) { 57641 var _this = this; 57642 57643 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 57644 57645 _classCallCheck(this, StickySidebar); 57646 57647 this.options = StickySidebar.extend(DEFAULTS, options); 57648 57649 // Sidebar element query if there's no one, throw error. 57650 this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar; 57651 if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element."); 57652 57653 this.sidebarInner = false; 57654 this.container = this.sidebar.parentElement; 57655 57656 // Current Affix Type of sidebar element. 57657 this.affixedType = 'STATIC'; 57658 this.direction = 'down'; 57659 this.support = { 57660 transform: false, 57661 transform3d: false 57662 }; 57663 57664 this._initialized = false; 57665 this._reStyle = false; 57666 this._breakpoint = false; 57667 this._resizeListeners = []; 57668 57669 // Dimensions of sidebar, container and screen viewport. 57670 this.dimensions = { 57671 translateY: 0, 57672 topSpacing: 0, 57673 lastTopSpacing: 0, 57674 bottomSpacing: 0, 57675 lastBottomSpacing: 0, 57676 sidebarHeight: 0, 57677 sidebarWidth: 0, 57678 containerTop: 0, 57679 containerHeight: 0, 57680 viewportHeight: 0, 57681 viewportTop: 0, 57682 lastViewportTop: 0 57683 }; 57684 57685 // Bind event handlers for referencability. 57686 ['handleEvent'].forEach(function (method) { 57687 _this[method] = _this[method].bind(_this); 57688 }); 57689 57690 // Initialize sticky sidebar for first time. 57691 this.initialize(); 57692 } 57693 57694 /** 57695 * Initializes the sticky sidebar by adding inner wrapper, define its container, 57696 * min-width breakpoint, calculating dimensions, adding helper classes and inline style. 57697 * @private 57698 */ 57699 57700 57701 _createClass(StickySidebar, [{ 57702 key: 'initialize', 57703 value: function initialize() { 57704 var _this2 = this; 57705 57706 this._setSupportFeatures(); 57707 57708 // Get sticky sidebar inner wrapper, if not found, will create one. 57709 if (this.options.innerWrapperSelector) { 57710 this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector); 57711 57712 if (null === this.sidebarInner) this.sidebarInner = false; 57713 } 57714 57715 if (!this.sidebarInner) { 57716 var wrapper = document.createElement('div'); 57717 wrapper.setAttribute('class', 'inner-wrapper-sticky'); 57718 this.sidebar.appendChild(wrapper); 57719 57720 while (this.sidebar.firstChild != wrapper) { 57721 wrapper.appendChild(this.sidebar.firstChild); 57722 }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky'); 57723 } 57724 57725 // Container wrapper of the sidebar. 57726 if (this.options.containerSelector) { 57727 var containers = document.querySelectorAll(this.options.containerSelector); 57728 containers = Array.prototype.slice.call(containers); 57729 57730 containers.forEach(function (container, item) { 57731 if (!container.contains(_this2.sidebar)) return; 57732 _this2.container = container; 57733 }); 57734 57735 if (!containers.length) throw new Error("The container does not contains on the sidebar."); 57736 } 57737 57738 // If top/bottom spacing is not function parse value to integer. 57739 if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0; 57740 57741 if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0; 57742 57743 // Breakdown sticky sidebar if screen width below `options.minWidth`. 57744 this._widthBreakpoint(); 57745 57746 // Calculate dimensions of sidebar, container and viewport. 57747 this.calcDimensions(); 57748 57749 // Affix sidebar in proper position. 57750 this.stickyPosition(); 57751 57752 // Bind all events. 57753 this.bindEvents(); 57754 57755 // Inform other properties the sticky sidebar is initialized. 57756 this._initialized = true; 57757 } 57758 57759 /** 57760 * Bind all events of sticky sidebar plugin. 57761 * @protected 57762 */ 57763 57764 }, { 57765 key: 'bindEvents', 57766 value: function bindEvents() { 57767 window.addEventListener('resize', this, { passive: true, capture: false }); 57768 window.addEventListener('scroll', this, { passive: true, capture: false }); 57769 57770 this.sidebar.addEventListener('update' + EVENT_KEY, this); 57771 57772 if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) { 57773 new ResizeSensor(this.sidebarInner, this.handleEvent); 57774 new ResizeSensor(this.container, this.handleEvent); 57775 } 57776 } 57777 57778 /** 57779 * Handles all events of the plugin. 57780 * @param {Object} event - Event object passed from listener. 57781 */ 57782 57783 }, { 57784 key: 'handleEvent', 57785 value: function handleEvent(event) { 57786 this.updateSticky(event); 57787 } 57788 57789 /** 57790 * Calculates dimensions of sidebar, container and screen viewpoint 57791 * @public 57792 */ 57793 57794 }, { 57795 key: 'calcDimensions', 57796 value: function calcDimensions() { 57797 if (this._breakpoint) return; 57798 var dims = this.dimensions; 57799 57800 // Container of sticky sidebar dimensions. 57801 dims.containerTop = StickySidebar.offsetRelative(this.container).top; 57802 dims.containerHeight = this.container.clientHeight; 57803 dims.containerBottom = dims.containerTop + dims.containerHeight; 57804 57805 // Sidebar dimensions. 57806 dims.sidebarHeight = this.sidebarInner.offsetHeight; 57807 dims.sidebarWidth = this.sidebar.offsetWidth; 57808 57809 // Screen viewport dimensions. 57810 dims.viewportHeight = window.innerHeight; 57811 57812 this._calcDimensionsWithScroll(); 57813 } 57814 57815 /** 57816 * Some dimensions values need to be up-to-date when scrolling the page. 57817 * @private 57818 */ 57819 57820 }, { 57821 key: '_calcDimensionsWithScroll', 57822 value: function _calcDimensionsWithScroll() { 57823 var dims = this.dimensions; 57824 57825 dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left; 57826 57827 dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop; 57828 dims.viewportBottom = dims.viewportTop + dims.viewportHeight; 57829 dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft; 57830 57831 dims.topSpacing = this.options.topSpacing; 57832 dims.bottomSpacing = this.options.bottomSpacing; 57833 57834 if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0; 57835 57836 if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0; 57837 57838 if ('VIEWPORT-TOP' === this.affixedType) { 57839 // Adjust translate Y in the case decrease top spacing value. 57840 if (dims.topSpacing < dims.lastTopSpacing) { 57841 dims.translateY += dims.lastTopSpacing - dims.topSpacing; 57842 this._reStyle = true; 57843 } 57844 } else if ('VIEWPORT-BOTTOM' === this.affixedType) { 57845 // Adjust translate Y in the case decrease bottom spacing value. 57846 if (dims.bottomSpacing < dims.lastBottomSpacing) { 57847 dims.translateY += dims.lastBottomSpacing - dims.bottomSpacing; 57848 this._reStyle = true; 57849 } 57850 } 57851 57852 dims.lastTopSpacing = dims.topSpacing; 57853 dims.lastBottomSpacing = dims.bottomSpacing; 57854 } 57855 57856 /** 57857 * Determine whether the sidebar is bigger than viewport. 57858 * @public 57859 * @return {Boolean} 57860 */ 57861 57862 }, { 57863 key: 'isSidebarFitsViewport', 57864 value: function isSidebarFitsViewport() { 57865 return this.dimensions.sidebarHeight < this.dimensions.viewportHeight; 57866 } 57867 57868 /** 57869 * Observe browser scrolling direction top and down. 57870 */ 57871 57872 }, { 57873 key: 'observeScrollDir', 57874 value: function observeScrollDir() { 57875 var dims = this.dimensions; 57876 if (dims.lastViewportTop === dims.viewportTop) return; 57877 57878 var furthest = 'down' === this.direction ? Math.min : Math.max; 57879 57880 // If the browser is scrolling not in the same direction. 57881 if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down'; 57882 } 57883 57884 /** 57885 * Gets affix type of sidebar according to current scrollTop and scrollLeft. 57886 * Holds all logical affix of the sidebar when scrolling up and down and when sidebar 57887 * is bigger than viewport and vice versa. 57888 * @public 57889 * @return {String|False} - Proper affix type. 57890 */ 57891 57892 }, { 57893 key: 'getAffixType', 57894 value: function getAffixType() { 57895 var dims = this.dimensions, 57896 affixType = false; 57897 57898 this._calcDimensionsWithScroll(); 57899 57900 var sidebarBottom = dims.sidebarHeight + dims.containerTop; 57901 var colliderTop = dims.viewportTop + dims.topSpacing; 57902 var colliderBottom = dims.viewportBottom - dims.bottomSpacing; 57903 57904 // When browser is scrolling top. 57905 if ('up' === this.direction) { 57906 if (colliderTop <= dims.containerTop) { 57907 dims.translateY = 0; 57908 affixType = 'STATIC'; 57909 } else if (colliderTop <= dims.translateY + dims.containerTop) { 57910 dims.translateY = colliderTop - dims.containerTop; 57911 affixType = 'VIEWPORT-TOP'; 57912 } else if (!this.isSidebarFitsViewport() && dims.containerTop <= colliderTop) { 57913 affixType = 'VIEWPORT-UNBOTTOM'; 57914 } 57915 // When browser is scrolling up. 57916 } else { 57917 // When sidebar element is not bigger than screen viewport. 57918 if (this.isSidebarFitsViewport()) { 57919 57920 if (dims.sidebarHeight + colliderTop >= dims.containerBottom) { 57921 dims.translateY = dims.containerBottom - sidebarBottom; 57922 affixType = 'CONTAINER-BOTTOM'; 57923 } else if (colliderTop >= dims.containerTop) { 57924 dims.translateY = colliderTop - dims.containerTop; 57925 affixType = 'VIEWPORT-TOP'; 57926 } 57927 // When sidebar element is bigger than screen viewport. 57928 } else { 57929 57930 if (dims.containerBottom <= colliderBottom) { 57931 dims.translateY = dims.containerBottom - sidebarBottom; 57932 affixType = 'CONTAINER-BOTTOM'; 57933 } else if (sidebarBottom + dims.translateY <= colliderBottom) { 57934 dims.translateY = colliderBottom - sidebarBottom; 57935 affixType = 'VIEWPORT-BOTTOM'; 57936 } else if (dims.containerTop + dims.translateY <= colliderTop) { 57937 affixType = 'VIEWPORT-UNBOTTOM'; 57938 } 57939 } 57940 } 57941 57942 // Make sure the translate Y is not bigger than container height. 57943 dims.translateY = Math.max(0, dims.translateY); 57944 dims.translateY = Math.min(dims.containerHeight, dims.translateY); 57945 57946 dims.lastViewportTop = dims.viewportTop; 57947 return affixType; 57948 } 57949 57950 /** 57951 * Gets inline style of sticky sidebar wrapper and inner wrapper according 57952 * to its affix type. 57953 * @private 57954 * @param {String} affixType - Affix type of sticky sidebar. 57955 * @return {Object} 57956 */ 57957 57958 }, { 57959 key: '_getStyle', 57960 value: function _getStyle(affixType) { 57961 if ('undefined' === typeof affixType) return; 57962 57963 var style = { inner: {}, outer: {} }; 57964 var dims = this.dimensions; 57965 57966 switch (affixType) { 57967 case 'VIEWPORT-TOP': 57968 style.inner = { position: 'fixed', top: dims.topSpacing, 57969 left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth }; 57970 break; 57971 case 'VIEWPORT-BOTTOM': 57972 style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft, 57973 bottom: dims.bottomSpacing, width: dims.sidebarWidth }; 57974 break; 57975 case 'CONTAINER-BOTTOM': 57976 case 'VIEWPORT-UNBOTTOM': 57977 var translate = this._getTranslate(0, dims.translateY + 'px'); 57978 57979 if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth }; 57980 break; 57981 } 57982 57983 switch (affixType) { 57984 case 'VIEWPORT-TOP': 57985 case 'VIEWPORT-BOTTOM': 57986 case 'VIEWPORT-UNBOTTOM': 57987 case 'CONTAINER-BOTTOM': 57988 style.outer = { height: dims.sidebarHeight, position: 'relative' }; 57989 break; 57990 } 57991 57992 style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer); 57993 style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '', 57994 bottom: '', width: '', transform: this._getTranslate() }, style.inner); 57995 57996 return style; 57997 } 57998 57999 /** 58000 * Cause the sidebar to be sticky according to affix type by adding inline 58001 * style, adding helper class and trigger events. 58002 * @function 58003 * @protected 58004 * @param {string} force - Update sticky sidebar position by force. 58005 */ 58006 58007 }, { 58008 key: 'stickyPosition', 58009 value: function stickyPosition(force) { 58010 if (this._breakpoint) return; 58011 58012 force = this._reStyle || force || false; 58013 58014 var affixType = this.getAffixType(); 58015 var style = this._getStyle(affixType); 58016 58017 if ((this.affixedType != affixType || force) && affixType) { 58018 var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY; 58019 StickySidebar.eventTrigger(this.sidebar, affixEvent); 58020 58021 if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass); 58022 58023 for (var key in style.outer) { 58024 this.sidebar.style[key] = style.outer[key]; 58025 } 58026 58027 for (var _key in style.inner) { 58028 var _unit2 = 'number' === typeof style.inner[_key] ? 'px' : ''; 58029 this.sidebarInner.style[_key] = style.inner[_key] + _unit2; 58030 } 58031 58032 var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY; 58033 StickySidebar.eventTrigger(this.sidebar, affixedEvent); 58034 } else { 58035 if (this._initialized) this.sidebarInner.style.left = style.inner.left; 58036 } 58037 58038 this.affixedType = affixType; 58039 } 58040 58041 /** 58042 * Breakdown sticky sidebar when window width is below `options.minWidth` value. 58043 * @protected 58044 */ 58045 58046 }, { 58047 key: '_widthBreakpoint', 58048 value: function _widthBreakpoint() { 58049 58050 if (window.innerWidth <= this.options.minWidth) { 58051 this._breakpoint = true; 58052 this.affixedType = 'STATIC'; 58053 58054 this.sidebar.removeAttribute('style'); 58055 StickySidebar.removeClass(this.sidebar, this.options.stickyClass); 58056 this.sidebarInner.removeAttribute('style'); 58057 } else { 58058 this._breakpoint = false; 58059 } 58060 } 58061 58062 /** 58063 * Switches between functions stack for each event type, if there's no 58064 * event, it will re-initialize sticky sidebar. 58065 * @public 58066 */ 58067 58068 }, { 58069 key: 'updateSticky', 58070 value: function updateSticky() { 58071 var _this3 = this; 58072 58073 var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 58074 58075 if (this._running) return; 58076 this._running = true; 58077 58078 (function (eventType) { 58079 58080 requestAnimationFrame(function () { 58081 switch (eventType) { 58082 // When browser is scrolling and re-calculate just dimensions 58083 // within scroll. 58084 case 'scroll': 58085 _this3._calcDimensionsWithScroll(); 58086 _this3.observeScrollDir(); 58087 _this3.stickyPosition(); 58088 break; 58089 58090 // When browser is resizing or there's no event, observe width 58091 // breakpoint and re-calculate dimensions. 58092 case 'resize': 58093 default: 58094 _this3._widthBreakpoint(); 58095 _this3.calcDimensions(); 58096 _this3.stickyPosition(true); 58097 break; 58098 } 58099 _this3._running = false; 58100 }); 58101 })(event.type); 58102 } 58103 58104 /** 58105 * Set browser support features to the public property. 58106 * @private 58107 */ 58108 58109 }, { 58110 key: '_setSupportFeatures', 58111 value: function _setSupportFeatures() { 58112 var support = this.support; 58113 58114 support.transform = StickySidebar.supportTransform(); 58115 support.transform3d = StickySidebar.supportTransform(true); 58116 } 58117 58118 /** 58119 * Get translate value, if the browser supports transfrom3d, it will adopt it. 58120 * and the same with translate. if browser doesn't support both return false. 58121 * @param {Number} y - Value of Y-axis. 58122 * @param {Number} x - Value of X-axis. 58123 * @param {Number} z - Value of Z-axis. 58124 * @return {String|False} 58125 */ 58126 58127 }, { 58128 key: '_getTranslate', 58129 value: function _getTranslate() { 58130 var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 58131 var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 58132 var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; 58133 58134 if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false; 58135 } 58136 58137 /** 58138 * Destroy sticky sidebar plugin. 58139 * @public 58140 */ 58141 58142 }, { 58143 key: 'destroy', 58144 value: function destroy() { 58145 window.removeEventListener('resize', this, { caption: false }); 58146 window.removeEventListener('scroll', this, { caption: false }); 58147 58148 this.sidebar.classList.remove(this.options.stickyClass); 58149 this.sidebar.style.minHeight = ''; 58150 58151 this.sidebar.removeEventListener('update' + EVENT_KEY, this); 58152 58153 var styleReset = { inner: {}, outer: {} }; 58154 58155 styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' }; 58156 styleReset.outer = { height: '', position: '' }; 58157 58158 for (var key in styleReset.outer) { 58159 this.sidebar.style[key] = styleReset.outer[key]; 58160 }for (var _key2 in styleReset.inner) { 58161 this.sidebarInner.style[_key2] = styleReset.inner[_key2]; 58162 }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) { 58163 ResizeSensor.detach(this.sidebarInner, this.handleEvent); 58164 ResizeSensor.detach(this.container, this.handleEvent); 58165 } 58166 } 58167 58168 /** 58169 * Determine if the browser supports CSS transform feature. 58170 * @function 58171 * @static 58172 * @param {Boolean} transform3d - Detect transform with translate3d. 58173 * @return {String} 58174 */ 58175 58176 }], [{ 58177 key: 'supportTransform', 58178 value: function supportTransform(transform3d) { 58179 var result = false, 58180 property = transform3d ? 'perspective' : 'transform', 58181 upper = property.charAt(0).toUpperCase() + property.slice(1), 58182 prefixes = ['Webkit', 'Moz', 'O', 'ms'], 58183 support = document.createElement('support'), 58184 style = support.style; 58185 58186 (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) { 58187 if (style[property] !== undefined) { 58188 result = property; 58189 return false; 58190 } 58191 }); 58192 return result; 58193 } 58194 58195 /** 58196 * Trigger custom event. 58197 * @static 58198 * @param {DOMObject} element - Target element on the DOM. 58199 * @param {String} eventName - Event name. 58200 * @param {Object} data - 58201 */ 58202 58203 }, { 58204 key: 'eventTrigger', 58205 value: function eventTrigger(element, eventName, data) { 58206 try { 58207 var event = new CustomEvent(eventName, { detail: data }); 58208 } catch (e) { 58209 var event = document.createEvent('CustomEvent'); 58210 event.initCustomEvent(eventName, true, true, data); 58211 } 58212 element.dispatchEvent(event); 58213 } 58214 58215 /** 58216 * Extend options object with defaults. 58217 * @function 58218 * @static 58219 */ 58220 58221 }, { 58222 key: 'extend', 58223 value: function extend(defaults, options) { 58224 var results = {}; 58225 for (var key in defaults) { 58226 if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key]; 58227 } 58228 return results; 58229 } 58230 58231 /** 58232 * Get current coordinates left and top of specific element. 58233 * @static 58234 */ 58235 58236 }, { 58237 key: 'offsetRelative', 58238 value: function offsetRelative(element) { 58239 var result = { left: 0, top: 0 }; 58240 58241 do { 58242 var offsetTop = element.offsetTop; 58243 var offsetLeft = element.offsetLeft; 58244 58245 if (!isNaN(offsetTop)) result.top += offsetTop; 58246 58247 if (!isNaN(offsetLeft)) result.left += offsetLeft; 58248 58249 element = 'BODY' === element.tagName ? element.parentElement : element.offsetParent; 58250 } while (element); 58251 return result; 58252 } 58253 58254 /** 58255 * Add specific class name to specific element. 58256 * @static 58257 * @param {ObjectDOM} element 58258 * @param {String} className 58259 */ 58260 58261 }, { 58262 key: 'addClass', 58263 value: function addClass(element, className) { 58264 if (!StickySidebar.hasClass(element, className)) { 58265 if (element.classList) element.classList.add(className);else element.className += ' ' + className; 58266 } 58267 } 58268 58269 /** 58270 * Remove specific class name to specific element 58271 * @static 58272 * @param {ObjectDOM} element 58273 * @param {String} className 58274 */ 58275 58276 }, { 58277 key: 'removeClass', 58278 value: function removeClass(element, className) { 58279 if (StickySidebar.hasClass(element, className)) { 58280 if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); 58281 } 58282 } 58283 58284 /** 58285 * Determine weather the element has specific class name. 58286 * @static 58287 * @param {ObjectDOM} element 58288 * @param {String} className 58289 */ 58290 58291 }, { 58292 key: 'hasClass', 58293 value: function hasClass(element, className) { 58294 if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className); 58295 } 58296 }]); 58297 58298 return StickySidebar; 58299 }(); 58300 58301 return StickySidebar; 58302}(); 58303 58304// Global 58305// ------------------------- 58306window.StickySidebar = StickySidebar; 58307 58308return StickySidebar; 58309 58310}))); 58311 58312//# sourceMappingURL=sticky-sidebar.js.map 58313 58314 58315/***/ }), 58316
58317/***/ "./Static/javascript/helpers/cookie.ts": 58318/*!*********************************************!*\ 58319 !*** ./Static/javascript/helpers/cookie.ts ***! 58320 \*********************************************/ 58321/***/ ((__unused_webpack_module, exports) => { 58322 58323"use strict"; 58324 58325Object.defineProperty(exports, "__esModule", ({ value: true })); 58326exports.expireCookie = exports.setCookie = exports.getCookie = void 0; 58327function getCookie(name) { 58328 var v = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)'); 58329 return v ? v[2] : null; 58330} 58331exports.getCookie = getCookie; 58332function setCookie(name, value, days, domain) { 58333 if (domain === void 0) { domain = ''; } 58334 var cName = name; 58335 var cDate = new Date(); 58336 cDate.setDate(cDate.getDate() + 1); 58337 var newCookie = cName + "=" + value + "; expires=" + cDate.toUTCString(); 58338 document.cookie = newCookie; 58339} 58340exports.setCookie = setCookie; 58341function expireCookie(name) { 58342 document.cookie = "".concat(name, "=; expires=Thu, 01 Jan 1970 00:00:00 UTC;"); 58343} 58344exports.expireCookie = expireCookie; 58345 58346 58347/***/ }), 58348
58349/***/ "./Static/javascript/helpers/disableTabbableChildren.ts": 58350/*!**************************************************************!*\ 58351 !*** ./Static/javascript/helpers/disableTabbableChildren.ts ***! 58352 \**************************************************************/ 58353/***/ ((__unused_webpack_module, exports) => { 58354 58355"use strict"; 58356 58357Object.defineProperty(exports, "__esModule", ({ value: true })); 58358exports.disableTabbableChildren = void 0; 58359function disableTabbableChildren(parent) { 58360 var tabbableChildren = [].slice.call(parent.querySelectorAll('a, button, input, select, textarea')); 58361 tabbableChildren.forEach(function (child) { 58362 child.tabIndex = -1; 58363 }); 58364} 58365exports.disableTabbableChildren = disableTabbableChildren; 58366 58367 58368/***/ }), 58369
58370/***/ "./Static/javascript/helpers/enableTabbableChildren.ts": 58371/*!*************************************************************!*\ 58372 !*** ./Static/javascript/helpers/enableTabbableChildren.ts ***! 58373 \*************************************************************/ 58374/***/ ((__unused_webpack_module, exports) => { 58375 58376"use strict"; 58377 58378Object.defineProperty(exports, "__esModule", ({ value: true })); 58379exports.enableTabbableChildren = void 0; 58380function enableTabbableChildren(parent) { 58381 var tabbableChildren = [].slice.call(parent.querySelectorAll('a, button, input, select, textarea')); 58382 tabbableChildren.forEach(function (child) { 58383 child.tabIndex = null; 58384 }); 58385} 58386exports.enableTabbableChildren = enableTabbableChildren; 58387 58388 58389/***/ }), 58390
58391/***/ "./Static/javascript/helpers/getHeightOfHidden.ts": 58392/*!********************************************************!*\ 58393 !*** ./Static/javascript/helpers/getHeightOfHidden.ts ***! 58394 \********************************************************/ 58395/***/ ((__unused_webpack_module, exports) => { 58396 58397"use strict"; 58398 58399Object.defineProperty(exports, "__esModule", ({ value: true })); 58400exports.getHeightOfHidden = void 0; 58401function getHeightOfHidden(element, calculateChildElement) { 58402 var el = element; 58403 var parentStyles = el.parentElement.getAttribute('style'); 58404 var selfStyles = el.getAttribute('style'); 58405 var elementHeight = calculateChildElement ? element.firstElementChild.offsetHeight : element.offsetHeight; 58406 el.parentElement.setAttribute('style', 'position: relative !important; width: 100% !important;'); 58407 el.setAttribute('style', 'opacity: 0 !important; height: auto !important; position: absolute !important;'); 58408 if (selfStyles) { 58409 el.setAttribute('style', selfStyles); 58410 } 58411 else { 58412 el.removeAttribute('style'); 58413 } 58414 if (parentStyles) { 58415 el.parentElement.setAttribute('style', parentStyles); 58416 } 58417 else { 58418 el.parentElement.removeAttribute('style'); 58419 } 58420 return elementHeight; 58421} 58422exports.getHeightOfHidden = getHeightOfHidden; 58423 58424 58425/***/ }), 58426
58427/***/ "./Static/javascript/helpers/lockBody.ts": 58428/*!***********************************************!*\ 58429 !*** ./Static/javascript/helpers/lockBody.ts ***! 58430 \***********************************************/ 58431/***/ ((__unused_webpack_module, exports) => { 58432 58433"use strict"; 58434 58435Object.defineProperty(exports, "__esModule", ({ value: true })); 58436exports.unlockBody = exports.lockBody = void 0; 58437function lockBody() { 58438 var bodyStyles = document.body.style.cssText; 58439 document.body.style.overflow = 'hidden'; 58440 return bodyStyles; 58441} 58442exports.lockBody = lockBody; 58443function unlockBody(oldStyles) { 58444 document.body.style.cssText = oldStyles || ''; 58445} 58446exports.unlockBody = unlockBody; 58447 58448 58449/***/ }), 58450
58451/***/ "./Static/javascript/index.ts": 58452/*!************************************!*\ 58453 !*** ./Static/javascript/index.ts ***! 58454 \************************************/ 58455/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 58456 58457"use strict"; 58458 58459var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 58460 if (k2 === undefined) k2 = k; 58461 var desc = Object.getOwnPropertyDescriptor(m, k); 58462 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 58463 desc = { enumerable: true, get: function() { return m[k]; } }; 58464 } 58465 Object.defineProperty(o, k2, desc); 58466}) : (function(o, m, k, k2) { 58467 if (k2 === undefined) k2 = k; 58468 o[k2] = m[k]; 58469})); 58470var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 58471 Object.defineProperty(o, "default", { enumerable: true, value: v }); 58472}) : function(o, v) { 58473 o["default"] = v; 58474}); 58475var __importStar = (this && this.__importStar) || function (mod) { 58476 if (mod && mod.__esModule) return mod; 58477 var result = {}; 58478 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 58479 __setModuleDefault(result, mod); 58480 return result; 58481}; 58482Object.defineProperty(exports, "__esModule", ({ value: true })); 58483var show_hide_password_1 = __webpack_require__(/*! ./modules/show-hide-password */ "./Static/javascript/modules/show-hide-password.ts"); 58484var svg_loader_1 = __webpack_require__(/*! ./modules/svg-loader */ "./Static/javascript/modules/svg-loader.ts"); 58485var revealPanel_1 = __webpack_require__(/*! ./modules/revealPanel */ "./Static/javascript/modules/revealPanel.ts"); 58486var accordion_1 = __webpack_require__(/*! ./modules/accordion */ "./Static/javascript/modules/accordion.ts"); 58487var tabs_1 = __webpack_require__(/*! ./modules/tabs */ "./Static/javascript/modules/tabs.ts"); 58488var mainNavigation_1 = __webpack_require__(/*! ./modules/mainNavigation */ "./Static/javascript/modules/mainNavigation.ts"); 58489var google_translate_1 = __webpack_require__(/*! ./modules/google-translate */ "./Static/javascript/modules/google-translate.ts"); 58490var YouTubeIframeLoader = __importStar(__webpack_require__(/*! youtube-iframe */ "./node_modules/youtube-iframe/index.js")); 58491__webpack_require__(/*! ./modules/promo-interface */ "./Static/javascript/modules/promo-interface.ts"); 58492__webpack_require__(/*! ./modules/sticky-sidebar-component */ "./Static/javascript/modules/sticky-sidebar-component.ts"); 58493var gallery_1 = __webpack_require__(/*! ./modules/gallery */ "./Static/javascript/modules/gallery.ts"); 58494var headerVideo_1 = __webpack_require__(/*! ./modules/headerVideo */ "./Static/javascript/modules/headerVideo.ts"); 58495var videoItem_1 = __webpack_require__(/*! ./modules/videoItem */ "./Static/javascript/modules/videoItem.ts"); 58496var debounce = __webpack_require__(/*! lodash.debounce */ "./node_modules/lodash.debounce/index.js"); 58497var alert_1 = __webpack_require__(/*! ./modules/alert */ "./Static/javascript/modules/alert.ts"); 58498var index_1 = __webpack_require__(/*! ./modules/filter/index */ "./Static/javascript/modules/filter/index.tsx"); 58499new svg_loader_1.SvgSprite('/Static/img/adage-sprite.svg'); 58500new google_translate_1.GoogleTranslate(); 58501(0, show_hide_password_1.showHidePassword)(); 58502var navigationInit = function () { 58503 if (mainNavigation_1.mainNavigation) 58504 mainNavigation_1.mainNavigation.init(); 58505 window.addEventListener('resize', debounce(function () { 58506 if (mainNavigation_1.mainNavigation) 58507 mainNavigation_1.mainNavigation.resizeHandler(); 58508 }, 50)); 58509}; 58510var initializeGenericComponents = function () { 58511 navigationInit(); 58512 var panels = [].slice.call(document.querySelectorAll('[data-panel]')); 58513 panels.forEach(function (panel) { 58514 new revealPanel_1.RevealPanel(panel); 58515 }); 58516 var accordions = [].slice.call(document.querySelectorAll('[data-accordion-list]')); 58517 accordions.forEach(function (accordionEl) { 58518 var oneOpenAtATime = accordionEl.getAttribute('data-one-open-at-a-time') == "true"; 58519 new accordion_1.Accordion({ container: accordionEl, oneOpenAtATime: oneOpenAtATime }); 58520 }); 58521 var tabEls = Array.prototype.slice.call(document.querySelectorAll('[data-tabs-container]'));
58522 tabEls.forEach(function (tabEl) { 58523 new tabs_1.Tabs({ container: tabEl }); 58524 }); 58525 // Gallery Init 58526 document.addEventListener('DOMContentLoaded', function () { 58527 var galleryClass = 'gallery'; 58528 var galleries = Array.prototype.slice.call(document.querySelectorAll('[data-gallery]')); 58529 galleries.forEach(function (gallery, index) { 58530 gallery.classList.add("".concat(galleryClass, "-").concat(index)); 58531 new gallery_1.Gallery(gallery); 58532 }); 58533 }); 58534 // Header videos 58535 var headerVideoContainers = Array.prototype.slice.call(document.querySelectorAll('[data-header-video-container]')); 58536 headerVideoContainers.forEach(function (HeaderVideoContainer) { 58537 new headerVideo_1.HeaderVideo(HeaderVideoContainer); 58538 }); 58539 // Videos 58540 var videoItems = Array.prototype.slice.call(document.querySelectorAll('[data-video-item]:not([data-video-type=youtube])')); 58541 var youtubeVideoItems = Array.prototype.slice.call(document.querySelectorAll('[data-video-item][data-video-type=youtube]')); 58542 videoItems.forEach(function (videoItem) { 58543 new videoItem_1.VideoItem(videoItem); 58544 }); 58545 YouTubeIframeLoader.load(function (YT) { 58546 youtubeVideoItems.forEach(function (youtubeVideoItem) { 58547 var iframe = youtubeVideoItem.querySelector('[data-youtube-id]'); 58548 var ytvideoPlayer = new YT.Player(iframe.getAttribute('id'), { 58549 height: '390', 58550 width: '640', 58551 videoId: iframe.getAttribute('data-youtube-id'), 58552 events: { 58553 onReady: function () { 58554 new videoItem_1.VideoItem(youtubeVideoItem, ytvideoPlayer); 58555 } 58556 } 58557 }); 58558 }); 58559 }); 58560 //Alert 58561 var alert = document.querySelector('#navContainer [data-alert]'); 58562 if (alert) 58563 new alert_1.Alert(alert); 58564 //Filter Block Init 58565 var filterBlockInit = function () { 58566 var filterBlocks = Array.from(document.querySelectorAll('[data-filter-block]')); 58567 if (filterBlocks.length > 0) { 58568 filterBlocks.forEach(function (filterBlock) { 58569 (0, index_1.FilterAppInit)(filterBlock); 58570 }); 58571 } 58572 }; 58573 filterBlockInit(); 58574 //Homepage overlay 58575 var overlay = document.querySelector('[data-home-overlay]'); 58576 if (overlay) 58577 document.documentElement.style.setProperty('--home-overlay-offset', "".concat(overlay.offsetHeight / 2, "px")); 58578}; 58579initializeGenericComponents(); 58580 58581 58582/***/ }), 58583
58584/***/ "./Static/javascript/modules/accordion.ts": 58585/*!************************************************!*\ 58586 !*** ./Static/javascript/modules/accordion.ts ***! 58587 \************************************************/ 58588/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 58589 58590"use strict"; 58591 58592Object.defineProperty(exports, "__esModule", ({ value: true })); 58593exports.Accordion = void 0; 58594var enableTabbableChildren_1 = __webpack_require__(/*! ../helpers/enableTabbableChildren */ "./Static/javascript/helpers/enableTabbableChildren.ts"); 58595var disableTabbableChildren_1 = __webpack_require__(/*! ../helpers/disableTabbableChildren */ "./Static/javascript/helpers/disableTabbableChildren.ts"); 58596var getHeightOfHidden_1 = __webpack_require__(/*! ../helpers/getHeightOfHidden */ "./Static/javascript/helpers/getHeightOfHidden.ts"); 58597var lodash_1 = __webpack_require__(/*! lodash */ "lodash"); 58598var Accordion = /** @class */ (function () { 58599 function Accordion(options) { 58600 var _this = this; 58601 this.options = { 58602 oneOpenAtATime: true 58603 }; 58604 (0, lodash_1.assign)(this.options, options); 58605 this.container = this.options.container; 58606 this.panels = [].slice.call(this.container.querySelectorAll('[role="region"]')); 58607 this.triggers = [].slice.call(this.container.querySelectorAll('[aria-controls]')); 58608 window.addEventListener('resize', (0, lodash_1.debounce)(function () { 58609 _this.setAccordionHeights(); 58610 }, 100)); 58611 this.container.addEventListener('keydown', this.handleKeydown.bind(this)); 58612 this.triggers.forEach(function (trigger) { 58613 trigger.addEventListener('click', _this.accordionClick.bind(_this)); 58614 }); 58615 this.panels.forEach(function (panel) { 58616 (0, disableTabbableChildren_1.disableTabbableChildren)(panel); 58617 }); 58618 setTimeout(function () { 58619 _this.setAccordionHeights(); 58620 }, 0); 58621 } 58622 Accordion.prototype.setAccordionPanelHeight = function (panel) { 58623 var panelHeight = (0, getHeightOfHidden_1.getHeightOfHidden)(panel, true); 58624 panel.style.height = "".concat(panelHeight, "px"); 58625 }; 58626 Accordion.prototype.setAccordionHeights = function () { 58627 var _this = this; 58628 this.panels.forEach(function (panel) { 58629 // override css styles so that we can capture the actual height of the collapsed panel 58630 _this.setAccordionPanelHeight(panel); 58631 }); 58632 }; 58633 Accordion.prototype.accordionClick = function (e) { 58634 this.activePanel = this.container.querySelector("#".concat(e.target.getAttribute('aria-controls'))); 58635 this.activeTrigger = e.target; 58636 this.setAccordionPanelHeight(this.activePanel); 58637 this.toggleActivePanel(); 58638 if (this.options.oneOpenAtATime) { 58639 this.closeInactivePanels(); 58640 } 58641 }; 58642 Accordion.prototype.toggleActivePanel = function () { 58643 if (this.activeTrigger.getAttribute('aria-expanded') === 'true') { 58644 this.closePanel(this.activeTrigger, this.activePanel); 58645 } 58646 else { 58647 this.openPanel(this.activeTrigger, this.activePanel); 58648 } 58649 if (this.options.oneOpenAtATime) { 58650 this.closeInactivePanels(); 58651 } 58652 }; 58653 Accordion.prototype.closeInactivePanels = function () { 58654 var _this = this; 58655 this.triggers.forEach(function (trigger) { 58656 if (trigger !== _this.activeTrigger) { 58657 var curPanel = _this.container.querySelector("#".concat(trigger.getAttribute('aria-controls'))); 58658 _this.closePanel(trigger, curPanel); 58659 } 58660 }); 58661 }; 58662 Accordion.prototype.openPanel = function (trigger, panel) { 58663 trigger.setAttribute('aria-expanded', 'true'); 58664 panel.setAttribute('aria-hidden', 'false'); 58665 (0, enableTabbableChildren_1.enableTabbableChildren)(panel); 58666 trigger.closest('li').classList.add('active'); 58667 }; 58668 Accordion.prototype.closePanel = function (trigger, panel) { 58669 trigger.setAttribute('aria-expanded', 'false'); 58670 panel.setAttribute('aria-hidden', 'true'); 58671 trigger.closest('li').classList.remove('active'); 58672 (0, disableTabbableChildren_1.disableTabbableChildren)(panel); 58673 }; 58674 Accordion.prototype.handleKeydown = function (e) { 58675 var _this = this; 58676 var key = e.which.toString(); 58677 var target = e.target; 58678 var ctrlModifier = (e.ctrlKey && key.match(/33|34/)); 58679 if (target.hasAttribute('aria-controls')) { 58680 if (key.match(/38|40/) || ctrlModifier) { 58681 var index = this.triggers.indexOf(target); 58682 var direction = (key.match(/34|40/)) ? 1 : -1; 58683 var length = this.triggers.length; 58684 var newIndex = (index + length + direction) % length; 58685 this.triggers[newIndex].focus(); 58686 e.preventDefault(); 58687 } 58688 else if (key.match(/35|36/)) { 58689 // 35 = End, 36 = Home keyboard operations 58690 switch (key) { 58691 // Go to first accordion 58692 case '36':
58693 this.triggers[0].focus(); 58694 break; 58695 // Go to last accordion 58696 case '35': 58697 this.triggers[this.triggers.length - 1].focus(); 58698 break; 58699 } 58700 e.preventDefault(); 58701 } 58702 } 58703 else if (ctrlModifier) { 58704 // Control + Page Up/ Page Down keyboard operations 58705 // Catches events that happen inside of panels 58706 this.panels.forEach(function (panel, index) { 58707 if (panel.contains(target)) { 58708 _this.triggers[index].focus(); 58709 e.preventDefault(); 58710 } 58711 }); 58712 } 58713 }; 58714 return Accordion; 58715}()); 58716exports.Accordion = Accordion; 58717 58718 58719/***/ }), 58720
58721/***/ "./Static/javascript/modules/alert.ts": 58722/*!********************************************!*\ 58723 !*** ./Static/javascript/modules/alert.ts ***! 58724 \********************************************/ 58725/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 58726 58727"use strict"; 58728 58729Object.defineProperty(exports, "__esModule", ({ value: true })); 58730exports.Alert = void 0; 58731var cookie_1 = __webpack_require__(/*! ../helpers/cookie */ "./Static/javascript/helpers/cookie.ts"); 58732var mainNavigation_1 = __webpack_require__(/*! ./mainNavigation */ "./Static/javascript/modules/mainNavigation.ts"); 58733var Alert = /** @class */ (function () { 58734 function Alert(alert) { 58735 var _this = this; 58736 this.cookieName = "alert_banner"; 58737 this.checkCookieAndSetVisibility = function () { 58738 if ((0, cookie_1.getCookie)(_this.cookieName) !== 'true') { 58739 _this.alert.classList.add('alert-display'); 58740 mainNavigation_1.mainNavigation.setCssVariables(); //Updates css variables 58741 } 58742 }; 58743 this.activateCloseButton = function () { 58744 var _a; 58745 (_a = _this.alert) === null || _a === void 0 ? void 0 : _a.querySelector('[data-close]').addEventListener('click', function () { 58746 _this.alert.setAttribute('hidden', 'true'); 58747 (0, cookie_1.setCookie)(_this.cookieName, "true", 1000); 58748 mainNavigation_1.mainNavigation.setCssVariables(); //Updates css variables 58749 }); 58750 }; 58751 this.alert = alert; 58752 this.checkCookieAndSetVisibility(); 58753 this.activateCloseButton(); 58754 } 58755 return Alert; 58756}()); 58757exports.Alert = Alert; 58758 58759 58760/***/ }), 58761
58762/***/ "./Static/javascript/modules/filter/common/loadingSpinner.tsx": 58763/*!********************************************************************!*\ 58764 !*** ./Static/javascript/modules/filter/common/loadingSpinner.tsx ***! 58765 \********************************************************************/ 58766/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 58767 58768"use strict"; 58769 58770var __assign = (this && this.__assign) || function () { 58771 __assign = Object.assign || function(t) { 58772 for (var s, i = 1, n = arguments.length; i < n; i++) { 58773 s = arguments[i]; 58774 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 58775 t[p] = s[p]; 58776 } 58777 return t; 58778 }; 58779 return __assign.apply(this, arguments); 58780}; 58781var __importDefault = (this && this.__importDefault) || function (mod) { 58782 return (mod && mod.__esModule) ? mod : { "default": mod }; 58783}; 58784Object.defineProperty(exports, "__esModule", ({ value: true })); 58785exports.LoadingSpinner = void 0; 58786var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); 58787var react_1 = __importDefault(__webpack_require__(/*! react */ "./node_modules/react/index.js")); 58788function LoadingSpinner() { 58789 return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "loader-small" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "loader" }, { children: (0, jsx_runtime_1.jsx)("span", __assign({ className: "visually-hidden" }, { children: "loading" })) })) }))); 58790} 58791exports.LoadingSpinner = LoadingSpinner; 58792 58793 58794/***/ }), 58795
58796/***/ "./Static/javascript/modules/filter/common/pagination.tsx": 58797/*!****************************************************************!*\ 58798 !*** ./Static/javascript/modules/filter/common/pagination.tsx ***! 58799 \****************************************************************/ 58800/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 58801 58802"use strict"; 58803 58804var __assign = (this && this.__assign) || function () { 58805 __assign = Object.assign || function(t) { 58806 for (var s, i = 1, n = arguments.length; i < n; i++) { 58807 s = arguments[i]; 58808 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 58809 t[p] = s[p]; 58810 } 58811 return t; 58812 }; 58813 return __assign.apply(this, arguments); 58814}; 58815var __importDefault = (this && this.__importDefault) || function (mod) { 58816 return (mod && mod.__esModule) ? mod : { "default": mod }; 58817}; 58818Object.defineProperty(exports, "__esModule", ({ value: true })); 58819var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); 58820var react_1 = __importDefault(__webpack_require__(/*! react */ "./node_modules/react/index.js")); 58821var usePagination_1 = __webpack_require__(/*! ../utils/usePagination */ "./Static/javascript/modules/filter/utils/usePagination.tsx"); 58822var hooks_1 = __webpack_require__(/*! ../redux/hooks */ "./Static/javascript/modules/filter/redux/hooks.ts"); 58823var Pagination = function (props) { 58824 var appContainer = (0, hooks_1.useAppSelector)(function (state) { return state.pageSettings.appId; }); 58825 var onPageChange = props.onPageChange, totalCount = props.totalCount, siblingCount = props.siblingCount, currentPage = props.currentPage, pageSize = props.pageSize; 58826 var paginationRange = (0, usePagination_1.usePagination)({ currentPage: currentPage, totalCount: totalCount, siblingCount: siblingCount, pageSize: pageSize }); 58827 if (currentPage === 0 || paginationRange.length < 2) { 58828 return null; 58829 } 58830 var scrollUp = function () { 58831 document.querySelector("[data-app-id=\"".concat(appContainer, "\"]")).scrollIntoView(({ behavior: "smooth", block: "start" })); 58832 }; 58833 var onNext = function (disabled) { 58834 if (disabled === void 0) { disabled = false; } 58835 if (disabled) 58836 return; 58837 scrollUp(); 58838 onPageChange(currentPage + 1); 58839 }; 58840 var onPrevious = function (disabled) { 58841 if (disabled === void 0) { disabled = false; } 58842 if (disabled) 58843 return; 58844 scrollUp(); 58845 onPageChange(currentPage - 1); 58846 }; 58847 var handlePageChange = function (pageNumber) { 58848 scrollUp(); 58849 onPageChange(pageNumber); 58850 }; 58851 var dotsCount = 0; 58852 var lastPage = paginationRange[paginationRange.length - 1]; 58853 return ((0, jsx_runtime_1.jsxs)("ul", __assign({ className: "filter-block-pagination-container space-top-xl" }, { children: [(0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)("button", __assign({ type: 'button', className: "filter-block-pagination-button un-button pagination-button-left ".concat((currentPage === 1 ? 'disabled' : '')), onClick: function () { return onPrevious(currentPage === 1); }, disabled: currentPage === 1, "data-testid": 'arrow-left' }, { children: [(0, jsx_runtime_1.jsx)("svg", __assign({ className: "svg-icon" }, { children: (0, jsx_runtime_1.jsx)("use", { xmlnsXlink: "http://www.w3.org/1999/xlink", xlinkHref: "#arrow-left" }) })), (0, jsx_runtime_1.jsx)("span", __assign({ className: "filter-block-pagination-label" }, { children: "Previous" }))] })) }), paginationRange.map(function (pageNumber) { 58854 if (pageNumber === usePagination_1.DOTS) { 58855 return (0, jsx_runtime_1.jsx)("li", __assign({ className: "pagination-item dots" }, { children: "\u2026" }), pageNumber + ++dotsCount); 58856 } 58857 // Pages 58858 return ((0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsx)("button", __assign({ type: 'button', className: "filter-block-pagination-item un-button ".concat((pageNumber === currentPage ? 'selected' : '')), onClick: function () { return handlePageChange(pageNumber); } }, { children: pageNumber })) }, pageNumber)); 58859 }), (0, jsx_runtime_1.jsx)("li", { children: (0, jsx_runtime_1.jsxs)("button", __assign({ type: 'button', className: "filter-block-pagination-button un-button pagination-button-right ".concat((currentPage === lastPage ? 'disabled' : '')), onClick: function () { return onNext(currentPage === lastPage); }, disabled: currentPage === lastPage, "data-testid": 'arrow-right' }, { children: [(0, jsx_runtime_1.jsx)("span", __assign({ className: "filter-block-pagination-label" }, { children: "Next" })), (0, jsx_runtime_1.jsx)("svg", __assign({ className: "svg-icon" }, { children: (0, jsx_runtime_1.jsx)("use", { xmlnsXlink: "http://www.w3.org/1999/xlink", xl
58859inkHref: "#arrow-right" }) }))] })) })] }))); 58860}; 58861exports["default"] = Pagination; 58862 58863 58864/***/ }), 58865
58866/***/ "./Static/javascript/modules/filter/components/App.tsx": 58867/*!*************************************************************!*\ 58868 !*** ./Static/javascript/modules/filter/components/App.tsx ***! 58869 \*************************************************************/ 58870/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 58871 58872"use strict"; 58873 58874var __assign = (this && this.__assign) || function () { 58875 __assign = Object.assign || function(t) { 58876 for (var s, i = 1, n = arguments.length; i < n; i++) { 58877 s = arguments[i]; 58878 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 58879 t[p] = s[p]; 58880 } 58881 return t; 58882 }; 58883 return __assign.apply(this, arguments); 58884}; 58885var __importDefault = (this && this.__importDefault) || function (mod) { 58886 return (mod && mod.__esModule) ? mod : { "default": mod }; 58887}; 58888Object.defineProperty(exports, "__esModule", ({ value: true })); 58889var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); 58890var react_1 = __importDefault(__webpack_require__(/*! react */ "./node_modules/react/index.js")); 58891var Container_1 = __importDefault(__webpack_require__(/*! ./Container */ "./Static/javascript/modules/filter/components/Container.tsx")); 58892var pageContext_1 = __importDefault(__webpack_require__(/*! ../utils/pageContext */ "./Static/javascript/modules/filter/utils/pageContext.tsx")); 58893function App(_a) { 58894 var pageId = _a.pageId; 58895 return ((0, jsx_runtime_1.jsx)(pageContext_1.default.Provider, __assign({ value: { pageId: pageId } }, { children: (0, jsx_runtime_1.jsx)(Container_1.default, {}) }))); 58896} 58897exports["default"] = App; 58898 58899 58900/***/ }), 58901
58902/***/ "./Static/javascript/modules/filter/components/Container.tsx": 58903/*!*******************************************************************!*\ 58904 !*** ./Static/javascript/modules/filter/components/Container.tsx ***! 58905 \*******************************************************************/ 58906/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 58907 58908"use strict"; 58909 58910var __assign = (this && this.__assign) || function () { 58911 __assign = Object.assign || function(t) { 58912 for (var s, i = 1, n = arguments.length; i < n; i++) { 58913 s = arguments[i]; 58914 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 58915 t[p] = s[p]; 58916 } 58917 return t; 58918 }; 58919 return __assign.apply(this, arguments); 58920}; 58921var __importDefault = (this && this.__importDefault) || function (mod) { 58922 return (mod && mod.__esModule) ? mod : { "default": mod }; 58923}; 58924Object.defineProperty(exports, "__esModule", ({ value: true })); 58925var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); 58926var react_1 = __importDefault(__webpack_require__(/*! react */ "./node_modules/react/index.js")); 58927var FiltersContainer_1 = __importDefault(__webpack_require__(/*! ./FiltersContainer */ "./Static/javascript/modules/filter/components/FiltersContainer.tsx")); 58928var Results_1 = __importDefault(__webpack_require__(/*! ./Results */ "./Static/javascript/modules/filter/components/Results.tsx")); 58929function Container() { 58930 return ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "space-top-xl" }, { children: [(0, jsx_runtime_1.jsx)(FiltersContainer_1.default, {}), (0, jsx_runtime_1.jsx)(Results_1.default, {})] }))); 58931} 58932exports["default"] = Container; 58933 58934 58935/***/ }), 58936
58937/***/ "./Static/javascript/modules/filter/components/Filters.tsx": 58938/*!*****************************************************************!*\ 58939 !*** ./Static/javascript/modules/filter/components/Filters.tsx ***! 58940 \*****************************************************************/ 58941/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 58942 58943"use strict"; 58944 58945var __assign = (this && this.__assign) || function () { 58946 __assign = Object.assign || function(t) { 58947 for (var s, i = 1, n = arguments.length; i < n; i++) { 58948 s = arguments[i]; 58949 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 58950 t[p] = s[p]; 58951 } 58952 return t; 58953 }; 58954 return __assign.apply(this, arguments); 58955}; 58956var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 58957 if (k2 === undefined) k2 = k; 58958 var desc = Object.getOwnPropertyDescriptor(m, k); 58959 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 58960 desc = { enumerable: true, get: function() { return m[k]; } }; 58961 } 58962 Object.defineProperty(o, k2, desc); 58963}) : (function(o, m, k, k2) { 58964 if (k2 === undefined) k2 = k; 58965 o[k2] = m[k]; 58966})); 58967var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 58968 Object.defineProperty(o, "default", { enumerable: true, value: v }); 58969}) : function(o, v) { 58970 o["default"] = v; 58971}); 58972var __importStar = (this && this.__importStar) || function (mod) { 58973 if (mod && mod.__esModule) return mod; 58974 var result = {}; 58975 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 58976 __setModuleDefault(result, mod); 58977 return result; 58978}; 58979Object.defineProperty(exports, "__esModule", ({ value: true })); 58980var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); 58981var react_1 = __importStar(__webpack_require__(/*! react */ "./node_modules/react/index.js")); 58982var hooks_1 = __webpack_require__(/*! ../redux/hooks */ "./Static/javascript/modules/filter/redux/hooks.ts"); 58983var filter_slice_1 = __webpack_require__(/*! ../redux/filter/filter-slice */ "./Static/javascript/modules/filter/redux/filter/filter-slice.ts"); 58984var page_settings_slice_1 = __webpack_require__(/*! ../redux/settings/page-settings-slice */ "./Static/javascript/modules/filter/redux/settings/page-settings-slice.ts"); 58985function Filters(filter, index) { 58986 var dispatch = (0, hooks_1.useAppDispatch)(); 58987 var initialSelectedValue = (0, hooks_1.useAppSelector)(function (state) { return state.filterState[filter.item.name.toLowerCase()]; }); 58988 var _a = (0, react_1.useState)(initialSelectedValue), selectedValue = _a[0], setSelectedValue = _a[1]; 58989 var rabbiState = (0, hooks_1.useAppSelector)(function (state) { return state.filterState.rabbi; }); 58990 var yearState = (0, hooks_1.useAppSelector)(function (state) { return state.filterState.year; }); 58991 var tagState = (0, hooks_1.useAppSelector)(function (state) { return state.filterState.tags; }); 58992 var handleFilterChange = function (e) { 58993 setSelectedValue(e.target.value); 58994 dispatch((0, page_settings_slice_1.setCurrentPage)(1)); 58995 dispatch((0, filter_slice_1.updateFilter)({ filterName: item.name.toLowerCase(), filterValue: e.target.value })); 58996 }; 58997 var item = filter.item; 58998 var _b = (0, hooks_1.useAppSelector)(function (state) { return state.pageSettings; }), tags = _b.tags, year = _b.year, rabbi = _b.rabbi; 58999 var filterLabels = { 59000 "Tags": tags, 59001 "Year": year, 59002 "Rabbi": rabbi 59003 }; 59004 var filterLabel = filterLabels[item.name] || "Filter"; 59005 (0, react_1.useEffect)(function () { 59006 setSelectedValue(initialSelectedValue); 59007 }, [rabbiState, yearState, tagState, initialSelectedValue]); 59008 return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "filter" }, { children: [(0, jsx_runtime_1.jsx)("label", { children: filterLabel }), (0, jsx_runtime_1.jsxs)("select", __assign({ value: selectedValue, onChange: handleFilterChange }, { children: [(0, jsx_runtime_1.jsx)("option", __assign({ value: "" }, { children: "Select a filter" })), item.values.map(function (value) { return ((0, jsx_runtime_1.jsx)("option", __assign({ value: value }, { children: value }), value)); })] }))] }), index) })); 59009} 59010exports["default"] = Filters; 59011 59012 59013/***/ }), 59014
59015/***/ "./Static/javascript/modules/filter/components/FiltersContainer.tsx": 59016/*!**************************************************************************!*\ 59017 !*** ./Static/javascript/modules/filter/components/FiltersContainer.tsx ***! 59018 \**************************************************************************/ 59019/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 59020 59021"use strict"; 59022 59023var __assign = (this && this.__assign) || function () { 59024 __assign = Object.assign || function(t) { 59025 for (var s, i = 1, n = arguments.length; i < n; i++) { 59026 s = arguments[i]; 59027 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 59028 t[p] = s[p]; 59029 } 59030 return t; 59031 }; 59032 return __assign.apply(this, arguments); 59033}; 59034var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 59035 if (k2 === undefined) k2 = k; 59036 var desc = Object.getOwnPropertyDescriptor(m, k); 59037 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 59038 desc = { enumerable: true, get: function() { return m[k]; } }; 59039 } 59040 Object.defineProperty(o, k2, desc); 59041}) : (function(o, m, k, k2) { 59042 if (k2 === undefined) k2 = k; 59043 o[k2] = m[k]; 59044})); 59045var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 59046 Object.defineProperty(o, "default", { enumerable: true, value: v }); 59047}) : function(o, v) { 59048 o["default"] = v; 59049}); 59050var __importStar = (this && this.__importStar) || function (mod) { 59051 if (mod && mod.__esModule) return mod; 59052 var result = {}; 59053 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 59054 __setModuleDefault(result, mod); 59055 return result; 59056}; 59057var __importDefault = (this && this.__importDefault) || function (mod) { 59058 return (mod && mod.__esModule) ? mod : { "default": mod }; 59059}; 59060Object.defineProperty(exports, "__esModule", ({ value: true })); 59061var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); 59062var react_1 = __importStar(__webpack_require__(/*! react */ "./node_modules/react/index.js")); 59063var hooks_1 = __webpack_require__(/*! ../redux/hooks */ "./Static/javascript/modules/filter/redux/hooks.ts"); 59064var filter_slice_1 = __webpack_require__(/*! ../redux/filter/filter-slice */ "./Static/javascript/modules/filter/redux/filter/filter-slice.ts"); 59065var page_settings_slice_1 = __webpack_require__(/*! ../redux/settings/page-settings-slice */ "./Static/javascript/modules/filter/redux/settings/page-settings-slice.ts"); 59066var api_slice_1 = __webpack_require__(/*! ../redux/api-slice */ "./Static/javascript/modules/filter/redux/api-slice.ts"); 59067var lodash_1 = __webpack_require__(/*! lodash */ "lodash"); 59068var react_a11y_dialog_1 = __webpack_require__(/*! react-a11y-dialog */ "./node_modules/react-a11y-dialog/dist/index.js"); 59069var Filters_1 = __importDefault(__webpack_require__(/*! ./Filters */ "./Static/javascript/modules/filter/components/Filters.tsx")); 59070function FiltersContainer() { 59071 var _a = (0, api_slice_1.useGetFilterCategoriesQuery)(null), _b = _a.data, data = _b === void 0 ? [] : _b, isFetching = _a.isFetching; 59072 var dispatch = (0, hooks_1.useAppDispatch)(); 59073 var filterModal = (0, react_1.useRef)(); 59074 var searchTerm = (0, hooks_1.useAppSelector)(function (state) { return state.filterState.query; }); 59075 var searchRef = (0, react_1.useRef)(); 59076 var filterContainerRef = (0, react_1.useRef)(); 59077 var clearFiltersLabel = (0, hooks_1.useAppSelector)(function (state) { return state.pageSettings.clearFiltersLabel; }); 59078 var searchLabel = (0, hooks_1.useAppSelector)(function (state) { return state.pageSettings.searchLabel; }); 59079 var updateFiltersBasedOnViewPort = function () { 59080 if (window.matchMedia("(max-width: 767px)").matches) { 59081 return false; 59082 } 59083 return true; 59084 }; 59085 var _c = (0, react_1.useState)(updateFiltersBasedOnViewPort()), visibleMobileFilters = _c[0], setVisibleMobileFilters = _c[1]; 59086 var handleFilterDisplay = function () { 59087 if (updateFiltersBasedOnViewPort() === true) { 59088 setVisibleMobileFilters(false); 59089 } 59090 else { 59091 setVisibleMobileFilters(true); 59092 } 59093 };
59094 var handleSearch = function (e) { return dispatch((0, filter_slice_1.setKeyword)(e.target.parentElement.querySelector('input').value)); }; 59095 var clearFilters = function () { 59096 dispatch((0, filter_slice_1.clearAllFilters)()); 59097 searchRef.current.value = ''; 59098 var selectList = filterContainerRef.current ? filterContainerRef.current.querySelectorAll('select') : []; 59099 selectList.forEach(function (select) { 59100 select.value = ""; 59101 }); 59102 }; 59103 var modalClasses = { 59104 container: 'dialog-container', overlay: 'dialog-overlay', dialog: 'dialog-content filter-block-dialog-content', title: 'h3-style', closeButton: 'hide' 59105 }; 59106 window.addEventListener('resize', (0, lodash_1.debounce)(function () { 59107 handleFilterDisplay(); 59108 }, 50)); 59109 (0, react_1.useEffect)(function () { 59110 handleFilterDisplay(); 59111 dispatch((0, page_settings_slice_1.setCurrentPage)(1)); 59112 if (searchRef.current) { 59113 searchRef.current.addEventListener('keydown', function (e) { 59114 if (e.key === 'Enter') { 59115 handleSearch(e); 59116 } 59117 }); 59118 } 59119 }, [data.length, searchTerm]); 59120 return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !isFetching && 59121 (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !visibleMobileFilters ? 59122 (0, jsx_runtime_1.jsxs)("div", __assign({ className: "filter-block-filters-container" }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "filter-block-filters", ref: filterContainerRef }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "filter-block-filter" }, { children: [(0, jsx_runtime_1.jsxs)("label", { children: [" ", searchLabel] }), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "filter-block-search-container" }, { children: [(0, jsx_runtime_1.jsx)("input", { className: "filter-block-search", type: "text", placeholder: "Search", ref: searchRef }), (0, jsx_runtime_1.jsx)("button", { type: "button", className: "filter-block-search-button un-button", onClick: handleSearch })] }))] })), data.length > 0 && 59123 data.map(function (item, index) { return ((0, jsx_runtime_1.jsx)(Filters_1.default, { item: item, index: index }, index)); })] })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "flex-between flex-wrap" }, { children: (0, jsx_runtime_1.jsxs)("button", __assign({ className: "btn-secondary", type: "button", onClick: clearFilters }, { children: [" ", clearFiltersLabel, " "] })) }))] })) 59124 : 59125 (0, jsx_runtime_1.jsxs)("div", __assign({ className: "filter-block-filters" }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "filter-block-filter" }, { children: [(0, jsx_runtime_1.jsxs)("label", { children: [" ", searchLabel, " "] }), (0, jsx_runtime_1.jsx)("input", { className: "filter-block-search", type: "text", placeholder: "Search", ref: searchRef })] })), (0, jsx_runtime_1.jsxs)(react_a11y_dialog_1.A11yDialog, __assign({ classNames: modalClasses, id: "sermon_filters_modal", title: "Filters", dialogRef: function (instance) { return (filterModal.current = instance); } }, { children: [(0, jsx_runtime_1.jsx)("button", __assign({ type: "button", className: "dialog-close un-button hyperlink label small", "aria-label": "close modal", onClick: function () { 59126 var _a; 59127 document.body.classList.remove('modal-open'); 59128 (_a = filterModal.current) === null || _a === void 0 ? void 0 : _a.hide(); 59129 } }, { children: "Close" })), data.length > 0 && 59130 data.map(function (item, index) { return ((0, jsx_runtime_1.jsx)(Filters_1.default, { item: item, index: index }, index)); }), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "filter-block-filters space-top-lg" }, { children: [(0, jsx_runtime_1.jsx)("button", __assign({ type: "button", className: "btn-primary", "aria-label": "close modal", onClick: function () { 59131 var _a; 59132 document.body.classList.remove('modal-open'); 59133 (_a = filterModal.current) === null || _a === void 0 ? void 0 : _a.hide(); 59134 } }, { children: " View Results" })), (0, jsx_runtime_1.jsxs)("button", __assign({ className: "btn-secondary", type: "button", onClick: clearFilters }, { children: [" ", clearFiltersLabel, " "] }))] }))] })), (0, jsx_runtime_1.jsx)("button", __assign({ type: "button", className: "btn-secondary", onClick: function () { 59135 var _a; 59136 document.body.classList.add('modal-open'); 59137 (_a = filterModal.current) === null || _a === void 0 ? void 0 : _a.show(); 59138 } }, { children: " Open Filters" }))] })) }) })); 59139} 59140exports["default"] = FiltersContainer; 59141 59142 59143/***/ }), 59144
59145/***/ "./Static/javascript/modules/filter/components/Results.tsx": 59146/*!*****************************************************************!*\ 59147 !*** ./Static/javascript/modules/filter/components/Results.tsx ***! 59148 \*****************************************************************/ 59149/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 59150 59151"use strict"; 59152 59153var __assign = (this && this.__assign) || function () { 59154 __assign = Object.assign || function(t) { 59155 for (var s, i = 1, n = arguments.length; i < n; i++) { 59156 s = arguments[i]; 59157 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 59158 t[p] = s[p]; 59159 } 59160 return t; 59161 }; 59162 return __assign.apply(this, arguments); 59163}; 59164var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 59165 if (k2 === undefined) k2 = k; 59166 var desc = Object.getOwnPropertyDescriptor(m, k); 59167 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 59168 desc = { enumerable: true, get: function() { return m[k]; } }; 59169 } 59170 Object.defineProperty(o, k2, desc); 59171}) : (function(o, m, k, k2) { 59172 if (k2 === undefined) k2 = k; 59173 o[k2] = m[k]; 59174})); 59175var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 59176 Object.defineProperty(o, "default", { enumerable: true, value: v }); 59177}) : function(o, v) { 59178 o["default"] = v; 59179}); 59180var __importStar = (this && this.__importStar) || function (mod) { 59181 if (mod && mod.__esModule) return mod; 59182 var result = {}; 59183 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 59184 __setModuleDefault(result, mod); 59185 return result; 59186}; 59187var __importDefault = (this && this.__importDefault) || function (mod) { 59188 return (mod && mod.__esModule) ? mod : { "default": mod }; 59189}; 59190Object.defineProperty(exports, "__esModule", ({ value: true })); 59191var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); 59192var react_1 = __importStar(__webpack_require__(/*! react */ "./node_modules/react/index.js")); 59193var pagination_1 = __importDefault(__webpack_require__(/*! ../common/pagination */ "./Static/javascript/modules/filter/common/pagination.tsx")); 59194var loadingSpinner_1 = __webpack_require__(/*! ../common/loadingSpinner */ "./Static/javascript/modules/filter/common/loadingSpinner.tsx"); 59195var Sermon_1 = __importDefault(__webpack_require__(/*! ../components/Sermon */ "./Static/javascript/modules/filter/components/Sermon.tsx")); 59196var hooks_1 = __webpack_require__(/*! ../redux/hooks */ "./Static/javascript/modules/filter/redux/hooks.ts"); 59197var api_slice_1 = __webpack_require__(/*! ../redux/api-slice */ "./Static/javascript/modules/filter/redux/api-slice.ts"); 59198var page_settings_slice_1 = __webpack_require__(/*! ../redux/settings/page-settings-slice */ "./Static/javascript/modules/filter/redux/settings/page-settings-slice.ts"); 59199function Results() { 59200 var dispatch = (0, hooks_1.useAppDispatch)(); 59201 var pageSize = (0, hooks_1.useAppSelector)(function (state) { return state.pageSettings.perPage; }); 59202 var currentPage = (0, hooks_1.useAppSelector)(function (state) { return state.pageSettings.currentPage; }); 59203 var tags = (0, hooks_1.useAppSelector)(function (state) { return state.filterState.tags; }); 59204 var keyword = (0, hooks_1.useAppSelector)(function (state) { return state.filterState.query; }); 59205 var year = (0, hooks_1.useAppSelector)(function (state) { return state.filterState.year; }); 59206 var rabbi = (0, hooks_1.useAppSelector)(function (state) { return state.filterState.rabbi; }); 59207 var noResults = (0, hooks_1.useAppSelector)(function (state) { return state.pageSettings.noResultsMsg; }); 59208 var _a = (0, react_1.useState)([]), results = _a[0], setResults = _a[1]; 59209 var _b = (0, api_slice_1.useGetSermonsQuery)({ keyword: keyword, rabbi: rabbi, year: year, tags: tags, currentPage: currentPage, pageSize: pageSize }), _c = _b.data, data = _c === void 0 ? [] : _c, isFetching = _b.isFetching; 59210 var _d = (0, react_1.useState)(0), totalResults = _d[0], setTotalResults = _d[1]; 59211 var paginatedData = []; 59212 var getResults = (function (useMemo) { 59213 if (data.results) { 59214 var paginatedData_1 = data.results; 59215 setTotalResults(data.totalResults); 59216 var firstPageIndex = (currentPage - 1) * pageSize; 59217 var lastPageIndex = firstPageIndex + pageSize; 59218 return paginatedData_1.slice(firstPageIndex, lastPageIndex); 59219 } 59220 }); 59221 (0, react_1.useEffect)(function () { 59222 setResults(getResults); 59223 }, [paginatedData.length, keyword, year, rabbi, tags, currentPage, isFetching]); 59224 return ((0, jsx_runtime_1.jsx)("div", __assign({ id: "SermonContainer", className: "space-top-lg" }, { children: isFetching ? (0, jsx_runtime_1.jsx)(loadingSpinner_1.LoadingSpinner, {}) : 59225 (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !data.error ? 59226 (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: results && results.length > 0 ? 59227 (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: "grid grid-eq-4" }, { children: results && results.map(function (item, index) { return ((0, jsx_runtime_1.jsx)(Sermon_1.default, { sermon: item }, index)); }) })), (0, jsx_runtime_1.jsx)(pagination_1.default, { className: "pagination-bar", currentPage: currentPage, totalCount: totalResults, pageSize: pageSize, onPageChange: function (page) { return dis
59227patch((0, page_settings_slice_1.setCurrentPage)(page)); } })] }) 59228 : (0, jsx_runtime_1.jsx)("div", { dangerouslySetInnerHTML: { __html: noResults } }) }) 59229 : (0, jsx_runtime_1.jsx)("h2", __assign({ className: "h3-style" }, { children: " An error occurred." })) }) }))); 59230} 59231exports["default"] = Results; 59232 59233 59234/***/ }), 59235
59236/***/ "./Static/javascript/modules/filter/components/Sermon.tsx": 59237/*!****************************************************************!*\ 59238 !*** ./Static/javascript/modules/filter/components/Sermon.tsx ***! 59239 \****************************************************************/ 59240/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 59241 59242"use strict"; 59243 59244var __assign = (this && this.__assign) || function () { 59245 __assign = Object.assign || function(t) { 59246 for (var s, i = 1, n = arguments.length; i < n; i++) { 59247 s = arguments[i]; 59248 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 59249 t[p] = s[p]; 59250 } 59251 return t; 59252 }; 59253 return __assign.apply(this, arguments); 59254}; 59255var __importDefault = (this && this.__importDefault) || function (mod) { 59256 return (mod && mod.__esModule) ? mod : { "default": mod }; 59257}; 59258Object.defineProperty(exports, "__esModule", ({ value: true })); 59259var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); 59260var react_1 = __importDefault(__webpack_require__(/*! react */ "./node_modules/react/index.js")); 59261function Sermon(result) { 59262 var sermon = result.sermon; 59263 return ((0, jsx_runtime_1.jsxs)("article", __assign({ className: "sermon stack-md" }, { children: [(0, jsx_runtime_1.jsx)("img", { src: sermon.image, alt: sermon.title }), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "stack-sm" }, { children: [(0, jsx_runtime_1.jsx)("p", __assign({ className: "h6-style" }, { children: sermon.date })), (0, jsx_runtime_1.jsx)("h2", __assign({ className: "h5-style" }, { children: sermon.title })), (0, jsx_runtime_1.jsx)("div", { className: "rich-text", dangerouslySetInnerHTML: { __html: sermon.description } }), (0, jsx_runtime_1.jsx)("div", __assign({ className: "sermon-cta" }, { children: (0, jsx_runtime_1.jsx)("a", __assign({ href: sermon.url, target: "_blank", className: "arrow-link-secondary space-top-md" }, { children: sermon.detailLinkText })) }))] }))] }))); 59264} 59265exports["default"] = Sermon; 59266 59267 59268/***/ }), 59269
59270/***/ "./Static/javascript/modules/filter/index.tsx": 59271/*!****************************************************!*\ 59272 !*** ./Static/javascript/modules/filter/index.tsx ***! 59273 \****************************************************/ 59274/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 59275 59276"use strict"; 59277 59278var __assign = (this && this.__assign) || function () { 59279 __assign = Object.assign || function(t) { 59280 for (var s, i = 1, n = arguments.length; i < n; i++) { 59281 s = arguments[i]; 59282 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 59283 t[p] = s[p]; 59284 } 59285 return t; 59286 }; 59287 return __assign.apply(this, arguments); 59288}; 59289var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 59290 if (k2 === undefined) k2 = k; 59291 var desc = Object.getOwnPropertyDescriptor(m, k); 59292 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 59293 desc = { enumerable: true, get: function() { return m[k]; } }; 59294 } 59295 Object.defineProperty(o, k2, desc); 59296}) : (function(o, m, k, k2) { 59297 if (k2 === undefined) k2 = k; 59298 o[k2] = m[k]; 59299})); 59300var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 59301 Object.defineProperty(o, "default", { enumerable: true, value: v }); 59302}) : function(o, v) { 59303 o["default"] = v; 59304}); 59305var __importStar = (this && this.__importStar) || function (mod) { 59306 if (mod && mod.__esModule) return mod; 59307 var result = {}; 59308 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 59309 __setModuleDefault(result, mod); 59310 return result; 59311}; 59312var __importDefault = (this && this.__importDefault) || function (mod) { 59313 return (mod && mod.__esModule) ? mod : { "default": mod }; 59314}; 59315Object.defineProperty(exports, "__esModule", ({ value: true })); 59316exports.FilterAppInit = void 0; 59317var jsx_runtime_1 = __webpack_require__(/*! react/jsx-runtime */ "./node_modules/react/jsx-runtime.js"); 59318var React = __importStar(__webpack_require__(/*! react */ "./node_modules/react/index.js")); 59319var client_1 = __webpack_require__(/*! react-dom/client */ "./node_modules/react-dom/client.js"); 59320var react_redux_1 = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/es/index.js"); 59321var App_1 = __importDefault(__webpack_require__(/*! ./components/App */ "./Static/javascript/modules/filter/components/App.tsx")); 59322var store_1 = __webpack_require__(/*! ./redux/store */ "./Static/javascript/modules/filter/redux/store.ts"); 59323function FilterAppInit(rootElement) { 59324 var root = (0, client_1.createRoot)(rootElement); 59325 root.render((0, jsx_runtime_1.jsx)(React.StrictMode, { children: (0, jsx_runtime_1.jsx)(react_redux_1.Provider, __assign({ store: store_1.store }, { children: (0, jsx_runtime_1.jsx)(App_1.default, { pageId: rootElement.getAttribute("data-page-id") }) })) })); 59326} 59327exports.FilterAppInit = FilterAppInit; 59328 59329 59330/***/ }), 59331
59332/***/ "./Static/javascript/modules/filter/redux/api-slice.ts": 59333/*!*************************************************************!*\ 59334 !*** ./Static/javascript/modules/filter/redux/api-slice.ts ***! 59335 \*************************************************************/ 59336/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 59337 59338"use strict"; 59339 59340Object.defineProperty(exports, "__esModule", ({ value: true })); 59341exports.useGetFilterCategoriesQuery = exports.useGetSermonsQuery = exports.apiSlice = void 0; 59342var react_1 = __webpack_require__(/*! @reduxjs/toolkit/query/react */ "./node_modules/@reduxjs/toolkit/dist/query/react/rtk-query-react.esm.js"); 59343exports.apiSlice = (0, react_1.createApi)({ 59344 reducerPath: 'api', 59345 baseQuery: (0, react_1.fetchBaseQuery)({ 59346 baseUrl: '/pas-api/sermons', 59347 }), 59348 endpoints: function (builder) { 59349 return { 59350 getSermons: builder.query({ 59351 query: function (args) { 59352 var keyword = args.keyword, rabbi = args.rabbi, year = args.year, tags = args.tags, currentPage = args.currentPage, pageSize = args.pageSize; 59353 return { 59354 url: "/GetSermons?Keyword=".concat(keyword, "&rabbi=").concat(rabbi, "&Year=").concat(year, "&Tag=").concat(tags, "&page=").concat(currentPage, "&pageSize=").concat(pageSize) 59355 }; 59356 }, 59357 }), 59358 getFilterCategories: builder.query({ 59359 query: function (args) { 59360 return { 59361 url: "/GetFilterCategories" 59362 }; 59363 }, 59364 }), 59365 }; 59366 }, 59367}); 59368exports.useGetSermonsQuery = exports.apiSlice.useGetSermonsQuery, exports.useGetFilterCategoriesQuery = exports.apiSlice.useGetFilterCategoriesQuery; 59369 59370 59371/***/ }), 59372
59373/***/ "./Static/javascript/modules/filter/redux/filter/filter-slice.ts": 59374/*!***********************************************************************!*\ 59375 !*** ./Static/javascript/modules/filter/redux/filter/filter-slice.ts ***! 59376 \***********************************************************************/ 59377/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 59378 59379"use strict"; 59380 59381var _a; 59382Object.defineProperty(exports, "__esModule", ({ value: true })); 59383exports.clearAllFilters = exports.setKeyword = exports.updateFilter = void 0; 59384var toolkit_1 = __webpack_require__(/*! @reduxjs/toolkit */ "./node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js"); 59385var initialState = { 59386 rabbi: "", 59387 year: "", 59388 tags: "", 59389 query: "" 59390}; 59391var filterSlice = (0, toolkit_1.createSlice)({ 59392 name: 'filter', 59393 initialState: initialState, 59394 reducers: { 59395 updateFilter: function (state, action) { 59396 var _a = action.payload, filterName = _a.filterName, filterValue = _a.filterValue; 59397 state[filterName] = filterValue; 59398 }, 59399 setKeyword: function (state, action) { 59400 state.query = action.payload; 59401 }, 59402 clearAllFilters: function (state) { 59403 state.query = ""; 59404 state.rabbi = ""; 59405 state.tags = ""; 59406 state.year = ""; 59407 } 59408 } 59409}); 59410exports.updateFilter = (_a = filterSlice.actions, _a.updateFilter), exports.setKeyword = _a.setKeyword, exports.clearAllFilters = _a.clearAllFilters; 59411exports["default"] = filterSlice.reducer; 59412 59413 59414/***/ }), 59415
59416/***/ "./Static/javascript/modules/filter/redux/hooks.ts": 59417/*!*********************************************************!*\ 59418 !*** ./Static/javascript/modules/filter/redux/hooks.ts ***! 59419 \*********************************************************/ 59420/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 59421 59422"use strict"; 59423 59424Object.defineProperty(exports, "__esModule", ({ value: true })); 59425exports.useAppSelector = exports.useAppDispatch = void 0; 59426var react_redux_1 = __webpack_require__(/*! react-redux */ "./node_modules/react-redux/es/index.js"); 59427var useAppDispatch = function () { return (0, react_redux_1.useDispatch)(); }; 59428exports.useAppDispatch = useAppDispatch; 59429exports.useAppSelector = react_redux_1.useSelector; 59430 59431 59432/***/ }), 59433
59434/***/ "./Static/javascript/modules/filter/redux/settings/page-settings-slice.ts": 59435/*!********************************************************************************!*\ 59436 !*** ./Static/javascript/modules/filter/redux/settings/page-settings-slice.ts ***! 59437 \********************************************************************************/ 59438/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 59439 59440"use strict"; 59441 59442var _a; 59443Object.defineProperty(exports, "__esModule", ({ value: true })); 59444exports.initializeSettings = exports.setCurrentPage = void 0; 59445var toolkit_1 = __webpack_require__(/*! @reduxjs/toolkit */ "./node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js"); 59446var defaultConfig = { 59447 "appId": "", 59448 "searchLabel": "Search", 59449 "categoryLabel": "Category", 59450 "publicationYearLabel": "Year", 59451 "rabbiLabel": "Rabbi", 59452 "noResultsMessage": "No Results", 59453 "perPage": "8" 59454}; 59455var pageConfig = window.pageConfig != undefined ? window.pageConfig : defaultConfig; 59456var pageSize = window.pageConfig != undefined ? parseInt(pageConfig.perPage) : parseInt(defaultConfig.perPage); 59457var initialState = { 59458 currentPage: 1, 59459 perPage: pageSize, 59460 appId: pageConfig.appId, 59461 noResultsMsg: pageConfig.noResultsMessage ? pageConfig.noResultsMessage : "No Results", 59462 rabbi: pageConfig.rabbi ? pageConfig.rabbi : "Rabbi", 59463 year: pageConfig.year ? pageConfig.year : "Year", 59464 tags: pageConfig.tags ? pageConfig.tags : "Tags", 59465 clearFiltersLabel: pageConfig.clearFiltersLabel ? pageConfig.clearFiltersLabel : "Clear Filters", 59466 searchLabel: pageConfig.searchLabel ? pageConfig.searchLabel : "Search", 59467}; 59468var pageSettingsSlice = (0, toolkit_1.createSlice)({ 59469 name: 'pageSettings', 59470 initialState: initialState, 59471 reducers: { 59472 setCurrentPage: function (state, action) { 59473 state.currentPage = action.payload; 59474 }, 59475 initializeSettings: function (state) { 59476 state.perPage = pageSize; 59477 state.noResultsMsg = initialState.noResultsMsg; 59478 }, 59479 }, 59480}); 59481exports.setCurrentPage = (_a = pageSettingsSlice.actions, _a.setCurrentPage), exports.initializeSettings = _a.initializeSettings; 59482exports["default"] = pageSettingsSlice.reducer; 59483 59484 59485/***/ }), 59486
59487/***/ "./Static/javascript/modules/filter/redux/store.ts": 59488/*!*********************************************************!*\ 59489 !*** ./Static/javascript/modules/filter/redux/store.ts ***! 59490 \*********************************************************/ 59491/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 59492 59493"use strict"; 59494 59495var __importDefault = (this && this.__importDefault) || function (mod) { 59496 return (mod && mod.__esModule) ? mod : { "default": mod }; 59497}; 59498var _a; 59499Object.defineProperty(exports, "__esModule", ({ value: true })); 59500exports.store = void 0; 59501var toolkit_1 = __webpack_require__(/*! @reduxjs/toolkit */ "./node_modules/@reduxjs/toolkit/dist/redux-toolkit.esm.js"); 59502var filter_slice_1 = __importDefault(__webpack_require__(/*! ../redux/filter/filter-slice */ "./Static/javascript/modules/filter/redux/filter/filter-slice.ts")); 59503var page_settings_slice_1 = __importDefault(__webpack_require__(/*! ../redux/settings/page-settings-slice */ "./Static/javascript/modules/filter/redux/settings/page-settings-slice.ts")); 59504var api_slice_1 = __webpack_require__(/*! ../redux/api-slice */ "./Static/javascript/modules/filter/redux/api-slice.ts"); 59505exports.store = (0, toolkit_1.configureStore)({ 59506 reducer: (_a = { 59507 filterState: filter_slice_1.default, 59508 pageSettings: page_settings_slice_1.default 59509 }, 59510 _a[api_slice_1.apiSlice.reducerPath] = api_slice_1.apiSlice.reducer, 59511 _a), 59512 middleware: function (getDefaultMiddleware) { return getDefaultMiddleware().concat(api_slice_1.apiSlice.middleware); }, 59513}); 59514 59515 59516/***/ }), 59517
59518/***/ "./Static/javascript/modules/filter/utils/pageContext.tsx": 59519/*!****************************************************************!*\ 59520 !*** ./Static/javascript/modules/filter/utils/pageContext.tsx ***! 59521 \****************************************************************/ 59522/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 59523 59524"use strict"; 59525 59526Object.defineProperty(exports, "__esModule", ({ value: true })); 59527var react_1 = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 59528var PageContext = (0, react_1.createContext)({ 59529 pageId: "", 59530}); 59531exports["default"] = PageContext; 59532 59533 59534/***/ }), 59535
59536/***/ "./Static/javascript/modules/filter/utils/usePagination.tsx": 59537/*!******************************************************************!*\ 59538 !*** ./Static/javascript/modules/filter/utils/usePagination.tsx ***! 59539 \******************************************************************/ 59540/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 59541 59542"use strict"; 59543 59544var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { 59545 if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { 59546 if (ar || !(i in from)) { 59547 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 59548 ar[i] = from[i]; 59549 } 59550 } 59551 return to.concat(ar || Array.prototype.slice.call(from)); 59552}; 59553Object.defineProperty(exports, "__esModule", ({ value: true })); 59554exports.usePagination = exports.DOTS = void 0; 59555var react_1 = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 59556exports.DOTS = '...'; 59557/* 59558Renders pagination based on range. Inspired by https://www.freecodecamp.org/news/build-a-custom-pagination-component-in-react/ 59559 */ 59560var range = function (start, end) { 59561 var length = end - start + 1; 59562 return Array.from({ length: length }, function (_, idx) { return idx + start; }); 59563}; 59564var usePagination = function (_a) { 59565 var totalCount = _a.totalCount, pageSize = _a.pageSize, _b = _a.siblingCount, siblingCount = _b === void 0 ? 1 : _b, currentPage = _a.currentPage; 59566 var paginationRange = (0, react_1.useMemo)(function () { 59567 var totalPageCount = Math.ceil(totalCount / pageSize); 59568 // Pages count is determined as siblingCount + firstPage + lastPage + currentPage + 2*DOTS 59569 var totalPageNumbers = siblingCount + 5; 59570 /* 59571 If the number of pages is less than the page numbers we want to show in our 59572 paginationComponent, we return the range [1..totalPageCount] 59573 */ 59574 if (totalPageNumbers >= totalPageCount) { 59575 return range(1, totalPageCount); 59576 } 59577 var leftSiblingIndex = Math.max(currentPage - siblingCount, 1); 59578 var rightSiblingIndex = Math.min(currentPage + siblingCount, totalPageCount); 59579 /* 59580 We do not want to show dots if there is only one position left 59581 after/before the left/right page count as that would lead to a change if our Pagination 59582 component size which we do not want 59583 */ 59584 var shouldShowLeftDots = leftSiblingIndex > 2; 59585 var shouldShowRightDots = rightSiblingIndex < totalPageCount - 2; 59586 var firstPageIndex = 1; 59587 var lastPageIndex = totalPageCount; 59588 if (!shouldShowLeftDots && shouldShowRightDots) { 59589 var leftItemCount = 3 + 2 * siblingCount; 59590 var leftRange = range(1, leftItemCount); 59591 return __spreadArray(__spreadArray([], leftRange, true), [exports.DOTS, totalPageCount], false); 59592 } 59593 if (shouldShowLeftDots && !shouldShowRightDots) { 59594 var rightItemCount = 3 + 2 * siblingCount; 59595 var rightRange = range(totalPageCount - rightItemCount + 1, totalPageCount); 59596 return __spreadArray([firstPageIndex, exports.DOTS], rightRange, true); 59597 } 59598 if (shouldShowLeftDots && shouldShowRightDots) { 59599 var middleRange = range(leftSiblingIndex, rightSiblingIndex); 59600 return __spreadArray(__spreadArray([firstPageIndex, exports.DOTS], middleRange, true), [exports.DOTS, lastPageIndex], false); 59601 } 59602 }, [totalCount, pageSize, siblingCount, currentPage]); 59603 return paginationRange; 59604}; 59605exports.usePagination = usePagination; 59606 59607 59608/***/ }), 59609
59610/***/ "./Static/javascript/modules/gallery.ts": 59611/*!**********************************************!*\ 59612 !*** ./Static/javascript/modules/gallery.ts ***! 59613 \**********************************************/ 59614/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 59615 59616"use strict"; 59617 59618var __assign = (this && this.__assign) || function () { 59619 __assign = Object.assign || function(t) { 59620 for (var s, i = 1, n = arguments.length; i < n; i++) { 59621 s = arguments[i]; 59622 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 59623 t[p] = s[p]; 59624 } 59625 return t; 59626 }; 59627 return __assign.apply(this, arguments); 59628}; 59629var __importDefault = (this && this.__importDefault) || function (mod) { 59630 return (mod && mod.__esModule) ? mod : { "default": mod }; 59631}; 59632Object.defineProperty(exports, "__esModule", ({ value: true })); 59633exports.Gallery = void 0; 59634var splide_1 = __importDefault(__webpack_require__(/*! @splidejs/splide */ "./node_modules/@splidejs/splide/dist/js/splide.cjs.js")); 59635var splide_extension_video_1 = __webpack_require__(/*! @splidejs/splide-extension-video */ "./node_modules/@splidejs/splide-extension-video/dist/js/splide-extension-video.esm.js"); 59636var splide_transition_1 = __webpack_require__(/*! ./splide-transition */ "./Static/javascript/modules/splide-transition.ts"); 59637var commonGalleryOptions = { 59638 accessibility: true, 59639 drag: true, 59640 // @ts-ignore 59641 pagination: true, 59642 // @ts-ignore 59643 slideFocus: false, 59644 easing: 'linear', 59645 speed: 600, 59646 interval: 5000, 59647 focus: 0, 59648 gap: '2rem', 59649 padding: { 59650 left: '0rem', 59651 right: '0rem' 59652 }, 59653 arrows: true, 59654 keyboard: 'focused', 59655 video: { 59656 // setting to true is currently required due to a bug in the splide video extension creating 59657 // the embed url with an empty "playlist" parameter which break YouTube embed link 59658 loop: true 59659 }, 59660 classes: { 59661 pagination: 'splide__pagination gallery-pagination gallery-pagination-nums', 59662 page: 'splide__pagination__page gallery-page' 59663 }, 59664}; 59665var gridGalleryOptions = { 59666 perPage: 4, 59667 perMove: 1, 59668 breakpoints: { 59669 1280: { 59670 perPage: 2, 59671 perMove: 1, 59672 gap: '1.5rem', 59673 }, 59674 767: { 59675 perPage: 1, 59676 perMove: 1, 59677 gap: '1rem', 59678 } 59679 }, 59680}; 59681var defaultGalleryOptions = { 59682 perPage: 2, 59683 perMove: 1, 59684 breakpoints: { 59685 1280: { 59686 gap: '1.5rem' 59687 }, 59688 767: { 59689 gap: '.5rem', 59690 perPage: 1, 59691 perMove: 1, 59692 } 59693 }, 59694 updateOnMove: true, 59695 autoHeight: true, 59696 type: 'loop', 59697}; 59698// Ignore the typescript issues on the pagination property and slideFocus, it's just incorrect typings from the library 59699var Gallery = /** @class */ (function () { 59700 function Gallery(element) { 59701 var _this = this; 59702 this.getPerPage = function () { 59703 var breakpointsArray = []; 59704 var perPage = _this.galleryOptions.perPage; 59705 //Push perpage breakpoint values into an array 59706 for (var _i = 0, _a = Object.entries(_this.galleryOptions.breakpoints); _i < _a.length; _i++) { 59707 var _b = _a[_i], key = _b[0], value = _b[1]; 59708 breakpointsArray.push({ "breakpoint": parseInt(key), perPage: value.perPage }); 59709 } 59710 breakpointsArray.sort(function (a, b) { return parseFloat(b.breakpoint) - parseFloat(a.breakpoint); }).forEach(function (breakpoint, breakpointIndex) { 59711 if (breakpointIndex !== breakpointsArray.length - 1) { 59712 if (window.innerWidth < breakpoint.breakpoint && window.innerWidth > breakpointsArray[breakpointIndex + 1].breakpoint) 59713 perPage = breakpoint.perPage ? breakpoint.perPage : perPage; 59714 } 59715 else { 59716 if (window.innerWidth < breakpoint.breakpoint) 59717 perPage = breakpoint.perPage ? breakpoint.perPage : perPage; 59718 } 59719 }); 59720 return perPage; 59721 }; 59722 this.arrowDisplay = function () { 59723 var galleryArrows = _this.gallery.Components.Arrows.arrows; 59724 if (galleryArrows.next && galleryArrows.prev) { 59725 var arrowsShouldBeHidden = (galleryArrows.next.hasAttribute('disabled') && galleryArrows.prev.hasAttribute('disabled')) || _this.gallery.Components.Slides.getLength() <= _this.getPerPage(); 59726 galleryArrows.next.hidden = arrowsShouldBeHidden; 59727 galleryArrows.prev.hidden = arrowsShouldBeHidden; 59728 } 59729 }; 59730 this.setGalleryOptions = function () { 59731 var optionsToUse = _this.galleryType == "grid" ? gridGalleryOptions : defaultGalleryOptions; 59732 var autoPlayOptions = { 59733 autoplay: _this.autoStart.toString(), 59734 interval: _this.setInterval.toString() 59735 }; 59736 _this.galleryOptions = __assign(__assign(__assign({}, commonGalleryOptions), autoPlayOptions), optionsToUse); 59737 }; 59738 this.galleryType = element.getAttribute('data-gallery-type'); 59739 this.autoStart = element.getAttribute('data-autoplay') != null ? element.getAttribute('data-autoplay') : ""; 59740 // This needs to be set to a obscenely large number due to an interval bug with Splide 59741 this.setInterval = element.getAttribute('data-interval') != null ? element.getAttribute('data-interval') : "1000000"; 59742 this.setGalleryOptions();
59743 this.gallery = new splide_1.default(element, this.galleryOptions); 59744 this.gallery.on('mounted', function () { 59745 _this.arrowDisplay(); 59746 setTimeout(function () { 59747 var playButtons = Array.prototype.slice.call(_this.gallery.root.querySelectorAll('.media-gallery-item .splide__slide__container--has-video')); 59748 playButtons.forEach(function (playButton) { 59749 var slide = playButton.closest('.splide__slide'); 59750 var slideTarget = slide.querySelector('[data-gallery-video]'); 59751 slideTarget.append(playButton); 59752 }); 59753 }, 1000); //Forgive me, but no event to listen to find out when the playbuttons are loaded. Splide also isn't respecting the splide__slide__container for the playbutton target so I had to do it manually here :( 59754 }); 59755 this.gallery.on('resized', function () { 59756 _this.arrowDisplay(); 59757 }); 59758 this.gallery.on('move', function () { 59759 _this.gallery.root.classList.add('moving'); 59760 _this.pauseAudioElements(); 59761 }); 59762 this.gallery.on('moved', function () { 59763 _this.gallery.root.classList.remove('moving'); 59764 }); 59765 this.gallery.on('video:play', function () { 59766 var videoSelector = ".is-playing .is-active .splide__video__wrapper"; 59767 var playingVideoElement = document.querySelector("".concat(videoSelector, " video")) || document.querySelector("".concat(videoSelector, " iframe")); 59768 if (playingVideoElement) { 59769 playingVideoElement.setAttribute('title', playingVideoElement.closest('[data-video-title]').getAttribute('data-video-title')); 59770 } 59771 }); 59772 this.gallery.mount({ Video: splide_extension_video_1.Video }, splide_transition_1.MyTransition); 59773 } 59774 Gallery.prototype.pauseAudioElements = function () { 59775 var audioPlayers = Array.from(this.gallery.root.querySelectorAll('audio')); 59776 audioPlayers.forEach(function (audioPlayer) { 59777 if (!audioPlayer.paused) 59778 audioPlayer.pause(); 59779 }); 59780 }; 59781 return Gallery; 59782}()); 59783exports.Gallery = Gallery; 59784 59785 59786/***/ }), 59787
59788/***/ "./Static/javascript/modules/google-translate.ts": 59789/*!*******************************************************!*\ 59790 !*** ./Static/javascript/modules/google-translate.ts ***! 59791 \*******************************************************/ 59792/***/ ((__unused_webpack_module, exports) => { 59793 59794"use strict"; 59795 59796Object.defineProperty(exports, "__esModule", ({ value: true })); 59797exports.GoogleTranslate = void 0; 59798var GoogleTranslate = /** @class */ (function () { 59799 function GoogleTranslate() { 59800 this.COOKIE_NAME = 'googtrans'; 59801 this.initializeTranslateInputListeners(); 59802 this.initializeLangMutationObserver(); 59803 } 59804 GoogleTranslate.prototype.onLanguageChange = function (e) { 59805 var select = e.target; 59806 var selectedLanguage = (select === null || select === void 0 ? void 0 : select.value) || 'en'; 59807 this.updateState(selectedLanguage); 59808 location.reload(); 59809 }; 59810 GoogleTranslate.prototype.initializeTranslateInputListeners = function () { 59811 var translateSelect = document.querySelector('[data-translate-select]'); 59812 this.translateElement = translateSelect; 59813 if (translateSelect) { 59814 var self = this; 59815 translateSelect.addEventListener('change', this.onLanguageChange.bind(self)); 59816 } 59817 }; 59818 // Observes the mutation of the 'lang' attribute on the <html> element 59819 // and upon a change, it updates the google translate form element to reflect the language change. 59820 // 59821 // This is important because the user can modify the lang of the page through UI which we don't have 59822 // event listeners set up for. 59823 // 59824 GoogleTranslate.prototype.initializeLangMutationObserver = function () { 59825 var _this = this; 59826 // If no translate element was found, then we don't need to observe the 59827 if (!this.translateElement) { 59828 return; 59829 } 59830 // Select the node that will be observed for mutations 59831 var htmlRoot = document.getElementsByTagName('html')[0]; 59832 // Options for the observer (which mutations to observe) 59833 var config = { attributes: true }; 59834 // Callback function to execute when mutations are observed 59835 var callback = function (mutationList, observer) { 59836 var _a; 59837 var _loop_1 = function (mutation) { 59838 var type = mutation.type, attributeName = mutation.attributeName, target = mutation.target; 59839 var newLang = (_a = target === null || target === void 0 ? void 0 : target.getAttribute('lang')) !== null && _a !== void 0 ? _a : 'en'; 59840 if (type === 'attributes' && attributeName === 'lang') { 59841 var languageOptions = _this.translateElement.querySelectorAll('input'); 59842 Array.from(languageOptions).forEach(function (languageOption) { 59843 languageOption.checked = languageOption.value.endsWith(newLang); 59844 }); 59845 } 59846 }; 59847 for (var _i = 0, mutationList_1 = mutationList; _i < mutationList_1.length; _i++) { 59848 var mutation = mutationList_1[_i]; 59849 _loop_1(mutation); 59850 } 59851 }; 59852 // Create an observer instance linked to the callback function 59853 var observer = new MutationObserver(callback); 59854 // Start observing the target node for configured mutations 59855 observer.observe(htmlRoot, config); 59856 }; 59857 // Cookie modifying code within is loosely taken from the JS that comes with Google Translate plugin 59858 // because it targets and modifies multiple cookies on page load, which have to be accounted for 59859 // when the user chooses a language from the dropdown. 59860 GoogleTranslate.prototype.updateState = function (selectedLanguage) { 59861 var newCookie = this.COOKIE_NAME; 59862 if (selectedLanguage && selectedLanguage !== 'en') { 59863 newCookie += ('=/en/' + selectedLanguage); 59864 } 59865 else { 59866 var time = new Date(); 59867 time.setTime(time.getTime() - 1); 59868 newCookie += '=none;expires=' + time.toUTCString(); 59869 } 59870 // update default domain, e.g, centertheatregroup-dev.adagete
59870ch.net 59871 newCookie += ';path=/'; 59872 document.cookie = newCookie; 59873 // update potential base domain 59874 var hostnameParts = window.location.hostname.split('.'); 59875 // e.g, [centertheatregroup-dev, adagetech, net] 59876 var baseDomain = (hostnameParts.length <= 2 59877 ? hostnameParts 59878 : hostnameParts.slice(hostnameParts.length - 2, hostnameParts.length)).join('.'); 59879 try { 59880 document.cookie = newCookie + ';domain=' + baseDomain; 59881 } 59882 catch (d) { } 59883 }; 59884 return GoogleTranslate; 59885}()); 59886exports.GoogleTranslate = GoogleTranslate; 59887 59888 59889/***/ }), 59890
59891/***/ "./Static/javascript/modules/headerVideo.ts": 59892/*!**************************************************!*\ 59893 !*** ./Static/javascript/modules/headerVideo.ts ***! 59894 \**************************************************/ 59895/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 59896 59897"use strict"; 59898 59899var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 59900 if (k2 === undefined) k2 = k; 59901 var desc = Object.getOwnPropertyDescriptor(m, k); 59902 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 59903 desc = { enumerable: true, get: function() { return m[k]; } }; 59904 } 59905 Object.defineProperty(o, k2, desc); 59906}) : (function(o, m, k, k2) { 59907 if (k2 === undefined) k2 = k; 59908 o[k2] = m[k]; 59909})); 59910var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 59911 Object.defineProperty(o, "default", { enumerable: true, value: v }); 59912}) : function(o, v) { 59913 o["default"] = v; 59914}); 59915var __importStar = (this && this.__importStar) || function (mod) { 59916 if (mod && mod.__esModule) return mod; 59917 var result = {}; 59918 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 59919 __setModuleDefault(result, mod); 59920 return result; 59921}; 59922var __importDefault = (this && this.__importDefault) || function (mod) { 59923 return (mod && mod.__esModule) ? mod : { "default": mod }; 59924}; 59925Object.defineProperty(exports, "__esModule", ({ value: true })); 59926exports.HeaderVideo = void 0; 59927var debounce = __webpack_require__(/*! lodash.debounce */ "./node_modules/lodash.debounce/index.js"); 59928var YouTubeIframeLoader = __importStar(__webpack_require__(/*! youtube-iframe */ "./node_modules/youtube-iframe/index.js")); 59929var player_1 = __importDefault(__webpack_require__(/*! @vimeo/player */ "./node_modules/@vimeo/player/dist/player.es.js")); 59930var VideoType; 59931(function (VideoType) { 59932 VideoType["NATIVE"] = "native"; 59933 VideoType["VIMEO"] = "vimeo"; 59934 VideoType["YOUTUBE"] = "youtube"; 59935 VideoType["NONE"] = "none"; 59936})(VideoType || (VideoType = {})); 59937var HeaderVideo = /** @class */ (function () { 59938 function HeaderVideo(container) { 59939 this.container = container; 59940 this.videoEdgeOffset = 0; 59941 this.videoWrapper = this.container.querySelector('[data-header-video-wrapper]'); 59942 var videoType = this.videoWrapper.getAttribute("data-video-type"); 59943 switch (videoType.toLowerCase()) { 59944 case VideoType.NATIVE: 59945 this.videoType = VideoType.NATIVE; 59946 break; 59947 case VideoType.YOUTUBE: 59948 this.videoType = VideoType.YOUTUBE; 59949 this.videoEdgeOffset = 480; // vertical offset to hide the youtube title and branding 59950 break; 59951 case VideoType.VIMEO: 59952 this.videoType = VideoType.VIMEO; 59953 break; 59954 default: 59955 this.videoType = VideoType.NONE; 59956 } 59957 this.imageFallback = this.container.querySelector('[data-header-video-image]'); 59958 this.content = this.container.querySelector('[data-header-video-content]'); 59959 this.breakpoint = parseInt(this.container.getAttribute('data-breakpoint')); 59960 if (this.videoType === VideoType.NONE) { 59961 // there's no video 59962 this.switchToImage(); 59963 } 59964 else if (window.outerWidth < this.breakpoint) { 59965 this.switchToImage(); 59966 } 59967 else { 59968 this.initializeVideo(); 59969 } 59970 } 59971 HeaderVideo.prototype.initializeVideo = function () { 59972 var _this = this; 59973 this.video = this.container.querySelector('[data-header-video]'); 59974 var controls = { 59975 pauseButton: this.container.querySelector('[data-header-video-pause]'), 59976 playButton: this.container.querySelector('[data-header-video-play]'), 59977 muteButton: this.container.querySelector('[data-header-video-mute]'), 59978 unmuteButton: this.container.querySelector('[data-header-video-unmute]') 59979 }; 59980 this.controls = controls;
59981 this.overlay = this.container.querySelector('[data-header-video-overlay]'); 59982 // Recalculate video size 59983 this.setDimensions(); 59984 window.addEventListener('resize', debounce(function () { 59985 _this.setDimensions(); 59986 if (window.outerWidth < _this.breakpoint) { 59987 _this.switchToImage(); 59988 } 59989 }, 50)); 59990 this.videoEndTime = parseInt(this.video.getAttribute('data-video-end')) || null; 59991 this.videoStartTime = parseInt(this.video.getAttribute('data-video-start')) || 0; 59992 if (!this.video.src) { 59993 // Youtube initialization and handlers 59994 if (this.videoType === VideoType.YOUTUBE) { 59995 this.initYoutubeVideo(); 59996 } 59997 // Native video initialization 59998 if (this.videoType === VideoType.NATIVE) { 59999 this.initNativeVideo(); 60000 } 60001 // Vimeo video initialization 60002 if (this.videoType === VideoType.VIMEO) { 60003 this.initVimeoVideo(); 60004 } 60005 } 60006 }; 60007 HeaderVideo.prototype.initNativeVideo = function () { 60008 var _this = this; 60009 this.video = this.video; 60010 var videoSource = this.video.querySelector('source'); 60011 if (videoSource) { 60012 videoSource.src = videoSource.getAttribute('data-src'); 60013 this.videoObject = this.video; 60014 this.videoObject.addEventListener('loadeddata', function () { 60015 var playPromise = _this.videoObject.play(); 60016 if (playPromise !== undefined) { 60017 playPromise.then(function () { 60018 // Autoplay is working 60019 }).catch(function (error) { 60020 // Autoplay is blocked 60021 _this.autoplayBlocked(true); 60022 }); 60023 } 60024 else 60025 _this.switchToImage(); 60026 }); 60027 this.videoObject.load(); 60028 this.showVideoAndAttachControls(); 60029 } 60030 }; 60031 HeaderVideo.prototype.initYoutubeVideo = function () { 60032 var _this = this; 60033 var videoPlayer; 60034 YouTubeIframeLoader.load(function (YT) { 60035 _this.video.src = _this.video.getAttribute('data-src'); 60036 videoPlayer = new YT.Player(_this.video.id, { 60037 events: { 60038 'onReady': _this.ytVideoLoaded.bind(_this), 60039 'onStateChange': _this.ytOnPlayerStateChange.bind(_this), 60040 } 60041 }); 60042 _this.videoObject = videoPlayer; 60043 }); 60044 }; 60045 HeaderVideo.prototype.initVimeoVideo = function () { 60046 var _this = this; 60047 this.video.src = this.video.getAttribute('data-src'); 60048 var vimeoPlayer = new player_1.default(this.video, {}); 60049 vimeoPlayer.on('loaded', function () { 60050 vimeoPlayer.play().then(function () { 60051 // Video is playing 60052 vimeoPlayer.setVolume(0).then(function (volume) { 60053 _this.showVideoAndAttachControls(); 60054 }); 60055 }).catch(function (error) { 60056 // Video had an error or was blocked 60057 _this.autoplayBlocked(true); 60058 }); 60059 }); 60060 this.videoObject = vimeoPlayer; 60061 }; 60062 HeaderVideo.prototype.showVideoAndAttachControls = function () { 60063 this.imageFallback.setAttribute('aria-hidden', 'true'); 60064 this.videoWrapper.removeAttribute('aria-hidden'); 60065 this.container.setAttribute('data-header-video-container', 'video'); 60066 this.attachControls(); 60067 }; 60068 HeaderVideo.prototype.attachControls = function () { 60069 this.controls.pauseButton.classList.remove('hide'); 60070 this.controls.pauseButton.addEventListener('click', this.playPause.bind(this)); 60071 this.controls.playButton.addEventListener('click', this.playPause.bind(this)); 60072 this.overlay.addEventListener('click', this.playPause.bind(this)); 60073 if (this.controls.unmuteButton) { 60074 this.controls.unmuteButton.classList.remove('hide'); 60075 this.controls.muteButton.addEventListener('click', this.muteUnmute.bind(this)); 60076 this.controls.unmuteButton.addEventListener('click', this.muteUnmute.bind(this)); 60077 } 60078 }; 60079 HeaderVideo.prototype.playPause = function () { 60080 var _this = this; 60081 // Youtube Play and Pause 60082 if (this.videoType === VideoType.YOUTUBE) { 60083 var playerState = this.videoObject.getPlayerState(); 60084 // == 1 means it's playing 60085 if (playerState == 1) { 60086 this.videoObject.pauseVideo(); 60087 this.setControlVisibility(this.controls.pauseButton, this.controls.playButton); 60088 } 60089 else { 60090 this.videoObject.playVideo(); 60091 this.setControlVisibility(this.controls.playButton, this.controls.pauseButton); 60092 } 60093 } 60094 // Native Play and Pause 60095 if (this.videoType === VideoType.NATIVE) { 60096 if (this.videoObject.paused) { 60097 this.videoObject.play(); 60098 this.setControlVisibility(this.controls.playButton, this.controls.pauseButton); 60099 } 60100 else { 60101 this.videoObject.pause(); 60102 this.setControlVisibility(this.controls.pauseButton, this.controls.playButton); 60103 } 60104 } 60105 // Vimeo Play and Pause 60106 if (this.videoType === VideoType.VIMEO) { 60107 this.videoObject.getPaused().then(function (paused) { 60108 if (paused) { 60109 _this.videoObject.play(); 60110 _this.setControlVisibility(_this.controls.playButton, _this.controls.pauseButton); 60111 } 60112 else { 60113 _this.videoObject.pause(); 60114 _this.setControlVisibility(_this.controls.pauseButton, _this.controls.playButton); 60115 } 60116 }); 60117 } 60118 }; 60119 HeaderVideo.prototype.muteUnmute = function () { 60120 var _this = this; 60121 // Youtube Mute and Unmute 60122 if (this.videoType === VideoType.YOUTUBE) { 60123 var isMuted = this.videoObject.isMuted(); 60124 if (isMuted) {
60125 this.videoObject.unMute(); 60126 this.setControlVisibility(this.controls.unmuteButton, this.controls.muteButton); 60127 } 60128 else { 60129 this.videoObject.mute(); 60130 this.setControlVisibility(this.controls.muteButton, this.controls.unmuteButton); 60131 } 60132 } 60133 // Native Mute and Unmute 60134 if (this.videoType === VideoType.NATIVE) { 60135 if (this.videoObject.muted) { 60136 this.videoObject.muted = false; 60137 this.setControlVisibility(this.controls.unmuteButton, this.controls.muteButton); 60138 } 60139 else { 60140 this.videoObject.muted = true; 60141 this.setControlVisibility(this.controls.muteButton, this.controls.unmuteButton); 60142 } 60143 } 60144 // Vimeo Mute and Unmute 60145 if (this.videoType === VideoType.VIMEO) { 60146 this.videoObject.getVolume().then(function (volume) { 60147 if (volume > 0) { 60148 _this.videoObject.setVolume(0).then(function (volume) { 60149 _this.setControlVisibility(_this.controls.muteButton, _this.controls.unmuteButton); 60150 }); 60151 } 60152 else { 60153 _this.videoObject.setVolume(1).then(function (volume) { 60154 _this.setControlVisibility(_this.controls.unmuteButton, _this.controls.muteButton); 60155 }); 60156 } 60157 }); 60158 } 60159 }; 60160 HeaderVideo.prototype.setDimensions = function () { 60161 var headerWidth = this.container.offsetWidth; 60162 var headerHeight = this.container.offsetHeight; 60163 this.video.style.width = "".concat(Math.max(headerWidth, (headerHeight * 16 / 9)), "px"); 60164 this.video.style.height = "".concat(Math.max((headerHeight + this.videoEdgeOffset), (headerWidth * 9 / 16)), "px"); 60165 }; 60166 HeaderVideo.prototype.autoplayBlocked = function (allowManualPlay, isYouTube) { 60167 if (isYouTube) { 60168 this.ytSetDuration(); 60169 } 60170 if (allowManualPlay) { 60171 this.switchToImage(); 60172 this.imageFallback.addEventListener('click', this.imageFallbackPlayback.bind(this)); 60173 } 60174 else { 60175 this.switchToImage(); 60176 } 60177 }; 60178 HeaderVideo.prototype.imageFallbackPlayback = function () { 60179 this.showVideoAndAttachControls(); 60180 this.playPause(); 60181 }; 60182 HeaderVideo.prototype.switchToImage = function () { 60183 this.imageFallback.removeAttribute('aria-hidden'); 60184 this.videoWrapper.setAttribute('aria-hidden', 'true'); 60185 this.container.setAttribute('data-header-video-container', 'image'); 60186 if (this.content) { 60187 this.content.setAttribute('data-hero-no-video', ''); 60188 } 60189 }; 60190 HeaderVideo.prototype.setControlVisibility = function (thingToHide, thingToShow) { 60191 thingToHide.classList.add('hide'); 60192 thingToShow.classList.remove('hide'); 60193 thingToShow.focus(); 60194 }; 60195 HeaderVideo.prototype.ytVideoLoaded = function () { 60196 if (this.videoObject) { 60197 var playerState = this.videoObject.getPlayerState(); 60198 if (playerState === 5) { 60199 // autoplay is blocked abort abort 60200 this.autoplayBlocked(true, true); 60201 } 60202 else { 60203 this.ytSetDuration(); 60204 this.showVideoAndAttachControls(); 60205 } 60206 } 60207 }; 60208 HeaderVideo.prototype.ytSetDuration = function () { 60209 var duration = this.videoObject.getDuration(); 60210 this.videoEndTime = this.videoEndTime ? Math.min(this.videoEndTime, duration) : duration; 60211 this.videoStartTime = this.videoEndTime > this.videoStartTime ? this.videoStartTime : 0; 60212 }; 60213 HeaderVideo.prototype.ytSetTimeChecker = function () { 60214 if (this.videoObject) { 60215 var playerState = this.videoObject.getPlayerState(); 60216 if (playerState === 1) { // playing 60217 clearInterval(this.endTimeChecker); 60218 this.endTimeChecker = setInterval(this.ytCheckForEnd.bind(this), 1000); 60219 } 60220 else if (playerState === 0) { // ended
60221 this.videoObject.seekTo(this.videoStartTime); 60222 this.videoObject.playVideo(); 60223 } 60224 else { 60225 clearInterval(this.endTimeChecker); 60226 } 60227 } 60228 }; 60229 HeaderVideo.prototype.ytCheckForEnd = function () { 60230 var curTime = this.videoObject.getCurrentTime(); 60231 if (curTime >= this.videoEndTime) { 60232 this.videoObject.seekTo(this.videoStartTime); 60233 } 60234 }; 60235 HeaderVideo.prototype.ytOnPlayerStateChange = function (e) { 60236 this.ytSetTimeChecker(); 60237 }; 60238 return HeaderVideo; 60239}()); 60240exports.HeaderVideo = HeaderVideo; 60241 60242 60243/***/ }), 60244
60245/***/ "./Static/javascript/modules/mainNavigation.ts": 60246/*!*****************************************************!*\ 60247 !*** ./Static/javascript/modules/mainNavigation.ts ***! 60248 \*****************************************************/ 60249/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 60250 60251"use strict"; 60252 60253Object.defineProperty(exports, "__esModule", ({ value: true })); 60254exports.mainNavigation = void 0; 60255var lockBody_1 = __webpack_require__(/*! ../helpers/lockBody */ "./Static/javascript/helpers/lockBody.ts"); 60256// Static strings 60257var openMenuClass = 'nav-menu-is-open'; 60258var menuSlideStateAttribute = 'data-nav-expanded'; 60259var navId = "navContainer"; 60260var menuId = "navPanel"; 60261var breadCrumbId = "breadcrumbs"; 60262var megaNavOpenAttribute = 'data-mega-nav-open'; 60263var searchId = 'mnavSearch'; 60264var MainNavigation = /** @class */ (function () { 60265 function MainNavigation(navigation) { 60266 var _this = this; 60267 this.init = function () { 60268 _this.menuTrigger.addEventListener('click', function () { 60269 if (_this.menuIsOpen) { 60270 _this.closeMenu(); 60271 } 60272 else { 60273 _this.openMenu(); 60274 } 60275 }); 60276 document.body.addEventListener('keyup', function (e) { 60277 if (e.which === 27) { 60278 if (_this.menuIsOpen) { // Escape key 60279 _this.closeMenu(); 60280 _this.menuTrigger.focus(); 60281 } 60282 if (_this.searchIsOpen) { // Escape key 60283 _this.toggleSearch(); 60284 _this.searchTrigger.focus(); 60285 } 60286 if (_this.subNavsOpen) { // Escape key 60287 _this.closeAllSubMenus(); 60288 } 60289 } 60290 if (e.which == 9) { // Tab key. Show nav if tabbed into, or close menu if tabbed out of. 60291 var focusInNav = _this.container.contains(document.activeElement); 60292 if (focusInNav && !_this.navIsShowing) { 60293 _this.slideDown(); 60294 } 60295 if (!focusInNav && _this.menuIsOpen) { 60296 _this.closeMenu(); 60297 } 60298 } 60299 }); 60300 // Setup on page load 60301 _this.setCssVariables(); 60302 _this.slideDown(); 60303 _this.initSearch(); 60304 }; 60305 this.initSearch = function () { 60306 _this.searchTrigger.addEventListener('click', function () { return _this.toggleSearch(); }); 60307 _this.searchForms.forEach(function (form) { 60308 form.addEventListener('submit', function (e) { 60309 e.preventDefault(); 60310 var urlToRedirect = form.getAttribute('data-redirect-url'); 60311 var formValue = form.querySelector('[data-search-form-input]').value; 60312 if (formValue != "") 60313 window.location.href = "".concat(urlToRedirect, "?q=").concat(form.querySelector('[data-search-form-input]').value); 60314 }); 60315 }); 60316 }; 60317 this.detectSearchClick = function (e) { 60318 if (!e.target.closest("[id=\"".concat(_this.searchForm.getAttribute("id"), "\"]")) && e.target.getAttribute("aria-controls") !== searchId) { 60319 _this.closeSearch(); 60320 } 60321 }; 60322 this.openSearch = function () { 60323 if (_this.menuIsOpen) 60324 _this.closeMenu(); 60325 if (document.getElementById("pageSearch")) { 60326 document.getElementById("pageSearch").querySelector('input[type="text"]').focus(); 60327 } 60328 else { 60329 _this.searchTrigger.setAttribute('aria-expanded', 'true'); 60330 _this.searchIsOpen = true; 60331 _this.showElement(_this.searchForm); 60332 setTimeout(function () { 60333 _this.searchForm.querySelector('input[type="text"]').focus(); 60334 }, 100); 60335 document.addEventListener("click", _this.detectSearchClick.bind(_this)); 60336 } 60337 }; 60338 this.closeSearch = function () { 60339 _this.searchTrigger.setAttribute('aria-expanded', 'false'); 60340 _this.hideElement(_this.searchForm); 60341 _this.searchIsOpen = false;
60342 }; 60343 this.showElement = function (element) { 60344 element.removeAttribute('inert'); 60345 element.hidden = false; 60346 }; 60347 this.hideElement = function (element) { 60348 element.inert = true; 60349 element.hidden = true; 60350 }; 60351 this.toggleSearch = function () { 60352 !_this.searchIsOpen ? _this.openSearch() : _this.closeSearch(); 60353 }; 60354 this.closeAllSubMenus = function () { 60355 var openSubMenus = _this.navItemTriggers.filter(function (navItemTrigger) { return navItemTrigger.getAttribute('aria-expanded') === 'true'; }); 60356 openSubMenus.forEach(function (subMenuTrigger) { 60357 _this.closeSubnavPanel(subMenuTrigger); 60358 }); 60359 _this.subNavsOpen = false; 60360 }; 60361 this.detectOutsideSubmenuClick = function (e) { 60362 if (_this.subNavsOpen && !_this.menuIsOpen) { //If a submenu is open but it's not in a mobile menu 60363 if (!e.target.closest("[data-nav-sub]")) { 60364 _this.closeAllSubMenus(); 60365 } 60366 } 60367 }; 60368 this.openSubnavPanel = function (trigger) { 60369 _this.closeAllSubMenus(); 60370 var panelToOpen = document.querySelector("#".concat(trigger.getAttribute('aria-controls'))); 60371 panelToOpen.inert = false; 60372 trigger.setAttribute('aria-expanded', 'true'); 60373 _this.subNavsOpen = true; 60374 document.addEventListener("click", _this.detectOutsideSubmenuClick.bind(_this)); 60375 _this.htmlElement.setAttribute(megaNavOpenAttribute, 'true'); 60376 }; 60377 this.closeSubnavPanel = function (trigger) { 60378 var panelToClose = document.querySelector("#".concat(trigger.getAttribute('aria-controls'))); 60379 panelToClose.inert = true; 60380 trigger.setAttribute('aria-expanded', 'false'); 60381 _this.subNavsOpen = false; 60382 document.removeEventListener("click", _this.detectOutsideSubmenuClick.bind(_this)); 60383 _this.htmlElement.setAttribute(megaNavOpenAttribute, 'false'); 60384 }; 60385 this.handleTriggerClick = function (trigger) { 60386 var triggerIsOpen = trigger.getAttribute('aria-expanded') == 'true'; 60387 if (!triggerIsOpen) 60388 _this.openSubnavPanel(trigger); 60389 else 60390 _this.closeSubnavPanel(trigger); 60391 }; 60392 this.slideDown = function () { 60393 _this.navIsShowing = true; 60394 _this.htmlElement.setAttribute(menuSlideStateAttribute, 'true'); 60395 _this.setCssVariables(); 60396 }; 60397 this.slideUp = function () { 60398 _this.navIsShowing = false; 60399 _this.htmlElement.setAttribute(menuSlideStateAttribute, 'false'); 60400 _this.setCssVariables(); 60401 }; 60402 this.openMenu = function () { 60403 _this.menuPanel.setAttribute('aria-hidden', 'false'); 60404 _this.menuTrigger.setAttribute('aria-expanded', 'true'); 60405 _this.enableTabbableChildren(); 60406 _this.menuIsOpen = true; 60407 _this.existingBodyStyles = (0, lockBody_1.lockBody)(); 60408 _this.container.classList.add(openMenuClass); 60409 }; 60410 this.closeMenu = function () { 60411 _this.menuPanel.setAttribute('aria-hidden', 'true'); 60412 _this.menuTrigger.setAttribute('aria-expanded', 'false'); 60413 _this.disableTabbableChildren(); 60414 _this.menuIsOpen = false; 60415 (0, lockBody_1.unlockBody)(_this.existingBodyStyles); 60416 _this.container.classList.remove(openMenuClass); 60417 _this.setCssVariables(); 60418 }; 60419 this.enableTabbableChildren = function () { 60420 _this.menuFocusableChildren.forEach(function (child) { 60421 child.tabIndex = 0; 60422 }); 60423 }; 60424 this.disableTabbableChildren = function () { 60425 _this.menuFocusableChildren.forEach(function (child) { 60426 child.tabIndex = -1; 60427 }); 60428 }; 60429 this.scrollHandler = function () { 60430 if (_this.hasLoaded) { 60431 var currentPosition = window.pageYOffset; 60432 var delta = currentPosition - _this.lastScrollPosition; 60433 _this.lastScrollPosition = currentPosition; 60434 if (_this.navIsShowing) { 60435 if (delta > 0 && currentPosition > _this.currentNavHeight && !_this.menuIsOpen) { 60436 _this.slideUp(); 60437 } 60438 } 60439 else if (delta < 0 || currentPosition < _this.currentNavHeight) { 60440 _this.slideDown(); 60441 } 60442 } 60443 }; 60444 this.getElementHeight = function (element) { 60445 return element ? element.offsetHeight : 0; 60446 }; 60447 this.resizeHandler = function () { 60448 _this.setCssVariables(); 60449 }; 60450 this.setCssVariables = function () { 60451 document.documentElement.style.setProperty('--nav-clearance', "".concat(_this.currentNavHeight, "px")); 60452 document.documentElement.style.setProperty('--breadcrumbs-offset', "".concat(_this.getElementHeight(_this.breadcrumbs), "px")); 60453 document.documentElement.style.setProperty('--anchornav-offset', "".concat(_this.getElementHeight(document.getElementById('pdpAnchorNav')), "px")); 60454 }; 60455 this.htmlElement = document.documentElement; 60456 this.container = navigation; 60457 this.menuTrigger = this.container.querySelector("[aria-controls=\"".concat(menuId, "\"]")); 60458 this.menuPanel = document.querySelector("#".concat(menuId)); 60459 this.menuFocusableChildren = [].slice.call(this.menuPanel.querySelectorAll('button, a, input')); 60460 this.breadcrumbs = document.querySelector("#".concat(breadCrumbId)
60460); 60461 this.menuIsOpen = false; 60462 this.navIsShowing = true; 60463 this.hasLoaded = false; 60464 this.existingBodyStyles = ''; 60465 this.navSearchCloseBtn = null; 60466 this.navItemTriggers = [].slice.call(this.container.querySelectorAll('[data-nav-button]')); 60467 this.searchTrigger = this.container.querySelector("[aria-controls=\"".concat(searchId, "\"]")); 60468 this.searchForms = Array.from(document.querySelectorAll('[data-search-form]')); 60469 this.searchToggleElements = Array.from(this.container.querySelectorAll('[data-search-toggle-text]')); 60470 this.searchIsOpen = false; 60471 this.searchForm = document.getElementById(this.searchTrigger.getAttribute('aria-controls')); 60472 // Intercept on-page links so that the offset recalculates before the browser reaches it 60473 // This makes sure that the target is always comfortably visible below the nav 60474 this.onPageAnchorLinks = [].slice.call(document.querySelectorAll('a[href^="#"]')); 60475 this.onPageAnchorLinks.forEach(function (link) { 60476 link.addEventListener('click', function (e) { 60477 e.preventDefault(); 60478 var hash = link.getAttribute('href'); 60479 var target = document.querySelector(hash); 60480 if (target) { 60481 if (_this.navIsShowing && target.offsetTop > window.pageYOffset) { 60482 _this.slideUp(); 60483 } 60484 else if (!_this.navIsShowing && target.offsetTop < window.pageYOffset) { 60485 _this.slideDown(); 60486 } 60487 setTimeout(function () { 60488 target.scrollIntoView(true); 60489 target.focus(); 60490 window.location.hash = hash; 60491 }, 0); 60492 } 60493 }); 60494 }); 60495 this.navItemTriggers.forEach(function (trigger) { 60496 trigger.addEventListener('click', function () { return _this.handleTriggerClick(trigger); }); 60497 }); 60498 this.subNavsOpen = false; 60499 this.setCssVariables(); 60500 } 60501 Object.defineProperty(MainNavigation.prototype, "currentNavHeight", { 60502 get: function () { 60503 return this.container.offsetHeight; 60504 }, 60505 enumerable: false, 60506 configurable: true 60507 }); 60508 return MainNavigation; 60509}()); 60510var mainNavigation = null; 60511exports.mainNavigation = mainNavigation; 60512var navContainer = document.querySelector("#".concat(navId)); 60513if (navContainer) { 60514 exports.mainNavigation = mainNavigation = new MainNavigation(navContainer); 60515 window.mainNavigation = mainNavigation; 60516} 60517 60518 60519/***/ }), 60520
60521/***/ "./Static/javascript/modules/promo-interface.ts": 60522/*!******************************************************!*\ 60523 !*** ./Static/javascript/modules/promo-interface.ts ***! 60524 \******************************************************/ 60525/***/ (() => { 60526 60527var PromoInterface = /** @class */ (function () { 60528 function PromoInterface(container) { 60529 var _this = this; 60530 this.container = container; 60531 this.trigger = container.querySelector('[data-promo-entry]'); 60532 this.panel = container.querySelector('[data-promo-input]'); 60533 this.hasError = this.trigger.classList.contains('hide'); 60534 if (!this.hasError) { 60535 this.trigger.addEventListener('click', function () { 60536 _this.trigger.classList.add('hide'); 60537 _this.panel.classList.remove('hide'); 60538 }); 60539 } 60540 } 60541 return PromoInterface; 60542}()); 60543var promoEls = [].slice.call(document.querySelectorAll('[data-promo]')); 60544promoEls.forEach(function (promoEl) { 60545 new PromoInterface(promoEl); 60546}); 60547 60548 60549/***/ }), 60550
60551/***/ "./Static/javascript/modules/revealPanel.ts": 60552/*!**************************************************!*\ 60553 !*** ./Static/javascript/modules/revealPanel.ts ***! 60554 \**************************************************/ 60555/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 60556 60557"use strict"; 60558 60559Object.defineProperty(exports, "__esModule", ({ value: true })); 60560exports.RevealPanel = void 0; 60561var enableTabbableChildren_1 = __webpack_require__(/*! ../helpers/enableTabbableChildren */ "./Static/javascript/helpers/enableTabbableChildren.ts"); 60562var disableTabbableChildren_1 = __webpack_require__(/*! ../helpers/disableTabbableChildren */ "./Static/javascript/helpers/disableTabbableChildren.ts"); 60563var getHeightOfHidden_1 = __webpack_require__(/*! ../helpers/getHeightOfHidden */ "./Static/javascript/helpers/getHeightOfHidden.ts"); 60564var lodash_1 = __webpack_require__(/*! lodash */ "lodash"); 60565var transitionSpeed = 300; 60566var defaultPanelAttribute = 'data-panel'; 60567var openClass = 'opened'; 60568var RevealPanel = /** @class */ (function () { 60569 function RevealPanel(panel) { 60570 var _this = this; 60571 var _a; 60572 var panelId = typeof panel == 'string' ? panel : panel.id; 60573 this.panel = document.querySelector("#".concat(panelId)); 60574 this.triggers = [].slice.call(document.querySelectorAll("[aria-controls=\"".concat(panelId, "\"]"))); 60575 this.childPanels = [].slice.call(this.panel.querySelectorAll("[".concat(defaultPanelAttribute, "]"))); 60576 this.clearInputsOnClose = ((_a = this.panel.getAttribute('data-clear-inputs-on-close')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true'; 60577 this.isOpen = false; 60578 this.openHandlers = []; 60579 this.closeHandlers = []; 60580 this.afterCloseHandlers = []; 60581 if (this.clearInputsOnClose) { 60582 // We're not getting select elements here, because there's much more logic at play for state/country select states and we don't need to make them blank 60583 this.inputChildren = [].slice.call(this.panel.querySelectorAll('input, textarea')); 60584 } 60585 window.addEventListener('resize', (0, lodash_1.debounce)(function () { 60586 _this.setPanelHeight(); 60587 }, 100)); 60588 this.triggers.forEach(function (trigger) { 60589 if (!trigger.matches('input[type="checkbox"] + label, input[type="radio"] + label, input[type="checkbox"] + input[type="hidden"] + label, input[type="radio"] + input[type="hidden"] + label')) { 60590 _this.initButtonTrigger(trigger); 60591 } 60592 else { 60593 _this.initRadioOrCheckboxTrigger(trigger); 60594 } 60595 }); 60596 } 60597 RevealPanel.prototype.initButtonTrigger = function (trigger) { 60598 trigger.addEventListener('click', this.triggerClick.bind(this)); 60599 this.initClosedPanel(); 60600 }; 60601 RevealPanel.prototype.initRadioOrCheckboxTrigger = function (trigger) { 60602 var _this = this; 60603 var triggerInput = trigger.previousElementSibling; 60604 if (triggerInput.getAttribute('type') == 'hidden') { 60605 triggerInput = triggerInput.previousElementSibling; 60606 } 60607 var inputGroup = [].slice.call(document.querySelectorAll("[type=\"radio\"][name=\"".concat(triggerInput.name, "\"], [type=\"checkbox\"][name=\"").concat(triggerInput.name, "\"]"))); 60608 if (triggerInput.checked) { 60609 this.initOpenPanel(); 60610 } 60611 else { 60612 this.initClosedPanel(); 60613 } 60614 inputGroup.forEach(function (inputInGroup) { 60615 inputInGroup.addEventListener('change', function () { 60616 if (triggerInput.checked) { 60617 if (!_this.isOpen) { 60618 _this.openPanel(); 60619 } 60620 } 60621 else { 60622 if (_this.isOpen) { 60623 _this.closePanel(); 60624 } 60625 } 60626 }); 60627 }); 60628 }; 60629 RevealPanel.prototype.initOpenPanel = function () { 60630 var _this = this; 60631 setTimeout(function () { 60632 _this.setPanelHeight(); 60633 _this.openPanel(); 60634 }, 0); 60635 }; 60636 RevealPanel.prototype.initClosedPanel = function () { 60637 var _this = this; 60638 setTimeout(function () { 60639 _this.setPanelHeight(); 60640 _this.closePanel(); 60641 }, 0); 60642 }; 60643 RevealPanel.prototype.on = function (event, handler) { 60644 switch (event) { 60645 case "open": 60646 return this.openHandlers.push(handler); 60647 case "close": 60648 return this.closeHandlers.push(handler); 60649 case "afterClose": 60650 return this.afterCloseHandlers.push(handler); 60651 } 60652 }; 60653 RevealPanel.prototype.setPanelHeight = function (childPanel) { 60654 if (childPanel) { 60655 var childPanelHeight = (0, getHeightOfHidden_1.getHeightOfHidden)(childPanel); 60656 childPanel.style.height = "".concat(childPanelHeight, "px"); 60657 } 60658 else { 60659 var panelHeight = (0, getHeightOfHidden_1.getHeightOfHidden)(this.panel); 60660 this.panel.style.height = "".concat(panelHeight, "px"); 60661 } 60662 }; 60663 RevealPanel.prototype.triggerClick = function (e) { 60664 if (this.isOpen) { 60665 this.closePanel(); 60666 } 60667 else {
60668 this.openPanel(); 60669 } 60670 }; 60671 RevealPanel.prototype.openPanel = function () { 60672 var _this = this; 60673 var handleOpen = function () { 60674 if (_this.isOpen) { 60675 _this.panel.style.overflow = 'visible'; 60676 _this.childPanels.forEach(function (childPanel) { 60677 _this.setPanelHeight(childPanel); 60678 }); 60679 _this.panel.classList.add(openClass); 60680 } 60681 }; 60682 setTimeout(function () { 60683 handleOpen(); 60684 if (_this.openHandlers.length > 0) { 60685 _this.openHandlers.forEach(function (handler) { 60686 requestAnimationFrame(handler.bind(_this)); 60687 }); 60688 } 60689 }, transitionSpeed); 60690 this.triggers.forEach(function (trigger) { 60691 trigger.setAttribute('aria-expanded', 'true'); 60692 }); 60693 this.panel.setAttribute('aria-hidden', 'false'); 60694 (0, enableTabbableChildren_1.enableTabbableChildren)(this.panel); 60695 this.isOpen = true; 60696 }; 60697 RevealPanel.prototype.closePanel = function () { 60698 var _this = this; 60699 this.panel.classList.remove(openClass); 60700 if (this.clearInputsOnClose) { 60701 this.clearChildInputs(); 60702 } 60703 if (this.closeHandlers.length > 0) { 60704 this.closeHandlers.forEach(function (handler) { 60705 handler(); 60706 }); 60707 } 60708 requestAnimationFrame(function () { 60709 _this.panel.style.overflow = ''; 60710 _this.triggers.forEach(function (trigger) { 60711 trigger.setAttribute('aria-expanded', 'false'); 60712 }); 60713 _this.panel.setAttribute('aria-hidden', 'true'); 60714 (0, disableTabbableChildren_1.disableTabbableChildren)(_this.panel); 60715 _this.isOpen = false; 60716 }); 60717 if (this.afterCloseHandlers.length > 0) { 60718 this.afterCloseHandlers.forEach(function (handler) { 60719 setTimeout(function () { 60720 requestAnimationFrame(handler.bind(_this)); 60721 }, transitionSpeed); 60722 }); 60723 } 60724 }; 60725 RevealPanel.prototype.clearChildInputs = function () { 60726 this.inputChildren.forEach(function (field) { 60727 var changeEvent = new Event('change'); 60728 var fieldType = field.getAttribute('type'); 60729 if (fieldType == 'radio' || fieldType == 'checkbox') { 60730 field.checked = false; 60731 } 60732 else if (fieldType != 'hidden') { 60733 field.value = ''; 60734 } 60735 field.dispatchEvent(changeEvent); 60736 }); 60737 }; 60738 return RevealPanel; 60739}()); 60740exports.RevealPanel = RevealPanel; 60741 60742 60743/***/ }), 60744
60745/***/ "./Static/javascript/modules/show-hide-password.ts": 60746/*!*********************************************************!*\ 60747 !*** ./Static/javascript/modules/show-hide-password.ts ***! 60748 \*********************************************************/ 60749/***/ ((__unused_webpack_module, exports) => { 60750 60751"use strict"; 60752 60753Object.defineProperty(exports, "__esModule", ({ value: true })); 60754exports.showHidePassword = void 0; 60755var showHidePassword = function () { 60756 var passwordToggles = [].slice.call(document.querySelectorAll('[data-password-input]')); 60757 passwordToggles.forEach(function (toggleContainer) { 60758 var passwordToggle = toggleContainer.querySelector('button'); 60759 var passwordInput = toggleContainer.querySelector('input[type="password"]'); 60760 if (passwordToggle && passwordInput) { 60761 var showText_1 = passwordToggle.getAttribute('data-password-input-show'); 60762 var hideText_1 = passwordToggle.getAttribute('data-password-input-hide'); 60763 var checked_1 = false; 60764 passwordToggle.addEventListener('click', function () { 60765 if (!checked_1) { 60766 passwordInput.type = 'text'; 60767 passwordToggle.setAttribute('aria-label', hideText_1); 60768 passwordToggle.setAttribute('aria-pressed', 'true'); 60769 } 60770 else { 60771 passwordInput.type = 'password'; 60772 passwordToggle.setAttribute('aria-label', showText_1); 60773 passwordToggle.setAttribute('aria-pressed', 'false'); 60774 } 60775 checked_1 = !checked_1; 60776 }); 60777 } 60778 }); 60779}; 60780exports.showHidePassword = showHidePassword; 60781 60782 60783/***/ }), 60784
60785/***/ "./Static/javascript/modules/splide-transition.ts": 60786/*!********************************************************!*\ 60787 !*** ./Static/javascript/modules/splide-transition.ts ***! 60788 \********************************************************/ 60789/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 60790 60791"use strict"; 60792 60793Object.defineProperty(exports, "__esModule", ({ value: true })); 60794exports.MyTransition = void 0; 60795var splide_1 = __webpack_require__(/*! @splidejs/splide */ "./node_modules/@splidejs/splide/dist/js/splide.cjs.js"); 60796//https://splidejs.com/guides/transition/ for docs 60797function MyTransition(Splide, Components) { 60798 var bind = (0, splide_1.EventInterface)(Splide).bind; 60799 var Move = Components.Move; 60800 var list = Components.Elements.list; 60801 var endCallback; 60802 function mount() { 60803 bind(list, 'transitionend', function (e) { 60804 if (e.target === list && endCallback) { 60805 // Removes the transition property 60806 cancel(); 60807 // Calls the `done` callback 60808 endCallback(); 60809 } 60810 }); 60811 } 60812 function start(index, done) { 60813 // Converts the index to the position 60814 var destination = Move.toPosition(index, true); 60815 // Applies the CSS transition 60816 list.style.transition = 'transform 300ms cubic-bezier(.44,.65,.07,1.01)'; 60817 // Moves the carousel to the destination. 60818 Move.translate(destination); 60819 // Keeps the callback to invoke later. 60820 endCallback = done; 60821 } 60822 function cancel() { 60823 list.style.transition = ''; 60824 } 60825 return { 60826 mount: mount, 60827 start: start, 60828 cancel: cancel, 60829 }; 60830} 60831exports.MyTransition = MyTransition; 60832 60833 60834/***/ }), 60835
60836/***/ "./Static/javascript/modules/sticky-sidebar-component.ts": 60837/*!***************************************************************!*\ 60838 !*** ./Static/javascript/modules/sticky-sidebar-component.ts ***! 60839 \***************************************************************/ 60840/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 60841 60842"use strict"; 60843 60844var __importDefault = (this && this.__importDefault) || function (mod) { 60845 return (mod && mod.__esModule) ? mod : { "default": mod }; 60846}; 60847Object.defineProperty(exports, "__esModule", ({ value: true })); 60848exports.StickySidebarComponent = void 0; 60849// Resize Sensor will ensure the sticky sidebar is able to update itself when the browser is resized 60850__webpack_require__(/*! css-element-queries/src/ResizeSensor.js */ "./node_modules/css-element-queries/src/ResizeSensor.js"); 60851var sticky_sidebar_js_1 = __importDefault(__webpack_require__(/*! sticky-sidebar/dist/sticky-sidebar.js */ "./node_modules/sticky-sidebar/dist/sticky-sidebar.js")); 60852var StickySidebarComponent = /** @class */ (function () { 60853 function StickySidebarComponent(sidebar) { 60854 var _this = this; 60855 this.topMargin = parseInt(sidebar.getAttribute('data-margin-top')); 60856 this.bottomMargin = parseInt(sidebar.getAttribute('data-margin-bottom')); 60857 this.breakpoint = parseInt(sidebar.getAttribute('data-sticky-for')); 60858 this.updateStickySidebar = this.updateStickySidebar.bind(this); 60859 this.stickySidebar = new sticky_sidebar_js_1.default("#".concat(sidebar.id), { 60860 containerSelector: '[data-sticky-container]', 60861 innerWrapperSelector: '[data-sticky-inner]', 60862 topSpacing: this.topMargin, 60863 bottomSpacing: this.bottomMargin, 60864 minWidth: this.breakpoint 60865 }); 60866 // Update it after a beat, in case anything needs to finish loading 60867 window.requestAnimationFrame(function () { 60868 _this.updateStickySidebar(); 60869 }); 60870 } 60871 StickySidebarComponent.prototype.updateStickySidebar = function () { 60872 if (this.stickySidebar) { 60873 this.stickySidebar.updateSticky(); 60874 } 60875 }; 60876 return StickySidebarComponent; 60877}()); 60878exports.StickySidebarComponent = StickySidebarComponent; 60879var stickyContainerEls = [].slice.call(document.querySelectorAll('[data-sticky-el]')); 60880stickyContainerEls.forEach(function (stickyEl) { 60881 new StickySidebarComponent(stickyEl); 60882}); 60883 60884 60885/***/ }), 60886
60887/***/ "./Static/javascript/modules/svg-loader.ts": 60888/*!*************************************************!*\ 60889 !*** ./Static/javascript/modules/svg-loader.ts ***! 60890 \*************************************************/ 60891/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 60892 60893"use strict"; 60894 60895Object.defineProperty(exports, "__esModule", ({ value: true })); 60896exports.SvgSprite = void 0; 60897(__webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js").polyfill)(); 60898__webpack_require__(/*! isomorphic-fetch */ "./node_modules/isomorphic-fetch/fetch-npm-browserify.js"); 60899var SvgSprite = /** @class */ (function () { 60900 function SvgSprite(svgURL) { 60901 var _this = this; 60902 var url = svgURL; 60903 // Override the svg path in the view 60904 var urlOverride = document.querySelector('#svgSpriteUrl'); 60905 if (urlOverride) 60906 url = urlOverride.value; 60907 var sprite = document.querySelector('#svgSprite'); 60908 if (!sprite) { 60909 window.fetch(url) 60910 .then(function (response) { 60911 if (response.status !== 200) { 60912 throw "SVG sprite load failed. Status code: " + response.status; 60913 } 60914 else { 60915 return response.text(); 60916 } 60917 }) 60918 .then(function (svg) { return _this.injectSvg(svg); }); 60919 } 60920 } 60921 SvgSprite.prototype.injectSvg = function (data) { 60922 if (data !== undefined) { 60923 var newDiv = document.createElement('div'); 60924 newDiv.innerHTML = data; 60925 document.body.insertBefore(newDiv, document.body.childNodes[0]); 60926 } 60927 }; 60928 return SvgSprite; 60929}()); 60930exports.SvgSprite = SvgSprite; 60931 60932 60933/***/ }), 60934
60935/***/ "./Static/javascript/modules/tabs.ts": 60936/*!*******************************************!*\ 60937 !*** ./Static/javascript/modules/tabs.ts ***! 60938 \*******************************************/ 60939/***/ ((__unused_webpack_module, exports) => { 60940 60941"use strict"; 60942 60943Object.defineProperty(exports, "__esModule", ({ value: true })); 60944exports.Tabs = void 0; 60945var Tabs = /** @class */ (function () { 60946 function Tabs(options) { 60947 var _this = this; 60948 // Most of this is from the WAI-ARIA Authoring Guide and revised for TS https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html 60949 this.options = options; 60950 this.container = options.container; 60951 this.delay = this.determineDelay(); 60952 this.tabs = [].slice.call(this.container.querySelectorAll('[role="tab"]')); 60953 this.panels = [].slice.call(this.container.querySelectorAll('[role="tabpanel"]')); 60954 var hasPagination = this.container.getAttribute('data-tabs-pagination') == "true"; 60955 this.tabSwitchHandlers = []; 60956 // For easy reference 60957 this.keys = { 60958 end: 35, 60959 home: 36, 60960 left: 37, 60961 right: 39 60962 }; 60963 // Add or substract depending on key pressed 60964 this.direction = { 60965 37: -1, 60966 39: 1 60967 }; 60968 // Bind listeners
60969 this.tabs.forEach(function (tab) { 60970 tab.addEventListener('click', _this.clickEventListener.bind(_this)); 60971 tab.addEventListener('keydown', _this.keydownEventListener.bind(_this)); 60972 tab.addEventListener('keyup', _this.keyupEventListener.bind(_this)); 60973 }); 60974 if (hasPagination) { 60975 this.attachPagination(); 60976 } 60977 } 60978 Tabs.prototype.on = function (event, handler) { 60979 switch (event) { 60980 case "tabSwitch": 60981 return this.tabSwitchHandlers.push(handler); 60982 } 60983 }; 60984 Tabs.prototype.attachPagination = function () { 60985 var _this = this; 60986 this.panels.forEach(function (panel, index) { 60987 var buttonContainer = document.createElement('div'); 60988 buttonContainer.className = "adage-block tabs-pagination"; 60989 if (index > 0) { 60990 // attach previous button 60991 var nextButton = _this.duplicateTabForPagination(_this.tabs[index - 1], "previous"); 60992 buttonContainer.appendChild(nextButton); 60993 } 60994 if (index < (_this.panels.length - 1)) { 60995 // attach next button 60996 var nextButton = _this.duplicateTabForPagination(_this.tabs[index + 1], "next"); 60997 buttonContainer.appendChild(nextButton); 60998 } 60999 panel.appendChild(buttonContainer); 61000 }); 61001 }; 61002 Tabs.prototype.duplicateTabForPagination = function (tab, suffix) { 61003 var newButton = tab.cloneNode(true); 61004 newButton.setAttribute('data-related-tab', newButton.id); 61005 newButton.id = "".concat(newButton.id, "_").concat(suffix); 61006 newButton.removeAttribute('aria-setsize'); 61007 newButton.removeAttribute('aria-posinset'); 61008 newButton.removeAttribute('role'); 61009 newButton.removeAttribute('aria-selected'); 61010 newButton.removeAttribute('tabindex'); 61011 newButton.className = "tabs-pagination-btn"; 61012 newButton.addEventListener('click', this.clickEventListener.bind(this)); 61013 var buttonWrapper = document.createElement('div'); 61014 buttonWrapper.className = "tabs-pagination-".concat(suffix); 61015 buttonWrapper.appendChild(newButton); 61016 return buttonWrapper; 61017 }; 61018 // When a tab is clicked, activateTab is fired to activate it 61019 Tabs.prototype.clickEventListener = function (event) { 61020 var tab = event.target; 61021 if (tab.getAttribute('data-related-tab')) { 61022 tab = this.container.querySelector('#' + tab.getAttribute('data-related-tab')); 61023 } 61024 this.activateTab(tab, false); 61025 }; 61026 // Handle keydown on tabs 61027 Tabs.prototype.keydownEventListener = function (event) { 61028 var key = event.keyCode; 61029 switch (key) { 61030 case this.keys.end: 61031 event.preventDefault(); 61032 // Activate last tab 61033 this.activateTab(this.tabs[this.tabs.length - 1], true); 61034 break; 61035 case this.keys.home: 61036 event.preventDefault(); 61037 // Activate first tab 61038 this.activateTab(this.tabs[0], true); 61039 break; 61040 } 61041 }; 61042 // Handle keyup on tabs 61043 Tabs.prototype.keyupEventListener = function (event) { 61044 var key = event.keyCode; 61045 switch (key) { 61046 case this.keys.left: 61047 case this.keys.right: 61048 this.switchTabOnArrowPress(event); 61049 break; 61050 } 61051 }; 61052 // Either focus the next, previous, first, or last tab 61053 // depening on key pressed 61054 Tabs.prototype.switchTabOnArrowPress = function (event) { 61055 var _this = this; 61056 var pressed = event.keyCode;
61057 this.tabs.forEach(function (tab) { 61058 tab.addEventListener('focus', _this.focusEventHandler.bind(_this)); 61059 }); 61060 if (this.direction[pressed]) { 61061 var target = event.target; 61062 var index = parseInt(target.getAttribute('aria-posinset')) - 1; 61063 if (index !== undefined) { 61064 if (this.tabs[index + this.direction[pressed]]) { 61065 this.tabs[index + this.direction[pressed]].focus(); 61066 } 61067 else if (pressed === this.keys.left || pressed === this.keys.up) { 61068 this.focusLastTab(); 61069 } 61070 else if (pressed === this.keys.right || pressed == this.keys.down) { 61071 this.focusFirstTab(); 61072 } 61073 } 61074 } 61075 }; 61076 // Activates any given tab panel 61077 Tabs.prototype.activateTab = function (tab, setFocus) { 61078 var _this = this; 61079 setFocus = setFocus || true; 61080 // Deactivate all other tabs 61081 this.deactivateTabs(); 61082 // Remove tabindex attribute 61083 tab.removeAttribute('tabindex'); 61084 // Set the tab as selected 61085 tab.setAttribute('aria-selected', 'true'); 61086 // Get the value of aria-controls (which is an ID) 61087 var controls = tab.getAttribute('aria-controls'); 61088 // Remove hidden attribute from tab panel to make it visible 61089 document.getElementById(controls).removeAttribute('hidden'); 61090 // Set focus when required 61091 if (setFocus) { 61092 tab.focus(); 61093 } 61094 if (this.tabSwitchHandlers) { 61095 this.tabSwitchHandlers.forEach(function (handler) { 61096 setTimeout(handler.bind(_this), 0); 61097 }); 61098 } 61099 }; 61100 // Deactivate all tabs and tab panels 61101 Tabs.prototype.deactivateTabs = function () { 61102 var _this = this;
61103 this.tabs.forEach(function (tab) { 61104 tab.setAttribute('tabindex', '-1'); 61105 tab.setAttribute('aria-selected', 'false'); 61106 tab.removeEventListener('focus', _this.focusEventHandler.bind(_this)); 61107 }); 61108 this.panels.forEach(function (panel) { 61109 panel.setAttribute('hidden', 'hidden'); 61110 }); 61111 }; 61112 // Make a guess 61113 Tabs.prototype.focusFirstTab = function () { 61114 this.tabs[0].focus(); 61115 }; 61116 // Make a guess 61117 Tabs.prototype.focusLastTab = function () { 61118 this.tabs[this.tabs.length - 1].focus(); 61119 }; 61120 // Determine whether there should be a delay 61121 // when user navigates with the arrow keys 61122 Tabs.prototype.determineDelay = function () { 61123 var hasDelay = this.container.hasAttribute('data-delay'); 61124 var delay = 0; 61125 if (hasDelay) { 61126 var delayValue = parseInt(this.container.getAttribute('data-delay')); 61127 if (delayValue) { 61128 delay = delayValue; 61129 } 61130 else { 61131 // If no value is specified, default to 300ms 61132 delay = 300; 61133 } 61134 } 61135 return delay; 61136 }; 61137 // 61138 Tabs.prototype.focusEventHandler = function (event) { 61139 var target = event.target; 61140 setTimeout(this.checkTabFocus.bind(this), this.delay, target); 61141 }; 61142 // Only activate tab on focus if it still has focus after the delay 61143 Tabs.prototype.checkTabFocus = function (target) { 61144 var focused = document.activeElement; 61145 if (target === focused) { 61146 this.activateTab(target, false); 61147 } 61148 }; 61149 Tabs.prototype.getActiveTabPanel = function () { 61150 var _this = this; 61151 var selected = this.panels[0];
61152 this.tabs.forEach(function (tab, index) { 61153 if (_this.tabs[index].getAttribute('aria-selected') == 'true') { 61154 selected = _this.panels[index]; 61155 } 61156 }); 61157 return selected; 61158 }; 61159 Tabs.prototype.getActiveTabIndex = function () { 61160 var _this = this; 61161 var selected = 0; 61162 this.tabs.forEach(function (tab, index) { 61163 if (_this.tabs[index].getAttribute('aria-selected') == 'true') { 61164 selected = index; 61165 } 61166 }); 61167 return selected; 61168 }; 61169 return Tabs; 61170}()); 61171exports.Tabs = Tabs; 61172 61173 61174/***/ }), 61175
61176/***/ "./Static/javascript/modules/videoItem.ts": 61177/*!************************************************!*\ 61178 !*** ./Static/javascript/modules/videoItem.ts ***! 61179 \************************************************/ 61180/***/ (function(__unused_webpack_module, exports, __webpack_require__) { 61181 61182"use strict"; 61183 61184var __importDefault = (this && this.__importDefault) || function (mod) { 61185 return (mod && mod.__esModule) ? mod : { "default": mod }; 61186}; 61187Object.defineProperty(exports, "__esModule", ({ value: true })); 61188exports.VideoItem = void 0; 61189var player_1 = __importDefault(__webpack_require__(/*! @vimeo/player */ "./node_modules/@vimeo/player/dist/player.es.js")); 61190var VideoType; 61191(function (VideoType) { 61192 VideoType["NATIVE"] = "native"; 61193 VideoType["VIMEO"] = "vimeo"; 61194 VideoType["YOUTUBE"] = "youtube"; 61195 VideoType["NONE"] = "none"; 61196})(VideoType || (VideoType = {})); 61197var VideoItem = /** @class */ (function () { 61198 function VideoItem(container, youtubeVideoPlayer) { 61199 if (youtubeVideoPlayer) 61200 this.youtubeVideoPlayer = youtubeVideoPlayer; 61201 this.container = container; 61202 this.video = this.youtubeVideoPlayer ? this.container.querySelector('iframe') : this.container.querySelector('[data-video]'); 61203 this.videoType = this.container.getAttribute('data-video-type'); 61204 this.videoSrc = this.video.getAttribute('data-src'); 61205 this.playButton = this.container.querySelector('[data-video-play]'); 61206 this.initializeVideo(); 61207 } 61208 VideoItem.prototype.playPause = function () { 61209 var _this = this; 61210 // Youtube Play and Pause 61211 if (this.videoType == VideoType.YOUTUBE) { 61212 var playerState = this.videoObject.getPlayerState(); 61213 //// == 1 means it's playing 61214 if (playerState == 1) { 61215 this.videoObject.pauseVideo(); 61216 } 61217 else { 61218 this.videoObject.playVideo(); 61219 if (this.videoObject.isMuted()) 61220 this.videoObject.unMute(); 61221 } 61222 } 61223 // Native Play and Pause 61224 if (this.videoType == VideoType.NATIVE) { 61225 if (this.videoObject.paused) { 61226 this.videoObject.play(); 61227 } 61228 else { 61229 this.videoObject.pause(); 61230 } 61231 this.videoObject.controls = true; 61232 } 61233 // Vimeo Play and Pause 61234 if (this.videoType == VideoType.VIMEO) { 61235 this.videoObject.getPaused().then(function (paused) { 61236 if (paused) { 61237 _this.videoObject.play(); 61238 } 61239 else { 61240 _this.videoObject.pause(); 61241 } 61242 }); 61243 } 61244 this.container.classList.add('media-item-playing'); 61245 }; 61246 VideoItem.prototype.initializeVideo = function () { 61247 if (!this.video.src) { 61248 // Native video initialization 61249 if (this.videoType == VideoType.NATIVE) { 61250 this.video = this.video; 61251 var videoSource = this.video.querySelector('source'); 61252 if (videoSource) { 61253 videoSource.src = this.videoSrc; 61254 this.videoObject = this.video; 61255 this.videoObject.load(); 61256 this.videoObject.controls = false; 61257 } 61258 } 61259 // Vimeo video initialization 61260 if (this.videoType == VideoType.VIMEO) { 61261 this.video.src = this.videoSrc; 61262 var vimeoPlayer = new player_1.default(this.video, {}); 61263 this.videoObject = vimeoPlayer; 61264 } 61265 } 61266 else { 61267 // Youtube initialization and handlers 61268 if (this.videoType == VideoType.YOUTUBE) { 61269 this.videoObject = this.youtubeVideoPlayer; 61270 } 61271 } 61272 //Activate Playbutton 61273 this.playButton.addEventListener('click', this.playPause.bind(this)); 61274 }; 61275 return VideoItem; 61276}()); 61277exports.VideoItem = VideoItem; 61278 61279 61280/***/ }), 61281
vendor: 8,914 bytes, lines 61282-61531
61282/***/ "./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js": 61283/*!**********************************************************************************************!*\ 61284 !*** ./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js ***! 61285 \**********************************************************************************************/ 61286/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 61287 61288"use strict"; 61289/** 61290 * @license React 61291 * use-sync-external-store-shim.development.js 61292 * 61293 * Copyright (c) Facebook, Inc. and its affiliates. 61294 * 61295 * This source code is licensed under the MIT license found in the 61296 * LICENSE file in the root directory of this source tree. 61297 */ 61298 61299 61300 61301if (true) { 61302 (function() { 61303 61304 'use strict'; 61305 61306/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 61307if ( 61308 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 61309 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === 61310 'function' 61311) { 61312 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); 61313} 61314 var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 61315 61316var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; 61317 61318function error(format) { 61319 { 61320 { 61321 for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { 61322 args[_key2 - 1] = arguments[_key2]; 61323 } 61324 61325 printWarning('error', format, args); 61326 } 61327 } 61328} 61329 61330function printWarning(level, format, args) { 61331 // When changing this logic, you might want to also 61332 // update consoleWithStackDev.www.js as well. 61333 { 61334 var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; 61335 var stack = ReactDebugCurrentFrame.getStackAddendum(); 61336 61337 if (stack !== '') { 61338 format += '%s'; 61339 args = args.concat([stack]); 61340 } // eslint-disable-next-line react-internal/safe-string-coercion 61341 61342 61343 var argsWithFormat = args.map(function (item) { 61344 return String(item); 61345 }); // Careful: RN currently depends on this prefix 61346 61347 argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it 61348 // breaks IE9: https://github.com/facebook/react/issues/13610 61349 // eslint-disable-next-line react-internal/no-production-logging 61350 61351 Function.prototype.apply.call(console[level], console, argsWithFormat); 61352 } 61353} 61354 61355/** 61356 * inlined Object.is polyfill to avoid requiring consumers ship their own 61357 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 61358 */ 61359function is(x, y) { 61360 return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare 61361 ; 61362} 61363 61364var objectIs = typeof Object.is === 'function' ? Object.is : is; 61365 61366// dispatch for CommonJS interop named imports. 61367 61368var useState = React.useState, 61369 useEffect = React.useEffect, 61370 useLayoutEffect = React.useLayoutEffect, 61371 useDebugValue = React.useDebugValue; 61372var didWarnOld18Alpha = false; 61373var didWarnUncachedGetSnapshot = false; // Disclaimer: This shim breaks many of the rules of React, and only works 61374// because of a very particular set of implementation details and assumptions 61375// -- change any one of them and it will break. The most important assumption 61376// is that updates are always synchronous, because concurrent rendering is 61377// only available in versions of React that also have a built-in 61378// useSyncExternalStore API. And we only use this shim when the built-in API 61379// does not exist. 61380// 61381// Do not assume that the clever hacks used by this hook also work in general. 61382// The point of this shim is to replace the need for hacks by other libraries. 61383 61384function useSyncExternalStore(subscribe, getSnapshot, // Note: The shim does not use getServerSnapshot, because pre-18 versions of 61385// React do not expose a way to check if we're hydrating. So users of the shim 61386// will need to track that themselves and return the correct value 61387// from `getSnapshot`. 61388getServerSnapshot) { 61389 { 61390 if (!didWarnOld18Alpha) { 61391 if (React.startTransition !== undefined) { 61392 didWarnOld18Alpha = true; 61393 61394 error('You are using an outdated, pre-release alpha of React 18 that ' + 'does not support useSyncExternalStore. The ' + 'use-sync-external-store shim will not work correctly. Upgrade ' + 'to a newer pre-release.'); 61395 } 61396 } 61397 } // Read the current snapshot from the store on every render. Again, this 61398 // breaks the rules of React, and only works here because of specific 61399 // implementation details, most importantly that updates are 61400 // always synchronous. 61401 61402 61403 var value = getSnapshot(); 61404 61405 { 61406 if (!didWarnUncachedGetSnapshot) { 61407 var cachedValue = getSnapshot(); 61408 61409 if (!objectIs(value, cachedValue)) { 61410 error('The result of getSnapshot should be cached to avoid an infinite loop'); 61411 61412 didWarnUncachedGetSnapshot = true; 61413 } 61414 } 61415 } // Because updates are synchronous, we don't queue them. Instead we force a 61416 // re-render whenever the subscribed state changes by updating an some 61417 // arbitrary useState hook. Then, during render, we call getSnapshot to read 61418 // the current value. 61419 // 61420 // Because we don't actually use the state returned by the useState hook, we 61421 // can save a bit of memory by storing other stuff in that slot. 61422 // 61423 // To implement the early bailout, we need to track some things on a mutable 61424 // object. Usually, we would put that in a useRef hook, but we can stash it in 61425 // our useState hook instead. 61426 // 61427 // To force a re-render, we call forceUpdate({inst}). That works because the 61428 // new object always fails an equality check. 61429 61430 61431 var _useState = useState({ 61432 inst: { 61433 value: value, 61434 getSnapshot: getSnapshot 61435 } 61436 }), 61437 inst = _useState[0].inst, 61438 forceUpdate = _useState[1]; // Track the latest getSnapshot function with a ref. This needs to be updated 61439 // in the layout phase so we can access it during the tearing check that 61440 // happens on subscribe. 61441 61442 61443 useLayoutEffect(function () { 61444 inst.value = value; 61445 inst.getSnapshot = getSnapshot; // Whenever getSnapshot or subscribe changes, we need to check in the 61446 // commit phase if there was an interleaved mutation. In concurrent mode 61447 // this can happen all the time, but even in synchronous mode, an earlier 61448 // effect may have mutated the store. 61449 61450 if (checkIfSnapshotChanged(inst)) { 61451 // Force a re-render. 61452 forceUpdate({ 61453 inst: inst 61454 }); 61455 } 61456 }, [subscribe, value, getSnapshot]); 61457 useEffect(function () { 61458 // Check for changes right before subscribing. Subsequent changes will be 61459 // detected in the subscription handler. 61460 if (checkIfSnapshotChanged(inst)) { 61461 // Force a re-render. 61462 forceUpdate({ 61463 inst: inst 61464 }); 61465 } 61466 61467 var handleStoreChange = function () { 61468 // TODO: Because there is no cross-renderer API for batching updates, it's 61469 // up to the consumer of this library to wrap their subscription event 61470 // with unstable_batchedUpdates. Should we try to detect when this isn't 61471 // the case and print a warning in development? 61472 // The store changed. Check if the snapshot changed since the last time we 61473 // read from the store. 61474 if (checkIfSnapshotChanged(inst)) { 61475 // Force a re-render. 61476 forceUpdate({ 61477 inst: inst 61478 }); 61479 } 61480 }; // Subscribe to the store and return a clean-up function. 61481 61482 61483 return subscribe(handleStoreChange); 61484 }, [subscribe]); 61485 useDebugValue(value); 61486 return value; 61487} 61488 61489function checkIfSnapshotChanged(inst) { 61490 var latestGetSnapshot = inst.getSnapshot; 61491 var prevValue = inst.value; 61492 61493 try { 61494 var nextValue = latestGetSnapshot(); 61495 return !objectIs(prevValue, nextValue); 61496 } catch (error) { 61497 return true; 61498 } 61499} 61500 61501function useSyncExternalStore$1(subscribe, getSnapshot, getServerSnapshot) { 61502 // Note: The shim does not use getServerSnapshot, because pre-18 versions of 61503 // React do not expose a way to check if we're hydrating. So users of the shim 61504 // will need to track that themselves and return the correct value 61505 // from `getSnapshot`. 61506 return getSnapshot(); 61507} 61508 61509var canUseDOM = !!(typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined'); 61510 61511var isServerEnvironment = !canUseDOM; 61512 61513var shim = isServerEnvironment ? useSyncExternalStore$1 : useSyncExternalStore; 61514var useSyncExternalStore$2 = React.useSyncExternalStore !== undefined ? React.useSyncExternalStore : shim; 61515 61516exports.useSyncExternalStore = useSyncExternalStore$2; 61517 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 61518if ( 61519 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 61520 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === 61521 'function' 61522) { 61523 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); 61524} 61525 61526 })(); 61527} 61528 61529 61530/***/ }), 61531
vendor: 6,317 bytes, lines 61532-61707
61532/***/ "./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js": 61533/*!************************************************************************************************************!*\ 61534 !*** ./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js ***! 61535 \************************************************************************************************************/ 61536/***/ ((__unused_webpack_module, exports, __webpack_require__) => { 61537 61538"use strict"; 61539/** 61540 * @license React 61541 * use-sync-external-store-shim/with-selector.development.js 61542 * 61543 * Copyright (c) Facebook, Inc. and its affiliates. 61544 * 61545 * This source code is licensed under the MIT license found in the 61546 * LICENSE file in the root directory of this source tree. 61547 */ 61548 61549 61550 61551if (true) { 61552 (function() { 61553 61554 'use strict'; 61555 61556/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 61557if ( 61558 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 61559 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart === 61560 'function' 61561) { 61562 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); 61563} 61564 var React = __webpack_require__(/*! react */ "./node_modules/react/index.js"); 61565var shim = __webpack_require__(/*! use-sync-external-store/shim */ "./node_modules/use-sync-external-store/shim/index.js"); 61566 61567/** 61568 * inlined Object.is polyfill to avoid requiring consumers ship their own 61569 * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is 61570 */ 61571function is(x, y) { 61572 return x === y && (x !== 0 || 1 / x === 1 / y) || x !== x && y !== y // eslint-disable-line no-self-compare 61573 ; 61574} 61575 61576var objectIs = typeof Object.is === 'function' ? Object.is : is; 61577 61578var useSyncExternalStore = shim.useSyncExternalStore; 61579 61580// for CommonJS interop. 61581 61582var useRef = React.useRef, 61583 useEffect = React.useEffect, 61584 useMemo = React.useMemo, 61585 useDebugValue = React.useDebugValue; // Same as useSyncExternalStore, but supports selector and isEqual arguments. 61586 61587function useSyncExternalStoreWithSelector(subscribe, getSnapshot, getServerSnapshot, selector, isEqual) { 61588 // Use this to track the rendered snapshot. 61589 var instRef = useRef(null); 61590 var inst; 61591 61592 if (instRef.current === null) { 61593 inst = { 61594 hasValue: false, 61595 value: null 61596 }; 61597 instRef.current = inst; 61598 } else { 61599 inst = instRef.current; 61600 } 61601 61602 var _useMemo = useMemo(function () { 61603 // Track the memoized state using closure variables that are local to this 61604 // memoized instance of a getSnapshot function. Intentionally not using a 61605 // useRef hook, because that state would be shared across all concurrent 61606 // copies of the hook/component. 61607 var hasMemo = false; 61608 var memoizedSnapshot; 61609 var memoizedSelection; 61610 61611 var memoizedSelector = function (nextSnapshot) { 61612 if (!hasMemo) { 61613 // The first time the hook is called, there is no memoized result. 61614 hasMemo = true; 61615 memoizedSnapshot = nextSnapshot; 61616 61617 var _nextSelection = selector(nextSnapshot); 61618 61619 if (isEqual !== undefined) { 61620 // Even if the selector has changed, the currently rendered selection 61621 // may be equal to the new selection. We should attempt to reuse the 61622 // current value if possible, to preserve downstream memoizations. 61623 if (inst.hasValue) { 61624 var currentSelection = inst.value; 61625 61626 if (isEqual(currentSelection, _nextSelection)) { 61627 memoizedSelection = currentSelection; 61628 return currentSelection; 61629 } 61630 } 61631 } 61632 61633 memoizedSelection = _nextSelection; 61634 return _nextSelection; 61635 } // We may be able to reuse the previous invocation's result. 61636 61637 61638 // We may be able to reuse the previous invocation's result. 61639 var prevSnapshot = memoizedSnapshot; 61640 var prevSelection = memoizedSelection; 61641 61642 if (objectIs(prevSnapshot, nextSnapshot)) { 61643 // The snapshot is the same as last time. Reuse the previous selection. 61644 return prevSelection; 61645 } // The snapshot has changed, so we need to compute a new selection. 61646 61647 61648 // The snapshot has changed, so we need to compute a new selection. 61649 var nextSelection = selector(nextSnapshot); // If a custom isEqual function is provided, use that to check if the data 61650 // has changed. If it hasn't, return the previous selection. That signals 61651 // to React that the selections are conceptually equal, and we can bail 61652 // out of rendering. 61653 61654 // If a custom isEqual function is provided, use that to check if the data 61655 // has changed. If it hasn't, return the previous selection. That signals 61656 // to React that the selections are conceptually equal, and we can bail 61657 // out of rendering. 61658 if (isEqual !== undefined && isEqual(prevSelection, nextSelection)) { 61659 return prevSelection; 61660 } 61661 61662 memoizedSnapshot = nextSnapshot; 61663 memoizedSelection = nextSelection; 61664 return nextSelection; 61665 }; // Assigning this to a constant so that Flow knows it can't change. 61666 61667 61668 // Assigning this to a constant so that Flow knows it can't change. 61669 var maybeGetServerSnapshot = getServerSnapshot === undefined ? null : getServerSnapshot; 61670 61671 var getSnapshotWithSelector = function () { 61672 return memoizedSelector(getSnapshot()); 61673 }; 61674 61675 var getServerSnapshotWithSelector = maybeGetServerSnapshot === null ? undefined : function () { 61676 return memoizedSelector(maybeGetServerSnapshot()); 61677 }; 61678 return [getSnapshotWithSelector, getServerSnapshotWithSelector]; 61679 }, [getSnapshot, getServerSnapshot, selector, isEqual]), 61680 getSelection = _useMemo[0], 61681 getServerSelection = _useMemo[1]; 61682 61683 var value = useSyncExternalStore(subscribe, getSelection, getServerSelection); 61684 useEffect(function () { 61685 inst.hasValue = true; 61686 inst.value = value; 61687 }, [value]); 61688 useDebugValue(value); 61689 return value; 61690} 61691 61692exports.useSyncExternalStoreWithSelector = useSyncExternalStoreWithSelector; 61693 /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */ 61694if ( 61695 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && 61696 typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop === 61697 'function' 61698) { 61699 __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); 61700} 61701 61702 })(); 61703} 61704 61705 61706/***/ }), 61707
vendor: 568 bytes, lines 61708-61723
61708/***/ "./node_modules/use-sync-external-store/shim/index.js": 61709/*!************************************************************!*\ 61710 !*** ./node_modules/use-sync-external-store/shim/index.js ***! 61711 \************************************************************/ 61712/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 61713 61714"use strict"; 61715 61716 61717if (false) {} else { 61718 module.exports = __webpack_require__(/*! ../cjs/use-sync-external-store-shim.development.js */ "./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js"); 61719} 61720 61721 61722/***/ }), 61723
vendor: 628 bytes, lines 61724-61739
61724/***/ "./node_modules/use-sync-external-store/shim/with-selector.js": 61725/*!********************************************************************!*\ 61726 !*** ./node_modules/use-sync-external-store/shim/with-selector.js ***! 61727 \********************************************************************/ 61728/***/ ((module, __unused_webpack_exports, __webpack_require__) => { 61729 61730"use strict"; 61731 61732 61733if (false) {} else { 61734 module.exports = __webpack_require__(/*! ../cjs/use-sync-external-store-shim/with-selector.development.js */ "./node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.development.js"); 61735} 61736 61737 61738/***/ }), 61739
vendor: 18,867 bytes, lines 61740-62400
61740/***/ "./node_modules/whatwg-fetch/fetch.js": 61741/*!********************************************!*\ 61742 !*** ./node_modules/whatwg-fetch/fetch.js ***! 61743 \********************************************/ 61744/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { 61745 61746"use strict"; 61747__webpack_require__.r(__webpack_exports__); 61748/* harmony export */ __webpack_require__.d(__webpack_exports__, { 61749/* harmony export */ DOMException: () => (/* binding */ DOMException), 61750/* harmony export */ Headers: () => (/* binding */ Headers), 61751/* harmony export */ Request: () => (/* binding */ Request), 61752/* harmony export */ Response: () => (/* binding */ Response), 61753/* harmony export */ fetch: () => (/* binding */ fetch) 61754/* harmony export */ }); 61755/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 61756/* eslint-disable no-prototype-builtins */ 61757var g = 61758 (typeof globalThis !== 'undefined' && globalThis) || 61759 (typeof self !== 'undefined' && self) || 61760 // eslint-disable-next-line no-undef 61761 (typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g) || 61762 {} 61763 61764var support = { 61765 searchParams: 'URLSearchParams' in g, 61766 iterable: 'Symbol' in g && 'iterator' in Symbol, 61767 blob: 61768 'FileReader' in g && 61769 'Blob' in g && 61770 (function() { 61771 try { 61772 new Blob() 61773 return true 61774 } catch (e) { 61775 return false 61776 } 61777 })(), 61778 formData: 'FormData' in g, 61779 arrayBuffer: 'ArrayBuffer' in g 61780} 61781 61782function isDataView(obj) { 61783 return obj && DataView.prototype.isPrototypeOf(obj) 61784} 61785 61786if (support.arrayBuffer) { 61787 var viewClasses = [ 61788 '[object Int8Array]', 61789 '[object Uint8Array]', 61790 '[object Uint8ClampedArray]', 61791 '[object Int16Array]', 61792 '[object Uint16Array]', 61793 '[object Int32Array]', 61794 '[object Uint32Array]', 61795 '[object Float32Array]', 61796 '[object Float64Array]' 61797 ] 61798 61799 var isArrayBufferView = 61800 ArrayBuffer.isView || 61801 function(obj) { 61802 return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 61803 } 61804} 61805 61806function normalizeName(name) { 61807 if (typeof name !== 'string') { 61808 name = String(name) 61809 } 61810 if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === '') { 61811 throw new TypeError('Invalid character in header field name: "' + name + '"') 61812 } 61813 return name.toLowerCase() 61814} 61815 61816function normalizeValue(value) { 61817 if (typeof value !== 'string') { 61818 value = String(value) 61819 } 61820 return value 61821} 61822 61823// Build a destructive iterator for the value list 61824function iteratorFor(items) { 61825 var iterator = { 61826 next: function() { 61827 var value = items.shift() 61828 return {done: value === undefined, value: value} 61829 } 61830 } 61831 61832 if (support.iterable) { 61833 iterator[Symbol.iterator] = function() { 61834 return iterator 61835 } 61836 } 61837 61838 return iterator 61839} 61840 61841function Headers(headers) { 61842 this.map = {} 61843 61844 if (headers instanceof Headers) { 61845 headers.forEach(function(value, name) { 61846 this.append(name, value) 61847 }, this) 61848 } else if (Array.isArray(headers)) { 61849 headers.forEach(function(header) { 61850 if (header.length != 2) { 61851 throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length) 61852 } 61853 this.append(header[0], header[1]) 61854 }, this) 61855 } else if (headers) { 61856 Object.getOwnPropertyNames(headers).forEach(function(name) { 61857 this.append(name, headers[name]) 61858 }, this) 61859 } 61860} 61861 61862Headers.prototype.append = function(name, value) { 61863 name = normalizeName(name) 61864 value = normalizeValue(value) 61865 var oldValue = this.map[name] 61866 this.map[name] = oldValue ? oldValue + ', ' + value : value 61867} 61868 61869Headers.prototype['delete'] = function(name) { 61870 delete this.map[normalizeName(name)] 61871} 61872 61873Headers.prototype.get = function(name) { 61874 name = normalizeName(name) 61875 return this.has(name) ? this.map[name] : null 61876} 61877 61878Headers.prototype.has = function(name) { 61879 return this.map.hasOwnProperty(normalizeName(name)) 61880} 61881 61882Headers.prototype.set = function(name, value) { 61883 this.map[normalizeName(name)] = normalizeValue(value) 61884} 61885 61886Headers.prototype.forEach = function(callback, thisArg) { 61887 for (var name in this.map) { 61888 if (this.map.hasOwnProperty(name)) { 61889 callback.call(thisArg, this.map[name], name, this) 61890 } 61891 } 61892} 61893 61894Headers.prototype.keys = function() { 61895 var items = [] 61896 this.forEach(function(value, name) { 61897 items.push(name) 61898 }) 61899 return iteratorFor(items) 61900} 61901 61902Headers.prototype.values = function() { 61903 var items = [] 61904 this.forEach(function(value) { 61905 items.push(value) 61906 }) 61907 return iteratorFor(items) 61908} 61909 61910Headers.prototype.entries = function() { 61911 var items = [] 61912 this.forEach(function(value, name) { 61913 items.push([name, value]) 61914 }) 61915 return iteratorFor(items) 61916} 61917 61918if (support.iterable) { 61919 Headers.prototype[Symbol.iterator] = Headers.prototype.entries 61920} 61921 61922function consumed(body) { 61923 if (body._noBody) return 61924 if (body.bodyUsed) { 61925 return Promise.reject(new TypeError('Already read')) 61926 } 61927 body.bodyUsed = true 61928} 61929 61930function fileReaderReady(reader) { 61931 return new Promise(function(resolve, reject) { 61932 reader.onload = function() { 61933 resolve(reader.result) 61934 } 61935 reader.onerror = function() { 61936 reject(reader.error) 61937 } 61938 }) 61939} 61940 61941function readBlobAsArrayBuffer(blob) { 61942 var reader = new FileReader() 61943 var promise = fileReaderReady(reader) 61944 reader.readAsArrayBuffer(blob) 61945 return promise 61946} 61947 61948function readBlobAsText(blob) { 61949 var reader = new FileReader() 61950 var promise = fileReaderReady(reader) 61951 var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type) 61952 var encoding = match ? match[1] : 'utf-8' 61953 reader.readAsText(blob, encoding) 61954 return promise 61955} 61956 61957function readArrayBufferAsText(buf) { 61958 var view = new Uint8Array(buf) 61959 var chars = new Array(view.length) 61960 61961 for (var i = 0; i < view.length; i++) { 61962 chars[i] = String.fromCharCode(view[i]) 61963 } 61964 return chars.join('') 61965} 61966 61967function bufferClone(buf) { 61968 if (buf.slice) { 61969 return buf.slice(0) 61970 } else { 61971 var view = new Uint8Array(buf.byteLength) 61972 view.set(new Uint8Array(buf)) 61973 return view.buffer 61974 } 61975} 61976 61977function Body() { 61978 this.bodyUsed = false 61979 61980 this._initBody = function(body) { 61981 /* 61982 fetch-mock wraps the Response object in an ES6 Proxy to 61983 provide useful test harness features such as flush. However, on 61984 ES5 browsers without fetch or Proxy support pollyfills must be used; 61985 the proxy-pollyfill is unable to proxy an attribute unless it exists 61986 on the object before the Proxy is created. This change ensures 61987 Response.bodyUsed exists on the instance, while maintaining the 61988 semantic of setting Request.bodyUsed in the constructor before 61989 _initBody is called. 61990 */ 61991 // eslint-disable-next-line no-self-assign 61992 this.bodyUsed = this.bodyUsed 61993 this._bodyInit = body 61994 if (!body) { 61995 this._noBody = true; 61996 this._bodyText = '' 61997 } else if (typeof body === 'string') { 61998 this._bodyText = body 61999 } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { 62000 this._bodyBlob = body 62001 } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { 62002 this._bodyFormData = body 62003 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { 62004 this._bodyText = body.toString() 62005 } else if (support.arrayBuffer && support.blob && isDataView(body)) { 62006 this._bodyArrayBuffer = bufferClone(body.buffer) 62007 // IE 10-11 can't handle a DataView body. 62008 this._bodyInit = new Blob([this._bodyArrayBuffer]) 62009 } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { 62010 this._bodyArrayBuffer = bufferClone(body) 62011 } else { 62012 this._bodyText = body = Object.prototype.toString.call(body) 62013 } 62014 62015 if (!this.headers.get('content-type')) { 62016 if (typeof body === 'string') { 62017 this.headers.set('content-type', 'text/plain;charset=UTF-8') 62018 } else if (this._bodyBlob && this._bodyBlob.type) { 62019 this.headers.set('content-type', this._bodyBlob.type) 62020 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { 62021 this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8') 62022 } 62023 } 62024 } 62025 62026 if (support.blob) { 62027 this.blob = function() { 62028 var rejected = consumed(this) 62029 if (rejected) { 62030 return rejected 62031 } 62032 62033 if (this._bodyBlob) { 62034 return Promise.resolve(this._bodyBlob) 62035 } else if (this._bodyArrayBuffer) { 62036 return Promise.resolve(new Blob([this._bodyArrayBuffer])) 62037 } else if (this._bodyFormData) { 62038 throw new Error('could not read FormData body as blob') 62039 } else { 62040 return Promise.resolve(new Blob([this._bodyText])) 62041 } 62042 } 62043 } 62044 62045 this.arrayBuffer = function() { 62046 if (this._bodyArrayBuffer) { 62047 var isConsumed = consumed(this) 62048 if (isConsumed) { 62049 return isConsumed 62050 } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) { 62051 return Promise.resolve( 62052 this._bodyArrayBuffer.buffer.slice( 62053 this._bodyArrayBuffer.byteOffset, 62054 this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength 62055 ) 62056 ) 62057 } else { 62058 return Promise.resolve(this._bodyArrayBuffer) 62059 } 62060 } else if (support.blob) { 62061 return this.blob().then(readBlobAsArrayBuffer) 62062 } else { 62063 throw new Error('could not read as ArrayBuffer') 62064 } 62065 } 62066 62067 this.text = function() { 62068 var rejected = consumed(this) 62069 if (rejected) { 62070 return rejected 62071 } 62072 62073 if (this._bodyBlob) { 62074 return readBlobAsText(this._bodyBlob) 62075 } else if (this._bodyArrayBuffer) { 62076 return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) 62077 } else if (this._bodyFormData) { 62078 throw new Error('could not read FormData body as text') 62079 } else { 62080 return Promise.resolve(this._bodyText) 62081 } 62082 } 62083 62084 if (support.formData) { 62085 this.formData = function() { 62086 return this.text().then(decode) 62087 } 62088 } 62089 62090 this.json = function() { 62091 return this.text().then(JSON.parse) 62092 } 62093 62094 return this 62095} 62096 62097// HTTP methods whose capitalization should be normalized 62098var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'] 62099 62100function normalizeMethod(method) { 62101 var upcased = method.toUpperCase() 62102 return methods.indexOf(upcased) > -1 ? upcased : method 62103} 62104 62105function Request(input, options) { 62106 if (!(this instanceof Request)) { 62107 throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') 62108 } 62109 62110 options = options || {} 62111 var body = options.body 62112 62113 if (input instanceof Request) { 62114 if (input.bodyUsed) { 62115 throw new TypeError('Already read') 62116 } 62117 this.url = input.url 62118 this.credentials = input.credentials 62119 if (!options.headers) { 62120 this.headers = new Headers(input.headers) 62121 } 62122 this.method = input.method 62123 this.mode = input.mode 62124 this.signal = input.signal 62125 if (!body && input._bodyInit != null) { 62126 body = input._bodyInit 62127 input.bodyUsed = true 62128 } 62129 } else { 62130 this.url = String(input) 62131 } 62132 62133 this.credentials = options.credentials || this.credentials || 'same-origin' 62134 if (options.headers || !this.headers) { 62135 this.headers = new Headers(options.headers) 62136 } 62137 this.method = normalizeMethod(options.method || this.method || 'GET') 62138 this.mode = options.mode || this.mode || null 62139 this.signal = options.signal || this.signal || (function () { 62140 if ('AbortController' in g) { 62141 var ctrl = new AbortController(); 62142 return ctrl.signal; 62143 } 62144 }()); 62145 this.referrer = null 62146 62147 if ((this.method === 'GET' || this.method === 'HEAD') && body) { 62148 throw new TypeError('Body not allowed for GET or HEAD requests') 62149 } 62150 this._initBody(body) 62151 62152 if (this.method === 'GET' || this.method === 'HEAD') { 62153 if (options.cache === 'no-store' || options.cache === 'no-cache') { 62154 // Search for a '_' parameter in the query string 62155 var reParamSearch = /([?&])_=[^&]*/ 62156 if (reParamSearch.test(this.url)) { 62157 // If it already exists then set the value with the current time 62158 this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime()) 62159 } else { 62160 // Otherwise add a new '_' parameter to the end with the current time 62161 var reQueryString = /\?/ 62162 this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime() 62163 } 62164 } 62165 } 62166} 62167 62168Request.prototype.clone = function() { 62169 return new Request(this, {body: this._bodyInit}) 62170} 62171 62172function decode(body) { 62173 var form = new FormData() 62174 body 62175 .trim() 62176 .split('&') 62177 .forEach(function(bytes) { 62178 if (bytes) { 62179 var split = bytes.split('=') 62180 var name = split.shift().replace(/\+/g, ' ') 62181 var value = split.join('=').replace(/\+/g, ' ') 62182 form.append(decodeURIComponent(name), decodeURIComponent(value)) 62183 } 62184 }) 62185 return form 62186} 62187 62188function parseHeaders(rawHeaders) { 62189 var headers = new Headers() 62190 // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space 62191 // https://tools.ietf.org/html/rfc7230#section-3.2 62192 var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ') 62193 // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill 62194 // https://github.com/github/fetch/issues/748 62195 // https://github.com/zloirock/core-js/issues/751 62196 preProcessedHeaders 62197 .split('\r') 62198 .map(function(header) { 62199 return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header 62200 }) 62201 .forEach(function(line) { 62202 var parts = line.split(':') 62203 var key = parts.shift().trim() 62204 if (key) { 62205 var value = parts.join(':').trim() 62206 try { 62207 headers.append(key, value) 62208 } catch (error) { 62209 console.warn('Response ' + error.message) 62210 } 62211 } 62212 }) 62213 return headers 62214} 62215 62216Body.call(Request.prototype) 62217 62218function Response(bodyInit, options) { 62219 if (!(this instanceof Response)) { 62220 throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') 62221 } 62222 if (!options) { 62223 options = {} 62224 } 62225 62226 this.type = 'default' 62227 this.status = options.status === undefined ? 200 : options.status 62228 if (this.status < 200 || this.status > 599) { 62229 throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].") 62230 } 62231 this.ok = this.status >= 200 && this.status < 300 62232 this.statusText = options.statusText === undefined ? '' : '' + options.statusText 62233 this.headers = new Headers(options.headers) 62234 this.url = options.url || '' 62235 this._initBody(bodyInit) 62236} 62237 62238Body.call(Response.prototype) 62239 62240Response.prototype.clone = function() { 62241 return new Response(this._bodyInit, { 62242 status: this.status, 62243 statusText: this.statusText, 62244 headers: new Headers(this.headers), 62245 url: this.url 62246 }) 62247} 62248 62249Response.error = function() { 62250 var response = new Response(null, {status: 200, statusText: ''}) 62251 response.status = 0 62252 response.type = 'error' 62253 return response 62254} 62255 62256var redirectStatuses = [301, 302, 303, 307, 308] 62257 62258Response.redirect = function(url, status) { 62259 if (redirectStatuses.indexOf(status) === -1) { 62260 throw new RangeError('Invalid status code') 62261 } 62262 62263 return new Response(null, {status: status, headers: {location: url}}) 62264} 62265 62266var DOMException = g.DOMException 62267try { 62268 new DOMException() 62269} catch (err) { 62270 DOMException = function(message, name) { 62271 this.message = message 62272 this.name = name 62273 var error = Error(message) 62274 this.stack = error.stack 62275 } 62276 DOMException.prototype = Object.create(Error.prototype) 62277 DOMException.prototype.constructor = DOMException 62278} 62279 62280function fetch(input, init) { 62281 return new Promise(function(resolve, reject) { 62282 var request = new Request(input, init) 62283 62284 if (request.signal && request.signal.aborted) { 62285 return reject(new DOMException('Aborted', 'AbortError')) 62286 } 62287 62288 var xhr = new XMLHttpRequest() 62289 62290 function abortXhr() { 62291 xhr.abort() 62292 } 62293 62294 xhr.onload = function() { 62295 var options = { 62296 statusText: xhr.statusText, 62297 headers: parseHeaders(xhr.getAllResponseHeaders() || '') 62298 } 62299 // This check if specifically for when a user fetches a file locally from the file system 62300 // Only if the status is out of a normal range 62301 if (request.url.startsWith('file://') && (xhr.status < 200 || xhr.status > 599)) { 62302 options.status = 200; 62303 } else { 62304 options.status = xhr.status; 62305 } 62306 options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') 62307 var body = 'response' in xhr ? xhr.response : xhr.responseText 62308 setTimeout(function() { 62309 resolve(new Response(body, options)) 62310 }, 0) 62311 } 62312 62313 xhr.onerror = function() { 62314 setTimeout(function() { 62315 reject(new TypeError('Network request failed')) 62316 }, 0) 62317 } 62318 62319 xhr.ontimeout = function() { 62320 setTimeout(function() { 62321 reject(new TypeError('Network request timed out')) 62322 }, 0) 62323 } 62324 62325 xhr.onabort = function() { 62326 setTimeout(function() { 62327 reject(new DOMException('Aborted', 'AbortError')) 62328 }, 0) 62329 } 62330 62331 function fixUrl(url) { 62332 try { 62333 return url === '' && g.location.href ? g.location.href : url 62334 } catch (e) { 62335 return url 62336 } 62337 } 62338 62339 xhr.open(request.method, fixUrl(request.url), true) 62340 62341 if (request.credentials === 'include') { 62342 xhr.withCredentials = true 62343 } else if (request.credentials === 'omit') { 62344 xhr.withCredentials = false 62345 } 62346 62347 if ('responseType' in xhr) { 62348 if (support.blob) { 62349 xhr.responseType = 'blob' 62350 } else if ( 62351 support.arrayBuffer 62352 ) { 62353 xhr.responseType = 'arraybuffer' 62354 } 62355 } 62356 62357 if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) { 62358 var names = []; 62359 Object.getOwnPropertyNames(init.headers).forEach(function(name) { 62360 names.push(normalizeName(name)) 62361 xhr.setRequestHeader(name, normalizeValue(init.headers[name])) 62362 }) 62363 request.headers.forEach(function(value, name) { 62364 if (names.indexOf(name) === -1) { 62365 xhr.setRequestHeader(name, value) 62366 } 62367 }) 62368 } else { 62369 request.headers.forEach(function(value, name) { 62370 xhr.setRequestHeader(name, value) 62371 }) 62372 } 62373 62374 if (request.signal) { 62375 request.signal.addEventListener('abort', abortXhr) 62376 62377 xhr.onreadystatechange = function() { 62378 // DONE (success or failure) 62379 if (xhr.readyState === 4) { 62380 request.signal.removeEventListener('abort', abortXhr) 62381 } 62382 } 62383 } 62384 62385 xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit) 62386 }) 62387} 62388 62389fetch.polyfill = true 62390 62391if (!g.fetch) { 62392 g.fetch = fetch 62393 g.Headers = Headers 62394 g.Request = Request 62395 g.Response = Response 62396} 62397 62398 62399/***/ }), 62400
vendor: 1,375 bytes, lines 62401-62471
62401/***/ "./node_modules/youtube-iframe/index.js": 62402/*!**********************************************!*\ 62403 !*** ./node_modules/youtube-iframe/index.js ***! 62404 \**********************************************/ 62405/***/ ((module) => { 62406 62407(function(window) { 62408 var YouTubeIframeLoader = { 62409 src: 'https://www.youtube.com/iframe_api', 62410 loading: false, 62411 loaded: false, 62412 listeners: [], 62413 62414 load: function(callback) { 62415 var _this = this; 62416 this.listeners.push(callback); 62417 62418 if(this.loaded) { 62419 setTimeout(function() { 62420 _this.done(); 62421 }); 62422 return; 62423 } 62424 62425 if(this.loading) { 62426 return; 62427 } 62428 62429 this.loading = true; 62430 62431 window.onYouTubeIframeAPIReady = function() { 62432 _this.loaded = true; 62433 _this.done(); 62434 }; 62435 62436 var script = document.createElement('script'); 62437 script.type = 'text/javascript'; 62438 script.src = this.src; 62439 document.body.appendChild(script); 62440 }, 62441 62442 done: function() { 62443 delete window.onYouTubeIframeAPIReady; 62444 62445 while(this.listeners.length) { 62446 this.listeners.pop()(window.YT); 62447 } 62448 } 62449 }; 62450 62451 if( true && module.exports) { 62452 module.exports = YouTubeIframeLoader; 62453 } else { 62454 window.YouTubeIframeLoader = YouTubeIframeLoader; 62455 } 62456}(window)); 62457 62458 62459/***/ }), 62460 62461/***/ "lodash": 62462/*!********************!*\ 62463 !*** external "_" ***! 62464 \********************/ 62465/***/ ((module) => { 62466 62467"use strict"; 62468module.exports = __WEBPACK_EXTERNAL_MODULE_lodash__; 62469 62470/***/ }), 62471
vendor: 1,127 bytes, lines 62472-62501
62472/***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js": 62473/*!*******************************************************************!*\ 62474 !*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***! 62475 \*******************************************************************/ 62476/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 62477 62478"use strict"; 62479__webpack_require__.r(__webpack_exports__); 62480/* harmony export */ __webpack_require__.d(__webpack_exports__, { 62481/* harmony export */ "default": () => (/* binding */ _defineProperty) 62482/* harmony export */ }); 62483/* harmony import */ var _toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./toPropertyKey.js */ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js"); 62484 62485function _defineProperty(obj, key, value) { 62486 key = (0,_toPropertyKey_js__WEBPACK_IMPORTED_MODULE_0__["default"])(key); 62487 if (key in obj) { 62488 Object.defineProperty(obj, key, { 62489 value: value, 62490 enumerable: true, 62491 configurable: true, 62492 writable: true 62493 }); 62494 } else { 62495 obj[key] = value; 62496 } 62497 return obj; 62498} 62499 62500/***/ }), 62501
vendor: 980 bytes, lines 62502-62529
62502/***/ "./node_modules/@babel/runtime/helpers/esm/extends.js": 62503/*!************************************************************!*\ 62504 !*** ./node_modules/@babel/runtime/helpers/esm/extends.js ***! 62505 \************************************************************/ 62506/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 62507 62508"use strict"; 62509__webpack_require__.r(__webpack_exports__); 62510/* harmony export */ __webpack_require__.d(__webpack_exports__, { 62511/* harmony export */ "default": () => (/* binding */ _extends) 62512/* harmony export */ }); 62513function _extends() { 62514 _extends = Object.assign ? Object.assign.bind() : function (target) { 62515 for (var i = 1; i < arguments.length; i++) { 62516 var source = arguments[i]; 62517 for (var key in source) { 62518 if (Object.prototype.hasOwnProperty.call(source, key)) { 62519 target[key] = source[key]; 62520 } 62521 } 62522 } 62523 return target; 62524 }; 62525 return _extends.apply(this, arguments); 62526} 62527 62528/***/ }), 62529
vendor: 1,599 bytes, lines 62530-62566
62530/***/ "./node_modules/@babel/runtime/helpers/esm/objectSpread2.js": 62531/*!******************************************************************!*\ 62532 !*** ./node_modules/@babel/runtime/helpers/esm/objectSpread2.js ***! 62533 \******************************************************************/ 62534/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 62535 62536"use strict"; 62537__webpack_require__.r(__webpack_exports__); 62538/* harmony export */ __webpack_require__.d(__webpack_exports__, { 62539/* harmony export */ "default": () => (/* binding */ _objectSpread2) 62540/* harmony export */ }); 62541/* harmony import */ var _defineProperty_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defineProperty.js */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js"); 62542 62543function ownKeys(e, r) { 62544 var t = Object.keys(e); 62545 if (Object.getOwnPropertySymbols) { 62546 var o = Object.getOwnPropertySymbols(e); 62547 r && (o = o.filter(function (r) { 62548 return Object.getOwnPropertyDescriptor(e, r).enumerable; 62549 })), t.push.apply(t, o); 62550 } 62551 return t; 62552} 62553function _objectSpread2(e) { 62554 for (var r = 1; r < arguments.length; r++) { 62555 var t = null != arguments[r] ? arguments[r] : {}; 62556 r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { 62557 (0,_defineProperty_js__WEBPACK_IMPORTED_MODULE_0__["default"])(e, r, t[r]); 62558 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { 62559 Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); 62560 }); 62561 } 62562 return e; 62563} 62564 62565/***/ }), 62566
vendor: 1,017 bytes, lines 62567-62592
62567/***/ "./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js": 62568/*!*********************************************************************************!*\ 62569 !*** ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js ***! 62570 \*********************************************************************************/ 62571/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 62572 62573"use strict"; 62574__webpack_require__.r(__webpack_exports__); 62575/* harmony export */ __webpack_require__.d(__webpack_exports__, { 62576/* harmony export */ "default": () => (/* binding */ _objectWithoutPropertiesLoose) 62577/* harmony export */ }); 62578function _objectWithoutPropertiesLoose(source, excluded) { 62579 if (source == null) return {}; 62580 var target = {}; 62581 var sourceKeys = Object.keys(source); 62582 var key, i; 62583 for (i = 0; i < sourceKeys.length; i++) { 62584 key = sourceKeys[i]; 62585 if (excluded.indexOf(key) >= 0) continue; 62586 target[key] = source[key]; 62587 } 62588 return target; 62589} 62590 62591/***/ }), 62592
vendor: 1,259 bytes, lines 62593-62618
62593/***/ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js": 62594/*!****************************************************************!*\ 62595 !*** ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js ***! 62596 \****************************************************************/ 62597/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 62598 62599"use strict"; 62600__webpack_require__.r(__webpack_exports__); 62601/* harmony export */ __webpack_require__.d(__webpack_exports__, { 62602/* harmony export */ "default": () => (/* binding */ _toPrimitive) 62603/* harmony export */ }); 62604/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js"); 62605 62606function _toPrimitive(input, hint) { 62607 if ((0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(input) !== "object" || input === null) return input; 62608 var prim = input[Symbol.toPrimitive]; 62609 if (prim !== undefined) { 62610 var res = prim.call(input, hint || "default"); 62611 if ((0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(res) !== "object") return res; 62612 throw new TypeError("@@toPrimitive must return a primitive value."); 62613 } 62614 return (hint === "string" ? String : Number)(input); 62615} 62616 62617/***/ }), 62618
vendor: 1,173 bytes, lines 62619-62640
62619/***/ "./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js": 62620/*!******************************************************************!*\ 62621 !*** ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js ***! 62622 \******************************************************************/ 62623/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 62624 62625"use strict"; 62626__webpack_require__.r(__webpack_exports__); 62627/* harmony export */ __webpack_require__.d(__webpack_exports__, { 62628/* harmony export */ "default": () => (/* binding */ _toPropertyKey) 62629/* harmony export */ }); 62630/* harmony import */ var _typeof_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./typeof.js */ "./node_modules/@babel/runtime/helpers/esm/typeof.js"); 62631/* harmony import */ var _toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./toPrimitive.js */ "./node_modules/@babel/runtime/helpers/esm/toPrimitive.js"); 62632 62633 62634function _toPropertyKey(arg) { 62635 var key = (0,_toPrimitive_js__WEBPACK_IMPORTED_MODULE_1__["default"])(arg, "string"); 62636 return (0,_typeof_js__WEBPACK_IMPORTED_MODULE_0__["default"])(key) === "symbol" ? key : String(key); 62637} 62638 62639/***/ }), 62640
vendor: 909 bytes, lines 62641-62663
62641/***/ "./node_modules/@babel/runtime/helpers/esm/typeof.js": 62642/*!***********************************************************!*\ 62643 !*** ./node_modules/@babel/runtime/helpers/esm/typeof.js ***! 62644 \***********************************************************/ 62645/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 62646 62647"use strict"; 62648__webpack_require__.r(__webpack_exports__); 62649/* harmony export */ __webpack_require__.d(__webpack_exports__, { 62650/* harmony export */ "default": () => (/* binding */ _typeof) 62651/* harmony export */ }); 62652function _typeof(o) { 62653 "@babel/helpers - typeof"; 62654 62655 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { 62656 return typeof o; 62657 } : function (o) { 62658 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 62659 }, _typeof(o); 62660} 62661 62662/***/ }), 62663
vendor: 19,809 bytes, lines 62664-62701
62664/***/ "./node_modules/immer/dist/immer.esm.mjs": 62665/*!***********************************************!*\ 62666 !*** ./node_modules/immer/dist/immer.esm.mjs ***! 62667 \***********************************************/ 62668/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => { 62669 62670"use strict"; 62671__webpack_require__.r(__webpack_exports__); 62672/* harmony export */ __webpack_require__.d(__webpack_exports__, { 62673/* harmony export */ Immer: () => (/* binding */ un), 62674/* harmony export */ applyPatches: () => (/* binding */ pn), 62675/* harmony export */ castDraft: () => (/* binding */ K), 62676/* harmony export */ castImmutable: () => (/* binding */ $), 62677/* harmony export */ createDraft: () => (/* binding */ ln), 62678/* harmony export */ current: () => (/* binding */ R), 62679/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), 62680/* harmony export */ enableAllPlugins: () => (/* binding */ J), 62681/* harmony export */ enableES5: () => (/* binding */ F), 62682/* harmony export */ enableMapSet: () => (/* binding */ C), 62683/* harmony export */ enablePatches: () => (/* binding */ T), 62684/* harmony export */ finishDraft: () => (/* binding */ dn), 62685/* harmony export */ freeze: () => (/* binding */ d), 62686/* harmony export */ immerable: () => (/* binding */ L), 62687/* harmony export */ isDraft: () => (/* binding */ r), 62688/* harmony export */ isDraftable: () => (/* binding */ t), 62689/* harmony export */ nothing: () => (/* binding */ H), 62690/* harmony export */ original: () => (/* binding */ e), 62691/* harmony export */ produce: () => (/* binding */ fn), 62692/* harmony export */ produceWithPatches: () => (/* binding */ cn), 62693/* harmony export */ setAutoFreeze: () => (/* binding */ sn), 62694/* harmony export */ setUseProxies: () => (/* binding */ vn) 62695/* harmony export */ }); 62696/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 62697function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if(true){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return"'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return!!n&&!!n[Q]}function t(n){var r;return!!n&&(function(n){if(!n||"object"!=typeof n)return!1;var r=Object.getPrototypeOf(n);if(null===r)return!0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v(n))}function e(t){return r(t)||n(23,t),t[Q].t}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n)})):n.forEach((function(t,e){return r(e,t,n)}))}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t}function c(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]})}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0)),n}function h(){n(2)}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b(r){var t=tn[r];return t||n(18,r),t}function m(n,r){tn[n]||(tn[n]=r)}function _(){return false||U||n(0),U}function j(n,r){r&&(b("Patches"),n.u=[],n.s=[],n.v=r)}function g(n){O(n),n.p.forEach(S),n.p=null}function O(n){n===U&&(U=n.l)}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=!0}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b("ES5").S(e,r,o),o?(i[Q].P&&(g(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o,u=o,a=!1;3===e.i&&(u=new Set(o),o.clear(),a=!0),i(u,(function(r,i){return A(n,e,o,r,i,t,a)})),x(n,o,!1),t&&n.u&&b("Patches").N(e,t,n.u,n.s)}return e.o}function A(e,i,o,a,c,s,v){if( true&&c===o&&n(5),r(c)){var p=M(e,c,s&&i&&3!==i.i&&!u(i.R,a)?s.concat(a):void 0);if(f(o,a,p),!r(p))return;e.m=!1}else v&&o.add(c);if(t(c)&&!y(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x(e,c)}}function x(n,r,t){void 0===t&&(t=!1),!n.l&&n.h.D&&n.m&&d(r,t)}function z(n,r){var t=n[Q];return(t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t)}}function k(n){n.P||(n.P=!0,n.l&&k(n.l))}function E(n){n.o||(n.o=l(n.t))}function N(n,r,t){var e=s(r)?b("MapSet").F(r,t):v(r)?b("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b("ES5").J(r,t);return(t?t.A:_()).p.push(e),e}function R(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b("ES5").K(u)))return u.t;u.I=!0,e=D(r,c),u.I=!1}else e=D(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f(e,r,n(t))})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}function F(){function t(n,r){var t=s[n];return t?t.enumerable=r:s[n]=t={configurable:!0,enumerable:r,get:function(){var r=this[Q];return true&&f(r),en.get(r,n)},set:function(r){var t=this[Q]; true&&f(t),en.set(t,n,r)}},t}function e(n){for(var r=n.length-1;r>=0;r--){var t=n[r][Q];if(!t.P)switch(t.i){case 5:a(t)&&k(t);break;case 4:o(t)&&k(t)}}}function o(n){for(var r=n.t,t=n.k,e=nn(t),i=e.length-1;i>=0;i--){var o=e[i];if(o!==Q){var a=r[o];if(void 0===a&&!u(r,o))return!0;var f=t[o],s=f&&f[Q];if(s?s.t!==a:!c(f,a))return!0}}var v=!!r[Q];return e.length!==nn(r).length+(v?0:1)}function a(n){var r=n.k;if(r.length!==n.t.length)return!0;var t=Object.getOwnPropertyDescriptor(r,r.length-1);if(t&&!t.get)return!0;for(var e=0;e<r.length;e++)if(!r.hasOwnProperty(e))return!0;return!1}function f(r){r.g&&n(3,JSON.stringify(p(r)))}var s={};m("ES5",{J:function(n,r){var e=Array.isArray(n),i=function(n,r){if(n){for(var e=Array(r.length),i=0;i<r.length;i++)Object.defineProperty(e,""+i,t(i,!0));return e}var o=rn(r);delete o[Q];for(var u=nn(o),a=0;a<u.length;a++){var f=u[a];o[f]=t(f,n||!!o[f].enumerable)}return Object.create(Object.getPrototypeOf(r),o)}(e,n),o={i:e?5:4,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:i,o:null,g:!1,C:!1};return Object.defineProperty(i,Q,{value:o,writable:!0}),i},S:function(n,t,o){o?r(t)&&t[Q].A===n&&e(n.p):(n.u&&function n(r){if(r&&"object"==typeof r){var t=r[Q];if(t){var e=t.t,o=t.k,f=t.R,c=t.i;if(4===c)i(o,(function(r){r!==Q&&(void 0!==e[r]||u(e,r)?f[r]||n(o[r]):(f[r]=!0,k(t)))})),i(e,(function(n){void 0!==o[n]||u(o,n)||(f[n]=!1,k(t))}));else if(5===c){if(a(t)&&(k(t),f.length=!0),o.length<e.length)for(var s=o.length;s<e.length;s++)f[s]=!1;else for(var v=e.length;v<o.length;v++)f[v]=!0;for(var p=Math.min(o.length,e.length),l=0;l<p;l++)o.hasOwnProperty(l)||(f[l]=!0),void 0===f[l]&&n(o[l])}}}}(n.p[0]),e(n.p))},K:function(n){return 4===n.i?o(n):a(n)}})}function T(){function e(n){if(!t(n))return n;if(Array.isArray(n))return n.map(e);if(s(n))return new Map(Array.from(n.entries()).map((function(n){return[n[0],e(n[1])]})));if(v(n))return new Set(Array.from(n).map(e));var r=Object.create(Object.getPrototypeOf(n));for(var i in n)r[i]=e(n[i]);return u(n,L)&&(r[L]=n[L]),r}function f(n){return r(n)?e(n):n}var c="add";m("Patches",{$:function(r,t){return t.forEach((function(t){for(var i=t.path,u=t.op,f=r,s=0;s<i.length-1;s++){var v=o(f),p=i[s];"string"!=typeof p&&"number"!=typeof p&&(p=""+p),0!==v&&1!==v||"__proto__"!==p&&"constructor"!==p||n(24),"function"==typeof f&&"prototype"===p&&n(24),"object"!=typeof(f=a(f,p))&&n(15,i.join("/"))}var l=o(f),d=e(t.value),h=i[i.length-1];switch(u){case"replace":switch(l){case 2:return f.set(h,d);case 3:n(16);default:return f[h]=d}case c:switch(l){case 1:return"-"===h?f.push(d):f.splice(h,0,d);case 2:return f.set(h,d);case 3:return f.add(d);default:return f[h]=d}case"remove":switch(l){case 1:return f.splice(h,1);case 2:return f.delete(h);case 3:return f.delete(t.value);default:return delete f[h]}default:n(17,u)}})),r},N:function(n,r,t,e){switch(n.i){case 0:case 4:case 2:return function(n,r,t,e){var o=n.t,s=n.o;i(n.R,(function(n,i){var v=a(o,n),p=a(s,n),l=i?u(o,n)?"replace":c:"remove";if(v!==p||"replace"!==l){var d=r.concat(n);t.push("remove"===l?{op:l,path:d}:{op:l,path:d,value:p}),e.push(l===c?{op:"remove",path:d}:"remove"===l?{op:c,path:d,value:f(v)}:{op:"replace",path:d,value:f(v)})}}))}(n,r,t,e);case 5:case 1:return function(n,r,t,e){var i=n.t,o=n.R,u=n.o;if(u.length<i.length){var a=[u,i];i=a[0],u=a[1];var s=[e,t];t=s[0],e=s[1]}for(var v=0;v<i.length;v++)if(o[v]&&u[v]!==i[v]){var p=r.concat([v]);t.push({op:"replace",path:p,value:f(u[v])}),e.push({op:"replace",path:p,value:f(i[v])})}for(var l=i.length;l<u.length;l++){var d=r.concat([l]);t.push({op:c,path:d,value:f(u[l])})}i.length<u.length&&e.push({op:"replace",path:r.concat(["length"]),value:i.length})}(n,r,t,e);case 3:return function(n,r,t,e){var i=n.t,o=n.o,u=0;i.forEach((function(n){if(!o.has(n)){var i=r.concat([u]);t.push({op:"remove",path:i,value:n}),e.unshift({op:c,path:i,value:n})}u++})),u=0,o.forEach((function(n){if(!i.has(n)){var o=r.concat([u]);t.push({op:c,path:o,value:n}),e.unshift({op:"remove",path:o,value:n})}u++}))}(n,r,t,e)}},M:function(n,r,t,e){t.push({op:"replace",path:[],value:r===H?void 0:r}),e.push({op:"replace",path:[],value:n})}})}function C(){function r(n,r){function t(){this.constructor=n}a(n,r),n.prototype=(t.prototype=r.prototype,new t)}function e(n){n.o||(n.R=new Map,n.o=new Map(n.t))}function o(n){n.o||(n.o=new Set,n.t.forEach((function(r){if(t(r)){var e=N(n.A.h,r,n);n.p.set(r,e),n.o.add(e)}else n.o.add(r)})))}function u(r){r.g&&n(3,JSON.stringify(p(r)))}var a=function(n,r){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var t in r)r.hasOwnProperty(t)&&(n[t]=r[t])})(n,r)},f=function(){function n(n,r){return this[Q]={i:2,l:r,A:r?r.A:_(),P:!1,I:!1,o:void 0,R:void 0,t:n,k:this,C:!1,g:!1},this}r(n,Map);var o=n.prototype;return Object.defineProperty(o,"size",{get:function(){return p(this[Q]).size}}),o.has=function(n){return p(this[Q]).has(n)},o.set=function(n,r){var t=this[Q];return u(t),p(t).has(n)&&p(t).get(n)===r||(e(t),k(t),t.R.set(n,!0),t.o.set(n,r),t.R.set(n,!0)),this},o.delete=function(n){if(!this.has(n))return!1;var r=this[Q];return u(r),e(r),k(r),r.t.has(n)?r.R.set(n,!1):r.R.delete(n),r.o.delete(n),!0},o.clear=function(){var n=this[Q];u(n),p(n).size&&(e(n),k(n),n.R=new Map,i(n.t,(function(r){n.R.set(r,!1)})),n.o.clear())},o.forEach=function(n,r){var t=this;p(this[Q]).forEach((function(e,i){n.call(r,t.get(i),i,t)}))},o.get=function(n){var r=this[Q];u(r);var i=p(r).get(n);if(r.I||!t(i))return i;if(i!==r.t.get(n))return i;var o=N(r.A.h,i,r);return e(r),r.o.set(n,o),o},o.keys=function(){return p(this[Q]).keys()},o.values=function(){var n,r=this,t=this.keys();return(n={})[V]=function(){return r.values()},n.next=function(){var n=t.next();return n.done?n:{done:!1,value:r.get(n.value)}},n},o.entries=function(){var n,r=this,t=this.keys();return(n={})[V]=function(){return r.entries()},n.next=function(){var n=t.next();if(n.done)return n;var e=r.get(n.value);return{done:!1,value:[n.value,e]}},n},o[V]=function(){return this.entries()},n}(),c=function(){function n(n,r){return this[Q]={i:3,l:r,A:r?r.A:_(),P:!1,I:!1,o:void 0,t:n,k:this,p:new Map,g:!1,C:!1},this}r(n,Set);var t=n.prototype;return Object.defineProperty(t,"size",{get:function(){return p(this[Q]).size}}),t.has=function(n){var r=this[Q];return u(r),r.o?!!r.o.has(n)||!(!r.p.has(n)||!r.o.has(r.p.get(n))):r.t.has(n)},t.add=function(n){var r=this[Q];return u(r),this.has(n)||(o(r),k(r),r.o.add(n)),this},t.delete=function(n){if(!this.has(n))return!1;var r=this[Q];return u(r),o(r),k(r),r.o.delete(n)||!!r.p.has(n)&&r.o.delete(r.p.get(n))},t.clear=function(){var n=this[Q];u(n),p(n).size&&(o(n),k(n),n.o.clear())},t.values=function(){var n=this[Q];return u(n),o(n),n.o.values()},t.entries=function(){var n=this[Q];return u(n),o(n),n.o.entries()},t.keys=function(){return this.values()},t[V]=function(){return this.values()},t.forEach=function(n,r){for(var t=this.values(),e=t.next();!e.done;)n.call(r,e.value,e.value,this),e=t.next()},n}();m("MapSet",{F:function(n,r){return new f(n,r)},T:function(n,r){return new c(n,r)}})}function J(){F(),C(),T()}function K(n){return n}function $(n){return n}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",V="undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return"Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return"Unsupported patch operation: "+n},18:function(n){return"The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return"produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return"'current' expects a draft, got: "+n},23:function(n){return"'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t)})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=!1,!0;if(c(t,i)&&(void 0!==t||u(n.t,r)))return!0;E(n),k(n)}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=!0),!0},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.R[r]=!1,E(n),k(n)):delete n.R[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11)},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12)}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)}})),on.deleteProperty=function(r,t){return true&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return true&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return(t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=N(e,r,void 0),v=!0;try{f=i(s),v=!1}finally{v?g(c):O(c)}return"undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d(f,!0),o){var p=[],l=[];b("Patches").M(r,f,p,l),o(p,l)}return f}n(21,r)},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r}));return"undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return[n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze)}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=R(e));var i=w(this),o=N(this,e,void 0);return o[Q].C=!0,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q]; true&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n},i.setUseProxies=function(r){r&&!B&&n(20),this.O=r},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce,cn=an.produceWithPatches.bind(an),sn=an.setAutoFreeze.bind(an),vn=an.setUseProxies.bind(an),pn=an.applyPatches.bind(an),ln=an.createDraft.bind(an),dn=an.finishDraft.bind(an);/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (fn); 62698//# sourceMappingURL=immer.esm.js.map 62699 62700 62701/***/ })
vendor: 3,842 bytes, lines 62701-62805
62701 62702 62703/******/ }); 62704/************************************************************************/ 62705/******/ // The module cache 62706/******/ var __webpack_module_cache__ = {}; 62707/******/ 62708/******/ // The require function 62709/******/ function __webpack_require__(moduleId) { 62710/******/ // Check if module is in cache 62711/******/ var cachedModule = __webpack_module_cache__[moduleId]; 62712/******/ if (cachedModule !== undefined) { 62713/******/ return cachedModule.exports; 62714/******/ } 62715/******/ // Create a new module (and put it into the cache) 62716/******/ var module = __webpack_module_cache__[moduleId] = { 62717/******/ id: moduleId, 62718/******/ loaded: false, 62719/******/ exports: {} 62720/******/ }; 62721/******/ 62722/******/ // Execute the module function 62723/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 62724/******/ 62725/******/ // Flag the module as loaded 62726/******/ module.loaded = true; 62727/******/ 62728/******/ // Return the exports of the module 62729/******/ return module.exports; 62730/******/ } 62731/******/ 62732/************************************************************************/ 62733/******/ /* webpack/runtime/compat get default export */ 62734/******/ (() => { 62735/******/ // getDefaultExport function for compatibility with non-harmony modules 62736/******/ __webpack_require__.n = (module) => { 62737/******/ var getter = module && module.__esModule ? 62738/******/ () => (module['default']) : 62739/******/ () => (module); 62740/******/ __webpack_require__.d(getter, { a: getter }); 62741/******/ return getter; 62742/******/ }; 62743/******/ })(); 62744/******/ 62745/******/ /* webpack/runtime/define property getters */ 62746/******/ (() => { 62747/******/ // define getter functions for harmony exports 62748/******/ __webpack_require__.d = (exports, definition) => { 62749/******/ for(var key in definition) { 62750/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 62751/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 62752/******/ } 62753/******/ } 62754/******/ }; 62755/******/ })(); 62756/******/ 62757/******/ /* webpack/runtime/global */ 62758/******/ (() => { 62759/******/ __webpack_require__.g = (function() { 62760/******/ if (typeof globalThis === 'object') return globalThis; 62761/******/ try { 62762/******/ return this || new Function('return this')(); 62763/******/ } catch (e) { 62764/******/ if (typeof window === 'object') return window; 62765/******/ } 62766/******/ })(); 62767/******/ })(); 62768/******/ 62769/******/ /* webpack/runtime/hasOwnProperty shorthand */ 62770/******/ (() => { 62771/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 62772/******/ })(); 62773/******/ 62774/******/ /* webpack/runtime/make namespace object */ 62775/******/ (() => { 62776/******/ // define __esModule on exports 62777/******/ __webpack_require__.r = (exports) => { 62778/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 62779/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 62780/******/ } 62781/******/ Object.defineProperty(exports, '__esModule', { value: true }); 62782/******/ }; 62783/******/ })(); 62784/******/ 62785/******/ /* webpack/runtime/node module decorator */ 62786/******/ (() => { 62787/******/ __webpack_require__.nmd = (module) => { 62788/******/ module.paths = []; 62789/******/ if (!module.children) module.children = []; 62790/******/ return module; 62791/******/ }; 62792/******/ })(); 62793/******/ 62794/************************************************************************/ 62795/******/ 62796/******/ // startup 62797/******/ // Load entry module and return exports 62798/******/ // This entry module is referenced by other modules so it can't be inlined 62799/******/ var __webpack_exports__ = __webpack_require__("./Static/javascript/index.ts"); 62800/******/ 62801/******/ return __webpack_exports__; 62802/******/ })() 62803; 62804}); 62805//# sourceMappingURL=global.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.