This repository has been archived by the owner on Jun 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
711-c14212873fe47abf96e6.js.map
1 lines (1 loc) · 5.58 KB
/
711-c14212873fe47abf96e6.js.map
1
{"version":3,"file":"711-c14212873fe47abf96e6.js","mappings":"8JAiBIA,EACAC,E,oBAAAA,G,gBAAAA,CAAAA,QAAAA,UAAAA,YAAAA,WAAAA,iBAAAA,MAAAA,eAAAA,WAAAA,iBAAAA,kBAAAA,cAqBIC,EAAiBC,EAAQA,MAODC,SAGhBC,EAAAA,EAedC,EACAC,EACAC,EACAC,GAAAA,IAhBEC,EAAAA,EAAAA,MACAC,EAAAA,EAAAA,QACAC,EAAAA,EAAAA,UACAC,EAAAA,EAAAA,SACAC,EAAAA,EAAAA,eACAC,EAAAA,EAAAA,IACAC,EAAAA,EAAAA,aAAAA,EAAAA,EACAC,SAAAA,OAAAA,IAAAA,EAAW,GAAAC,EACXC,EAAAA,EAAAA,eACAC,EAAAA,EAAAA,gBAAAA,EAAAA,EACAC,UAAAA,OAAAA,IAAAA,EAAAA,QAAAA,EACGC,GAAAA,EAAAA,EAAAA,GAAAA,EAAAA,GAQHC,EAMEb,EANFa,MACAC,EAKEd,EALFc,OACAC,EAIEf,EAJFe,OACAC,EAGEhB,EAHFgB,OACAC,EAEEjB,EAFFiB,YACiBC,EACflB,EADFU,gBAGIS,EAAWC,KAAKC,UAAUL,GAEhCT,GAAAA,EAAAA,EAAAA,GAAAA,CACEI,UAAAA,EACAF,eAAAA,EACAC,gBAAAA,GACGH,GAGL,IAAMe,EACJC,EAAAA,cAACC,EAAAA,EAAAA,CAAcT,OAAQA,EAAQF,MAAOA,EAAOC,OAAQA,GACnDS,EAAAA,cAACE,EAAAA,GAAAA,EAAAA,EAAAA,GAAAA,IACKC,EAAAA,EAAAA,GACFT,EACAd,EACAY,EACAF,EACAC,EACAI,EACAP,EACAF,KAIJc,EAAAA,cAACI,EAAAA,GAAAA,EAAAA,EAAAA,GAAAA,GACMf,EAAAA,CACLC,MAAOA,EACPC,OAAQA,EACRc,UAAWtB,IACPuB,EAAAA,EAAAA,GACF3B,EACAC,EACAa,EACAf,EACAG,EACAe,EACAd,EACAE,MAoBR,OAdIX,EAAKkC,UAEHjC,EAASiC,SAAWhC,EAAagC,QACnC/B,EAAa+B,QAAUxC,EACrBgC,EACA1B,EAAKkC,QACL/B,EAAa+B,SAGfvC,EAAa+B,EAAW1B,EAAKkC,SAE/BjC,EAASiC,SAAAA,GAAU,WAIflC,EAAKkC,SACPxC,EACE,KACAM,EAAKkC,QACL/B,EAAa+B,UApGnBxC,EAAc,SACZyC,EACAC,GAEAxC,EAAeyC,OAAOF,EAAWC,IAEnCzC,EAAeC,EAAeE","sources":["webpack://overlayz/../src/components/lazy-hydrate.tsx"],"sourcesContent":["/* global HAS_REACT_18 */\nimport React, { MutableRefObject } from \"react\"\nimport { GatsbyImageProps } from \"./gatsby-image.browser\"\nimport { LayoutWrapper } from \"./layout-wrapper\"\nimport { Placeholder } from \"./placeholder\"\nimport { MainImageProps, MainImage } from \"./main-image\"\nimport { getMainProps, getPlaceholderProps } from \"./hooks\"\nimport { ReactElement } from \"react\"\nimport type { Root } from \"react-dom/client\"\n\ntype LazyHydrateProps = Omit<GatsbyImageProps, \"as\" | \"style\" | \"className\"> & {\n isLoading: boolean\n isLoaded: boolean // alwaystype SetStateAction<S> = S | ((prevState: S) => S);\n toggleIsLoaded: (toggle: boolean) => void\n ref: MutableRefObject<HTMLImageElement | undefined>\n}\n\nlet reactRender\nlet reactHydrate\nif (HAS_REACT_18) {\n const reactDomClient = require(`react-dom/client`)\n reactRender = (\n Component: React.ReactChild | Iterable<React.ReactNode>,\n el: ReactDOM.Container,\n root: Root\n ): Root => {\n if (!root) {\n root = reactDomClient.createRoot(el)\n }\n\n root.render(Component)\n\n return root\n }\n reactHydrate = (\n Component: React.ReactChild | Iterable<React.ReactNode>,\n el: ReactDOM.Container\n ): Root => reactDomClient.hydrateRoot(el, Component)\n} else {\n const reactDomClient = require(`react-dom`)\n reactRender = (\n Component: React.ReactChild | Iterable<React.ReactNode>,\n el: ReactDOM.Container\n ): void => {\n reactDomClient.render(Component, el)\n }\n reactHydrate = reactDomClient.hydrate\n}\n\nexport function lazyHydrate(\n {\n image,\n loading,\n isLoading,\n isLoaded,\n toggleIsLoaded,\n ref,\n imgClassName,\n imgStyle = {},\n objectPosition,\n backgroundColor,\n objectFit = `cover`,\n ...props\n }: LazyHydrateProps,\n root: MutableRefObject<HTMLElement | undefined>,\n hydrated: MutableRefObject<boolean>,\n forceHydrate: MutableRefObject<boolean>,\n reactRootRef: MutableRefObject<Root>\n): (() => void) | null {\n const {\n width,\n height,\n layout,\n images,\n placeholder,\n backgroundColor: wrapperBackgroundColor,\n } = image\n\n const cacheKey = JSON.stringify(images)\n\n imgStyle = {\n objectFit,\n objectPosition,\n backgroundColor,\n ...imgStyle,\n }\n\n const component = (\n <LayoutWrapper layout={layout} width={width} height={height}>\n <Placeholder\n {...getPlaceholderProps(\n placeholder,\n isLoaded,\n layout,\n width,\n height,\n wrapperBackgroundColor,\n objectFit,\n objectPosition\n )}\n />\n\n <MainImage\n {...(props as Omit<MainImageProps, \"images\" | \"fallback\">)}\n width={width}\n height={height}\n className={imgClassName}\n {...getMainProps(\n isLoading,\n isLoaded,\n images,\n loading,\n toggleIsLoaded,\n cacheKey,\n ref,\n imgStyle\n )}\n />\n </LayoutWrapper>\n )\n\n if (root.current) {\n // Force render to mitigate \"Expected server HTML to contain a matching\" in develop\n if (hydrated.current || forceHydrate.current || HAS_REACT_18) {\n reactRootRef.current = reactRender(\n component,\n root.current,\n reactRootRef.current\n )\n } else {\n reactHydrate(component, root.current)\n }\n hydrated.current = true\n }\n\n return (): void => {\n if (root.current) {\n reactRender(\n null as unknown as ReactElement,\n root.current,\n reactRootRef.current\n )\n }\n }\n}\n"],"names":["reactRender","reactHydrate","reactDomClient","require","hydrate","lazyHydrate","root","hydrated","forceHydrate","reactRootRef","image","loading","isLoading","isLoaded","toggleIsLoaded","ref","imgClassName","imgStyle","E","objectPosition","backgroundColor","objectFit","props","width","height","layout","images","placeholder","wrapperBackgroundColor","cacheKey","JSON","stringify","component","React","LayoutWrapper","Placeholder","getPlaceholderProps","MainImage","className","getMainProps","current","Component","el","render"],"sourceRoot":""}