/opt/canhelp/node_modules/next/dist/esm/client
Edit: /opt/canhelp/node_modules/next/dist/esm/client/app-index.js.map (17238B)
{"version":3,"sources":["../../src/client/app-index.tsx"],"sourcesContent":["import './app-globals'\nimport ReactDOMClient from 'react-dom/client'\nimport React, { use } from 'react'\n// TODO: Explicitly import from client.browser\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport { createFromReadableStream as createFromReadableStreamBrowser } from 'react-server-dom-webpack/client'\nimport { HeadManagerContext } from '../shared/lib/head-manager-context.shared-runtime'\nimport { onRecoverableError } from './react-client-callbacks/on-recoverable-error'\nimport {\n onCaughtError,\n onUncaughtError,\n} from './react-client-callbacks/error-boundary-callbacks'\nimport { callServer } from './app-call-server'\nimport { findSourceMapURL } from './app-find-source-map-url'\nimport {\n type AppRouterActionQueue,\n createMutableActionQueue,\n} from './components/app-router-instance'\nimport AppRouter from './components/app-router'\nimport type { InitialRSCPayload } from '../server/app-render/types'\nimport { createInitialRouterState } from './components/router-reducer/create-initial-router-state'\nimport { MissingSlotContext } from '../shared/lib/app-router-context.shared-runtime'\nimport { setAppBuildId } from './app-build-id'\n\n///
\n\nconst createFromReadableStream =\n createFromReadableStreamBrowser as (typeof import('react-server-dom-webpack/client.browser'))['createFromReadableStream']\n\nconst appElement: HTMLElement | Document = document\n\nconst encoder = new TextEncoder()\n\nlet initialServerDataBuffer: (string | Uint8Array)[] | undefined = undefined\nlet initialServerDataWriter: ReadableStreamDefaultController | undefined =\n undefined\nlet initialServerDataLoaded = false\nlet initialServerDataFlushed = false\n\nlet initialFormStateData: null | any = null\n\ntype FlightSegment =\n | [isBootStrap: 0]\n | [isNotBootstrap: 1, responsePartial: string]\n | [isFormState: 2, formState: any]\n | [isBinary: 3, responseBase64Partial: string]\n\ntype NextFlight = Omit
, 'push'> & {\n push: (seg: FlightSegment) => void\n}\n\ndeclare global {\n // If you're working in a browser environment\n interface Window {\n __next_f: NextFlight\n }\n}\n\nfunction nextServerDataCallback(seg: FlightSegment): void {\n if (seg[0] === 0) {\n initialServerDataBuffer = []\n } else if (seg[0] === 1) {\n if (!initialServerDataBuffer)\n throw new Error('Unexpected server data: missing bootstrap script.')\n\n if (initialServerDataWriter) {\n initialServerDataWriter.enqueue(encoder.encode(seg[1]))\n } else {\n initialServerDataBuffer.push(seg[1])\n }\n } else if (seg[0] === 2) {\n initialFormStateData = seg[1]\n } else if (seg[0] === 3) {\n if (!initialServerDataBuffer)\n throw new Error('Unexpected server data: missing bootstrap script.')\n\n // Decode the base64 string back to binary data.\n const binaryString = atob(seg[1])\n const decodedChunk = new Uint8Array(binaryString.length)\n for (var i = 0; i < binaryString.length; i++) {\n decodedChunk[i] = binaryString.charCodeAt(i)\n }\n\n if (initialServerDataWriter) {\n initialServerDataWriter.enqueue(decodedChunk)\n } else {\n initialServerDataBuffer.push(decodedChunk)\n }\n }\n}\n\nfunction isStreamErrorOrUnfinished(ctr: ReadableStreamDefaultController) {\n // If `desiredSize` is null, it means the stream is closed or errored. If it is lower than 0, the stream is still unfinished.\n return ctr.desiredSize === null || ctr.desiredSize < 0\n}\n\n// There might be race conditions between `nextServerDataRegisterWriter` and\n// `DOMContentLoaded`. The former will be called when React starts to hydrate\n// the root, the latter will be called when the DOM is fully loaded.\n// For streaming, the former is called first due to partial hydration.\n// For non-streaming, the latter can be called first.\n// Hence, we use two variables `initialServerDataLoaded` and\n// `initialServerDataFlushed` to make sure the writer will be closed and\n// `initialServerDataBuffer` will be cleared in the right time.\nfunction nextServerDataRegisterWriter(ctr: ReadableStreamDefaultController) {\n if (initialServerDataBuffer) {\n initialServerDataBuffer.forEach((val) => {\n ctr.enqueue(typeof val === 'string' ? encoder.encode(val) : val)\n })\n if (initialServerDataLoaded && !initialServerDataFlushed) {\n if (isStreamErrorOrUnfinished(ctr)) {\n ctr.error(\n new Error(\n 'The connection to the page was unexpectedly closed, possibly due to the stop button being clicked, loss of Wi-Fi, or an unstable internet connection.'\n )\n )\n } else {\n ctr.close()\n }\n initialServerDataFlushed = true\n initialServerDataBuffer = undefined\n }\n }\n\n initialServerDataWriter = ctr\n}\n\n// When `DOMContentLoaded`, we can close all pending writers to finish hydration.\nconst DOMContentLoaded = function () {\n if (initialServerDataWriter && !initialServerDataFlushed) {\n initialServerDataWriter.close()\n initialServerDataFlushed = true\n initialServerDataBuffer = undefined\n }\n initialServerDataLoaded = true\n}\n\n// It's possible that the DOM is already loaded.\nif (document.readyState === 'loading') {\n document.addEventListener('DOMContentLoaded', DOMContentLoaded, false)\n} else {\n // Delayed in marco task to ensure it's executed later than hydration\n setTimeout(DOMContentLoaded)\n}\n\nconst nextServerDataLoadingGlobal = (self.__next_f = self.__next_f || [])\nnextServerDataLoadingGlobal.forEach(nextServerDataCallback)\nnextServerDataLoadingGlobal.push = nextServerDataCallback\n\nconst readable = new ReadableStream({\n start(controller) {\n nextServerDataRegisterWriter(controller)\n },\n})\n\nconst initialServerResponse = createFromReadableStream(\n readable,\n { callServer, findSourceMapURL }\n)\n\nfunction ServerRoot({\n pendingActionQueue,\n}: {\n pendingActionQueue: Promise\n}): React.ReactNode {\n const initialRSCPayload = use(initialServerResponse)\n const actionQueue = use(pendingActionQueue)\n\n const router = (\n \n )\n\n if (process.env.NODE_ENV === 'development' && initialRSCPayload.m) {\n // We provide missing slot information in a context provider only during development\n // as we log some additional information about the missing slots in the console.\n return (\n \n {router}\n \n )\n }\n\n return router\n}\n\nconst StrictModeIfEnabled = process.env.__NEXT_STRICT_MODE_APP\n ? React.StrictMode\n : React.Fragment\n\nfunction Root({ children }: React.PropsWithChildren<{}>) {\n if (process.env.__NEXT_TEST_MODE) {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useEffect(() => {\n window.__NEXT_HYDRATED = true\n window.__NEXT_HYDRATED_AT = performance.now()\n window.__NEXT_HYDRATED_CB?.()\n }, [])\n }\n\n return children\n}\n\nfunction onDefaultTransitionIndicator() {\n // TODO: Compose default with user-configureable (e.g. nprogress)\n // TODO: Use React's default once we figure out hanging indicators: https://codesandbox.io/p/sandbox/charming-moon-hktkp6?file=%2Fsrc%2Findex.js%3A106%2C30\n return () => {}\n}\n\nconst reactRootOptions: ReactDOMClient.RootOptions = {\n onDefaultTransitionIndicator: onDefaultTransitionIndicator,\n onRecoverableError,\n onCaughtError,\n onUncaughtError,\n}\n\nexport type ClientInstrumentationHooks = {\n onRouterTransitionStart?: (\n url: string,\n navigationType: 'push' | 'replace' | 'traverse'\n ) => void\n}\n\nexport function hydrate(\n instrumentationHooks: ClientInstrumentationHooks | null\n) {\n // React overrides `.then` and doesn't return a new promise chain,\n // so we wrap the action queue in a promise to ensure that its value\n // is defined when the promise resolves.\n // https://github.com/facebook/react/blob/163365a07872337e04826c4f501565d43dbd2fd4/packages/react-client/src/ReactFlightClient.js#L189-L190\n const pendingActionQueue: Promise = new Promise(\n (resolve, reject) => {\n initialServerResponse.then(\n (initialRSCPayload) => {\n // setAppBuildId should be called only once, during JS initialization\n // and before any components have hydrated.\n setAppBuildId(initialRSCPayload.b)\n\n const initialTimestamp = Date.now()\n\n resolve(\n createMutableActionQueue(\n createInitialRouterState({\n navigatedAt: initialTimestamp,\n initialFlightData: initialRSCPayload.f,\n initialCanonicalUrlParts: initialRSCPayload.c,\n initialParallelRoutes: new Map(),\n location: window.location,\n couldBeIntercepted: initialRSCPayload.i,\n postponed: initialRSCPayload.s,\n prerendered: initialRSCPayload.S,\n }),\n instrumentationHooks\n )\n )\n },\n (err: Error) => reject(err)\n )\n }\n )\n\n const reactEl = (\n \n \n \n \n \n \n \n )\n\n if (document.documentElement.id === '__next_error__') {\n let element = reactEl\n // Server rendering failed, fall back to client-side rendering\n if (process.env.NODE_ENV !== 'production') {\n const { RootLevelDevOverlayElement } =\n require('../next-devtools/userspace/app/client-entry') as typeof import('../next-devtools/userspace/app/client-entry')\n\n // Note this won't cause hydration mismatch because we are doing CSR w/o hydration\n element = (\n {element}\n )\n }\n\n ReactDOMClient.createRoot(appElement, reactRootOptions).render(element)\n } else {\n React.startTransition(() => {\n ReactDOMClient.hydrateRoot(appElement, reactEl, {\n ...reactRootOptions,\n formState: initialFormStateData,\n })\n })\n }\n\n // TODO-APP: Remove this logic when Float has GC built-in in development.\n if (process.env.NODE_ENV !== 'production') {\n const { linkGc } =\n require('./app-link-gc') as typeof import('./app-link-gc')\n linkGc()\n }\n}\n"],"names":["ReactDOMClient","React","use","createFromReadableStream","createFromReadableStreamBrowser","HeadManagerContext","onRecoverableError","onCaughtError","onUncaughtError","callServer","findSourceMapURL","createMutableActionQueue","AppRouter","createInitialRouterState","MissingSlotContext","setAppBuildId","appElement","document","encoder","TextEncoder","initialServerDataBuffer","undefined","initialServerDataWriter","initialServerDataLoaded","initialServerDataFlushed","initialFormStateData","nextServerDataCallback","seg","Error","enqueue","encode","push","binaryString","atob","decodedChunk","Uint8Array","length","i","charCodeAt","isStreamErrorOrUnfinished","ctr","desiredSize","nextServerDataRegisterWriter","forEach","val","error","close","DOMContentLoaded","readyState","addEventListener","setTimeout","nextServerDataLoadingGlobal","self","__next_f","readable","ReadableStream","start","controller","initialServerResponse","ServerRoot","pendingActionQueue","initialRSCPayload","actionQueue","router","globalErrorState","G","assetPrefix","p","process","env","NODE_ENV","m","value","StrictModeIfEnabled","__NEXT_STRICT_MODE_APP","StrictMode","Fragment","Root","children","__NEXT_TEST_MODE","useEffect","window","__NEXT_HYDRATED","__NEXT_HYDRATED_AT","performance","now","__NEXT_HYDRATED_CB","onDefaultTransitionIndicator","reactRootOptions","hydrate","instrumentationHooks","Promise","resolve","reject","then","b","initialTimestamp","Date","navigatedAt","initialFlightData","f","initialCanonicalUrlParts","c","initialParallelRoutes","Map","location","couldBeIntercepted","postponed","s","prerendered","S","err","reactEl","Provider","appDir","documentElement","id","element","RootLevelDevOverlayElement","require","createRoot","render","startTransition","hydrateRoot","formState","linkGc"],"mappings":";AAAA,OAAO,gBAAe;AACtB,OAAOA,oBAAoB,mBAAkB;AAC7C,OAAOC,SAASC,GAAG,QAAQ,QAAO;AAClC,8CAA8C;AAC9C,6DAA6D;AAC7D,SA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