@hubspot/cms-dev-server 1.0.19 → 1.0.29

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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/storybook/moduleStory.tsx", "../../../cms-js-internal/dist/basicUtils.js", "../../../cms-js-internal/dist/index.js", "../../src/storybook/getFieldsArgTypes.ts", "../../src/storybook/getNestedFieldObjectForArgs.ts"],
4
+ "sourcesContent": ["import React, { useEffect } from 'react';\nimport {\n renderFieldsToJson,\n namespaceModulePropsShape,\n} from '@hubspot/cms-js-internal';\nimport { ModuleProps } from '@hubspot/cms-components';\nimport getFieldsArgTypes from './getFieldsArgTypes.js';\nimport getNestedFieldObjectForArgs from './getNestedFieldObjectForArgs.js';\nimport { Args, ArgTypes, ModuleStory } from './types.js';\n\nfunction moduleArgs(argTypes: ArgTypes) {\n const args = {};\n for (const argKey in argTypes) {\n if (Object.hasOwnProperty.call(argTypes, argKey)) {\n args[argKey] = argTypes[argKey].defaultValue;\n }\n }\n\n return args;\n}\n\nexport function moduleStory(\n ModuleComponent: (\n moduleProps: ModuleProps\n ) => React.ReactElement<any, any> | null,\n fields: JSX.Element,\n storyArgs: Args\n): ModuleStory {\n const fieldsJSON = renderFieldsToJson(fields, ModuleComponent.name);\n const argTypes = getFieldsArgTypes(fieldsJSON);\n\n const args = { ...moduleArgs(argTypes), ...storyArgs };\n\n return {\n render: (_args: Args) => {\n const fieldValues = getNestedFieldObjectForArgs(_args);\n const props = namespaceModulePropsShape(fieldValues);\n\n return <ModuleComponent {...props} />;\n },\n argTypes,\n args,\n };\n}\n\nexport function moduleStoryWithIsland(\n moduleName: string,\n fields: JSX.Element,\n storyArgs: Args\n): ModuleStory {\n if (typeof moduleName !== 'string') {\n throw new Error(\n \"moduleStoryWithIsland takes a `moduleName` that matches the file or folder name for the module as a string for the first argument, and the module's Fields JSX as the second parameter\"\n );\n }\n\n if (!fields) {\n throw new Error(\n \"moduleStoryWithIsland requires a second parameter of the module's fields configuration\"\n );\n }\n\n const fieldsJSON = renderFieldsToJson(fields, moduleName);\n const argTypes = getFieldsArgTypes(fieldsJSON);\n const args = { ...moduleArgs(argTypes), ...storyArgs };\n\n return {\n argTypes,\n args,\n render: (_args: Args) => {\n const fieldValues = getNestedFieldObjectForArgs(_args);\n const fieldValuesString = JSON.stringify(fieldValues);\n\n const domain = `${\n window.location.protocol\n }//${window.location.hostname.replace('storybook.', '')}:3000`;\n\n const fieldValuesJson = encodeURIComponent(fieldValuesString);\n const iframeSrc = `${domain}/module/${moduleName}?fields=${fieldValuesJson}`;\n\n useEffect(() => {\n const existingElement = document.querySelector('#hs-module-iframe');\n if (existingElement) {\n existingElement.setAttribute('src', iframeSrc);\n return () => {\n existingElement.remove();\n };\n }\n\n const iframeElement = document.createElement('iframe');\n iframeElement.setAttribute('src', iframeSrc);\n iframeElement.setAttribute('id', 'hs-module-iframe');\n iframeElement.setAttribute(\n 'style',\n `border: none;width: 100%;height: 100%;overflow: auto;position: absolute;left: 0;top: 0;`\n );\n\n document.querySelector('#storybook-root').appendChild(iframeElement);\n\n return () => {\n iframeElement.remove();\n };\n }, [iframeSrc]);\n\n return <div />;\n },\n };\n}\n", "import path from \"path\";\nimport { createHash } from \"crypto\";\nimport fs, { readFileSync, existsSync, readdirSync, lstatSync } from \"fs\";\nimport { join } from \"path/posix\";\nconst COMPONENT_EXTENSIONS = [\".jsx\", \".tsx\", \".js\", \".ts\"];\nconst ENTRY_POINTS_PATH = \"components/partials/\";\nconst MODULE_FOLDER_PATH = \"components/modules/\";\nconst VIRTUAL_ISLAND_RUNTIME = \"virtual:island-runtime\";\nconst VIRTUAL_CONFIG_SETUP = \"virtual:config-setup\";\nconst CSS_LANGS_RE = /\\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\\?)/;\nconst collectCssModules = (modulePathToStartWith, viteServer, cssModulesImported = /* @__PURE__ */ new Set()) => {\n const appModulesForPath = viteServer.moduleGraph.fileToModulesMap.get(\n modulePathToStartWith\n );\n if (!appModulesForPath || appModulesForPath.size === 0) {\n throw new Error(`No modules at: ${modulePathToStartWith}`);\n } else if (appModulesForPath.size > 1) {\n throw new Error(`More than one module at: ${modulePathToStartWith}`);\n }\n const appModule = Array.from(appModulesForPath.values())[0];\n const allServerSideModulesImported = /* @__PURE__ */ new Set();\n const newCssModules = [];\n const moduleQueue = Array.from(appModule.importedModules);\n for (const importedModule of moduleQueue) {\n if (allServerSideModulesImported.has(importedModule.id)) {\n continue;\n }\n allServerSideModulesImported.add(importedModule.id);\n const isCss = CSS_LANGS_RE.test(importedModule.file);\n const moduleModulesToQueue = Array.from(importedModule.importedModules);\n if (isCss && !cssModulesImported.has(importedModule)) {\n cssModulesImported.add(importedModule);\n newCssModules.push(importedModule);\n }\n moduleQueue.push(...moduleModulesToQueue);\n }\n return newCssModules;\n};\nfunction createPreloadLink(assetPath, basePath = \"\") {\n if (assetPath && assetPath[0] !== \"/\") {\n assetPath = `/${assetPath}`;\n }\n if (assetPath.endsWith(\".js\")) {\n return `<link rel=\"modulepreload\" crossorigin href=\"${basePath}${assetPath}\">`;\n } else if (CSS_LANGS_RE.test(assetPath)) {\n return `<link rel=\"stylesheet\" href=\"${basePath}${assetPath}?css\">`;\n } else if (assetPath.endsWith(\".woff\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"font\" type=\"font/woff\" crossorigin>`;\n } else if (assetPath.endsWith(\".woff2\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"font\" type=\"font/woff2\" crossorigin>`;\n } else if (assetPath.endsWith(\".gif\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/gif\">`;\n } else if (assetPath.endsWith(\".jpg\") || assetPath.endsWith(\".jpeg\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/jpeg\">`;\n } else if (assetPath.endsWith(\".png\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/png\">`;\n } else {\n throw new Error(`Unknown preload type for ${assetPath}`);\n }\n}\nconst collectCssInDev = (modulePathToStartWith, viteServer, cssModulesImported = /* @__PURE__ */ new Set()) => {\n return `${collectCssModules(\n modulePathToStartWith,\n viteServer,\n cssModulesImported\n ).map((cssModule) => createPreloadLink(cssModule.url)).join(\"\\n\")}\n`;\n};\nconst badInlineJsChars = /[\\u2028\\u2029<>/]/g;\nconst inlineJsEscapeChars = {\n \"\\u2028\": \"\\\\u2028\",\n \"\\u2029\": \"\\\\u2029\",\n \"<\": \"\\\\u003C\",\n \">\": \"\\\\u003E\",\n \"/\": \"\\\\u002F\"\n};\nfunction escapeChar(unsafeChar) {\n return inlineJsEscapeChars[unsafeChar];\n}\nfunction escapeForInlineJS(input) {\n return input.replace(badInlineJsChars, escapeChar);\n}\nfunction jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {\n const indentString = \" \".repeat(baseIndent);\n jsonIndent = prettyPrint ? jsonIndent : void 0;\n return escapeForInlineJS(JSON.stringify(input, null, jsonIndent)).replace(\n /\\n/gm,\n `\n${indentString}`\n );\n}\nlet viteRoot;\nlet viteCommand;\nfunction resolveIslandPlugin(islandsSet) {\n return {\n enforce: \"pre\",\n name: \"resolve-islands\",\n configResolved(config) {\n viteRoot = config.root;\n viteCommand = config.command;\n },\n load(id) {\n if (id.endsWith(\"?island\") || id.endsWith(\"?client\")) {\n const [idWithNoParam] = id.split(\"?\");\n const islandModuleImportPath = `${idWithNoParam}?client-entry`;\n const componentExtension = path.extname(idWithNoParam);\n const componentFilenameWithNoExtension = path.basename(\n idWithNoParam,\n componentExtension\n );\n const modulePath = idWithNoParam.replace(`${viteRoot}/`, \"\");\n const moduleId = (viteCommand === \"serve\" ? idWithNoParam : modulePath).concat(\"?client-entry\");\n if (islandsSet) {\n islandsSet.add(moduleId);\n }\n return `\n const moduleId = '${moduleId}';\n\n const lazyComponent = () => import('${islandModuleImportPath}');\n lazyComponent.moduleName = '${componentFilenameWithNoExtension}';\n lazyComponent.moduleId = moduleId;\n\n export default lazyComponent;\n `;\n }\n return null;\n }\n };\n}\nfunction resolveIslandToPlainModulePlugin(enabled = true) {\n return {\n enforce: \"pre\",\n name: \"resolve-islands-to-plain\",\n configResolved(config) {\n viteRoot = config.root;\n viteCommand = config.command;\n },\n async resolveId(id, importer, options) {\n if (enabled && (id.endsWith(\"?island\") || id.endsWith(\"?client\"))) {\n const newId = id.replace(\"?island\", \"\").replace(\"?client\", \"\");\n const resolution = await this.resolve(newId, importer, {\n skipSelf: true,\n ...options\n });\n if (resolution) {\n return resolution;\n }\n }\n return null;\n }\n };\n}\nfunction resolveIslandToPlainModuleNoopPlugin() {\n return resolveIslandToPlainModulePlugin(false);\n}\nconst clientRenderIsland = \"import type { RenderableIsland } from '@hubspot/cms-components';\\nimport * as cmsComponents from '@hubspot/cms-components';\\nimport { ClientRenderContextProvider } from '@hubspot/cms-components';\\nimport { Suspense } from 'react';\\nimport ReactDOMClient from 'react-dom/client';\\n\\nconst buildIslandIdentifierPrefix =\\n cmsComponents.buildIslandIdentifierPrefix || ((id) => id);\\n\\nexport function clientRenderIsland(\\n renderableIsland: RenderableIsland,\\n Component: React.ComponentType<any>\\n) {\\n const {\\n island,\\n rootElement,\\n postHydration,\\n pageUrl,\\n islands,\\n basePath,\\n WrapperModule,\\n } = renderableIsland;\\n let reactRoot: any;\\n\\n const rootOptions = {\\n // Ensure useId is unique across island roots\\n identifierPrefix: buildIslandIdentifierPrefix(renderableIsland.island.id),\\n };\\n\\n let innerComponent = <Component islandId={island.id} {...island.props} />;\\n if (WrapperModule) {\\n innerComponent = <WrapperModule>{innerComponent}</WrapperModule>;\\n }\\n\\n const elementsToHydrate = (\\n <Suspense fallback={`client hydrate fail/waiting for ${island.id}`}>\\n <ClientRenderContextProvider\\n pageUrl={pageUrl}\\n islands={islands}\\n onTopLevelHydrationFinish={postHydration}\\n island={island}\\n basePath={basePath}\\n >\\n {innerComponent}\\n </ClientRenderContextProvider>\\n </Suspense>\\n );\\n\\n if (island.clientOnly) {\\n reactRoot = ReactDOMClient.createRoot(rootElement, rootOptions);\\n reactRoot.render(elementsToHydrate);\\n } else {\\n reactRoot = ReactDOMClient.hydrateRoot(\\n rootElement,\\n elementsToHydrate,\\n rootOptions\\n );\\n }\\n return reactRoot;\\n}\\n\";\nconst virtualClientRenderIslandModuleId = \"virtual:clientRenderIsland.tsx\";\nfunction clientIslandEntryPlugin() {\n return {\n enforce: \"pre\",\n name: \"client-island-entry-plugin\",\n resolveId(id) {\n if (id === virtualClientRenderIslandModuleId) {\n return virtualClientRenderIslandModuleId;\n }\n return null;\n },\n load(id) {\n if (id.endsWith(\"?client-entry\")) {\n const [idWithNoParam] = id.split(\"?\");\n return `\n import { clientRenderIsland } from '${virtualClientRenderIslandModuleId}';\n import Component from '${idWithNoParam}';\n\n export function render(island) {\n return clientRenderIsland(island, Component)\n }\n\n export default Component;\n `;\n }\n if (id === virtualClientRenderIslandModuleId) {\n return clientRenderIsland;\n }\n return null;\n }\n };\n}\nconst scriptTagToLogServerMessages = (messagesForBrowser, groupLabel, nonceAttribute) => {\n if (!messagesForBrowser) {\n return \"\";\n }\n const consoleLines = [];\n for (const message of messagesForBrowser) {\n let funcString = \"console.log\";\n if (message.level === \"error\") {\n funcString = \"console.error\";\n }\n if (message.level === \"warn\") {\n funcString = \"console.warn\";\n }\n const argString = message.parameters.map((arg) => JSON.stringify(arg)).join(\", \");\n consoleLines.push(` ${funcString}(${argString});`);\n }\n let groupStart = \"\";\n let groupEnd = \"\";\n if (groupLabel !== void 0 && groupLabel !== null) {\n groupStart = `\n console.group(${JSON.stringify(groupLabel)});`;\n groupEnd = ` console.groupEnd()\n`;\n }\n return `<script ${nonceAttribute}>${groupStart}\n${consoleLines.join(\"\\n\")}\n${groupEnd}<\\/script>\n`;\n};\nconst getComponentExtension = (componentPath) => {\n const filteredExtensions = COMPONENT_EXTENSIONS.filter(\n (ext) => componentPath.endsWith(ext)\n );\n if (filteredExtensions.length === 1) {\n return filteredExtensions[0];\n }\n return void 0;\n};\nconst hasComponentExtension = (componentPath) => {\n return !!getComponentExtension(componentPath);\n};\nconst isStorybookStory = (componentPath) => {\n return !!path.basename(componentPath, path.extname(componentPath)).endsWith(\".stories\");\n};\nconst removeComponentExtension = (componentPath) => {\n const ext = getComponentExtension(componentPath);\n if (ext == null) {\n return componentPath;\n }\n return componentPath.slice(0, -1 * ext.length);\n};\nfunction getEntryPointHash(entryPoint) {\n return createHash(\"md5\").update(entryPoint).digest(\"hex\").slice(0, 6);\n}\nfunction getEntryPointHashWithIndexSuffix(entryPoint, index) {\n const renderIndexSuffix = index != null ? `i${index}` : \"\";\n return `${getEntryPointHash(entryPoint)}${renderIndexSuffix}`;\n}\nconst COMBINED_REACT_BASE_PATH = \"https://static.hsappstatic.net/cms-js-static/ex/js/react/v18\";\nconst ISLAND_RUNTIME_CONFIG_BASE_PATH = \"https://static.hsappstatic.net/cms-js-static/ex/js/island-runtime/v1\";\nfunction getCombinedReactUrl() {\n const hsEnv = process.env.HS_ENV;\n const fileVersion = hsEnv === \"prod\" ? `react-combined.mjs` : \"react-combined-qa.mjs\";\n return `${COMBINED_REACT_BASE_PATH}/${fileVersion}`;\n}\nfunction getIslandRuntimeConfigUrl() {\n const hsEnv = process.env.HS_ENV;\n const fileVersion = hsEnv === \"prod\" ? `island-runtime.mjs` : \"island-runtime-qa.mjs\";\n return `${ISLAND_RUNTIME_CONFIG_BASE_PATH}/${fileVersion}`;\n}\nfunction includesHublDataReference(templateSource) {\n const hublDataPattern = /\\{%\\s+set\\s+(experimentalHublData|hublData)\\s*=/;\n return !!templateSource.match(hublDataPattern);\n}\nconst removeIndexFromPath = (id) => {\n return id.replace(/\\/index\\.[jt]sx?$/, \"\");\n};\nconst removeIndexOrTrailingJsFromPath = (id) => {\n return removeIndexFromPath(id).replace(/\\.[jt]sx?$/, \"\");\n};\nconst HEALTHCHECKS_ENABLED_DEFAULT = true;\nconst HEALTHCHECKS_STRICT_DEFAULT = false;\nfunction getCMSAssetConfig(webRoot) {\n const cmsAssetsPath = path.join(webRoot, \"cms-assets.json\");\n const cmsThemePath = path.join(webRoot, \"theme.json\");\n const configPathToUse = fs.existsSync(cmsAssetsPath) ? cmsAssetsPath : cmsThemePath;\n const parsedConfig = JSON.parse(\n fs.readFileSync(configPathToUse).toString()\n );\n return parsedConfig;\n}\nfunction getCMSAssetConfigIfExists(webRoot) {\n try {\n return getCMSAssetConfig(webRoot);\n } catch (e) {\n console.error(\n `Error finding or parsing cms-assets.json in ${webRoot}, but ignoring for now`\n );\n return {};\n }\n}\nfunction areBuildHealthChecksEnabled(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.healthchecks) == null ? void 0 : _b.enabled) ?? HEALTHCHECKS_ENABLED_DEFAULT;\n}\nfunction doHealthChecksFailTheBuild(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.healthchecks) == null ? void 0 : _b.strict) ?? HEALTHCHECKS_STRICT_DEFAULT;\n}\nfunction getServerIncludePrebundleDepPatterns(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.serverPrebundling) == null ? void 0 : _b.include) ?? [];\n}\nconst BUILD_INFO_PATH = \"/build-info.json\";\nfunction getBuildInfo(buildDir) {\n try {\n const buildInfo = JSON.parse(\n readFileSync(path.join(buildDir, BUILD_INFO_PATH)).toString()\n );\n return buildInfo;\n } catch (e) {\n throw new Error(`Error loading build-info.json, path: ${BUILD_INFO_PATH}`);\n }\n}\nfunction getBaseAssetUrlFromBuild(buildDir) {\n return getBuildInfo(buildDir).baseAssetUrl;\n}\nconst GATES = [\n \"CMS:JSRenderer:GetServerSideProps\",\n \"CMS:JSRenderer:ModuleHubl\",\n \"CMS:JSRenderer:RemoveCjsPlugin\",\n \"CMS:JSRenderer:RemoveMockClientEntryPlugin\",\n \"CMS:JSRenderer:AnalyzeCmsModules\"\n];\nconst ENABLED_FEATURES_GATE_MAP = {\n \"cms:jsr:getServerSideProps\": \"CMS:JSRenderer:GetServerSideProps\",\n \"cms:jsr:RemoveCjsPlugin\": \"CMS:JSRenderer:RemoveCjsPlugin\",\n \"cms:jsr:analyzeCmsModules\": \"CMS:JSRenderer:AnalyzeCmsModules\"\n};\nfunction isUngatedFor(gates, gate) {\n return gates.includes(gate);\n}\nfunction ungatedAtBuildTimeFor(buildDir, gate) {\n try {\n const buildInfo = getBuildInfo(buildDir);\n return isUngatedFor(buildInfo.gates, gate);\n } catch (e) {\n return false;\n }\n}\nconst findAllComponentsIn = (webRoot, componentsFolder) => {\n const fullComponentsFolderPath = join(webRoot, componentsFolder);\n const componentsByName = {};\n if (!existsSync(fullComponentsFolderPath)) {\n return componentsByName;\n }\n readdirSync(fullComponentsFolderPath).forEach((fileOrFolderName) => {\n const fullPath = join(fullComponentsFolderPath, fileOrFolderName);\n const subdirPath = join(componentsFolder, fileOrFolderName);\n const isDirectory = lstatSync(fullPath).isDirectory();\n if (!isDirectory && hasComponentExtension(fileOrFolderName) && !isStorybookStory(fileOrFolderName)) {\n const subdirPathNoExtension = removeComponentExtension(subdirPath);\n componentsByName[subdirPathNoExtension] = subdirPath;\n } else if (isDirectory) {\n for (const potentialExtension of COMPONENT_EXTENSIONS) {\n const potentialIndexModule = join(\n subdirPath,\n `index${potentialExtension}`\n );\n const fullPotentialPath = join(\n fullPath,\n `index${potentialExtension}`\n );\n if (existsSync(fullPotentialPath)) {\n const moduleIndexPathNoExtension = removeComponentExtension(potentialIndexModule);\n componentsByName[moduleIndexPathNoExtension] = potentialIndexModule;\n break;\n }\n }\n }\n });\n return componentsByName;\n};\nfunction findAllModulesInRoot(webRoot) {\n const allModuleComponents = findAllComponentsIn(\n webRoot,\n \"./components/modules\"\n );\n const moduleNames = Object.keys(allModuleComponents).map(\n (moduleSubpath) => moduleSubpath.replace(\"components/modules/\", \"\").replace(\"/index\", \"\")\n );\n const moduleSubpaths = Object.keys(allModuleComponents);\n return { moduleNames, moduleSubpaths };\n}\nfunction findAllPartialsInRoot(webRoot) {\n const allPartialComponents = findAllComponentsIn(\n webRoot,\n \"./components/partials\"\n );\n const partialNames = Object.keys(allPartialComponents).map(\n (partialSubpath) => partialSubpath.replace(\"components/partials/\", \"\").replace(\"/index\", \"\")\n );\n const partialSubpaths = Object.keys(allPartialComponents);\n return { partialNames, partialSubpaths };\n}\nfunction namespaceModulePropsShape(props) {\n const {\n dataQueryResult,\n hublParameters,\n fieldValues: passedFieldValues,\n hublData,\n experimentalHublData,\n moduleName,\n supplementalFieldValues\n } = props;\n const oldPropsShape = { ...props };\n if (oldPropsShape.dataQueryResult) {\n delete oldPropsShape.dataQueryResult;\n }\n if (oldPropsShape.hublParameters) {\n delete oldPropsShape.hublParameters;\n }\n const fieldValues = passedFieldValues || oldPropsShape;\n return {\n ...fieldValues,\n dataQueryResult,\n fieldValues,\n hublParameters,\n hublData,\n experimentalHublData,\n moduleName,\n supplementalFieldValues\n };\n}\nfunction setIn(object, nestedKeysArray, value) {\n let curr = object;\n const finalKey = nestedKeysArray.pop();\n for (let index = 0; index < nestedKeysArray.length; index++) {\n const currentKey = nestedKeysArray[index];\n const nextKey = nestedKeysArray[index + 1];\n if (Number.isInteger(nextKey) || !nextKey && Number.isInteger(finalKey)) {\n if (curr[currentKey] === void 0) {\n curr[currentKey] = [];\n }\n }\n if (curr[currentKey] === void 0) {\n curr[currentKey] = {};\n }\n curr = curr[currentKey];\n }\n if (value !== void 0) {\n curr[finalKey] = value;\n }\n}\nfunction isStylesheetAsset(staticAsset) {\n return staticAsset.type === \"stylesheet\";\n}\nexport {\n COMPONENT_EXTENSIONS,\n CSS_LANGS_RE,\n ENABLED_FEATURES_GATE_MAP,\n ENTRY_POINTS_PATH,\n GATES,\n MODULE_FOLDER_PATH,\n VIRTUAL_CONFIG_SETUP,\n VIRTUAL_ISLAND_RUNTIME,\n getBaseAssetUrlFromBuild as a,\n areBuildHealthChecksEnabled,\n clientIslandEntryPlugin,\n collectCssInDev,\n collectCssModules,\n doHealthChecksFailTheBuild,\n escapeForInlineJS,\n findAllComponentsIn,\n findAllModulesInRoot,\n findAllPartialsInRoot,\n getBuildInfo as g,\n getCMSAssetConfig,\n getCMSAssetConfigIfExists,\n getCombinedReactUrl,\n getComponentExtension,\n getEntryPointHash,\n getEntryPointHashWithIndexSuffix,\n getIslandRuntimeConfigUrl,\n getServerIncludePrebundleDepPatterns,\n hasComponentExtension,\n includesHublDataReference,\n isStorybookStory,\n isStylesheetAsset,\n isUngatedFor,\n jsonStringifyAndEscapeForInlineJS,\n namespaceModulePropsShape,\n removeComponentExtension,\n removeIndexFromPath,\n removeIndexOrTrailingJsFromPath,\n resolveIslandPlugin,\n resolveIslandToPlainModuleNoopPlugin,\n resolveIslandToPlainModulePlugin,\n scriptTagToLogServerMessages,\n setIn,\n ungatedAtBuildTimeFor,\n virtualClientRenderIslandModuleId\n};\n", "import { jsonStringifyAndEscapeForInlineJS, scriptTagToLogServerMessages } from \"./basicUtils.js\";\nimport { COMPONENT_EXTENSIONS, CSS_LANGS_RE, ENABLED_FEATURES_GATE_MAP, ENTRY_POINTS_PATH, GATES, MODULE_FOLDER_PATH, VIRTUAL_CONFIG_SETUP, VIRTUAL_ISLAND_RUNTIME, areBuildHealthChecksEnabled, clientIslandEntryPlugin, collectCssInDev, collectCssModules, doHealthChecksFailTheBuild, escapeForInlineJS, findAllComponentsIn, findAllModulesInRoot, findAllPartialsInRoot, a, g, getCMSAssetConfig, getCMSAssetConfigIfExists, getCombinedReactUrl, getComponentExtension, getEntryPointHash, getEntryPointHashWithIndexSuffix, getIslandRuntimeConfigUrl, getServerIncludePrebundleDepPatterns, hasComponentExtension, includesHublDataReference, isStorybookStory, isStylesheetAsset, isUngatedFor, namespaceModulePropsShape, removeComponentExtension, removeIndexFromPath, removeIndexOrTrailingJsFromPath, resolveIslandPlugin, resolveIslandToPlainModuleNoopPlugin, resolveIslandToPlainModulePlugin, setIn, ungatedAtBuildTimeFor, virtualClientRenderIslandModuleId } from \"./basicUtils.js\";\nimport * as dotProp from \"dot-prop\";\nimport * as parser from \"@babel/parser\";\nimport _traverse from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport { jsx } from \"react/jsx-runtime\";\nimport stream from \"stream\";\nimport { renderToPipeableStream, renderToStaticMarkup } from \"react-dom/server\";\nimport * as cmsComponents from \"@hubspot/cms-components\";\nimport { ServerRenderContext } from \"@hubspot/cms-components\";\nimport { isValidElement, cloneElement } from \"react\";\nimport \"path\";\nimport \"crypto\";\nimport \"fs\";\nimport \"path/posix\";\nconst { setProperty, getProperty, hasProperty } = dotProp;\nconst serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {\n const islandsArrayToSerialize = tweakedIslandsArray.map(\n ({\n id,\n moduleName,\n moduleId,\n props,\n hydrateOn,\n clientOnly,\n priority,\n url,\n sharedStateID,\n supplementalFieldValues,\n wrapperModuleId,\n wrapperUrl\n }) => {\n const output = {\n id,\n moduleName,\n moduleId,\n hydrateOn,\n clientOnly,\n priority,\n props,\n url\n };\n if (sharedStateID) {\n output.sharedStateID = sharedStateID;\n }\n if (wrapperModuleId) {\n output.wrapperModuleId = wrapperModuleId;\n }\n if (wrapperUrl) {\n output.wrapperUrl = wrapperUrl;\n }\n const filteredSupplementalFieldValues = filterOutUnreadSupplementalFieldValues(\n supplementalFieldValues,\n perServerRequestData.get(\"supplementalFieldValuesRead\")\n );\n if (filteredSupplementalFieldValues) {\n output.supplementalFieldValues = filteredSupplementalFieldValues;\n }\n return output;\n }\n );\n return jsonStringifyAndEscapeForInlineJS(islandsArrayToSerialize, {\n baseIndent,\n jsonIndent: 2,\n prettyPrint\n });\n};\nfunction filterOutUnreadSupplementalFieldValues(supplementalFieldValues, supplementalFieldValuesRead) {\n if (!supplementalFieldValues) {\n return supplementalFieldValues;\n }\n if (!supplementalFieldValuesRead) {\n return supplementalFieldValues;\n }\n const result = {};\n Array.from(supplementalFieldValuesRead).forEach((fieldPath) => {\n if (hasProperty(supplementalFieldValues, fieldPath)) {\n setProperty(\n result,\n fieldPath,\n getProperty(supplementalFieldValues, fieldPath)\n );\n }\n });\n return result;\n}\nconst writeSharedStateToJsGlobal = (islands, perServerRequestData, indent = 0, prettyPrint) => {\n const sharedStateIDs = islands.map((island) => island.sharedStateID).filter((x) => !!x);\n if (sharedStateIDs.length > 0) {\n const indentString = \" \".repeat(indent);\n const stateByID = {};\n sharedStateIDs.forEach(\n (id) => stateByID[id] = perServerRequestData.get(id)\n );\n const stringifiedState = jsonStringifyAndEscapeForInlineJS(stateByID, {\n prettyPrint,\n jsonIndent: 2\n });\n return `\n\nvar newState = ${stringifiedState};\nif(window.__hsSSInit) {\n window.__hsSSInit = Object.assign(window.__hsSSInit, newState);\n} else {\n window.__hsSSInit = newState;\n}`.replace(/\\n/gm, `\n${indentString}`);\n }\n return \"\";\n};\nfunction getIslandUrls(roots, viteDevServer) {\n return roots.map((island) => {\n const islandModule = viteDevServer.moduleGraph.getModuleById(\n island.moduleId\n );\n if (!islandModule) {\n throw new Error(`Unknown island moduleId: ${island.moduleId}`);\n }\n let wrapperModule;\n if (island.wrapperModuleId) {\n wrapperModule = viteDevServer.moduleGraph.getModuleById(\n island.wrapperModuleId\n );\n }\n const tweakedIsland = {\n ...island,\n url: islandModule.url,\n wrapperUrl: wrapperModule ? wrapperModule.url : void 0\n };\n return tweakedIsland;\n });\n}\nfunction getPerServerRequestUrls(perServerRequestData, viteDevServer) {\n if (!perServerRequestData.has(\"sharedStateIDs\")) {\n return new Map(perServerRequestData);\n }\n const perServerRequestDataWithUrls = new Map(\n perServerRequestData\n );\n perServerRequestData.get(\"sharedStateIDs\").forEach((id) => {\n const reducer = perServerRequestData.get(id);\n if (reducer.reducerFuncModuleId) {\n const reducerWithUrl = {\n ...reducer,\n reducerFuncModuleUrl: viteDevServer.moduleGraph.getModuleById(\n reducer.reducerFuncModuleId\n ).url\n };\n perServerRequestDataWithUrls.set(id, reducerWithUrl);\n }\n });\n return perServerRequestDataWithUrls;\n}\nconst createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent, prettyPrint) => {\n const islands = getIslandUrls(roots, viteDevServer);\n const perServerRequestDataWithUrls = getPerServerRequestUrls(\n perServerRequestData,\n viteDevServer\n );\n return `${\" \".repeat(\n indent\n )}window.__islands = ${serializeIslandDataForInlineScript(\n islands,\n perServerRequestData,\n indent,\n prettyPrint\n )}${writeSharedStateToJsGlobal(\n islands,\n perServerRequestDataWithUrls,\n indent,\n prettyPrint\n )}`;\n};\nfunction noncePlaceholderPlugin() {\n const HS_DEPLOYED = process.env.AWS_EXECUTION_ENV != null || process.env.HS_DEPLOYED === \"true\";\n return {\n name: \"hs-nonce-placeholder\",\n enforce: \"post\",\n apply() {\n return HS_DEPLOYED;\n },\n transformIndexHtml(html) {\n const regex = /<(style|script|link) (.*)>/gi;\n const replacer = (_, p1, p2) => {\n if (p1 === \"style\" || p1 === \"script\" || // if link, only nonce for stylesheet\n p1 === \"link\" && p2.includes('rel=\"stylesheet\"')) {\n const noncePlaceholderValue = p1 === \"script\" ? \"hs-random-nonce\" : \"hs-random-style-nonce\";\n p2 = `nonce=\"${noncePlaceholderValue}\" ${p2}`;\n }\n return `<${p1} ${p2}>`;\n };\n return html.replace(regex, replacer);\n }\n };\n}\nconst traverse = _traverse.default;\nconst CMS_MODULE_COMPONENT_NAME = \"UnstableModule\";\nfunction findCmsModules(cmsModules = {}) {\n let config;\n return {\n enforce: \"pre\",\n name: \"findCmsModules\",\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n transform(code, id) {\n const moduleInfo = this.getModuleInfo(id);\n const isExternal = config.command === \"serve\" ? false : moduleInfo.isExternal;\n if (isExternal || !moduleInfo.id.startsWith(config.root) || !code.includes(CMS_MODULE_COMPONENT_NAME)) {\n return null;\n }\n const localCmsModules = {};\n const sourceAst = parser.parse(code, {\n sourceType: \"module\",\n plugins: [\"jsx\", \"typescript\"]\n });\n let unstableModuleLocalName = CMS_MODULE_COMPONENT_NAME;\n const pluginError = this.error.bind(this);\n traverse(sourceAst, {\n ImportDeclaration(path) {\n if (!t.isStringLiteral(path.node.source, {\n value: \"@hubspot/cms-components\"\n })) {\n return null;\n }\n for (const specifier of path.node.specifiers) {\n if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported, {\n name: CMS_MODULE_COMPONENT_NAME\n })) {\n unstableModuleLocalName = specifier.local.name;\n }\n }\n },\n JSXOpeningElement(path) {\n if (!t.isJSXIdentifier(path.node.name, {\n name: unstableModuleLocalName\n }) || path.node.attributes.length !== 2) {\n return null;\n }\n let cmsModuleName;\n let cmsModulePath;\n for (const prop of path.node.attributes) {\n if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: \"name\" }) && t.isStringLiteral(prop.value)) {\n cmsModuleName = prop.value.value;\n continue;\n }\n if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: \"path\" }) && t.isStringLiteral(prop.value)) {\n cmsModulePath = prop.value.value;\n continue;\n }\n pluginError(\n new Error(\n `Error: ${id.replace(config.root, \"\")}:${prop.loc.start.line} \"name\" and \"path\" must be primitive strings`\n )\n );\n }\n const cmsModuleProps = {\n name: cmsModuleName,\n path: cmsModulePath\n };\n if (Object.hasOwn(localCmsModules, cmsModuleProps.name)) {\n pluginError(\n new Error(\n `Error: multiple <${CMS_MODULE_COMPONENT_NAME} /> with duplicate name: ${cmsModuleProps.name}`\n )\n );\n }\n localCmsModules[cmsModuleProps.name] = cmsModuleProps;\n }\n });\n return {\n meta: {\n findCmsModules: localCmsModules\n }\n };\n },\n buildEnd(error) {\n if (error)\n throw error;\n const modulesWithCmsModuleUsage = Array.of(\n ...this.getModuleIds()\n ).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => this.getModuleInfo(moduleId)).filter(\n (moduleInfo) => Object.hasOwn(moduleInfo.meta, \"findCmsModules\")\n );\n const moduleToEntryPoints = {};\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n moduleToEntryPoints[moduleWithCmsModuleUsage.id] = findEntryPoints(\n this,\n moduleWithCmsModuleUsage\n );\n }\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const usageInModuleEntryPoint = moduleToEntryPoints[moduleWithCmsModuleUsage.id].find((entryPoint) => entryPoint.id.includes(\"/components/modules\"));\n if (usageInModuleEntryPoint) {\n this.error(`\n Error: <${CMS_MODULE_COMPONENT_NAME} /> can only be used in Partials.\n Module: ${usageInModuleEntryPoint.id === moduleWithCmsModuleUsage.id ? usageInModuleEntryPoint.id.replace(config.root, \"\") : `imports: ${moduleWithCmsModuleUsage.id.replace(\n config.root,\n \"\"\n )}, which`} contains a <${CMS_MODULE_COMPONENT_NAME} />\n `);\n }\n }\n const root = config.root;\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const islandsContainingCmsModuleUsage = checkModuleTreeForIslands(\n this,\n moduleWithCmsModuleUsage\n );\n if (islandsContainingCmsModuleUsage.length > 0) {\n throw new Error(`\n <${CMS_MODULE_COMPONENT_NAME} /> cannot be used within islands.\n ${formatIslandImporter(\n moduleWithCmsModuleUsage.id,\n root\n )} uses <${CMS_MODULE_COMPONENT_NAME} /> and is used by islands:\n ${islandsContainingCmsModuleUsage.map(\n (islandModuleInfo) => formatIslandImporter(islandModuleInfo.id, root)\n ).join(\", \")}\n `);\n }\n }\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const entryPoints = moduleToEntryPoints[moduleWithCmsModuleUsage.id];\n for (const entryPoint of entryPoints) {\n const relativeEntryPoint = entryPoint.id.replace(root, \"\");\n if (!Object.hasOwn(cmsModules, relativeEntryPoint)) {\n cmsModules[relativeEntryPoint] = {};\n }\n for (const [cmsModuleName, cmsModuleValue] of Object.entries(\n moduleWithCmsModuleUsage.meta.findCmsModules\n )) {\n if (Object.hasOwn(cmsModules[relativeEntryPoint], cmsModuleName)) {\n this.error(`Error: duplicate module name: ${cmsModuleName}`);\n }\n cmsModules[relativeEntryPoint][cmsModuleName] = cmsModuleValue;\n }\n }\n }\n }\n };\n}\nfunction findEntryPoints(ctx, moduleInfo) {\n if (moduleInfo.isEntry) {\n return [moduleInfo];\n }\n const result = [];\n for (const importer of moduleInfo.importers) {\n const importerModuleInfo = ctx.getModuleInfo(importer);\n const entryPoints = findEntryPoints(ctx, importerModuleInfo);\n result.push(...entryPoints);\n }\n return result;\n}\nfunction checkModuleTreeForIslands(ctx, module) {\n if (module.id.endsWith(\"?client-entry\")) {\n return [module];\n }\n const importerResults = [];\n for (const importer of module.importers) {\n const importerInfo = ctx.getModuleInfo(importer);\n const importerResult = checkModuleTreeForIslands(ctx, importerInfo);\n importerResults.push(importerResult);\n }\n return importerResults.flat();\n}\nfunction formatIslandImporter(id, root) {\n return id.replace(root, \"\").replace(\"?client-entry\", \"\");\n}\nconst promiseForNewWritableStream = () => {\n const chunks = [];\n const writableStream = new stream.Writable();\n writableStream._write = (chunk, encoding, done) => {\n chunks.push(Buffer.from(chunk));\n done();\n };\n const streamDonePromise = new Promise((resolve, reject) => {\n writableStream.on(\"error\", (error) => {\n reject(error);\n });\n writableStream._final = (done) => {\n resolve(Buffer.concat(chunks).toString(\"utf8\"));\n done();\n };\n });\n return { streamDonePromise, writableStream };\n};\nconst renderStreamToPromise = async (reactElements, options) => {\n const { streamDonePromise, writableStream } = promiseForNewWritableStream();\n const {\n pipe\n /* abort */\n } = renderToPipeableStream(reactElements, {\n ...options || {},\n onShellReady() {\n },\n onAllReady() {\n pipe(writableStream);\n if (options == null ? void 0 : options.onAllReady) {\n options.onAllReady();\n }\n }\n });\n return streamDonePromise;\n};\nconst {\n createServerRenderContextV2,\n createServerRenderContext,\n renderServerSidePropsWithAsyncLocalStoreContext\n} = cmsComponents;\nconst bootStrapRenderContext = () => {\n const renderContext = createServerRenderContextV2 ? createServerRenderContextV2(null, {\n environmentConfig: null,\n entryPointBasePath: \"\",\n supplementalFieldValues: {},\n messagesForBrowser: []\n }) : createServerRenderContext(\"\", null);\n return renderContext;\n};\nasync function renderComponentOnServer(Component, propsAndDeps, pageUrl, environmentConfig, entryPointBasePath, contextOptions, renderOptions, getServerSideProps) {\n const { props } = propsAndDeps;\n const componentDebugName = Component.displayName || Component.name;\n const supplementalFieldValues = contextOptions == null ? void 0 : contextOptions.supplementalFieldValues;\n const messagesForBrowser = contextOptions == null ? void 0 : contextOptions.messagesForBrowser;\n const renderContext = cmsComponents.createServerRenderContextV2 ? cmsComponents.createServerRenderContextV2(pageUrl, {\n environmentConfig,\n entryPointBasePath,\n supplementalFieldValues,\n messagesForBrowser\n }) : cmsComponents.createServerRenderContext(pageUrl, environmentConfig);\n if (getServerSideProps !== void 0 && typeof getServerSideProps === \"function\") {\n const gSSPResult = await renderServerSidePropsWithAsyncLocalStoreContext(\n getServerSideProps,\n propsAndDeps,\n renderContext\n );\n if (gSSPResult) {\n props.serverSideProps = gSSPResult.serverSideProps;\n }\n }\n return renderOnServer(\n /* @__PURE__ */ jsx(Component, { ...props }),\n renderContext,\n componentDebugName,\n renderOptions\n );\n}\nasync function renderOnServer(elements, renderContext = bootStrapRenderContext(), debugName, renderOptions) {\n let html = await renderStreamToPromise(\n /* @__PURE__ */ jsx(ServerRenderContext.Provider, { value: renderContext, children: elements }),\n renderOptions\n );\n if (renderContext.messagesForBrowser.length > 0) {\n html = `${html}${scriptTagToLogServerMessages(\n renderContext.messagesForBrowser,\n `Server messages rendering: ${debugName}`\n )}`;\n }\n return { html, renderContext };\n}\nfunction getServerGlobalsToInject(environmentConfig, hsServerPageUrl, hsBasePath, prettyPrint, criticalDevErrors, includeNonces) {\n if (prettyPrint === void 0 && hsServerPageUrl && cmsComponents.isDebugUrlString) {\n prettyPrint = cmsComponents.isDebugUrlString(hsServerPageUrl);\n }\n const serializedJson = jsonStringifyAndEscapeForInlineJS(\n environmentConfig.toJSON(),\n { baseIndent: 6, prettyPrint }\n );\n const globals = [`window.__hsEnvConfig = ${serializedJson};`];\n if (hsServerPageUrl) {\n globals.push(\n `window.__hsServerPageUrl = ${jsonStringifyAndEscapeForInlineJS(\n hsServerPageUrl\n )};`\n );\n }\n if (hsBasePath) {\n globals.push(\n `window.__hsBasePath = ${jsonStringifyAndEscapeForInlineJS(hsBasePath)};`\n );\n }\n if (!environmentConfig.getIsDeployed() && (criticalDevErrors == null ? void 0 : criticalDevErrors.length)) {\n const firstCriticalDevError = criticalDevErrors[0];\n globals.push(`\n customElements.whenDefined('vite-error-overlay').then(() => {\n const ErrorOverlay = customElements.get('vite-error-overlay');\n const error = new Error(${jsonStringifyAndEscapeForInlineJS(\n firstCriticalDevError.message\n )});\n const overlay = new ErrorOverlay(error);\n\n document.body.appendChild(overlay);\n })\n `);\n }\n const nonceAttr = includeNonces && cmsComponents.SCRIPT_NONCE_PLACEHOLDER ? ` nonce=\"${cmsComponents.SCRIPT_NONCE_PLACEHOLDER}\"` : \"\";\n return `\n <script type=\"text/javascript\"${nonceAttr}>\n ${globals.join(\"\\n \")}\n <\\/script>\n `;\n}\nfunction renderFieldsJSX(fieldsJSX) {\n let moduleJson;\n const outputCallback = (callbackJson) => {\n moduleJson = callbackJson;\n };\n renderToStaticMarkup(\n cloneElement(fieldsJSX, {\n outputCallback\n })\n );\n if (!moduleJson) {\n throw new Error(\"couldn't render module fields definition to fields.json\");\n }\n return moduleJson;\n}\nfunction renderFieldsToJson(fields, moduleName) {\n let fieldsJSON;\n try {\n if (isValidElement(fields)) {\n fieldsJSON = renderFieldsJSX(fields);\n } else if (Array.isArray(fields)) {\n fieldsJSON = fields;\n } else {\n throw new Error(\n `Couldn't recognize \\`fields\\` value for module ${moduleName}`\n );\n }\n return fieldsJSON;\n } catch (e) {\n e.message = `Error when rendering fields for ${moduleName}: ${e.message}`;\n throw e;\n }\n}\nexport {\n COMPONENT_EXTENSIONS,\n CSS_LANGS_RE,\n ENABLED_FEATURES_GATE_MAP,\n ENTRY_POINTS_PATH,\n GATES,\n MODULE_FOLDER_PATH,\n VIRTUAL_CONFIG_SETUP,\n VIRTUAL_ISLAND_RUNTIME,\n areBuildHealthChecksEnabled,\n clientIslandEntryPlugin,\n collectCssInDev,\n collectCssModules,\n createIslandsGlobalJsForClientInDev,\n doHealthChecksFailTheBuild,\n escapeForInlineJS,\n findAllComponentsIn,\n findAllModulesInRoot,\n findAllPartialsInRoot,\n findCmsModules,\n a as getBaseAssetUrlFromBuild,\n g as getBuildInfo,\n getCMSAssetConfig,\n getCMSAssetConfigIfExists,\n getCombinedReactUrl,\n getComponentExtension,\n getEntryPointHash,\n getEntryPointHashWithIndexSuffix,\n getIslandRuntimeConfigUrl,\n getIslandUrls,\n getServerGlobalsToInject,\n getServerIncludePrebundleDepPatterns,\n hasComponentExtension,\n includesHublDataReference,\n isStorybookStory,\n isStylesheetAsset,\n isUngatedFor,\n jsonStringifyAndEscapeForInlineJS,\n namespaceModulePropsShape,\n noncePlaceholderPlugin,\n removeComponentExtension,\n removeIndexFromPath,\n removeIndexOrTrailingJsFromPath,\n renderComponentOnServer,\n renderFieldsToJson,\n renderOnServer,\n renderStreamToPromise,\n resolveIslandPlugin,\n resolveIslandToPlainModuleNoopPlugin,\n resolveIslandToPlainModulePlugin,\n scriptTagToLogServerMessages,\n serializeIslandDataForInlineScript,\n setIn,\n ungatedAtBuildTimeFor,\n virtualClientRenderIslandModuleId\n};\n", "import { Field } from '@hubspot/cms-components/fields';\nimport { ArgTypes } from './types.js';\n\nexport default function getFieldsArgTypes(\n fieldsJson: Field[],\n currentPathSegments: string[] = []\n): ArgTypes {\n let resultArgTypes: ArgTypes = {};\n for (const field of fieldsJson) {\n // storybook doesn't support nested controls, so emulate our nested\n // structure with group1.group2.field structure\n const fullFieldName = [...currentPathSegments, field.name].join('.');\n\n // should this definition of fieldType => argType live next to fields in cms-components?\n switch (field.type) {\n case 'group': {\n if (!field.children) {\n continue;\n }\n\n const groupResult = getFieldsArgTypes(field.children, [\n ...currentPathSegments,\n field.name,\n ]);\n\n resultArgTypes = {\n ...resultArgTypes,\n ...groupResult,\n };\n break;\n }\n case 'boolean': {\n resultArgTypes[fullFieldName] = {\n control: 'boolean',\n defaultValue: field.default,\n };\n break;\n }\n case 'text': {\n resultArgTypes[fullFieldName] = {\n control: 'text',\n defaultValue: field.default,\n };\n break;\n }\n case 'number': {\n resultArgTypes[fullFieldName] = {\n control: 'number',\n defaultValue: field.default,\n };\n break;\n }\n case 'choice': {\n const options = field.choices\n ? field.choices.map((choice) => choice[1])\n : [];\n\n resultArgTypes[fullFieldName] = {\n control: 'select',\n defaultValue: field.default,\n options,\n };\n break;\n }\n default: {\n resultArgTypes[fullFieldName] = {\n control: 'object',\n defaultValue: field.default,\n };\n break;\n }\n }\n }\n return resultArgTypes;\n}\n", "import { Args } from './types.js';\n\ntype FieldValues = {\n [fieldNameOrGroupName: string]: FieldValues;\n};\n\n// default values come through via `defaultValue` in the story's argTypes, we\n// need to re-nest them to match the field structure\nexport default function getNestedFieldObjectForArgs(_args: Args): FieldValues {\n const result: FieldValues = {};\n for (const argPath in _args) {\n if (Object.prototype.hasOwnProperty.call(_args, argPath)) {\n const argPathSegments = argPath.split('.');\n const nestedSegments = argPathSegments.slice(0, -1);\n const fieldName = argPathSegments[argPathSegments.length - 1];\n const fieldValue = _args[argPath];\n\n let currentNest = result;\n for (const segment of nestedSegments) {\n if (!Object.prototype.hasOwnProperty.call(currentNest, segment)) {\n currentNest[segment] = {};\n }\n currentNest = currentNest[segment];\n }\n currentNest[fieldName] = fieldValue;\n }\n }\n\n return result;\n}\n"],
5
+ "mappings": ";AAAA,SAAgB,iBAAiB;;;ACyYjC,SAAS,0BAA0B,OAAO;AACxC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,IAAI;AACJ,QAAM,gBAAgB,EAAE,GAAG,MAAM;AACjC,MAAI,cAAc,iBAAiB;AACjC,WAAO,cAAc;AAAA,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;AAAA,IACL;AAAA,IACA;AAAA,IACA,QAAQ,CAAC,UAAgB;AACvB,YAAM,cAAc,4BAA4B,KAAK;AACrD,YAAM,oBAAoB,KAAK,UAAU,WAAW;AAEpD,YAAM,SAAS,GACb,OAAO,SAAS,aACb,OAAO,SAAS,SAAS,QAAQ,cAAc,EAAE;AAEtD,YAAM,kBAAkB,mBAAmB,iBAAiB;AAC5D,YAAM,YAAY,GAAG,iBAAiB,qBAAqB;AAE3D,gBAAU,MAAM;AACd,cAAM,kBAAkB,SAAS,cAAc,mBAAmB;AAClE,YAAI,iBAAiB;AACnB,0BAAgB,aAAa,OAAO,SAAS;AAC7C,iBAAO,MAAM;AACX,4BAAgB,OAAO;AAAA,UACzB;AAAA,QACF;AAEA,cAAM,gBAAgB,SAAS,cAAc,QAAQ;AACrD,sBAAc,aAAa,OAAO,SAAS;AAC3C,sBAAc,aAAa,MAAM,kBAAkB;AACnD,sBAAc;AAAA,UACZ;AAAA,UACA;AAAA,QACF;AAEA,iBAAS,cAAc,iBAAiB,EAAE,YAAY,aAAa;AAEnE,eAAO,MAAM;AACX,wBAAc,OAAO;AAAA,QACvB;AAAA,MACF,GAAG,CAAC,SAAS,CAAC;AAEd,aAAO,oBAAC,SAAI;AAAA,IACd;AAAA,EACF;AACF;",
6
+ "names": ["createServerRenderContextV2", "createServerRenderContext"]
7
+ }
@@ -557,6 +557,7 @@ __export(dist_exports, {
557
557
  ENABLED_FEATURES_GATE_MAP: () => ENABLED_FEATURES_GATE_MAP,
558
558
  ENTRY_POINTS_PATH: () => ENTRY_POINTS_PATH,
559
559
  GATES: () => GATES,
560
+ GlobalPartialSlot: () => GlobalPartialSlot,
560
561
  MODULE_FOLDER_PATH: () => MODULE_FOLDER_PATH,
561
562
  ModuleSlot: () => ModuleSlot,
562
563
  TEMPLATE_FOLDER_PATH: () => TEMPLATE_FOLDER_PATH,
@@ -1160,6 +1161,17 @@ function ModuleSlot(props) {
1160
1161
  }
1161
1162
  );
1162
1163
  }
1164
+ function GlobalPartialSlot(props) {
1165
+ return /* @__PURE__ */ jsx(
1166
+ "div",
1167
+ {
1168
+ suppressHydrationWarning: true,
1169
+ dangerouslySetInnerHTML: {
1170
+ __html: `<!-- hs-global-partial-placeholder-${props.name} -->`
1171
+ }
1172
+ }
1173
+ );
1174
+ }
1163
1175
  var setProperty, getProperty, hasProperty, serializeIslandDataForInlineScript, writeSharedStateToJsGlobal, createIslandsGlobalJsForClientInDev, traverse, CMS_MODULE_COMPONENT_NAME, DND_AREA_COMPONENT_NAME, PLUGIN_NAME, promiseForNewWritableStream, renderStreamToPromise, createServerRenderContextV22, createServerRenderContext2, renderServerSidePropsWithAsyncLocalStoreContext, bootStrapRenderContext;
1164
1176
  var init_dist = __esm({
1165
1177
  "../cms-js-internal/dist/index.js"() {
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../cms-js-internal/dist/basicUtils.js", "../../../cms-js-internal/dist/index.js", "../../src/storybook-main/main.ts"],
4
+ "sourcesContent": ["import path from \"path\";\nimport { createHash } from \"crypto\";\nimport fs, { readFileSync, existsSync, readdirSync, lstatSync } from \"fs\";\nimport { join } from \"path/posix\";\nconst COMPONENT_EXTENSIONS = [\".jsx\", \".tsx\", \".js\", \".ts\"];\nconst ENTRY_POINTS_PATH = \"components/partials/\";\nconst MODULE_FOLDER_PATH = \"components/modules/\";\nconst VIRTUAL_ISLAND_RUNTIME = \"virtual:island-runtime\";\nconst VIRTUAL_CONFIG_SETUP = \"virtual:config-setup\";\nconst CSS_LANGS_RE = /\\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\\?)/;\nconst collectCssModules = (modulePathToStartWith, viteServer, cssModulesImported = /* @__PURE__ */ new Set()) => {\n const appModulesForPath = viteServer.moduleGraph.fileToModulesMap.get(\n modulePathToStartWith\n );\n if (!appModulesForPath || appModulesForPath.size === 0) {\n throw new Error(`No modules at: ${modulePathToStartWith}`);\n } else if (appModulesForPath.size > 1) {\n throw new Error(`More than one module at: ${modulePathToStartWith}`);\n }\n const appModule = Array.from(appModulesForPath.values())[0];\n const allServerSideModulesImported = /* @__PURE__ */ new Set();\n const newCssModules = [];\n const moduleQueue = Array.from(appModule.importedModules);\n for (const importedModule of moduleQueue) {\n if (allServerSideModulesImported.has(importedModule.id)) {\n continue;\n }\n allServerSideModulesImported.add(importedModule.id);\n const isCss = CSS_LANGS_RE.test(importedModule.file);\n const moduleModulesToQueue = Array.from(importedModule.importedModules);\n if (isCss && !cssModulesImported.has(importedModule)) {\n cssModulesImported.add(importedModule);\n newCssModules.push(importedModule);\n }\n moduleQueue.push(...moduleModulesToQueue);\n }\n return newCssModules;\n};\nfunction createPreloadLink(assetPath, basePath = \"\") {\n if (assetPath && assetPath[0] !== \"/\") {\n assetPath = `/${assetPath}`;\n }\n if (assetPath.endsWith(\".js\")) {\n return `<link rel=\"modulepreload\" crossorigin href=\"${basePath}${assetPath}\">`;\n } else if (CSS_LANGS_RE.test(assetPath)) {\n return `<link rel=\"stylesheet\" href=\"${basePath}${assetPath}?css\">`;\n } else if (assetPath.endsWith(\".woff\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"font\" type=\"font/woff\" crossorigin>`;\n } else if (assetPath.endsWith(\".woff2\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"font\" type=\"font/woff2\" crossorigin>`;\n } else if (assetPath.endsWith(\".gif\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/gif\">`;\n } else if (assetPath.endsWith(\".jpg\") || assetPath.endsWith(\".jpeg\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/jpeg\">`;\n } else if (assetPath.endsWith(\".png\")) {\n return ` <link rel=\"preload\" href=\"${basePath}${assetPath}\" as=\"image\" type=\"image/png\">`;\n } else {\n throw new Error(`Unknown preload type for ${assetPath}`);\n }\n}\nconst collectCssInDev = (modulePathToStartWith, viteServer, cssModulesImported = /* @__PURE__ */ new Set()) => {\n return `${collectCssModules(\n modulePathToStartWith,\n viteServer,\n cssModulesImported\n ).map((cssModule) => createPreloadLink(cssModule.url)).join(\"\\n\")}\n`;\n};\nconst badInlineJsChars = /[\\u2028\\u2029<>/]/g;\nconst inlineJsEscapeChars = {\n \"\\u2028\": \"\\\\u2028\",\n \"\\u2029\": \"\\\\u2029\",\n \"<\": \"\\\\u003C\",\n \">\": \"\\\\u003E\",\n \"/\": \"\\\\u002F\"\n};\nfunction escapeChar(unsafeChar) {\n return inlineJsEscapeChars[unsafeChar];\n}\nfunction escapeForInlineJS(input) {\n return input.replace(badInlineJsChars, escapeChar);\n}\nfunction jsonStringifyAndEscapeForInlineJS(input, { baseIndent = 0, jsonIndent = 2, prettyPrint = true } = {}) {\n const indentString = \" \".repeat(baseIndent);\n jsonIndent = prettyPrint ? jsonIndent : void 0;\n return escapeForInlineJS(JSON.stringify(input, null, jsonIndent)).replace(\n /\\n/gm,\n `\n${indentString}`\n );\n}\nlet viteRoot;\nlet viteCommand;\nfunction resolveIslandPlugin(islandsSet) {\n return {\n enforce: \"pre\",\n name: \"resolve-islands\",\n configResolved(config) {\n viteRoot = config.root;\n viteCommand = config.command;\n },\n load(id) {\n if (id.endsWith(\"?island\") || id.endsWith(\"?client\")) {\n const [idWithNoParam] = id.split(\"?\");\n const islandModuleImportPath = `${idWithNoParam}?client-entry`;\n const componentExtension = path.extname(idWithNoParam);\n const componentFilenameWithNoExtension = path.basename(\n idWithNoParam,\n componentExtension\n );\n const modulePath = idWithNoParam.replace(`${viteRoot}/`, \"\");\n const moduleId = (viteCommand === \"serve\" ? idWithNoParam : modulePath).concat(\"?client-entry\");\n if (islandsSet) {\n islandsSet.add(moduleId);\n }\n return `\n const moduleId = '${moduleId}';\n\n const lazyComponent = () => import('${islandModuleImportPath}');\n lazyComponent.moduleName = '${componentFilenameWithNoExtension}';\n lazyComponent.moduleId = moduleId;\n\n export default lazyComponent;\n `;\n }\n return null;\n }\n };\n}\nfunction resolveIslandToPlainModulePlugin(enabled = true) {\n return {\n enforce: \"pre\",\n name: \"resolve-islands-to-plain\",\n configResolved(config) {\n viteRoot = config.root;\n viteCommand = config.command;\n },\n async resolveId(id, importer, options) {\n if (enabled && (id.endsWith(\"?island\") || id.endsWith(\"?client\"))) {\n const newId = id.replace(\"?island\", \"\").replace(\"?client\", \"\");\n const resolution = await this.resolve(newId, importer, {\n skipSelf: true,\n ...options\n });\n if (resolution) {\n return resolution;\n }\n }\n return null;\n }\n };\n}\nfunction resolveIslandToPlainModuleNoopPlugin() {\n return resolveIslandToPlainModulePlugin(false);\n}\nconst clientRenderIsland = \"import type { RenderableIsland } from '@hubspot/cms-components';\\nimport * as cmsComponents from '@hubspot/cms-components';\\nimport { ClientRenderContextProvider } from '@hubspot/cms-components';\\nimport { Suspense } from 'react';\\nimport ReactDOMClient from 'react-dom/client';\\n\\nconst buildIslandIdentifierPrefix =\\n cmsComponents.buildIslandIdentifierPrefix || ((id) => id);\\n\\nexport function clientRenderIsland(\\n renderableIsland: RenderableIsland,\\n Component: React.ComponentType<any>\\n) {\\n const {\\n island,\\n rootElement,\\n postHydration,\\n pageUrl,\\n islands,\\n basePath,\\n WrapperModule,\\n } = renderableIsland;\\n let reactRoot: any;\\n\\n const rootOptions = {\\n // Ensure useId is unique across island roots\\n identifierPrefix: buildIslandIdentifierPrefix(renderableIsland.island.id),\\n };\\n\\n let innerComponent = <Component islandId={island.id} {...island.props} />;\\n if (WrapperModule) {\\n innerComponent = <WrapperModule>{innerComponent}</WrapperModule>;\\n }\\n\\n const elementsToHydrate = (\\n <Suspense fallback={`client hydrate fail/waiting for ${island.id}`}>\\n <ClientRenderContextProvider\\n pageUrl={pageUrl}\\n islands={islands}\\n onTopLevelHydrationFinish={postHydration}\\n island={island}\\n basePath={basePath}\\n >\\n {innerComponent}\\n </ClientRenderContextProvider>\\n </Suspense>\\n );\\n\\n if (island.clientOnly) {\\n reactRoot = ReactDOMClient.createRoot(rootElement, rootOptions);\\n reactRoot.render(elementsToHydrate);\\n } else {\\n reactRoot = ReactDOMClient.hydrateRoot(\\n rootElement,\\n elementsToHydrate,\\n rootOptions\\n );\\n }\\n return reactRoot;\\n}\\n\";\nconst virtualClientRenderIslandModuleId = \"virtual:clientRenderIsland.tsx\";\nfunction clientIslandEntryPlugin() {\n return {\n enforce: \"pre\",\n name: \"client-island-entry-plugin\",\n resolveId(id) {\n if (id === virtualClientRenderIslandModuleId) {\n return virtualClientRenderIslandModuleId;\n }\n return null;\n },\n load(id) {\n if (id.endsWith(\"?client-entry\")) {\n const [idWithNoParam] = id.split(\"?\");\n return `\n import { clientRenderIsland } from '${virtualClientRenderIslandModuleId}';\n import Component from '${idWithNoParam}';\n\n export function render(island) {\n return clientRenderIsland(island, Component)\n }\n\n export default Component;\n `;\n }\n if (id === virtualClientRenderIslandModuleId) {\n return clientRenderIsland;\n }\n return null;\n }\n };\n}\nconst scriptTagToLogServerMessages = (messagesForBrowser, groupLabel, nonceAttribute) => {\n if (!messagesForBrowser) {\n return \"\";\n }\n const consoleLines = [];\n for (const message of messagesForBrowser) {\n let funcString = \"console.log\";\n if (message.level === \"error\") {\n funcString = \"console.error\";\n }\n if (message.level === \"warn\") {\n funcString = \"console.warn\";\n }\n const argString = message.parameters.map((arg) => JSON.stringify(arg)).join(\", \");\n consoleLines.push(` ${funcString}(${argString});`);\n }\n let groupStart = \"\";\n let groupEnd = \"\";\n if (groupLabel !== void 0 && groupLabel !== null) {\n groupStart = `\n console.group(${JSON.stringify(groupLabel)});`;\n groupEnd = ` console.groupEnd()\n`;\n }\n return `<script ${nonceAttribute}>${groupStart}\n${consoleLines.join(\"\\n\")}\n${groupEnd}<\\/script>\n`;\n};\nconst getComponentExtension = (componentPath) => {\n const filteredExtensions = COMPONENT_EXTENSIONS.filter(\n (ext) => componentPath.endsWith(ext)\n );\n if (filteredExtensions.length === 1) {\n return filteredExtensions[0];\n }\n return void 0;\n};\nconst hasComponentExtension = (componentPath) => {\n return !!getComponentExtension(componentPath);\n};\nconst isStorybookStory = (componentPath) => {\n return !!path.basename(componentPath, path.extname(componentPath)).endsWith(\".stories\");\n};\nconst removeComponentExtension = (componentPath) => {\n const ext = getComponentExtension(componentPath);\n if (ext == null) {\n return componentPath;\n }\n return componentPath.slice(0, -1 * ext.length);\n};\nfunction getEntryPointHash(entryPoint) {\n return createHash(\"md5\").update(entryPoint).digest(\"hex\").slice(0, 6);\n}\nfunction getEntryPointHashWithIndexSuffix(entryPoint, index) {\n const renderIndexSuffix = index != null ? `i${index}` : \"\";\n return `${getEntryPointHash(entryPoint)}${renderIndexSuffix}`;\n}\nconst COMBINED_REACT_BASE_PATH = \"https://static.hsappstatic.net/cms-js-static/ex/js/react/v18\";\nconst ISLAND_RUNTIME_CONFIG_BASE_PATH = \"https://static.hsappstatic.net/cms-js-static/ex/js/island-runtime/v1\";\nfunction getCombinedReactUrl() {\n const hsEnv = process.env.HS_ENV;\n const fileVersion = hsEnv === \"prod\" ? `react-combined.mjs` : \"react-combined-qa.mjs\";\n return `${COMBINED_REACT_BASE_PATH}/${fileVersion}`;\n}\nfunction getIslandRuntimeConfigUrl() {\n const hsEnv = process.env.HS_ENV;\n const fileVersion = hsEnv === \"prod\" ? `island-runtime.mjs` : \"island-runtime-qa.mjs\";\n return `${ISLAND_RUNTIME_CONFIG_BASE_PATH}/${fileVersion}`;\n}\nfunction includesHublDataReference(templateSource) {\n const hublDataPattern = /\\{%\\s+set\\s+(experimentalHublData|hublData)\\s*=/;\n return !!templateSource.match(hublDataPattern);\n}\nconst removeIndexFromPath = (id) => {\n return id.replace(/\\/index\\.[jt]sx?$/, \"\");\n};\nconst removeIndexOrTrailingJsFromPath = (id) => {\n return removeIndexFromPath(id).replace(/\\.[jt]sx?$/, \"\");\n};\nconst HEALTHCHECKS_ENABLED_DEFAULT = true;\nconst HEALTHCHECKS_STRICT_DEFAULT = false;\nfunction getCMSAssetConfig(webRoot) {\n const cmsAssetsPath = path.join(webRoot, \"cms-assets.json\");\n const cmsThemePath = path.join(webRoot, \"theme.json\");\n const configPathToUse = fs.existsSync(cmsAssetsPath) ? cmsAssetsPath : cmsThemePath;\n const parsedConfig = JSON.parse(\n fs.readFileSync(configPathToUse).toString()\n );\n return parsedConfig;\n}\nfunction getCMSAssetConfigIfExists(webRoot) {\n try {\n return getCMSAssetConfig(webRoot);\n } catch (e) {\n console.error(\n `Error finding or parsing cms-assets.json in ${webRoot}, but ignoring for now`\n );\n return {};\n }\n}\nfunction areBuildHealthChecksEnabled(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.healthchecks) == null ? void 0 : _b.enabled) ?? HEALTHCHECKS_ENABLED_DEFAULT;\n}\nfunction doHealthChecksFailTheBuild(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.healthchecks) == null ? void 0 : _b.strict) ?? HEALTHCHECKS_STRICT_DEFAULT;\n}\nfunction getServerIncludePrebundleDepPatterns(config) {\n var _a, _b;\n return ((_b = (_a = config.buildConfig) == null ? void 0 : _a.serverPrebundling) == null ? void 0 : _b.include) ?? [];\n}\nconst BUILD_INFO_PATH = \"/build-info.json\";\nfunction getBuildInfo(buildDir) {\n try {\n const buildInfo = JSON.parse(\n readFileSync(path.join(buildDir, BUILD_INFO_PATH)).toString()\n );\n return buildInfo;\n } catch (e) {\n throw new Error(`Error loading build-info.json, path: ${BUILD_INFO_PATH}`);\n }\n}\nfunction getBaseAssetUrlFromBuild(buildDir) {\n return getBuildInfo(buildDir).baseAssetUrl;\n}\nconst GATES = [\n \"CMS:JSRenderer:GetServerSideProps\",\n \"CMS:JSRenderer:ModuleHubl\",\n \"CMS:JSRenderer:RemoveCjsPlugin\",\n \"CMS:JSRenderer:RemoveMockClientEntryPlugin\",\n \"CMS:JSRenderer:AnalyzeCmsModules\"\n];\nconst ENABLED_FEATURES_GATE_MAP = {\n \"cms:jsr:getServerSideProps\": \"CMS:JSRenderer:GetServerSideProps\",\n \"cms:jsr:RemoveCjsPlugin\": \"CMS:JSRenderer:RemoveCjsPlugin\",\n \"cms:jsr:analyzeCmsModules\": \"CMS:JSRenderer:AnalyzeCmsModules\"\n};\nfunction isUngatedFor(gates, gate) {\n return gates.includes(gate);\n}\nfunction ungatedAtBuildTimeFor(buildDir, gate) {\n try {\n const buildInfo = getBuildInfo(buildDir);\n return isUngatedFor(buildInfo.gates, gate);\n } catch (e) {\n return false;\n }\n}\nconst findAllComponentsIn = (webRoot, componentsFolder) => {\n const fullComponentsFolderPath = join(webRoot, componentsFolder);\n const componentsByName = {};\n if (!existsSync(fullComponentsFolderPath)) {\n return componentsByName;\n }\n readdirSync(fullComponentsFolderPath).forEach((fileOrFolderName) => {\n const fullPath = join(fullComponentsFolderPath, fileOrFolderName);\n const subdirPath = join(componentsFolder, fileOrFolderName);\n const isDirectory = lstatSync(fullPath).isDirectory();\n if (!isDirectory && hasComponentExtension(fileOrFolderName) && !isStorybookStory(fileOrFolderName)) {\n const subdirPathNoExtension = removeComponentExtension(subdirPath);\n componentsByName[subdirPathNoExtension] = subdirPath;\n } else if (isDirectory) {\n for (const potentialExtension of COMPONENT_EXTENSIONS) {\n const potentialIndexModule = join(\n subdirPath,\n `index${potentialExtension}`\n );\n const fullPotentialPath = join(\n fullPath,\n `index${potentialExtension}`\n );\n if (existsSync(fullPotentialPath)) {\n const moduleIndexPathNoExtension = removeComponentExtension(potentialIndexModule);\n componentsByName[moduleIndexPathNoExtension] = potentialIndexModule;\n break;\n }\n }\n }\n });\n return componentsByName;\n};\nfunction findAllModulesInRoot(webRoot) {\n const allModuleComponents = findAllComponentsIn(\n webRoot,\n \"./components/modules\"\n );\n const moduleNames = Object.keys(allModuleComponents).map(\n (moduleSubpath) => moduleSubpath.replace(\"components/modules/\", \"\").replace(\"/index\", \"\")\n );\n const moduleSubpaths = Object.keys(allModuleComponents);\n return { moduleNames, moduleSubpaths };\n}\nfunction findAllPartialsInRoot(webRoot) {\n const allPartialComponents = findAllComponentsIn(\n webRoot,\n \"./components/partials\"\n );\n const partialNames = Object.keys(allPartialComponents).map(\n (partialSubpath) => partialSubpath.replace(\"components/partials/\", \"\").replace(\"/index\", \"\")\n );\n const partialSubpaths = Object.keys(allPartialComponents);\n return { partialNames, partialSubpaths };\n}\nfunction namespaceModulePropsShape(props) {\n const {\n dataQueryResult,\n hublParameters,\n fieldValues: passedFieldValues,\n hublData,\n experimentalHublData,\n moduleName,\n supplementalFieldValues\n } = props;\n const oldPropsShape = { ...props };\n if (oldPropsShape.dataQueryResult) {\n delete oldPropsShape.dataQueryResult;\n }\n if (oldPropsShape.hublParameters) {\n delete oldPropsShape.hublParameters;\n }\n const fieldValues = passedFieldValues || oldPropsShape;\n return {\n ...fieldValues,\n dataQueryResult,\n fieldValues,\n hublParameters,\n hublData,\n experimentalHublData,\n moduleName,\n supplementalFieldValues\n };\n}\nfunction setIn(object, nestedKeysArray, value) {\n let curr = object;\n const finalKey = nestedKeysArray.pop();\n for (let index = 0; index < nestedKeysArray.length; index++) {\n const currentKey = nestedKeysArray[index];\n const nextKey = nestedKeysArray[index + 1];\n if (Number.isInteger(nextKey) || !nextKey && Number.isInteger(finalKey)) {\n if (curr[currentKey] === void 0) {\n curr[currentKey] = [];\n }\n }\n if (curr[currentKey] === void 0) {\n curr[currentKey] = {};\n }\n curr = curr[currentKey];\n }\n if (value !== void 0) {\n curr[finalKey] = value;\n }\n}\nfunction isStylesheetAsset(staticAsset) {\n return staticAsset.type === \"stylesheet\";\n}\nexport {\n COMPONENT_EXTENSIONS,\n CSS_LANGS_RE,\n ENABLED_FEATURES_GATE_MAP,\n ENTRY_POINTS_PATH,\n GATES,\n MODULE_FOLDER_PATH,\n VIRTUAL_CONFIG_SETUP,\n VIRTUAL_ISLAND_RUNTIME,\n getBaseAssetUrlFromBuild as a,\n areBuildHealthChecksEnabled,\n clientIslandEntryPlugin,\n collectCssInDev,\n collectCssModules,\n doHealthChecksFailTheBuild,\n escapeForInlineJS,\n findAllComponentsIn,\n findAllModulesInRoot,\n findAllPartialsInRoot,\n getBuildInfo as g,\n getCMSAssetConfig,\n getCMSAssetConfigIfExists,\n getCombinedReactUrl,\n getComponentExtension,\n getEntryPointHash,\n getEntryPointHashWithIndexSuffix,\n getIslandRuntimeConfigUrl,\n getServerIncludePrebundleDepPatterns,\n hasComponentExtension,\n includesHublDataReference,\n isStorybookStory,\n isStylesheetAsset,\n isUngatedFor,\n jsonStringifyAndEscapeForInlineJS,\n namespaceModulePropsShape,\n removeComponentExtension,\n removeIndexFromPath,\n removeIndexOrTrailingJsFromPath,\n resolveIslandPlugin,\n resolveIslandToPlainModuleNoopPlugin,\n resolveIslandToPlainModulePlugin,\n scriptTagToLogServerMessages,\n setIn,\n ungatedAtBuildTimeFor,\n virtualClientRenderIslandModuleId\n};\n", "import { jsonStringifyAndEscapeForInlineJS, scriptTagToLogServerMessages } from \"./basicUtils.js\";\nimport { COMPONENT_EXTENSIONS, CSS_LANGS_RE, ENABLED_FEATURES_GATE_MAP, ENTRY_POINTS_PATH, GATES, MODULE_FOLDER_PATH, VIRTUAL_CONFIG_SETUP, VIRTUAL_ISLAND_RUNTIME, areBuildHealthChecksEnabled, clientIslandEntryPlugin, collectCssInDev, collectCssModules, doHealthChecksFailTheBuild, escapeForInlineJS, findAllComponentsIn, findAllModulesInRoot, findAllPartialsInRoot, a, g, getCMSAssetConfig, getCMSAssetConfigIfExists, getCombinedReactUrl, getComponentExtension, getEntryPointHash, getEntryPointHashWithIndexSuffix, getIslandRuntimeConfigUrl, getServerIncludePrebundleDepPatterns, hasComponentExtension, includesHublDataReference, isStorybookStory, isStylesheetAsset, isUngatedFor, namespaceModulePropsShape, removeComponentExtension, removeIndexFromPath, removeIndexOrTrailingJsFromPath, resolveIslandPlugin, resolveIslandToPlainModuleNoopPlugin, resolveIslandToPlainModulePlugin, setIn, ungatedAtBuildTimeFor, virtualClientRenderIslandModuleId } from \"./basicUtils.js\";\nimport * as dotProp from \"dot-prop\";\nimport * as parser from \"@babel/parser\";\nimport _traverse from \"@babel/traverse\";\nimport * as t from \"@babel/types\";\nimport { jsx } from \"react/jsx-runtime\";\nimport stream from \"stream\";\nimport { renderToPipeableStream, renderToStaticMarkup } from \"react-dom/server\";\nimport * as cmsComponents from \"@hubspot/cms-components\";\nimport { ServerRenderContext } from \"@hubspot/cms-components\";\nimport { isValidElement, cloneElement } from \"react\";\nimport \"path\";\nimport \"crypto\";\nimport \"fs\";\nimport \"path/posix\";\nconst { setProperty, getProperty, hasProperty } = dotProp;\nconst serializeIslandDataForInlineScript = (tweakedIslandsArray, perServerRequestData, baseIndent = 0, prettyPrint) => {\n const islandsArrayToSerialize = tweakedIslandsArray.map(\n ({\n id,\n moduleName,\n moduleId,\n props,\n hydrateOn,\n clientOnly,\n priority,\n url,\n sharedStateID,\n supplementalFieldValues,\n wrapperModuleId,\n wrapperUrl\n }) => {\n const output = {\n id,\n moduleName,\n moduleId,\n hydrateOn,\n clientOnly,\n priority,\n props,\n url\n };\n if (sharedStateID) {\n output.sharedStateID = sharedStateID;\n }\n if (wrapperModuleId) {\n output.wrapperModuleId = wrapperModuleId;\n }\n if (wrapperUrl) {\n output.wrapperUrl = wrapperUrl;\n }\n const filteredSupplementalFieldValues = filterOutUnreadSupplementalFieldValues(\n supplementalFieldValues,\n perServerRequestData.get(\"supplementalFieldValuesRead\")\n );\n if (filteredSupplementalFieldValues) {\n output.supplementalFieldValues = filteredSupplementalFieldValues;\n }\n return output;\n }\n );\n return jsonStringifyAndEscapeForInlineJS(islandsArrayToSerialize, {\n baseIndent,\n jsonIndent: 2,\n prettyPrint\n });\n};\nfunction filterOutUnreadSupplementalFieldValues(supplementalFieldValues, supplementalFieldValuesRead) {\n if (!supplementalFieldValues) {\n return supplementalFieldValues;\n }\n if (!supplementalFieldValuesRead) {\n return supplementalFieldValues;\n }\n const result = {};\n Array.from(supplementalFieldValuesRead).forEach((fieldPath) => {\n if (hasProperty(supplementalFieldValues, fieldPath)) {\n setProperty(\n result,\n fieldPath,\n getProperty(supplementalFieldValues, fieldPath)\n );\n }\n });\n return result;\n}\nconst writeSharedStateToJsGlobal = (islands, perServerRequestData, indent = 0, prettyPrint) => {\n const sharedStateIDs = islands.map((island) => island.sharedStateID).filter((x) => !!x);\n if (sharedStateIDs.length > 0) {\n const indentString = \" \".repeat(indent);\n const stateByID = {};\n sharedStateIDs.forEach(\n (id) => stateByID[id] = perServerRequestData.get(id)\n );\n const stringifiedState = jsonStringifyAndEscapeForInlineJS(stateByID, {\n prettyPrint,\n jsonIndent: 2\n });\n return `\n\nvar newState = ${stringifiedState};\nif(window.__hsSSInit) {\n window.__hsSSInit = Object.assign(window.__hsSSInit, newState);\n} else {\n window.__hsSSInit = newState;\n}`.replace(/\\n/gm, `\n${indentString}`);\n }\n return \"\";\n};\nfunction getIslandUrls(roots, viteDevServer) {\n return roots.map((island) => {\n const islandModule = viteDevServer.moduleGraph.getModuleById(\n island.moduleId\n );\n if (!islandModule) {\n throw new Error(`Unknown island moduleId: ${island.moduleId}`);\n }\n let wrapperModule;\n if (island.wrapperModuleId) {\n wrapperModule = viteDevServer.moduleGraph.getModuleById(\n island.wrapperModuleId\n );\n }\n const tweakedIsland = {\n ...island,\n url: islandModule.url,\n wrapperUrl: wrapperModule ? wrapperModule.url : void 0\n };\n return tweakedIsland;\n });\n}\nfunction getPerServerRequestUrls(perServerRequestData, viteDevServer) {\n if (!perServerRequestData.has(\"sharedStateIDs\")) {\n return new Map(perServerRequestData);\n }\n const perServerRequestDataWithUrls = new Map(\n perServerRequestData\n );\n perServerRequestData.get(\"sharedStateIDs\").forEach((id) => {\n const reducer = perServerRequestData.get(id);\n if (reducer.reducerFuncModuleId) {\n const reducerWithUrl = {\n ...reducer,\n reducerFuncModuleUrl: viteDevServer.moduleGraph.getModuleById(\n reducer.reducerFuncModuleId\n ).url\n };\n perServerRequestDataWithUrls.set(id, reducerWithUrl);\n }\n });\n return perServerRequestDataWithUrls;\n}\nconst createIslandsGlobalJsForClientInDev = (roots, perServerRequestData, viteDevServer, indent, prettyPrint) => {\n const islands = getIslandUrls(roots, viteDevServer);\n const perServerRequestDataWithUrls = getPerServerRequestUrls(\n perServerRequestData,\n viteDevServer\n );\n return `${\" \".repeat(\n indent\n )}window.__islands = ${serializeIslandDataForInlineScript(\n islands,\n perServerRequestData,\n indent,\n prettyPrint\n )}${writeSharedStateToJsGlobal(\n islands,\n perServerRequestDataWithUrls,\n indent,\n prettyPrint\n )}`;\n};\nfunction noncePlaceholderPlugin() {\n const HS_DEPLOYED = process.env.AWS_EXECUTION_ENV != null || process.env.HS_DEPLOYED === \"true\";\n return {\n name: \"hs-nonce-placeholder\",\n enforce: \"post\",\n apply() {\n return HS_DEPLOYED;\n },\n transformIndexHtml(html) {\n const regex = /<(style|script|link) (.*)>/gi;\n const replacer = (_, p1, p2) => {\n if (p1 === \"style\" || p1 === \"script\" || // if link, only nonce for stylesheet\n p1 === \"link\" && p2.includes('rel=\"stylesheet\"')) {\n const noncePlaceholderValue = p1 === \"script\" ? \"hs-random-nonce\" : \"hs-random-style-nonce\";\n p2 = `nonce=\"${noncePlaceholderValue}\" ${p2}`;\n }\n return `<${p1} ${p2}>`;\n };\n return html.replace(regex, replacer);\n }\n };\n}\nconst traverse = _traverse.default;\nconst CMS_MODULE_COMPONENT_NAME = \"UnstableModule\";\nfunction findCmsModules(cmsModules = {}) {\n let config;\n return {\n enforce: \"pre\",\n name: \"findCmsModules\",\n configResolved(resolvedConfig) {\n config = resolvedConfig;\n },\n transform(code, id) {\n const moduleInfo = this.getModuleInfo(id);\n const isExternal = config.command === \"serve\" ? false : moduleInfo.isExternal;\n if (isExternal || !moduleInfo.id.startsWith(config.root) || !code.includes(CMS_MODULE_COMPONENT_NAME)) {\n return null;\n }\n const localCmsModules = {};\n const sourceAst = parser.parse(code, {\n sourceType: \"module\",\n plugins: [\"jsx\", \"typescript\"]\n });\n let unstableModuleLocalName = CMS_MODULE_COMPONENT_NAME;\n const pluginError = this.error.bind(this);\n traverse(sourceAst, {\n ImportDeclaration(path) {\n if (!t.isStringLiteral(path.node.source, {\n value: \"@hubspot/cms-components\"\n })) {\n return null;\n }\n for (const specifier of path.node.specifiers) {\n if (t.isImportSpecifier(specifier) && t.isIdentifier(specifier.imported, {\n name: CMS_MODULE_COMPONENT_NAME\n })) {\n unstableModuleLocalName = specifier.local.name;\n }\n }\n },\n JSXOpeningElement(path) {\n if (!t.isJSXIdentifier(path.node.name, {\n name: unstableModuleLocalName\n }) || path.node.attributes.length !== 2) {\n return null;\n }\n let cmsModuleName;\n let cmsModulePath;\n for (const prop of path.node.attributes) {\n if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: \"name\" }) && t.isStringLiteral(prop.value)) {\n cmsModuleName = prop.value.value;\n continue;\n }\n if (t.isJSXAttribute(prop) && t.isJSXIdentifier(prop.name, { name: \"path\" }) && t.isStringLiteral(prop.value)) {\n cmsModulePath = prop.value.value;\n continue;\n }\n pluginError(\n new Error(\n `Error: ${id.replace(config.root, \"\")}:${prop.loc.start.line} \"name\" and \"path\" must be primitive strings`\n )\n );\n }\n const cmsModuleProps = {\n name: cmsModuleName,\n path: cmsModulePath\n };\n if (Object.hasOwn(localCmsModules, cmsModuleProps.name)) {\n pluginError(\n new Error(\n `Error: multiple <${CMS_MODULE_COMPONENT_NAME} /> with duplicate name: ${cmsModuleProps.name}`\n )\n );\n }\n localCmsModules[cmsModuleProps.name] = cmsModuleProps;\n }\n });\n return {\n meta: {\n findCmsModules: localCmsModules\n }\n };\n },\n buildEnd(error) {\n if (error)\n throw error;\n const modulesWithCmsModuleUsage = Array.of(\n ...this.getModuleIds()\n ).filter((moduleId) => moduleId.startsWith(config.root)).map((moduleId) => this.getModuleInfo(moduleId)).filter(\n (moduleInfo) => Object.hasOwn(moduleInfo.meta, \"findCmsModules\")\n );\n const moduleToEntryPoints = {};\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n moduleToEntryPoints[moduleWithCmsModuleUsage.id] = findEntryPoints(\n this,\n moduleWithCmsModuleUsage\n );\n }\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const usageInModuleEntryPoint = moduleToEntryPoints[moduleWithCmsModuleUsage.id].find((entryPoint) => entryPoint.id.includes(\"/components/modules\"));\n if (usageInModuleEntryPoint) {\n this.error(`\n Error: <${CMS_MODULE_COMPONENT_NAME} /> can only be used in Partials.\n Module: ${usageInModuleEntryPoint.id === moduleWithCmsModuleUsage.id ? usageInModuleEntryPoint.id.replace(config.root, \"\") : `imports: ${moduleWithCmsModuleUsage.id.replace(\n config.root,\n \"\"\n )}, which`} contains a <${CMS_MODULE_COMPONENT_NAME} />\n `);\n }\n }\n const root = config.root;\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const islandsContainingCmsModuleUsage = checkModuleTreeForIslands(\n this,\n moduleWithCmsModuleUsage\n );\n if (islandsContainingCmsModuleUsage.length > 0) {\n throw new Error(`\n <${CMS_MODULE_COMPONENT_NAME} /> cannot be used within islands.\n ${formatIslandImporter(\n moduleWithCmsModuleUsage.id,\n root\n )} uses <${CMS_MODULE_COMPONENT_NAME} /> and is used by islands:\n ${islandsContainingCmsModuleUsage.map(\n (islandModuleInfo) => formatIslandImporter(islandModuleInfo.id, root)\n ).join(\", \")}\n `);\n }\n }\n for (const moduleWithCmsModuleUsage of modulesWithCmsModuleUsage) {\n const entryPoints = moduleToEntryPoints[moduleWithCmsModuleUsage.id];\n for (const entryPoint of entryPoints) {\n const relativeEntryPoint = entryPoint.id.replace(root, \"\");\n if (!Object.hasOwn(cmsModules, relativeEntryPoint)) {\n cmsModules[relativeEntryPoint] = {};\n }\n for (const [cmsModuleName, cmsModuleValue] of Object.entries(\n moduleWithCmsModuleUsage.meta.findCmsModules\n )) {\n if (Object.hasOwn(cmsModules[relativeEntryPoint], cmsModuleName)) {\n this.error(`Error: duplicate module name: ${cmsModuleName}`);\n }\n cmsModules[relativeEntryPoint][cmsModuleName] = cmsModuleValue;\n }\n }\n }\n }\n };\n}\nfunction findEntryPoints(ctx, moduleInfo) {\n if (moduleInfo.isEntry) {\n return [moduleInfo];\n }\n const result = [];\n for (const importer of moduleInfo.importers) {\n const importerModuleInfo = ctx.getModuleInfo(importer);\n const entryPoints = findEntryPoints(ctx, importerModuleInfo);\n result.push(...entryPoints);\n }\n return result;\n}\nfunction checkModuleTreeForIslands(ctx, module) {\n if (module.id.endsWith(\"?client-entry\")) {\n return [module];\n }\n const importerResults = [];\n for (const importer of module.importers) {\n const importerInfo = ctx.getModuleInfo(importer);\n const importerResult = checkModuleTreeForIslands(ctx, importerInfo);\n importerResults.push(importerResult);\n }\n return importerResults.flat();\n}\nfunction formatIslandImporter(id, root) {\n return id.replace(root, \"\").replace(\"?client-entry\", \"\");\n}\nconst promiseForNewWritableStream = () => {\n const chunks = [];\n const writableStream = new stream.Writable();\n writableStream._write = (chunk, encoding, done) => {\n chunks.push(Buffer.from(chunk));\n done();\n };\n const streamDonePromise = new Promise((resolve, reject) => {\n writableStream.on(\"error\", (error) => {\n reject(error);\n });\n writableStream._final = (done) => {\n resolve(Buffer.concat(chunks).toString(\"utf8\"));\n done();\n };\n });\n return { streamDonePromise, writableStream };\n};\nconst renderStreamToPromise = async (reactElements, options) => {\n const { streamDonePromise, writableStream } = promiseForNewWritableStream();\n const {\n pipe\n /* abort */\n } = renderToPipeableStream(reactElements, {\n ...options || {},\n onShellReady() {\n },\n onAllReady() {\n pipe(writableStream);\n if (options == null ? void 0 : options.onAllReady) {\n options.onAllReady();\n }\n }\n });\n return streamDonePromise;\n};\nconst {\n createServerRenderContextV2,\n createServerRenderContext,\n renderServerSidePropsWithAsyncLocalStoreContext\n} = cmsComponents;\nconst bootStrapRenderContext = () => {\n const renderContext = createServerRenderContextV2 ? createServerRenderContextV2(null, {\n environmentConfig: null,\n entryPointBasePath: \"\",\n supplementalFieldValues: {},\n messagesForBrowser: []\n }) : createServerRenderContext(\"\", null);\n return renderContext;\n};\nasync function renderComponentOnServer(Component, propsAndDeps, pageUrl, environmentConfig, entryPointBasePath, contextOptions, renderOptions, getServerSideProps) {\n const { props } = propsAndDeps;\n const componentDebugName = Component.displayName || Component.name;\n const supplementalFieldValues = contextOptions == null ? void 0 : contextOptions.supplementalFieldValues;\n const messagesForBrowser = contextOptions == null ? void 0 : contextOptions.messagesForBrowser;\n const renderContext = cmsComponents.createServerRenderContextV2 ? cmsComponents.createServerRenderContextV2(pageUrl, {\n environmentConfig,\n entryPointBasePath,\n supplementalFieldValues,\n messagesForBrowser\n }) : cmsComponents.createServerRenderContext(pageUrl, environmentConfig);\n if (getServerSideProps !== void 0 && typeof getServerSideProps === \"function\") {\n const gSSPResult = await renderServerSidePropsWithAsyncLocalStoreContext(\n getServerSideProps,\n propsAndDeps,\n renderContext\n );\n if (gSSPResult) {\n props.serverSideProps = gSSPResult.serverSideProps;\n }\n }\n return renderOnServer(\n /* @__PURE__ */ jsx(Component, { ...props }),\n renderContext,\n componentDebugName,\n renderOptions\n );\n}\nasync function renderOnServer(elements, renderContext = bootStrapRenderContext(), debugName, renderOptions) {\n let html = await renderStreamToPromise(\n /* @__PURE__ */ jsx(ServerRenderContext.Provider, { value: renderContext, children: elements }),\n renderOptions\n );\n if (renderContext.messagesForBrowser.length > 0) {\n html = `${html}${scriptTagToLogServerMessages(\n renderContext.messagesForBrowser,\n `Server messages rendering: ${debugName}`\n )}`;\n }\n return { html, renderContext };\n}\nfunction getServerGlobalsToInject(environmentConfig, hsServerPageUrl, hsBasePath, prettyPrint, criticalDevErrors, includeNonces) {\n if (prettyPrint === void 0 && hsServerPageUrl && cmsComponents.isDebugUrlString) {\n prettyPrint = cmsComponents.isDebugUrlString(hsServerPageUrl);\n }\n const serializedJson = jsonStringifyAndEscapeForInlineJS(\n environmentConfig.toJSON(),\n { baseIndent: 6, prettyPrint }\n );\n const globals = [`window.__hsEnvConfig = ${serializedJson};`];\n if (hsServerPageUrl) {\n globals.push(\n `window.__hsServerPageUrl = ${jsonStringifyAndEscapeForInlineJS(\n hsServerPageUrl\n )};`\n );\n }\n if (hsBasePath) {\n globals.push(\n `window.__hsBasePath = ${jsonStringifyAndEscapeForInlineJS(hsBasePath)};`\n );\n }\n if (!environmentConfig.getIsDeployed() && (criticalDevErrors == null ? void 0 : criticalDevErrors.length)) {\n const firstCriticalDevError = criticalDevErrors[0];\n globals.push(`\n customElements.whenDefined('vite-error-overlay').then(() => {\n const ErrorOverlay = customElements.get('vite-error-overlay');\n const error = new Error(${jsonStringifyAndEscapeForInlineJS(\n firstCriticalDevError.message\n )});\n const overlay = new ErrorOverlay(error);\n\n document.body.appendChild(overlay);\n })\n `);\n }\n const nonceAttr = includeNonces && cmsComponents.SCRIPT_NONCE_PLACEHOLDER ? ` nonce=\"${cmsComponents.SCRIPT_NONCE_PLACEHOLDER}\"` : \"\";\n return `\n <script type=\"text/javascript\"${nonceAttr}>\n ${globals.join(\"\\n \")}\n <\\/script>\n `;\n}\nfunction renderFieldsJSX(fieldsJSX) {\n let moduleJson;\n const outputCallback = (callbackJson) => {\n moduleJson = callbackJson;\n };\n renderToStaticMarkup(\n cloneElement(fieldsJSX, {\n outputCallback\n })\n );\n if (!moduleJson) {\n throw new Error(\"couldn't render module fields definition to fields.json\");\n }\n return moduleJson;\n}\nfunction renderFieldsToJson(fields, moduleName) {\n let fieldsJSON;\n try {\n if (isValidElement(fields)) {\n fieldsJSON = renderFieldsJSX(fields);\n } else if (Array.isArray(fields)) {\n fieldsJSON = fields;\n } else {\n throw new Error(\n `Couldn't recognize \\`fields\\` value for module ${moduleName}`\n );\n }\n return fieldsJSON;\n } catch (e) {\n e.message = `Error when rendering fields for ${moduleName}: ${e.message}`;\n throw e;\n }\n}\nexport {\n COMPONENT_EXTENSIONS,\n CSS_LANGS_RE,\n ENABLED_FEATURES_GATE_MAP,\n ENTRY_POINTS_PATH,\n GATES,\n MODULE_FOLDER_PATH,\n VIRTUAL_CONFIG_SETUP,\n VIRTUAL_ISLAND_RUNTIME,\n areBuildHealthChecksEnabled,\n clientIslandEntryPlugin,\n collectCssInDev,\n collectCssModules,\n createIslandsGlobalJsForClientInDev,\n doHealthChecksFailTheBuild,\n escapeForInlineJS,\n findAllComponentsIn,\n findAllModulesInRoot,\n findAllPartialsInRoot,\n findCmsModules,\n a as getBaseAssetUrlFromBuild,\n g as getBuildInfo,\n getCMSAssetConfig,\n getCMSAssetConfigIfExists,\n getCombinedReactUrl,\n getComponentExtension,\n getEntryPointHash,\n getEntryPointHashWithIndexSuffix,\n getIslandRuntimeConfigUrl,\n getIslandUrls,\n getServerGlobalsToInject,\n getServerIncludePrebundleDepPatterns,\n hasComponentExtension,\n includesHublDataReference,\n isStorybookStory,\n isStylesheetAsset,\n isUngatedFor,\n jsonStringifyAndEscapeForInlineJS,\n namespaceModulePropsShape,\n noncePlaceholderPlugin,\n removeComponentExtension,\n removeIndexFromPath,\n removeIndexOrTrailingJsFromPath,\n renderComponentOnServer,\n renderFieldsToJson,\n renderOnServer,\n renderStreamToPromise,\n resolveIslandPlugin,\n resolveIslandToPlainModuleNoopPlugin,\n resolveIslandToPlainModulePlugin,\n scriptTagToLogServerMessages,\n serializeIslandDataForInlineScript,\n setIn,\n ungatedAtBuildTimeFor,\n virtualClientRenderIslandModuleId\n};\n", "import path from 'path';\nimport { InlineConfig, mergeConfig } from 'vite';\nimport { withoutVitePlugins } from '@storybook/builder-vite';\nimport { default as react } from '@vitejs/plugin-react';\nimport { jsonStringifyAndEscapeForInlineJS } from '@hubspot/cms-js-internal';\n\nconst webRoot = process.env.WEB_ROOT;\nconst storyPath = path.resolve(process.cwd(), webRoot, '**/*.stories.*');\nconst jsRenderingGates = process.env.GATES ? process.env.GATES.split(',') : [];\n\nexport default {\n addons: ['@storybook/addon-essentials'],\n framework: '@storybook/react-vite',\n stories: [storyPath],\n previewHead: (head: string) => {\n return `\n ${head}\n\n <script type=\"module\">\n import { initConfigSingletonFromJSON } from '@hubspot/cms-components/config';\n\n initConfigSingletonFromJSON(${jsonStringifyAndEscapeForInlineJS(\n {\n portalId: process.env.portalId,\n hublet: process.env.hublet,\n hsEnv: process.env.hsEnv,\n hsDeployed: false,\n hsJSRGates: jsRenderingGates,\n },\n { prettyPrint: false }\n )})\n </script>\n\n `;\n },\n viteFinal: async (config: InlineConfig) => {\n const { resolveIslandPlugin } = await import('@hubspot/cms-js-internal');\n\n const viteConfig = {\n resolve: {\n dedupe: [\n 'react',\n 'react-dom',\n '@hubspot/cms-components',\n '@hubspot/cms-dev-server',\n ],\n },\n optimizeDeps: {\n include: ['react', 'react-dom', 'react-dom/client'],\n exclude: ['fsevents'],\n },\n css: {\n postcss: webRoot,\n },\n plugins: [\n resolveIslandPlugin(),\n react({\n babel: {\n plugins: [\n 'babel-plugin-styled-components',\n 'styled-jsx/babel',\n 'macros',\n ],\n },\n }),\n ],\n };\n\n const configNoReact: InlineConfig = {\n ...config,\n // replacing the default usage of `@vite/plugin-react` (it emits multiple\n // sub-plugins listed here) to add our babel plugin configuration\n plugins: await withoutVitePlugins(config.plugins, [\n 'vite:react-babel',\n 'vite:react-swc',\n 'vite:react-refresh',\n ]),\n };\n\n return mergeConfig(configNoReact, viteConfig);\n },\n};\n"],
5
+ "mappings": ";;;;;;;;;;;AAAA,OAAO,UAAU;AACjB,SAAS,kBAAkB;AAC3B,OAAO,MAAM,cAAc,YAAY,aAAa,iBAAiB;AACrE,SAAS,YAAY;AAmCrB,SAAS,kBAAkB,WAAW,WAAW,IAAI;AACnD,MAAI,aAAa,UAAU,CAAC,MAAM,KAAK;AACrC,gBAAY,IAAI;AAAA,EAClB;AACA,MAAI,UAAU,SAAS,KAAK,GAAG;AAC7B,WAAO,+CAA+C,WAAW;AAAA,EACnE,WAAW,aAAa,KAAK,SAAS,GAAG;AACvC,WAAO,gCAAgC,WAAW;AAAA,EACpD,WAAW,UAAU,SAAS,OAAO,GAAG;AACtC,WAAO,8BAA8B,WAAW;AAAA,EAClD,WAAW,UAAU,SAAS,QAAQ,GAAG;AACvC,WAAO,8BAA8B,WAAW;AAAA,EAClD,WAAW,UAAU,SAAS,MAAM,GAAG;AACrC,WAAO,8BAA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AA,QAClD,SAAS,CAAC,UAAU;AAAA,MACtB;AAAA,MACA,KAAK;AAAA,QACH,SAAS;AAAA,MACX;AAAA,MACA,SAAS;AAAA,QACPA,qBAAoB;AAAA,QACpB,MAAM;AAAA,UACJ,OAAO;AAAA,YACL,SAAS;AAAA,cACP;AAAA,cACA;AAAA,cACA;AAAA,YACF;AAAA,UACF;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF;AAEA,UAAM,gBAA8B;AAAA,MAClC,GAAG;AAAA;AAAA;AAAA,MAGH,SAAS,MAAM,mBAAmB,OAAO,SAAS;AAAA,QAChD;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH;AAEA,WAAO,YAAY,eAAe,UAAU;AAAA,EAC9C;AACF;",
6
+ "names": ["webRoot", "path", "createServerRenderContextV2", "createServerRenderContext", "path", "resolveIslandPlugin"]
7
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/storybook-main/preview.jsx"],
4
+ "sourcesContent": ["import React from 'react';\nimport {\n ServerRenderContext,\n createServerRenderContextV2,\n ClientRenderContextProvider,\n} from '@hubspot/cms-components';\n\nconst contextValue = createServerRenderContextV2('http://testUrl.com', {\n environmentConfig: null,\n});\n\nexport default {\n parameters: {\n actions: { argTypesRegex: '^on[A-Z].*' },\n },\n decorators: [\n Story => (\n <ClientRenderContextProvider pageUrl=\"http://test.com\" islands={[]}>\n <ServerRenderContext.Provider value={contextValue}>\n <Story />\n </ServerRenderContext.Provider>\n </ClientRenderContextProvider>\n ),\n ],\n};\n"],
5
+ "mappings": ";AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAcG;AAZV,IAAM,eAAe,4BAA4B,sBAAsB;AAAA,EACrE,mBAAmB;AACrB,CAAC;AAED,IAAO,kBAAQ;AAAA,EACb,YAAY;AAAA,IACV,SAAS,EAAE,eAAe,aAAa;AAAA,EACzC;AAAA,EACA,YAAY;AAAA,IACV,WACE,oBAAC,+BAA4B,SAAQ,mBAAkB,SAAS,CAAC,GAC/D,8BAAC,oBAAoB,UAApB,EAA6B,OAAO,cACnC,8BAAC,SAAM,GACT,GACF;AAAA,EAEJ;AACF;",
6
+ "names": []
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/cms-dev-server",
3
- "version": "1.0.19",
3
+ "version": "1.0.29",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "engines": {
@@ -29,13 +29,14 @@
29
29
  "@babel/parser": "^7.25.3",
30
30
  "@babel/traverse": "^7.25.3",
31
31
  "@babel/types": "^7.25.2",
32
- "@hubspot/cms-components": "^1.0.19",
32
+ "@hubspot/cms-components": "^1.0.29",
33
33
  "@hubspot/local-dev-lib": "2.0.1",
34
34
  "@inquirer/select": "^2.0.0",
35
35
  "@originjs/vite-plugin-commonjs": "^1.0.3",
36
36
  "@radix-ui/react-dialog": "^1.1.2",
37
37
  "@radix-ui/react-separator": "^1.1.0",
38
38
  "@radix-ui/react-slot": "^1.1.0",
39
+ "@radix-ui/react-toggle": "^1.1.3",
39
40
  "@radix-ui/react-tooltip": "^1.1.4",
40
41
  "@sentry/node": "^6.2.0",
41
42
  "@storybook/addon-actions": "7.1.1",
@@ -131,5 +132,5 @@
131
132
  "publishConfig": {
132
133
  "access": "public"
133
134
  },
134
- "gitHead": "93a5843ed0250056800ed4aa76beb96f7a7887e0"
135
+ "gitHead": "163dade1c49fb5d20e5ab4ee059601a70ed8c4fc"
135
136
  }
@@ -0,0 +1,2 @@
1
+ import { setupIslandHydration } from '@hubspot/cms-js-internal/island-runtime';
2
+ export { setupIslandHydration };
@@ -1 +0,0 @@
1
- *,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#efedeb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#cecccb}input::placeholder,textarea::placeholder{opacity:1;color:#cecccb}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 215 27% 27%;--primary-default: #7d53e9;--primary-hover: #6431da;--primary-pressed: #5113ba;--primary-disabled: #e5e1fa;--primary-subtle: #e5e1fa;--primary-foreground: #ffffff;--radius: .5rem;--accent: 240 4.8% 95.9%;--input: 240 5.9% 90%;--muted: 240 4.8% 95.9%;--popover: 0 0% 100%}body{font-family:Lexend Deca,Helvetica,Arial,sans-serif;--tw-text-opacity: 1;color:rgb(20 20 20 / var(--tw-text-opacity))}.container{width:100%;margin-right:auto;margin-left:auto;padding-right:2rem;padding-left:2rem}@media (min-width: 1400px){.container{max-width:1400px}}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.inset-x-0{left:0;right:0}.inset-y-0{top:0;bottom:0}.bottom-0{bottom:0}.left-0{left:0}.right-0{right:0}.right-1\.5{right:.375rem}.right-4{right:1rem}.top-0{top:0}.top-1\.5{top:.375rem}.top-4{top:1rem}.z-10{z-index:10}.z-50{z-index:50}.mx-4{margin-left:1rem;margin-right:1rem}.mx-auto{margin-left:auto;margin-right:auto}.my-6{margin-top:1.5rem;margin-bottom:1.5rem}.mb-16{margin-bottom:4rem}.mb-3{margin-bottom:.75rem}.mb-4{margin-bottom:1rem}.mb-5{margin-bottom:1.25rem}.mb-6{margin-bottom:1.5rem}.mr-2{margin-right:.5rem}.mt-10{margin-top:2.5rem}.mt-12{margin-top:3rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.mt-5{margin-top:1.25rem}.mt-6{margin-top:1.5rem}.flex{display:flex}.inline-flex{display:inline-flex}.table{display:table}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-11{height:2.75rem}.h-12{height:3rem}.h-36{height:9rem}.h-4{height:1rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[1px\]{height:1px}.h-\[20px\]{height:20px}.h-fit{height:-moz-fit-content;height:fit-content}.h-full{height:100%}.max-h-\[770px\]{max-height:770px}.min-h-36{min-height:9rem}.w-10{width:2.5rem}.w-3\/4{width:75%}.w-4{width:1rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-\[1px\]{width:1px}.w-full{width:100%}.min-w-10{min-width:2.5rem}.max-w-2xl{max-width:42rem}.max-w-\[200px\]{max-width:200px}.max-w-md{max-width:28rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.caption-bottom{caption-side:bottom}@keyframes pulse{50%{opacity:.5}}.animate-pulse{animation:pulse 2s cubic-bezier(.4,0,.6,1) infinite}.cursor-pointer{cursor:pointer}.auto-cols-fr{grid-auto-columns:minmax(0,1fr)}.grid-cols-\[repeat\(auto-fit\,minmax\(100px\,1fr\)\)\]{grid-template-columns:repeat(auto-fit,minmax(100px,1fr))}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-start{justify-content:flex-start}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-1{gap:.25rem}.gap-14{gap:3.5rem}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.gap-6{gap:1.5rem}.gap-8{gap:2rem}.space-x-4>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(1rem * var(--tw-space-x-reverse));margin-left:calc(1rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.overflow-y-scroll{overflow-y:scroll}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.rounded{border-radius:.25rem}.rounded-3xl{border-radius:1.5rem}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-sm{border-radius:calc(var(--radius) - 4px)}.rounded-xl{border-radius:.75rem}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-l{border-left-width:1px}.border-r{border-right-width:1px}.border-t{border-top-width:1px}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(231 229 228 / var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-slate-300{--tw-border-opacity: 1;border-color:rgb(203 213 225 / var(--tw-border-opacity))}.bg-\[\#0F172A\]{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.bg-background{background-color:hsl(var(--background))}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-black{--tw-bg-opacity: 1;background-color:rgb(0 0 0 / var(--tw-bg-opacity))}.bg-black\/80{background-color:#000c}.bg-destructive{background-color:hsl(var(--destructive))}.bg-gray-200{--tw-bg-opacity: 1;background-color:rgb(239 237 235 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-muted\/50{background-color:hsl(var(--muted) / .5)}.bg-popover{background-color:hsl(var(--popover))}.bg-primary{background-color:var(--primary-default)}.bg-secondary{background-color:hsl(var(--secondary))}.bg-slate-100{--tw-bg-opacity: 1;background-color:rgb(241 245 249 / var(--tw-bg-opacity))}.bg-slate-900{--tw-bg-opacity: 1;background-color:rgb(15 23 42 / var(--tw-bg-opacity))}.bg-slate-900\/90{background-color:#0f172ae6}.bg-white{--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.p-0{padding:0}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}.px-1{padding-left:.25rem;padding-right:.25rem}.px-1\.5{padding-left:.375rem;padding-right:.375rem}.px-10{padding-left:2.5rem;padding-right:2.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pb-6{padding-bottom:1.5rem}.pb-8{padding-bottom:2rem}.pt-8{padding-top:2rem}.text-left{text-align:left}.text-center{text-align:center}.align-middle{vertical-align:middle}.text-2xl{font-size:1.5rem;line-height:2rem}.text-4xl{font-size:2.25rem;line-height:2.5rem}.text-\[14px\]{font-size:14px}.text-\[16px\]{font-size:16px}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-extrabold{font-weight:800}.font-light{font-weight:300}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.italic{font-style:italic}.leading-4{line-height:1rem}.leading-5{line-height:1.25rem}.leading-6{line-height:1.5rem}.leading-7{line-height:1.75rem}.leading-8{line-height:2rem}.leading-9{line-height:2.25rem}.leading-none{line-height:1}.leading-tight{line-height:1.25}.tracking-tight{letter-spacing:-.025em}.text-\[\#9CDCFE\]{--tw-text-opacity: 1;color:rgb(156 220 254 / var(--tw-text-opacity))}.text-\[\#ff7a59\]{--tw-text-opacity: 1;color:rgb(255 122 89 / var(--tw-text-opacity))}.text-black{--tw-text-opacity: 1;color:rgb(0 0 0 / var(--tw-text-opacity))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-gray-500{--tw-text-opacity: 1;color:rgb(182 177 175 / var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity: 1;color:rgb(20 20 20 / var(--tw-text-opacity))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-popover-foreground{color:hsl(var(--popover-foreground))}.text-primary{color:var(--primary-default)}.text-primary-foreground{color:var(--primary-foreground)}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-slate-400{--tw-text-opacity: 1;color:rgb(148 163 184 / var(--tw-text-opacity))}.text-slate-900{--tw-text-opacity: 1;color:rgb(15 23 42 / var(--tw-text-opacity))}.text-white{--tw-text-opacity: 1;color:rgb(255 255 255 / var(--tw-text-opacity))}.underline{text-decoration-line:underline}.underline-offset-4{text-underline-offset:4px}.opacity-70{opacity:.7}.opacity-90{opacity:.9}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.ring{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(3px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.animate-in{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.fade-in-0{--tw-enter-opacity: 0}.zoom-in-95{--tw-enter-scale: .95}.ease-in-out{animation-timing-function:cubic-bezier(.4,0,.2,1)}@font-face{font-family:Lexend Deca;src:url(/assets/LexendDeca-Light-BtcvwT5C.woff2) format("woff2")}@font-face{font-family:Lexend Deca;src:url(/assets/LexendDeca-Medium-CxVPR2j6.woff2) format("woff2");font-weight:500}@font-face{font-family:Lexend Deca;src:url(/assets/LexendDeca-SemiBold-BhzS3XUP.woff2) format("woff2");font-weight:600}@font-face{font-family:Lexend Deca;src:url(/assets/LexendDeca-Bold-B8uERmr8.woff2) format("woff2");font-weight:700}.odd\:bg-white:nth-child(odd){--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.even\:bg-gray-100:nth-child(2n){--tw-bg-opacity: 1;background-color:rgb(245 243 242 / var(--tw-bg-opacity))}.even\:bg-gray-50:nth-child(2n){--tw-bg-opacity: 1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-gray-100:hover{--tw-bg-opacity: 1;background-color:rgb(245 243 242 / var(--tw-bg-opacity))}.hover\:bg-gray-200:hover{--tw-bg-opacity: 1;background-color:rgb(239 237 235 / var(--tw-bg-opacity))}.hover\:bg-muted\/50:hover{background-color:hsl(var(--muted) / .5)}.hover\:bg-primary-hover:hover{background-color:var(--primary-hover)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-100:hover{opacity:1}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus\:ring-2:focus{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus\:ring-ring:focus{--tw-ring-color: hsl(var(--ring))}.focus\:ring-offset-2:focus{--tw-ring-offset-width: 2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.active\:bg-gray-200:active{--tw-bg-opacity: 1;background-color:rgb(239 237 235 / var(--tw-bg-opacity))}.active\:bg-primary-pressed:active{background-color:var(--primary-pressed)}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:bg-primary-disabled:disabled{background-color:var(--primary-disabled)}.disabled\:opacity-50:disabled{opacity:.5}.data-\[state\=open\]\:bg-secondary[data-state=open]{background-color:hsl(var(--secondary))}.data-\[state\=selected\]\:bg-muted[data-state=selected]{background-color:hsl(var(--muted))}.data-\[state\=closed\]\:duration-300[data-state=closed]{transition-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{transition-duration:.5s}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}.data-\[state\=closed\]\:zoom-out-95[data-state=closed]{--tw-exit-scale: .95}.data-\[side\=bottom\]\:slide-in-from-top-2[data-side=bottom]{--tw-enter-translate-y: -.5rem}.data-\[side\=left\]\:slide-in-from-right-2[data-side=left]{--tw-enter-translate-x: .5rem}.data-\[side\=right\]\:slide-in-from-left-2[data-side=right]{--tw-enter-translate-x: -.5rem}.data-\[side\=top\]\:slide-in-from-bottom-2[data-side=top]{--tw-enter-translate-y: .5rem}.data-\[state\=closed\]\:slide-out-to-bottom[data-state=closed]{--tw-exit-translate-y: 100%}.data-\[state\=closed\]\:slide-out-to-left[data-state=closed]{--tw-exit-translate-x: -100%}.data-\[state\=closed\]\:slide-out-to-right[data-state=closed]{--tw-exit-translate-x: 100%}.data-\[state\=closed\]\:slide-out-to-top[data-state=closed]{--tw-exit-translate-y: -100%}.data-\[state\=open\]\:slide-in-from-bottom[data-state=open]{--tw-enter-translate-y: 100%}.data-\[state\=open\]\:slide-in-from-left[data-state=open]{--tw-enter-translate-x: -100%}.data-\[state\=open\]\:slide-in-from-right[data-state=open]{--tw-enter-translate-x: 100%}.data-\[state\=open\]\:slide-in-from-top[data-state=open]{--tw-enter-translate-y: -100%}.data-\[state\=closed\]\:duration-300[data-state=closed]{animation-duration:.3s}.data-\[state\=open\]\:duration-500[data-state=open]{animation-duration:.5s}@media (min-width: 640px){.sm\:max-w-sm{max-width:24rem}.sm\:max-w-xl{max-width:36rem}.sm\:flex-row{flex-direction:row}.sm\:justify-end{justify-content:flex-end}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:text-left{text-align:left}}@media (min-width: 768px){.md\:w-\[170px\]{width:170px}.md\:flex-none{flex:none}.md\:flex-row{flex-direction:row}}@media (min-width: 1024px){.lg\:block{display:block}}.\[\&\:has\(\[role\=checkbox\]\)\]\:pr-0:has([role=checkbox]){padding-right:0}.\[\&\>tr\]\:last\:border-b-0:last-child>tr{border-bottom-width:0px}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0}.\[\&_tr\:last-child\]\:border-0 tr:last-child{border-width:0px}.\[\&_tr\]\:border-b tr{border-bottom-width:1px}
@@ -1,15 +0,0 @@
1
- import { ViteDevServer } from 'vite';
2
- /**
3
- * Processes HTML to find remote assets and replace with Vite-managed URLs
4
- */
5
- export declare function processRemoteAssets(html: string, viteServer: ViteDevServer): Promise<string>;
6
- /**
7
- * Vite plugin to handle remote assets
8
- */
9
- export declare function remoteAssetsPlugin(): {
10
- name: string;
11
- apply: "serve";
12
- configResolved(config: any): void;
13
- resolveId(id: string): string;
14
- load(id: string): Promise<string>;
15
- };
@@ -1,2 +0,0 @@
1
- import type { Plugin } from 'vite';
2
- export declare function hubspotStaticAssetsPlugin(): Plugin;
@@ -1,7 +0,0 @@
1
- import { ViteDevServer, Plugin } from 'vite';
2
- /**
3
- * Create a self-contained plugin with proper caching
4
- */
5
- export declare function remoteAssetsPlugin(): Plugin & {
6
- processRemoteAssets: (html: string, viteServer: ViteDevServer) => Promise<string>;
7
- };