@plasmicapp/loader-react 1.0.391 → 2.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +0 -9
- package/dist/index.esm.js +0 -9
- package/dist/index.esm.js.map +3 -3
- package/dist/index.js +0 -9
- package/dist/index.js.map +3 -3
- package/package.json +20 -13
package/dist/index.d.ts
CHANGED
|
@@ -622,15 +622,6 @@ declare interface ReactServerOps {
|
|
|
622
622
|
fetchData: typeof useMutablePlasmicQueryData;
|
|
623
623
|
}
|
|
624
624
|
|
|
625
|
-
export declare function renderToElement(loader: PlasmicComponentLoader, target: HTMLElement, lookup: ComponentLookupSpec, opts?: {
|
|
626
|
-
prefetchedData?: ComponentRenderData;
|
|
627
|
-
componentProps?: any;
|
|
628
|
-
globalVariants?: GlobalVariantSpec[];
|
|
629
|
-
prefetchedQueryData?: Record<string, any>;
|
|
630
|
-
pageParams?: Record<string, any>;
|
|
631
|
-
pageQuery?: Record<string, any>;
|
|
632
|
-
}): Promise<void>;
|
|
633
|
-
|
|
634
625
|
export declare function renderToString(loader: PlasmicComponentLoader, lookup: ComponentLookupSpec, opts?: {
|
|
635
626
|
prefetchedData?: ComponentRenderData;
|
|
636
627
|
componentProps?: any;
|
package/dist/index.esm.js
CHANGED
|
@@ -1422,14 +1422,6 @@ import { extractPlasmicQueryData as extractPlasmicQueryData2 } from "@plasmicapp
|
|
|
1422
1422
|
import React6 from "react";
|
|
1423
1423
|
import ReactDOM2 from "react-dom";
|
|
1424
1424
|
import { renderToString as reactRenderToString } from "react-dom/server";
|
|
1425
|
-
function renderToElement(_0, _1, _2) {
|
|
1426
|
-
return __async(this, arguments, function* (loader, target, lookup, opts = {}) {
|
|
1427
|
-
return new Promise((resolve) => {
|
|
1428
|
-
const element = makeElement(loader, lookup, opts);
|
|
1429
|
-
ReactDOM2.render(element, target, () => resolve());
|
|
1430
|
-
});
|
|
1431
|
-
});
|
|
1432
|
-
}
|
|
1433
1425
|
function renderToString(loader, lookup, opts = {}) {
|
|
1434
1426
|
const element = makeElement(loader, lookup, opts);
|
|
1435
1427
|
return reactRenderToString(element);
|
|
@@ -1495,7 +1487,6 @@ export {
|
|
|
1495
1487
|
initPlasmicLoader,
|
|
1496
1488
|
matchesPagePath,
|
|
1497
1489
|
plasmicPrepass,
|
|
1498
|
-
renderToElement,
|
|
1499
1490
|
renderToString,
|
|
1500
1491
|
repeatedElement,
|
|
1501
1492
|
useDataEnv,
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/loader-client.ts", "../src/PlasmicRootProvider.tsx", "../src/utils.tsx", "../src/variation.ts", "../src/global-variants.ts", "../src/loader-shared.ts", "../src/bundles.ts", "../src/component-lookup.ts", "../src/index.ts", "../src/PlasmicComponent.tsx", "../src/usePlasmicComponent.tsx", "../src/prepass-client.ts", "../src/render.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as PlasmicDataSourcesContext from \"@plasmicapp/data-sources-context\";\n// eslint-disable-next-line no-restricted-imports\nimport * as PlasmicHost from \"@plasmicapp/host\";\nimport {\n // eslint-disable-next-line no-restricted-imports\n registerComponent,\n registerFunction,\n registerGlobalContext,\n registerToken,\n registerTrait,\n stateHelpersKeys,\n TokenRegistration,\n TraitMeta,\n} from \"@plasmicapp/host\";\nimport { PlasmicModulesFetcher, PlasmicTracker } from \"@plasmicapp/loader-core\";\nimport * as PlasmicQuery from \"@plasmicapp/query\";\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport * as jsxDevRuntime from \"react/jsx-dev-runtime\";\nimport * as jsxRuntime from \"react/jsx-runtime\";\nimport { createUseGlobalVariant } from \"./global-variants\";\nimport {\n BaseInternalPlasmicComponentLoader,\n CodeComponentMeta,\n CustomFunctionMeta,\n GlobalContextMeta,\n InitOptions,\n internalSetRegisteredFunction,\n PlasmicRootWatcher,\n REGISTERED_CODE_COMPONENT_HELPERS,\n REGISTERED_CUSTOM_FUNCTIONS,\n SUBSTITUTED_COMPONENTS,\n SUBSTITUTED_GLOBAL_VARIANT_HOOKS,\n} from \"./loader-shared\";\n\nexport class InternalPlasmicComponentLoader extends BaseInternalPlasmicComponentLoader {\n private readonly roots: PlasmicRootWatcher[] = [];\n\n constructor(opts: InitOptions) {\n const tracker = new PlasmicTracker({\n ...opts,\n projectIds: opts.projects.map((p) => p.id),\n });\n super({\n opts,\n tracker,\n fetcher: new PlasmicModulesFetcher(opts),\n onBundleMerged: () => {\n this.refreshRegistry();\n },\n onBundleFetched: () => {\n this.roots.forEach((watcher) => watcher.onDataFetched?.());\n },\n builtinModules: {\n react: React,\n \"react-dom\": ReactDOM,\n \"react/jsx-runtime\": jsxRuntime,\n \"react/jsx-dev-runtime\": jsxDevRuntime,\n\n // Also inject @plasmicapp/query and @plasmicapp/host to use the\n // same contexts here and in loader-downloaded code.\n \"@plasmicapp/query\": PlasmicQuery,\n \"@plasmicapp/data-sources-context\": PlasmicDataSourcesContext,\n \"@plasmicapp/host\": PlasmicHost,\n \"@plasmicapp/host/registerFunction\": internalSetRegisteredFunction,\n \"@plasmicapp/loader-runtime-registry\": {\n components: SUBSTITUTED_COMPONENTS,\n globalVariantHooks: SUBSTITUTED_GLOBAL_VARIANT_HOOKS,\n codeComponentHelpers: REGISTERED_CODE_COMPONENT_HELPERS,\n functions: REGISTERED_CUSTOM_FUNCTIONS,\n },\n },\n });\n }\n\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n ) {\n // making the component meta consistent between codegen and loader\n const stateHelpers = Object.fromEntries(\n Object.entries(meta.states ?? {})\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, stateSpec]) =>\n Object.keys(stateSpec).some((key) => stateHelpersKeys.includes(key))\n )\n .map(([stateName, stateSpec]) => [\n stateName,\n Object.fromEntries(\n stateHelpersKeys\n .filter((key) => key in stateSpec)\n .map((key) => [key, stateSpec[key]])\n ),\n ])\n );\n const helpers = { states: stateHelpers };\n this.internalSubstituteComponent(\n component,\n { name: meta.name, isCode: true },\n Object.keys(stateHelpers).length > 0 ? helpers : undefined\n );\n registerComponent(component, {\n ...meta,\n // Import path is not used as we will use component substitution\n importPath: meta.importPath ?? \"\",\n ...(Object.keys(stateHelpers).length > 0\n ? {\n componentHelpers: {\n helpers,\n importPath: \"\",\n importName: \"\",\n },\n }\n : {}),\n });\n }\n\n registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n ) {\n registerFunction(fn, {\n ...meta,\n importPath: meta.importPath ?? \"\",\n });\n internalSetRegisteredFunction(fn, meta);\n }\n\n registerGlobalContext<T extends React.ComponentType<any>>(\n context: T,\n meta: GlobalContextMeta<React.ComponentProps<T>>\n ) {\n this.substituteComponent(context, { name: meta.name, isCode: true });\n // Import path is not used as we will use component substitution\n registerGlobalContext(context, {\n ...meta,\n importPath: meta.importPath ?? \"\",\n });\n }\n\n registerTrait(trait: string, meta: TraitMeta) {\n registerTrait(trait, meta);\n }\n\n registerToken(token: TokenRegistration) {\n registerToken(token);\n }\n\n subscribePlasmicRoot(watcher: PlasmicRootWatcher) {\n this.roots.push(watcher);\n }\n\n unsubscribePlasmicRoot(watcher: PlasmicRootWatcher) {\n const index = this.roots.indexOf(watcher);\n if (index >= 0) {\n this.roots.splice(index, 1);\n }\n }\n\n refreshRegistry() {\n // We swap global variants' useXXXGlobalVariant() hook with\n // a fake one that just reads from the PlasmicRootContext. Because\n // global variant values are not supplied by the generated global variant\n // context providers, but instead by <PlasmicRootProvider/> and by\n // PlasmicComponentLoader.setGlobalVariants(), we redirect these\n // hooks to read from them instead.\n for (const globalGroup of this.getBundle().globalGroups) {\n if (globalGroup.type !== \"global-screen\") {\n SUBSTITUTED_GLOBAL_VARIANT_HOOKS[globalGroup.id] =\n createUseGlobalVariant(globalGroup.name, globalGroup.projectId);\n }\n }\n super.refreshRegistry();\n }\n}\n", "import { PlasmicDataSourceContextValue } from \"@plasmicapp/data-sources-context\";\nimport { PageParamsProvider } from \"@plasmicapp/host\";\nimport { AssetModule, ComponentMeta, Split } from \"@plasmicapp/loader-core\";\nimport { PlasmicQueryDataProvider } from \"@plasmicapp/query\";\nimport * as React from \"react\";\nimport { InternalPlasmicComponentLoader } from \"./loader-client\";\nimport { ComponentRenderData, PlasmicComponentLoader } from \"./loader-shared\";\nimport { MaybeWrap, useForceUpdate } from \"./utils\";\nimport {\n getGlobalVariantsFromSplits,\n mergeGlobalVariantsSpec,\n} from \"./variation\";\n\nexport interface PlasmicRootContextValue extends PlasmicDataSourceContextValue {\n globalVariants?: GlobalVariantSpec[];\n globalContextsProps?: Record<string, any>;\n loader: InternalPlasmicComponentLoader;\n variation?: Record<string, string>;\n translator?: PlasmicTranslator;\n Head?: React.ComponentType<any>;\n Link?: React.ComponentType<any>;\n disableLoadingBoundary?: boolean;\n suspenseFallback?: React.ReactNode;\n}\n\nconst PlasmicRootContext = React.createContext<\n PlasmicRootContextValue | undefined\n>(undefined);\n\nexport interface GlobalVariantSpec {\n name: string;\n projectId?: string;\n value: any;\n}\n\nexport type PlasmicTranslator = (\n str: string,\n opts?: {\n components?: {\n [key: string]: React.ReactElement | React.ReactFragment;\n };\n }\n) => React.ReactNode;\n\n/**\n * PlasmicRootProvider should be used at the root of your page\n * or application.\n */\nexport function PlasmicRootProvider(\n props: {\n /**\n * The global PlasmicComponentLoader instance you created via\n * initPlasmicLoader().\n */\n loader: PlasmicComponentLoader;\n\n /**\n * Global variants to activate for Plasmic components\n */\n globalVariants?: GlobalVariantSpec[];\n\n children?: React.ReactNode;\n\n /**\n * If true, will skip rendering css\n */\n skipCss?: boolean;\n\n /**\n * If true, will skip installing fonts\n */\n skipFonts?: boolean;\n\n /**\n * If you have pre-fetched component data via PlasmicComponentLoader,\n * you can pass them in here; PlasmicComponent will avoid fetching\n * component data that have already been pre-fetched.\n */\n prefetchedData?: ComponentRenderData;\n\n /**\n * If you have pre-fetched data that are needed by usePlasmicQueryData(),\n * then pass in the pre-fetched cache here, mapping query key to fetched data.\n */\n prefetchedQueryData?: Record<string, any>;\n\n /**\n * Specifies whether usePlasmicQueryData() should be operating in suspense mode\n * (throwing promises).\n */\n suspenseForQueryData?: boolean;\n\n /**\n * Override your Global Contexts Provider props. This is a map from\n * globalContextComponentNameProps to object of props to use for that\n * component.\n */\n globalContextsProps?: Record<string, any>;\n\n /**\n * Specifies a mapping of split id to slice id that should be activated\n */\n variation?: Record<string, string>;\n\n /**\n * Translator function to be used for text blocks\n */\n translator?: PlasmicTranslator;\n\n /**\n * Head component to use in PlasmicHead component (e.g. Head from next/head\n * or Helmet from react-helmet).\n */\n Head?: React.ComponentType<any>;\n\n /**\n * Link component to use. Can be any component that takes in props passed\n * to an <a/> tag.\n */\n Link?: React.ComponentType<any>;\n\n /**\n * Page route without params substitution (e.g. /products/[slug]).\n */\n pageRoute?: string;\n\n /**\n * Page path parameters (e.g. {slug: \"foo\"} if page path is\n * /products/[slug] and URI is /products/foo).\n */\n pageParams?: Record<string, string | string[] | undefined>;\n\n /**\n * Page query parameters (e.g. {q: \"foo\"} if page path is\n * /some/path?q=foo).\n */\n pageQuery?: Record<string, string | string[] | undefined>;\n /**\n * Whether the internal Plasmic React.Suspense boundaries should be removed\n */\n disableLoadingBoundary?: boolean;\n /**\n * Whether the root React.Suspense boundary should be removed\n */\n disableRootLoadingBoundary?: boolean;\n /**\n * Fallback value for React.Suspense boundary\n */\n suspenseFallback?: React.ReactNode;\n } & PlasmicDataSourceContextValue\n) {\n const {\n globalVariants,\n prefetchedData,\n children,\n skipCss,\n skipFonts,\n prefetchedQueryData,\n suspenseForQueryData,\n globalContextsProps,\n variation,\n translator,\n Head,\n Link,\n pageRoute,\n pageParams,\n pageQuery,\n suspenseFallback,\n disableLoadingBoundary,\n disableRootLoadingBoundary,\n } = props;\n const loader = (props.loader as any)\n .__internal as InternalPlasmicComponentLoader;\n\n if (prefetchedData) {\n loader.registerPrefetchedBundle(prefetchedData.bundle);\n }\n\n const [splits, setSplits] = React.useState<Split[]>(loader.getActiveSplits());\n const forceUpdate = useForceUpdate();\n const watcher = React.useMemo(\n () => ({\n onDataFetched: () => {\n setSplits(loader.getActiveSplits());\n forceUpdate();\n },\n }),\n [loader, forceUpdate]\n );\n\n React.useEffect(() => {\n loader.subscribePlasmicRoot(watcher);\n return () => loader.unsubscribePlasmicRoot(watcher);\n }, [watcher, loader]);\n\n const currentContextValue = React.useContext(PlasmicRootContext);\n\n const { user, userAuthToken, isUserLoading, authRedirectUri } = props;\n\n const value = React.useMemo<PlasmicRootContextValue>(() => {\n // Fallback to the value in `currentContextValue` if none is provided\n const withCurrentContextValueFallback = <\n K extends keyof PlasmicRootContextValue\n >(\n v: PlasmicRootContextValue[K],\n key: K\n ): PlasmicRootContextValue[K] => {\n return (v !== undefined ? v : currentContextValue?.[key])!;\n };\n return {\n globalVariants: [\n ...mergeGlobalVariantsSpec(\n globalVariants ?? [],\n getGlobalVariantsFromSplits(splits, variation ?? {})\n ),\n ...(currentContextValue?.globalVariants ?? []),\n ],\n globalContextsProps: {\n ...(currentContextValue?.globalContextsProps ?? {}),\n ...(globalContextsProps ?? {}),\n },\n loader: withCurrentContextValueFallback(loader, \"loader\"),\n variation: {\n ...(currentContextValue?.variation ?? {}),\n ...(variation ?? {}),\n },\n translator: withCurrentContextValueFallback(translator, \"translator\"),\n Head: withCurrentContextValueFallback(Head, \"Head\"),\n Link: withCurrentContextValueFallback(Link, \"Link\"),\n user: withCurrentContextValueFallback(user, \"user\"),\n userAuthToken: withCurrentContextValueFallback(\n userAuthToken,\n \"userAuthToken\"\n ),\n isUserLoading: withCurrentContextValueFallback(\n isUserLoading,\n \"isUserLoading\"\n ),\n authRedirectUri: withCurrentContextValueFallback(\n authRedirectUri,\n \"authRedirectUri\"\n ),\n suspenseFallback: withCurrentContextValueFallback(\n suspenseFallback,\n \"suspenseFallback\"\n ),\n disableLoadingBoundary: withCurrentContextValueFallback(\n disableLoadingBoundary,\n \"disableLoadingBoundary\"\n ),\n };\n }, [\n globalVariants,\n variation,\n globalContextsProps,\n loader,\n splits,\n translator,\n Head,\n Link,\n user,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n suspenseFallback,\n disableLoadingBoundary,\n currentContextValue,\n ]);\n\n React.useEffect(() => {\n loader.trackRender({\n renderCtx: {\n // We track the provider as a single entity\n rootComponentId: \"provider\",\n teamIds: loader.getTeamIds(),\n projectIds: loader.getProjectIds(),\n },\n variation: value.variation,\n });\n }, [loader, value]);\n\n const reactMajorVersion = +React.version.split(\".\")[0];\n\n const shouldDisableRootLoadingBoundary =\n disableRootLoadingBoundary ??\n loader.getBundle().disableRootLoadingBoundaryByDefault;\n\n return (\n <PlasmicQueryDataProvider\n prefetchedCache={prefetchedQueryData}\n suspense={suspenseForQueryData}\n >\n <PlasmicRootContext.Provider value={value}>\n {!skipCss && (\n <PlasmicCss\n loader={loader}\n prefetchedData={prefetchedData}\n skipFonts={skipFonts}\n />\n )}\n <PageParamsProvider\n route={pageRoute}\n params={pageParams}\n query={pageQuery}\n >\n <MaybeWrap\n cond={!shouldDisableRootLoadingBoundary && reactMajorVersion >= 18}\n wrapper={(contents) => (\n <React.Suspense fallback={suspenseFallback ?? \"Loading...\"}>\n {contents}\n </React.Suspense>\n )}\n >\n {children}\n </MaybeWrap>\n </PageParamsProvider>\n </PlasmicRootContext.Provider>\n </PlasmicQueryDataProvider>\n );\n}\n\n/**\n * Inject all css modules as <style/> tags. We can't use the usual styleInjector postcss\n * uses because that doesn't work on the server side for SSR.\n */\nconst PlasmicCss = React.memo(function PlasmicCss(props: {\n loader: InternalPlasmicComponentLoader;\n prefetchedData?: ComponentRenderData;\n skipFonts?: boolean;\n}) {\n const { loader, prefetchedData, skipFonts } = props;\n const [useScopedCss, setUseScopedCss] = React.useState(!!prefetchedData);\n const builtCss = buildCss(loader, {\n scopedCompMetas:\n useScopedCss && prefetchedData\n ? prefetchedData.bundle.components\n : undefined,\n skipFonts,\n });\n const forceUpdate = useForceUpdate();\n const watcher = React.useMemo(\n () => ({\n onDataFetched: () => {\n // If new data has been fetched, then use all the fetched css\n setUseScopedCss(false);\n forceUpdate();\n },\n }),\n [loader, forceUpdate]\n );\n\n React.useEffect(() => {\n loader.subscribePlasmicRoot(watcher);\n return () => loader.unsubscribePlasmicRoot(watcher);\n }, [watcher, loader]);\n\n return <style dangerouslySetInnerHTML={{ __html: builtCss }} />;\n});\n\nfunction buildCss(\n loader: InternalPlasmicComponentLoader,\n opts: {\n scopedCompMetas?: ComponentMeta[];\n skipFonts?: boolean;\n }\n) {\n const { scopedCompMetas, skipFonts } = opts;\n const cssFiles =\n scopedCompMetas &&\n new Set<string>([\n \"entrypoint.css\",\n ...scopedCompMetas.map((c) => c.cssFile),\n ]);\n const cssModules = loader\n .getLookup()\n .getCss()\n .filter((f) => !cssFiles || cssFiles.has(f.fileName));\n\n const getPri = (fileName: string) => (fileName === \"entrypoint.css\" ? 0 : 1);\n const compareModules = (a: AssetModule, b: AssetModule) =>\n getPri(a.fileName) !== getPri(b.fileName)\n ? getPri(a.fileName) - getPri(b.fileName)\n : a.fileName.localeCompare(b.fileName);\n cssModules.sort(compareModules);\n\n const remoteFonts = loader.getLookup().getRemoteFonts();\n\n // Make sure the @import statements come at the front of css\n return `\n ${\n skipFonts\n ? \"\"\n : remoteFonts.map((f) => `@import url('${f.url}');`).join(\"\\n\")\n }\n ${cssModules.map((mod) => mod.source).join(\"\\n\")}\n `;\n}\n\nexport function usePlasmicRootContext() {\n return React.useContext(PlasmicRootContext);\n}\n", "import { ComponentMeta } from \"@plasmicapp/loader-core\";\nimport pascalcase from \"pascalcase\";\nimport * as React from \"react\";\n\nexport const isBrowser = typeof window !== \"undefined\";\n\nexport type ComponentLookupSpec =\n | string\n | { name: string; projectId?: string; isCode?: boolean };\n\ninterface FullNameLookupSpec {\n name: string;\n rawName?: string;\n projectId?: string;\n isCode?: boolean;\n}\n\ninterface FullPathLookupSpec {\n path: string;\n projectId?: string;\n}\n\ntype FullLookupSpec = FullNameLookupSpec | FullPathLookupSpec;\n\nexport function useForceUpdate() {\n const [, setTick] = React.useState(0);\n const update = React.useCallback(() => {\n setTick((tick) => tick + 1);\n }, []);\n return update;\n}\n\nexport function useStableLookupSpec(spec: ComponentLookupSpec) {\n return useStableLookupSpecs(spec)[0];\n}\n\nexport function useStableLookupSpecs(...specs: ComponentLookupSpec[]) {\n const [stableSpecs, setStableSpecs] = React.useState(specs);\n\n React.useEffect(() => {\n if (\n specs.length !== stableSpecs.length ||\n specs.some((s, i) => !areLookupSpecsEqual(s, stableSpecs[i]))\n ) {\n setStableSpecs(specs);\n }\n }, [specs, stableSpecs]);\n return stableSpecs;\n}\n\nfunction areLookupSpecsEqual(\n spec1: ComponentLookupSpec,\n spec2: ComponentLookupSpec\n) {\n if (spec1 === spec2) {\n return true;\n }\n if (typeof spec1 !== typeof spec2) {\n return false;\n }\n\n const fullSpec1 = toFullLookup(spec1);\n const fullSpec2 = toFullLookup(spec2);\n return (\n ((isNameSpec(fullSpec1) &&\n isNameSpec(fullSpec2) &&\n fullSpec1.name === fullSpec2.name &&\n fullSpec1.isCode === fullSpec2.isCode) ||\n (isPathSpec(fullSpec1) &&\n isPathSpec(fullSpec2) &&\n fullSpec1.path === fullSpec2.path)) &&\n fullSpec1.projectId === fullSpec2.projectId\n );\n}\n\nfunction isNameSpec(lookup: FullLookupSpec): lookup is FullNameLookupSpec {\n return \"name\" in lookup;\n}\n\nfunction isPathSpec(lookup: FullLookupSpec): lookup is FullPathLookupSpec {\n return \"path\" in lookup;\n}\n\nfunction toFullLookup(lookup: ComponentLookupSpec): FullLookupSpec {\n const namePart = typeof lookup === \"string\" ? lookup : lookup.name;\n const projectId = typeof lookup === \"string\" ? undefined : lookup.projectId;\n const codeComponent = typeof lookup === \"string\" ? undefined : lookup.isCode;\n\n if (codeComponent !== true && namePart.startsWith(\"/\")) {\n return { path: normalizePath(namePart), projectId };\n } else {\n return {\n name: codeComponent ? namePart : normalizeName(namePart),\n rawName: namePart.trim(),\n projectId,\n isCode: codeComponent,\n };\n }\n}\n\nfunction normalizePath(path: string) {\n return path.trim();\n}\n\nfunction normalizeName(name: string) {\n // Not a full normalization, but should be good enough\n return pascalcase(name).trim();\n}\n\nexport function useIsMounted(): () => boolean {\n const ref = React.useRef<boolean>(false);\n const isMounted = React.useCallback(() => ref.current, []);\n\n React.useEffect(() => {\n ref.current = true;\n return () => {\n ref.current = false;\n };\n }, []);\n\n return isMounted;\n}\n\n/**\n * Check if `lookup` resolves to `pagePath`. If it's a match, return an object\n * containing path params; otherwise, return false.\n *\n * For example,\n * - `matchesPagePath(\"/hello/[name]\", \"/hello/world\")` -> `{params: {name:\n * \"world\"}}`\n * - `matchesPagePath(\"/hello/[name]\", \"/\")` -> `false`\n * - `matchesPagePath(\"/hello/[...catchall]\", \"/hello/a/b/c\")` -> `{params: {catchall: [\"a\", \"b\", \"c\"]}}`\n * - `matchesPagePath(\"/hello/[[...catchall]]\", \"/hello/\")` -> `{params: {catchall: []}}`\n * - `matchesPagePath(\"/\", \"\")` -> `{params: {}}`\n */\nexport function matchesPagePath(pattern: string, path: string) {\n // (generated by ChatGPT 4 from the test cases)\n\n // Normalize the path and pattern by ensuring they both start and end without slashes\n const normalizedPattern = \"/\" + pattern.replace(/^\\/|\\/$/g, \"\");\n const normalizedPath = \"/\" + path.replace(/^\\/|\\/$/g, \"\");\n\n // Modify the regex to match optional leading slashes\n const regexString = normalizedPattern\n .replace(/\\/\\[\\[\\.\\.\\.([^\\]^]+)]]/g, \"(?:/([^]*))?\") // Optional catch-all\n .replace(/\\/\\[\\.\\.\\.([^\\]^]+)]/g, \"/([^]*)\") // Catch-all\n .replace(/\\[([^\\]^]+)]/g, \"([^/]+)\") // Normal slug\n .replace(/\\//g, \"\\\\/\"); // Escape forward slashes\n\n const regex = new RegExp(`^/?${regexString}$`); // Allow optional leading slash\n const match = normalizedPath.match(regex);\n\n if (!match) return false;\n\n // Extract slug names from pattern\n const slugNames = [...pattern.matchAll(/\\[\\.?\\.?\\.?([^[\\]]+)]/g)].map(\n (m) => m[1]\n );\n\n // Construct params object\n const params: Record<string, string | string[]> = {};\n for (let i = 0; i < slugNames.length; i++) {\n const slugName = slugNames[i];\n const value = match[i + 1];\n\n if (pattern.includes(`[[...${slugName}]]`)) {\n // Handle optional catchall slugs\n params[slugName] = value ? value.split(\"/\").filter(Boolean) : [];\n } else if (pattern.includes(`[...${slugName}]`)) {\n // Handle mandatory catchall slugs\n params[slugName] = value.split(\"/\").filter(Boolean);\n } else if (value !== undefined) {\n // Handle normal slugs\n params[slugName] = value;\n }\n }\n\n return { params };\n}\n\nexport function isDynamicPagePath(path: string): boolean {\n return !!path.match(/\\[[^/]*\\]/);\n}\n\nfunction matchesCompMeta(lookup: FullLookupSpec, meta: ComponentMeta) {\n if (lookup.projectId && meta.projectId !== lookup.projectId) {\n return false;\n }\n\n return isNameSpec(lookup)\n ? (lookup.name === meta.name ||\n lookup.rawName === meta.name ||\n lookup.rawName === meta.displayName) &&\n (lookup.isCode == null || lookup.isCode === meta.isCode)\n : !!(meta.path && matchesPagePath(meta.path, lookup.path));\n}\n\nexport function getCompMetas(\n metas: ComponentMeta[],\n lookup: ComponentLookupSpec\n) {\n const full = toFullLookup(lookup);\n return metas\n .filter((meta) => matchesCompMeta(full, meta))\n .map<ComponentMeta & { params?: Record<string, string | string[]> }>(\n (meta) => {\n if (isNameSpec(full) || !meta.path) {\n return meta;\n }\n\n const match = matchesPagePath(meta.path, full.path);\n if (!match) {\n return meta;\n }\n\n return { ...meta, params: match.params };\n }\n )\n .sort(\n (meta1, meta2) =>\n // We sort the matched component metas by the number of path params, so\n // if there are two pages `/products/foo` and `/products/[slug]`,\n // the first one will have higher precedence.\n Array.from(Object.keys(meta1.params || {})).length -\n Array.from(Object.keys(meta2.params || {})).length\n );\n}\n\nexport function getLookupSpecName(lookup: ComponentLookupSpec) {\n if (typeof lookup === \"string\") {\n return lookup;\n } else if (lookup.projectId) {\n return `${lookup.name} (project ${lookup.projectId})`;\n } else {\n return lookup.name;\n }\n}\n\nexport function MaybeWrap(props: {\n children: React.ReactNode;\n cond: boolean;\n wrapper: (children: React.ReactNode) => React.ReactElement;\n}) {\n return (\n props.cond ? props.wrapper(props.children) : props.children\n ) as React.ReactElement;\n}\n\nexport function uniq<T>(elements: T[]): T[] {\n return Array.from(new Set(elements));\n}\n\nexport function uniqBy<T, K>(elements: T[], iterator: (elt: T) => K): T[] {\n const vis = new Set<K>();\n const filtered: T[] = [];\n for (const elt of elements) {\n const key = iterator(elt);\n if (!vis.has(key)) {\n vis.add(key);\n filtered.push(elt);\n }\n }\n return filtered;\n}\n\nexport function intersect<T>(a: T[], b: T[]): T[] {\n const setB = new Set(b);\n return a.filter((elt) => setB.has(elt));\n}\n", "import type {\n ExperimentSlice,\n SegmentSlice,\n Split,\n} from \"@plasmicapp/loader-core\";\nimport type { GlobalVariantSpec } from \"./PlasmicRootProvider\";\n\nexport function getPlasmicCookieValues() {\n return Object.fromEntries(\n document.cookie\n .split(\"; \")\n .filter((cookie) => cookie.includes(\"plasmic:\"))\n .map((cookie) => cookie.split(\"=\"))\n .map(([key, value]) => [key.split(\":\")[1], value])\n );\n}\n\nexport function updatePlasmicCookieValue(key: string, value: string) {\n document.cookie = `plasmic:${key}=${value}`;\n}\n\nexport const getGlobalVariantsFromSplits = (\n splits: Split[],\n variation: Record<string, string>\n) => {\n const globalVariants: GlobalVariantSpec[] = [];\n\n Object.keys(variation).map((variationKey: string) => {\n const [_type, splitId] = variationKey.split(\".\");\n const sliceId = variation[variationKey];\n const split = splits.find(\n (s) => s.id === splitId || s.externalId === splitId\n );\n if (split) {\n const slice: ExperimentSlice | SegmentSlice | undefined = (\n split.slices as Array<ExperimentSlice | SegmentSlice>\n ).find((s: any) => s.id === sliceId || s.externalId === sliceId);\n if (slice) {\n slice.contents.map((x) => {\n globalVariants.push({\n name: x.group,\n value: x.variant,\n projectId: x.projectId,\n });\n });\n }\n }\n });\n\n return globalVariants;\n};\n\nexport const mergeGlobalVariantsSpec = (\n target: GlobalVariantSpec[],\n from: GlobalVariantSpec[]\n) => {\n let result = [...target];\n const existingGlobalVariants = new Set(\n target.map((t) => `${t.name}-${t.projectId ?? \"\"}`)\n );\n const newGlobals = from.filter(\n (t) => !existingGlobalVariants.has(`${t.name}-${t.projectId ?? \"\"}`)\n );\n\n if (newGlobals.length > 0) {\n result = [...result, ...newGlobals];\n }\n\n return result;\n};\n", "/**\n * We don't actually make use of the global variant React contexts generated\n * in the bundle. That's because we would have to wait until the data is\n * loaded before we can set up the context providers, but setting up context\n * providers will mutate the React tree and invalidate all the children. That means\n * once data comes in, we'll re-render the React tree from the providers down\n * in a way that will lose all existing React state. Therefore, instead,\n * we always have a single context provided -- the PlasmicRootContext -- and we\n * create these fake useGlobalVariant() hooks that just read from that\n * PlasmicRootContext. This allows us to have a stable React tree before and\n * after the data load.\n */\n\nimport { InternalPlasmicComponentLoader } from \"./loader-client\";\nimport { usePlasmicRootContext } from \"./PlasmicRootProvider\";\n\nexport function createUseGlobalVariant(name: string, projectId: string) {\n return () => {\n const rootContext = usePlasmicRootContext();\n if (!rootContext) {\n return undefined;\n }\n\n const loader = rootContext.loader as InternalPlasmicComponentLoader;\n const spec = [\n ...loader.getGlobalVariants(),\n ...(rootContext.globalVariants ?? []),\n ].find(\n (spec2) =>\n spec2.name === name &&\n (!spec2.projectId || spec2.projectId === projectId)\n );\n return spec ? spec.value : undefined;\n };\n}\n", "import type {\n ComponentHelpers,\n ComponentHelpers as InternalCodeComponentHelpers,\n CodeComponentMeta as InternalCodeComponentMeta,\n CustomFunctionMeta as InternalCustomFunctionMeta,\n GlobalContextMeta as InternalGlobalContextMeta,\n StateHelpers,\n StateSpec,\n TokenRegistration,\n TraitMeta,\n useDataEnv,\n useSelector,\n useSelectors,\n} from \"@plasmicapp/host\";\nimport {\n LoaderBundleCache,\n PageMeta,\n PlasmicModulesFetcher,\n PlasmicTracker,\n Registry,\n TrackRenderOptions,\n} from \"@plasmicapp/loader-core\";\nimport {\n CodeModule,\n ComponentMeta,\n LoaderBundleOutput,\n internal_getCachedBundleInNodeServer,\n} from \"@plasmicapp/loader-fetcher\";\nimport { getActiveVariation, getExternalIds } from \"@plasmicapp/loader-splits\";\nimport type { useMutablePlasmicQueryData } from \"@plasmicapp/query\";\nimport type { GlobalVariantSpec } from \"./PlasmicRootProvider\";\nimport { mergeBundles, prepComponentData } from \"./bundles\";\nimport { ComponentLookup } from \"./component-lookup\";\nimport {\n ComponentLookupSpec,\n getCompMetas,\n getLookupSpecName,\n isBrowser,\n isDynamicPagePath,\n uniq,\n} from \"./utils\";\nimport { getPlasmicCookieValues, updatePlasmicCookieValue } from \"./variation\";\n\nexport interface InitOptions {\n projects: {\n id: string;\n token: string;\n version?: string;\n }[];\n cache?: LoaderBundleCache;\n platform?: \"react\" | \"nextjs\" | \"gatsby\";\n platformOptions?: {\n nextjs?: {\n appDir: boolean;\n };\n };\n preview?: boolean;\n host?: string;\n onClientSideFetch?: \"warn\" | \"error\";\n i18n?: {\n keyScheme: \"content\" | \"hash\" | \"path\";\n tagPrefix?: string;\n };\n /**\n * @deprecated use i18n.keyScheme instead\n */\n i18nKeyScheme?: \"content\" | \"hash\";\n\n /**\n * By default, fetchComponentData() and fetchPages() calls cached in memory\n * with the PlasmicComponentLoader instance. If alwaysFresh is true, then\n * data is always freshly fetched over the network.\n */\n alwaysFresh?: boolean;\n\n /**\n * If true, generated code from the server won't include page metadata tags\n */\n skipHead?: boolean;\n\n /**\n * If true, uses browser / node's native fetch\n */\n nativeFetch?: boolean;\n\n /**\n * If true, will not redirect to the codegen server automatically, and will\n * try to reuse the existing bundle in the cache.\n */\n manualRedirect?: boolean;\n}\n\nexport interface ComponentRenderData {\n entryCompMetas: (ComponentMeta & { params?: Record<string, string> })[];\n bundle: LoaderBundleOutput;\n remoteFontUrls: string[];\n}\n\nexport interface ComponentSubstitutionSpec {\n lookup: ComponentLookupSpec;\n component: React.ComponentType<any>;\n codeComponentHelpers?: InternalCodeComponentHelpers<\n React.ComponentProps<any>\n >;\n}\n\nexport interface PlasmicRootWatcher {\n onDataFetched?: () => void;\n}\n\n/**\n * Helper functions to describe code component behaviors, in order to allow\n * data extraction in RSC / Next.js App routing.\n */\nexport interface ReactServerOps {\n readDataEnv: typeof useDataEnv;\n readDataSelector: typeof useSelector;\n readDataSelectors: typeof useSelectors;\n /**\n * The contexts are passed using a key instead of the context provider\n * Notice it cannot access the default context value if none has been provided,\n * since React server components cannot create contexts.\n */\n readContext: (contextKey: string) => any;\n /**\n * Allows data fetching from the code component and caching the result,\n * which will be stored in the `queryCache` returned by\n * `extractPlasmicQueryData`.\n */\n fetchData: typeof useMutablePlasmicQueryData;\n}\n\n/**\n * Represents data provided by a code component via `DataProvider`\n */\nexport interface ServerProvidedData {\n name: string;\n data: any;\n}\n\n/**\n * Provides a new value for a given context key, similar to Context.Provider.\n * The context itself is not available (RSC doesn't allow calling\n * `createContext`) so each context will need to be represented as a unique\n * \"context key\". Also it means the default context value is not available\n * in case no value is passed (and reading that context will return `undefined`)\n */\nexport interface ServerProvidedContext {\n /**\n * Identifier to the context, required to read it later via\n * `ReactServerOps.readContext()`.\n */\n contextKey: string;\n /**\n * Context value being provided (similar to `Context.Provider`).\n */\n value: any;\n}\n\n/**\n * Each child of a code component might receive separate `DataProvider` and\n * Context values.\n */\nexport interface ServerChildData {\n providedData?: ServerProvidedData | ServerProvidedData[];\n providedContexts?: ServerProvidedContext | ServerProvidedContext[];\n node: React.ReactNode;\n}\n\nexport interface ServerInfo {\n /**\n * Optional: Indicates the React Nodes created by the component and the\n * respective contexts provided to them. If not specified, it will render the\n * children passed to the component as props.\n */\n children?: ServerChildData | ServerChildData[];\n providedData?: ServerProvidedData | ServerProvidedData[];\n providedContexts?: ServerProvidedContext | ServerProvidedContext[];\n}\n\nexport type CodeComponentMeta<P> = Omit<\n InternalCodeComponentMeta<P>,\n \"importPath\" | \"componentHelpers\" | \"states\"\n> & {\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n * Optional: not used by Plasmic headless API, only by codegen.\n */\n importPath?: string;\n /**\n * The states helpers are registered together with the states for the Plasmic headless API\n */\n states?: Record<string, StateSpec<P> & StateHelpers<P, any>>;\n\n /**\n * Helper function to enable data extraction when running Plasmic from\n * Next.js App Router.\n */\n getServerInfo?: (props: P, ops: ReactServerOps) => ServerInfo;\n};\n\nexport type GlobalContextMeta<P> = Omit<\n InternalGlobalContextMeta<P>,\n \"importPath\"\n> & {\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n * Optional: not used by Plasmic headless API, only by codegen.\n */\n importPath?: string;\n};\n\nexport type CustomFunctionMeta<F extends (...args: any[]) => any> = Omit<\n InternalCustomFunctionMeta<F>,\n \"importPath\"\n> & {\n /**\n * The path to be used when importing the function in the generated code.\n * It can be the name of the package that contains the function, or the path\n * to the file in the project (relative to the root directory).\n * Optional: not used by Plasmic headless API, only by codegen.\n */\n importPath?: string;\n};\n\nexport type FetchPagesOpts = {\n /**\n * Whether to include dynamic pages in fetchPages() output. A page is\n * considered dynamic if its path contains some param between brackets,\n * e.g. \"[slug]\".\n */\n includeDynamicPages?: boolean;\n};\n\nexport const SUBSTITUTED_COMPONENTS: Record<\n string,\n React.ComponentType<any>\n> = {};\nexport const REGISTERED_CODE_COMPONENT_HELPERS: Record<\n string,\n InternalCodeComponentHelpers<React.ComponentProps<any>>\n> = {};\nexport const SUBSTITUTED_GLOBAL_VARIANT_HOOKS: Record<string, () => any> = {};\nexport const REGISTERED_CUSTOM_FUNCTIONS: Record<\n string,\n (...args: any[]) => any\n> = {};\n\nexport function customFunctionImportAlias<F extends (...args: any[]) => any>(\n meta: CustomFunctionMeta<F>\n) {\n const customFunctionPrefix = `__fn_`;\n return meta.namespace\n ? `${customFunctionPrefix}${meta.namespace}__${meta.name}`\n : `${customFunctionPrefix}${meta.name}`;\n}\n\nexport function internalSetRegisteredFunction<\n F extends (...args: any[]) => any\n>(fn: F, meta: CustomFunctionMeta<F>) {\n REGISTERED_CUSTOM_FUNCTIONS[customFunctionImportAlias(meta)] = fn;\n}\n\ninterface BuiltinRegisteredModules {\n react: typeof import(\"react\");\n \"react-dom\": typeof import(\"react-dom\");\n \"react/jsx-runtime\": typeof import(\"react/jsx-runtime\");\n \"react/jsx-dev-runtime\": typeof import(\"react/jsx-dev-runtime\");\n \"@plasmicapp/query\": typeof import(\"@plasmicapp/query\");\n \"@plasmicapp/data-sources-context\": typeof import(\"@plasmicapp/data-sources-context\");\n \"@plasmicapp/host\": typeof import(\"@plasmicapp/host\");\n \"@plasmicapp/host/registerFunction\": typeof import(\"@plasmicapp/host\").registerFunction;\n \"@plasmicapp/loader-runtime-registry\": {\n components: Record<string, React.ComponentType<any>>;\n globalVariantHooks: Record<string, () => any>;\n codeComponentHelpers: Record<string, ComponentHelpers<any>>;\n functions: Record<string, (...args: any[]) => any>;\n };\n}\n\nexport interface FetchComponentDataOpts {\n /**\n * Will fetch either code targeting SSR or browser hydration in the\n * returned bundle.\n *\n * By default, the target is browser. That's okay, because even when\n * doing SSR, as long as you are using the same instance of PlasmicLoader\n * that was used to fetch component data, it will still know how to get at\n * the server code.\n *\n * But, if you are building your own SSR solution, where fetching and rendering\n * are using different instances of PlasmicLoader, then you'll want to make\n * sure that when you fetch, you are fetching the right one to be used in the\n * right environment for either SSR or browser hydration.\n */\n target?: \"server\" | \"browser\";\n}\n\nfunction parseFetchComponentDataArgs(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n): { specs: ComponentLookupSpec[]; opts?: FetchComponentDataOpts };\nfunction parseFetchComponentDataArgs(...specs: ComponentLookupSpec[]): {\n specs: ComponentLookupSpec[];\n opts?: FetchComponentDataOpts;\n};\nfunction parseFetchComponentDataArgs(...args: any[]) {\n let specs: ComponentLookupSpec[];\n let opts: FetchComponentDataOpts | undefined;\n if (Array.isArray(args[0])) {\n specs = args[0];\n opts = args[1];\n } else {\n specs = args;\n opts = undefined;\n }\n return { specs, opts };\n}\n\n/** Subset of loader functionality that works on Client and React Server Components. */\nexport abstract class BaseInternalPlasmicComponentLoader {\n public readonly opts: InitOptions;\n private readonly registry = new Registry();\n private readonly tracker: PlasmicTracker;\n private readonly fetcher: PlasmicModulesFetcher;\n private readonly onBundleMerged?: () => void;\n private readonly onBundleFetched?: () => void;\n private globalVariants: GlobalVariantSpec[] = [];\n private subs: ComponentSubstitutionSpec[] = [];\n\n private bundle: LoaderBundleOutput = {\n modules: {\n browser: [],\n server: [],\n },\n components: [],\n globalGroups: [],\n projects: [],\n activeSplits: [],\n bundleKey: null,\n deferChunksByDefault: false,\n disableRootLoadingBoundaryByDefault: false,\n filteredIds: {},\n };\n\n constructor(args: {\n opts: InitOptions;\n fetcher: PlasmicModulesFetcher;\n tracker: PlasmicTracker;\n /** Called after `mergeBundle` (including `fetch` calls). */\n onBundleMerged?: () => void;\n /** Called after any `fetch` calls. */\n onBundleFetched?: () => void;\n builtinModules: BuiltinRegisteredModules;\n }) {\n this.opts = args.opts;\n this.fetcher = args.fetcher;\n this.tracker = args.tracker;\n this.onBundleMerged = args.onBundleMerged;\n this.onBundleFetched = args.onBundleFetched;\n this.registerModules(args.builtinModules);\n }\n\n private maybeGetCompMetas(...specs: ComponentLookupSpec[]) {\n const found = new Set<ComponentMeta>();\n const missing: ComponentLookupSpec[] = [];\n for (const spec of specs) {\n const filteredMetas = getCompMetas(this.bundle.components, spec);\n if (filteredMetas.length > 0) {\n filteredMetas.forEach((meta) => found.add(meta));\n } else {\n missing.push(spec);\n }\n }\n return { found: Array.from(found.keys()), missing };\n }\n\n async maybeFetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n ...args: any[]\n ): Promise<ComponentRenderData | null> {\n const { specs, opts } = parseFetchComponentDataArgs(...args);\n const returnWithSpecsToFetch = async (\n specsToFetch: ComponentLookupSpec[]\n ) => {\n await this.fetchMissingData({ missingSpecs: specsToFetch });\n const { found: existingMetas2, missing: missingSpecs2 } =\n this.maybeGetCompMetas(...specs);\n if (missingSpecs2.length > 0) {\n return null;\n }\n\n return prepComponentData(this.bundle, existingMetas2, opts);\n };\n\n if (this.opts.alwaysFresh) {\n // If alwaysFresh, then we treat all specs as missing\n return await returnWithSpecsToFetch(specs);\n }\n\n // Else we only fetch actually missing specs\n const { found: existingMetas, missing: missingSpecs } =\n this.maybeGetCompMetas(...specs);\n if (missingSpecs.length === 0) {\n return prepComponentData(this.bundle, existingMetas, opts);\n }\n\n return await returnWithSpecsToFetch(missingSpecs);\n }\n\n async fetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData>;\n async fetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData>;\n async fetchComponentData(...args: any[]): Promise<ComponentRenderData> {\n const { specs, opts } = parseFetchComponentDataArgs(...args);\n const data = await this.maybeFetchComponentData(specs, opts);\n\n if (!data) {\n const { missing: missingSpecs } = this.maybeGetCompMetas(...specs);\n throw new Error(\n `Unable to find components ${missingSpecs\n .map(getLookupSpecName)\n .join(\", \")}`\n );\n }\n\n return data;\n }\n\n async fetchPages(opts?: FetchPagesOpts) {\n this.maybeReportClientSideFetch(\n () => `Plasmic: fetching all page metadata in the browser`\n );\n const data = await this.fetchAllData();\n return data.components.filter(\n (comp) =>\n comp.isPage &&\n comp.path &&\n (opts?.includeDynamicPages || !isDynamicPagePath(comp.path))\n ) as PageMeta[];\n }\n\n async fetchComponents() {\n this.maybeReportClientSideFetch(\n () => `Plasmic: fetching all component metadata in the browser`\n );\n const data = await this.fetchAllData();\n return data.components;\n }\n\n getActiveSplits() {\n return this.bundle.activeSplits;\n }\n\n getChunksUrl(bundle: LoaderBundleOutput, modules: CodeModule[]) {\n return this.fetcher.getChunksUrl(bundle, modules);\n }\n\n private async fetchMissingData(opts: {\n missingSpecs: ComponentLookupSpec[];\n }) {\n // TODO: do better than just fetching everything\n this.maybeReportClientSideFetch(\n () =>\n `Plasmic: fetching missing components in the browser: ${opts.missingSpecs\n .map((spec) => getLookupSpecName(spec))\n .join(\", \")}`\n );\n return this.fetchAllData();\n }\n\n private maybeReportClientSideFetch(mkMsg: () => string) {\n if (isBrowser && this.opts.onClientSideFetch) {\n const msg = mkMsg();\n if (this.opts.onClientSideFetch === \"warn\") {\n console.warn(msg);\n } else {\n throw new Error(msg);\n }\n }\n }\n\n private async fetchAllData() {\n const bundle = await this.fetcher.fetchAllData();\n this.tracker.trackFetch();\n this.mergeBundle(bundle);\n this.onBundleFetched?.();\n return bundle;\n }\n\n mergeBundle(newBundle: LoaderBundleOutput) {\n newBundle.bundleKey = newBundle.bundleKey ?? null;\n if (\n newBundle.bundleKey &&\n this.bundle.bundleKey &&\n newBundle.bundleKey !== this.bundle.bundleKey\n ) {\n console.warn(\n `Plasmic Error: Different code export hashes. This can happen if your app is using different loaders with different project IDs or project versions.\nConflicting values:\n${newBundle.bundleKey}\n${this.bundle.bundleKey}`\n );\n }\n // Merge the old bundle into the new bundle, this way\n // the new bundle will enforce the latest data from the server\n // allowing elements to be deleted by newer bundles\n this.bundle = mergeBundles(newBundle, this.bundle);\n\n this.onBundleMerged?.();\n }\n\n getBundle(): LoaderBundleOutput {\n return this.bundle;\n }\n\n clearCache() {\n this.bundle = {\n modules: {\n browser: [],\n server: [],\n },\n components: [],\n globalGroups: [],\n projects: [],\n activeSplits: [],\n bundleKey: null,\n deferChunksByDefault: false,\n disableRootLoadingBoundaryByDefault: false,\n filteredIds: {},\n };\n this.registry.clear();\n }\n\n registerModules(modules: Record<string, any>) {\n if (\n Object.keys(modules).some(\n (name) => this.registry.getRegisteredModule(name) !== modules[name]\n )\n ) {\n if (!this.registry.isEmpty()) {\n console.warn(\n \"Calling PlasmicComponentLoader.registerModules() after Plasmic component has rendered; starting over.\"\n );\n this.registry.clear();\n }\n for (const key of Object.keys(modules)) {\n this.registry.register(key, modules[key]);\n }\n }\n }\n\n substituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec\n ) {\n this.internalSubstituteComponent(component, name, undefined);\n }\n\n protected internalSubstituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec,\n codeComponentHelpers:\n | InternalCodeComponentHelpers<\n React.ComponentProps<React.ComponentType<P>>\n >\n | undefined\n ) {\n if (!this.isRegistryEmpty()) {\n console.warn(\n \"Calling PlasmicComponentLoader.registerSubstitution() after Plasmic component has rendered; starting over.\"\n );\n this.clearRegistry();\n }\n this.subs.push({ lookup: name, component, codeComponentHelpers });\n }\n\n abstract registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n ): void;\n abstract registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n ): void;\n abstract registerGlobalContext<T extends React.ComponentType<any>>(\n context: T,\n meta: GlobalContextMeta<React.ComponentProps<T>>\n ): void;\n abstract registerTrait(trait: string, meta: TraitMeta): void;\n abstract registerToken(token: TokenRegistration): void;\n\n protected refreshRegistry() {\n // Once we have received data, we register components to\n // substitute. We had to wait for data to do this so\n // that we can look up the right module name to substitute\n // in component meta.\n for (const sub of this.subs) {\n const metas = getCompMetas(this.getBundle().components, sub.lookup);\n metas.forEach((meta) => {\n SUBSTITUTED_COMPONENTS[meta.id] = sub.component;\n if (sub.codeComponentHelpers) {\n REGISTERED_CODE_COMPONENT_HELPERS[meta.id] = sub.codeComponentHelpers;\n }\n });\n }\n\n this.registry.updateModules(this.getBundle());\n }\n\n isRegistryEmpty() {\n return this.registry.isEmpty();\n }\n\n clearRegistry() {\n this.registry.clear();\n }\n\n setGlobalVariants(globalVariants: GlobalVariantSpec[]) {\n this.globalVariants = globalVariants;\n }\n\n getGlobalVariants() {\n return this.globalVariants;\n }\n\n registerPrefetchedBundle(bundle: LoaderBundleOutput) {\n // For React Server Components (Next.js 13+),\n // we need to pass server modules in LoaderBundleOutput from Server Components to Client Components.\n // We don't want to pass them via normal page props because that will be serialized to the browser.\n // Instead, we pass the bundle (including the server modules) via the Node `global` variable.\n //\n // This is the code that reads the stored bundle and merges it back into the loader.\n if (!isBrowser) {\n // Check if we have a cached bundle on this Node server.\n const cachedBundle = internal_getCachedBundleInNodeServer(this.opts);\n if (cachedBundle) {\n // If it's there, merge the cached bundle first.\n this.mergeBundle(cachedBundle);\n }\n }\n this.mergeBundle(bundle);\n }\n\n getLookup() {\n return new ComponentLookup(this.getBundle(), this.registry);\n }\n\n trackConversion(value = 0) {\n this.tracker.trackConversion(value);\n }\n\n public async getActiveVariation(\n opts: Omit<Parameters<typeof getActiveVariation>[0], \"splits\">\n ) {\n await this.fetchComponents();\n return getActiveVariation({\n ...opts,\n splits: this.getBundle().activeSplits,\n });\n }\n\n public getTeamIds(): string[] {\n return uniq(\n this.getBundle()\n .projects.map((p) =>\n p.teamId ? `${p.teamId}${p.indirect ? \"@indirect\" : \"\"}` : null\n )\n .filter((x): x is string => !!x)\n );\n }\n\n public getProjectIds(): string[] {\n return uniq(\n this.getBundle().projects.map(\n (p) => `${p.id}${p.indirect ? \"@indirect\" : \"\"}`\n )\n );\n }\n\n public trackRender(opts?: TrackRenderOptions) {\n this.tracker.trackRender(opts);\n }\n\n public loadServerQueriesModule(fileName: string) {\n return this.registry.load(fileName);\n }\n}\n\n/**\n * Library for fetching component data, and registering\n * custom components.\n */\nexport class PlasmicComponentLoader {\n private __internal: BaseInternalPlasmicComponentLoader;\n\n constructor(internal: BaseInternalPlasmicComponentLoader) {\n this.__internal = internal;\n }\n\n /**\n * Sets global variants to be used for all components. Note that\n * this is not reactive, and will not re-render all components\n * already mounted; instead, it should be used to activate global\n * variants that should always be activated for the lifetime of this\n * app. If you'd like to reactively change the global variants,\n * you should specify them via <PlasmicRootProvider />\n */\n setGlobalVariants(globalVariants: GlobalVariantSpec[]) {\n this.__internal.setGlobalVariants(globalVariants);\n }\n\n registerModules(modules: Record<string, any>) {\n this.__internal.registerModules(modules);\n }\n\n /**\n * Register custom components that should be swapped in for\n * components defined in your project. You can use this to\n * swap in / substitute a Plasmic component with a \"real\" component.\n */\n substituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec\n ) {\n this.__internal.substituteComponent(component, name);\n }\n\n /**\n * Register code components to be used on Plasmic Editor.\n */\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n ): void;\n\n /**\n * [[deprecated]] Please use `substituteComponent` instead for component\n * substitution, or the other `registerComponent` overload to register\n * code components to be used on Plasmic Editor.\n *\n * @see `substituteComponent`\n */\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n name: ComponentLookupSpec\n ): void;\n\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n metaOrName: ComponentLookupSpec | CodeComponentMeta<React.ComponentProps<T>>\n ) {\n // 'props' is a required field in CodeComponentMeta\n if (metaOrName && typeof metaOrName === \"object\" && \"props\" in metaOrName) {\n this.__internal.registerComponent(component, metaOrName);\n } else {\n // Deprecated call\n if (\n process.env.NODE_ENV === \"development\" &&\n !this.warnedRegisterComponent\n ) {\n console.warn(\n `PlasmicLoader: Using deprecated method \\`registerComponent\\` for component substitution. ` +\n `Please consider using \\`substituteComponent\\` instead.`\n );\n this.warnedRegisterComponent = true;\n }\n this.substituteComponent(component, metaOrName);\n }\n }\n private warnedRegisterComponent = false;\n\n registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n ) {\n this.__internal.registerFunction(fn, meta);\n }\n\n registerGlobalContext<T extends React.ComponentType<any>>(\n context: T,\n meta: GlobalContextMeta<React.ComponentProps<T>>\n ) {\n this.__internal.registerGlobalContext(context, meta);\n }\n\n registerTrait(trait: string, meta: TraitMeta) {\n this.__internal.registerTrait(trait, meta);\n }\n\n registerToken(token: TokenRegistration) {\n this.__internal.registerToken(token);\n }\n\n /**\n * Pre-fetches component data needed to for PlasmicLoader to render\n * these components. Should be passed into PlasmicRootProvider as\n * the prefetchedData prop.\n *\n * You can look up a component either by:\n * - the name of the component\n * - the path for a page component\n * - an array of strings that make up parts of the path\n * - object { name: \"name_or_path\", projectId: ...}, to specify which project\n * to use, if multiple projects have the same component name\n *\n * Throws an Error if a specified component to fetch does not exist in\n * the Plasmic project.\n */\n fetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData>;\n fetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData>;\n fetchComponentData(...args: any[]): Promise<ComponentRenderData> {\n return this.__internal.fetchComponentData(...args);\n }\n\n /**\n * Like fetchComponentData(), but returns null instead of throwing an Error\n * when a component is not found. Useful when you are implementing a catch-all\n * page and want to check if a specific path had been defined for Plasmic.\n */\n async maybeFetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n ...args: any[]\n ): Promise<ComponentRenderData | null> {\n return this.__internal.maybeFetchComponentData(...args);\n }\n\n /**\n * Returns all the page component metadata for these projects.\n */\n async fetchPages(opts?: FetchPagesOpts) {\n return this.__internal.fetchPages(opts);\n }\n\n /**\n * Returns all components metadata for these projects.\n */\n async fetchComponents() {\n return this.__internal.fetchComponents();\n }\n\n protected async _getActiveVariation(\n opts: Parameters<typeof this.__internal.getActiveVariation>[0]\n ) {\n return this.__internal.getActiveVariation(opts);\n }\n\n async getActiveVariation(opts: {\n known?: Record<string, string>;\n traits: Record<string, string | number | boolean>;\n }) {\n return this._getActiveVariation({\n traits: opts.traits,\n getKnownValue: (key: string) => {\n if (opts.known) {\n return opts.known[key];\n } else {\n const cookies = getPlasmicCookieValues();\n return cookies[key];\n }\n },\n updateKnownValue: (key: string, value: string) => {\n if (!opts.known) {\n updatePlasmicCookieValue(key, value);\n }\n },\n });\n }\n\n getChunksUrl(bundle: LoaderBundleOutput, modules: CodeModule[]) {\n return this.__internal.getChunksUrl(bundle, modules);\n }\n\n getExternalVariation(\n variation: Record<string, string>,\n filters?: Parameters<typeof getExternalIds>[2]\n ) {\n return getExternalIds(this.getActiveSplits(), variation, filters);\n }\n\n getActiveSplits() {\n return this.__internal.getActiveSplits();\n }\n\n trackConversion(value = 0) {\n this.__internal.trackConversion(value);\n }\n\n clearCache() {\n return this.__internal.clearCache();\n }\n\n async unstable__getServerQueriesData(\n renderData: ComponentRenderData,\n $ctx: Record<string, any>\n ) {\n if (renderData.entryCompMetas.length === 0) {\n return {};\n }\n\n const fileName = renderData.entryCompMetas[0].serverQueriesExecFuncFileName;\n\n if (!fileName) {\n return {};\n }\n\n const module = this.__internal.loadServerQueriesModule(fileName);\n const { executeServerQueries } = module;\n\n try {\n const $serverQueries = await executeServerQueries($ctx);\n return $serverQueries;\n } catch (err) {\n console.error(\"Error executing server queries function\", err);\n return {};\n }\n }\n}\n", "import {\n ComponentMeta,\n getBundleSubset,\n LoaderBundleOutput,\n} from \"@plasmicapp/loader-core\";\nimport type { ComponentRenderData } from \"./loader-shared\";\nimport { intersect } from \"./utils\";\n\nfunction getUsedComps(allComponents: ComponentMeta[], entryCompIds: string[]) {\n const q: string[] = [...entryCompIds];\n const seenIds = new Set<string>(entryCompIds);\n const componentMetaById = new Map<string, ComponentMeta>(\n allComponents.map((meta) => [meta.id, meta])\n );\n const usedComps: ComponentMeta[] = [];\n while (q.length > 0) {\n const [id] = q.splice(0, 1);\n const meta = componentMetaById.get(id);\n if (!meta) {\n continue;\n }\n usedComps.push(meta);\n meta.usedComponents.forEach((usedCompId) => {\n if (!seenIds.has(usedCompId)) {\n seenIds.add(usedCompId);\n q.push(usedCompId);\n }\n });\n }\n return usedComps;\n}\n\nexport function prepComponentData(\n bundle: LoaderBundleOutput,\n compMetas: ComponentMeta[],\n opts?: {\n target?: \"browser\" | \"server\";\n }\n): ComponentRenderData {\n if (compMetas.length === 0) {\n return {\n entryCompMetas: bundle.components,\n bundle: bundle,\n remoteFontUrls: [],\n };\n }\n\n const usedComps = getUsedComps(\n bundle.components,\n compMetas.map((compMeta) => compMeta.id)\n );\n const compPaths = usedComps.map((compMeta) => compMeta.entry);\n const subBundle = getBundleSubset(\n bundle,\n [\n \"entrypoint.css\",\n ...compPaths,\n \"root-provider.js\",\n ...bundle.projects\n .map((x) => x.globalContextsProviderFileName)\n .filter((x) => !!x),\n // We need to explicitly include global context provider components\n // to make sure they are kept in bundle.components. That's because\n // for esbuild, just the globalContextsProviderFileName is not enough,\n // because it will import a chunk that includes the global context\n // component, instead of importing that global context component's\n // entry file. And because nothing depends on the global context component's\n // entry file, we end up excluding the global context component from\n // bundle.components, which then makes its substitution not work.\n // Instead, we forcibly include it here (we'll definitely need it anyway!).\n ...bundle.components\n .filter((c) => c.isGlobalContextProvider)\n .map((c) => c.entry),\n ...bundle.globalGroups.map((g) => g.contextFile),\n ],\n opts\n );\n\n const remoteFontUrls: string[] = [];\n subBundle.projects.forEach((p) =>\n remoteFontUrls.push(...p.remoteFonts.map((f) => f.url))\n );\n\n return {\n entryCompMetas: compMetas,\n bundle: subBundle,\n remoteFontUrls,\n };\n}\n\n// It's important to deep clone any attributes that are going to be changed in the\n// target bundle, since the build of pages can be done in multiple stages/processes\n// we don't want to mutate the original bundle, which can impact other pages.\nexport function mergeBundles(\n target: LoaderBundleOutput,\n from: LoaderBundleOutput\n) {\n const existingProjects = new Set(target.projects.map((p) => p.id));\n const newProjects = from.projects.filter((p) => !existingProjects.has(p.id));\n if (newProjects.length > 0) {\n target = {\n ...target,\n projects: [...target.projects, ...newProjects],\n };\n }\n\n const existingCompIds = new Set(target.components.map((c) => c.id));\n\n function shouldIncludeComponentInBundle(c: ComponentMeta) {\n // If the component is already present in the target bundle, don't include it\n if (existingCompIds.has(c.id)) {\n return false;\n }\n // If the component belongs to a project that is not present in the target bundle,\n // include it\n if (!existingProjects.has(c.projectId)) {\n return true;\n }\n // If the component is present in the filteredIds of the project it belongs to,\n // in the target bundle, we consider that the component was not deleted in the target\n // bundle, so we can include it\n const targetBundleFilteredIds = target.filteredIds[c.projectId] ?? [];\n return targetBundleFilteredIds.includes(c.id);\n }\n\n const newCompMetas = from.components.filter((m) =>\n shouldIncludeComponentInBundle(m)\n );\n if (newCompMetas.length > 0) {\n target = {\n ...target,\n components: [...target.components, ...newCompMetas],\n };\n\n // Deep clone the filteredIds object to avoid mutating the original bundle\n target.filteredIds = Object.fromEntries(\n Object.entries(target.filteredIds).map(([k, v]) => [k, [...v]])\n );\n\n from.projects.forEach((fromProject) => {\n const projectId = fromProject.id;\n const fromBundleFilteredIds = from.filteredIds[projectId] ?? [];\n if (!existingProjects.has(projectId)) {\n target.filteredIds[projectId] = [...fromBundleFilteredIds];\n } else {\n target.filteredIds[projectId] = intersect(\n target.filteredIds[projectId] ?? [],\n fromBundleFilteredIds\n );\n }\n });\n }\n\n const existingModules = {\n browser: new Set(target.modules.browser.map((m) => m.fileName)),\n server: new Set(target.modules.server.map((m) => m.fileName)),\n };\n const newModules = {\n browser: from.modules.browser.filter(\n (m) => !existingModules.browser.has(m.fileName)\n ),\n server: from.modules.server.filter(\n (m) => !existingModules.server.has(m.fileName)\n ),\n };\n if (newModules.browser.length > 0 || newModules.server.length > 0) {\n target = {\n ...target,\n modules: {\n browser: [...target.modules.browser, ...newModules.browser],\n server: [...target.modules.server, ...newModules.server],\n },\n };\n }\n\n const existingGlobalIds = new Set(target.globalGroups.map((g) => g.id));\n const newGlobals = from.globalGroups.filter(\n (g) => !existingGlobalIds.has(g.id)\n );\n if (newGlobals.length > 0) {\n target = {\n ...target,\n globalGroups: [...target.globalGroups, ...newGlobals],\n };\n }\n\n const existingSplitIds = new Set(target.activeSplits.map((s) => s.id));\n const newSplits =\n from.activeSplits.filter(\n // Don't include splits belonging to projects already present\n // in the target bundle\n (s) => !existingSplitIds.has(s.id) && !existingProjects.has(s.projectId)\n ) ?? [];\n if (newSplits.length > 0) {\n target = {\n ...target,\n activeSplits: [...target.activeSplits, ...newSplits],\n };\n }\n\n // Avoid `undefined` as it cannot be serialized as JSON\n target.bundleKey = target.bundleKey ?? from.bundleKey ?? null;\n target.deferChunksByDefault =\n target.deferChunksByDefault ?? from.deferChunksByDefault ?? false;\n\n target.disableRootLoadingBoundaryByDefault =\n target.disableRootLoadingBoundaryByDefault ??\n from.disableRootLoadingBoundaryByDefault ??\n false;\n\n return target;\n}\n\nexport const convertBundlesToComponentRenderData = (\n bundles: LoaderBundleOutput[],\n compMetas: ComponentMeta[]\n): ComponentRenderData | null => {\n if (bundles.length === 0) {\n return null;\n }\n\n const mergedBundles = bundles.reduce((prev, cur) => mergeBundles(prev, cur));\n return prepComponentData(mergedBundles, compMetas);\n};\n", "import {\n AssetModule,\n ComponentMeta,\n FontMeta,\n GlobalGroupMeta,\n LoaderBundleOutput,\n Registry,\n} from '@plasmicapp/loader-core';\nimport * as React from 'react';\nimport { ComponentLookupSpec, getCompMetas } from './utils';\n\nfunction getFirstCompMeta(metas: ComponentMeta[], lookup: ComponentLookupSpec) {\n const filtered = getCompMetas(metas, lookup);\n return filtered.length === 0 ? undefined : filtered[0];\n}\n\nexport class ComponentLookup {\n constructor(private bundle: LoaderBundleOutput, private registry: Registry) {}\n\n getComponentMeta(spec: ComponentLookupSpec): ComponentMeta | undefined {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n return compMeta;\n }\n\n getComponent<P extends React.ComponentType = any>(\n spec: ComponentLookupSpec,\n opts: { forceOriginal?: boolean } = {}\n ) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n if (!compMeta) {\n throw new Error(`Component not found: ${spec}`);\n }\n const moduleName = compMeta.entry;\n if (!this.registry.hasModule(moduleName, opts)) {\n throw new Error(`Component not yet fetched: ${compMeta.name}`);\n }\n const entry = this.registry.load(moduleName, {\n forceOriginal: opts.forceOriginal,\n });\n return !opts.forceOriginal &&\n typeof entry?.getPlasmicComponent === 'function'\n ? entry.getPlasmicComponent()\n : (entry.default as P);\n }\n\n hasComponent(spec: ComponentLookupSpec) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n if (compMeta) {\n return this.registry.hasModule(compMeta.entry);\n }\n return false;\n }\n\n getGlobalContexts(): { meta: GlobalGroupMeta; context: any }[] {\n const customGlobalMetas = this.bundle.globalGroups.filter(\n (m) => m.type === 'global-user-defined'\n );\n return customGlobalMetas.map((meta) => ({\n meta,\n context: this.registry.load(meta.contextFile).default,\n }));\n }\n\n getGlobalContextsProvider(spec: ComponentLookupSpec) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n const projectMeta = compMeta\n ? this.bundle.projects.find((x) => x.id === compMeta.projectId)\n : undefined;\n\n if (\n !projectMeta ||\n !projectMeta.globalContextsProviderFileName ||\n !this.registry.hasModule(projectMeta.globalContextsProviderFileName)\n ) {\n return undefined;\n }\n const entry = this.registry.load(\n projectMeta.globalContextsProviderFileName\n );\n\n return typeof entry?.getPlasmicComponent === 'function'\n ? entry.getPlasmicComponent()\n : entry.default;\n }\n\n getRootProvider() {\n const entry = this.registry.load('root-provider.js');\n return entry.default;\n }\n\n getCss(): AssetModule[] {\n // We can probably always get the modules from the browser build\n return this.bundle.modules.browser.filter(\n (mod) => mod.type === 'asset' && mod.fileName.endsWith('css')\n ) as AssetModule[];\n }\n\n getRemoteFonts(): FontMeta[] {\n return this.bundle.projects.flatMap((p) => p.remoteFonts);\n }\n}\n", "import { InternalPlasmicComponentLoader } from \"./loader-client\";\nimport {\n CodeComponentMeta,\n CustomFunctionMeta,\n FetchComponentDataOpts,\n InitOptions,\n PlasmicComponentLoader,\n} from \"./loader-shared\";\n\nexport {\n DataCtxReader,\n DataProvider,\n GlobalActionsContext,\n GlobalActionsProvider,\n PageParamsProvider,\n PlasmicCanvasContext,\n PlasmicCanvasHost,\n PlasmicTranslatorContext,\n repeatedElement,\n useDataEnv,\n usePlasmicCanvasComponentInfo,\n usePlasmicCanvasContext,\n useSelector,\n useSelectors,\n} from \"@plasmicapp/host\";\nexport type { PropType, TokenRegistration } from \"@plasmicapp/host\";\nexport { usePlasmicQueryData } from \"@plasmicapp/query\";\nexport { PlasmicComponent } from \"./PlasmicComponent\";\nexport { PlasmicRootProvider } from \"./PlasmicRootProvider\";\nexport type {\n GlobalVariantSpec,\n PlasmicTranslator,\n} from \"./PlasmicRootProvider\";\nexport { extractPlasmicQueryData, plasmicPrepass } from \"./prepass-client\";\nexport {\n extractPlasmicQueryDataFromElement,\n hydrateFromElement,\n renderToElement,\n renderToString,\n} from \"./render\";\nexport * from \"./shared-exports\";\nexport { usePlasmicComponent } from \"./usePlasmicComponent\";\nexport type { ComponentLookupSpec } from \"./utils\";\nexport { InternalPlasmicComponentLoader, PlasmicComponentLoader };\nexport type { CodeComponentMeta, CustomFunctionMeta, FetchComponentDataOpts };\n\nexport function initPlasmicLoader(opts: InitOptions): PlasmicComponentLoader {\n const internal = new InternalPlasmicComponentLoader(opts);\n return new PlasmicComponentLoader(internal);\n}\n", "import * as React from \"react\";\nimport { usePlasmicRootContext } from \"./PlasmicRootProvider\";\nimport { usePlasmicComponent } from \"./usePlasmicComponent\";\nimport { MaybeWrap } from \"./utils\";\n\nconst PlasmicComponentContext = React.createContext(false);\n\nexport function PlasmicComponent(props: {\n /**\n * Name of the component to render, or the path of the page component\n */\n component: string;\n /**\n * Optionally specify a projectId if there are multiple components\n * of the same name from different projects\n */\n projectId?: string;\n /**\n * If you used registerComponent(), then if the name matches a registered\n * component, that component is used. If you want the Plasmic-generated\n * component instead, specify forceOriginal.\n */\n forceOriginal?: boolean;\n componentProps?: any;\n}): React.ReactElement | null {\n const { component, projectId, componentProps, forceOriginal } = props;\n\n const rootContext = usePlasmicRootContext();\n const isRootLoader = !React.useContext(PlasmicComponentContext);\n\n if (!rootContext) {\n // no existing PlasmicRootProvider\n throw new Error(\n `You must use <PlasmicRootProvider/> at the root of your app`\n );\n }\n\n const {\n loader,\n globalContextsProps,\n variation,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n translator,\n ...rest\n } = rootContext;\n\n const Component = usePlasmicComponent(\n { name: component, projectId, isCode: false },\n { forceOriginal }\n );\n\n React.useEffect(() => {\n if (isRootLoader) {\n const meta = loader\n .getLookup()\n .getComponentMeta({ name: component, projectId });\n\n if (meta) {\n loader.trackRender({\n renderCtx: {\n rootProjectId: meta.projectId,\n rootComponentId: meta.id,\n rootComponentName: component,\n teamIds: loader.getTeamIds(),\n projectIds: loader.getProjectIds(),\n },\n variation,\n });\n }\n }\n }, [component, projectId, loader, variation]);\n\n const element = React.useMemo(() => {\n if (!Component) {\n return null;\n }\n\n let elt = <Component {...componentProps} />;\n\n if (isRootLoader) {\n // If this is the root PlasmicComponent, then wrap the content with the\n // react-web's PlasmicRootProvider. We are doing this here, instead of\n // say PlasmicRootProvider, because we don't have access to this context\n // provider until data has been loaded. If we insert this provider into\n // the tree at the root after data is loaded, then we'll invalidate the\n // React tree and tree state, which is bad. Instead, we do it at the\n // \"root-most PlasmicComponent\"; we won't risk invalidating the sub-tree\n // here because there were no children before the data came in.\n const lookup = loader.getLookup();\n const ReactWebRootProvider = lookup.getRootProvider();\n const GlobalContextsProvider = lookup.getGlobalContextsProvider({\n name: component,\n projectId,\n });\n elt = (\n <ReactWebRootProvider\n {...rest}\n userAuthToken={userAuthToken}\n isUserLoading={isUserLoading}\n authRedirectUri={authRedirectUri}\n i18n={{\n translator,\n tagPrefix: loader.opts.i18n?.tagPrefix,\n }}\n >\n <MaybeWrap\n cond={!!GlobalContextsProvider}\n wrapper={(children) => (\n <GlobalContextsProvider {...globalContextsProps}>\n {children}\n </GlobalContextsProvider>\n )}\n >\n <PlasmicComponentContext.Provider value={true}>\n {elt}\n </PlasmicComponentContext.Provider>\n </MaybeWrap>\n </ReactWebRootProvider>\n );\n }\n return elt;\n }, [\n Component,\n componentProps,\n loader,\n isRootLoader,\n component,\n projectId,\n globalContextsProps,\n userAuthToken, // Just use the token to memo, `user` should be derived from it\n isUserLoading,\n authRedirectUri,\n ]);\n return element;\n}\n", "import * as React from 'react';\nimport { usePlasmicRootContext } from './PlasmicRootProvider';\nimport {\n ComponentLookupSpec,\n useForceUpdate,\n useIsMounted,\n useStableLookupSpec,\n} from './utils';\n\n/**\n * Hook that fetches and returns a React component for rendering the argument\n * Plasmic component. Returns undefined if the component data is still\n * being fetched.\n *\n * @param opts.forceOriginal if you used PlasmicComponentLoader.registerComponent,\n * then normally usePlasmicComponent will return the registered component.\n * You can set forceOriginal to true if you want to return the Plasmic-generated\n * component instead.\n */\nexport function usePlasmicComponent<P extends React.ComponentType = any>(\n spec: ComponentLookupSpec,\n opts: { forceOriginal?: boolean } = {}\n) {\n const rootContext = usePlasmicRootContext();\n if (!rootContext) {\n throw new Error(\n `You can only use usePlasmicComponent if wrapped in <PlasmicRootProvider />`\n );\n }\n\n const loader = rootContext.loader;\n const lookup = loader.getLookup();\n\n const component = lookup.hasComponent(spec)\n ? lookup.getComponent(spec, opts)\n : undefined;\n\n const stableSpec = useStableLookupSpec(spec);\n const isMounted = useIsMounted();\n const forceUpdate = useForceUpdate();\n\n React.useEffect(() => {\n if (!component) {\n (async () => {\n await loader.fetchComponentData(stableSpec);\n if (isMounted()) {\n forceUpdate();\n }\n })();\n }\n }, [component, stableSpec]);\n\n return component as P;\n}\n", "import {\n extractPlasmicQueryData as internalExtractQueryData,\n plasmicPrepass as internalPlasmicPrepass,\n} from \"@plasmicapp/prepass\";\n\n/**\n * Performs a prepass over Plasmic content, kicking off the necessary\n * data fetches, and populating the fetched data into a cache. This\n * cache can be passed as prefetchedQueryData into PlasmicRootProvider.\n *\n * To limit rendering errors that can occur when you do this, we recommend\n * that you pass in _only_ the PlasmicComponents that you are planning to use\n * as the argument. For example:\n *\n * const cache = await extractPlasmicQueryData(\n * <PlasmicRootProvider loader={PLASMIC} prefetchedData={plasmicData}>\n * <PlasmicComponent component=\"Home\" componentProps={{\n * // Specify the component prop overrides you are planning to use\n * // to render the page, as they may change what data is fetched.\n * ...\n * }} />\n * <PlasmicComponent component=\"NavBar\" componentProps={{\n * ...\n * }} />\n * ...\n * </PlasmicRootProvider>\n * );\n *\n * If your PlasmicComponent will be wrapping components that require special\n * context set up, you should also wrap the element above with those context\n * providers.\n *\n * You should avoid passing in elements that are not related to Plasmic, as any\n * rendering errors from those elements during the prepass may result in data\n * not being populated in the cache.\n *\n * @param element a React element containing instances of PlasmicComponent.\n * Will attempt to satisfy all data needs from usePlasmicDataQuery()\n * in this element tree.\n * @returns an object mapping query key to fetched data\n */\nexport function extractPlasmicQueryData(\n element: React.ReactElement\n): Promise<Record<string, any>> {\n return internalExtractQueryData(element);\n}\n\n/**\n * @deprecated Maintained for backwards compatibility\n */\nexport function plasmicPrepass(element: React.ReactElement): Promise<void> {\n return internalPlasmicPrepass(element);\n}\n", "import { extractPlasmicQueryData } from \"@plasmicapp/prepass\";\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { renderToString as reactRenderToString } from \"react-dom/server\";\nimport { ComponentRenderData, PlasmicComponentLoader } from \"./loader-shared\";\nimport { PlasmicComponent } from \"./PlasmicComponent\";\nimport { GlobalVariantSpec, PlasmicRootProvider } from \"./PlasmicRootProvider\";\nimport { ComponentLookupSpec } from \"./utils\";\n\nexport async function renderToElement(\n loader: PlasmicComponentLoader,\n target: HTMLElement,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n pageParams?: Record<string, any>;\n pageQuery?: Record<string, any>;\n } = {}\n) {\n return new Promise<void>((resolve) => {\n const element = makeElement(loader, lookup, opts);\n ReactDOM.render(element, target, () => resolve());\n });\n}\n\nexport function renderToString(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n const element = makeElement(loader, lookup, opts);\n return reactRenderToString(element);\n}\n\nexport async function extractPlasmicQueryDataFromElement(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n const element = makeElement(loader, lookup, opts);\n return extractPlasmicQueryData(element);\n}\n\nexport async function hydrateFromElement(\n loader: PlasmicComponentLoader,\n target: HTMLElement,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n return new Promise<void>((resolve) => {\n const element = makeElement(loader, lookup, opts);\n ReactDOM.hydrate(element, target, () => resolve());\n });\n}\n\nfunction makeElement(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n pageParams?: Record<string, any>;\n pageQuery?: Record<string, any>;\n } = {}\n) {\n return (\n <PlasmicRootProvider\n loader={loader}\n prefetchedData={opts.prefetchedData}\n globalVariants={opts.globalVariants}\n prefetchedQueryData={opts.prefetchedQueryData}\n pageParams={opts.pageParams}\n pageQuery={opts.pageQuery}\n >\n <PlasmicComponent\n component={typeof lookup === \"string\" ? lookup : lookup.name}\n projectId={typeof lookup === \"string\" ? undefined : lookup.projectId}\n componentProps={opts.componentProps}\n />\n </PlasmicRootProvider>\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,YAAY,+BAA+B;AAE3C,YAAY,iBAAiB;AAC7B;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EAC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AAoB,OAAO;AACpC;AAEA,SAAsB,mCACpB,IACA,IAOA;AAAA,6CARA,QACA,QACA,OAKI,CAAC,GACL;AACA,UAAM,UAAU,YAAY,QAAQ,QAAQ,IAAI;AAChD,WAAOC,yBAAwB,OAAO;AAAA,EACxC;AAAA;AAEA,SAAsB,mBACpB,IACA,IACA,IAOA;AAAA,6CATA,QACA,QACA,QACA,OAKI,CAAC,GACL;AACA,WAAO,IAAI,QAAc,CAAC,YAAY;AACpC,YAAM,UAAU,YAAY,QAAQ,QAAQ,IAAI;AAChD,MAAAD,UAAS,QAAQ,SAAS,QAAQ,MAAM,QAAQ,CAAC;AAAA,IACnD,CAAC;AAAA,EACH;AAAA;AAEA,SAAS,YACP,QACA,QACA,OAOI,CAAC,GACL;AACA,SACE,gBAAAE,OAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,gBAAgB,KAAK;AAAA,MACrB,gBAAgB,KAAK;AAAA,MACrB,qBAAqB,KAAK;AAAA,MAC1B,YAAY,KAAK;AAAA,MACjB,WAAW,KAAK;AAAA;AAAA,IAEhB,gBAAAA,OAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,OAAO,WAAW,WAAW,SAAS,OAAO;AAAA,QACxD,WAAW,OAAO,WAAW,WAAW,SAAY,OAAO;AAAA,QAC3D,gBAAgB,KAAK;AAAA;AAAA,IACvB;AAAA,EACF;AAEJ;;;AJvDO,SAAS,kBAAkB,MAA2C;AAC3E,QAAM,WAAW,IAAI,+BAA+B,IAAI;AACxD,SAAO,IAAI,uBAAuB,QAAQ;AAC5C;",
|
|
6
|
-
"names": ["PlasmicModulesFetcher", "PlasmicTracker", "React", "React", "PlasmicCss", "_a", "_b", "PlasmicTracker", "PlasmicModulesFetcher", "React", "PageParamsProvider", "React", "React", "_a", "extractPlasmicQueryData", "React", "ReactDOM", "
|
|
4
|
+
"sourcesContent": ["import * as PlasmicDataSourcesContext from \"@plasmicapp/data-sources-context\";\n// eslint-disable-next-line no-restricted-imports\nimport * as PlasmicHost from \"@plasmicapp/host\";\nimport {\n // eslint-disable-next-line no-restricted-imports\n registerComponent,\n registerFunction,\n registerGlobalContext,\n registerToken,\n registerTrait,\n stateHelpersKeys,\n TokenRegistration,\n TraitMeta,\n} from \"@plasmicapp/host\";\nimport { PlasmicModulesFetcher, PlasmicTracker } from \"@plasmicapp/loader-core\";\nimport * as PlasmicQuery from \"@plasmicapp/query\";\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport * as jsxDevRuntime from \"react/jsx-dev-runtime\";\nimport * as jsxRuntime from \"react/jsx-runtime\";\nimport { createUseGlobalVariant } from \"./global-variants\";\nimport {\n BaseInternalPlasmicComponentLoader,\n CodeComponentMeta,\n CustomFunctionMeta,\n GlobalContextMeta,\n InitOptions,\n internalSetRegisteredFunction,\n PlasmicRootWatcher,\n REGISTERED_CODE_COMPONENT_HELPERS,\n REGISTERED_CUSTOM_FUNCTIONS,\n SUBSTITUTED_COMPONENTS,\n SUBSTITUTED_GLOBAL_VARIANT_HOOKS,\n} from \"./loader-shared\";\n\nexport class InternalPlasmicComponentLoader extends BaseInternalPlasmicComponentLoader {\n private readonly roots: PlasmicRootWatcher[] = [];\n\n constructor(opts: InitOptions) {\n const tracker = new PlasmicTracker({\n ...opts,\n projectIds: opts.projects.map((p) => p.id),\n });\n super({\n opts,\n tracker,\n fetcher: new PlasmicModulesFetcher(opts),\n onBundleMerged: () => {\n this.refreshRegistry();\n },\n onBundleFetched: () => {\n this.roots.forEach((watcher) => watcher.onDataFetched?.());\n },\n builtinModules: {\n react: React,\n \"react-dom\": ReactDOM,\n \"react/jsx-runtime\": jsxRuntime,\n \"react/jsx-dev-runtime\": jsxDevRuntime,\n\n // Also inject @plasmicapp/query and @plasmicapp/host to use the\n // same contexts here and in loader-downloaded code.\n \"@plasmicapp/query\": PlasmicQuery,\n \"@plasmicapp/data-sources-context\": PlasmicDataSourcesContext,\n \"@plasmicapp/host\": PlasmicHost,\n \"@plasmicapp/host/registerFunction\": internalSetRegisteredFunction,\n \"@plasmicapp/loader-runtime-registry\": {\n components: SUBSTITUTED_COMPONENTS,\n globalVariantHooks: SUBSTITUTED_GLOBAL_VARIANT_HOOKS,\n codeComponentHelpers: REGISTERED_CODE_COMPONENT_HELPERS,\n functions: REGISTERED_CUSTOM_FUNCTIONS,\n },\n },\n });\n }\n\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n ) {\n // making the component meta consistent between codegen and loader\n const stateHelpers = Object.fromEntries(\n Object.entries(meta.states ?? {})\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n .filter(([_, stateSpec]) =>\n Object.keys(stateSpec).some((key) => stateHelpersKeys.includes(key))\n )\n .map(([stateName, stateSpec]) => [\n stateName,\n Object.fromEntries(\n stateHelpersKeys\n .filter((key) => key in stateSpec)\n .map((key) => [key, stateSpec[key]])\n ),\n ])\n );\n const helpers = { states: stateHelpers };\n this.internalSubstituteComponent(\n component,\n { name: meta.name, isCode: true },\n Object.keys(stateHelpers).length > 0 ? helpers : undefined\n );\n registerComponent(component, {\n ...meta,\n // Import path is not used as we will use component substitution\n importPath: meta.importPath ?? \"\",\n ...(Object.keys(stateHelpers).length > 0\n ? {\n componentHelpers: {\n helpers,\n importPath: \"\",\n importName: \"\",\n },\n }\n : {}),\n });\n }\n\n registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n ) {\n registerFunction(fn, {\n ...meta,\n importPath: meta.importPath ?? \"\",\n });\n internalSetRegisteredFunction(fn, meta);\n }\n\n registerGlobalContext<T extends React.ComponentType<any>>(\n context: T,\n meta: GlobalContextMeta<React.ComponentProps<T>>\n ) {\n this.substituteComponent(context, { name: meta.name, isCode: true });\n // Import path is not used as we will use component substitution\n registerGlobalContext(context, {\n ...meta,\n importPath: meta.importPath ?? \"\",\n });\n }\n\n registerTrait(trait: string, meta: TraitMeta) {\n registerTrait(trait, meta);\n }\n\n registerToken(token: TokenRegistration) {\n registerToken(token);\n }\n\n subscribePlasmicRoot(watcher: PlasmicRootWatcher) {\n this.roots.push(watcher);\n }\n\n unsubscribePlasmicRoot(watcher: PlasmicRootWatcher) {\n const index = this.roots.indexOf(watcher);\n if (index >= 0) {\n this.roots.splice(index, 1);\n }\n }\n\n refreshRegistry() {\n // We swap global variants' useXXXGlobalVariant() hook with\n // a fake one that just reads from the PlasmicRootContext. Because\n // global variant values are not supplied by the generated global variant\n // context providers, but instead by <PlasmicRootProvider/> and by\n // PlasmicComponentLoader.setGlobalVariants(), we redirect these\n // hooks to read from them instead.\n for (const globalGroup of this.getBundle().globalGroups) {\n if (globalGroup.type !== \"global-screen\") {\n SUBSTITUTED_GLOBAL_VARIANT_HOOKS[globalGroup.id] =\n createUseGlobalVariant(globalGroup.name, globalGroup.projectId);\n }\n }\n super.refreshRegistry();\n }\n}\n", "import { PlasmicDataSourceContextValue } from \"@plasmicapp/data-sources-context\";\nimport { PageParamsProvider } from \"@plasmicapp/host\";\nimport { AssetModule, ComponentMeta, Split } from \"@plasmicapp/loader-core\";\nimport { PlasmicQueryDataProvider } from \"@plasmicapp/query\";\nimport * as React from \"react\";\nimport { InternalPlasmicComponentLoader } from \"./loader-client\";\nimport { ComponentRenderData, PlasmicComponentLoader } from \"./loader-shared\";\nimport { MaybeWrap, useForceUpdate } from \"./utils\";\nimport {\n getGlobalVariantsFromSplits,\n mergeGlobalVariantsSpec,\n} from \"./variation\";\n\nexport interface PlasmicRootContextValue extends PlasmicDataSourceContextValue {\n globalVariants?: GlobalVariantSpec[];\n globalContextsProps?: Record<string, any>;\n loader: InternalPlasmicComponentLoader;\n variation?: Record<string, string>;\n translator?: PlasmicTranslator;\n Head?: React.ComponentType<any>;\n Link?: React.ComponentType<any>;\n disableLoadingBoundary?: boolean;\n suspenseFallback?: React.ReactNode;\n}\n\nconst PlasmicRootContext = React.createContext<\n PlasmicRootContextValue | undefined\n>(undefined);\n\nexport interface GlobalVariantSpec {\n name: string;\n projectId?: string;\n value: any;\n}\n\nexport type PlasmicTranslator = (\n str: string,\n opts?: {\n components?: {\n [key: string]: React.ReactElement | React.ReactFragment;\n };\n }\n) => React.ReactNode;\n\n/**\n * PlasmicRootProvider should be used at the root of your page\n * or application.\n */\nexport function PlasmicRootProvider(\n props: {\n /**\n * The global PlasmicComponentLoader instance you created via\n * initPlasmicLoader().\n */\n loader: PlasmicComponentLoader;\n\n /**\n * Global variants to activate for Plasmic components\n */\n globalVariants?: GlobalVariantSpec[];\n\n children?: React.ReactNode;\n\n /**\n * If true, will skip rendering css\n */\n skipCss?: boolean;\n\n /**\n * If true, will skip installing fonts\n */\n skipFonts?: boolean;\n\n /**\n * If you have pre-fetched component data via PlasmicComponentLoader,\n * you can pass them in here; PlasmicComponent will avoid fetching\n * component data that have already been pre-fetched.\n */\n prefetchedData?: ComponentRenderData;\n\n /**\n * If you have pre-fetched data that are needed by usePlasmicQueryData(),\n * then pass in the pre-fetched cache here, mapping query key to fetched data.\n */\n prefetchedQueryData?: Record<string, any>;\n\n /**\n * Specifies whether usePlasmicQueryData() should be operating in suspense mode\n * (throwing promises).\n */\n suspenseForQueryData?: boolean;\n\n /**\n * Override your Global Contexts Provider props. This is a map from\n * globalContextComponentNameProps to object of props to use for that\n * component.\n */\n globalContextsProps?: Record<string, any>;\n\n /**\n * Specifies a mapping of split id to slice id that should be activated\n */\n variation?: Record<string, string>;\n\n /**\n * Translator function to be used for text blocks\n */\n translator?: PlasmicTranslator;\n\n /**\n * Head component to use in PlasmicHead component (e.g. Head from next/head\n * or Helmet from react-helmet).\n */\n Head?: React.ComponentType<any>;\n\n /**\n * Link component to use. Can be any component that takes in props passed\n * to an <a/> tag.\n */\n Link?: React.ComponentType<any>;\n\n /**\n * Page route without params substitution (e.g. /products/[slug]).\n */\n pageRoute?: string;\n\n /**\n * Page path parameters (e.g. {slug: \"foo\"} if page path is\n * /products/[slug] and URI is /products/foo).\n */\n pageParams?: Record<string, string | string[] | undefined>;\n\n /**\n * Page query parameters (e.g. {q: \"foo\"} if page path is\n * /some/path?q=foo).\n */\n pageQuery?: Record<string, string | string[] | undefined>;\n /**\n * Whether the internal Plasmic React.Suspense boundaries should be removed\n */\n disableLoadingBoundary?: boolean;\n /**\n * Whether the root React.Suspense boundary should be removed\n */\n disableRootLoadingBoundary?: boolean;\n /**\n * Fallback value for React.Suspense boundary\n */\n suspenseFallback?: React.ReactNode;\n } & PlasmicDataSourceContextValue\n) {\n const {\n globalVariants,\n prefetchedData,\n children,\n skipCss,\n skipFonts,\n prefetchedQueryData,\n suspenseForQueryData,\n globalContextsProps,\n variation,\n translator,\n Head,\n Link,\n pageRoute,\n pageParams,\n pageQuery,\n suspenseFallback,\n disableLoadingBoundary,\n disableRootLoadingBoundary,\n } = props;\n const loader = (props.loader as any)\n .__internal as InternalPlasmicComponentLoader;\n\n if (prefetchedData) {\n loader.registerPrefetchedBundle(prefetchedData.bundle);\n }\n\n const [splits, setSplits] = React.useState<Split[]>(loader.getActiveSplits());\n const forceUpdate = useForceUpdate();\n const watcher = React.useMemo(\n () => ({\n onDataFetched: () => {\n setSplits(loader.getActiveSplits());\n forceUpdate();\n },\n }),\n [loader, forceUpdate]\n );\n\n React.useEffect(() => {\n loader.subscribePlasmicRoot(watcher);\n return () => loader.unsubscribePlasmicRoot(watcher);\n }, [watcher, loader]);\n\n const currentContextValue = React.useContext(PlasmicRootContext);\n\n const { user, userAuthToken, isUserLoading, authRedirectUri } = props;\n\n const value = React.useMemo<PlasmicRootContextValue>(() => {\n // Fallback to the value in `currentContextValue` if none is provided\n const withCurrentContextValueFallback = <\n K extends keyof PlasmicRootContextValue\n >(\n v: PlasmicRootContextValue[K],\n key: K\n ): PlasmicRootContextValue[K] => {\n return (v !== undefined ? v : currentContextValue?.[key])!;\n };\n return {\n globalVariants: [\n ...mergeGlobalVariantsSpec(\n globalVariants ?? [],\n getGlobalVariantsFromSplits(splits, variation ?? {})\n ),\n ...(currentContextValue?.globalVariants ?? []),\n ],\n globalContextsProps: {\n ...(currentContextValue?.globalContextsProps ?? {}),\n ...(globalContextsProps ?? {}),\n },\n loader: withCurrentContextValueFallback(loader, \"loader\"),\n variation: {\n ...(currentContextValue?.variation ?? {}),\n ...(variation ?? {}),\n },\n translator: withCurrentContextValueFallback(translator, \"translator\"),\n Head: withCurrentContextValueFallback(Head, \"Head\"),\n Link: withCurrentContextValueFallback(Link, \"Link\"),\n user: withCurrentContextValueFallback(user, \"user\"),\n userAuthToken: withCurrentContextValueFallback(\n userAuthToken,\n \"userAuthToken\"\n ),\n isUserLoading: withCurrentContextValueFallback(\n isUserLoading,\n \"isUserLoading\"\n ),\n authRedirectUri: withCurrentContextValueFallback(\n authRedirectUri,\n \"authRedirectUri\"\n ),\n suspenseFallback: withCurrentContextValueFallback(\n suspenseFallback,\n \"suspenseFallback\"\n ),\n disableLoadingBoundary: withCurrentContextValueFallback(\n disableLoadingBoundary,\n \"disableLoadingBoundary\"\n ),\n };\n }, [\n globalVariants,\n variation,\n globalContextsProps,\n loader,\n splits,\n translator,\n Head,\n Link,\n user,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n suspenseFallback,\n disableLoadingBoundary,\n currentContextValue,\n ]);\n\n React.useEffect(() => {\n loader.trackRender({\n renderCtx: {\n // We track the provider as a single entity\n rootComponentId: \"provider\",\n teamIds: loader.getTeamIds(),\n projectIds: loader.getProjectIds(),\n },\n variation: value.variation,\n });\n }, [loader, value]);\n\n const reactMajorVersion = +React.version.split(\".\")[0];\n\n const shouldDisableRootLoadingBoundary =\n disableRootLoadingBoundary ??\n loader.getBundle().disableRootLoadingBoundaryByDefault;\n\n return (\n <PlasmicQueryDataProvider\n prefetchedCache={prefetchedQueryData}\n suspense={suspenseForQueryData}\n >\n <PlasmicRootContext.Provider value={value}>\n {!skipCss && (\n <PlasmicCss\n loader={loader}\n prefetchedData={prefetchedData}\n skipFonts={skipFonts}\n />\n )}\n <PageParamsProvider\n route={pageRoute}\n params={pageParams}\n query={pageQuery}\n >\n <MaybeWrap\n cond={!shouldDisableRootLoadingBoundary && reactMajorVersion >= 18}\n wrapper={(contents) => (\n <React.Suspense fallback={suspenseFallback ?? \"Loading...\"}>\n {contents}\n </React.Suspense>\n )}\n >\n {children}\n </MaybeWrap>\n </PageParamsProvider>\n </PlasmicRootContext.Provider>\n </PlasmicQueryDataProvider>\n );\n}\n\n/**\n * Inject all css modules as <style/> tags. We can't use the usual styleInjector postcss\n * uses because that doesn't work on the server side for SSR.\n */\nconst PlasmicCss = React.memo(function PlasmicCss(props: {\n loader: InternalPlasmicComponentLoader;\n prefetchedData?: ComponentRenderData;\n skipFonts?: boolean;\n}) {\n const { loader, prefetchedData, skipFonts } = props;\n const [useScopedCss, setUseScopedCss] = React.useState(!!prefetchedData);\n const builtCss = buildCss(loader, {\n scopedCompMetas:\n useScopedCss && prefetchedData\n ? prefetchedData.bundle.components\n : undefined,\n skipFonts,\n });\n const forceUpdate = useForceUpdate();\n const watcher = React.useMemo(\n () => ({\n onDataFetched: () => {\n // If new data has been fetched, then use all the fetched css\n setUseScopedCss(false);\n forceUpdate();\n },\n }),\n [loader, forceUpdate]\n );\n\n React.useEffect(() => {\n loader.subscribePlasmicRoot(watcher);\n return () => loader.unsubscribePlasmicRoot(watcher);\n }, [watcher, loader]);\n\n return <style dangerouslySetInnerHTML={{ __html: builtCss }} />;\n});\n\nfunction buildCss(\n loader: InternalPlasmicComponentLoader,\n opts: {\n scopedCompMetas?: ComponentMeta[];\n skipFonts?: boolean;\n }\n) {\n const { scopedCompMetas, skipFonts } = opts;\n const cssFiles =\n scopedCompMetas &&\n new Set<string>([\n \"entrypoint.css\",\n ...scopedCompMetas.map((c) => c.cssFile),\n ]);\n const cssModules = loader\n .getLookup()\n .getCss()\n .filter((f) => !cssFiles || cssFiles.has(f.fileName));\n\n const getPri = (fileName: string) => (fileName === \"entrypoint.css\" ? 0 : 1);\n const compareModules = (a: AssetModule, b: AssetModule) =>\n getPri(a.fileName) !== getPri(b.fileName)\n ? getPri(a.fileName) - getPri(b.fileName)\n : a.fileName.localeCompare(b.fileName);\n cssModules.sort(compareModules);\n\n const remoteFonts = loader.getLookup().getRemoteFonts();\n\n // Make sure the @import statements come at the front of css\n return `\n ${\n skipFonts\n ? \"\"\n : remoteFonts.map((f) => `@import url('${f.url}');`).join(\"\\n\")\n }\n ${cssModules.map((mod) => mod.source).join(\"\\n\")}\n `;\n}\n\nexport function usePlasmicRootContext() {\n return React.useContext(PlasmicRootContext);\n}\n", "import { ComponentMeta } from \"@plasmicapp/loader-core\";\nimport pascalcase from \"pascalcase\";\nimport * as React from \"react\";\n\nexport const isBrowser = typeof window !== \"undefined\";\n\nexport type ComponentLookupSpec =\n | string\n | { name: string; projectId?: string; isCode?: boolean };\n\ninterface FullNameLookupSpec {\n name: string;\n rawName?: string;\n projectId?: string;\n isCode?: boolean;\n}\n\ninterface FullPathLookupSpec {\n path: string;\n projectId?: string;\n}\n\ntype FullLookupSpec = FullNameLookupSpec | FullPathLookupSpec;\n\nexport function useForceUpdate() {\n const [, setTick] = React.useState(0);\n const update = React.useCallback(() => {\n setTick((tick) => tick + 1);\n }, []);\n return update;\n}\n\nexport function useStableLookupSpec(spec: ComponentLookupSpec) {\n return useStableLookupSpecs(spec)[0];\n}\n\nexport function useStableLookupSpecs(...specs: ComponentLookupSpec[]) {\n const [stableSpecs, setStableSpecs] = React.useState(specs);\n\n React.useEffect(() => {\n if (\n specs.length !== stableSpecs.length ||\n specs.some((s, i) => !areLookupSpecsEqual(s, stableSpecs[i]))\n ) {\n setStableSpecs(specs);\n }\n }, [specs, stableSpecs]);\n return stableSpecs;\n}\n\nfunction areLookupSpecsEqual(\n spec1: ComponentLookupSpec,\n spec2: ComponentLookupSpec\n) {\n if (spec1 === spec2) {\n return true;\n }\n if (typeof spec1 !== typeof spec2) {\n return false;\n }\n\n const fullSpec1 = toFullLookup(spec1);\n const fullSpec2 = toFullLookup(spec2);\n return (\n ((isNameSpec(fullSpec1) &&\n isNameSpec(fullSpec2) &&\n fullSpec1.name === fullSpec2.name &&\n fullSpec1.isCode === fullSpec2.isCode) ||\n (isPathSpec(fullSpec1) &&\n isPathSpec(fullSpec2) &&\n fullSpec1.path === fullSpec2.path)) &&\n fullSpec1.projectId === fullSpec2.projectId\n );\n}\n\nfunction isNameSpec(lookup: FullLookupSpec): lookup is FullNameLookupSpec {\n return \"name\" in lookup;\n}\n\nfunction isPathSpec(lookup: FullLookupSpec): lookup is FullPathLookupSpec {\n return \"path\" in lookup;\n}\n\nfunction toFullLookup(lookup: ComponentLookupSpec): FullLookupSpec {\n const namePart = typeof lookup === \"string\" ? lookup : lookup.name;\n const projectId = typeof lookup === \"string\" ? undefined : lookup.projectId;\n const codeComponent = typeof lookup === \"string\" ? undefined : lookup.isCode;\n\n if (codeComponent !== true && namePart.startsWith(\"/\")) {\n return { path: normalizePath(namePart), projectId };\n } else {\n return {\n name: codeComponent ? namePart : normalizeName(namePart),\n rawName: namePart.trim(),\n projectId,\n isCode: codeComponent,\n };\n }\n}\n\nfunction normalizePath(path: string) {\n return path.trim();\n}\n\nfunction normalizeName(name: string) {\n // Not a full normalization, but should be good enough\n return pascalcase(name).trim();\n}\n\nexport function useIsMounted(): () => boolean {\n const ref = React.useRef<boolean>(false);\n const isMounted = React.useCallback(() => ref.current, []);\n\n React.useEffect(() => {\n ref.current = true;\n return () => {\n ref.current = false;\n };\n }, []);\n\n return isMounted;\n}\n\n/**\n * Check if `lookup` resolves to `pagePath`. If it's a match, return an object\n * containing path params; otherwise, return false.\n *\n * For example,\n * - `matchesPagePath(\"/hello/[name]\", \"/hello/world\")` -> `{params: {name:\n * \"world\"}}`\n * - `matchesPagePath(\"/hello/[name]\", \"/\")` -> `false`\n * - `matchesPagePath(\"/hello/[...catchall]\", \"/hello/a/b/c\")` -> `{params: {catchall: [\"a\", \"b\", \"c\"]}}`\n * - `matchesPagePath(\"/hello/[[...catchall]]\", \"/hello/\")` -> `{params: {catchall: []}}`\n * - `matchesPagePath(\"/\", \"\")` -> `{params: {}}`\n */\nexport function matchesPagePath(pattern: string, path: string) {\n // (generated by ChatGPT 4 from the test cases)\n\n // Normalize the path and pattern by ensuring they both start and end without slashes\n const normalizedPattern = \"/\" + pattern.replace(/^\\/|\\/$/g, \"\");\n const normalizedPath = \"/\" + path.replace(/^\\/|\\/$/g, \"\");\n\n // Modify the regex to match optional leading slashes\n const regexString = normalizedPattern\n .replace(/\\/\\[\\[\\.\\.\\.([^\\]^]+)]]/g, \"(?:/([^]*))?\") // Optional catch-all\n .replace(/\\/\\[\\.\\.\\.([^\\]^]+)]/g, \"/([^]*)\") // Catch-all\n .replace(/\\[([^\\]^]+)]/g, \"([^/]+)\") // Normal slug\n .replace(/\\//g, \"\\\\/\"); // Escape forward slashes\n\n const regex = new RegExp(`^/?${regexString}$`); // Allow optional leading slash\n const match = normalizedPath.match(regex);\n\n if (!match) return false;\n\n // Extract slug names from pattern\n const slugNames = [...pattern.matchAll(/\\[\\.?\\.?\\.?([^[\\]]+)]/g)].map(\n (m) => m[1]\n );\n\n // Construct params object\n const params: Record<string, string | string[]> = {};\n for (let i = 0; i < slugNames.length; i++) {\n const slugName = slugNames[i];\n const value = match[i + 1];\n\n if (pattern.includes(`[[...${slugName}]]`)) {\n // Handle optional catchall slugs\n params[slugName] = value ? value.split(\"/\").filter(Boolean) : [];\n } else if (pattern.includes(`[...${slugName}]`)) {\n // Handle mandatory catchall slugs\n params[slugName] = value.split(\"/\").filter(Boolean);\n } else if (value !== undefined) {\n // Handle normal slugs\n params[slugName] = value;\n }\n }\n\n return { params };\n}\n\nexport function isDynamicPagePath(path: string): boolean {\n return !!path.match(/\\[[^/]*\\]/);\n}\n\nfunction matchesCompMeta(lookup: FullLookupSpec, meta: ComponentMeta) {\n if (lookup.projectId && meta.projectId !== lookup.projectId) {\n return false;\n }\n\n return isNameSpec(lookup)\n ? (lookup.name === meta.name ||\n lookup.rawName === meta.name ||\n lookup.rawName === meta.displayName) &&\n (lookup.isCode == null || lookup.isCode === meta.isCode)\n : !!(meta.path && matchesPagePath(meta.path, lookup.path));\n}\n\nexport function getCompMetas(\n metas: ComponentMeta[],\n lookup: ComponentLookupSpec\n) {\n const full = toFullLookup(lookup);\n return metas\n .filter((meta) => matchesCompMeta(full, meta))\n .map<ComponentMeta & { params?: Record<string, string | string[]> }>(\n (meta) => {\n if (isNameSpec(full) || !meta.path) {\n return meta;\n }\n\n const match = matchesPagePath(meta.path, full.path);\n if (!match) {\n return meta;\n }\n\n return { ...meta, params: match.params };\n }\n )\n .sort(\n (meta1, meta2) =>\n // We sort the matched component metas by the number of path params, so\n // if there are two pages `/products/foo` and `/products/[slug]`,\n // the first one will have higher precedence.\n Array.from(Object.keys(meta1.params || {})).length -\n Array.from(Object.keys(meta2.params || {})).length\n );\n}\n\nexport function getLookupSpecName(lookup: ComponentLookupSpec) {\n if (typeof lookup === \"string\") {\n return lookup;\n } else if (lookup.projectId) {\n return `${lookup.name} (project ${lookup.projectId})`;\n } else {\n return lookup.name;\n }\n}\n\nexport function MaybeWrap(props: {\n children: React.ReactNode;\n cond: boolean;\n wrapper: (children: React.ReactNode) => React.ReactElement;\n}) {\n return (\n props.cond ? props.wrapper(props.children) : props.children\n ) as React.ReactElement;\n}\n\nexport function uniq<T>(elements: T[]): T[] {\n return Array.from(new Set(elements));\n}\n\nexport function uniqBy<T, K>(elements: T[], iterator: (elt: T) => K): T[] {\n const vis = new Set<K>();\n const filtered: T[] = [];\n for (const elt of elements) {\n const key = iterator(elt);\n if (!vis.has(key)) {\n vis.add(key);\n filtered.push(elt);\n }\n }\n return filtered;\n}\n\nexport function intersect<T>(a: T[], b: T[]): T[] {\n const setB = new Set(b);\n return a.filter((elt) => setB.has(elt));\n}\n", "import type {\n ExperimentSlice,\n SegmentSlice,\n Split,\n} from \"@plasmicapp/loader-core\";\nimport type { GlobalVariantSpec } from \"./PlasmicRootProvider\";\n\nexport function getPlasmicCookieValues() {\n return Object.fromEntries(\n document.cookie\n .split(\"; \")\n .filter((cookie) => cookie.includes(\"plasmic:\"))\n .map((cookie) => cookie.split(\"=\"))\n .map(([key, value]) => [key.split(\":\")[1], value])\n );\n}\n\nexport function updatePlasmicCookieValue(key: string, value: string) {\n document.cookie = `plasmic:${key}=${value}`;\n}\n\nexport const getGlobalVariantsFromSplits = (\n splits: Split[],\n variation: Record<string, string>\n) => {\n const globalVariants: GlobalVariantSpec[] = [];\n\n Object.keys(variation).map((variationKey: string) => {\n const [_type, splitId] = variationKey.split(\".\");\n const sliceId = variation[variationKey];\n const split = splits.find(\n (s) => s.id === splitId || s.externalId === splitId\n );\n if (split) {\n const slice: ExperimentSlice | SegmentSlice | undefined = (\n split.slices as Array<ExperimentSlice | SegmentSlice>\n ).find((s: any) => s.id === sliceId || s.externalId === sliceId);\n if (slice) {\n slice.contents.map((x) => {\n globalVariants.push({\n name: x.group,\n value: x.variant,\n projectId: x.projectId,\n });\n });\n }\n }\n });\n\n return globalVariants;\n};\n\nexport const mergeGlobalVariantsSpec = (\n target: GlobalVariantSpec[],\n from: GlobalVariantSpec[]\n) => {\n let result = [...target];\n const existingGlobalVariants = new Set(\n target.map((t) => `${t.name}-${t.projectId ?? \"\"}`)\n );\n const newGlobals = from.filter(\n (t) => !existingGlobalVariants.has(`${t.name}-${t.projectId ?? \"\"}`)\n );\n\n if (newGlobals.length > 0) {\n result = [...result, ...newGlobals];\n }\n\n return result;\n};\n", "/**\n * We don't actually make use of the global variant React contexts generated\n * in the bundle. That's because we would have to wait until the data is\n * loaded before we can set up the context providers, but setting up context\n * providers will mutate the React tree and invalidate all the children. That means\n * once data comes in, we'll re-render the React tree from the providers down\n * in a way that will lose all existing React state. Therefore, instead,\n * we always have a single context provided -- the PlasmicRootContext -- and we\n * create these fake useGlobalVariant() hooks that just read from that\n * PlasmicRootContext. This allows us to have a stable React tree before and\n * after the data load.\n */\n\nimport { InternalPlasmicComponentLoader } from \"./loader-client\";\nimport { usePlasmicRootContext } from \"./PlasmicRootProvider\";\n\nexport function createUseGlobalVariant(name: string, projectId: string) {\n return () => {\n const rootContext = usePlasmicRootContext();\n if (!rootContext) {\n return undefined;\n }\n\n const loader = rootContext.loader as InternalPlasmicComponentLoader;\n const spec = [\n ...loader.getGlobalVariants(),\n ...(rootContext.globalVariants ?? []),\n ].find(\n (spec2) =>\n spec2.name === name &&\n (!spec2.projectId || spec2.projectId === projectId)\n );\n return spec ? spec.value : undefined;\n };\n}\n", "import type {\n ComponentHelpers,\n ComponentHelpers as InternalCodeComponentHelpers,\n CodeComponentMeta as InternalCodeComponentMeta,\n CustomFunctionMeta as InternalCustomFunctionMeta,\n GlobalContextMeta as InternalGlobalContextMeta,\n StateHelpers,\n StateSpec,\n TokenRegistration,\n TraitMeta,\n useDataEnv,\n useSelector,\n useSelectors,\n} from \"@plasmicapp/host\";\nimport {\n LoaderBundleCache,\n PageMeta,\n PlasmicModulesFetcher,\n PlasmicTracker,\n Registry,\n TrackRenderOptions,\n} from \"@plasmicapp/loader-core\";\nimport {\n CodeModule,\n ComponentMeta,\n LoaderBundleOutput,\n internal_getCachedBundleInNodeServer,\n} from \"@plasmicapp/loader-fetcher\";\nimport { getActiveVariation, getExternalIds } from \"@plasmicapp/loader-splits\";\nimport type { useMutablePlasmicQueryData } from \"@plasmicapp/query\";\nimport type { GlobalVariantSpec } from \"./PlasmicRootProvider\";\nimport { mergeBundles, prepComponentData } from \"./bundles\";\nimport { ComponentLookup } from \"./component-lookup\";\nimport {\n ComponentLookupSpec,\n getCompMetas,\n getLookupSpecName,\n isBrowser,\n isDynamicPagePath,\n uniq,\n} from \"./utils\";\nimport { getPlasmicCookieValues, updatePlasmicCookieValue } from \"./variation\";\n\nexport interface InitOptions {\n projects: {\n id: string;\n token: string;\n version?: string;\n }[];\n cache?: LoaderBundleCache;\n platform?: \"react\" | \"nextjs\" | \"gatsby\";\n platformOptions?: {\n nextjs?: {\n appDir: boolean;\n };\n };\n preview?: boolean;\n host?: string;\n onClientSideFetch?: \"warn\" | \"error\";\n i18n?: {\n keyScheme: \"content\" | \"hash\" | \"path\";\n tagPrefix?: string;\n };\n /**\n * @deprecated use i18n.keyScheme instead\n */\n i18nKeyScheme?: \"content\" | \"hash\";\n\n /**\n * By default, fetchComponentData() and fetchPages() calls cached in memory\n * with the PlasmicComponentLoader instance. If alwaysFresh is true, then\n * data is always freshly fetched over the network.\n */\n alwaysFresh?: boolean;\n\n /**\n * If true, generated code from the server won't include page metadata tags\n */\n skipHead?: boolean;\n\n /**\n * If true, uses browser / node's native fetch\n */\n nativeFetch?: boolean;\n\n /**\n * If true, will not redirect to the codegen server automatically, and will\n * try to reuse the existing bundle in the cache.\n */\n manualRedirect?: boolean;\n}\n\nexport interface ComponentRenderData {\n entryCompMetas: (ComponentMeta & { params?: Record<string, string> })[];\n bundle: LoaderBundleOutput;\n remoteFontUrls: string[];\n}\n\nexport interface ComponentSubstitutionSpec {\n lookup: ComponentLookupSpec;\n component: React.ComponentType<any>;\n codeComponentHelpers?: InternalCodeComponentHelpers<\n React.ComponentProps<any>\n >;\n}\n\nexport interface PlasmicRootWatcher {\n onDataFetched?: () => void;\n}\n\n/**\n * Helper functions to describe code component behaviors, in order to allow\n * data extraction in RSC / Next.js App routing.\n */\nexport interface ReactServerOps {\n readDataEnv: typeof useDataEnv;\n readDataSelector: typeof useSelector;\n readDataSelectors: typeof useSelectors;\n /**\n * The contexts are passed using a key instead of the context provider\n * Notice it cannot access the default context value if none has been provided,\n * since React server components cannot create contexts.\n */\n readContext: (contextKey: string) => any;\n /**\n * Allows data fetching from the code component and caching the result,\n * which will be stored in the `queryCache` returned by\n * `extractPlasmicQueryData`.\n */\n fetchData: typeof useMutablePlasmicQueryData;\n}\n\n/**\n * Represents data provided by a code component via `DataProvider`\n */\nexport interface ServerProvidedData {\n name: string;\n data: any;\n}\n\n/**\n * Provides a new value for a given context key, similar to Context.Provider.\n * The context itself is not available (RSC doesn't allow calling\n * `createContext`) so each context will need to be represented as a unique\n * \"context key\". Also it means the default context value is not available\n * in case no value is passed (and reading that context will return `undefined`)\n */\nexport interface ServerProvidedContext {\n /**\n * Identifier to the context, required to read it later via\n * `ReactServerOps.readContext()`.\n */\n contextKey: string;\n /**\n * Context value being provided (similar to `Context.Provider`).\n */\n value: any;\n}\n\n/**\n * Each child of a code component might receive separate `DataProvider` and\n * Context values.\n */\nexport interface ServerChildData {\n providedData?: ServerProvidedData | ServerProvidedData[];\n providedContexts?: ServerProvidedContext | ServerProvidedContext[];\n node: React.ReactNode;\n}\n\nexport interface ServerInfo {\n /**\n * Optional: Indicates the React Nodes created by the component and the\n * respective contexts provided to them. If not specified, it will render the\n * children passed to the component as props.\n */\n children?: ServerChildData | ServerChildData[];\n providedData?: ServerProvidedData | ServerProvidedData[];\n providedContexts?: ServerProvidedContext | ServerProvidedContext[];\n}\n\nexport type CodeComponentMeta<P> = Omit<\n InternalCodeComponentMeta<P>,\n \"importPath\" | \"componentHelpers\" | \"states\"\n> & {\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n * Optional: not used by Plasmic headless API, only by codegen.\n */\n importPath?: string;\n /**\n * The states helpers are registered together with the states for the Plasmic headless API\n */\n states?: Record<string, StateSpec<P> & StateHelpers<P, any>>;\n\n /**\n * Helper function to enable data extraction when running Plasmic from\n * Next.js App Router.\n */\n getServerInfo?: (props: P, ops: ReactServerOps) => ServerInfo;\n};\n\nexport type GlobalContextMeta<P> = Omit<\n InternalGlobalContextMeta<P>,\n \"importPath\"\n> & {\n /**\n * The path to be used when importing the component in the generated code.\n * It can be the name of the package that contains the component, or the path\n * to the file in the project (relative to the root directory).\n * Optional: not used by Plasmic headless API, only by codegen.\n */\n importPath?: string;\n};\n\nexport type CustomFunctionMeta<F extends (...args: any[]) => any> = Omit<\n InternalCustomFunctionMeta<F>,\n \"importPath\"\n> & {\n /**\n * The path to be used when importing the function in the generated code.\n * It can be the name of the package that contains the function, or the path\n * to the file in the project (relative to the root directory).\n * Optional: not used by Plasmic headless API, only by codegen.\n */\n importPath?: string;\n};\n\nexport type FetchPagesOpts = {\n /**\n * Whether to include dynamic pages in fetchPages() output. A page is\n * considered dynamic if its path contains some param between brackets,\n * e.g. \"[slug]\".\n */\n includeDynamicPages?: boolean;\n};\n\nexport const SUBSTITUTED_COMPONENTS: Record<\n string,\n React.ComponentType<any>\n> = {};\nexport const REGISTERED_CODE_COMPONENT_HELPERS: Record<\n string,\n InternalCodeComponentHelpers<React.ComponentProps<any>>\n> = {};\nexport const SUBSTITUTED_GLOBAL_VARIANT_HOOKS: Record<string, () => any> = {};\nexport const REGISTERED_CUSTOM_FUNCTIONS: Record<\n string,\n (...args: any[]) => any\n> = {};\n\nexport function customFunctionImportAlias<F extends (...args: any[]) => any>(\n meta: CustomFunctionMeta<F>\n) {\n const customFunctionPrefix = `__fn_`;\n return meta.namespace\n ? `${customFunctionPrefix}${meta.namespace}__${meta.name}`\n : `${customFunctionPrefix}${meta.name}`;\n}\n\nexport function internalSetRegisteredFunction<\n F extends (...args: any[]) => any\n>(fn: F, meta: CustomFunctionMeta<F>) {\n REGISTERED_CUSTOM_FUNCTIONS[customFunctionImportAlias(meta)] = fn;\n}\n\ninterface BuiltinRegisteredModules {\n react: typeof import(\"react\");\n \"react-dom\": typeof import(\"react-dom\");\n \"react/jsx-runtime\": typeof import(\"react/jsx-runtime\");\n \"react/jsx-dev-runtime\": typeof import(\"react/jsx-dev-runtime\");\n \"@plasmicapp/query\": typeof import(\"@plasmicapp/query\");\n \"@plasmicapp/data-sources-context\": typeof import(\"@plasmicapp/data-sources-context\");\n \"@plasmicapp/host\": typeof import(\"@plasmicapp/host\");\n \"@plasmicapp/host/registerFunction\": typeof import(\"@plasmicapp/host\").registerFunction;\n \"@plasmicapp/loader-runtime-registry\": {\n components: Record<string, React.ComponentType<any>>;\n globalVariantHooks: Record<string, () => any>;\n codeComponentHelpers: Record<string, ComponentHelpers<any>>;\n functions: Record<string, (...args: any[]) => any>;\n };\n}\n\nexport interface FetchComponentDataOpts {\n /**\n * Will fetch either code targeting SSR or browser hydration in the\n * returned bundle.\n *\n * By default, the target is browser. That's okay, because even when\n * doing SSR, as long as you are using the same instance of PlasmicLoader\n * that was used to fetch component data, it will still know how to get at\n * the server code.\n *\n * But, if you are building your own SSR solution, where fetching and rendering\n * are using different instances of PlasmicLoader, then you'll want to make\n * sure that when you fetch, you are fetching the right one to be used in the\n * right environment for either SSR or browser hydration.\n */\n target?: \"server\" | \"browser\";\n}\n\nfunction parseFetchComponentDataArgs(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n): { specs: ComponentLookupSpec[]; opts?: FetchComponentDataOpts };\nfunction parseFetchComponentDataArgs(...specs: ComponentLookupSpec[]): {\n specs: ComponentLookupSpec[];\n opts?: FetchComponentDataOpts;\n};\nfunction parseFetchComponentDataArgs(...args: any[]) {\n let specs: ComponentLookupSpec[];\n let opts: FetchComponentDataOpts | undefined;\n if (Array.isArray(args[0])) {\n specs = args[0];\n opts = args[1];\n } else {\n specs = args;\n opts = undefined;\n }\n return { specs, opts };\n}\n\n/** Subset of loader functionality that works on Client and React Server Components. */\nexport abstract class BaseInternalPlasmicComponentLoader {\n public readonly opts: InitOptions;\n private readonly registry = new Registry();\n private readonly tracker: PlasmicTracker;\n private readonly fetcher: PlasmicModulesFetcher;\n private readonly onBundleMerged?: () => void;\n private readonly onBundleFetched?: () => void;\n private globalVariants: GlobalVariantSpec[] = [];\n private subs: ComponentSubstitutionSpec[] = [];\n\n private bundle: LoaderBundleOutput = {\n modules: {\n browser: [],\n server: [],\n },\n components: [],\n globalGroups: [],\n projects: [],\n activeSplits: [],\n bundleKey: null,\n deferChunksByDefault: false,\n disableRootLoadingBoundaryByDefault: false,\n filteredIds: {},\n };\n\n constructor(args: {\n opts: InitOptions;\n fetcher: PlasmicModulesFetcher;\n tracker: PlasmicTracker;\n /** Called after `mergeBundle` (including `fetch` calls). */\n onBundleMerged?: () => void;\n /** Called after any `fetch` calls. */\n onBundleFetched?: () => void;\n builtinModules: BuiltinRegisteredModules;\n }) {\n this.opts = args.opts;\n this.fetcher = args.fetcher;\n this.tracker = args.tracker;\n this.onBundleMerged = args.onBundleMerged;\n this.onBundleFetched = args.onBundleFetched;\n this.registerModules(args.builtinModules);\n }\n\n private maybeGetCompMetas(...specs: ComponentLookupSpec[]) {\n const found = new Set<ComponentMeta>();\n const missing: ComponentLookupSpec[] = [];\n for (const spec of specs) {\n const filteredMetas = getCompMetas(this.bundle.components, spec);\n if (filteredMetas.length > 0) {\n filteredMetas.forEach((meta) => found.add(meta));\n } else {\n missing.push(spec);\n }\n }\n return { found: Array.from(found.keys()), missing };\n }\n\n async maybeFetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n ...args: any[]\n ): Promise<ComponentRenderData | null> {\n const { specs, opts } = parseFetchComponentDataArgs(...args);\n const returnWithSpecsToFetch = async (\n specsToFetch: ComponentLookupSpec[]\n ) => {\n await this.fetchMissingData({ missingSpecs: specsToFetch });\n const { found: existingMetas2, missing: missingSpecs2 } =\n this.maybeGetCompMetas(...specs);\n if (missingSpecs2.length > 0) {\n return null;\n }\n\n return prepComponentData(this.bundle, existingMetas2, opts);\n };\n\n if (this.opts.alwaysFresh) {\n // If alwaysFresh, then we treat all specs as missing\n return await returnWithSpecsToFetch(specs);\n }\n\n // Else we only fetch actually missing specs\n const { found: existingMetas, missing: missingSpecs } =\n this.maybeGetCompMetas(...specs);\n if (missingSpecs.length === 0) {\n return prepComponentData(this.bundle, existingMetas, opts);\n }\n\n return await returnWithSpecsToFetch(missingSpecs);\n }\n\n async fetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData>;\n async fetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData>;\n async fetchComponentData(...args: any[]): Promise<ComponentRenderData> {\n const { specs, opts } = parseFetchComponentDataArgs(...args);\n const data = await this.maybeFetchComponentData(specs, opts);\n\n if (!data) {\n const { missing: missingSpecs } = this.maybeGetCompMetas(...specs);\n throw new Error(\n `Unable to find components ${missingSpecs\n .map(getLookupSpecName)\n .join(\", \")}`\n );\n }\n\n return data;\n }\n\n async fetchPages(opts?: FetchPagesOpts) {\n this.maybeReportClientSideFetch(\n () => `Plasmic: fetching all page metadata in the browser`\n );\n const data = await this.fetchAllData();\n return data.components.filter(\n (comp) =>\n comp.isPage &&\n comp.path &&\n (opts?.includeDynamicPages || !isDynamicPagePath(comp.path))\n ) as PageMeta[];\n }\n\n async fetchComponents() {\n this.maybeReportClientSideFetch(\n () => `Plasmic: fetching all component metadata in the browser`\n );\n const data = await this.fetchAllData();\n return data.components;\n }\n\n getActiveSplits() {\n return this.bundle.activeSplits;\n }\n\n getChunksUrl(bundle: LoaderBundleOutput, modules: CodeModule[]) {\n return this.fetcher.getChunksUrl(bundle, modules);\n }\n\n private async fetchMissingData(opts: {\n missingSpecs: ComponentLookupSpec[];\n }) {\n // TODO: do better than just fetching everything\n this.maybeReportClientSideFetch(\n () =>\n `Plasmic: fetching missing components in the browser: ${opts.missingSpecs\n .map((spec) => getLookupSpecName(spec))\n .join(\", \")}`\n );\n return this.fetchAllData();\n }\n\n private maybeReportClientSideFetch(mkMsg: () => string) {\n if (isBrowser && this.opts.onClientSideFetch) {\n const msg = mkMsg();\n if (this.opts.onClientSideFetch === \"warn\") {\n console.warn(msg);\n } else {\n throw new Error(msg);\n }\n }\n }\n\n private async fetchAllData() {\n const bundle = await this.fetcher.fetchAllData();\n this.tracker.trackFetch();\n this.mergeBundle(bundle);\n this.onBundleFetched?.();\n return bundle;\n }\n\n mergeBundle(newBundle: LoaderBundleOutput) {\n newBundle.bundleKey = newBundle.bundleKey ?? null;\n if (\n newBundle.bundleKey &&\n this.bundle.bundleKey &&\n newBundle.bundleKey !== this.bundle.bundleKey\n ) {\n console.warn(\n `Plasmic Error: Different code export hashes. This can happen if your app is using different loaders with different project IDs or project versions.\nConflicting values:\n${newBundle.bundleKey}\n${this.bundle.bundleKey}`\n );\n }\n // Merge the old bundle into the new bundle, this way\n // the new bundle will enforce the latest data from the server\n // allowing elements to be deleted by newer bundles\n this.bundle = mergeBundles(newBundle, this.bundle);\n\n this.onBundleMerged?.();\n }\n\n getBundle(): LoaderBundleOutput {\n return this.bundle;\n }\n\n clearCache() {\n this.bundle = {\n modules: {\n browser: [],\n server: [],\n },\n components: [],\n globalGroups: [],\n projects: [],\n activeSplits: [],\n bundleKey: null,\n deferChunksByDefault: false,\n disableRootLoadingBoundaryByDefault: false,\n filteredIds: {},\n };\n this.registry.clear();\n }\n\n registerModules(modules: Record<string, any>) {\n if (\n Object.keys(modules).some(\n (name) => this.registry.getRegisteredModule(name) !== modules[name]\n )\n ) {\n if (!this.registry.isEmpty()) {\n console.warn(\n \"Calling PlasmicComponentLoader.registerModules() after Plasmic component has rendered; starting over.\"\n );\n this.registry.clear();\n }\n for (const key of Object.keys(modules)) {\n this.registry.register(key, modules[key]);\n }\n }\n }\n\n substituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec\n ) {\n this.internalSubstituteComponent(component, name, undefined);\n }\n\n protected internalSubstituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec,\n codeComponentHelpers:\n | InternalCodeComponentHelpers<\n React.ComponentProps<React.ComponentType<P>>\n >\n | undefined\n ) {\n if (!this.isRegistryEmpty()) {\n console.warn(\n \"Calling PlasmicComponentLoader.registerSubstitution() after Plasmic component has rendered; starting over.\"\n );\n this.clearRegistry();\n }\n this.subs.push({ lookup: name, component, codeComponentHelpers });\n }\n\n abstract registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n ): void;\n abstract registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n ): void;\n abstract registerGlobalContext<T extends React.ComponentType<any>>(\n context: T,\n meta: GlobalContextMeta<React.ComponentProps<T>>\n ): void;\n abstract registerTrait(trait: string, meta: TraitMeta): void;\n abstract registerToken(token: TokenRegistration): void;\n\n protected refreshRegistry() {\n // Once we have received data, we register components to\n // substitute. We had to wait for data to do this so\n // that we can look up the right module name to substitute\n // in component meta.\n for (const sub of this.subs) {\n const metas = getCompMetas(this.getBundle().components, sub.lookup);\n metas.forEach((meta) => {\n SUBSTITUTED_COMPONENTS[meta.id] = sub.component;\n if (sub.codeComponentHelpers) {\n REGISTERED_CODE_COMPONENT_HELPERS[meta.id] = sub.codeComponentHelpers;\n }\n });\n }\n\n this.registry.updateModules(this.getBundle());\n }\n\n isRegistryEmpty() {\n return this.registry.isEmpty();\n }\n\n clearRegistry() {\n this.registry.clear();\n }\n\n setGlobalVariants(globalVariants: GlobalVariantSpec[]) {\n this.globalVariants = globalVariants;\n }\n\n getGlobalVariants() {\n return this.globalVariants;\n }\n\n registerPrefetchedBundle(bundle: LoaderBundleOutput) {\n // For React Server Components (Next.js 13+),\n // we need to pass server modules in LoaderBundleOutput from Server Components to Client Components.\n // We don't want to pass them via normal page props because that will be serialized to the browser.\n // Instead, we pass the bundle (including the server modules) via the Node `global` variable.\n //\n // This is the code that reads the stored bundle and merges it back into the loader.\n if (!isBrowser) {\n // Check if we have a cached bundle on this Node server.\n const cachedBundle = internal_getCachedBundleInNodeServer(this.opts);\n if (cachedBundle) {\n // If it's there, merge the cached bundle first.\n this.mergeBundle(cachedBundle);\n }\n }\n this.mergeBundle(bundle);\n }\n\n getLookup() {\n return new ComponentLookup(this.getBundle(), this.registry);\n }\n\n trackConversion(value = 0) {\n this.tracker.trackConversion(value);\n }\n\n public async getActiveVariation(\n opts: Omit<Parameters<typeof getActiveVariation>[0], \"splits\">\n ) {\n await this.fetchComponents();\n return getActiveVariation({\n ...opts,\n splits: this.getBundle().activeSplits,\n });\n }\n\n public getTeamIds(): string[] {\n return uniq(\n this.getBundle()\n .projects.map((p) =>\n p.teamId ? `${p.teamId}${p.indirect ? \"@indirect\" : \"\"}` : null\n )\n .filter((x): x is string => !!x)\n );\n }\n\n public getProjectIds(): string[] {\n return uniq(\n this.getBundle().projects.map(\n (p) => `${p.id}${p.indirect ? \"@indirect\" : \"\"}`\n )\n );\n }\n\n public trackRender(opts?: TrackRenderOptions) {\n this.tracker.trackRender(opts);\n }\n\n public loadServerQueriesModule(fileName: string) {\n return this.registry.load(fileName);\n }\n}\n\n/**\n * Library for fetching component data, and registering\n * custom components.\n */\nexport class PlasmicComponentLoader {\n private __internal: BaseInternalPlasmicComponentLoader;\n\n constructor(internal: BaseInternalPlasmicComponentLoader) {\n this.__internal = internal;\n }\n\n /**\n * Sets global variants to be used for all components. Note that\n * this is not reactive, and will not re-render all components\n * already mounted; instead, it should be used to activate global\n * variants that should always be activated for the lifetime of this\n * app. If you'd like to reactively change the global variants,\n * you should specify them via <PlasmicRootProvider />\n */\n setGlobalVariants(globalVariants: GlobalVariantSpec[]) {\n this.__internal.setGlobalVariants(globalVariants);\n }\n\n registerModules(modules: Record<string, any>) {\n this.__internal.registerModules(modules);\n }\n\n /**\n * Register custom components that should be swapped in for\n * components defined in your project. You can use this to\n * swap in / substitute a Plasmic component with a \"real\" component.\n */\n substituteComponent<P>(\n component: React.ComponentType<P>,\n name: ComponentLookupSpec\n ) {\n this.__internal.substituteComponent(component, name);\n }\n\n /**\n * Register code components to be used on Plasmic Editor.\n */\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n meta: CodeComponentMeta<React.ComponentProps<T>>\n ): void;\n\n /**\n * [[deprecated]] Please use `substituteComponent` instead for component\n * substitution, or the other `registerComponent` overload to register\n * code components to be used on Plasmic Editor.\n *\n * @see `substituteComponent`\n */\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n name: ComponentLookupSpec\n ): void;\n\n registerComponent<T extends React.ComponentType<any>>(\n component: T,\n metaOrName: ComponentLookupSpec | CodeComponentMeta<React.ComponentProps<T>>\n ) {\n // 'props' is a required field in CodeComponentMeta\n if (metaOrName && typeof metaOrName === \"object\" && \"props\" in metaOrName) {\n this.__internal.registerComponent(component, metaOrName);\n } else {\n // Deprecated call\n if (\n process.env.NODE_ENV === \"development\" &&\n !this.warnedRegisterComponent\n ) {\n console.warn(\n `PlasmicLoader: Using deprecated method \\`registerComponent\\` for component substitution. ` +\n `Please consider using \\`substituteComponent\\` instead.`\n );\n this.warnedRegisterComponent = true;\n }\n this.substituteComponent(component, metaOrName);\n }\n }\n private warnedRegisterComponent = false;\n\n registerFunction<F extends (...args: any[]) => any>(\n fn: F,\n meta: CustomFunctionMeta<F>\n ) {\n this.__internal.registerFunction(fn, meta);\n }\n\n registerGlobalContext<T extends React.ComponentType<any>>(\n context: T,\n meta: GlobalContextMeta<React.ComponentProps<T>>\n ) {\n this.__internal.registerGlobalContext(context, meta);\n }\n\n registerTrait(trait: string, meta: TraitMeta) {\n this.__internal.registerTrait(trait, meta);\n }\n\n registerToken(token: TokenRegistration) {\n this.__internal.registerToken(token);\n }\n\n /**\n * Pre-fetches component data needed to for PlasmicLoader to render\n * these components. Should be passed into PlasmicRootProvider as\n * the prefetchedData prop.\n *\n * You can look up a component either by:\n * - the name of the component\n * - the path for a page component\n * - an array of strings that make up parts of the path\n * - object { name: \"name_or_path\", projectId: ...}, to specify which project\n * to use, if multiple projects have the same component name\n *\n * Throws an Error if a specified component to fetch does not exist in\n * the Plasmic project.\n */\n fetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData>;\n fetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData>;\n fetchComponentData(...args: any[]): Promise<ComponentRenderData> {\n return this.__internal.fetchComponentData(...args);\n }\n\n /**\n * Like fetchComponentData(), but returns null instead of throwing an Error\n * when a component is not found. Useful when you are implementing a catch-all\n * page and want to check if a specific path had been defined for Plasmic.\n */\n async maybeFetchComponentData(\n ...specs: ComponentLookupSpec[]\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n specs: ComponentLookupSpec[],\n opts?: FetchComponentDataOpts\n ): Promise<ComponentRenderData | null>;\n async maybeFetchComponentData(\n ...args: any[]\n ): Promise<ComponentRenderData | null> {\n return this.__internal.maybeFetchComponentData(...args);\n }\n\n /**\n * Returns all the page component metadata for these projects.\n */\n async fetchPages(opts?: FetchPagesOpts) {\n return this.__internal.fetchPages(opts);\n }\n\n /**\n * Returns all components metadata for these projects.\n */\n async fetchComponents() {\n return this.__internal.fetchComponents();\n }\n\n protected async _getActiveVariation(\n opts: Parameters<typeof this.__internal.getActiveVariation>[0]\n ) {\n return this.__internal.getActiveVariation(opts);\n }\n\n async getActiveVariation(opts: {\n known?: Record<string, string>;\n traits: Record<string, string | number | boolean>;\n }) {\n return this._getActiveVariation({\n traits: opts.traits,\n getKnownValue: (key: string) => {\n if (opts.known) {\n return opts.known[key];\n } else {\n const cookies = getPlasmicCookieValues();\n return cookies[key];\n }\n },\n updateKnownValue: (key: string, value: string) => {\n if (!opts.known) {\n updatePlasmicCookieValue(key, value);\n }\n },\n });\n }\n\n getChunksUrl(bundle: LoaderBundleOutput, modules: CodeModule[]) {\n return this.__internal.getChunksUrl(bundle, modules);\n }\n\n getExternalVariation(\n variation: Record<string, string>,\n filters?: Parameters<typeof getExternalIds>[2]\n ) {\n return getExternalIds(this.getActiveSplits(), variation, filters);\n }\n\n getActiveSplits() {\n return this.__internal.getActiveSplits();\n }\n\n trackConversion(value = 0) {\n this.__internal.trackConversion(value);\n }\n\n clearCache() {\n return this.__internal.clearCache();\n }\n\n async unstable__getServerQueriesData(\n renderData: ComponentRenderData,\n $ctx: Record<string, any>\n ) {\n if (renderData.entryCompMetas.length === 0) {\n return {};\n }\n\n const fileName = renderData.entryCompMetas[0].serverQueriesExecFuncFileName;\n\n if (!fileName) {\n return {};\n }\n\n const module = this.__internal.loadServerQueriesModule(fileName);\n const { executeServerQueries } = module;\n\n try {\n const $serverQueries = await executeServerQueries($ctx);\n return $serverQueries;\n } catch (err) {\n console.error(\"Error executing server queries function\", err);\n return {};\n }\n }\n}\n", "import {\n ComponentMeta,\n getBundleSubset,\n LoaderBundleOutput,\n} from \"@plasmicapp/loader-core\";\nimport type { ComponentRenderData } from \"./loader-shared\";\nimport { intersect } from \"./utils\";\n\nfunction getUsedComps(allComponents: ComponentMeta[], entryCompIds: string[]) {\n const q: string[] = [...entryCompIds];\n const seenIds = new Set<string>(entryCompIds);\n const componentMetaById = new Map<string, ComponentMeta>(\n allComponents.map((meta) => [meta.id, meta])\n );\n const usedComps: ComponentMeta[] = [];\n while (q.length > 0) {\n const [id] = q.splice(0, 1);\n const meta = componentMetaById.get(id);\n if (!meta) {\n continue;\n }\n usedComps.push(meta);\n meta.usedComponents.forEach((usedCompId) => {\n if (!seenIds.has(usedCompId)) {\n seenIds.add(usedCompId);\n q.push(usedCompId);\n }\n });\n }\n return usedComps;\n}\n\nexport function prepComponentData(\n bundle: LoaderBundleOutput,\n compMetas: ComponentMeta[],\n opts?: {\n target?: \"browser\" | \"server\";\n }\n): ComponentRenderData {\n if (compMetas.length === 0) {\n return {\n entryCompMetas: bundle.components,\n bundle: bundle,\n remoteFontUrls: [],\n };\n }\n\n const usedComps = getUsedComps(\n bundle.components,\n compMetas.map((compMeta) => compMeta.id)\n );\n const compPaths = usedComps.map((compMeta) => compMeta.entry);\n const subBundle = getBundleSubset(\n bundle,\n [\n \"entrypoint.css\",\n ...compPaths,\n \"root-provider.js\",\n ...bundle.projects\n .map((x) => x.globalContextsProviderFileName)\n .filter((x) => !!x),\n // We need to explicitly include global context provider components\n // to make sure they are kept in bundle.components. That's because\n // for esbuild, just the globalContextsProviderFileName is not enough,\n // because it will import a chunk that includes the global context\n // component, instead of importing that global context component's\n // entry file. And because nothing depends on the global context component's\n // entry file, we end up excluding the global context component from\n // bundle.components, which then makes its substitution not work.\n // Instead, we forcibly include it here (we'll definitely need it anyway!).\n ...bundle.components\n .filter((c) => c.isGlobalContextProvider)\n .map((c) => c.entry),\n ...bundle.globalGroups.map((g) => g.contextFile),\n ],\n opts\n );\n\n const remoteFontUrls: string[] = [];\n subBundle.projects.forEach((p) =>\n remoteFontUrls.push(...p.remoteFonts.map((f) => f.url))\n );\n\n return {\n entryCompMetas: compMetas,\n bundle: subBundle,\n remoteFontUrls,\n };\n}\n\n// It's important to deep clone any attributes that are going to be changed in the\n// target bundle, since the build of pages can be done in multiple stages/processes\n// we don't want to mutate the original bundle, which can impact other pages.\nexport function mergeBundles(\n target: LoaderBundleOutput,\n from: LoaderBundleOutput\n) {\n const existingProjects = new Set(target.projects.map((p) => p.id));\n const newProjects = from.projects.filter((p) => !existingProjects.has(p.id));\n if (newProjects.length > 0) {\n target = {\n ...target,\n projects: [...target.projects, ...newProjects],\n };\n }\n\n const existingCompIds = new Set(target.components.map((c) => c.id));\n\n function shouldIncludeComponentInBundle(c: ComponentMeta) {\n // If the component is already present in the target bundle, don't include it\n if (existingCompIds.has(c.id)) {\n return false;\n }\n // If the component belongs to a project that is not present in the target bundle,\n // include it\n if (!existingProjects.has(c.projectId)) {\n return true;\n }\n // If the component is present in the filteredIds of the project it belongs to,\n // in the target bundle, we consider that the component was not deleted in the target\n // bundle, so we can include it\n const targetBundleFilteredIds = target.filteredIds[c.projectId] ?? [];\n return targetBundleFilteredIds.includes(c.id);\n }\n\n const newCompMetas = from.components.filter((m) =>\n shouldIncludeComponentInBundle(m)\n );\n if (newCompMetas.length > 0) {\n target = {\n ...target,\n components: [...target.components, ...newCompMetas],\n };\n\n // Deep clone the filteredIds object to avoid mutating the original bundle\n target.filteredIds = Object.fromEntries(\n Object.entries(target.filteredIds).map(([k, v]) => [k, [...v]])\n );\n\n from.projects.forEach((fromProject) => {\n const projectId = fromProject.id;\n const fromBundleFilteredIds = from.filteredIds[projectId] ?? [];\n if (!existingProjects.has(projectId)) {\n target.filteredIds[projectId] = [...fromBundleFilteredIds];\n } else {\n target.filteredIds[projectId] = intersect(\n target.filteredIds[projectId] ?? [],\n fromBundleFilteredIds\n );\n }\n });\n }\n\n const existingModules = {\n browser: new Set(target.modules.browser.map((m) => m.fileName)),\n server: new Set(target.modules.server.map((m) => m.fileName)),\n };\n const newModules = {\n browser: from.modules.browser.filter(\n (m) => !existingModules.browser.has(m.fileName)\n ),\n server: from.modules.server.filter(\n (m) => !existingModules.server.has(m.fileName)\n ),\n };\n if (newModules.browser.length > 0 || newModules.server.length > 0) {\n target = {\n ...target,\n modules: {\n browser: [...target.modules.browser, ...newModules.browser],\n server: [...target.modules.server, ...newModules.server],\n },\n };\n }\n\n const existingGlobalIds = new Set(target.globalGroups.map((g) => g.id));\n const newGlobals = from.globalGroups.filter(\n (g) => !existingGlobalIds.has(g.id)\n );\n if (newGlobals.length > 0) {\n target = {\n ...target,\n globalGroups: [...target.globalGroups, ...newGlobals],\n };\n }\n\n const existingSplitIds = new Set(target.activeSplits.map((s) => s.id));\n const newSplits =\n from.activeSplits.filter(\n // Don't include splits belonging to projects already present\n // in the target bundle\n (s) => !existingSplitIds.has(s.id) && !existingProjects.has(s.projectId)\n ) ?? [];\n if (newSplits.length > 0) {\n target = {\n ...target,\n activeSplits: [...target.activeSplits, ...newSplits],\n };\n }\n\n // Avoid `undefined` as it cannot be serialized as JSON\n target.bundleKey = target.bundleKey ?? from.bundleKey ?? null;\n target.deferChunksByDefault =\n target.deferChunksByDefault ?? from.deferChunksByDefault ?? false;\n\n target.disableRootLoadingBoundaryByDefault =\n target.disableRootLoadingBoundaryByDefault ??\n from.disableRootLoadingBoundaryByDefault ??\n false;\n\n return target;\n}\n\nexport const convertBundlesToComponentRenderData = (\n bundles: LoaderBundleOutput[],\n compMetas: ComponentMeta[]\n): ComponentRenderData | null => {\n if (bundles.length === 0) {\n return null;\n }\n\n const mergedBundles = bundles.reduce((prev, cur) => mergeBundles(prev, cur));\n return prepComponentData(mergedBundles, compMetas);\n};\n", "import {\n AssetModule,\n ComponentMeta,\n FontMeta,\n GlobalGroupMeta,\n LoaderBundleOutput,\n Registry,\n} from '@plasmicapp/loader-core';\nimport * as React from 'react';\nimport { ComponentLookupSpec, getCompMetas } from './utils';\n\nfunction getFirstCompMeta(metas: ComponentMeta[], lookup: ComponentLookupSpec) {\n const filtered = getCompMetas(metas, lookup);\n return filtered.length === 0 ? undefined : filtered[0];\n}\n\nexport class ComponentLookup {\n constructor(private bundle: LoaderBundleOutput, private registry: Registry) {}\n\n getComponentMeta(spec: ComponentLookupSpec): ComponentMeta | undefined {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n return compMeta;\n }\n\n getComponent<P extends React.ComponentType = any>(\n spec: ComponentLookupSpec,\n opts: { forceOriginal?: boolean } = {}\n ) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n if (!compMeta) {\n throw new Error(`Component not found: ${spec}`);\n }\n const moduleName = compMeta.entry;\n if (!this.registry.hasModule(moduleName, opts)) {\n throw new Error(`Component not yet fetched: ${compMeta.name}`);\n }\n const entry = this.registry.load(moduleName, {\n forceOriginal: opts.forceOriginal,\n });\n return !opts.forceOriginal &&\n typeof entry?.getPlasmicComponent === 'function'\n ? entry.getPlasmicComponent()\n : (entry.default as P);\n }\n\n hasComponent(spec: ComponentLookupSpec) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n if (compMeta) {\n return this.registry.hasModule(compMeta.entry);\n }\n return false;\n }\n\n getGlobalContexts(): { meta: GlobalGroupMeta; context: any }[] {\n const customGlobalMetas = this.bundle.globalGroups.filter(\n (m) => m.type === 'global-user-defined'\n );\n return customGlobalMetas.map((meta) => ({\n meta,\n context: this.registry.load(meta.contextFile).default,\n }));\n }\n\n getGlobalContextsProvider(spec: ComponentLookupSpec) {\n const compMeta = getFirstCompMeta(this.bundle.components, spec);\n const projectMeta = compMeta\n ? this.bundle.projects.find((x) => x.id === compMeta.projectId)\n : undefined;\n\n if (\n !projectMeta ||\n !projectMeta.globalContextsProviderFileName ||\n !this.registry.hasModule(projectMeta.globalContextsProviderFileName)\n ) {\n return undefined;\n }\n const entry = this.registry.load(\n projectMeta.globalContextsProviderFileName\n );\n\n return typeof entry?.getPlasmicComponent === 'function'\n ? entry.getPlasmicComponent()\n : entry.default;\n }\n\n getRootProvider() {\n const entry = this.registry.load('root-provider.js');\n return entry.default;\n }\n\n getCss(): AssetModule[] {\n // We can probably always get the modules from the browser build\n return this.bundle.modules.browser.filter(\n (mod) => mod.type === 'asset' && mod.fileName.endsWith('css')\n ) as AssetModule[];\n }\n\n getRemoteFonts(): FontMeta[] {\n return this.bundle.projects.flatMap((p) => p.remoteFonts);\n }\n}\n", "import { InternalPlasmicComponentLoader } from \"./loader-client\";\nimport {\n CodeComponentMeta,\n CustomFunctionMeta,\n FetchComponentDataOpts,\n InitOptions,\n PlasmicComponentLoader,\n} from \"./loader-shared\";\n\nexport {\n DataCtxReader,\n DataProvider,\n GlobalActionsContext,\n GlobalActionsProvider,\n PageParamsProvider,\n PlasmicCanvasContext,\n PlasmicCanvasHost,\n PlasmicTranslatorContext,\n repeatedElement,\n useDataEnv,\n usePlasmicCanvasComponentInfo,\n usePlasmicCanvasContext,\n useSelector,\n useSelectors,\n} from \"@plasmicapp/host\";\nexport type { PropType, TokenRegistration } from \"@plasmicapp/host\";\nexport { usePlasmicQueryData } from \"@plasmicapp/query\";\nexport { PlasmicComponent } from \"./PlasmicComponent\";\nexport { PlasmicRootProvider } from \"./PlasmicRootProvider\";\nexport type {\n GlobalVariantSpec,\n PlasmicTranslator,\n} from \"./PlasmicRootProvider\";\nexport { extractPlasmicQueryData, plasmicPrepass } from \"./prepass-client\";\nexport {\n extractPlasmicQueryDataFromElement,\n hydrateFromElement,\n renderToString,\n} from \"./render\";\nexport * from \"./shared-exports\";\nexport { usePlasmicComponent } from \"./usePlasmicComponent\";\nexport type { ComponentLookupSpec } from \"./utils\";\nexport { InternalPlasmicComponentLoader, PlasmicComponentLoader };\nexport type { CodeComponentMeta, CustomFunctionMeta, FetchComponentDataOpts };\n\nexport function initPlasmicLoader(opts: InitOptions): PlasmicComponentLoader {\n const internal = new InternalPlasmicComponentLoader(opts);\n return new PlasmicComponentLoader(internal);\n}\n", "import * as React from \"react\";\nimport { usePlasmicRootContext } from \"./PlasmicRootProvider\";\nimport { usePlasmicComponent } from \"./usePlasmicComponent\";\nimport { MaybeWrap } from \"./utils\";\n\nconst PlasmicComponentContext = React.createContext(false);\n\nexport function PlasmicComponent(props: {\n /**\n * Name of the component to render, or the path of the page component\n */\n component: string;\n /**\n * Optionally specify a projectId if there are multiple components\n * of the same name from different projects\n */\n projectId?: string;\n /**\n * If you used registerComponent(), then if the name matches a registered\n * component, that component is used. If you want the Plasmic-generated\n * component instead, specify forceOriginal.\n */\n forceOriginal?: boolean;\n componentProps?: any;\n}): React.ReactElement | null {\n const { component, projectId, componentProps, forceOriginal } = props;\n\n const rootContext = usePlasmicRootContext();\n const isRootLoader = !React.useContext(PlasmicComponentContext);\n\n if (!rootContext) {\n // no existing PlasmicRootProvider\n throw new Error(\n `You must use <PlasmicRootProvider/> at the root of your app`\n );\n }\n\n const {\n loader,\n globalContextsProps,\n variation,\n userAuthToken,\n isUserLoading,\n authRedirectUri,\n translator,\n ...rest\n } = rootContext;\n\n const Component = usePlasmicComponent(\n { name: component, projectId, isCode: false },\n { forceOriginal }\n );\n\n React.useEffect(() => {\n if (isRootLoader) {\n const meta = loader\n .getLookup()\n .getComponentMeta({ name: component, projectId });\n\n if (meta) {\n loader.trackRender({\n renderCtx: {\n rootProjectId: meta.projectId,\n rootComponentId: meta.id,\n rootComponentName: component,\n teamIds: loader.getTeamIds(),\n projectIds: loader.getProjectIds(),\n },\n variation,\n });\n }\n }\n }, [component, projectId, loader, variation]);\n\n const element = React.useMemo(() => {\n if (!Component) {\n return null;\n }\n\n let elt = <Component {...componentProps} />;\n\n if (isRootLoader) {\n // If this is the root PlasmicComponent, then wrap the content with the\n // react-web's PlasmicRootProvider. We are doing this here, instead of\n // say PlasmicRootProvider, because we don't have access to this context\n // provider until data has been loaded. If we insert this provider into\n // the tree at the root after data is loaded, then we'll invalidate the\n // React tree and tree state, which is bad. Instead, we do it at the\n // \"root-most PlasmicComponent\"; we won't risk invalidating the sub-tree\n // here because there were no children before the data came in.\n const lookup = loader.getLookup();\n const ReactWebRootProvider = lookup.getRootProvider();\n const GlobalContextsProvider = lookup.getGlobalContextsProvider({\n name: component,\n projectId,\n });\n elt = (\n <ReactWebRootProvider\n {...rest}\n userAuthToken={userAuthToken}\n isUserLoading={isUserLoading}\n authRedirectUri={authRedirectUri}\n i18n={{\n translator,\n tagPrefix: loader.opts.i18n?.tagPrefix,\n }}\n >\n <MaybeWrap\n cond={!!GlobalContextsProvider}\n wrapper={(children) => (\n <GlobalContextsProvider {...globalContextsProps}>\n {children}\n </GlobalContextsProvider>\n )}\n >\n <PlasmicComponentContext.Provider value={true}>\n {elt}\n </PlasmicComponentContext.Provider>\n </MaybeWrap>\n </ReactWebRootProvider>\n );\n }\n return elt;\n }, [\n Component,\n componentProps,\n loader,\n isRootLoader,\n component,\n projectId,\n globalContextsProps,\n userAuthToken, // Just use the token to memo, `user` should be derived from it\n isUserLoading,\n authRedirectUri,\n ]);\n return element;\n}\n", "import * as React from 'react';\nimport { usePlasmicRootContext } from './PlasmicRootProvider';\nimport {\n ComponentLookupSpec,\n useForceUpdate,\n useIsMounted,\n useStableLookupSpec,\n} from './utils';\n\n/**\n * Hook that fetches and returns a React component for rendering the argument\n * Plasmic component. Returns undefined if the component data is still\n * being fetched.\n *\n * @param opts.forceOriginal if you used PlasmicComponentLoader.registerComponent,\n * then normally usePlasmicComponent will return the registered component.\n * You can set forceOriginal to true if you want to return the Plasmic-generated\n * component instead.\n */\nexport function usePlasmicComponent<P extends React.ComponentType = any>(\n spec: ComponentLookupSpec,\n opts: { forceOriginal?: boolean } = {}\n) {\n const rootContext = usePlasmicRootContext();\n if (!rootContext) {\n throw new Error(\n `You can only use usePlasmicComponent if wrapped in <PlasmicRootProvider />`\n );\n }\n\n const loader = rootContext.loader;\n const lookup = loader.getLookup();\n\n const component = lookup.hasComponent(spec)\n ? lookup.getComponent(spec, opts)\n : undefined;\n\n const stableSpec = useStableLookupSpec(spec);\n const isMounted = useIsMounted();\n const forceUpdate = useForceUpdate();\n\n React.useEffect(() => {\n if (!component) {\n (async () => {\n await loader.fetchComponentData(stableSpec);\n if (isMounted()) {\n forceUpdate();\n }\n })();\n }\n }, [component, stableSpec]);\n\n return component as P;\n}\n", "import {\n extractPlasmicQueryData as internalExtractQueryData,\n plasmicPrepass as internalPlasmicPrepass,\n} from \"@plasmicapp/prepass\";\n\n/**\n * Performs a prepass over Plasmic content, kicking off the necessary\n * data fetches, and populating the fetched data into a cache. This\n * cache can be passed as prefetchedQueryData into PlasmicRootProvider.\n *\n * To limit rendering errors that can occur when you do this, we recommend\n * that you pass in _only_ the PlasmicComponents that you are planning to use\n * as the argument. For example:\n *\n * const cache = await extractPlasmicQueryData(\n * <PlasmicRootProvider loader={PLASMIC} prefetchedData={plasmicData}>\n * <PlasmicComponent component=\"Home\" componentProps={{\n * // Specify the component prop overrides you are planning to use\n * // to render the page, as they may change what data is fetched.\n * ...\n * }} />\n * <PlasmicComponent component=\"NavBar\" componentProps={{\n * ...\n * }} />\n * ...\n * </PlasmicRootProvider>\n * );\n *\n * If your PlasmicComponent will be wrapping components that require special\n * context set up, you should also wrap the element above with those context\n * providers.\n *\n * You should avoid passing in elements that are not related to Plasmic, as any\n * rendering errors from those elements during the prepass may result in data\n * not being populated in the cache.\n *\n * @param element a React element containing instances of PlasmicComponent.\n * Will attempt to satisfy all data needs from usePlasmicDataQuery()\n * in this element tree.\n * @returns an object mapping query key to fetched data\n */\nexport function extractPlasmicQueryData(\n element: React.ReactElement\n): Promise<Record<string, any>> {\n return internalExtractQueryData(element);\n}\n\n/**\n * @deprecated Maintained for backwards compatibility\n */\nexport function plasmicPrepass(element: React.ReactElement): Promise<void> {\n return internalPlasmicPrepass(element);\n}\n", "import { extractPlasmicQueryData } from \"@plasmicapp/prepass\";\nimport React from \"react\";\nimport ReactDOM from \"react-dom\";\nimport { renderToString as reactRenderToString } from \"react-dom/server\";\nimport { ComponentRenderData, PlasmicComponentLoader } from \"./loader-shared\";\nimport { PlasmicComponent } from \"./PlasmicComponent\";\nimport { GlobalVariantSpec, PlasmicRootProvider } from \"./PlasmicRootProvider\";\nimport { ComponentLookupSpec } from \"./utils\";\n\nexport function renderToString(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n const element = makeElement(loader, lookup, opts);\n return reactRenderToString(element);\n}\n\nexport async function extractPlasmicQueryDataFromElement(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n const element = makeElement(loader, lookup, opts);\n return extractPlasmicQueryData(element);\n}\n\nexport async function hydrateFromElement(\n loader: PlasmicComponentLoader,\n target: HTMLElement,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n } = {}\n) {\n return new Promise<void>((resolve) => {\n const element = makeElement(loader, lookup, opts);\n ReactDOM.hydrate(element, target, () => resolve());\n });\n}\n\nfunction makeElement(\n loader: PlasmicComponentLoader,\n lookup: ComponentLookupSpec,\n opts: {\n prefetchedData?: ComponentRenderData;\n componentProps?: any;\n globalVariants?: GlobalVariantSpec[];\n prefetchedQueryData?: Record<string, any>;\n pageParams?: Record<string, any>;\n pageQuery?: Record<string, any>;\n } = {}\n) {\n return (\n <PlasmicRootProvider\n loader={loader}\n prefetchedData={opts.prefetchedData}\n globalVariants={opts.globalVariants}\n prefetchedQueryData={opts.prefetchedQueryData}\n pageParams={opts.pageParams}\n pageQuery={opts.pageQuery}\n >\n <PlasmicComponent\n component={typeof lookup === \"string\" ? lookup : lookup.name}\n projectId={typeof lookup === \"string\" ? undefined : lookup.projectId}\n componentProps={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CACpB,IACA,IAOA;AAAA,6CARA,QACA,QACA,OAKI,CAAC,GACL;AACA,UAAM,UAAU,YAAY,QAAQ,QAAQ,IAAI;AAChD,WAAOC,yBAAwB,OAAO;AAAA,EACxC;AAAA;AAEA,SAAsB,mBACpB,IACA,IACA,IAOA;AAAA,6CATA,QACA,QACA,QACA,OAKI,CAAC,GACL;AACA,WAAO,IAAI,QAAc,CAAC,YAAY;AACpC,YAAM,UAAU,YAAY,QAAQ,QAAQ,IAAI;AAChD,MAAAC,UAAS,QAAQ,SAAS,QAAQ,MAAM,QAAQ,CAAC;AAAA,IACnD,CAAC;AAAA,EACH;AAAA;AAEA,SAAS,YACP,QACA,QACA,OAOI,CAAC,GACL;AACA,SACE,gBAAAC,OAAA;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,gBAAgB,KAAK;AAAA,MACrB,gBAAgB,KAAK;AAAA,MACrB,qBAAqB,KAAK;AAAA,MAC1B,YAAY,KAAK;AAAA,MACjB,WAAW,KAAK;AAAA;AAAA,IAEhB,gBAAAA,OAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAW,OAAO,WAAW,WAAW,SAAS,OAAO;AAAA,QACxD,WAAW,OAAO,WAAW,WAAW,SAAY,OAAO;AAAA,QAC3D,gBAAgB,KAAK;AAAA;AAAA,IACvB;AAAA,EACF;AAEJ;;;AJrCO,SAAS,kBAAkB,MAA2C;AAC3E,QAAM,WAAW,IAAI,+BAA+B,IAAI;AACxD,SAAO,IAAI,uBAAuB,QAAQ;AAC5C;",
|
|
6
|
+
"names": ["PlasmicModulesFetcher", "PlasmicTracker", "React", "React", "PlasmicCss", "_a", "_b", "PlasmicTracker", "PlasmicModulesFetcher", "React", "PageParamsProvider", "React", "React", "_a", "extractPlasmicQueryData", "React", "ReactDOM", "extractPlasmicQueryData", "ReactDOM", "React"]
|
|
7
7
|
}
|