{"version":3,"file":"f2408bd2.js","sources":["../../../node_modules/@shopify/hydrogen/dist/esnext/foundation/ssr-interop.js"],"sourcesContent":["/**\n * This file is used for compatibility between browser and server environments.\n * The browser loads this file as is, without leaking server logic.\n * In the server, this file is transformed by Vite to inject server logic.\n * NOTE: Do not remove SSR-prefixed comments in this file.\n */\nimport { useContext } from 'react';\n//@SSR import {useServerRequest} from './ServerRequestProvider/index.js';\n// This is replaced by Vite to import.meta.env.SSR\nexport const META_ENV_SSR = false;\nconst reactContextType = Symbol.for('react.context');\n/**\n * Isomorphic hook to access context data. It gives access to the current request\n * when running on the server, and returns the provided client fallback in the browser.\n * This can be used in server components (RSC) as a Context/Provider replacement. In client\n * components, it uses the server getter in SSR and the client fallback in the browser.\n * @param serverGetter - A function that gets the current server request and returns any\n * desired request property. It only runs in the server (both in RSC and SSR).\n * @param clientFallback - An optional raw value or a React.Context to be consumed that will be\n * returned if the current environment is not the server. Note that, if this is a React.Context,\n * there must be a React.Provider parent in the app tree.\n * @returns A value retrieved from the current server request or a fallback value in the client.\n * The returned type depends on what the server getter returns.\n * @example\n * ```js\n * import {MyClientContext} from './my-client-react-context-provider.js';\n * useEnvContext(req => req.ctx.myServerContext, MyClientContext)\n * ```\n */\nexport function useEnvContext(serverGetter, clientFallback) {\n //@SSR if (META_ENV_SSR) return serverGetter(useServerRequest());\n return clientFallback && clientFallback.$$typeof === reactContextType\n ? useContext(clientFallback) // eslint-disable-line react-hooks/rules-of-hooks\n : clientFallback;\n}\n"],"names":["META_ENV_SSR","reactContextType","useEnvContext","serverGetter","clientFallback","useContext"],"mappings":"wCASY,MAACA,EAAe,GACtBC,EAAmB,OAAO,IAAI,eAAe,EAmB5C,SAASC,EAAcC,EAAcC,EAAgB,CAExD,OAAOA,GAAkBA,EAAe,WAAaH,EAC/CI,EAAAA,QAAAA,WAAWD,CAAc,EACzBA,CACV"}