/
opt
/
canhelp
/
node_modules
/
next
/
dist
/
client
/
/opt/canhelp/node_modules/next/dist/client
mkdir
upload
Name
Size
Mode
Actions
app-dir/
-
0755
rm
compat/
-
0755
rm
components/
-
0755
rm
dev/
-
0755
rm
legacy/
-
0755
rm
lib/
-
0755
rm
portal/
-
0755
rm
react-client-callbacks/
-
0755
rm
request/
-
0755
rm
tracing/
-
0755
rm
add-base-path.d.ts
79
0644
edit
dl
rm
add-base-path.js
1010
0644
edit
dl
rm
add-base-path.js.map
973
0644
edit
dl
rm
add-locale.d.ts
121
0644
edit
dl
rm
add-locale.js
1052
0644
edit
dl
rm
add-locale.js.map
900
0644
edit
dl
rm
app-bootstrap.d.ts
285
0644
edit
dl
rm
app-bootstrap.js
2771
0644
edit
dl
rm
app-bootstrap.js.map
3967
0644
edit
dl
rm
app-build-id.d.ts
111
0644
edit
dl
rm
app-build-id.js
1767
0644
edit
dl
rm
app-build-id.js.map
1461
0644
edit
dl
rm
app-call-server.d.ts
91
0644
edit
dl
rm
app-call-server.js
1164
0644
edit
dl
rm
app-call-server.js.map
1017
0644
edit
dl
rm
app-find-source-map-url.d.ts
90
0644
edit
dl
rm
app-find-source-map-url.js
1662
0644
edit
dl
rm
app-find-source-map-url.js.map
2092
0644
edit
dl
rm
app-globals.d.ts
45
0644
edit
dl
rm
app-globals.js
708
0644
edit
dl
rm
app-globals.js.map
591
0644
edit
dl
rm
app-index.d.ts
625
0644
edit
dl
rm
app-index.js
11429
0644
edit
dl
rm
app-index.js.map
17063
0644
edit
dl
rm
app-link-gc.d.ts
40
0644
edit
dl
rm
app-link-gc.js
4543
0644
edit
dl
rm
app-link-gc.js.map
5163
0644
edit
dl
rm
app-next-dev.d.ts
24
0644
edit
dl
rm
app-next-dev.js
1214
0644
edit
dl
rm
app-next-dev.js.map
1198
0644
edit
dl
rm
app-next-turbopack.d.ts
11
0644
edit
dl
rm
app-next-turbopack.js
1291
0644
edit
dl
rm
app-next-turbopack.js.map
1659
0644
edit
dl
rm
app-next.d.ts
24
0644
edit
dl
rm
app-next.js
1284
0644
edit
dl
rm
app-next.js.map
1249
0644
edit
dl
rm
app-webpack.d.ts
11
0644
edit
dl
rm
app-webpack.js
3174
0644
edit
dl
rm
app-webpack.js.map
3203
0644
edit
dl
rm
assign-location.d.ts
363
0644
edit
dl
rm
assign-location.js
1259
0644
edit
dl
rm
assign-location.js.map
1549
0644
edit
dl
rm
detect-domain-locale.d.ts
141
0644
edit
dl
rm
detect-domain-locale.js
922
0644
edit
dl
rm
detect-domain-locale.js.map
722
0644
edit
dl
rm
flight-data-helpers.d.ts
1491
0644
edit
dl
rm
flight-data-helpers.js
5439
0644
edit
dl
rm
flight-data-helpers.js.map
8665
0644
edit
dl
rm
form-shared.d.ts
2886
0644
edit
dl
rm
form-shared.js
7132
0644
edit
dl
rm
form-shared.js.map
10762
0644
edit
dl
rm
form.d.ts
489
0644
edit
dl
rm
form.js
5816
0644
edit
dl
rm
form.js.map
8265
0644
edit
dl
rm
get-domain-locale.d.ts
220
0644
edit
dl
rm
get-domain-locale.js
1561
0644
edit
dl
rm
get-domain-locale.js.map
2457
0644
edit
dl
rm
has-base-path.d.ts
60
0644
edit
dl
rm
has-base-path.js
807
0644
edit
dl
rm
has-base-path.js.map
605
0644
edit
dl
rm
head-manager.d.ts
1041
0644
edit
dl
rm
head-manager.js
4981
0644
edit
dl
rm
head-manager.js.map
8342
0644
edit
dl
rm
image-component.d.ts
1337
0644
edit
dl
rm
image-component.js
13961
0644
edit
dl
rm
image-component.js.map
21385
0644
edit
dl
rm
index.d.ts
773
0644
edit
dl
rm
index.js
33440
0644
edit
dl
rm
index.js.map
52576
0644
edit
dl
rm
link.d.ts
5062
0644
edit
dl
rm
link.js
19457
0644
edit
dl
rm
link.js.map
34367
0644
edit
dl
rm
next-dev-turbopack.d.ts
11
0644
edit
dl
rm
next-dev-turbopack.js
1940
0644
edit
dl
rm
next-dev-turbopack.js.map
3002
0644
edit
dl
rm
next-dev.d.ts
20
0644
edit
dl
rm
next-dev.js
1223
0644
edit
dl
rm
next-dev.js.map
1194
0644
edit
dl
rm
next-turbopack.d.ts
48
0644
edit
dl
rm
next-turbopack.js
1460
0644
edit
dl
rm
next-turbopack.js.map
2330
0644
edit
dl
rm
next.d.ts
135
0644
edit
dl
rm
next.js
787
0644
edit
dl
rm
next.js.map
860
0644
edit
dl
rm
normalize-locale-path.d.ts
144
0644
edit
dl
rm
normalize-locale-path.js
883
0644
edit
dl
rm
normalize-locale-path.js.map
883
0644
edit
dl
rm
normalize-trailing-slash.d.ts
190
0644
edit
dl
rm
normalize-trailing-slash.js
1450
0644
edit
dl
rm
normalize-trailing-slash.js.map
1723
0644
edit
dl
rm
page-bootstrap.d.ts
123
0644
edit
dl
rm
page-bootstrap.js
7427
0644
edit
dl
rm
page-bootstrap.js.map
8999
0644
edit
dl
rm
page-loader.d.ts
1370
0644
edit
dl
rm
page-loader.js
7595
0644
edit
dl
rm
page-loader.js.map
12106
0644
edit
dl
rm
remove-base-path.d.ts
62
0644
edit
dl
rm
remove-base-path.js
1080
0644
edit
dl
rm
remove-base-path.js.map
1145
0644
edit
dl
rm
remove-locale.d.ts
77
0644
edit
dl
rm
remove-locale.js
1148
0644
edit
dl
rm
remove-locale.js.map
1308
0644
edit
dl
rm
request-idle-callback.d.ts
265
0644
edit
dl
rm
request-idle-callback.js
1449
0644
edit
dl
rm
request-idle-callback.js.map
1432
0644
edit
dl
rm
resolve-href.d.ts
396
0644
edit
dl
rm
resolve-href.js
5506
0644
edit
dl
rm
resolve-href.js.map
7899
0644
edit
dl
rm
route-announcer.d.ts
115
0644
edit
dl
rm
route-announcer.js
3312
0644
edit
dl
rm
route-announcer.js.map
3553
0644
edit
dl
rm
route-loader.d.ts
1736
0644
edit
dl
rm
route-loader.js
13968
0644
edit
dl
rm
route-loader.js.map
23012
0644
edit
dl
rm
route-params.d.ts
1113
0644
edit
dl
rm
route-params.js
8258
0644
edit
dl
rm
route-params.js.map
10884
0644
edit
dl
rm
router.d.ts
1078
0644
edit
dl
rm
router.js
6716
0644
edit
dl
rm
router.js.map
8823
0644
edit
dl
rm
script.d.ts
923
0644
edit
dl
rm
script.js
14047
0644
edit
dl
rm
script.js.map
18782
0644
edit
dl
rm
set-attributes-from-props.d.ts
86
0644
edit
dl
rm
set-attributes-from-props.js
2367
0644
edit
dl
rm
set-attributes-from-props.js.map
3121
0644
edit
dl
rm
trusted-types.d.ts
544
0644
edit
dl
rm
trusted-types.js
1528
0644
edit
dl
rm
trusted-types.js.map
1957
0644
edit
dl
rm
use-client-disallowed.d.ts
53
0644
edit
dl
rm
use-client-disallowed.js
1006
0644
edit
dl
rm
use-client-disallowed.js.map
753
0644
edit
dl
rm
use-intersection.d.ts
412
0644
edit
dl
rm
use-intersection.js
3845
0644
edit
dl
rm
use-intersection.js.map
6646
0644
edit
dl
rm
use-merged-ref.d.ts
139
0644
edit
dl
rm
use-merged-ref.js
2402
0644
edit
dl
rm
use-merged-ref.js.map
3496
0644
edit
dl
rm
web-vitals.d.ts
156
0644
edit
dl
rm
web-vitals.js
1109
0644
edit
dl
rm
web-vitals.js.map
1008
0644
edit
dl
rm
webpack.d.ts
11
0644
edit
dl
rm
webpack.js
2282
0644
edit
dl
rm
webpack.js.map
2535
0644
edit
dl
rm
with-router.d.ts
505
0644
edit
dl
rm
with-router.js
1458
0644
edit
dl
rm
with-router.js.map
1921
0644
edit
dl
rm
Edit:
/opt/canhelp/node_modules/next/dist/client/index.js
(33440B)
/* global location */ // imports polyfill from `@next/polyfill-module` after build. "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); 0 && (module.exports = { emitter: null, hydrate: null, initialize: null, router: null, version: null }); function _export(target, all) { for(var name in all)Object.defineProperty(target, name, { enumerable: true, get: all[name] }); } _export(exports, { emitter: function() { return emitter; }, hydrate: function() { return hydrate; }, initialize: function() { return initialize; }, router: function() { return router; }, version: function() { return version; } }); const _interop_require_default = require("@swc/helpers/_/_interop_require_default"); const _jsxruntime = require("react/jsx-runtime"); require("../build/polyfills/polyfill-module"); const _react = /*#__PURE__*/ _interop_require_default._(require("react")); const _client = /*#__PURE__*/ _interop_require_default._(require("react-dom/client")); const _headmanagercontextsharedruntime = require("../shared/lib/head-manager-context.shared-runtime"); const _mitt = /*#__PURE__*/ _interop_require_default._(require("../shared/lib/mitt")); const _routercontextsharedruntime = require("../shared/lib/router-context.shared-runtime"); const _disablesmoothscroll = require("../shared/lib/router/utils/disable-smooth-scroll"); const _isdynamic = require("../shared/lib/router/utils/is-dynamic"); const _querystring = require("../shared/lib/router/utils/querystring"); const _runtimeconfigexternal = require("../shared/lib/runtime-config.external"); const _utils = require("../shared/lib/utils"); const _portal = require("./portal"); const _headmanager = /*#__PURE__*/ _interop_require_default._(require("./head-manager")); const _pageloader = /*#__PURE__*/ _interop_require_default._(require("./page-loader")); const _routeannouncer = require("./route-announcer"); const _router = require("./router"); const _iserror = require("../lib/is-error"); const _imageconfigcontextsharedruntime = require("../shared/lib/image-config-context.shared-runtime"); const _removebasepath = require("./remove-base-path"); const _hasbasepath = require("./has-base-path"); const _approutercontextsharedruntime = require("../shared/lib/app-router-context.shared-runtime"); const _adapters = require("../shared/lib/router/adapters"); const _hooksclientcontextsharedruntime = require("../shared/lib/hooks-client-context.shared-runtime"); const _onrecoverableerror = require("./react-client-callbacks/on-recoverable-error"); const _tracer = /*#__PURE__*/ _interop_require_default._(require("./tracing/tracer")); const _isnextroutererror = require("./components/is-next-router-error"); const version = "15.5.14"; let router; const emitter = (0, _mitt.default)(); const looseToArray = (input)=>[].slice.call(input); let initialData; let defaultLocale = undefined; let asPath; let pageLoader; let appElement; let headManager; let initialMatchesMiddleware = false; let lastAppProps; let lastRenderReject; let devClient; let CachedApp, onPerfEntry; let CachedComponent; class Container extends _react.default.Component { componentDidCatch(componentErr, info) { this.props.fn(componentErr, info); } componentDidMount() { this.scrollToHash(); // We need to replace the router state if: // - the page was (auto) exported and has a query string or search (hash) // - it was auto exported and is a dynamic route (to provide params) // - if it is a client-side skeleton (fallback render) // - if middleware matches the current page (may have rewrite params) // - if rewrites in next.config.js match (may have rewrite params) if (router.isSsr && (initialData.isFallback || initialData.nextExport && ((0, _isdynamic.isDynamicRoute)(router.pathname) || location.search || process.env.__NEXT_HAS_REWRITES || initialMatchesMiddleware) || initialData.props && initialData.props.__N_SSG && (location.search || process.env.__NEXT_HAS_REWRITES || initialMatchesMiddleware))) { // update query on mount for exported pages router.replace(router.pathname + '?' + String((0, _querystring.assign)((0, _querystring.urlQueryToSearchParams)(router.query), new URLSearchParams(location.search))), asPath, { // @ts-ignore // WARNING: `_h` is an internal option for handing Next.js // client-side hydration. Your app should _never_ use this property. // It may change at any time without notice. _h: 1, // Fallback pages must trigger the data fetch, so the transition is // not shallow. // Other pages (strictly updating query) happens shallowly, as data // requirements would already be present. shallow: !initialData.isFallback && !initialMatchesMiddleware }).catch((err)=>{ if (!err.cancelled) throw err; }); } } componentDidUpdate() { this.scrollToHash(); } scrollToHash() { let { hash } = location; hash = hash && hash.substring(1); if (!hash) return; const el = document.getElementById(hash); if (!el) return; // If we call scrollIntoView() in here without a setTimeout // it won't scroll properly. setTimeout(()=>el.scrollIntoView(), 0); } render() { if (process.env.NODE_ENV === 'production') { return this.props.children; } else { const { PagesDevOverlayBridge } = require('../next-devtools/userspace/pages/pages-dev-overlay-setup'); return /*#__PURE__*/ (0, _jsxruntime.jsx)(PagesDevOverlayBridge, { children: this.props.children }); } } } async function initialize(opts) { if (opts === void 0) opts = {}; // This makes sure this specific lines are removed in production if (process.env.NODE_ENV === 'development') { _tracer.default.onSpanEnd(require('./tracing/report-to-socket').default); devClient = opts.devClient; } initialData = JSON.parse(document.getElementById('__NEXT_DATA__').textContent); window.__NEXT_DATA__ = initialData; defaultLocale = initialData.defaultLocale; const prefix = initialData.assetPrefix || ''; self.__next_set_public_path__("" + prefix + "/_next/") //eslint-disable-line ; // Initialize next/config with the environment configuration (0, _runtimeconfigexternal.setConfig)({ serverRuntimeConfig: {}, publicRuntimeConfig: initialData.runtimeConfig || {} }); asPath = (0, _utils.getURL)(); // make sure not to attempt stripping basePath for 404s if ((0, _hasbasepath.hasBasePath)(asPath)) { asPath = (0, _removebasepath.removeBasePath)(asPath); } if (process.env.__NEXT_I18N_SUPPORT) { const { normalizeLocalePath } = require('../shared/lib/i18n/normalize-locale-path'); const { detectDomainLocale } = require('../shared/lib/i18n/detect-domain-locale'); const { parseRelativeUrl } = require('../shared/lib/router/utils/parse-relative-url'); const { formatUrl } = require('../shared/lib/router/utils/format-url'); if (initialData.locales) { const parsedAs = parseRelativeUrl(asPath); const localePathResult = normalizeLocalePath(parsedAs.pathname, initialData.locales); if (localePathResult.detectedLocale) { parsedAs.pathname = localePathResult.pathname; asPath = formatUrl(parsedAs); } else { // derive the default locale if it wasn't detected in the asPath // since we don't prerender static pages with all possible default // locales defaultLocale = initialData.locale; } // attempt detecting default locale based on hostname const detectedDomain = detectDomainLocale(process.env.__NEXT_I18N_DOMAINS, window.location.hostname); // TODO: investigate if defaultLocale needs to be populated after // hydration to prevent mismatched renders if (detectedDomain) { defaultLocale = detectedDomain.defaultLocale; } } } if (initialData.scriptLoader) { const { initScriptLoader } = require('./script'); initScriptLoader(initialData.scriptLoader); } pageLoader = new _pageloader.default(initialData.buildId, prefix); const register = (param)=>{ let [r, f] = param; return pageLoader.routeLoader.onEntrypoint(r, f); }; if (window.__NEXT_P) { // Defer page registration for another tick. This will increase the overall // latency in hydrating the page, but reduce the total blocking time. window.__NEXT_P.map((p)=>setTimeout(()=>register(p), 0)); } window.__NEXT_P = []; window.__NEXT_P.push = register; headManager = (0, _headmanager.default)(); headManager.getIsSsr = ()=>{ return router.isSsr; }; appElement = document.getElementById('__next'); return { assetPrefix: prefix }; } function renderApp(App, appProps) { return /*#__PURE__*/ (0, _jsxruntime.jsx)(App, { ...appProps }); } function AppContainer(param) { let { children } = param; // Create a memoized value for next/navigation router context. const adaptedForAppRouter = _react.default.useMemo(()=>{ return (0, _adapters.adaptForAppRouterInstance)(router); }, []); var _self___NEXT_DATA___autoExport; return /*#__PURE__*/ (0, _jsxruntime.jsx)(Container, { fn: (error)=>// TODO: Fix disabled eslint rule // eslint-disable-next-line @typescript-eslint/no-use-before-define renderError({ App: CachedApp, err: error }).catch((err)=>console.error('Error rendering page: ', err)), children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_approutercontextsharedruntime.AppRouterContext.Provider, { value: adaptedForAppRouter, children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_hooksclientcontextsharedruntime.SearchParamsContext.Provider, { value: (0, _adapters.adaptForSearchParams)(router), children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_adapters.PathnameContextProviderAdapter, { router: router, isAutoExport: (_self___NEXT_DATA___autoExport = self.__NEXT_DATA__.autoExport) != null ? _self___NEXT_DATA___autoExport : false, children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_hooksclientcontextsharedruntime.PathParamsContext.Provider, { value: (0, _adapters.adaptForPathParams)(router), children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_routercontextsharedruntime.RouterContext.Provider, { value: (0, _router.makePublicRouterInstance)(router), children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_headmanagercontextsharedruntime.HeadManagerContext.Provider, { value: headManager, children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_imageconfigcontextsharedruntime.ImageConfigContext.Provider, { value: process.env.__NEXT_IMAGE_OPTS, children: children }) }) }) }) }) }) }) }); } const wrapApp = (App)=>(wrappedAppProps)=>{ const appProps = { ...wrappedAppProps, Component: CachedComponent, err: initialData.err, router }; return /*#__PURE__*/ (0, _jsxruntime.jsx)(AppContainer, { children: renderApp(App, appProps) }); }; // This method handles all runtime and debug errors. // 404 and 500 errors are special kind of errors // and they are still handle via the main render method. function renderError(renderErrorProps) { let { App, err } = renderErrorProps; // In development runtime errors are caught by our overlay // In production we catch runtime errors using componentDidCatch which will trigger renderError if (process.env.NODE_ENV !== 'production') { // A Next.js rendering runtime error is always unrecoverable // FIXME: let's make this recoverable (error in GIP client-transition) devClient.onUnrecoverableError(); // We need to render an empty <App> so that the `<ReactDevOverlay>` can // render itself. // TODO: Fix disabled eslint rule // eslint-disable-next-line @typescript-eslint/no-use-before-define return doRender({ App: ()=>null, props: {}, Component: ()=>null, styleSheets: [] }); } // Make sure we log the error to the console, otherwise users can't track down issues. console.error(err); console.error("A client-side exception has occurred, see here for more info: https://nextjs.org/docs/messages/client-side-exception-occurred"); return pageLoader.loadPage('/_error').then((param)=>{ let { page: ErrorComponent, styleSheets } = param; return (lastAppProps == null ? void 0 : lastAppProps.Component) === ErrorComponent ? import('../pages/_error').then((errorModule)=>{ return import('../pages/_app').then((appModule)=>{ App = appModule.default; renderErrorProps.App = App; return errorModule; }); }).then((m)=>({ ErrorComponent: m.default, styleSheets: [] })) : { ErrorComponent, styleSheets }; }).then((param)=>{ let { ErrorComponent, styleSheets } = param; var _renderErrorProps_props; // In production we do a normal render with the `ErrorComponent` as component. // If we've gotten here upon initial render, we can use the props from the server. // Otherwise, we need to call `getInitialProps` on `App` before mounting. const AppTree = wrapApp(App); const appCtx = { Component: ErrorComponent, AppTree, router, ctx: { err, pathname: initialData.page, query: initialData.query, asPath, AppTree } }; return Promise.resolve(((_renderErrorProps_props = renderErrorProps.props) == null ? void 0 : _renderErrorProps_props.err) ? renderErrorProps.props : (0, _utils.loadGetInitialProps)(App, appCtx)).then((initProps)=>// TODO: Fix disabled eslint rule // eslint-disable-next-line @typescript-eslint/no-use-before-define doRender({ ...renderErrorProps, err, Component: ErrorComponent, styleSheets, props: initProps })); }); } // Dummy component that we render as a child of Root so that we can // toggle the correct styles before the page is rendered. function Head(param) { let { callback } = param; // We use `useLayoutEffect` to guarantee the callback is executed // as soon as React flushes the update. _react.default.useLayoutEffect(()=>callback(), [ callback ]); return null; } const performanceMarks = { navigationStart: 'navigationStart', beforeRender: 'beforeRender', afterRender: 'afterRender', afterHydrate: 'afterHydrate', routeChange: 'routeChange' }; const performanceMeasures = { hydration: 'Next.js-hydration', beforeHydration: 'Next.js-before-hydration', routeChangeToRender: 'Next.js-route-change-to-render', render: 'Next.js-render' }; let reactRoot = null; // On initial render a hydrate should always happen let shouldHydrate = true; function clearMarks() { ; [ performanceMarks.beforeRender, performanceMarks.afterHydrate, performanceMarks.afterRender, performanceMarks.routeChange ].forEach((mark)=>performance.clearMarks(mark)); } function markHydrateComplete() { if (!_utils.ST) return; performance.mark(performanceMarks.afterHydrate) // mark end of hydration ; const hasBeforeRenderMark = performance.getEntriesByName(performanceMarks.beforeRender, 'mark').length; if (hasBeforeRenderMark) { const beforeHydrationMeasure = performance.measure(performanceMeasures.beforeHydration, performanceMarks.navigationStart, performanceMarks.beforeRender); const hydrationMeasure = performance.measure(performanceMeasures.hydration, performanceMarks.beforeRender, performanceMarks.afterHydrate); if (process.env.NODE_ENV === 'development' && // Old versions of Safari don't return `PerformanceMeasure`s from `performance.measure()` beforeHydrationMeasure && hydrationMeasure) { _tracer.default.startSpan('navigation-to-hydration', { startTime: performance.timeOrigin + beforeHydrationMeasure.startTime, attributes: { pathname: location.pathname, query: location.search } }).end(performance.timeOrigin + hydrationMeasure.startTime + hydrationMeasure.duration); } } if (onPerfEntry) { performance.getEntriesByName(performanceMeasures.hydration).forEach(onPerfEntry); } clearMarks(); } function markRenderComplete() { if (!_utils.ST) return; performance.mark(performanceMarks.afterRender) // mark end of render ; const navStartEntries = performance.getEntriesByName(performanceMarks.routeChange, 'mark'); if (!navStartEntries.length) return; const hasBeforeRenderMark = performance.getEntriesByName(performanceMarks.beforeRender, 'mark').length; if (hasBeforeRenderMark) { performance.measure(performanceMeasures.routeChangeToRender, navStartEntries[0].name, performanceMarks.beforeRender); performance.measure(performanceMeasures.render, performanceMarks.beforeRender, performanceMarks.afterRender); if (onPerfEntry) { performance.getEntriesByName(performanceMeasures.render).forEach(onPerfEntry); performance.getEntriesByName(performanceMeasures.routeChangeToRender).forEach(onPerfEntry); } } clearMarks(); [ performanceMeasures.routeChangeToRender, performanceMeasures.render ].forEach((measure)=>performance.clearMeasures(measure)); } function renderReactElement(domEl, fn) { // mark start of hydrate/render if (_utils.ST) { performance.mark(performanceMarks.beforeRender); } const reactEl = fn(shouldHydrate ? markHydrateComplete : markRenderComplete); if (!reactRoot) { // Unlike with createRoot, you don't need a separate root.render() call here reactRoot = _client.default.hydrateRoot(domEl, reactEl, { onRecoverableError: _onrecoverableerror.onRecoverableError }); // TODO: Remove shouldHydrate variable when React 18 is stable as it can depend on `reactRoot` existing shouldHydrate = false; } else { const startTransition = _react.default.startTransition; startTransition(()=>{ reactRoot.render(reactEl); }); } } function Root(param) { let { callbacks, children } = param; // We use `useLayoutEffect` to guarantee the callbacks are executed // as soon as React flushes the update _react.default.useLayoutEffect(()=>callbacks.forEach((callback)=>callback()), [ callbacks ]); if (process.env.__NEXT_TEST_MODE) { // eslint-disable-next-line react-hooks/rules-of-hooks _react.default.useEffect(()=>{ window.__NEXT_HYDRATED = true; window.__NEXT_HYDRATED_AT = performance.now(); if (window.__NEXT_HYDRATED_CB) { window.__NEXT_HYDRATED_CB(); } }, []); } return children; } function doRender(input) { let { App, Component, props, err } = input; let styleSheets = 'initial' in input ? undefined : input.styleSheets; Component = Component || lastAppProps.Component; props = props || lastAppProps.props; const appProps = { ...props, Component, err, router }; // lastAppProps has to be set before ReactDom.render to account for ReactDom throwing an error. lastAppProps = appProps; let canceled = false; let resolvePromise; const renderPromise = new Promise((resolve, reject)=>{ if (lastRenderReject) { lastRenderReject(); } resolvePromise = ()=>{ lastRenderReject = null; resolve(); }; lastRenderReject = ()=>{ canceled = true; lastRenderReject = null; const error = Object.defineProperty(new Error('Cancel rendering route'), "__NEXT_ERROR_CODE", { value: "E503", enumerable: false, configurable: true }); error.cancelled = true; reject(error); }; }); // This function has a return type to ensure it doesn't start returning a // Promise. It should remain synchronous. function onStart() { if (!styleSheets || // We use `style-loader` in development, so we don't need to do anything // unless we're in production: process.env.NODE_ENV !== 'production') { return false; } const currentStyleTags = looseToArray(document.querySelectorAll('style[data-n-href]')); const currentHrefs = new Set(currentStyleTags.map((tag)=>tag.getAttribute('data-n-href'))); const noscript = document.querySelector('noscript[data-n-css]'); const nonce = noscript == null ? void 0 : noscript.getAttribute('data-n-css'); styleSheets.forEach((param)=>{ let { href, text } = param; if (!currentHrefs.has(href)) { const styleTag = document.createElement('style'); styleTag.setAttribute('data-n-href', href); styleTag.setAttribute('media', 'x'); if (nonce) { styleTag.setAttribute('nonce', nonce); } document.head.appendChild(styleTag); styleTag.appendChild(document.createTextNode(text)); } }); return true; } function onHeadCommit() { if (// Turbopack has it's own css injection handling, this code ends up removing the CSS. !process.env.TURBOPACK && // We use `style-loader` in development, so we don't need to do anything // unless we're in production: process.env.NODE_ENV === 'production' && // We can skip this during hydration. Running it wont cause any harm, but // we may as well save the CPU cycles: styleSheets && // Ensure this render was not canceled !canceled) { const desiredHrefs = new Set(styleSheets.map((s)=>s.href)); const currentStyleTags = looseToArray(document.querySelectorAll('style[data-n-href]')); const currentHrefs = currentStyleTags.map((tag)=>tag.getAttribute('data-n-href')); // Toggle `<style>` tags on or off depending on if they're needed: for(let idx = 0; idx < currentHrefs.length; ++idx){ if (desiredHrefs.has(currentHrefs[idx])) { currentStyleTags[idx].removeAttribute('media'); } else { currentStyleTags[idx].setAttribute('media', 'x'); } } // Reorder styles into intended order: let referenceNode = document.querySelector('noscript[data-n-css]'); if (// This should be an invariant: referenceNode) { styleSheets.forEach((param)=>{ let { href } = param; const targetTag = document.querySelector('style[data-n-href="' + href + '"]'); if (// This should be an invariant: targetTag) { referenceNode.parentNode.insertBefore(targetTag, referenceNode.nextSibling); referenceNode = targetTag; } }); } // Finally, clean up server rendered stylesheets: looseToArray(document.querySelectorAll('link[data-n-p]')).forEach((el)=>{ el.parentNode.removeChild(el); }); } if (input.scroll) { const { x, y } = input.scroll; (0, _disablesmoothscroll.disableSmoothScrollDuringRouteTransition)(()=>{ window.scrollTo(x, y); }); } } function onRootCommit() { resolvePromise(); } onStart(); const elem = /*#__PURE__*/ (0, _jsxruntime.jsxs)(_jsxruntime.Fragment, { children: [ /*#__PURE__*/ (0, _jsxruntime.jsx)(Head, { callback: onHeadCommit }), /*#__PURE__*/ (0, _jsxruntime.jsxs)(AppContainer, { children: [ renderApp(App, appProps), /*#__PURE__*/ (0, _jsxruntime.jsx)(_portal.Portal, { type: "next-route-announcer", children: /*#__PURE__*/ (0, _jsxruntime.jsx)(_routeannouncer.RouteAnnouncer, {}) }) ] }) ] }); // We catch runtime errors using componentDidCatch which will trigger renderError renderReactElement(appElement, (callback)=>/*#__PURE__*/ (0, _jsxruntime.jsx)(Root, { callbacks: [ callback, onRootCommit ], children: process.env.__NEXT_STRICT_MODE ? /*#__PURE__*/ (0, _jsxruntime.jsx)(_react.default.StrictMode, { children: elem }) : elem })); return renderPromise; } async function render(renderingProps) { // if an error occurs in a server-side page (e.g. in getInitialProps), // skip re-rendering the error page client-side as data-fetching operations // will already have been done on the server and NEXT_DATA contains the correct // data for straight-forward hydration of the error page if (renderingProps.err && // renderingProps.Component might be undefined if there is a top/module-level error (typeof renderingProps.Component === 'undefined' || !renderingProps.isHydratePass)) { await renderError(renderingProps); return; } try { await doRender(renderingProps); } catch (err) { const renderErr = (0, _iserror.getProperError)(err); // bubble up cancelation errors if (renderErr.cancelled) { throw renderErr; } if (process.env.NODE_ENV === 'development') { // Ensure this error is displayed in the overlay in development setTimeout(()=>{ throw renderErr; }); } await renderError({ ...renderingProps, err: renderErr }); } } async function hydrate(opts) { let initialErr = initialData.err; try { const appEntrypoint = await pageLoader.routeLoader.whenEntrypoint('/_app'); if ('error' in appEntrypoint) { throw appEntrypoint.error; } const { component: app, exports: mod } = appEntrypoint; CachedApp = app; if (mod && mod.reportWebVitals) { onPerfEntry = (param)=>{ let { id, name, startTime, value, duration, entryType, entries, attribution } = param; // Combines timestamp with random number for unique ID const uniqueID = Date.now() + "-" + (Math.floor(Math.random() * (9e12 - 1)) + 1e12); let perfStartEntry; if (entries && entries.length) { perfStartEntry = entries[0].startTime; } const webVitals = { id: id || uniqueID, name, startTime: startTime || perfStartEntry, value: value == null ? duration : value, label: entryType === 'mark' || entryType === 'measure' ? 'custom' : 'web-vital' }; if (attribution) { webVitals.attribution = attribution; } mod.reportWebVitals(webVitals); }; } const pageEntrypoint = // The dev server fails to serve script assets when there's a hydration // error, so we need to skip waiting for the entrypoint. process.env.NODE_ENV === 'development' && initialData.err ? { error: initialData.err } : await pageLoader.routeLoader.whenEntrypoint(initialData.page); if ('error' in pageEntrypoint) { throw pageEntrypoint.error; } CachedComponent = pageEntrypoint.component; if (process.env.NODE_ENV !== 'production') { const { isValidElementType } = require('next/dist/compiled/react-is'); if (!isValidElementType(CachedComponent)) { throw Object.defineProperty(new Error('The default export is not a React Component in page: "' + initialData.page + '"'), "__NEXT_ERROR_CODE", { value: "E286", enumerable: false, configurable: true }); } } } catch (error) { // This catches errors like throwing in the top level of a module initialErr = (0, _iserror.getProperError)(error); } if (process.env.NODE_ENV === 'development') { const getServerError = require('../server/dev/node-stack-frames').getServerError; // Server-side runtime errors need to be re-thrown on the client-side so // that the overlay is rendered. if (initialErr) { if (initialErr === initialData.err) { setTimeout(()=>{ let error; try { // Generate a new error object. We `throw` it because some browsers // will set the `stack` when thrown, and we want to ensure ours is // not overridden when we re-throw it below. throw Object.defineProperty(new Error(initialErr.message), "__NEXT_ERROR_CODE", { value: "E394", enumerable: false, configurable: true }); } catch (e) { error = e; } error.name = initialErr.name; error.stack = initialErr.stack; const errSource = initialErr.source; // In development, error the navigation API usage in runtime, // since it's not allowed to be used in pages router as it doesn't contain error boundary like app router. if ((0, _isnextroutererror.isNextRouterError)(initialErr)) { error.message = 'Next.js navigation API is not allowed to be used in Pages Router.'; } throw getServerError(error, errSource); }); } else { setTimeout(()=>{ throw initialErr; }); } } } if (window.__NEXT_PRELOADREADY) { await window.__NEXT_PRELOADREADY(initialData.dynamicIds); } router = (0, _router.createRouter)(initialData.page, initialData.query, asPath, { initialProps: initialData.props, pageLoader, App: CachedApp, Component: CachedComponent, wrapApp, err: initialErr, isFallback: Boolean(initialData.isFallback), subscription: (info, App, scroll)=>render(Object.assign({}, info, { App, scroll })), locale: initialData.locale, locales: initialData.locales, defaultLocale, domainLocales: initialData.domainLocales, isPreview: initialData.isPreview }); initialMatchesMiddleware = await router._initialMatchesMiddlewarePromise; const renderCtx = { App: CachedApp, initial: true, Component: CachedComponent, props: initialData.props, err: initialErr, isHydratePass: true }; if (opts == null ? void 0 : opts.beforeRender) { await opts.beforeRender(); } render(renderCtx); } if ((typeof exports.default === 'function' || (typeof exports.default === 'object' && exports.default !== null)) && typeof exports.default.__esModule === 'undefined') { Object.defineProperty(exports.default, '__esModule', { value: true }); Object.assign(exports.default, exports); module.exports = exports.default; } //# sourceMappingURL=index.js.map
Save
cmd:
run