@contentful/experiences-components-react 3.8.4-dev-20251024T1213-2c026d6.0 → 3.8.4-dev-20251113T1616-163df18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../core/dist/esm/constants.js","../src/utils/combineClasses.ts","../src/components/Button/Button.tsx","../src/components/Button/index.ts","../src/components/Heading/Heading.tsx","../src/components/Heading/index.ts","../src/components/RichText/RichText.tsx","../src/components/RichText/index.ts","../src/components/Text/Text.tsx","../src/components/Text/index.ts","../src/components/Image/Image.tsx","../src/components/Image/index.ts","../../core/dist/esm/index.js","../src/components/Layout/Flex.tsx","../src/utils/extractRenderProps.ts","../src/components/ContentfulContainer/ContentfulContainerAsHyperlink.tsx","../src/components/ContentfulContainer/ContentfulContainer.tsx","../src/components/ContentfulContainer/index.ts","../src/components/Divider/ContentfulDivider.tsx","../src/components/Divider/index.ts","../src/components/Columns/Columns.tsx","../src/components/Columns/SingleColumn.tsx","../src/components/Columns/index.ts","../src/components/Assembly/Assembly.tsx","../src/components/Carousel/Carousel.tsx","../src/components/Carousel/index.ts"],"sourcesContent":["/** @deprecated will be removed when dropping backward compatibility for old DND */\nconst SCROLL_STATES = {\n Start: 'scrollStart',\n IsScrolling: 'isScrolling',\n End: 'scrollEnd',\n};\nconst OUTGOING_EVENTS = {\n Connected: 'connected',\n DesignTokens: 'registerDesignTokens',\n RegisteredBreakpoints: 'registeredBreakpoints',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n MouseMove: 'mouseMove',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentSelected: 'componentSelected',\n RegisteredComponents: 'registeredComponents',\n RequestComponentTreeUpdate: 'requestComponentTreeUpdate',\n CanvasReload: 'canvasReload',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n UpdateSelectedComponentCoordinates: 'updateSelectedComponentCoordinates',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasScroll: 'canvasScrolling',\n CanvasError: 'canvasError',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n OutsideCanvasClick: 'outsideCanvasClick',\n SDKFeatures: 'sdkFeatures',\n RequestEntities: 'REQUEST_ENTITIES',\n CanvasGeometryUpdated: 'canvasGeometryUpdated',\n CanvasPan: 'canvasPan',\n};\nconst INCOMING_EVENTS = {\n RequestEditorMode: 'requestEditorMode',\n RequestReadOnlyMode: 'requestReadOnlyMode',\n ExperienceUpdated: 'componentTreeUpdated',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDraggingChanged: 'componentDraggingChanged',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragCanceled: 'componentDragCanceled',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragStarted: 'componentDragStarted',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragEnded: 'componentDragEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentMoveEnded: 'componentMoveEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasResized: 'canvasResized',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n SelectComponent: 'selectComponent',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n HoverComponent: 'hoverComponent',\n UpdatedEntity: 'updatedEntity',\n /** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */\n AssembliesAdded: 'assembliesAdded',\n /** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */\n AssembliesRegistered: 'assembliesRegistered',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n MouseMove: 'mouseMove',\n RequestedEntities: 'REQUESTED_ENTITIES',\n};\nconst INTERNAL_EVENTS = {\n ComponentsRegistered: 'cfComponentsRegistered',\n VisualEditorInitialize: 'cfVisualEditorInitialize',\n};\nconst VISUAL_EDITOR_EVENTS = {\n Ready: 'cfVisualEditorReady',\n};\n/**\n * These modes are ONLY intended to be internally used within the context of\n * editing an experience inside of Contentful Studio. i.e. these modes\n * intentionally do not include preview/delivery modes.\n */\nvar StudioCanvasMode;\n(function (StudioCanvasMode) {\n StudioCanvasMode[\"READ_ONLY\"] = \"readOnlyMode\";\n StudioCanvasMode[\"EDITOR\"] = \"editorMode\";\n StudioCanvasMode[\"NONE\"] = \"none\";\n})(StudioCanvasMode || (StudioCanvasMode = {}));\nconst VISUAL_EDITOR_CONTAINER_ID = 'cf-visual-editor';\nconst CONTENTFUL_COMPONENT_CATEGORY = 'contentful-component';\nconst CONTENTFUL_DEFAULT_CATEGORY = 'Contentful';\nconst CONTENTFUL_COMPONENTS = {\n section: {\n id: 'contentful-section',\n name: 'Section',\n },\n container: {\n id: 'contentful-container',\n name: 'Container',\n },\n columns: {\n id: 'contentful-columns',\n name: 'Columns',\n },\n singleColumn: {\n id: 'contentful-single-column',\n name: 'Column',\n },\n button: {\n id: 'contentful-button',\n name: 'Button',\n },\n heading: {\n id: 'contentful-heading',\n name: 'Heading',\n },\n image: {\n id: 'contentful-image',\n name: 'Image',\n },\n richText: {\n id: 'contentful-richText',\n name: 'Rich Text',\n },\n text: {\n id: 'contentful-text',\n name: 'Text',\n },\n divider: {\n id: 'contentful-divider',\n name: 'Divider',\n },\n carousel: {\n id: 'contentful-carousel',\n name: 'Carousel',\n },\n};\nconst ASSEMBLY_NODE_TYPE = 'assembly';\nconst ASSEMBLY_DEFAULT_CATEGORY = 'Assemblies';\nconst ASSEMBLY_BLOCK_NODE_TYPE = 'assemblyBlock';\nconst ASSEMBLY_NODE_TYPES = [ASSEMBLY_NODE_TYPE, ASSEMBLY_BLOCK_NODE_TYPE];\nconst LATEST_SCHEMA_VERSION = '2023-09-28';\nconst CF_STYLE_ATTRIBUTES = [\n 'cfVisibility',\n 'cfHorizontalAlignment',\n 'cfVerticalAlignment',\n 'cfMargin',\n 'cfPadding',\n 'cfBackgroundColor',\n 'cfWidth',\n 'cfMaxWidth',\n 'cfHeight',\n 'cfImageAsset',\n 'cfImageOptions',\n 'cfBackgroundImageUrl',\n 'cfBackgroundImageOptions',\n 'cfFlexDirection',\n 'cfFlexWrap',\n 'cfFlexReverse',\n 'cfBorder',\n 'cfBorderRadius',\n 'cfGap',\n 'cfColumnSpan',\n 'cfColumnSpanLock',\n 'cfColumns',\n 'cfFontSize',\n 'cfFontWeight',\n 'cfLineHeight',\n 'cfLetterSpacing',\n 'cfTextColor',\n 'cfTextAlign',\n 'cfTextTransform',\n 'cfTextBold',\n 'cfTextItalic',\n 'cfTextUnderline',\n];\nconst EMPTY_CONTAINER_SIZE = '80px';\nconst HYPERLINK_DEFAULT_PATTERN = `/{locale}/{entry.fields.slug}/`;\nvar PostMessageMethods;\n(function (PostMessageMethods) {\n PostMessageMethods[\"REQUEST_ENTITIES\"] = \"REQUEST_ENTITIES\";\n PostMessageMethods[\"REQUESTED_ENTITIES\"] = \"REQUESTED_ENTITIES\";\n})(PostMessageMethods || (PostMessageMethods = {}));\nconst SUPPORTED_IMAGE_FORMATS = ['jpg', 'png', 'webp', 'gif', 'avif'];\n\nexport { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, EMPTY_CONTAINER_SIZE, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PostMessageMethods, SCROLL_STATES, SUPPORTED_IMAGE_FORMATS, StudioCanvasMode, VISUAL_EDITOR_CONTAINER_ID, VISUAL_EDITOR_EVENTS };\n//# sourceMappingURL=constants.js.map\n",null,null,null,null,null,null,null,null,null,null,null,"import { z, ZodIssueCode } from 'zod';\nimport cloneDeep from 'lodash.clonedeep';\nimport md5 from 'md5';\nimport { BLOCKS } from '@contentful/rich-text-types';\nimport { create } from 'zustand';\n\n/** @deprecated will be removed when dropping backward compatibility for old DND */\nconst INCOMING_EVENTS = {\n RequestEditorMode: 'requestEditorMode',\n RequestReadOnlyMode: 'requestReadOnlyMode',\n ExperienceUpdated: 'componentTreeUpdated',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDraggingChanged: 'componentDraggingChanged',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragCanceled: 'componentDragCanceled',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragStarted: 'componentDragStarted',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragEnded: 'componentDragEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentMoveEnded: 'componentMoveEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasResized: 'canvasResized',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n SelectComponent: 'selectComponent',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n HoverComponent: 'hoverComponent',\n UpdatedEntity: 'updatedEntity',\n /** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */\n AssembliesAdded: 'assembliesAdded',\n /** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */\n AssembliesRegistered: 'assembliesRegistered',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n MouseMove: 'mouseMove',\n RequestedEntities: 'REQUESTED_ENTITIES',\n};\n/**\n * These modes are ONLY intended to be internally used within the context of\n * editing an experience inside of Contentful Studio. i.e. these modes\n * intentionally do not include preview/delivery modes.\n */\nvar StudioCanvasMode;\n(function (StudioCanvasMode) {\n StudioCanvasMode[\"READ_ONLY\"] = \"readOnlyMode\";\n StudioCanvasMode[\"EDITOR\"] = \"editorMode\";\n StudioCanvasMode[\"NONE\"] = \"none\";\n})(StudioCanvasMode || (StudioCanvasMode = {}));\nconst CONTENTFUL_COMPONENTS = {\n section: {\n id: 'contentful-section',\n name: 'Section',\n },\n container: {\n id: 'contentful-container',\n name: 'Container',\n },\n columns: {\n id: 'contentful-columns',\n name: 'Columns',\n },\n singleColumn: {\n id: 'contentful-single-column',\n name: 'Column',\n },\n button: {\n id: 'contentful-button',\n name: 'Button',\n },\n heading: {\n id: 'contentful-heading',\n name: 'Heading',\n },\n image: {\n id: 'contentful-image',\n name: 'Image',\n },\n richText: {\n id: 'contentful-richText',\n name: 'Rich Text',\n },\n text: {\n id: 'contentful-text',\n name: 'Text',\n },\n divider: {\n id: 'contentful-divider',\n name: 'Divider',\n },\n carousel: {\n id: 'contentful-carousel',\n name: 'Carousel',\n },\n};\nconst ASSEMBLY_NODE_TYPE = 'assembly';\nconst ASSEMBLY_DEFAULT_CATEGORY = 'Assemblies';\nconst ASSEMBLY_BLOCK_NODE_TYPE = 'assemblyBlock';\nconst CF_STYLE_ATTRIBUTES = [\n 'cfVisibility',\n 'cfHorizontalAlignment',\n 'cfVerticalAlignment',\n 'cfMargin',\n 'cfPadding',\n 'cfBackgroundColor',\n 'cfWidth',\n 'cfMaxWidth',\n 'cfHeight',\n 'cfImageAsset',\n 'cfImageOptions',\n 'cfBackgroundImageUrl',\n 'cfBackgroundImageOptions',\n 'cfFlexDirection',\n 'cfFlexWrap',\n 'cfFlexReverse',\n 'cfBorder',\n 'cfBorderRadius',\n 'cfGap',\n 'cfColumnSpan',\n 'cfColumnSpanLock',\n 'cfColumns',\n 'cfFontSize',\n 'cfFontWeight',\n 'cfLineHeight',\n 'cfLetterSpacing',\n 'cfTextColor',\n 'cfTextAlign',\n 'cfTextTransform',\n 'cfTextBold',\n 'cfTextItalic',\n 'cfTextUnderline',\n];\nconst EMPTY_CONTAINER_SIZE = '80px';\nvar PostMessageMethods;\n(function (PostMessageMethods) {\n PostMessageMethods[\"REQUEST_ENTITIES\"] = \"REQUEST_ENTITIES\";\n PostMessageMethods[\"REQUESTED_ENTITIES\"] = \"REQUESTED_ENTITIES\";\n})(PostMessageMethods || (PostMessageMethods = {}));\nconst SUPPORTED_IMAGE_FORMATS = ['jpg', 'png', 'webp', 'gif', 'avif'];\n\nconst structureComponentIds = new Set([\n CONTENTFUL_COMPONENTS.section.id,\n CONTENTFUL_COMPONENTS.columns.id,\n CONTENTFUL_COMPONENTS.container.id,\n CONTENTFUL_COMPONENTS.singleColumn.id,\n]);\nconst patternTypes = new Set([ASSEMBLY_NODE_TYPE, ASSEMBLY_BLOCK_NODE_TYPE]);\nconst allContentfulComponentIds = new Set(Object.values(CONTENTFUL_COMPONENTS).map((component) => component.id));\nconst isPatternComponent = (type) => patternTypes.has(type ?? '');\nconst isContentfulStructureComponent = (componentId) => structureComponentIds.has((componentId ?? ''));\nconst isContentfulComponent = (componentId) => allContentfulComponentIds.has((componentId ?? ''));\nconst isComponentAllowedOnRoot = ({ type, category, componentId }) => isPatternComponent(type) ||\n category === ASSEMBLY_DEFAULT_CATEGORY ||\n isContentfulStructureComponent(componentId) ||\n componentId === CONTENTFUL_COMPONENTS.divider.id;\nconst isStructureWithRelativeHeight = (componentId, height) => {\n return isContentfulStructureComponent(componentId) && !height?.toString().endsWith('px');\n};\n\n// These styles get added to every component, user custom or contentful provided\nconst builtInStyles = {\n cfVerticalAlignment: {\n validations: {\n in: [\n {\n value: 'start',\n displayName: 'Align left',\n },\n {\n value: 'center',\n displayName: 'Align center',\n },\n {\n value: 'end',\n displayName: 'Align right',\n },\n {\n value: 'stretch',\n displayName: 'Stretch',\n },\n ],\n },\n type: 'Text',\n group: 'style',\n defaultValue: 'center',\n displayName: 'Vertical alignment',\n },\n cfHorizontalAlignment: {\n validations: {\n in: [\n {\n value: 'start',\n displayName: 'Align top',\n },\n {\n value: 'center',\n displayName: 'Align center',\n },\n {\n value: 'end',\n displayName: 'Align bottom',\n },\n {\n value: 'stretch',\n displayName: 'Stretch',\n },\n ],\n },\n type: 'Text',\n group: 'style',\n defaultValue: 'center',\n displayName: 'Horizontal alignment',\n },\n cfVisibility: {\n displayName: 'Visibility toggle',\n type: 'Boolean',\n group: 'style',\n defaultValue: true,\n },\n cfMargin: {\n displayName: 'Margin',\n type: 'Text',\n group: 'style',\n defaultValue: '0 0 0 0',\n },\n cfPadding: {\n displayName: 'Padding',\n type: 'Text',\n group: 'style',\n defaultValue: '0 0 0 0',\n },\n cfBackgroundColor: {\n displayName: 'Background color',\n type: 'Text',\n group: 'style',\n defaultValue: 'rgba(0, 0, 0, 0)',\n },\n cfWidth: {\n displayName: 'Width',\n type: 'Text',\n group: 'style',\n defaultValue: '100%',\n },\n cfHeight: {\n displayName: 'Height',\n type: 'Text',\n group: 'style',\n defaultValue: 'fit-content',\n },\n cfMaxWidth: {\n displayName: 'Max width',\n type: 'Text',\n group: 'style',\n defaultValue: 'none',\n },\n cfFlexDirection: {\n displayName: 'Direction',\n type: 'Text',\n group: 'style',\n defaultValue: 'column',\n },\n cfFlexReverse: {\n displayName: 'Reverse Direction',\n type: 'Boolean',\n group: 'style',\n defaultValue: false,\n },\n cfFlexWrap: {\n displayName: 'Wrap objects',\n type: 'Text',\n group: 'style',\n defaultValue: 'nowrap',\n },\n cfBorder: {\n displayName: 'Border',\n type: 'Text',\n group: 'style',\n defaultValue: '0px solid rgba(0, 0, 0, 0)',\n },\n cfGap: {\n displayName: 'Gap',\n type: 'Text',\n group: 'style',\n defaultValue: '0px',\n },\n cfHyperlink: {\n displayName: 'URL',\n type: 'Hyperlink',\n defaultValue: '',\n validations: {\n format: 'URL',\n bindingSourceType: ['entry', 'experience', 'manual'],\n },\n },\n cfOpenInNewTab: {\n displayName: 'URL behaviour',\n type: 'Boolean',\n defaultValue: false,\n description: 'Open in new tab',\n },\n};\nconst optionalBuiltInStyles = {\n cfFontSize: {\n displayName: 'Font Size',\n type: 'Text',\n group: 'style',\n defaultValue: '16px',\n },\n cfFontWeight: {\n validations: {\n in: [\n {\n value: '400',\n displayName: 'Normal',\n },\n {\n value: '500',\n displayName: 'Medium',\n },\n {\n value: '600',\n displayName: 'Semi Bold',\n },\n ],\n },\n displayName: 'Font Weight',\n type: 'Text',\n group: 'style',\n defaultValue: '400',\n },\n cfImageAsset: {\n displayName: 'Image',\n type: 'Media',\n validations: {\n bindingSourceType: ['asset', 'entry', 'manual'],\n },\n },\n cfImageOptions: {\n displayName: 'Image options',\n type: 'Object',\n group: 'style',\n defaultValue: {\n width: '100%',\n height: '100%',\n targetSize: 'unset',\n },\n },\n cfBackgroundColor: {\n displayName: 'Background color',\n type: 'Text',\n group: 'style',\n defaultValue: 'rgba(0, 0, 0, 0)',\n },\n cfBackgroundImageUrl: {\n displayName: 'Background image',\n type: 'Media',\n validations: {\n bindingSourceType: ['asset', 'entry', 'manual'],\n },\n },\n cfBackgroundImageOptions: {\n displayName: 'Background image options',\n type: 'Object',\n group: 'style',\n defaultValue: {\n scaling: 'fill',\n alignment: 'left top',\n targetSize: '2000px',\n },\n },\n cfBorderRadius: {\n displayName: 'Border Radius',\n type: 'Text',\n group: 'style',\n defaultValue: '0px',\n },\n cfLineHeight: {\n displayName: 'Line Height',\n type: 'Text',\n group: 'style',\n defaultValue: '20px',\n },\n cfLetterSpacing: {\n displayName: 'Letter Spacing',\n type: 'Text',\n group: 'style',\n defaultValue: '0px',\n },\n cfTextColor: {\n displayName: 'Text Color',\n type: 'Text',\n group: 'style',\n defaultValue: 'rgba(0, 0, 0, 1)',\n },\n cfTextAlign: {\n validations: {\n in: [\n {\n value: 'start',\n displayName: 'Align start',\n },\n {\n value: 'center',\n displayName: 'Align center',\n },\n {\n value: 'end',\n displayName: 'Align end',\n },\n ],\n },\n displayName: 'Text Align',\n type: 'Text',\n group: 'style',\n defaultValue: 'start',\n },\n cfTextTransform: {\n validations: {\n in: [\n {\n value: 'none',\n displayName: 'Normal',\n },\n {\n value: 'capitalize',\n displayName: 'Capitalize',\n },\n {\n value: 'uppercase',\n displayName: 'Uppercase',\n },\n {\n value: 'lowercase',\n displayName: 'Lowercase',\n },\n ],\n },\n displayName: 'Text Transform',\n type: 'Text',\n group: 'style',\n defaultValue: 'none',\n },\n cfTextBold: {\n displayName: 'Bold',\n type: 'Boolean',\n group: 'style',\n defaultValue: false,\n },\n cfTextItalic: {\n displayName: 'Italic',\n type: 'Boolean',\n group: 'style',\n defaultValue: false,\n },\n cfTextUnderline: {\n displayName: 'Underline',\n type: 'Boolean',\n group: 'style',\n defaultValue: false,\n },\n};\nconst sectionBuiltInStyles = {\n ...builtInStyles,\n cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,\n cfBackgroundImageUrl: optionalBuiltInStyles.cfBackgroundImageUrl,\n cfBackgroundImageOptions: optionalBuiltInStyles.cfBackgroundImageOptions,\n};\nconst containerBuiltInStyles = {\n ...builtInStyles,\n cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,\n cfBackgroundImageUrl: optionalBuiltInStyles.cfBackgroundImageUrl,\n cfBackgroundImageOptions: optionalBuiltInStyles.cfBackgroundImageOptions,\n cfMargin: {\n displayName: 'Margin',\n type: 'Text',\n group: 'style',\n // Note: The UI overwrites '0 Auto 0 Auto' as the default value for top-level containers\n defaultValue: '0 0 0 0',\n },\n cfMaxWidth: {\n displayName: 'Max Width',\n type: 'Text',\n group: 'style',\n defaultValue: '1192px',\n },\n};\nconst dividerBuiltInStyles = {\n cfVisibility: builtInStyles.cfVisibility,\n cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,\n cfMargin: {\n displayName: 'Margin',\n type: 'Text',\n group: 'style',\n defaultValue: '20px 0px 20px 0px',\n },\n cfWidth: {\n displayName: 'Width',\n type: 'Text',\n group: 'style',\n defaultValue: '100%',\n },\n cfHeight: {\n displayName: 'Height',\n type: 'Text',\n group: 'style',\n defaultValue: '1px',\n },\n cfMaxWidth: {\n displayName: 'Max width',\n type: 'Text',\n group: 'style',\n defaultValue: 'none',\n },\n cfBackgroundColor: {\n displayName: 'Background color',\n type: 'Text',\n group: 'style',\n defaultValue: 'rgba(204, 204, 204, 1)',\n },\n};\nconst singleColumnBuiltInStyles = {\n cfVisibility: builtInStyles.cfVisibility,\n cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,\n cfBackgroundColor: optionalBuiltInStyles.cfBackgroundColor,\n cfBackgroundImageUrl: optionalBuiltInStyles.cfBackgroundImageUrl,\n cfBackgroundImageOptions: optionalBuiltInStyles.cfBackgroundImageOptions,\n cfVerticalAlignment: {\n validations: {\n in: [\n {\n value: 'start',\n displayName: 'Align left',\n },\n {\n value: 'center',\n displayName: 'Align center',\n },\n {\n value: 'end',\n displayName: 'Align right',\n },\n {\n value: 'stretch',\n displayName: 'Stretch',\n },\n ],\n },\n type: 'Text',\n group: 'style',\n defaultValue: 'center',\n displayName: 'Vertical alignment',\n },\n cfHorizontalAlignment: {\n validations: {\n in: [\n {\n value: 'start',\n displayName: 'Align top',\n },\n {\n value: 'center',\n displayName: 'Align center',\n },\n {\n value: 'end',\n displayName: 'Align bottom',\n },\n {\n value: 'stretch',\n displayName: 'Stretch',\n },\n ],\n },\n type: 'Text',\n group: 'style',\n defaultValue: 'center',\n displayName: 'Horizontal alignment',\n },\n cfPadding: {\n displayName: 'Padding',\n type: 'Text',\n group: 'style',\n defaultValue: '0 0 0 0',\n },\n cfFlexDirection: {\n displayName: 'Direction',\n type: 'Text',\n group: 'style',\n defaultValue: 'column',\n },\n cfFlexWrap: {\n displayName: 'Wrap objects',\n type: 'Text',\n group: 'style',\n defaultValue: 'nowrap',\n },\n cfBorder: {\n displayName: 'Border',\n type: 'Text',\n group: 'style',\n defaultValue: '0px solid rgba(0, 0, 0, 0)',\n },\n cfGap: {\n displayName: 'Gap',\n type: 'Text',\n group: 'style',\n defaultValue: '0px',\n },\n cfColumnSpan: {\n type: 'Text',\n defaultValue: '6',\n group: 'style',\n },\n cfColumnSpanLock: {\n type: 'Boolean',\n defaultValue: false,\n group: 'style',\n },\n};\nconst columnsBuiltInStyles = {\n cfVisibility: builtInStyles.cfVisibility,\n cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,\n cfBackgroundColor: optionalBuiltInStyles.cfBackgroundColor,\n cfBackgroundImageUrl: optionalBuiltInStyles.cfBackgroundImageUrl,\n cfBackgroundImageOptions: optionalBuiltInStyles.cfBackgroundImageOptions,\n cfMargin: {\n displayName: 'Margin',\n type: 'Text',\n group: 'style',\n // Note: The UI overwrites '0 Auto 0 Auto' as the default value for top-level columns\n defaultValue: '0 0 0 0',\n },\n cfWidth: {\n displayName: 'Width',\n type: 'Text',\n group: 'style',\n defaultValue: '100%',\n },\n cfMaxWidth: {\n displayName: 'Max width',\n type: 'Text',\n group: 'style',\n defaultValue: '1192px',\n },\n cfPadding: {\n displayName: 'Padding',\n type: 'Text',\n group: 'style',\n defaultValue: '10px 10px 10px 10px',\n },\n cfBorder: {\n displayName: 'Border',\n type: 'Text',\n group: 'style',\n defaultValue: '0px solid rgba(0, 0, 0, 0)',\n },\n cfGap: {\n displayName: 'Gap',\n type: 'Text',\n group: 'style',\n defaultValue: '10px 10px',\n },\n cfColumns: {\n type: 'Text',\n defaultValue: '[6,6]',\n group: 'style',\n },\n cfWrapColumns: {\n type: 'Boolean',\n defaultValue: false,\n group: 'style',\n },\n cfWrapColumnsCount: {\n type: 'Text',\n defaultValue: '2',\n group: 'style',\n },\n};\n\nlet designTokensRegistry = {};\n// This function is used to ensure that the composite values are valid since composite values are optional.\n// Therefore only border and in the future text related design tokens are/will be checked in this funciton.\n// Ensuring values for simple key-value design tokens are not neccessary since they are required via typescript.\nconst ensureValidCompositeValues = (designTokenDefinition) => {\n // Text token validation\n if (designTokenDefinition.text) {\n for (const textKey in designTokenDefinition.text) {\n const textValue = designTokenDefinition.text[textKey];\n designTokenDefinition.text[textKey] = {\n emphasis: textValue.emphasis || 'none',\n fontSize: textValue.fontSize || '16px',\n case: textValue.case || 'normal',\n fontWeight: textValue.fontWeight || '400',\n lineHeight: textValue.lineHeight || '20px',\n letterSpacing: textValue.letterSpacing || '0px',\n color: textValue.color || '#000000',\n };\n }\n }\n // Border validation\n if (designTokenDefinition.border) {\n for (const borderKey in designTokenDefinition.border) {\n const borderValue = designTokenDefinition.border[borderKey];\n designTokenDefinition.border[borderKey] = {\n width: borderValue.width || '1px',\n style: borderValue.style || 'solid',\n color: borderValue.color || '#000000',\n };\n }\n }\n return designTokenDefinition;\n};\n/**\n * Register design tokens styling\n * @param designTokenDefinition - {[key:string]: Record<string, string>}\n * @returns void\n */\nconst defineDesignTokens = (designTokenDefinition) => {\n Object.assign(designTokensRegistry, ensureValidCompositeValues(designTokenDefinition));\n};\nconst templateStringRegex = /\\${(\\w.+?)}/g;\nconst getDesignTokenRegistration = (breakpointValue, variableName) => {\n if (!breakpointValue)\n return breakpointValue;\n let resolvedValue = '';\n // Match all parts of the string, including design tokens and other parts\n const parts = breakpointValue.match(/(\\${.+?}|\\S+)/g);\n if (parts) {\n for (const part of parts) {\n const isDesignToken = templateStringRegex.test(part);\n const tokenValue = isDesignToken ? resolveSimpleDesignToken(part, variableName) : part;\n resolvedValue += `${tokenValue} `;\n }\n }\n // Not trimming would end up with a trailing space that breaks the check in `calculateNodeDefaultHeight`\n return resolvedValue.trim();\n};\nconst resolveSimpleDesignToken = (templateString, variableName) => {\n const nonTemplateValue = templateString.replace(templateStringRegex, '$1');\n const [tokenCategory, tokenName] = nonTemplateValue.split('.');\n const tokenValues = designTokensRegistry[tokenCategory];\n if (tokenValues && tokenValues[tokenName]) {\n if (variableName === 'cfBorder') {\n const { width, style, color } = tokenValues[tokenName];\n return `${width} ${style} ${color}`;\n }\n return tokenValues[tokenName];\n }\n if (builtInStyles[variableName]) {\n return builtInStyles[variableName].defaultValue;\n }\n if (optionalBuiltInStyles[variableName]) {\n return optionalBuiltInStyles[variableName].defaultValue;\n }\n return '0px';\n};\n// Used in unit tests to reset the design token registry\nconst resetDesignTokenRegistry = () => {\n designTokensRegistry = {};\n};\n\n// If more than one version is supported, use z.union\nconst SchemaVersions = z.literal('2023-09-28');\n// Keep deprecated versions here just for reference\nz.union([\n z.literal('2023-08-23'),\n z.literal('2023-07-26'),\n z.literal('2023-06-27'),\n]);\n\nconst DefinitionPropertyTypeSchema = z.enum([\n 'Text',\n 'RichText',\n 'Number',\n 'Date',\n 'Boolean',\n 'Location',\n 'Media',\n 'Object',\n 'Hyperlink',\n 'Array',\n 'Link',\n]);\nconst DefinitionPropertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,32}$/, { message: 'Property needs to match: /^[a-zA-Z0-9-_]{1,32}$/' });\nconst PrimitiveValueSchema = z.union([\n z.string(),\n z.boolean(),\n z.number(),\n z.record(z.any(), z.any()),\n z.undefined(),\n]);\nconst UsedComponentsSchema = z.array(z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.literal('Entry'),\n }),\n}));\nconst uuidKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,21}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,21}$/' });\nconst DataSourceSchema = z.record(uuidKeySchema, z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry', 'Asset']),\n }),\n}));\nconst UnboundValuesSchema = z.record(uuidKeySchema, z.object({\n value: PrimitiveValueSchema,\n}));\n/**\n * Property keys for imported components have a limit of 32 characters (to be implemented) while\n * property keys for patterns have a limit of 54 characters (<32-char-variable-name>_<21-char-nanoid-id>).\n * Because we cannot distinguish between the two in the componentTree, we will use the larger limit for both.\n */\nconst propertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,54}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,54}$/' });\nconst ComponentTreeNodeIdSchema = z\n .string()\n .regex(/^[a-zA-Z0-9]{1,8}$/, { message: 'Does not match /^[a-zA-Z0-9]{1,8}$/' });\nconst breakpointsRefinement = (value, ctx) => {\n if (!value.length || value[0].query !== '*') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The first breakpoint should include the following attributes: { \"query\": \"*\" }`,\n });\n return;\n }\n // Return early if there's only one generic breakpoint\n const hasNoBreakpointsStrategy = value.length === 1;\n if (hasNoBreakpointsStrategy) {\n return;\n }\n // Check if any breakpoint id occurs twice\n const ids = value.map((breakpoint) => breakpoint.id);\n const hasDuplicateIds = new Set(ids).size !== ids.length;\n if (hasDuplicateIds) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint IDs must be unique`,\n });\n return;\n }\n // Skip the first one which is guaranteed to be a wildcard query\n const nonBaseBreakpoints = value.slice(1);\n const isMobileFirstStrategy = nonBaseBreakpoints[0].query.startsWith('>');\n const isDesktopFirstStrategy = nonBaseBreakpoints[0].query.startsWith('<');\n if (isMobileFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('>'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \">[size]px\" for mobile-first strategy`,\n });\n }\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n // Starting with the third breakpoint, check that every query is higher than the one above\n const isIncreasing = queries.every((value, index, array) => index === 0 || value > array[index - 1]);\n if (!isIncreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a mobile-first strategy, all breakpoints must have strictly increasing pixel values`,\n });\n }\n }\n else if (isDesktopFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('<'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \"<[size]px\" for desktop-first strategy`,\n });\n }\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n // Starting with the third breakpoint, check that every query is lower than the one above\n const isDecreasing = queries.every((value, index, array) => index === 0 || value < array[index - 1]);\n if (!isDecreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a desktop-first strategy, all breakpoints must have strictly decreasing pixel values`,\n });\n }\n }\n else if (!isMobileFirstStrategy && !isDesktopFirstStrategy) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `You may only use a mobile-first or desktop-first strategy for breakpoints using '<' or '>' queries`,\n });\n }\n};\nconst ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));\nconst BindingSourceTypeEnumSchema = z\n .array(z.enum(['entry', 'asset', 'manual', 'experience']))\n .nonempty();\nconst DesignValueSchema = z\n .object({\n type: z.literal('DesignValue'),\n valuesByBreakpoint: ValuesByBreakpointSchema,\n})\n .strict();\nconst BoundValueSchema = z\n .object({\n type: z.literal('BoundValue'),\n path: z.string(),\n})\n .strict();\nconst HyperlinkValueSchema = z\n .object({\n type: z.literal('HyperlinkValue'),\n linkTargetKey: z.string(),\n /** Allows to override parts of the URL, e.g. the locale */\n overrides: z.object({}).optional(),\n})\n .strict();\nconst UnboundValueSchema = z\n .object({\n type: z.literal('UnboundValue'),\n key: z.string(),\n})\n .strict();\nconst ComponentValueSchema = z\n .object({\n type: z.literal('ComponentValue'),\n key: z.string(),\n})\n .strict();\nconst NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();\nconst ComponentPropertyValueSchema = z.discriminatedUnion('type', [\n DesignValueSchema,\n BoundValueSchema,\n UnboundValueSchema,\n HyperlinkValueSchema,\n ComponentValueSchema,\n NoValueSchema,\n]);\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nconst ParameterSchema = z.object({\n type: z.literal('BoundValue'),\n path: z.string(),\n});\nconst ParametersSchema = z.record(propertyKeySchema, ParameterSchema);\nconst BREAKPOINT_QUERY_REGEX = /^\\*$|^[<>][0-9]+px$/;\nconst BreakpointSchema = z\n .object({\n id: propertyKeySchema,\n // Can be replaced with z.templateLiteral when upgrading to zod v4\n query: z.string().refine((s) => BREAKPOINT_QUERY_REGEX.test(s)),\n previewSize: z.string().optional(),\n displayName: z.string(),\n displayIcon: z.enum(['desktop', 'tablet', 'mobile']).optional(),\n})\n .strict();\n// Use helper schema to define a recursive schema with its type correctly below\nconst BaseComponentTreeNodeSchema = z.object({\n id: ComponentTreeNodeIdSchema.optional(),\n definitionId: DefinitionPropertyKeySchema,\n prebindingId: z.string().optional(),\n displayName: z.string().optional(),\n slotId: z.string().optional(),\n variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),\n parameters: ParametersSchema.optional(),\n});\nconst ComponentVariableSchema = z.object({\n displayName: z.string().optional(),\n type: DefinitionPropertyTypeSchema,\n description: z.string().optional(),\n group: z.string().optional(),\n defaultValue: PrimitiveValueSchema.or(ComponentPropertyValueSchema).optional(),\n validations: z\n .object({\n bindingSourceType: BindingSourceTypeEnumSchema.optional(),\n required: z.boolean().optional(),\n format: z.literal('URL').optional(),\n in: z\n .array(z.object({\n value: z.union([z.string(), z.number()]),\n displayName: z.string().optional(),\n }))\n .optional(),\n })\n .optional(),\n});\nconst ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({\n children: z.lazy(() => ComponentTreeNodeSchema.array()),\n}).superRefine(({ id, prebindingId, parameters }, ctx) => {\n // We don't fail if parameters are present but prebindingId is not because\n // older experiences (updated before 21-09-2025) always included parameters\n // and they will start failing if we do.\n if (prebindingId && !parameters) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found \"prebindingId\" but no \"parameters\" for node with id: \"${id}\"`,\n });\n }\n});\nconst ComponentTreeSchema = z\n .object({\n breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),\n children: z.array(ComponentTreeNodeSchema),\n schemaVersion: SchemaVersions,\n})\n .strict();\nconst localeWrapper = (fieldSchema) => z.record(z.string(), fieldSchema);\n\nz.object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n});\n\nfunction treeVisit$1(initialNode, onNode) {\n const _treeVisit = (currentNode) => {\n const children = [...currentNode.children];\n onNode(currentNode);\n for (const child of children) {\n _treeVisit(child);\n }\n };\n if (Array.isArray(initialNode)) {\n for (const node of initialNode) {\n _treeVisit(node);\n }\n }\n else {\n _treeVisit(initialNode);\n }\n}\n\nconst MAX_ALLOWED_PATHS = 200;\nconst THUMBNAIL_IDS = [\n 'columns',\n 'columnsPlusRight',\n 'imagesSquare',\n 'subtitles',\n 'rowsPlusBottom',\n 'userRectangle',\n 'textbox',\n 'monitorPlay',\n 'article',\n 'table',\n 'star',\n 'heartStraight',\n 'frameCorners',\n 'rows',\n 'dotsThreeOutline',\n 'listDashes',\n 'checkerBoard',\n 'gridFour',\n 'slideshow',\n 'diamondsFour',\n 'cards',\n 'textColumns',\n 'duplex',\n];\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nconst VariableMappingSchema = z.object({\n parameterId: propertyKeySchema,\n type: z.literal('ContentTypeMapping'),\n pathsByContentType: z\n .record(z.string(), z.object({ path: z.string() }))\n .superRefine((paths, ctx) => {\n const variableId = ctx.path[ctx.path.length - 2];\n if (Object.keys(paths).length > MAX_ALLOWED_PATHS) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Too many paths defined for variable mapping with id \"${variableId}\", maximum allowed is ${MAX_ALLOWED_PATHS}`,\n });\n }\n }),\n});\nconst PassToNodeSchema = z\n .object({\n nodeId: propertyKeySchema,\n parameterId: propertyKeySchema,\n prebindingId: propertyKeySchema,\n})\n .strict();\nconst ParameterDefinitionSchema = z.object({\n defaultSource: z\n .strictObject({\n type: z.enum(['Entry']),\n contentTypeId: z.string(),\n link: z.strictObject({\n sys: z.strictObject({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry']),\n }),\n }),\n })\n .optional(),\n contentTypes: z.array(z.string()).min(1),\n passToNodes: z\n .array(PassToNodeSchema)\n .max(1, 'At most one \"passToNodes\" element is allowed per parameter definition.'),\n});\nconst ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);\nconst VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);\nconst ComponentVariablesSchema = z.record(z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length\nComponentVariableSchema);\nconst PrebindingDefinitionSchema = z\n .object({\n id: propertyKeySchema,\n parameterDefinitions: ParameterDefinitionsSchema,\n variableMappings: VariableMappingsSchema.optional(),\n allowedVariableOverrides: z.array(z.string()).optional(),\n})\n .strict();\nconst ComponentSettingsSchema = z\n .object({\n variableDefinitions: ComponentVariablesSchema,\n thumbnailId: z.enum(THUMBNAIL_IDS).optional(),\n category: z.string().max(50, 'Category must contain at most 50 characters').optional(),\n prebindingDefinitions: z.array(PrebindingDefinitionSchema).length(1).optional(),\n})\n .strict()\n .superRefine((componentSettings, ctx) => {\n const { variableDefinitions, prebindingDefinitions } = componentSettings;\n if (!prebindingDefinitions || prebindingDefinitions.length === 0) {\n return;\n }\n const { parameterDefinitions, variableMappings, allowedVariableOverrides } = prebindingDefinitions[0];\n validateAtMostOneNativeParameterDefinition(parameterDefinitions, ctx);\n validateNoOverlapBetweenMappingAndOverrides(variableMappings, allowedVariableOverrides, ctx);\n validateMappingsAgainstVariableDefinitions(variableMappings, allowedVariableOverrides, variableDefinitions, ctx);\n validateMappingsAgainstParameterDefinitions(variableMappings, parameterDefinitions, ctx);\n});\nz\n .object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n componentSettings: localeWrapper(ComponentSettingsSchema),\n})\n .superRefine((patternFields, ctx) => {\n const { componentTree, componentSettings } = patternFields;\n // values at this point are wrapped under locale code\n const nonLocalisedComponentTree = Object.values(componentTree)[0];\n const nonLocalisedComponentSettings = Object.values(componentSettings)[0];\n if (!nonLocalisedComponentSettings || !nonLocalisedComponentTree) {\n return;\n }\n validatePassToNodes(nonLocalisedComponentTree.children || [], nonLocalisedComponentSettings || {}, ctx);\n});\nconst validateAtMostOneNativeParameterDefinition = (parameterDefinitions, ctx) => {\n const nativeParamDefinitions = Object.values(parameterDefinitions).filter((paramDefinition) => !(paramDefinition.passToNodes && paramDefinition.passToNodes.length > 0));\n if (nativeParamDefinitions.length > 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Only one native parameter definition (parameter definition without passToNodes) is allowed per prebinding definition.`,\n });\n }\n};\nconst validateNoOverlapBetweenMappingAndOverrides = (variableMappings, allowedVariableOverrides, ctx) => {\n const variableMappingKeys = Object.keys(variableMappings || {});\n const overridesSet = new Set(allowedVariableOverrides || []);\n const overlap = variableMappingKeys.filter((key) => overridesSet.has(key));\n if (overlap.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found both variable mapping and allowed override for the following keys: ${overlap.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\nconst validateMappingsAgainstVariableDefinitions = (variableMappings, allowedVariableOverrides, variableDefinitions, ctx) => {\n const nonDesignVariableDefinitionKeys = Object.entries(variableDefinitions)\n .filter(([_, def]) => def.group !== 'style')\n .map(([key]) => key);\n const variableMappingKeys = Object.keys(variableMappings || {});\n const allKeys = [...variableMappingKeys, ...(allowedVariableOverrides || [])];\n const invalidMappings = allKeys.filter((key) => !nonDesignVariableDefinitionKeys.includes(key));\n if (invalidMappings.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following variable mappings or overrides are missing from the variable definitions: ${invalidMappings.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\nconst validateMappingsAgainstParameterDefinitions = (variableMappings, parameterDefinitions, ctx) => {\n const parameterDefinitionKeys = Object.keys(parameterDefinitions || {});\n for (const [mappingKey, mappingValue] of Object.entries(variableMappings || {})) {\n if (!parameterDefinitionKeys.includes(mappingValue.parameterId)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The variable mapping with id \"${mappingKey}\" references a non-existing parameterId \"${mappingValue.parameterId}\".`,\n });\n }\n }\n};\nconst validatePassToNodes = (rootChildren, componentSettings, ctx) => {\n if (!componentSettings.prebindingDefinitions ||\n componentSettings.prebindingDefinitions.length === 0) {\n return;\n }\n const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];\n const nodeIds = new Set();\n for (const paramDef of Object.values(parameterDefinitions || {})) {\n paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));\n }\n treeVisit$1(rootChildren, (node) => {\n if (!node.id)\n return;\n if (nodeIds.has(node.id)) {\n nodeIds.delete(node.id);\n }\n });\n if (nodeIds.size > 0) {\n const stringifiedNodeIds = Array.from(nodeIds)\n .map((id) => `\"${id}\"`)\n .join(', ');\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following node IDs referenced in passToNodes are not present in the component tree: ${stringifiedNodeIds}.`,\n });\n }\n};\n\nz\n .object({\n id: DefinitionPropertyKeySchema,\n name: z.string(),\n category: z.string().optional(),\n thumbnailUrl: z.string().optional(),\n thumbnailId: z.string().optional(),\n hyperlinkPattern: z.string().optional(),\n children: z.boolean().optional(),\n slots: z\n .record(DefinitionPropertyKeySchema, z.object({ displayName: z.string().optional() }))\n .optional(),\n builtInStyles: z.array(z.string()).optional(),\n tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),\n variables: z.record(DefinitionPropertyKeySchema, ComponentVariableSchema.extend({\n defaultValue: PrimitiveValueSchema.optional(),\n }).superRefine((val, ctx) => {\n switch (val.type) {\n case 'Array':\n if (typeof val.defaultValue !== 'undefined') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Array\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Boolean':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'boolean') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a boolean when type is \"Boolean\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Date':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Date\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Hyperlink':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Hyperlink\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Link':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Link\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Location':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Location\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Media':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Media\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Number':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'number') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a number when type is \"Number\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Object':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Object\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'RichText':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"RichText\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Text':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Text\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n }\n })),\n})\n .superRefine((val, ctx) => {\n if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,\n fatal: false,\n });\n }\n // Ensure that slots and variables don't use the same names\n if (val.variables && val.slots) {\n Object.keys(val.variables).forEach((name) => {\n if (val.slots[name]) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Variable and slot cannot have the same name: ${name}`,\n fatal: false,\n });\n }\n });\n }\n});\n\nvar CodeNames;\n(function (CodeNames) {\n CodeNames[\"Type\"] = \"type\";\n CodeNames[\"Required\"] = \"required\";\n CodeNames[\"Unexpected\"] = \"unexpected\";\n CodeNames[\"Regex\"] = \"regex\";\n CodeNames[\"In\"] = \"in\";\n CodeNames[\"Size\"] = \"size\";\n CodeNames[\"Custom\"] = \"custom\";\n})(CodeNames || (CodeNames = {}));\nconst convertInvalidType = (issue) => {\n const name = issue.received === 'undefined' ? CodeNames.Required : CodeNames.Type;\n const details = issue.received === 'undefined'\n ? `The property \"${issue.path.slice(-1)}\" is required here`\n : `The type of \"${issue.path.slice(-1)}\" is incorrect, expected type: ${issue.expected}`;\n return {\n details: details,\n name: name,\n path: issue.path,\n value: issue.received.toString(),\n };\n};\nconst convertUnrecognizedKeys = (issue) => {\n const missingProperties = issue.keys.map((k) => `\"${k}\"`).join(', ');\n return {\n details: issue.keys.length > 1\n ? `The properties ${missingProperties} are not expected`\n : `The property ${missingProperties} is not expected`,\n name: CodeNames.Unexpected,\n path: issue.path,\n };\n};\nconst convertInvalidString = (issue) => {\n return {\n details: issue.message || 'Invalid string',\n name: issue.validation === 'regex' ? CodeNames.Regex : CodeNames.Unexpected,\n path: issue.path,\n };\n};\nconst convertInvalidEnumValue = (issue) => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received.toString(),\n expected: issue.options,\n };\n};\nconst convertInvalidLiteral = (issue) => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received,\n expected: [issue.expected],\n };\n};\nconst convertTooBig = (issue) => {\n return {\n details: issue.message || `Size should be at most ${issue.maximum}`,\n name: CodeNames.Size,\n path: issue.path,\n max: issue.maximum,\n };\n};\nconst convertTooSmall = (issue) => {\n return {\n details: issue.message || `Size should be at least ${issue.minimum}`,\n name: CodeNames.Size,\n path: issue.path,\n min: issue.minimum,\n };\n};\nconst defaultConversion = (issue) => {\n return {\n details: issue.message || 'An unexpected error occurred',\n name: CodeNames.Custom,\n path: issue.path.map(String),\n };\n};\nconst zodToContentfulError = (issue) => {\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n return convertInvalidType(issue);\n case ZodIssueCode.unrecognized_keys:\n return convertUnrecognizedKeys(issue);\n case ZodIssueCode.invalid_enum_value:\n return convertInvalidEnumValue(issue);\n case ZodIssueCode.invalid_string:\n return convertInvalidString(issue);\n case ZodIssueCode.too_small:\n return convertTooSmall(issue);\n case ZodIssueCode.too_big:\n return convertTooBig(issue);\n case ZodIssueCode.invalid_literal:\n return convertInvalidLiteral(issue);\n default:\n return defaultConversion(issue);\n }\n};\n\nconst validateBreakpointsDefinition = (breakpoints) => {\n const result = z\n .array(BreakpointSchema)\n .superRefine(breakpointsRefinement)\n .safeParse(breakpoints);\n if (!result.success) {\n return {\n success: false,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n\nconst breakpointsRegistry = [];\n/**\n * Define custom breakpoints that should be used for all your experiences.\n * A breakpoint consists of:\n * - id: a unique identifier for this breakpoint\n * - query: a media query string that defines when this breakpoint is active\n * - previewSize: an optional fixed preview size to be used in the Studio editor when selecting this breakpoint\n * - displayName: the name to be displayed in the Studio editor for this breakpoint\n * - displayIcon: an optional icon to be displayed in the Studio editor for this breakpoint\n *\n * The first breakpoint must use a wildcard query (`*`) to match all sizes.\n *\n * Every subsequent breakpoint inherits the designs of the previous ones by default.\n *\n * The order of breakpoints must be either:\n * - desktop first: from largest to smallest, using `<` operators\n * - mobile first: from smallest to largest, using `>` operators\n *\n * @note changing breakpoints after you have created experiences may break those experiences\n * @example\n * defineBreakpoints([{\n * id: 'desktop',\n * query: '*',\n * displayName: 'Desktop',\n * displayIcon: 'desktop',\n * }, {\n * id: 'tablet',\n * query: '<992px',\n * displayName: 'Tablet',\n * displayIcon: 'tablet',\n * }, {\n * id: 'mobile',\n * query: '<576px',\n * displayName: 'Mobile',\n * displayIcon: 'mobile',\n * }]);\n */\nconst defineBreakpoints = (breakpoints) => {\n Object.assign(breakpointsRegistry, breakpoints);\n};\nconst runBreakpointsValidation = () => {\n if (!breakpointsRegistry.length)\n return;\n const validation = validateBreakpointsDefinition(breakpointsRegistry);\n if (!validation.success) {\n throw new Error(`Invalid breakpoints definition. Failed with errors: \\n${JSON.stringify(validation.errors, null, 2)}`);\n }\n};\n\nconst sdkOptionsRegistry = {};\n/**\n * Used inside defineComponents to forward registry arguments to this registry\n * of SDK options.\n */\nconst defineSdkOptions = (options) => {\n Object.assign(sdkOptionsRegistry, options);\n};\nconst getSdkOptions = () => {\n return { ...sdkOptionsRegistry };\n};\n\nconst MEDIA_QUERY_REGEXP = /(<|>)(\\d{1,})(px|cm|mm|in|pt|pc)$/;\nconst toCSSMediaQuery = ({ query }) => {\n if (query === '*')\n return undefined;\n const match = query.match(MEDIA_QUERY_REGEXP);\n if (!match)\n return undefined;\n const [, operator, value, unit] = match;\n if (operator === '<') {\n const maxScreenWidth = Number(value) - 1;\n return `(max-width: ${maxScreenWidth}${unit})`;\n }\n else if (operator === '>') {\n const minScreenWidth = Number(value) + 1;\n return `(min-width: ${minScreenWidth}${unit})`;\n }\n return undefined;\n};\n// Remove this helper when upgrading to TypeScript 5.0 - https://github.com/microsoft/TypeScript/issues/48829\nconst findLast = (array, predicate) => {\n return [...array].reverse().find(predicate);\n};\n// Initialise media query matchers. This won't include the always matching fallback breakpoint.\nconst mediaQueryMatcher = (breakpoints) => {\n const mediaQueryMatches = {};\n const mediaQueryMatchers = breakpoints\n .map((breakpoint) => {\n const cssMediaQuery = toCSSMediaQuery(breakpoint);\n if (!cssMediaQuery)\n return undefined;\n if (typeof window === 'undefined')\n return undefined;\n const mediaQueryMatcher = window.matchMedia(cssMediaQuery);\n mediaQueryMatches[breakpoint.id] = mediaQueryMatcher.matches;\n return { id: breakpoint.id, signal: mediaQueryMatcher };\n })\n .filter((matcher) => !!matcher);\n return [mediaQueryMatchers, mediaQueryMatches];\n};\nconst getActiveBreakpointIndex = (breakpoints, mediaQueryMatches, fallbackBreakpointIndex) => {\n // The breakpoints are ordered (desktop-first: descending by screen width, mobile-first: ascending by screen width).\n const breakpointsWithMatches = breakpoints.map(({ id }, index) => ({\n id,\n index,\n // The fallback breakpoint with wildcard query will always match\n isMatch: mediaQueryMatches[id] ?? index === fallbackBreakpointIndex,\n }));\n // Find the last breakpoint in the list that matches (desktop-first: the narrowest one, mobile-first: the widest one)\n const mostSpecificIndex = findLast(breakpointsWithMatches, ({ isMatch }) => isMatch)?.index;\n return mostSpecificIndex ?? fallbackBreakpointIndex;\n};\nconst getFallbackBreakpointIndex = (breakpoints) => {\n // The validation ensures that there will be exactly one breakpoint using the wildcard query.\n // If there is none, we just take the first one in the list.\n return Math.max(breakpoints.findIndex(({ query }) => query === '*'), 0);\n};\nconst builtInStylesWithDesignTokens = [\n 'cfMargin',\n 'cfPadding',\n 'cfGap',\n 'cfWidth',\n 'cfHeight',\n 'cfBackgroundColor',\n 'cfBorder',\n 'cfBorderRadius',\n 'cfFontSize',\n 'cfLineHeight',\n 'cfLetterSpacing',\n 'cfTextColor',\n 'cfMaxWidth',\n];\nconst isValidBreakpointValue = (value) => {\n return value !== undefined && value !== null && value !== '';\n};\nconst getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex, \n/** Provide the name for built-in styles to replace design tokens. Supported properties are:\n * cfMargin, cfPadding, cfGap, cfWidth, cfHeight, cfBackgroundColor,\n * cfBorder, cfBorderRadius, cfFontSize, cfLineHeight, cfLetterSpacing,\n * cfTextColor, cfMaxWidth\n */\npropertyName, resolveDesignTokens = true) => {\n const eventuallyResolveDesignTokens = (value) => {\n // This is used externally in the web app to determine the original persisted value\n if (!resolveDesignTokens) {\n return value;\n }\n // For some built-in design properties, we support design tokens\n if (propertyName && builtInStylesWithDesignTokens.includes(propertyName)) {\n return getDesignTokenRegistration(value, propertyName);\n }\n // For all other properties, we just return the breakpoint-specific value\n return value;\n };\n if (valuesByBreakpoint instanceof Object) {\n // Assume that the values are sorted by media query to apply the cascading CSS logic\n for (let index = activeBreakpointIndex; index >= 0; index--) {\n const breakpointId = breakpoints[index]?.id;\n if (isValidBreakpointValue(valuesByBreakpoint[breakpointId])) {\n // If the value is defined, we use it and stop the breakpoints cascade\n return eventuallyResolveDesignTokens(valuesByBreakpoint[breakpointId]);\n }\n }\n const fallbackBreakpointId = breakpoints[fallbackBreakpointIndex]?.id;\n if (isValidBreakpointValue(valuesByBreakpoint[fallbackBreakpointId])) {\n return eventuallyResolveDesignTokens(valuesByBreakpoint[fallbackBreakpointId]);\n }\n }\n else {\n // Old design properties did not support breakpoints, keep for backward compatibility\n return valuesByBreakpoint;\n }\n};\n/** Overwrites the default value breakpoint by breakpoint. If a breakpoint\n * is not overwritten, it will fall back to the default. */\nfunction mergeDesignValuesByBreakpoint(defaultValue, overwriteValue) {\n if (!defaultValue || !overwriteValue) {\n return defaultValue ?? overwriteValue;\n }\n const mergedValuesByBreakpoint = { ...defaultValue.valuesByBreakpoint };\n for (const [breakpointId, value] of Object.entries(overwriteValue.valuesByBreakpoint)) {\n if (!isValidBreakpointValue(value)) {\n continue;\n }\n mergedValuesByBreakpoint[breakpointId] = value;\n }\n return {\n type: 'DesignValue',\n valuesByBreakpoint: mergedValuesByBreakpoint,\n };\n}\nconst BREAKPOINTS_STRATEGY_DESKTOP_FIRST = 'desktop-first';\nconst BREAKPOINTS_STRATEGY_MOBILE_FIRST = 'mobile-first';\n/**\n * Detects the breakpoint strategy based on the provided breakpoints.\n *\n * @param breakpoints The array of breakpoints to analyze.\n * @returns The detected breakpoint strategy or undefined if not determinable.\n */\nconst detectBreakpointsStrategy = (breakpoints) => {\n if (breakpoints.length < 2) {\n return undefined;\n }\n const hasMobileFirst = breakpoints.slice(1).every((bp) => bp.query.startsWith('>'));\n if (hasMobileFirst) {\n return BREAKPOINTS_STRATEGY_MOBILE_FIRST;\n }\n const hasDesktopFirst = breakpoints.slice(1).every((bp) => bp.query.startsWith('<'));\n if (hasDesktopFirst) {\n return BREAKPOINTS_STRATEGY_DESKTOP_FIRST;\n }\n return undefined;\n};\n\nconst CF_DEBUG_KEY = 'cf_debug';\n/**\n * To ensure that the localStorage API can be used safely, we check\n * for availability (e.g. undefined in Node.js). Additionally, we\n * check if the localStorage can be used as some browsers throw a\n * SecurityError (e.g. Brave or Chromium with specific settings).\n */\nconst checkLocalStorageAvailability = () => {\n try {\n // Even the typeof check can throw an error in an agressive browser like Brave (requires using the deprecated flag #block-all-cookies-toggle)\n if (typeof localStorage === 'undefined' || localStorage === null) {\n return false;\n }\n // Attempt to set and remove an item to check if localStorage is enabled\n const TEST_KEY = 'cf_test_local_storage';\n localStorage.setItem(TEST_KEY, 'yes');\n if (localStorage.getItem(TEST_KEY) === 'yes') {\n localStorage.removeItem(TEST_KEY);\n return true;\n }\n else {\n return false;\n }\n }\n catch (_error) {\n return false;\n }\n};\nconst DEBUG_LEVELS_HIERARCHY = ['error', 'warn', 'log', 'debug'];\nclass DebugLogger {\n constructor() {\n this.activeLevel = 'warn';\n // Public methods for logging\n this.error = this.logger('error');\n this.warn = this.logger('warn');\n this.log = this.logger('log');\n this.debug = this.logger('debug');\n if (!checkLocalStorageAvailability()) {\n return;\n }\n // Default to checking localStorage for the debug mode on initialization if in browser\n if (localStorage.getItem(CF_DEBUG_KEY) === 'true') {\n this.activeLevel = 'debug';\n }\n }\n static getInstance() {\n if (this.instance === null) {\n this.instance = new DebugLogger();\n }\n return this.instance;\n }\n getActiveLevel() {\n return this.activeLevel;\n }\n setActiveLevel(level) {\n this.activeLevel = level;\n if (!checkLocalStorageAvailability()) {\n return;\n }\n if (this.activeLevel === 'debug' || this.activeLevel === 'log') {\n localStorage.setItem(CF_DEBUG_KEY, 'true');\n }\n else {\n localStorage.removeItem(CF_DEBUG_KEY);\n }\n }\n // Log method for different levels (error, warn, log)\n logger(level) {\n return (...args) => {\n const levelPriority = DEBUG_LEVELS_HIERARCHY.indexOf(level);\n const activeLevelPriority = DEBUG_LEVELS_HIERARCHY.indexOf(this.activeLevel);\n const enabled = levelPriority <= activeLevelPriority;\n if (enabled) {\n console[level](...args);\n }\n };\n }\n}\nDebugLogger.instance = null;\nconst debug = DebugLogger.getInstance();\n/** Set the logging level to `debug` */\nconst enableDebug = () => {\n debug.setActiveLevel('debug');\n console.log('Debug mode enabled');\n};\n/** Set the debug level to `warn` */\nconst disableDebug = () => {\n debug.setActiveLevel('warn');\n console.log('Debug mode disabled');\n};\n/** Set the debug level to the provided level */\nconst setDebugLevel = (level) => {\n debug.setActiveLevel(level);\n console.log(`Debug mode set to ${level}`);\n};\n\nconst findOutermostCoordinates = (first, second) => {\n return {\n top: Math.min(first.top, second.top),\n right: Math.max(first.right, second.right),\n bottom: Math.max(first.bottom, second.bottom),\n left: Math.min(first.left, second.left),\n };\n};\nconst isElementHidden = (rect) => {\n /** if the rect has no size and position, its element is not rendered in the DOM */\n return rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0;\n};\nconst getElementCoordinates = (element) => {\n const rect = element.getBoundingClientRect();\n /**\n * If element does not have children, or element has it's own width or height,\n * return the element's coordinates.\n */\n if (element.children.length === 0 || rect.width !== 0 || rect.height !== 0) {\n return rect;\n }\n const rects = [];\n /**\n * If element has children, or element does not have it's own width and height,\n * we find the cordinates of the children, and assume the outermost coordinates of the children\n * as the coordinate of the element.\n *\n * E.g child1 => {top: 2, bottom: 3, left: 4, right: 6} & child2 => {top: 1, bottom: 8, left: 12, right: 24}\n * The final assumed coordinates of the element would be => { top: 1, right: 24, bottom: 8, left: 4 }\n */\n for (const child of element.children) {\n const childRect = getElementCoordinates(child);\n if (childRect.width !== 0 || childRect.height !== 0) {\n const { top, right, bottom, left } = childRect;\n rects.push({ top, right, bottom, left });\n }\n }\n if (rects.length === 0) {\n return rect;\n }\n const { top, right, bottom, left } = rects.reduce(findOutermostCoordinates);\n return DOMRect.fromRect({\n x: left,\n y: top,\n height: bottom - top,\n width: right - left,\n });\n};\n\nconst isLinkToAsset = (variable) => {\n if (variable === null || typeof variable !== 'object')\n return false;\n // The `'prop' in` pattern is informing TypeScript of the object shape, no need to cast `as`.\n if (!('sys' in variable))\n return false;\n if (variable.sys === null || typeof variable.sys !== 'object')\n return false;\n if (!('linkType' in variable.sys))\n return false;\n if (!('id' in variable.sys))\n return false;\n if (!('type' in variable.sys))\n return false;\n return (variable.sys?.linkType === 'Asset' &&\n typeof variable.sys?.id === 'string' &&\n !!variable.sys?.id &&\n variable.sys?.type === 'Link');\n};\n\nconst isLinkToEntry = (variable) => {\n if (variable === null || typeof variable !== 'object')\n return false;\n // The `'prop' in` pattern is informing TypeScript of the object shape, no need to cast `as`.\n if (!('sys' in variable))\n return false;\n if (variable.sys === null || typeof variable.sys !== 'object')\n return false;\n if (!('linkType' in variable.sys))\n return false;\n if (!('id' in variable.sys))\n return false;\n if (!('type' in variable.sys))\n return false;\n return (variable.sys?.linkType === 'Entry' &&\n typeof variable.sys?.id === 'string' &&\n !!variable.sys?.id &&\n variable.sys?.type === 'Link');\n};\n\nfunction isLink(maybeLink) {\n if (maybeLink === null)\n return false;\n if (typeof maybeLink !== 'object')\n return false;\n const link = maybeLink;\n return Boolean(link.sys?.id) && link.sys?.type === 'Link' && Boolean(link.sys?.linkType);\n}\n\n/**\n * Localizes the provided entry or asset to match the regular format of CDA/CPA entities.\n * Note that this function does not apply a fallback to the default locale nor does it check\n * the content type for the localization setting of each field.\n * It will simply resolve each field to the requested locale. As using single and multiple\n * reference fields is still considered an experimental feature, this function does not handle\n * recursive localization of deeper referenced entities.\n *\n * If the entity is already localized, it will return the entity as is.\n *\n * Note that localization is later on determined by the existence of the `sys.locale` property (matching the API shape).\n *\n * @example\n * ```\n * const multiLocaleEntry = { fields: { title: { 'en-US': 'Hello' } } };\n * const localizedEntry = localizeEntity(multiLocaleEntry, 'en-US');\n * console.log(localizedEntry.fields.title); // 'Hello'\n * ```\n */\nfunction localizeEntity(entity, locale) {\n if (!entity || !entity.fields) {\n throw new Error('Invalid entity provided');\n }\n if (entity.sys.locale) {\n return entity;\n }\n const cloned = cloneDeep(entity);\n // Set the requested locale as entry locale to follow the API shape:\n // https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/common-resource-attributes\n cloned.sys.locale = locale;\n for (const key in cloned.fields) {\n cloned.fields[key] = cloned.fields[key][locale];\n }\n return cloned;\n}\n\n/**\n * This module encapsulates format of the path to a deep reference.\n */\nconst isPreboundProp = (variable) => {\n return (variable.type === 'BoundValue' &&\n typeof variable.isPrebound === 'boolean' &&\n !!variable.pathsByContentType);\n};\nconst parseDataSourcePathIntoFieldset = (path) => {\n const parsedPath = parseDeepPath(path);\n if (null === parsedPath) {\n throw new Error(`Cannot parse path '${path}' as deep path`);\n }\n return parsedPath.fields.map((field) => [null, field, '~locale']);\n};\n/**\n * Parse path into components, supports L1 references (one reference follow) atm.\n * @param path from data source. eg. `/uuid123/fields/image/~locale/fields/file/~locale`\n * eg. `/uuid123/fields/file/~locale/fields/title/~locale`\n * @returns\n */\nconst parseDataSourcePathWithL1DeepBindings = (path) => {\n const parsedPath = parseDeepPath(path);\n if (null === parsedPath) {\n throw new Error(`Cannot parse path '${path}' as deep path`);\n }\n return {\n key: parsedPath.key,\n field: parsedPath.fields[0],\n referentField: parsedPath.fields[1],\n };\n};\n/**\n * Detects if paths is valid deep-path, like:\n * - /gV6yKXp61hfYrR7rEyKxY/fields/mainStory/~locale/fields/cover/~locale/fields/title/~locale\n * or regular, like:\n * - /6J8eA60yXwdm5eyUh9fX6/fields/mainStory/~locale\n * @returns\n */\nconst isDeepPath = (deepPathCandidate) => {\n const deepPathParsed = parseDeepPath(deepPathCandidate);\n if (!deepPathParsed) {\n return false;\n }\n return deepPathParsed.fields.length > 1;\n};\nconst isDeepPrebinding = (boundValueProperty) => {\n if (!boundValueProperty?.path || boundValueProperty.type !== 'BoundValue') {\n return false;\n }\n if (!isPreboundProp(boundValueProperty)) {\n return false;\n }\n if (isDeepPath(boundValueProperty.path)) {\n return true;\n }\n const hasDeepPathByContentType = Object.values(boundValueProperty.pathsByContentType || {}).some((val) => isDeepPath(val.path));\n return hasDeepPathByContentType;\n};\nconst getPrebindingPathBySourceEntry = (preboundValueProperty, getHeadEntityByDataSourceKey) => {\n if (!isPreboundProp(preboundValueProperty)) {\n return undefined;\n }\n // incomplete path due to several content types and not known default source\n const [, dataSourceKey] = preboundValueProperty.path.split('/');\n if (!dataSourceKey) {\n return undefined;\n }\n const headEntity = getHeadEntityByDataSourceKey(dataSourceKey);\n if (headEntity?.sys.type !== 'Entry') {\n return undefined;\n }\n const contentTypeId = headEntity.sys.contentType.sys.id;\n if (!preboundValueProperty.pathsByContentType?.[contentTypeId]) {\n return undefined;\n }\n return preboundValueProperty.pathsByContentType?.[contentTypeId]?.path;\n};\nconst parseDeepPath = (deepPathCandidate) => {\n // ALGORITHM:\n // We start with deep path in form:\n // /uuid123/fields/mainStory/~locale/fields/cover/~locale/fields/title/~locale\n // First turn string into array of segments\n // ['', 'uuid123', 'fields', 'mainStory', '~locale', 'fields', 'cover', '~locale', 'fields', 'title', '~locale']\n // Then group segments into intermediate represenatation - chunks, where each non-initial chunk starts with 'fields'\n // [\n // [ \"\", \"uuid123\" ],\n // [ \"fields\", \"mainStory\", \"~locale\" ],\n // [ \"fields\", \"cover\", \"~locale\" ],\n // [ \"fields\", \"title\", \"~locale\" ]\n // ]\n // Then check \"initial\" chunk for corretness\n // Then check all \"field-leading\" chunks for correctness\n const isValidInitialChunk = (initialChunk) => {\n // must have start with '' and have at least 2 segments, second non-empty\n // eg. /-_432uuid123123\n return /^\\/([^/^~]+)$/.test(initialChunk.join('/'));\n };\n const isValidFieldChunk = (fieldChunk) => {\n // must start with 'fields' and have at least 3 segments, second non-empty and last segment must be '~locale'\n // eg. fields/-32234mainStory/~locale\n return /^fields\\/[^/^~]+\\/~locale$/.test(fieldChunk.join('/'));\n };\n const deepPathSegments = deepPathCandidate.split('/');\n const chunks = chunkSegments(deepPathSegments, { startNextChunkOnElementEqualTo: 'fields' });\n if (chunks.length <= 1) {\n return null; // malformed path, even regular paths have at least 2 chunks\n }\n else if (chunks.length === 2) {\n return null; // deep paths have at least 3 chunks\n }\n // With 3+ chunks we can now check for deep path correctness\n const [initialChunk, ...fieldChunks] = chunks;\n if (!isValidInitialChunk(initialChunk)) {\n return null;\n }\n if (!fieldChunks.every(isValidFieldChunk)) {\n return null;\n }\n return {\n key: initialChunk[1], // pick uuid from initial chunk ['','uuid123'],\n fields: fieldChunks.map((fieldChunk) => fieldChunk[1]), // pick only fieldName eg. from ['fields','mainStory', '~locale'] we pick `mainStory`\n };\n};\nconst chunkSegments = (segments, { startNextChunkOnElementEqualTo }) => {\n const chunks = [];\n let currentChunk = [];\n const isSegmentBeginningOfChunk = (segment) => segment === startNextChunkOnElementEqualTo;\n const excludeEmptyChunks = (chunk) => chunk.length > 0;\n for (let i = 0; i < segments.length; i++) {\n const isInitialElement = i === 0;\n const segment = segments[i];\n if (isInitialElement) {\n currentChunk = [segment];\n }\n else if (isSegmentBeginningOfChunk(segment)) {\n chunks.push(currentChunk);\n currentChunk = [segment];\n }\n else {\n currentChunk.push(segment);\n }\n }\n chunks.push(currentChunk);\n return chunks.filter(excludeEmptyChunks);\n};\nconst lastPathNamedSegmentEq = (path, expectedName) => {\n // `/key123/fields/featureImage/~locale/fields/file/~locale`\n // ['', 'key123', 'fields', 'featureImage', '~locale', 'fields', 'file', '~locale']\n const segments = path.split('/');\n if (segments.length < 2) {\n debug.warn(`[experiences-core::pathSchema] Attempting to check whether last named segment of the path (${path}) equals to '${expectedName}', but the path doesn't have enough segments.`);\n return false;\n }\n const secondLast = segments[segments.length - 2]; // skipping trailing '~locale'\n return secondLast === expectedName;\n};\n\nconst resolveHyperlinkPattern = (pattern, entry, locale) => {\n if (!entry || !locale)\n return null;\n const variables = {\n entry,\n locale,\n };\n return buildTemplate({ template: pattern, context: variables });\n};\nfunction getValue(obj, path) {\n return path\n .replace(/\\[/g, '.')\n .replace(/\\]/g, '')\n .split('.')\n .reduce((o, k) => (o || {})[k], obj);\n}\nfunction addLocale(str, locale) {\n const fieldsIndicator = 'fields';\n const fieldsIndex = str.indexOf(fieldsIndicator);\n if (fieldsIndex !== -1) {\n const dotIndex = str.indexOf('.', fieldsIndex + fieldsIndicator.length + 1); // +1 for '.'\n if (dotIndex !== -1) {\n return str.slice(0, dotIndex + 1) + locale + '.' + str.slice(dotIndex + 1);\n }\n }\n return str;\n}\nfunction getTemplateValue(ctx, path) {\n const pathWithLocale = addLocale(path, ctx.locale);\n const retrievedValue = getValue(ctx, pathWithLocale);\n return typeof retrievedValue === 'object' && retrievedValue !== null\n ? retrievedValue[ctx.locale]\n : retrievedValue;\n}\nfunction buildTemplate({ template, context, }) {\n const localeVariable = /{\\s*locale\\s*}/g;\n // e.g. \"{ page.sys.id }\"\n const variables = /{\\s*([\\S]+?)\\s*}/g;\n return (template\n // first replace the locale pattern\n .replace(localeVariable, context.locale)\n // then resolve the remaining variables\n .replace(variables, (_, path) => {\n const fallback = path + '_NOT_FOUND';\n const value = getTemplateValue(context, path) ?? fallback;\n // using _.result didn't gave proper results so we run our own version of it\n return String(typeof value === 'function' ? value() : value);\n }));\n}\n\nconst stylesToKeep = ['cfImageAsset'];\nconst stylesToRemove = CF_STYLE_ATTRIBUTES.filter((style) => !stylesToKeep.includes(style));\n// cfWrapColumns & cfWrapColumnsCount are no real style attributes as they are handled on the editor side\nconst propsToRemove = ['cfSsrClassName', 'cfWrapColumns', 'cfWrapColumnsCount'];\nconst sanitizeNodeProps = (nodeProps) => {\n const keysToRemove = [...stylesToRemove, ...propsToRemove];\n const sanitizedProps = Object.fromEntries(Object.entries(nodeProps).filter(([key]) => !keysToRemove.includes(key)));\n return sanitizedProps;\n};\n\n/** Turn the visibility value into a style object that can be used for inline styles in React */\nconst transformVisibility = (value) => {\n if (value === false) {\n return {\n display: 'none !important',\n };\n }\n // Don't explicitly set anything when visible to not overwrite values like `grid` or `flex`.\n return {};\n};\nconst transformGridColumn = (span) => {\n if (!span) {\n return {};\n }\n return {\n gridColumn: `span ${span}`,\n };\n};\nconst transformBorderStyle = (value) => {\n if (!value)\n return {};\n const parts = value.split(' ');\n // Just accept the passed value\n if (parts.length < 3)\n return { border: value };\n const [borderSize, borderStyle, ...borderColorParts] = parts;\n const borderColor = borderColorParts.join(' ');\n return {\n border: `${borderSize} ${borderStyle} ${borderColor}`,\n };\n};\nconst transformAlignment = (cfHorizontalAlignment, cfVerticalAlignment, cfFlexDirection = 'column') => cfFlexDirection === 'row'\n ? {\n alignItems: cfHorizontalAlignment,\n justifyContent: cfVerticalAlignment === 'center' ? `safe ${cfVerticalAlignment}` : cfVerticalAlignment,\n }\n : {\n alignItems: cfVerticalAlignment,\n justifyContent: cfHorizontalAlignment === 'center'\n ? `safe ${cfHorizontalAlignment}`\n : cfHorizontalAlignment,\n };\nconst transformBackgroundImage = (cfBackgroundImageUrl, cfBackgroundImageOptions) => {\n const matchBackgroundSize = (scaling) => {\n if ('fill' === scaling)\n return 'cover';\n if ('fit' === scaling)\n return 'contain';\n };\n const matchBackgroundPosition = (alignment) => {\n if (!alignment || 'string' !== typeof alignment) {\n return;\n }\n let [horizontalAlignment, verticalAlignment] = alignment.trim().split(/\\s+/, 2);\n const isHorizontalValid = ['left', 'right', 'center'].includes(horizontalAlignment);\n const isVerticalValid = ['top', 'bottom', 'center'].includes(verticalAlignment);\n horizontalAlignment = isHorizontalValid ? horizontalAlignment : 'left';\n verticalAlignment = isVerticalValid ? verticalAlignment : 'top';\n return `${horizontalAlignment} ${verticalAlignment}`;\n };\n if (!cfBackgroundImageUrl) {\n return;\n }\n let backgroundImage;\n let backgroundImageSet;\n if (typeof cfBackgroundImageUrl === 'string') {\n backgroundImage = `url(${cfBackgroundImageUrl})`;\n }\n else {\n const imgSet = cfBackgroundImageUrl.srcSet?.join(',');\n backgroundImage = `url(${cfBackgroundImageUrl.url})`;\n backgroundImageSet = `image-set(${imgSet})`;\n }\n return {\n backgroundImage,\n backgroundImage2: backgroundImageSet,\n backgroundRepeat: cfBackgroundImageOptions?.scaling === 'tile' ? 'repeat' : 'no-repeat',\n backgroundPosition: matchBackgroundPosition(cfBackgroundImageOptions?.alignment),\n backgroundSize: matchBackgroundSize(cfBackgroundImageOptions?.scaling),\n };\n};\nconst transformTextAlign = (value) => {\n if (!value)\n return undefined;\n const sdkOptions = getSdkOptions();\n // New behavior: translate left/right to start/end\n // Customer can opt out by activating this global option toggle\n if (!sdkOptions.__disableTextAlignmentTransform) {\n if (value === 'left')\n return 'start';\n if (value === 'right')\n return 'end';\n }\n return value;\n};\n\nconst toCSSAttribute = (key) => {\n let val = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());\n // Remove the number from the end of the key to allow for overrides on style properties\n val = val.replace(/\\d+$/, '');\n return val;\n};\n/**\n * Turns a list of CSSProperties into a joined CSS string that can be\n * used for <style> tags. Per default it creates a minimized version.\n * For editor mode, use the `useWhitespaces` flag to create a more readable version.\n *\n * @param cssProperties list of CSS properties\n * @param useWhitespaces adds whitespaces and newlines between each rule\n * @returns a string of CSS rules\n */\nconst stringifyCssProperties = (cssProperties, useWhitespaces = false) => {\n const rules = Object.entries(cssProperties)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => useWhitespaces ? `${toCSSAttribute(key)}: ${value};` : `${toCSSAttribute(key)}:${value};`);\n return rules.join(useWhitespaces ? '\\n' : '');\n};\nconst buildStyleTag = ({ styles, nodeId }) => {\n const generatedStyles = stringifyCssProperties(styles, true);\n const className = `cfstyles-${nodeId ? nodeId : md5(generatedStyles)}`;\n const styleRule = `.${className}{ ${generatedStyles} }`;\n return [className, styleRule];\n};\n/**\n * Takes plain design values and transforms them into CSS properties. Undefined values will\n * be filtered out.\n *\n * **Example Input**\n * ```\n * values = {\n * cfVisibility: 'visible',\n * cfMargin: '10px',\n * cfFlexReverse: true,\n * cfImageOptions: { objectFit: 'cover' },\n * // ...\n * }\n * ```\n * **Example Output**\n * ```\n * cssProperties = {\n * margin: '10px',\n * flexDirection: 'row-reverse',\n * objectFit: 'cover',\n * // ...\n * }\n * ```\n */\nconst buildCfStyles = (values) => {\n const cssProperties = {\n margin: values.cfMargin,\n padding: values.cfPadding,\n backgroundColor: values.cfBackgroundColor,\n width: values.cfWidth || values.cfImageOptions?.width,\n height: values.cfHeight || values.cfImageOptions?.height,\n maxWidth: values.cfMaxWidth,\n ...transformGridColumn(values.cfColumnSpan),\n ...transformBorderStyle(values.cfBorder),\n borderRadius: values.cfBorderRadius,\n gap: values.cfGap,\n ...transformAlignment(values.cfHorizontalAlignment, values.cfVerticalAlignment, values.cfFlexDirection),\n flexDirection: values.cfFlexReverse && values.cfFlexDirection\n ? `${values.cfFlexDirection}-reverse`\n : values.cfFlexDirection,\n flexWrap: values.cfFlexWrap,\n ...transformBackgroundImage(values.cfBackgroundImageUrl, values.cfBackgroundImageOptions),\n fontSize: values.cfFontSize,\n fontWeight: values.cfTextBold ? 'bold' : values.cfFontWeight,\n fontStyle: values.cfTextItalic ? 'italic' : undefined,\n textDecoration: values.cfTextUnderline ? 'underline' : undefined,\n lineHeight: values.cfLineHeight,\n letterSpacing: values.cfLetterSpacing,\n color: values.cfTextColor,\n textAlign: transformTextAlign(values.cfTextAlign),\n textTransform: values.cfTextTransform,\n objectFit: values.cfImageOptions?.objectFit,\n objectPosition: values.cfImageOptions?.objectPosition,\n };\n const cssPropertiesWithoutUndefined = Object.fromEntries(Object.entries(cssProperties).filter(([, value]) => value !== undefined));\n return cssPropertiesWithoutUndefined;\n};\n/**\n * **Only meant to be used in editor mode!**\n *\n * If the node is an empty structure component with a relative height (e.g. '100%'),\n * it might render with a zero height. In this case, add a min height of 80px to ensure\n * that child nodes can be added via drag & drop.\n */\nconst addMinHeightForEmptyStructures = (cssProperties, node) => {\n if (!node.children.length &&\n isStructureWithRelativeHeight(node.definitionId, cssProperties.height)) {\n return {\n ...cssProperties,\n minHeight: EMPTY_CONTAINER_SIZE,\n };\n }\n return cssProperties;\n};\n/**\n * Container/section default behavior:\n * Default height => height: EMPTY_CONTAINER_SIZE\n * If a container component has children => height: 'fit-content'\n */\nconst calculateNodeDefaultHeight = ({ blockId, children, value, }) => {\n if (!blockId || !isContentfulStructureComponent(blockId) || value !== 'auto') {\n return value;\n }\n if (children.length) {\n return '100%';\n }\n return EMPTY_CONTAINER_SIZE;\n};\n\nconst getDataFromTree = (tree) => {\n let dataSource = {};\n let unboundValues = {};\n const queue = [...tree.root.children];\n while (queue.length) {\n const node = queue.shift();\n if (!node) {\n continue;\n }\n dataSource = { ...dataSource, ...node.data.dataSource };\n unboundValues = { ...unboundValues, ...node.data.unboundValues };\n if (node.children.length) {\n queue.push(...node.children);\n }\n }\n return {\n dataSource,\n unboundValues,\n };\n};\nconst generateRandomId = (letterCount) => {\n const LETTERS = 'abcdefghijklmnopqvwxyzABCDEFGHIJKLMNOPQVWXYZ';\n const NUMS = '0123456789';\n const ALNUM = NUMS + LETTERS;\n const times = (n, callback) => Array.from({ length: n }, callback);\n const random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;\n return times(letterCount, () => ALNUM[random(0, ALNUM.length - 1)]).join('');\n};\nconst checkIsAssemblyNode = ({ componentId, usedComponents, }) => {\n if (!usedComponents?.length)\n return false;\n return usedComponents.some((usedComponent) => usedComponent.sys.id === componentId);\n};\n/**\n * This check assumes that the entry is already ensured to be an experience, i.e. the\n * content type of the entry is an experience type with the necessary annotations.\n **/\nconst checkIsAssemblyEntry = (entry) => {\n return Boolean(entry.fields?.componentSettings);\n};\nconst checkIsAssemblyDefinition = (component) => component?.category === ASSEMBLY_DEFAULT_CATEGORY;\nfunction parseCSSValue(input) {\n const regex = /^(\\d+(\\.\\d+)?)(px|em|rem)$/;\n const match = input.match(regex);\n if (match) {\n return {\n value: parseFloat(match[1]),\n unit: match[3],\n };\n }\n return null;\n}\nfunction getTargetValueInPixels(targetWidthObject) {\n switch (targetWidthObject.unit) {\n case 'px':\n return targetWidthObject.value;\n case 'em':\n return targetWidthObject.value * 16;\n case 'rem':\n return targetWidthObject.value * 16;\n default:\n return targetWidthObject.value;\n }\n}\n/**\n * Creates a component definition for an assembly. As all assemblies use the same definition in the SDK,\n * all should be registered via this function.\n */\nconst createAssemblyDefinition = (definitionId) => {\n return {\n id: definitionId,\n name: 'Component',\n variables: {},\n children: true,\n category: ASSEMBLY_DEFAULT_CATEGORY,\n };\n};\n\n/**\n * Turns a condition like `<768px` or `>1024px` into a media query rule.\n * For example, `<768px` becomes `max-width:768px` and `>1024px` becomes `min-width:1024px`.\n */\nconst toMediaQueryRule = (condition) => {\n const [evaluation, pixelValue] = [condition[0], condition.substring(1)];\n const mediaQueryRule = evaluation === '<' ? 'max-width' : 'min-width';\n return `(${mediaQueryRule}:${pixelValue})`;\n};\n/**\n * Converts a map of class names to CSS strings into a single CSS string.\n *\n * @param cssByClassName map of class names to CSS strings containing all rules for each class\n * @returns joined string of all CSS class definitions\n */\nconst toCompoundCss = (cssByClassName) => {\n return Object.entries(cssByClassName).reduce((acc, [className, css]) => {\n if (css === '')\n return acc;\n return `${acc}.${className}{${css}}`;\n }, ``);\n};\n/**\n * Create a single CSS string containing all class definitions for a given media query.\n *\n * @param cssByClassName map of class names to CSS strings containing all rules for each class\n * @param condition e.g. \"*\", \"<520px\", \">520px\"\n * @param nextCondition optional next condition to create a disjunct media query that doesn't affect the next breakpoint\n * @returns joined string of all CSS class definitions wrapped into media queries\n */\nconst toMediaQuery = ({ cssByClassName, condition, nextCondition, }) => {\n const compoundCss = toCompoundCss(cssByClassName);\n if (compoundCss === '') {\n return '';\n }\n const queryRule = toMediaQueryRule(condition);\n if (!nextCondition) {\n if (condition === '*') {\n return compoundCss;\n }\n return `@media${queryRule}{${compoundCss}}`;\n }\n const nextRule = toMediaQueryRule(nextCondition);\n if (condition === '*') {\n return `@media not ${nextRule}{${compoundCss}}`;\n }\n return `@media${queryRule} and (not ${nextRule}){${compoundCss}}`;\n};\n\nfunction getOptimizedImageUrl(url, width, quality, format) {\n if (url.startsWith('//')) {\n url = 'https:' + url;\n }\n const params = new URLSearchParams();\n if (width) {\n params.append('w', width.toString());\n }\n if (quality && quality > 0 && quality < 100) {\n params.append('q', quality.toString());\n }\n if (format) {\n params.append('fm', format);\n }\n const queryString = params.toString();\n return `${url}${queryString ? '?' + queryString : ''}`;\n}\n\nfunction validateParams(file, quality, format) {\n if (!file.details.image) {\n throw Error('No image in file asset to transform');\n }\n if (quality < 0 || quality > 100) {\n throw Error('Quality must be between 0 and 100');\n }\n if (format && !SUPPORTED_IMAGE_FORMATS.includes(format)) {\n throw Error(`Format must be one of ${SUPPORTED_IMAGE_FORMATS.join(', ')}`);\n }\n return true;\n}\n\nconst MAX_WIDTH_ALLOWED$1 = 2000;\nconst getOptimizedBackgroundImageAsset = (file, widthStyle, quality = '100%', format) => {\n const qualityNumber = Number(quality.replace('%', ''));\n if (!validateParams(file, qualityNumber, format)) ;\n if (!validateParams(file, qualityNumber, format)) ;\n const url = file.url;\n const { width1x, width2x } = getWidths(widthStyle, file);\n const imageUrl1x = getOptimizedImageUrl(url, width1x, qualityNumber, format);\n const imageUrl2x = getOptimizedImageUrl(url, width2x, qualityNumber, format);\n const srcSet = [`url(${imageUrl1x}) 1x`, `url(${imageUrl2x}) 2x`];\n const returnedUrl = getOptimizedImageUrl(url, width2x, qualityNumber, format);\n const optimizedBackgroundImageAsset = {\n url: returnedUrl,\n srcSet,\n file,\n };\n return optimizedBackgroundImageAsset;\n function getWidths(widthStyle, file) {\n let width1x = 0;\n let width2x = 0;\n const intrinsicImageWidth = file.details.image.width;\n if (widthStyle.endsWith('px')) {\n width1x = Math.min(Number(widthStyle.replace('px', '')), intrinsicImageWidth);\n }\n else {\n width1x = Math.min(MAX_WIDTH_ALLOWED$1, intrinsicImageWidth);\n }\n width2x = Math.min(width1x * 2, intrinsicImageWidth);\n return { width1x, width2x };\n }\n};\n\nconst detachExperienceStyles = (experience) => {\n const experienceTreeRoot = experience.entityStore?.experienceEntryFields\n ?.componentTree;\n if (!experienceTreeRoot) {\n return;\n }\n const isRenderingAPatternEntry = experience.entityStore?.isExperienceAPatternEntry;\n const mapOfDesignVariableKeys = flattenDesignTokenRegistry(designTokensRegistry);\n // getting breakpoints from the entry componentTree field\n const { breakpoints } = experienceTreeRoot;\n // creating the structure which I thought would work best for aggregation\n const mediaQueryDataByBreakpoint = breakpoints.reduce((mediaQueryTemplate, breakpoint) => ({\n ...mediaQueryTemplate,\n [breakpoint.id]: {\n condition: breakpoint.query,\n cssByClassName: {},\n visibilityCssByClassName: {},\n },\n }), {});\n // getting the breakpoint ids\n const breakpointIds = Object.keys(mediaQueryDataByBreakpoint);\n const iterateOverTreeAndExtractStyles = ({ componentTree, dataSource, unboundValues, componentSettings, componentVariablesOverwrites, patternWrapper, wrappingPatternIds, wrappingPatternNodeIds = isRenderingAPatternEntry ? ['root'] : [], }) => {\n // traversing the tree\n const queue = [];\n queue.push(...componentTree.children);\n // for each tree node\n while (queue.length) {\n const currentNode = queue.shift();\n if (!currentNode) {\n break;\n }\n const usedComponents = experience.entityStore?.usedComponents ?? [];\n const isPatternNode = checkIsAssemblyNode({\n componentId: currentNode.definitionId,\n usedComponents,\n });\n if (isPatternNode) {\n // When detecting a circular dependency among patterns, stop to avoid an infinite loop\n if (wrappingPatternIds.has(currentNode.definitionId)) {\n continue;\n }\n const patternEntry = usedComponents.find((component) => component.sys.id === currentNode.definitionId);\n if (!patternEntry || !('fields' in patternEntry)) {\n continue;\n }\n const nextComponentVariablesOverwrites = resolveComponentVariablesOverwrites({\n patternNode: currentNode,\n wrapperComponentVariablesOverwrites: componentVariablesOverwrites,\n wrapperComponentSettings: componentSettings,\n });\n // the node of a used pattern contains only the definitionId (id of the patter entry)\n // as well as the variables overwrites\n // the layout of a pattern is stored in it's entry\n iterateOverTreeAndExtractStyles({\n // that is why we pass it here to iterate of the pattern tree\n componentTree: patternEntry.fields.componentTree,\n // but we pass the data source of the experience entry cause that's where the binding is stored\n dataSource,\n // unbound values of a pattern store the default values of pattern variables\n unboundValues: patternEntry.fields.unboundValues,\n // this is where we can map the pattern variable to it's default value\n componentSettings: patternEntry.fields.componentSettings,\n // and this is where the over-writes for the default values are stored\n // yes, I know, it's a bit confusing\n componentVariablesOverwrites: nextComponentVariablesOverwrites,\n // pass top-level pattern node to store instance-specific child styles for rendering\n patternWrapper: currentNode,\n wrappingPatternIds: new Set([...wrappingPatternIds, currentNode.definitionId]),\n wrappingPatternNodeIds: [...wrappingPatternNodeIds, currentNode.id || ''],\n });\n continue;\n }\n /* [Data format] `currentNode.variables` uses the following serialized shape:\n * {\n * cfMargin: { type: 'DesignValue', valuesByBreakpoint: { desktop: '1px', tablet: '2px' } },\n * cfPadding: { type: 'DesignValue', valuesByBreakpoint: { desktop: '3px' } }\n * cfBackgroundImageUrl: { type: 'BoundValue', path: '/lUERH7tX7nJTaPX6f0udB/fields/assetReference/~locale/fields/file/~locale' }\n * asdf1234: { type: 'ComponentValue', key: 'qwer567' }\n * // ...\n * }\n */\n // so first, I convert it into a map to help me make it easier to access the values\n const propsByBreakpoint = indexByBreakpoint({\n variables: currentNode.variables,\n breakpointIds,\n unboundValues: unboundValues,\n dataSource: dataSource,\n componentSettings,\n componentVariablesOverwrites,\n getBoundEntityById: (id) => {\n return experience.entityStore?.entities.find((entity) => entity.sys.id === id);\n },\n });\n // When the node is hidden for any breakpoint, we need to handle this separately with a disjunct media query.\n const isAnyVisibilityValueHidden = Object.values(propsByBreakpoint).some((designProperties) => designProperties.cfVisibility === false);\n // We always need an explicit value when using disjunct media queries\n // Example: desktop uses \"false\" and tablet is undefined -> we need to set `display: none` for tablet as well.\n let previousVisibilityValue = undefined;\n /* [Data format] `propsByBreakpoint` is a map of \"breakpointId > propertyName > plainValue\":\n * {\n * desktop: {\n * cfMargin: '1px',\n * cfWidth: '100%',\n * cfBackgroundImageUrl: 'https://example.com/image.jpg'\n * //...\n * }\n * }\n */\n const currentNodeClassNames = [];\n // Chain IDs to avoid overwriting styles across multiple instances of the same pattern\n // e.g. `{outerPatternNodeId}{innerPatternNodeId}-{currentNodeId}`\n // (!) Notice that the chain of patterns (before the dash) follows the format of prebinding/ parameters\n const currentNodeIdsChain = [...wrappingPatternNodeIds, currentNode.id].join('-');\n // For each breakpoint, resolve design tokens, create the CSS and generate a unique className.\n for (const breakpointId of breakpointIds) {\n const propsByBreakpointWithResolvedDesignTokens = Object.entries(propsByBreakpoint[breakpointId]).reduce((acc, [variableName, variableValue]) => {\n return {\n ...acc,\n [variableName]: maybePopulateDesignTokenValue(variableName, variableValue, mapOfDesignVariableKeys),\n };\n }, {});\n // Convert CF-specific property names to CSS variables, e.g. `cfMargin` -> `margin`\n const cfStyles = buildCfStyles(propsByBreakpointWithResolvedDesignTokens);\n /* [Data format] `cfStyles` is a list of CSSProperties (React format):\n * {\n * margin: '1px',\n * width: '100%',\n * backgroundImage: 'url(https://example.com/image.jpg)'\n * //...\n * }\n */\n const generatedCss = stringifyCssProperties(cfStyles);\n if (!generatedCss && !isAnyVisibilityValueHidden) {\n // If there are no styles to apply, skip this breakpoint completely including the class name\n continue;\n }\n /* [Data format] `generatedCss` is the minimized CSS string that will be added to the DOM:\n * generatedCss = \"margin: 1px;width: 100%;...\"\n */\n // - Adding breakpointId to ensure not using the same IDs between breakpoints as this leads to\n // conflicts between different breakpoint values from multiple nodes where the hash would be equal\n // - Adding wrapping pattern nodes IDs to avoid conflicts between similar nested patterns as those\n // could override each others CSS for some breakpoints just through the order of `<style>` tags in the DOM.\n const styleHash = md5(currentNodeIdsChain + breakpointId + generatedCss);\n // and prefix the className to make sure the value can be processed\n const className = `cf-${styleHash}`;\n // I save the generated hashes into an array to later save it in the tree node\n // as cfSsrClassName prop\n // making sure to avoid the duplicates in case styles for > 1 breakpoints are the same\n if (!currentNodeClassNames.includes(className)) {\n currentNodeClassNames.push(className);\n }\n // Only if the hash was not used yet, save the CSS to the stylesheet\n if (!mediaQueryDataByBreakpoint[breakpointId].cssByClassName[className]) {\n mediaQueryDataByBreakpoint[breakpointId].cssByClassName[className] = generatedCss;\n }\n // Special case for visibility to override any custom `display` values but only for a specific breakpoint.\n if (isAnyVisibilityValueHidden) {\n const visibilityValue = propsByBreakpointWithResolvedDesignTokens.cfVisibility ?? previousVisibilityValue;\n previousVisibilityValue = visibilityValue;\n const visibilityStyles = transformVisibility(visibilityValue);\n const visibilityCss = stringifyCssProperties(visibilityStyles);\n if (!mediaQueryDataByBreakpoint[breakpointId].visibilityCssByClassName[className]) {\n mediaQueryDataByBreakpoint[breakpointId].visibilityCssByClassName[className] =\n visibilityCss;\n }\n }\n }\n // all generated classNames are saved in the tree node\n // to be handled by the sdk later\n // each node will get N classNames, where N is the number of breakpoints\n // browsers process classNames in the order they are defined\n // meaning that in case of className1 className2 className3\n // className3 will win over className2 and className1\n // making sure that we respect the order of breakpoints from\n // we can achieve \"desktop first\" or \"mobile first\" approach to style over-writes\n if (patternWrapper) {\n // @ts-expect-error -- valueByBreakpoint is not explicitly defined, but it's already defined in the patternWrapper styles\n patternWrapper.variables.cfSsrClassName = {\n ...(patternWrapper.variables.cfSsrClassName ?? {}),\n type: 'DesignValue',\n [currentNodeIdsChain]: {\n valuesByBreakpoint: {\n [breakpointIds[0]]: currentNodeClassNames.join(' '),\n },\n },\n };\n }\n else {\n currentNode.variables.cfSsrClassName = {\n type: 'DesignValue',\n valuesByBreakpoint: {\n [breakpointIds[0]]: currentNodeClassNames.join(' '),\n },\n };\n }\n queue.push(...currentNode.children);\n }\n };\n iterateOverTreeAndExtractStyles({\n componentTree: experienceTreeRoot,\n dataSource: experience.entityStore?.dataSource ?? {},\n unboundValues: experience.entityStore?.unboundValues ?? {},\n componentSettings: experience.entityStore?.experienceEntryFields?.componentSettings,\n wrappingPatternIds: new Set(experience.entityStore?.experienceEntryId ? [experience.entityStore.experienceEntryId] : []),\n });\n // once the whole tree was traversed, for each breakpoint, I aggregate the styles\n // for each generated className into one css string\n return Object.values(mediaQueryDataByBreakpoint).reduce((acc, { condition, cssByClassName, visibilityCssByClassName }, index) => {\n const mediaQueryCss = toMediaQuery({ cssByClassName, condition });\n // Handle visibility separately to use disjunct media queries (\"if desktop but not tablet ...\")\n // Enables to hide on one breakpoint but render any unknown custom `display` value on another breakpoint.\n const visibilityMediaQueryCss = toMediaQuery({\n cssByClassName: visibilityCssByClassName,\n condition,\n // Breakpoint validation ensures that it starts with the '*' breakpoint\n nextCondition: Object.values(mediaQueryDataByBreakpoint)[index + 1]?.condition,\n });\n return `${acc}${mediaQueryCss}${visibilityMediaQueryCss}`;\n }, '');\n};\n/**\n * Rendering pattern nodes inside pattern entry by injecting default values from the top:\n * When there is a ComponentValue but the recursive logic is not wrapped by a pattern node (no `componentVariablesOverwrites`),\n * a pattern entry is rendered directly. In this case, we replace each ComponentValue with the default value from componentSettings.\n */\nconst injectDefaultValuesForComponentValues = ({ patternNode, wrapperComponentSettings, }) => {\n const propertyDefinitions = wrapperComponentSettings?.variableDefinitions;\n return Object.entries(patternNode.variables).reduce((resolvedProperties, [propertyName, propertyValue]) => {\n if (propertyValue.type === 'ComponentValue') {\n const componentValueKey = propertyValue.key;\n const componentDefaultValue = propertyDefinitions?.[componentValueKey].defaultValue;\n // We're only considering design properties for styles generation\n if (componentDefaultValue?.type === 'DesignValue') {\n resolvedProperties[propertyName] = componentDefaultValue;\n }\n }\n else {\n // Do nothing when it's not a ComponentValue & just keep the defined value\n resolvedProperties[propertyName] = propertyValue;\n }\n return resolvedProperties;\n }, {});\n};\n/**\n * In case of nested patterns, we need to resolve the ComponentValue properties and overwrite them with the value\n * stored in the parent component.\n *\n *\n * @param patternNode - pattern node which contains the variables\n * @param componentVariablesOverwrites - object which contains the variables of the parent component\n */\nconst resolveComponentVariablesOverwrites = ({ patternNode, wrapperComponentVariablesOverwrites, wrapperComponentSettings, }) => {\n // In case of rendering a pattern entry, there are no custom ComponentValues.\n // So we pass down the default values from this pattern node down to each deeper pattern level.\n if (!wrapperComponentVariablesOverwrites) {\n return injectDefaultValuesForComponentValues({\n patternNode,\n wrapperComponentSettings,\n });\n }\n // Rendering (nested) pattern node inside another pattern node (for both experience & pattern entry):\n // The `wrapperComponentVariablesOverwrites` from the top-most pattern node is passed through to each child\n // node (and nested pattern nodes). It replaces each ComponentValue in the subtree with either the overwrite\n // or the default value.\n return Object.entries(patternNode?.variables).reduce((resolvedValues, [propertyName, propertyValue]) => {\n if (propertyValue.type === 'ComponentValue') {\n // Copying the values from the parent node\n const overwritingValue = wrapperComponentVariablesOverwrites?.[propertyValue.key];\n // Property definition from the parent pattern\n const propertyDefinition = wrapperComponentSettings?.variableDefinitions?.[propertyValue.key];\n const defaultValue = propertyDefinition?.defaultValue;\n // The overwriting value is either a custom value from the experience or default value from a\n // wrapping pattern node that got trickled down to this nesting level.\n resolvedValues[propertyName] = mergeDefaultAndOverwriteValues(defaultValue, overwritingValue);\n }\n else {\n // Keep raw values\n resolvedValues[propertyName] = propertyValue;\n }\n return resolvedValues;\n }, {});\n};\nconst isCfStyleAttribute = (variableName) => {\n return CF_STYLE_ATTRIBUTES.includes(variableName);\n};\nconst maybePopulateDesignTokenValue = (variableName, variableValue, mapOfDesignVariableKeys) => {\n // TODO: refactor to reuse fn from core package\n if (typeof variableValue !== 'string') {\n return variableValue;\n }\n if (!isCfStyleAttribute(variableName)) {\n return variableValue;\n }\n // matches ${...} and captures the content between ${ and }\n // ${color.Blue}, ${spacing.Sizes.Large} or ${border.Text Heading.Small}\n const templateStringRegex = /\\$\\{(\\w[^}]*)}/g;\n const result = variableValue\n .replace(templateStringRegex, (_, rawKey) => {\n const value = mapOfDesignVariableKeys[rawKey];\n if (!value) {\n if (builtInStyles[variableName]?.defaultValue) {\n return String(builtInStyles[variableName].defaultValue);\n }\n if (optionalBuiltInStyles[variableName]?.defaultValue) {\n return String(optionalBuiltInStyles[variableName].defaultValue);\n }\n return '0px';\n }\n if (variableName === 'cfBorder' || variableName.startsWith('cfBorder_')) {\n if (typeof value === 'object') {\n const { width, style, color } = value;\n return `${width} ${style} ${color}`;\n }\n }\n return String(value);\n })\n // Replace all multiple spaces with a single space\n .replace(/ +/g, ' ');\n return result;\n};\nconst transformMedia$1 = (boundAsset, width, options) => {\n try {\n const asset = boundAsset;\n // Target width (px/rem/em) will be applied to the css url if it's lower than the original image width (in px)\n const assetDetails = asset.fields.file?.details;\n const assetWidth = assetDetails?.image?.width || 0; // This is always in px\n if (!options) {\n return asset.fields.file?.url;\n }\n const targetWidthObject = parseCSSValue(options.targetSize); // Contains value and unit (px/rem/em) so convert and then compare to assetWidth\n const targetValue = targetWidthObject ? getTargetValueInPixels(targetWidthObject) : assetWidth;\n if (targetValue < assetWidth)\n width = `${targetValue}px`;\n return getOptimizedBackgroundImageAsset(asset.fields.file, width, options.quality, options.format);\n }\n catch (error) {\n debug.error('[experiences-core::ssrStyles] Error transforming image asset', error);\n }\n return boundAsset.fields.file?.url;\n};\nconst resolveBackgroundImageBinding = ({ variableData, getBoundEntityById, dataSource = {}, unboundValues = {}, componentVariablesOverwrites, componentSettings = { variableDefinitions: {} }, options, width, }) => {\n if (variableData.type === 'UnboundValue') {\n const uuid = variableData.key;\n return unboundValues[uuid]?.value;\n }\n if (variableData.type === 'ComponentValue') {\n const variableDefinitionKey = variableData.key;\n const variableDefinition = componentSettings.variableDefinitions[variableDefinitionKey];\n // @ts-expect-error TODO: Types coming from validations erroneously assume that `defaultValue` can be a primitive value (e.g. string or number)\n const defaultValueKey = variableDefinition.defaultValue?.key;\n const defaultValue = unboundValues[defaultValueKey].value;\n const overwriteValue = componentVariablesOverwrites?.[variableDefinitionKey];\n // overwriteValue is a ComponentValue we can safely return the default value\n if (!overwriteValue || overwriteValue.type === 'ComponentValue') {\n return defaultValue;\n }\n // at this point overwriteValue will either be type of 'DesignValue' or 'BoundValue'\n // so we recursively run resolution again to resolve it\n const resolvedValue = resolveBackgroundImageBinding({\n variableData: overwriteValue,\n getBoundEntityById,\n dataSource,\n unboundValues,\n componentVariablesOverwrites,\n componentSettings,\n options,\n width,\n });\n return resolvedValue || defaultValue;\n }\n if (variableData.type === 'BoundValue') {\n // '/lUERH7tX7nJTaPX6f0udB/fields/assetReference/~locale/fields/file/~locale'\n const [, uuid] = variableData.path.split('/');\n const binding = dataSource[uuid];\n const boundEntity = getBoundEntityById(binding.sys.id);\n if (!boundEntity) {\n return;\n }\n if (boundEntity.sys.type === 'Asset') {\n return transformMedia$1(boundEntity, width, options);\n }\n else {\n // '/lUERH7tX7nJTaPX6f0udB/fields/assetReference/~locale/fields/file/~locale'\n // becomes\n // '/fields/assetReference/~locale/fields/file/~locale'\n const pathWithoutUUID = variableData.path.split(uuid)[1];\n // '/fields/assetReference/~locale/fields/file/~locale'\n // becomes\n // '/fields/assetReference/'\n const pathToReferencedAsset = pathWithoutUUID.split('~locale')[0];\n // '/fields/assetReference/'\n // becomes\n // '[fields, assetReference]'\n const [, fieldName] = pathToReferencedAsset.substring(1).split('/') ?? undefined;\n const referenceToAsset = boundEntity.fields[fieldName];\n if (!referenceToAsset) {\n return;\n }\n if (referenceToAsset.sys?.linkType === 'Asset') {\n const referencedAsset = getBoundEntityById(referenceToAsset.sys.id);\n if (!referencedAsset) {\n return;\n }\n return transformMedia$1(referencedAsset, width, options);\n }\n }\n }\n};\nconst resolveVariable = ({ variableData, defaultBreakpoint, componentSettings = { variableDefinitions: {} }, componentVariablesOverwrites, }) => {\n if (variableData?.type === 'DesignValue') {\n return variableData.valuesByBreakpoint[defaultBreakpoint] || {};\n }\n else if (variableData?.type === 'ComponentValue') {\n const variableDefinitionKey = variableData.key;\n const variableDefinition = componentSettings.variableDefinitions[variableDefinitionKey];\n const defaultValue = variableDefinition.defaultValue;\n const userSetValue = componentVariablesOverwrites?.[variableDefinitionKey];\n if (!userSetValue || userSetValue.type === 'ComponentValue') {\n return defaultValue?.valuesByBreakpoint[defaultBreakpoint] || '';\n }\n return resolveVariable({\n variableData: userSetValue,\n defaultBreakpoint,\n componentSettings,\n componentVariablesOverwrites,\n });\n }\n};\n/**\n * Takes the initial set of properties, filters only design properties that will be mapped to CSS and\n * re-organizes them to be indexed by breakpoint ID (\"breakpoint > variable > value\"). It will\n * also resolve the design/ component values to plain values.\n *\n * **Example Input**\n * ```\n * variables = {\n * cfMargin: { type: 'DesignValue', valuesByBreakpoint: { desktop: '1px', tablet: '2px' } },\n * cfPadding: { type: 'DesignValue', valuesByBreakpoint: { desktop: '3px', mobile: '4px' } }\n * }\n * ```\n *\n * **Example Output**\n * ```\n * variableValuesByBreakpoints = {\n * desktop: {\n * cfMargin: '1px',\n * cfPadding: '3px'\n * },\n * tablet: {\n * cfMargin: '2px'\n * },\n * mobile: {\n * cfPadding: '4px'\n * }\n * }\n * ```\n *\n * **Note**\n * - The property cfBackgroundImageUrl is the only content property that gets mapped to CSS as well.\n * It will be solely stored on the default breakpoint.\n * - For ComponentValues, it will either take the override from the pattern instance or fallback to\n * the defaultValue defined in variableDefinitions.\n */\nconst indexByBreakpoint = ({ variables, breakpointIds, getBoundEntityById, unboundValues = {}, dataSource = {}, componentVariablesOverwrites, componentSettings = { variableDefinitions: {} }, }) => {\n const variableValuesByBreakpoints = breakpointIds.reduce((acc, breakpointId) => {\n return {\n ...acc,\n [breakpointId]: {},\n };\n }, {});\n const defaultBreakpoint = breakpointIds[0];\n for (const [variableName, variableData] of Object.entries(variables)) {\n // handling the special case - cfBackgroundImageUrl variable, which can be bound or unbound\n // so, we need to resolve it here and pass it down as a css property to be converted into the CSS\n // I used .startsWith() cause it can be part of a pattern node\n if (variableName === 'cfBackgroundImageUrl' ||\n // TODO: Test this for nested patterns as the name might be just a random hash without the actual name (needs to be validated).\n variableName.startsWith('cfBackgroundImageUrl_')) {\n const width = resolveVariable({\n variableData: variables['cfWidth'],\n defaultBreakpoint,\n componentSettings,\n componentVariablesOverwrites,\n });\n const options = resolveVariable({\n variableData: variables['cfBackgroundImageOptions'],\n defaultBreakpoint,\n componentSettings,\n componentVariablesOverwrites,\n });\n if (!options) {\n debug.error('[experiences-core::ssrStyles] Error transforming image asset: Required variable [cfBackgroundImageOptions] missing from component definition');\n continue;\n }\n const imageUrl = resolveBackgroundImageBinding({\n variableData,\n getBoundEntityById,\n unboundValues,\n dataSource,\n componentSettings,\n componentVariablesOverwrites,\n width,\n options,\n });\n if (imageUrl) {\n variableValuesByBreakpoints[defaultBreakpoint][variableName] = imageUrl;\n }\n continue;\n }\n let resolvedVariableData = variableData;\n if (variableData.type === 'ComponentValue') {\n const variableDefinition = componentSettings?.variableDefinitions[variableData.key];\n const defaultValue = variableDefinition.defaultValue;\n if (variableDefinition.group === 'style' && defaultValue !== undefined) {\n const overwriteVariableData = componentVariablesOverwrites?.[variableData.key];\n resolvedVariableData = mergeDefaultAndOverwriteValues(defaultValue, overwriteVariableData);\n }\n }\n if (resolvedVariableData.type !== 'DesignValue') {\n continue;\n }\n for (const [breakpointId, variableValue] of Object.entries(resolvedVariableData.valuesByBreakpoint)) {\n if (!isValidBreakpointValue(variableValue)) {\n continue;\n }\n variableValuesByBreakpoints[breakpointId] = {\n ...variableValuesByBreakpoints[breakpointId],\n [variableName]: variableValue,\n };\n }\n }\n return variableValuesByBreakpoints;\n};\n/**\n * Flattens the object from\n * `{ color: { [key]: [value] } }`\n * to\n * `{ 'color.key': [value] }`\n */\nconst flattenDesignTokenRegistry = (designTokenRegistry) => {\n const flattenObject = (obj, prefix = '') => {\n return Object.entries(obj).reduce((acc, [key, value]) => {\n const newKey = prefix ? `${prefix}.${key}` : key;\n if (value &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n // handle border types\n !(typeof value === 'object' && ('width' in value || 'style' in value || 'color' in value))) {\n // Recursively flatten nested objects, but skip objects that look like border definitions\n return {\n ...acc,\n ...flattenObject(value, newKey),\n };\n }\n else {\n // This is a leaf value (string, number, or border object)\n return {\n ...acc,\n [newKey]: value,\n };\n }\n }, {});\n };\n return flattenObject(designTokenRegistry);\n};\nfunction mergeDefaultAndOverwriteValues(defaultValue, overwriteValue) {\n if (defaultValue?.type === 'DesignValue' && overwriteValue?.type === 'DesignValue') {\n return mergeDesignValuesByBreakpoint(defaultValue, overwriteValue);\n }\n return overwriteValue ?? defaultValue;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction get(obj, path) {\n if (!path.length) {\n return obj;\n }\n try {\n const [currentPath, ...nextPath] = path;\n return get(obj[currentPath], nextPath);\n }\n catch (err) {\n return undefined;\n }\n}\n\nconst getBoundValue = (entryOrAsset, path) => {\n const value = get(entryOrAsset, path.split('/').slice(2, -1));\n return value && typeof value == 'object' && value.url\n ? value.url\n : value;\n};\n\nconst transformRichText = (entryOrAsset, entityStore, path) => {\n const value = getBoundValue(entryOrAsset, path);\n if (typeof value === 'string') {\n return {\n data: {},\n content: [\n {\n nodeType: BLOCKS.PARAGRAPH,\n data: {},\n content: [\n {\n data: {},\n nodeType: 'text',\n value: value,\n marks: [],\n },\n ],\n },\n ],\n nodeType: BLOCKS.DOCUMENT,\n };\n }\n if (typeof value === 'object' && value.nodeType === BLOCKS.DOCUMENT) {\n // resolve any links to assets/entries/hyperlinks\n // we need to clone, as we want to keep the original Entity in the EntityStore intact,\n // and resolveLinks() is mutating the node object.\n const richTextDocument = cloneDeep(value);\n resolveLinks(richTextDocument, entityStore);\n return richTextDocument;\n }\n return undefined;\n};\nconst isLinkTarget = (node) => {\n return node?.data?.target?.sys?.type === 'Link';\n};\nconst resolveLinks = (node, entityStore) => {\n if (!node)\n return;\n // Resolve link if current node has one\n if (isLinkTarget(node)) {\n const entity = entityStore.getEntityFromLink(node.data.target);\n if (entity) {\n node.data.target = entity;\n }\n }\n // Process content array if it exists\n if ('content' in node && Array.isArray(node.content)) {\n node.content.forEach((childNode) => resolveLinks(childNode, entityStore));\n }\n};\n\nconst MAX_WIDTH_ALLOWED = 4000;\nconst getOptimizedImageAsset = ({ file, sizes, loading, quality = '100%', format, }) => {\n const qualityNumber = Number(quality.replace('%', ''));\n if (!validateParams(file, qualityNumber, format)) ;\n const url = file.url;\n const maxWidth = Math.min(file.details.image.width, MAX_WIDTH_ALLOWED);\n const numOfParts = Math.max(2, Math.ceil(maxWidth / 500));\n const widthParts = Array.from({ length: numOfParts }, (_, index) => Math.ceil((index + 1) * (maxWidth / numOfParts)));\n const srcSet = sizes\n ? widthParts.map((width) => `${getOptimizedImageUrl(url, width, qualityNumber, format)} ${width}w`)\n : [];\n const intrinsicImageWidth = file.details.image.width;\n if (intrinsicImageWidth > MAX_WIDTH_ALLOWED) {\n srcSet.push(`${getOptimizedImageUrl(url, undefined, qualityNumber, format)} ${intrinsicImageWidth}w`);\n }\n const returnedUrl = getOptimizedImageUrl(url, file.details.image.width > 2000 ? 2000 : undefined, qualityNumber, format);\n const optimizedImageAsset = {\n url: returnedUrl,\n srcSet,\n sizes,\n file,\n loading,\n };\n return optimizedImageAsset;\n};\n\nconst transformMedia = (asset, variables, resolveDesignValue, variableName, path) => {\n let value;\n // If it is not a deep path and not pointing to the file of the asset,\n // it is just pointing to a normal field and therefore we just resolve the value as normal field\n if (!isDeepPath(path) && !lastPathNamedSegmentEq(path, 'file')) {\n return getBoundValue(asset, path);\n }\n //TODO: this will be better served by injectable type transformers instead of if statement\n if (variableName === 'cfImageAsset') {\n const optionsVariableName = 'cfImageOptions';\n const options = resolveDesignValue(variables[optionsVariableName]?.type === 'DesignValue'\n ? variables[optionsVariableName].valuesByBreakpoint\n : {});\n if (!options) {\n debug.error(`[experiences-core::transformMedia] Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);\n return;\n }\n try {\n value = getOptimizedImageAsset({\n file: asset.fields.file,\n loading: options.loading,\n sizes: options.targetSize,\n quality: options.quality,\n format: options.format,\n });\n return value;\n }\n catch (error) {\n debug.error('[experiences-core::transformMedia] Error transforming image asset', error);\n }\n return;\n }\n if (variableName === 'cfBackgroundImageUrl') {\n let width = resolveDesignValue(variables['cfWidth']?.type === 'DesignValue' ? variables['cfWidth'].valuesByBreakpoint : {}, 'cfWidth') || '100%';\n const optionsVariableName = 'cfBackgroundImageOptions';\n const options = resolveDesignValue(variables[optionsVariableName]?.type === 'DesignValue'\n ? variables[optionsVariableName].valuesByBreakpoint\n : {});\n if (!options) {\n debug.error(`[experiences-core::transformMedia] Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);\n return;\n }\n try {\n // Target width (px/rem/em) will be applied to the css url if it's lower than the original image width (in px)\n const assetDetails = asset.fields.file?.details;\n const assetWidth = assetDetails?.image?.width || 0; // This is always in px\n const targetWidthObject = parseCSSValue(options.targetSize); // Contains value and unit (px/rem/em) so convert and then compare to assetWidth\n const targetValue = targetWidthObject\n ? getTargetValueInPixels(targetWidthObject)\n : assetWidth;\n if (targetValue < assetWidth)\n width = `${targetValue}px`;\n value = getOptimizedBackgroundImageAsset(asset.fields.file, width, options.quality, options.format);\n return value;\n }\n catch (error) {\n debug.error('[experiences-core::transformMedia] Error transforming image asset', error);\n }\n return;\n }\n return asset.fields.file?.url;\n};\n\nconst isExperienceEntry = (entry) => {\n return (entry?.sys?.type === 'Entry' &&\n !!entry.fields?.title &&\n !!entry.fields?.slug &&\n !!entry.fields?.componentTree &&\n Array.isArray(entry.fields.componentTree.breakpoints) &&\n Array.isArray(entry.fields.componentTree.children) &&\n typeof entry.fields.componentTree.schemaVersion === 'string');\n};\nconst isPatternEntry = (entry) => {\n return isExperienceEntry(entry) && !!entry.fields?.componentSettings; // signals that this is pattern (not experience) entry\n};\nconst isEntry = (value) => {\n return (null !== value &&\n typeof value === 'object' &&\n 'sys' in value &&\n value.sys?.type === 'Entry');\n};\nconst isAsset = (value) => {\n return (null !== value &&\n typeof value === 'object' &&\n 'sys' in value &&\n value.sys?.type === 'Asset');\n};\n/**\n * Checks if the values is an array of links.\n * Note: we use convention where empty arrays are considered valid \"arrays of links\"\n * as they don't contradict the type definition.\n */\nconst isArrayOfLinks = (value) => {\n return Array.isArray(value) && value.every((item) => isLink(item));\n};\n\nfunction getResolvedEntryFromLink(entryOrAsset, path, entityStore) {\n if (isAsset(entryOrAsset)) {\n return entryOrAsset;\n }\n else if (!isEntry(entryOrAsset)) {\n throw new Error(`Expected an Entry or Asset, but got: ${JSON.stringify(entryOrAsset)}`);\n }\n const fieldName = path.split('/').slice(2, -1);\n const value = get(entryOrAsset, fieldName);\n let resolvedEntity;\n if (isAsset(value) || isEntry(value)) {\n // In some cases, reference fields are already resolved\n resolvedEntity = value;\n }\n else if (value?.sys.type === 'Link') {\n // Look up the reference in the entity store\n resolvedEntity = entityStore.getEntityFromLink(value);\n }\n else {\n debug.warn(`[experiences-core::getResolvedEntryFromLink] When attempting to follow link in field '${fieldName}' of entity, the value is expected to be a link, but got: ${JSON.stringify(value)}`, { entity: entryOrAsset });\n return;\n }\n // no need to make structuredClone(entityStore.getEntityFromLink(value)) because\n // we provide component with the original Object.frozen object of the entity.\n // As we don't resolve L3 and don't mutate the entity before returning anymore,\n // we don't need to make a copy of the entity. And even provide better referential integrity\n // for the component for the same entity.\n if (!resolvedEntity) {\n return;\n }\n return resolvedEntity;\n}\n\nconst excludeUndefined = (value) => {\n return value !== undefined;\n};\nfunction getArrayValue(entryOrAsset, path, entityStore) {\n // NOTE: Not sure if we need this if-statement,\n // as it is NOT possible to bind to Array variable an Asset\n // (as Assets don't have multi-reference fields) unless it's a degenerate case.\n if (entryOrAsset.sys.type === 'Asset') {\n return entryOrAsset;\n }\n const fieldName = path.split('/').slice(2, -1);\n const arrayValue = get(entryOrAsset, fieldName);\n if (!Array.isArray(arrayValue)) {\n debug.warn(`[experiences-core::getArrayValue] A field '${fieldName}' of an entity was bound to an Array variable. Expected value of that field to be an array, but got: ${JSON.stringify(arrayValue)}`, { entity: entryOrAsset });\n return;\n }\n const result = arrayValue\n .map((value) => {\n if (typeof value === 'string') {\n return value; // handles case where Text array is bound (in [Content Model] tab of the platform, select Text and make it a list)\n }\n else if (value?.sys?.type === 'Link') {\n const resolvedEntity = entityStore.getEntityFromLink(value);\n if (!resolvedEntity) {\n // We return undefined, which means that entity wasn't availble in the Entity Store due to:\n // - because it's archived entity (and they normally wouldn't be sent to the Entity Store)\n // - bug where some entity wasn't added to the Entity Store\n // BTW, deleted entities shouldn't even be possible here as they require CT deletion first and that shouldn't allow us to load them at all)\n return;\n }\n return resolvedEntity;\n }\n else {\n debug.warn(`[experiences-core::getArrayValue] Expected value to be a string or Link, but got: ${JSON.stringify(value)}`);\n return undefined;\n }\n })\n .filter(excludeUndefined);\n // eg. imagine you have multi-referene field with 3 links to archived entries,\n // all of them will be undefined on previous step and will be filtered out\n // of resultWithoutUndefined. Instead of passing to component an empty array,\n // we pass undefined. This means that develloper making custom component\n // does not have to handle empty array case. But only undefiened, which signals:\n // user didn't bind anything; user bound to reference field which is unset; all references are archived\n return result.length > 0 ? result : undefined;\n}\n\nconst transformBoundContentValue = (variables, entityStore, binding, resolveDesignValue, variableName, variableType, path) => {\n const entityOrAsset = entityStore.getEntryOrAsset(binding, path);\n if (!entityOrAsset)\n return;\n switch (variableType) {\n case 'Media':\n // If we bound a normal entry field to the media variable we just return the bound value\n if (entityOrAsset.sys.type === 'Entry') {\n return getBoundValue(entityOrAsset, path);\n }\n return transformMedia(entityOrAsset, variables, resolveDesignValue, variableName, path);\n case 'RichText':\n return transformRichText(entityOrAsset, entityStore, path);\n case 'Array':\n return getArrayValue(entityOrAsset, path, entityStore);\n case 'Link':\n return getResolvedEntryFromLink(entityOrAsset, path, entityStore);\n default:\n return getBoundValue(entityOrAsset, path);\n }\n};\n\nfunction treeVisit(initialNode, onNode) {\n // returns last used index\n const _treeVisit = (currentNode, currentIndex, currentDepth) => {\n // Copy children in case of onNode removing it as we pass the node by reference\n const children = [...currentNode.children];\n onNode(currentNode, currentIndex, currentDepth);\n let nextAvailableIndex = currentIndex + 1;\n const lastUsedIndex = currentIndex;\n for (const child of children) {\n const lastUsedIndex = _treeVisit(child, nextAvailableIndex, currentDepth + 1);\n nextAvailableIndex = lastUsedIndex + 1;\n }\n return lastUsedIndex;\n };\n _treeVisit(initialNode, 0, 0);\n}\n/**\n * Traverses all nodes of a tree and maps all of them.\n * Intuitively works similarly to Array.map().\n * When returning mapped object from the mapper function\n * you _do not_ need to return about `.children[]` field.\n * This field is automatically managed by the treeMap() function.\n *\n * You can map each node to whatever you want, but shouldn't\n * modify the structure of the tree from the mapping function.\n */\nfunction treeMap(node, onNode) {\n // Copy children in case of onNode removing it as we pass the node by reference\n const children = [...node.children];\n const newNode = {\n ...onNode(node),\n children: children.map((child) => treeMap(child, onNode)),\n };\n return newNode;\n}\n\nclass ParseError extends Error {\n constructor(message) {\n super(message);\n }\n}\nconst isValidJsonObject = (s) => {\n try {\n const result = JSON.parse(s);\n if ('object' !== typeof result) {\n return false;\n }\n return true;\n }\n catch (e) {\n return false;\n }\n};\nconst doesMismatchMessageSchema = (event) => {\n try {\n tryParseMessage(event);\n return false;\n }\n catch (e) {\n if (e instanceof ParseError) {\n return e.message;\n }\n throw e;\n }\n};\nconst tryParseMessage = (event) => {\n if (!event.data) {\n throw new ParseError('Field event.data is missing');\n }\n if ('string' !== typeof event.data) {\n throw new ParseError(`Field event.data must be a string, instead of '${typeof event.data}'`);\n }\n if (!isValidJsonObject(event.data)) {\n throw new ParseError('Field event.data must be a valid JSON object serialized as string');\n }\n const eventData = JSON.parse(event.data);\n if (!eventData.source) {\n throw new ParseError(`Field eventData.source must be equal to 'composability-app'`);\n }\n if ('composability-app' !== eventData.source) {\n throw new ParseError(`Field eventData.source must be equal to 'composability-app', instead of '${eventData.source}'`);\n }\n // check eventData.eventType\n const supportedEventTypes = Object.values(INCOMING_EVENTS);\n if (!supportedEventTypes.includes(eventData.eventType)) {\n // Expected message: This message is handled in the EntityStore to store fetched entities\n if (eventData.eventType !== PostMessageMethods.REQUESTED_ENTITIES) {\n throw new ParseError(`Field eventData.eventType must be one of the supported values: [${supportedEventTypes.join(', ')}]`);\n }\n }\n return eventData;\n};\nconst validateExperienceBuilderConfig = ({ locale, mode, }) => {\n if (mode === StudioCanvasMode.EDITOR || mode === StudioCanvasMode.READ_ONLY) {\n return;\n }\n if (!locale) {\n throw new Error('Parameter \"locale\" is required for experience builder initialization outside of editor mode');\n }\n};\n\nconst uniqueById = (arr) => {\n const map = new Map();\n arr.forEach((item) => map.set(item.sys.id, item));\n return [...map.values()];\n};\nconst isObject = (value) => {\n return typeof value === 'object' && value !== null;\n};\n/**\n * Extracts all references from an entry.\n * Handles both: reference and multi-reference fields.\n * Returns unique array of references (even if they repeat within the entry).\n */\nconst referencesOf = (entry, fnShouldFollowReferencesOfEntryField) => {\n const references = [];\n const handleArray = (fieldValue, _fieldName) => {\n for (const item of fieldValue) {\n if (isObject(item) && item.sys?.type === 'Link') {\n references.push(item);\n }\n }\n };\n const handleLink = (fieldValue, _fieldName) => {\n references.push(fieldValue);\n };\n for (const [fieldName, fieldValue] of Object.entries(entry.fields)) {\n if (fnShouldFollowReferencesOfEntryField &&\n !fnShouldFollowReferencesOfEntryField(fieldName, entry)) {\n continue;\n }\n if (fieldValue === undefined) {\n continue; // edge case when field is present on object, but is set to undefined explicitly e.g. during test mocking { myField: undefined }\n }\n if (Array.isArray(fieldValue)) {\n handleArray(fieldValue);\n }\n else if (fieldValue !== null &&\n isObject(fieldValue) &&\n fieldValue.sys?.type === 'Link') {\n handleLink(fieldValue);\n }\n }\n return uniqueById(references);\n};\n// -- REFERENCE EXTRACTION UTILITIES --\nfunction extractReferencesFromEntriesAsIds(entries) {\n const [uniqueEntries, uniqueAssets, uniqueReferences] = extractReferencesFromEntries(entries);\n const entryIds = uniqueEntries.map((link) => link.sys.id);\n const assetIds = uniqueAssets.map((link) => link.sys.id);\n const referenceIds = uniqueReferences.map((link) => link.sys.id);\n return [entryIds, assetIds, referenceIds];\n}\nfunction extractReferencesFromEntries(entries) {\n const allReferences = entries.flatMap((entry) => referencesOf(entry));\n const uniqueReferences = uniqueById(allReferences);\n const uniqueAssets = uniqueReferences.filter((link) => link.sys.linkType === 'Asset');\n const uniqueEntries = uniqueReferences.filter((link) => link.sys.linkType === 'Entry');\n return [uniqueEntries, uniqueAssets, uniqueReferences];\n}\n\nconst excludeAssets = (entity) => !isAsset(entity);\nconst excludePatternEntries = (entry) => !isPatternEntry(entry);\n/**\n * Parses experience and extracts all leaf links that are referenced from the experience.\n * PRECONDITION: Relies on the fact that entityStore is preloaded with all dataSource\n * entries using include=2 (meaning that up to L3 entries are already preloaded into EntitStore).\n *\n * The function iterates over all entries in the entityStore (assuming they can be L1, L2, L3) and\n * over all of their references. Any references that are NOT available in the entityStore are considered\n * \"leaf references\" aka \"leaf links\" and are returned.\n *\n * The EntityStore happens to contain also entities representing patterns, which we do NOT consider\n * as entries that point to leaf links. So we don't iterate over patterns only over entries which\n * can be used for binding.\n */\nconst extractLeafLinksReferencedFromExperience = (experience) => {\n const assetLinks = [];\n const entryLinks = [];\n if (!experience.entityStore) {\n throw new Error('Parameter `experience` should have valid `experience.entityStore` object. Without it, we cannot extract leaf links. Most likely you passed `experience` instance that was not fully fetched. Check your experience fetching logic.');\n }\n // We want only leaf links which can be used for binding. We use two filters:\n // excludeAssets: because assets do not have references, so we don't need to traverse them\n // excludePatternEntries: because EntityStore happens to also store pattern-entries.\n // Those point to other patterns, and we don't want to consider them as\n // parents of leaf links pointing to actual data carrying entries used for binding.\n const entries = experience.entityStore.entities\n .filter(excludeAssets)\n .filter(excludePatternEntries);\n // We assume that ALL of the entries in the experience\n for (const entry of entries) {\n const references = referencesOf(entry);\n for (const ref of references) {\n if (isLinkToAsset(ref)) {\n if (!experience.entityStore.getEntityFromLink(ref)) {\n assetLinks.push(ref);\n }\n }\n else if (isLinkToEntry(ref)) {\n if (!experience.entityStore.getEntityFromLink(ref)) {\n entryLinks.push(ref);\n }\n }\n else {\n debug.warn(`[experiences-core::experienceSchema] Unexpected reference type found in entry \"${entry.sys.id}\": ${JSON.stringify(ref)}`);\n }\n }\n }\n const dedupedAssetLinks = uniqueById(assetLinks);\n const dedupedEntryLinks = uniqueById(entryLinks);\n return {\n assetLinks: dedupedAssetLinks,\n entryLinks: dedupedEntryLinks,\n assetIds: dedupedAssetLinks.map((link) => link.sys.id),\n entryIds: dedupedEntryLinks.map((link) => link.sys.id),\n };\n};\n\nconst splitDirectAndSlotChildren = (allChildNodes, componentDefinition) => {\n // Bridge difference between editor and delivery mode\n const getSlotId = (child) => {\n if ('data' in child)\n return child.data.slotId;\n return child.slotId;\n };\n const slotNodesMap = {};\n for (const slotId in componentDefinition.slots) {\n // We only allow one component per slot (container). This is just safer to not render components twice or not at all\n const nodes = allChildNodes.filter((child) => getSlotId(child) === slotId);\n slotNodesMap[slotId] = nodes.length ? nodes : null;\n }\n const directChildNodes = allChildNodes.filter((child) => getSlotId(child) === undefined);\n if (!componentDefinition.children || !directChildNodes.length) {\n // If there are no children allowed in the component or no children added, render as undefined\n return { slotNodesMap, directChildNodes: undefined };\n }\n return { slotNodesMap, directChildNodes };\n};\n\nconst flattenNestedPatterns = (fetchedPatterns) => {\n const patternsById = {};\n const queue = [...fetchedPatterns];\n while (queue.length) {\n const pattern = queue.shift();\n if (!pattern) {\n continue;\n }\n if (patternsById[pattern.sys.id]) {\n continue;\n }\n patternsById[pattern.sys.id] = pattern;\n if (!Array.isArray(pattern.fields.usedComponents) || !pattern.fields.usedComponents.length) {\n continue;\n }\n for (const nestedPattern of pattern.fields.usedComponents) {\n if (!isLink(nestedPattern)) {\n queue.push(nestedPattern);\n }\n }\n }\n return Object.values(patternsById);\n};\n/**\n * Given a list of patterns, extract the prebinding data into a more digestable format indexed by the pattern entry id\n * @param patterns a list of pattern entries\n * @returns a map of pattern entry ids to their prebinding data\n */\nconst extractPrebindingDataByPatternId = (patterns) => {\n const prebindingDataByPatternId = {};\n for (const pattern of patterns) {\n const patternId = pattern.sys.id;\n const [prebindingDefinition] = pattern.fields.componentSettings?.prebindingDefinitions ?? [];\n if (!prebindingDefinition)\n continue;\n const [nativeParameterId] = Object.entries(prebindingDefinition.parameterDefinitions ?? {}).find(([, value]) => !value.passToNodes?.length) ?? [];\n const prebindingData = {\n prebindingDefinitionId: prebindingDefinition.id,\n parameterIds: Object.keys(prebindingDefinition.parameterDefinitions),\n nativeParameterId,\n parameterDefinitions: prebindingDefinition.parameterDefinitions,\n variableMappings: prebindingDefinition.variableMappings,\n };\n prebindingDataByPatternId[patternId] = prebindingData;\n }\n return prebindingDataByPatternId;\n};\nconst generateDefaultDataSourceForPrebindingDefinition = (prebindingDefinitions = []) => {\n if (!prebindingDefinitions ||\n !Array.isArray(prebindingDefinitions) ||\n !prebindingDefinitions.length) {\n return { dataSource: {}, parameters: {} };\n }\n const prebindingDefinition = prebindingDefinitions[0];\n const dataSource = {};\n const parameters = {};\n for (const [parameterId, parameterDefinition] of Object.entries(prebindingDefinition.parameterDefinitions ?? {})) {\n if (parameterDefinition.defaultSource && isLink(parameterDefinition.defaultSource.link)) {\n const dataSourceKey = parameterDefinition.defaultSource.link.sys.id;\n dataSource[dataSourceKey] = parameterDefinition.defaultSource.link;\n parameters[parameterId] = {\n type: 'BoundValue',\n path: `/${dataSourceKey}`,\n };\n }\n }\n return {\n dataSource,\n parameters,\n };\n};\nfunction getTargetPatternMappingsForParameter({ fetchedPatterns, prebindingDataByPatternId, patternNodeDefinitionId, parameterId, }) {\n const patternPrebindingData = prebindingDataByPatternId[patternNodeDefinitionId];\n if (!patternPrebindingData)\n return undefined;\n if (patternPrebindingData.parameterIds.includes(parameterId)) {\n if (patternPrebindingData.nativeParameterId === parameterId) {\n if (!patternPrebindingData.variableMappings)\n return undefined;\n return Object.fromEntries(Object.entries(patternPrebindingData.variableMappings).filter(([, mapping]) => mapping.parameterId === parameterId));\n }\n else {\n const parameterDefinition = patternPrebindingData.parameterDefinitions[parameterId];\n if (!parameterDefinition || !parameterDefinition.passToNodes?.length)\n return undefined;\n const patternEntry = fetchedPatterns.find((entry) => entry.sys.id === patternNodeDefinitionId);\n if (!patternEntry)\n return undefined;\n let nestedPatternNode;\n treeVisit({\n definitionId: 'root',\n parameters: {},\n children: patternEntry.fields.componentTree.children,\n }, (node) => {\n if (node.id === parameterDefinition.passToNodes?.[0]?.nodeId) {\n nestedPatternNode = node;\n }\n return undefined;\n });\n if (!nestedPatternNode) {\n return undefined;\n }\n return getTargetPatternMappingsForParameter({\n fetchedPatterns,\n prebindingDataByPatternId,\n patternNodeDefinitionId: nestedPatternNode.definitionId,\n parameterId: parameterDefinition.passToNodes?.[0]?.parameterId,\n });\n }\n }\n}\n\nconst sendMessage = (eventType, data) => {\n if (typeof window === 'undefined') {\n return;\n }\n debug.debug(`[experiences-sdk-react::sendMessage] Sending message [${eventType}]`, {\n source: 'customer-app',\n eventType,\n payload: data,\n });\n window.parent?.postMessage({\n source: 'customer-app',\n eventType,\n payload: data,\n }, '*');\n};\n\nfunction deepFreeze(obj) {\n const propNames = Object.getOwnPropertyNames(obj);\n for (const name of propNames) {\n const value = obj[name];\n if (value && typeof value === 'object') {\n deepFreeze(value);\n }\n }\n return Object.freeze(obj);\n}\n\n/**\n * Base Store for entities\n * Can be extended for the different loading behaviours (editor, production, ..)\n */\nclass EntityStoreBase {\n constructor({ entities, locale }) {\n /* serialized */ this.entryMap = new Map();\n /* serialized */ this.assetMap = new Map();\n this.locale = locale;\n for (const entity of entities) {\n this.addEntity(entity);\n }\n }\n get entities() {\n return [...this.entryMap.values(), ...this.assetMap.values()];\n }\n updateEntity(entity) {\n this.addEntity(entity);\n }\n getEntryOrAsset(linkOrEntryOrAsset, path) {\n if (isDeepPath(path)) {\n return this.getDeepEntry(linkOrEntryOrAsset, path);\n }\n let entity;\n if (isLink(linkOrEntryOrAsset)) {\n const resolvedEntity = linkOrEntryOrAsset.sys.linkType === 'Entry'\n ? this.entryMap.get(linkOrEntryOrAsset.sys.id)\n : this.assetMap.get(linkOrEntryOrAsset.sys.id);\n if (!resolvedEntity || resolvedEntity.sys.type !== linkOrEntryOrAsset.sys.linkType) {\n debug.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(linkOrEntryOrAsset)}`);\n return;\n }\n entity = resolvedEntity;\n }\n else if (isAsset(linkOrEntryOrAsset) || isEntry(linkOrEntryOrAsset)) {\n // We already have the complete entity in preview & delivery (resolved by the CMA client)\n entity = linkOrEntryOrAsset;\n }\n else {\n throw new Error(`[experiences-core::EntityStoreBase] Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);\n }\n return entity;\n }\n /**\n * @deprecated in the base class this should be simply an abstract method\n * @param entityLink\n * @param path\n * @returns\n */\n getValue(entityLink, path) {\n const entity = this.getEntity(entityLink.sys.linkType, entityLink.sys.id);\n if (!entity) {\n // TODO: move to `debug` utils once it is extracted\n debug.warn(`Unresolved entity reference: ${entityLink.sys.linkType} with ID ${entityLink.sys.id}`);\n return;\n }\n return get(entity, path);\n }\n getEntityFromLink(link) {\n const resolvedEntity = link.sys.linkType === 'Entry'\n ? this.entryMap.get(link.sys.id)\n : this.assetMap.get(link.sys.id);\n if (!resolvedEntity || resolvedEntity.sys.type !== link.sys.linkType) {\n debug.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(link)}`);\n return;\n }\n return resolvedEntity;\n }\n getAssetById(assetId) {\n const asset = this.assetMap.get(assetId);\n if (!asset) {\n debug.warn(`[experiences-core::EntityStoreBase] Asset with ID \"${assetId}\" is not found in the store`);\n return;\n }\n return asset;\n }\n getEntryById(entryId) {\n const entry = this.entryMap.get(entryId);\n if (!entry) {\n debug.warn(`[experiences-core::EntityStoreBase] Entry with ID \"${entryId}\" is not found in the store`);\n return;\n }\n return entry;\n }\n getEntitiesFromMap(type, ids) {\n const resolved = [];\n const missing = [];\n for (const id of ids) {\n const entity = this.getEntity(type, id);\n if (entity) {\n resolved.push(entity);\n }\n else {\n missing.push(id);\n }\n }\n return {\n resolved,\n missing,\n };\n }\n addEntity(entity) {\n if (isAsset(entity)) {\n // cloned and frozen\n this.assetMap.set(entity.sys.id, deepFreeze(cloneDeep(entity)));\n }\n else if (isEntry(entity)) {\n // cloned and frozen\n this.entryMap.set(entity.sys.id, deepFreeze(cloneDeep(entity)));\n }\n else {\n throw new Error(`Attempted to add an entity to the store that is neither Asset nor Entry: '${JSON.stringify(entity)}'`);\n }\n }\n async fetchAsset(id) {\n const { resolved, missing } = this.getEntitiesFromMap('Asset', [id]);\n if (missing.length) {\n // TODO: move to `debug` utils once it is extracted\n debug.warn(`[experiences-core::EntityStoreBase] Asset \"${id}\" is not in the store`);\n return;\n }\n return resolved[0];\n }\n async fetchAssets(ids) {\n const { resolved, missing } = this.getEntitiesFromMap('Asset', ids);\n if (missing.length) {\n throw new Error(`Missing assets in the store (${missing.join(',')})`);\n }\n return resolved;\n }\n async fetchEntry(id) {\n const { resolved, missing } = this.getEntitiesFromMap('Entry', [id]);\n if (missing.length) {\n // TODO: move to `debug` utils once it is extracted\n debug.warn(`[experiences-core::EntityStoreBase] Entry \"${id}\" is not in the store`);\n return;\n }\n return resolved[0];\n }\n async fetchEntries(ids) {\n const { resolved, missing } = this.getEntitiesFromMap('Entry', ids);\n if (missing.length) {\n throw new Error(`Missing assets in the store (${missing.join(',')})`);\n }\n return resolved;\n }\n getDeepEntry(linkOrEntryOrAsset, path) {\n const resolveFieldset = (unresolvedFieldset, headEntry) => {\n const resolvedFieldset = [];\n let entityToResolveFieldsFrom = headEntry;\n for (let i = 0; i < unresolvedFieldset.length; i++) {\n const isLeaf = i === unresolvedFieldset.length - 1; // with last row, we are not expecting a link, but a value\n const row = unresolvedFieldset[i];\n const [, field, _localeQualifier] = row;\n if (!entityToResolveFieldsFrom) {\n throw new Error(`Logic Error: Cannot resolve field ${field} of a fieldset as there is no entity to resolve it from.`);\n }\n if (isLeaf) {\n resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);\n break;\n }\n const fieldValue = get(entityToResolveFieldsFrom, ['fields', field]);\n if (undefined === fieldValue) {\n return {\n resolvedFieldset,\n isFullyResolved: false,\n reason: `Cannot resolve field Link<${entityToResolveFieldsFrom.sys.type}>(sys.id=${entityToResolveFieldsFrom.sys.id}).fields[${field}] as field value is not defined`,\n };\n }\n else if (isLink(fieldValue)) {\n const entity = this.getEntityFromLink(fieldValue);\n if (entity === undefined) {\n return {\n resolvedFieldset,\n isFullyResolved: false,\n reason: `Field reference Link (sys.id=${fieldValue.sys.id}) not found in the EntityStore, waiting...`,\n };\n }\n resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);\n entityToResolveFieldsFrom = entity; // we move up\n }\n else if (isAsset(fieldValue) || isEntry(fieldValue)) {\n resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);\n entityToResolveFieldsFrom = fieldValue; // we move up\n }\n else {\n return {\n resolvedFieldset,\n isFullyResolved: false,\n reason: `Deep path points to an invalid field value of type '${typeof fieldValue}' (value=${fieldValue})`,\n };\n }\n }\n return {\n resolvedFieldset,\n isFullyResolved: true,\n };\n };\n const headEntity = isLink(linkOrEntryOrAsset)\n ? this.getEntityFromLink(linkOrEntryOrAsset)\n : linkOrEntryOrAsset;\n if (undefined === headEntity) {\n return;\n }\n const unresolvedFieldset = parseDataSourcePathIntoFieldset(path);\n // The purpose here is to take this intermediate representation of the deep-path\n // and to follow the links to the leaf-entity and field\n // in case we can't follow till the end, we should signal that there was null-reference in the path\n const { resolvedFieldset, isFullyResolved, reason } = resolveFieldset(unresolvedFieldset, headEntity);\n if (!isFullyResolved) {\n if (reason) {\n debug.log(`[experiences-core::EntityStoreBase] Deep path wasn't resolved till leaf node, falling back to undefined, because: ${reason}`);\n }\n return;\n }\n const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];\n return leafEntity;\n }\n getEntity(type, id) {\n if (type === 'Asset') {\n return this.assetMap.get(id);\n }\n return this.entryMap.get(id);\n }\n toJSON() {\n return {\n entryMap: Object.fromEntries(this.entryMap),\n assetMap: Object.fromEntries(this.assetMap),\n locale: this.locale,\n };\n }\n}\n\n/**\n * EntityStore which resolves entries and assets from the editor\n * over the sendMessage and subscribe functions.\n */\nclass EditorEntityStore extends EntityStoreBase {\n constructor({ entities, locale, sendMessage, subscribe, timeoutDuration = 3000, }) {\n super({ entities, locale });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.requestCache = new Map();\n this.cacheIdSeperator = ',';\n this.sendMessage = sendMessage;\n this.subscribe = subscribe;\n this.timeoutDuration = timeoutDuration;\n }\n cleanupPromise(referenceId) {\n setTimeout(() => {\n this.requestCache.delete(referenceId);\n }, 300);\n }\n getCacheId(id) {\n return id.length === 1 ? id[0] : id.join(this.cacheIdSeperator);\n }\n async fetchEntity(type, ids, skipCache = false) {\n let missing;\n if (!skipCache) {\n const { missing: missingFromCache, resolved } = this.getEntitiesFromMap(type, ids);\n if (missingFromCache.length === 0) {\n // everything is already in cache\n return resolved;\n }\n missing = missingFromCache;\n }\n else {\n missing = [...ids];\n }\n const cacheId = this.getCacheId(missing);\n const openRequest = this.requestCache.get(cacheId);\n if (openRequest) {\n return openRequest;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const newPromise = new Promise((resolve, reject) => {\n const unsubscribe = this.subscribe(PostMessageMethods.REQUESTED_ENTITIES, (message) => {\n const messageIds = [\n ...message.entities.map((entity) => entity.sys.id),\n ...(message.missingEntityIds ?? []),\n ];\n if (missing.every((id) => messageIds.includes(id))) {\n clearTimeout(timeout);\n resolve(message.entities);\n this.cleanupPromise(cacheId);\n ids.forEach((id) => this.cleanupPromise(id));\n unsubscribe();\n }\n else {\n debug.warn('[experiences-core::EditorEntityStore] Unexpected entities received in REQUESTED_ENTITIES. Ignoring this response.');\n }\n });\n const timeout = setTimeout(() => {\n reject(new Error(`Request for entities timed out ${this.timeoutDuration}ms for ${cacheId}`));\n this.cleanupPromise(cacheId);\n ids.forEach((id) => this.cleanupPromise(id));\n unsubscribe();\n }, this.timeoutDuration);\n this.sendMessage(PostMessageMethods.REQUEST_ENTITIES, {\n entityIds: missing,\n entityType: type,\n locale: this.locale,\n });\n });\n this.requestCache.set(cacheId, newPromise);\n ids.forEach((cid) => {\n this.requestCache.set(cid, newPromise);\n });\n const result = (await newPromise);\n result.forEach((value) => {\n this.addEntity(value);\n });\n return this.getEntitiesFromMap(type, ids).resolved;\n }\n async fetchAsset(id, skipCache = false) {\n try {\n return (await this.fetchAssets([id], skipCache))[0];\n }\n catch (err) {\n // TODO: move to debug utils once it is extracted\n debug.warn(`[experiences-core::EditorEntityStore] Failed to request asset ${id}`);\n return undefined;\n }\n }\n fetchAssets(ids, skipCache = false) {\n return this.fetchEntity('Asset', ids, skipCache);\n }\n async fetchEntry(id, skipCache = false) {\n try {\n return (await this.fetchEntries([id], skipCache))[0];\n }\n catch (err) {\n // TODO: move to debug utils once it is extracted\n debug.warn(`[experiences-core::EditorEntityStore] Failed to request entry ${id}`, err);\n return undefined;\n }\n }\n fetchEntries(ids, skipCache = false) {\n return this.fetchEntity('Entry', ids, skipCache);\n }\n}\n\nfunction transformAssetFileToUrl(fieldValue) {\n return fieldValue && typeof fieldValue == 'object' && fieldValue.url\n ? fieldValue.url\n : fieldValue;\n}\n\n// The default of 3s in the EditorEntityStore is sometimes timing out and\n// leads to not rendering bound content and assemblies.\nconst REQUEST_TIMEOUT = 10000;\nclass EditorModeEntityStore extends EditorEntityStore {\n constructor({ entities, locale }) {\n debug.debug(`[experiences-core::EditorModeEntityStore] Initializing editor entity store with ${entities.length} entities for locale ${locale}.`, { entities });\n const subscribe = (method, cb) => {\n const handleMessage = (event) => {\n const data = JSON.parse(event.data);\n if (typeof data !== 'object' || !data)\n return;\n if (data.source !== 'composability-app')\n return;\n if (data.eventType === method) {\n cb(data.payload);\n }\n };\n if (typeof window !== 'undefined') {\n window.addEventListener('message', handleMessage);\n }\n return () => {\n if (typeof window !== 'undefined') {\n window.removeEventListener('message', handleMessage);\n }\n };\n };\n super({ entities, sendMessage, subscribe, locale, timeoutDuration: REQUEST_TIMEOUT });\n }\n /**\n * This function collects and returns the list of requested entries and assets. Additionally, it checks\n * upfront whether any async fetching logic is actually happening. If not, it returns a plain `false` value, so we\n * can detect this early and avoid unnecessary re-renders.\n * @param entityLinks\n * @returns false if no async fetching is happening, otherwise a promise that resolves when all entities are fetched\n */\n async fetchEntities({ missingEntryIds, missingAssetIds, skipCache = false, }) {\n // Entries and assets will be stored in entryMap and assetMap\n await Promise.all([\n super.fetchEntries(missingEntryIds, skipCache),\n super.fetchAssets(missingAssetIds, skipCache),\n ]);\n }\n getMissingEntityIds(entityLinks) {\n const entryLinks = entityLinks.filter((link) => link.sys?.linkType === 'Entry');\n const assetLinks = entityLinks.filter((link) => link.sys?.linkType === 'Asset');\n const uniqueEntryIds = [...new Set(entryLinks.map((link) => link.sys.id))];\n const uniqueAssetIds = [...new Set(assetLinks.map((link) => link.sys.id))];\n const { missing: missingEntryIds } = this.getEntitiesFromMap('Entry', uniqueEntryIds);\n const { missing: missingAssetIds } = this.getEntitiesFromMap('Asset', uniqueAssetIds);\n return { missingEntryIds, missingAssetIds };\n }\n getValue(entityLinkOrEntity, path) {\n const entity = this.getEntryOrAsset(entityLinkOrEntity, path.join('/'));\n if (!entity) {\n return;\n }\n const fieldValue = get(entity, path);\n return transformAssetFileToUrl(fieldValue);\n }\n}\n\nconst resolveDeepUsedComponents = ({ experienceEntryFields, parentComponents, }) => {\n const totalUsedComponents = [];\n const usedComponents = experienceEntryFields?.usedComponents;\n if (!usedComponents || usedComponents.length === 0) {\n return [];\n }\n for (const component of usedComponents) {\n if ('fields' in component) {\n totalUsedComponents.push(component);\n if (parentComponents.has(component.sys.id)) {\n continue;\n }\n totalUsedComponents.push(...resolveDeepUsedComponents({\n experienceEntryFields: component.fields,\n parentComponents: new Set([...parentComponents, component.sys.id]),\n }));\n }\n }\n return totalUsedComponents;\n};\n\nclass EntityStore extends EntityStoreBase {\n constructor(options) {\n if (typeof options === 'string') {\n // For SSR/SSG, the entity store is created server-side and passed to the client as a serialised JSON.\n // So the properties in data.entityStore are equal to the attributes of this class (see `toJSON()`)\n const serializedAttributes = JSON.parse(options).entityStore;\n super({\n entities: [\n ...Object.values(serializedAttributes.entryMap),\n ...Object.values(serializedAttributes.assetMap),\n ],\n locale: serializedAttributes.locale,\n });\n this._hoistedParameterDefinitions = {};\n this._hoistedVariableMappings = {};\n this._experienceEntryFields = serializedAttributes._experienceEntryFields; // non-broken deserialization always should result in valid ExperienceFields\n this._experienceEntryId = serializedAttributes._experienceEntryId; // // non-broken deserialization always should result in valid experienceEntryId\n this._unboundValues = serializedAttributes._unboundValues; // non-broken deserialization always should result in valid unboundValues\n }\n else {\n const { experienceEntry, entities, locale } = options;\n if (!isExperienceEntry(experienceEntry)) {\n throw new Error('Provided entry is not an experience entry');\n }\n super({ entities, locale });\n this._hoistedParameterDefinitions = {};\n this._hoistedVariableMappings = {};\n this._experienceEntryFields = experienceEntry.fields;\n this._experienceEntryId = experienceEntry.sys.id;\n this._unboundValues = experienceEntry.fields.unboundValues;\n }\n this._isExperienceAPatternEntry = checkIsAssemblyEntry({\n fields: this._experienceEntryFields,\n });\n // DERIVE ENTITY STORE INSTANCE VARIBLES\n // Register prebindings\n {\n const usedComponentLinks = this._experienceEntryFields.usedComponents ?? [];\n const usedComponents = usedComponentLinks\n .map((component) => (isLink(component) ? this.getEntityFromLink(component) : component))\n .filter((component) => component !== undefined);\n this._hoistedParameterDefinitions = EntityStore.calculateHoistedParameterDefinitions(this._experienceEntryFields, usedComponents);\n this._hoistedVariableMappings = EntityStore.calculateHoistedVariableMappings(this._experienceEntryFields, usedComponents);\n }\n // Register deep references\n this._usedComponentsWithDeepReferences = resolveDeepUsedComponents({\n experienceEntryFields: this._experienceEntryFields,\n parentComponents: new Set([this._experienceEntryId]),\n });\n }\n static calculateHoistedParameterDefinitions(parentEntryFields, usedComponents) {\n let hoistedDefinitions = {};\n // --------------------\n // Hoist prebinding for the L1 parent pattern aka `pA`\n // --------------------\n hoistedDefinitions = Object.assign(hoistedDefinitions, parentEntryFields.componentSettings?.prebindingDefinitions?.[0].parameterDefinitions || {});\n // --------------------\n // Hoist prebinding for the L2 nested patterns, patterns aka`pB`\n // --------------------\n usedComponents.forEach((patternEntryLevel2) => {\n hoistedDefinitions = {\n ...hoistedDefinitions,\n ...patternEntryLevel2.fields.componentSettings?.prebindingDefinitions?.[0]\n .parameterDefinitions,\n };\n });\n // --------------------\n // Hoist prebinding for L3 nested patterns, patterns aka `pC`\n // --------------------\n const usedComponentsLevel3 = usedComponents.flatMap((patternEntryLevel2) => {\n const usedComponents = patternEntryLevel2.fields.usedComponents || [];\n const filteredUsedComponents = usedComponents.filter((component) => component !== undefined && isExperienceEntry(component));\n return filteredUsedComponents;\n });\n usedComponentsLevel3.forEach((patternEntryLevel3) => {\n hoistedDefinitions = {\n ...hoistedDefinitions,\n ...patternEntryLevel3.fields.componentSettings?.prebindingDefinitions?.[0]\n .parameterDefinitions,\n };\n });\n return hoistedDefinitions;\n }\n static calculateHoistedVariableMappings(parentEntryFields, usedComponents) {\n let hoistedMappings = {};\n // --------------------\n // Hoist prebinding for the L1 parent pattern aka `pA`\n // --------------------\n hoistedMappings = Object.assign(hoistedMappings, parentEntryFields.componentSettings?.prebindingDefinitions?.[0].variableMappings || {});\n // --------------------\n // Hoist prebinding for the L2 nested patterns, patterns aka`pB`\n // --------------------\n usedComponents.forEach((patternEntryLevel2) => {\n hoistedMappings = {\n ...hoistedMappings,\n ...patternEntryLevel2.fields.componentSettings?.prebindingDefinitions?.[0].variableMappings,\n };\n });\n // --------------------\n // Hoist prebinding for L3 nested patterns, patterns aka `pC`\n // --------------------\n const usedComponentsLevel3 = usedComponents.flatMap((patternEntryLevel2) => {\n const usedComponents = patternEntryLevel2.fields.usedComponents || [];\n const filteredUsedComponents = usedComponents.filter((component) => component !== undefined && isExperienceEntry(component));\n return filteredUsedComponents;\n });\n usedComponentsLevel3.forEach((patternEntryLevel3) => {\n hoistedMappings = {\n ...hoistedMappings,\n ...patternEntryLevel3.fields.componentSettings?.prebindingDefinitions?.[0].variableMappings,\n };\n });\n return hoistedMappings;\n }\n getCurrentLocale() {\n return this.locale;\n }\n get isExperienceAPatternEntry() {\n return this._isExperienceAPatternEntry;\n }\n get hoistedVariableMappings() {\n return this._hoistedVariableMappings;\n }\n get hoistedParameterDefinitions() {\n return this._hoistedParameterDefinitions;\n }\n get experienceEntryFields() {\n return this._experienceEntryFields;\n }\n get experienceEntryId() {\n return this._experienceEntryId;\n }\n get schemaVersion() {\n return this._experienceEntryFields?.componentTree.schemaVersion;\n }\n get breakpoints() {\n return this._experienceEntryFields?.componentTree.breakpoints ?? [];\n }\n get dataSource() {\n return this._experienceEntryFields?.dataSource ?? {};\n }\n get unboundValues() {\n return this._unboundValues ?? {};\n }\n get usedComponents() {\n return this._usedComponentsWithDeepReferences ?? [];\n }\n /**\n * Extend the existing set of unbound values with the ones from the assembly definition.\n * When creating a new assembly out of a container, the unbound value keys are copied and\n * thus the existing and the added ones have colliding keys. In the case of overlapping value\n * keys, the ones from the experience overrule the ones from the assembly definition as\n * the latter one is certainly just a default value while the other one is from the actual instance.\n * @param unboundValues set of unbound values defined in the assembly definition\n */\n addAssemblyUnboundValues(unboundValues) {\n this._unboundValues = { ...unboundValues, ...(this._unboundValues ?? {}) };\n }\n getValue(entityLinkOrEntity, path) {\n const entity = isLink(entityLinkOrEntity)\n ? this.getEntityFromLink(entityLinkOrEntity)\n : entityLinkOrEntity;\n if (entity === undefined) {\n return;\n }\n const fieldValue = get(entity, path);\n return transformAssetFileToUrl(fieldValue);\n }\n toJSON() {\n return {\n _experienceEntryFields: this._experienceEntryFields,\n _experienceEntryId: this._experienceEntryId,\n _unboundValues: this._unboundValues,\n ...super.toJSON(),\n };\n }\n}\n\nclass UninitializedEntityStore extends EntityStoreBase {\n constructor() {\n super({ entities: [], locale: 'uninitialized-locale-in-uninitialized-entity-store' });\n }\n}\n\nconst inMemoryEntitiesStore = create((set, get) => ({\n // The UninitializedEntityStore is a placeholder instance and is here to highlight the\n // // fact that it's not used by anything until during loading lifecycle it'sreplaced by real entity store:\n // - in Preview+Delivery mode: right after we fetch Expereince and it entities\n // - in EDITOR (VisualEditor) mode: right after the VisualEditor is async imported and initialize event happens\n entityStore: new UninitializedEntityStore(),\n areEntitiesFetched: false,\n setEntitiesFetched(fetched) {\n set({ areEntitiesFetched: fetched });\n },\n resolveAssetById(assetId) {\n if (!assetId)\n return undefined;\n const { entityStore } = get();\n return entityStore.getAssetById(assetId);\n },\n resolveEntryById(entryId) {\n if (!entryId)\n return undefined;\n const { entityStore } = get();\n return entityStore.getEntryById(entryId);\n },\n resolveEntity(link) {\n if (!link)\n return undefined;\n const { entityStore } = get();\n return entityStore.getEntityFromLink(link);\n },\n resetEntityStore(entityStore) {\n set({\n entityStore,\n areEntitiesFetched: false,\n });\n },\n}));\n\nfunction maybeResolveLink(maybeLink) {\n if (!isLink(maybeLink)) {\n debug.warn('[experiences-core::InMemoryEntitiesStore] maybeResolveLink function must receive Link shape. Provided argument does not match the Link shape: ', maybeLink);\n return undefined;\n }\n return inMemoryEntitiesStore.getState().resolveEntity(maybeLink);\n}\nfunction maybeResolveByAssetId(assetId) {\n return inMemoryEntitiesStore.getState().resolveAssetById(assetId);\n}\nfunction maybeResolveByEntryId(entryId) {\n return inMemoryEntitiesStore.getState().resolveEntryById(entryId);\n}\nfunction hasEntry(entryId) {\n return Boolean(maybeResolveByEntryId(entryId));\n}\nfunction hasAsset(assetId) {\n return Boolean(maybeResolveByAssetId(assetId));\n}\nfunction addEntities(entities) {\n if (!Array.isArray(entities) || entities.length === 0) {\n return;\n }\n const { entityStore } = inMemoryEntitiesStore.getState();\n const definedEntities = entities.filter(Boolean);\n for (const entity of definedEntities) {\n entityStore.updateEntity(entity);\n }\n}\nconst inMemoryEntities = {\n maybeResolveLink,\n maybeResolveByAssetId,\n maybeResolveByEntryId,\n hasEntry,\n hasAsset,\n addEntities,\n};\nconst useInMemoryEntities = () => {\n return inMemoryEntities;\n};\n\nvar VisualEditorMode;\n(function (VisualEditorMode) {\n VisualEditorMode[\"LazyLoad\"] = \"lazyLoad\";\n VisualEditorMode[\"InjectScript\"] = \"injectScript\";\n})(VisualEditorMode || (VisualEditorMode = {}));\n\nfunction createExperience(options) {\n let entityStore;\n if (typeof options === 'string') {\n entityStore = new EntityStore(options);\n }\n else {\n const { experienceEntry, referencedAssets, referencedEntries, locale } = options;\n if ([experienceEntry, ...referencedAssets, ...referencedEntries].some(isNotLocalized)) {\n throw new Error('Some of the provided content is not localized. Please localize every entity before passing it to this function. Note that this is solely determined by `sys.locale` being set respectively.');\n }\n if (!isExperienceEntry(experienceEntry)) {\n throw new Error('Provided entry is not an experience entry');\n }\n entityStore = new EntityStore({\n experienceEntry,\n entities: [...referencedEntries, ...referencedAssets],\n locale,\n });\n }\n inMemoryEntitiesStore.getState().resetEntityStore(entityStore);\n return {\n entityStore,\n };\n}\n// Following the API shape, we check the `sys.locale` property as we can't rely on the shape of\n// fields to determine whether it's localized or not.\n// See CDA documentation mentioning it here: https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/common-resource-attributes\nconst isNotLocalized = (entity) => {\n return !entity.sys.locale;\n};\n\n/**\n * Fetches an experience entry by its slug or id. Throws an error if there are multiple\n * entries with the same slug. Additionally, it resolves all nested pattern entries inside `fields.usedComponents`.\n * @param options.client - Instantiated client from the Contentful SDK. If this is using the `withAllLocales` modifier, you may not provide a specific locale.\n * @param options.locale - Provide a locale if your experience contains custom localized fields. Otherwise, it will fallback to the default locale.\n * @param options.experienceTypeId - id of the content type associated with the experience\n * @param options.identifier - identifying condition to find the correct experience entry\n *\n */\nconst fetchExperienceEntry = async ({ client, experienceTypeId, locale, identifier, }) => {\n if (!client) {\n throw new Error('Failed to fetch experience entities. Required \"client\" parameter was not provided');\n }\n if (!experienceTypeId) {\n throw new Error('Failed to fetch experience entities. Required \"experienceTypeId\" parameter was not provided');\n }\n if (!('slug' in identifier) && !('id' in identifier)) {\n throw new Error(`Failed to fetch experience entities. At least one identifier must be provided. Received: ${JSON.stringify(identifier)}`);\n }\n const filter = 'slug' in identifier ? { 'fields.slug': identifier.slug } : { 'sys.id': identifier.id };\n const entries = await client.getEntries({\n content_type: experienceTypeId,\n locale,\n include: 3, // fetching max 3 level deep references due to nested patterns\n ...filter,\n });\n if (entries.items.length > 1) {\n throw new Error(`More than one experience with identifier: ${JSON.stringify(identifier)} was found`);\n }\n return entries.items[0];\n};\n\nclass DeepReference {\n constructor({ path, dataSource }) {\n const { key, field, referentField } = parseDataSourcePathWithL1DeepBindings(path);\n this.originalPath = path;\n this.entityId = dataSource[key].sys.id;\n this.entityLink = dataSource[key];\n this.field = field;\n this.referentField = referentField;\n }\n get headEntityId() {\n return this.entityId;\n }\n /**\n * Extracts referent from the path, using EntityStore as source of\n * entities during the resolution path.\n */\n extractReferent(entityStore) {\n const headEntity = entityStore.getEntityFromLink(this.entityLink);\n const maybeReferentLink = headEntity?.fields[this.field];\n if (undefined === maybeReferentLink) {\n // field references nothing (or even field doesn't exist)\n return undefined;\n }\n if (!isLink(maybeReferentLink)) {\n // Scenario of \"impostor referent\", where one of the deepPath's segments is not a Link but some other type\n // Under normal circumstance we expect field to be a Link, but it could be an \"impostor\"\n // eg. `Text` or `Number` or anything like that; could be due to CT changes or manual path creation via CMA\n return undefined;\n }\n return maybeReferentLink;\n }\n static from(opt) {\n return new DeepReference(opt);\n }\n}\nfunction gatherDeepReferencesFromExperienceEntry(experienceEntry) {\n const deepReferences = [];\n const dataSource = experienceEntry.fields.dataSource;\n const { children } = experienceEntry.fields.componentTree;\n treeVisit({\n definitionId: 'root',\n variables: {},\n children,\n }, (node) => {\n if (!node.variables)\n return;\n for (const variableMapping of Object.values(node.variables)) {\n if (variableMapping.type !== 'BoundValue')\n continue;\n if (!isDeepPath(variableMapping.path))\n continue;\n deepReferences.push(DeepReference.from({\n path: variableMapping.path,\n dataSource,\n }));\n }\n });\n return deepReferences;\n}\nfunction gatherDeepPrebindingReferencesFromExperienceEntry({ experienceEntry, fetchedPatterns, prebindingDataByPatternId, fetchedLevel1Entries, }) {\n const deepPrebindingReferences = [];\n const dataSource = experienceEntry.fields.dataSource;\n const { children } = experienceEntry.fields.componentTree;\n treeVisit({\n definitionId: 'root',\n parameters: {},\n children,\n }, (node) => {\n if (!node.parameters)\n return;\n for (const [parameterId, parameterValue] of Object.entries(node.parameters)) {\n const dataSourceKey = parameterValue.path.split('/')[1];\n const headEntryLink = dataSource[dataSourceKey];\n if (!headEntryLink)\n continue;\n if (headEntryLink.sys.linkType !== 'Entry')\n continue;\n const headEntry = fetchedLevel1Entries.find((entry) => entry.sys.id === headEntryLink.sys.id);\n if (!headEntry)\n continue;\n const headEntryContentTypeId = headEntry.sys.contentType.sys.id;\n // if experience, we don't have any hoisted data on the given experienceEntry\n // and we have to lookup the pattern instead\n const variableMappings = getTargetPatternMappingsForParameter({\n fetchedPatterns,\n prebindingDataByPatternId,\n patternNodeDefinitionId: node.definitionId,\n parameterId,\n });\n if (!variableMappings)\n continue;\n for (const mappingData of Object.values(variableMappings)) {\n const targetMapping = mappingData.pathsByContentType[headEntryContentTypeId];\n if (!targetMapping)\n continue;\n // mapping doesn't start with /uuid, but instead starts with /fields\n // so we add /uuid to make it match the binding path format\n const path = `/${dataSourceKey}${targetMapping.path}`;\n if (!isDeepPath(path))\n continue;\n deepPrebindingReferences.push(DeepReference.from({\n path,\n dataSource,\n }));\n }\n }\n });\n return deepPrebindingReferences;\n}\nfunction gatherDeepPrebindingReferencesFromPatternEntry({ patternEntry, fetchedPatterns, prebindingDataByPatternId, fetchedLevel1Entries, }) {\n const deepPrebindingReferences = [];\n // patterns can't have parameters in their CDA/CMA JSON, so we can generate random ids here\n const { dataSource, parameters } = generateDefaultDataSourceForPrebindingDefinition(patternEntry.fields.componentSettings?.prebindingDefinitions);\n for (const [parameterId, parameterValue] of Object.entries(parameters)) {\n const dataSourceKey = parameterValue.path.split('/')[1];\n const headEntryLink = dataSource[dataSourceKey];\n if (!headEntryLink)\n continue;\n if (headEntryLink.sys.linkType !== 'Entry')\n continue;\n const headEntry = fetchedLevel1Entries.find((entry) => entry.sys.id === headEntryLink.sys.id);\n if (!headEntry)\n continue;\n const headEntryContentTypeId = headEntry.sys.contentType.sys.id;\n const variableMappings = getTargetPatternMappingsForParameter({\n fetchedPatterns,\n prebindingDataByPatternId,\n patternNodeDefinitionId: patternEntry.sys.id,\n parameterId,\n });\n if (!variableMappings)\n continue;\n for (const mappingData of Object.values(variableMappings)) {\n const targetMapping = mappingData.pathsByContentType[headEntryContentTypeId];\n if (!targetMapping)\n continue;\n // mapping doesn't start with /uuid, but instead starts with /fields\n // so we add /uuid to make it match the binding path format\n const path = `/${dataSourceKey}${targetMapping.path}`;\n if (!isDeepPath(path))\n continue;\n deepPrebindingReferences.push(DeepReference.from({\n path,\n dataSource,\n }));\n }\n }\n return deepPrebindingReferences;\n}\n/**\n * used in editor mode. for delivery mode see `gatherDeepReferencesFromExperienceEntry`\n */\nfunction gatherDeepReferencesFromTree(startingNode, dataSource, getEntityFromLink) {\n const deepReferences = [];\n treeVisit(startingNode, (node) => {\n if (!node.data.props)\n return;\n for (const [, variableMapping] of Object.entries(node.data.props)) {\n if (variableMapping.type !== 'BoundValue')\n continue;\n if (isDeepPath(variableMapping.path)) {\n deepReferences.push(DeepReference.from({\n path: variableMapping.path,\n dataSource,\n }));\n }\n else if (isPreboundProp(variableMapping) && isDeepPrebinding(variableMapping)) {\n const getEntityByDataSourceKey = (dataSourceKey) => {\n const entityLink = dataSource[dataSourceKey];\n if (!entityLink)\n return undefined;\n return getEntityFromLink(entityLink);\n };\n const deepPrebindingPath = getPrebindingPathBySourceEntry(variableMapping, getEntityByDataSourceKey);\n if (!deepPrebindingPath)\n continue;\n deepReferences.push(DeepReference.from({\n path: deepPrebindingPath,\n dataSource,\n }));\n }\n }\n });\n return deepReferences;\n}\n\n/**\n * Traverses deep-references and extracts referents from valid deep-paths.\n * The referents are received from the CDA/CPA response `.includes` field.\n *\n * In case deep-paths not resolving till the end, eg.:\n * - non-link referents: are ignored\n * - unset references: are ignored\n *\n * Errors are thrown in case of deep-paths being correct,\n * but referents not found. Because if we don't throw now, the EntityStore will\n * be missing entities and upon rendering will not be able to render bindings.\n */\nfunction gatherAutoFetchedReferentsFromIncludes(deepReferences, entriesResponse) {\n const autoFetchedReferentEntries = [];\n const autoFetchedReferentAssets = [];\n for (const reference of deepReferences) {\n const headEntry = entriesResponse.items.find((entry) => entry.sys.id === reference.headEntityId);\n if (!headEntry) {\n debug.debug(`[experiences-sdk-core::fetchers] When resolving deep-references could not find headEntry with id '${reference.entityId}'`);\n continue;\n }\n const linkToReferent = headEntry.fields[reference.field];\n if (undefined === linkToReferent) {\n debug.debug(`[experiences-sdk-core::fetchers] Empty reference in headEntity. Probably reference is simply not set.`);\n continue;\n }\n if (!isLink(linkToReferent)) {\n debug.debug(`[experiences-sdk-core::fetchers] Non-link value in headEntity. Probably broken path '${reference.originalPath}'`);\n continue;\n }\n const linkType = linkToReferent.sys.linkType;\n if (!['Entry', 'Asset'].includes(linkType)) {\n debug.debug(`[experiences-sdk-core::fetchers] Unhandled linkType :${JSON.stringify(linkToReferent)}`);\n continue;\n }\n const referentEntity = entriesResponse.includes?.[linkType]?.find((entity) => entity.sys.id === linkToReferent.sys.id);\n if (!referentEntity) {\n debug.debug(`[experiences-sdk-core::fetchers] L2-referent ${linkType} was not found within .includes (${JSON.stringify({\n linkToReferent,\n })})`);\n continue;\n }\n linkType === 'Entry'\n ? autoFetchedReferentEntries.push(referentEntity)\n : autoFetchedReferentAssets.push(referentEntity);\n } // for (reference of deepReferences)\n return { autoFetchedReferentAssets, autoFetchedReferentEntries };\n}\n\nconst MIN_FETCH_LIMIT = 1;\nconst fetchAllEntries = async ({ client, ids, locale, skip = 0, limit = 100, responseItems = [], responseIncludes = { Entry: [], Asset: [] }, }) => {\n try {\n if (!client) {\n throw new Error('Failed to fetch experience entities. Required \"client\" parameter was not provided');\n }\n if (!ids.length) {\n return {\n items: [],\n includes: {\n Entry: [],\n Asset: [],\n },\n };\n }\n const query = { 'sys.id[in]': ids, locale, limit, skip, include: 2 };\n const { items, includes, total: responseTotal, } = await client.withoutLinkResolution.getEntries({ ...query });\n responseItems.push(...items);\n responseIncludes?.Entry?.push(...(includes?.Entry || []));\n responseIncludes?.Asset?.push(...(includes?.Asset || []));\n // E.g Total entries = 99\n // First fetch => { skip: 0, limit: 50, total: 99 } => 50 Entries fetched in Page 0\n // Total Entries fetched = 50, 49 remaining\n // 0(skip) + 50(limit) < 99(total) => Fetch again\n // Second fetch => { skip: 50, limit: 50, total: 99 } => 49 Entries fetched in Page 1\n // Total Entries fetched = 50(Page 0) + 49(Page 1) = 99, 0 remaining\n // 50(skip) + 50(limit) > 99(total) => Stop fetching\n if (skip + limit < responseTotal) {\n return await fetchAllEntries({\n client,\n ids,\n locale,\n skip: skip + limit,\n limit,\n responseItems,\n responseIncludes,\n });\n }\n const dedupedEntries = uniqueById(responseIncludes?.Entry);\n const dedupedAssets = uniqueById(responseIncludes?.Asset);\n return {\n items: responseItems,\n includes: {\n Entry: dedupedEntries,\n Asset: dedupedAssets,\n },\n };\n }\n catch (error) {\n if (error instanceof Error &&\n error.message.includes('size too big') &&\n limit > MIN_FETCH_LIMIT) {\n const newLimit = Math.max(MIN_FETCH_LIMIT, Math.floor(limit / 2));\n return fetchAllEntries({\n client,\n ids,\n locale,\n skip,\n limit: newLimit,\n responseItems,\n });\n }\n throw error;\n }\n};\nconst fetchAllAssets = async ({ client, ids, locale, skip = 0, limit = 100, responseItems = [], }) => {\n try {\n if (!client) {\n throw new Error('Failed to fetch experience entities. Required \"client\" parameter was not provided');\n }\n if (!ids.length) {\n return { items: [] };\n }\n const query = { 'sys.id[in]': ids, locale, limit, skip };\n const { items, total: responseTotal } = await client.getAssets({ ...query });\n responseItems.push(...items);\n if (skip + limit < responseTotal) {\n return await fetchAllAssets({\n client,\n ids,\n locale,\n skip: skip + limit,\n limit,\n responseItems,\n });\n }\n return {\n items: responseItems,\n };\n }\n catch (error) {\n if (error instanceof Error &&\n error.message.includes('size too big') &&\n limit > MIN_FETCH_LIMIT) {\n const newLimit = Math.max(MIN_FETCH_LIMIT, Math.floor(limit / 2));\n return fetchAllAssets({\n client,\n ids,\n locale,\n skip,\n limit: newLimit,\n responseItems,\n });\n }\n throw error;\n }\n};\n\n/**\n * Fetches all entries and assets from the `dataSource` of the given experience entry. This will\n * also consider deep references that are not listed explicitly but linked through deep binding paths.\n * @param options.client - Instantiated client from the Contentful SDK. If this is using the `withAllLocales` modifier, you may not provide a specific locale.\n * @param options.experienceEntry - Localized experience entry. To localize a multi locale entry, use the `localizeEntity` function.\n * @param options.locale - Retrieve a specific localized version of the referenced entities. Otherwise, it will fallback to the default locale.\n * @returns object with a list of `entries` and a list of `assets`\n */\nconst fetchReferencedEntities = async ({ client, experienceEntry, locale, }) => {\n if (!client) {\n throw new Error('Failed to fetch experience entities. Required \"client\" parameter was not provided');\n }\n if (!isExperienceEntry(experienceEntry)) {\n throw new Error('Failed to fetch experience entities. Provided \"experienceEntry\" does not match experience entry schema');\n }\n const entryIds = new Set();\n const assetIds = new Set();\n for (const dataBinding of Object.values(experienceEntry.fields.dataSource)) {\n if (!('sys' in dataBinding)) {\n continue;\n }\n if (dataBinding.sys.linkType === 'Entry') {\n entryIds.add(dataBinding.sys.id);\n }\n if (dataBinding.sys.linkType === 'Asset') {\n assetIds.add(dataBinding.sys.id);\n }\n }\n const [entriesResponse, assetsResponse] = await Promise.all([\n fetchAllEntries({ client, ids: [...entryIds], locale }),\n fetchAllAssets({ client, ids: [...assetIds], locale }),\n ]);\n const usedPatterns = experienceEntry.fields.usedComponents ?? [];\n const isRenderingExperience = Boolean(!experienceEntry.fields.componentSettings);\n const deepReferences = gatherDeepReferencesFromExperienceEntry(experienceEntry);\n // If we are previewing a pattern, we want to include the entry itself as well\n const fetchedPatterns = (isRenderingExperience ? usedPatterns : [...usedPatterns, experienceEntry]);\n const allFetchedPatterns = flattenNestedPatterns(fetchedPatterns);\n const prebindingDataByPatternId = extractPrebindingDataByPatternId(allFetchedPatterns);\n // Patterns do not have dataSource stored in their dataSource field, so head entities won't be there and we need to fetch them\n if (!isRenderingExperience) {\n const { dataSource } = generateDefaultDataSourceForPrebindingDefinition(experienceEntry.fields.componentSettings?.prebindingDefinitions);\n if (Object.keys(dataSource).length) {\n const prebindingEntriesResponse = await fetchAllEntries({\n client,\n ids: Object.values(dataSource).map((link) => link.sys.id),\n locale,\n });\n entriesResponse.items.push(...prebindingEntriesResponse.items);\n entriesResponse.includes.Asset.push(...(prebindingEntriesResponse.includes?.Asset ?? []));\n entriesResponse.includes.Entry.push(...(prebindingEntriesResponse.includes?.Entry ?? []));\n }\n }\n // normally, for experience entry, there should be no need to call this method, as `includes=2` will have them resolved\n // because the entries used for pre-binding are stored in both - the layout of the experience, as well as the dataSource field\n const deepPrebindingReferences = isRenderingExperience\n ? gatherDeepPrebindingReferencesFromExperienceEntry({\n experienceEntry: experienceEntry,\n fetchedPatterns: allFetchedPatterns,\n prebindingDataByPatternId,\n fetchedLevel1Entries: entriesResponse.items,\n })\n : // however, for patterns, we have to do it by hand, because a pattern entry doesn't save the pre-binding data neither in the\n // layout nor in the dataSource field.\n // for consistency, as well as to be future safe from the change to \"includes=2\", I added methods for both\n gatherDeepPrebindingReferencesFromPatternEntry({\n patternEntry: experienceEntry,\n fetchedPatterns: allFetchedPatterns,\n prebindingDataByPatternId,\n fetchedLevel1Entries: entriesResponse.items,\n });\n const allDeepReferences = [...deepReferences, ...deepPrebindingReferences];\n const { autoFetchedReferentAssets, autoFetchedReferentEntries } = gatherAutoFetchedReferentsFromIncludes(allDeepReferences, entriesResponse);\n // Using client getEntries resolves all linked entry references, so we do not need to resolve entries in usedComponents\n const allResolvedEntries = [\n ...(entriesResponse?.items ?? []),\n ...(entriesResponse.includes?.Entry ?? []),\n ...(usedPatterns || []),\n ...autoFetchedReferentEntries,\n ];\n const allResolvedAssets = [\n ...(assetsResponse.items ?? []),\n ...(entriesResponse?.includes?.Asset ?? []),\n ...autoFetchedReferentAssets,\n ];\n return {\n // we have to drop duplicates, becasue of the merge of deepReferences and deepPrebindingReferences above\n // If not, the same entity might appear in this array more than once\n entries: [\n ...new Map(allResolvedEntries.map((entry) => [entry.sys.id, entry])).values(),\n ],\n assets: [\n ...new Map(allResolvedAssets.map((asset) => [asset.sys.id, asset])).values(),\n ],\n };\n};\n\n/**\n * The CMA client will automatically replace links with entry references.\n * As we're including all referenced pattern entries in usedComponents, this can lead\n * to a circular reference. This function replaces those with plain links inplace (!).\n *\n * @see https://github.com/contentful/contentful.js/issues/377\n */\nconst removeCircularPatternReferences = (experienceEntry, _parentIds) => {\n const parentIds = _parentIds ?? new Set([experienceEntry.sys.id]);\n const usedComponents = experienceEntry.fields.usedComponents;\n const newUsedComponents = usedComponents?.reduce((acc, linkOrEntry) => {\n if (!('fields' in linkOrEntry)) {\n // It is a link, we're good\n return [...acc, linkOrEntry];\n }\n const entry = linkOrEntry;\n if (parentIds.has(entry.sys.id)) {\n // It is an entry that already occurred -> turn it into a link to remove the circularity\n const link = {\n sys: {\n id: entry.sys.id,\n linkType: 'Entry',\n type: 'Link',\n },\n };\n return [...acc, link];\n }\n // Remove circularity for its usedComponents as well (inplace)\n removeCircularPatternReferences(entry, new Set([...parentIds, entry.sys.id]));\n return [...acc, entry];\n }, []);\n // @ts-expect-error - type of usedComponents doesn't yet allow a mixed list of both links and entries\n experienceEntry.fields.usedComponents = newUsedComponents;\n};\n/**\n * The CMA client will automatically replace links with entry references if they are available.\n * While we're not fetching the data sources, a self reference would be replaced as the entry is\n * fetched. Any circuar reference in the object breaks SSR where we have to stringify the JSON.\n * This would fail if the object contains circular references.\n */\nconst removeSelfReferencingDataSource = (experienceEntry) => {\n const dataSources = experienceEntry.fields.dataSource;\n const newDataSource = Object.entries(dataSources).reduce((acc, [key, linkOrEntry]) => {\n if ('fields' in linkOrEntry && linkOrEntry.sys.id === experienceEntry.sys.id) {\n const entry = linkOrEntry;\n acc[key] = {\n sys: {\n id: entry.sys.id,\n linkType: 'Entry',\n type: 'Link',\n },\n };\n }\n else {\n const link = linkOrEntry;\n acc[key] = link;\n }\n return acc;\n }, {});\n experienceEntry.fields.dataSource = newDataSource;\n};\n\n/**\n * Run additional checks on the references used in the experience entry and\n * process data required for prebinding. This must be used after fetching an\n * experience entry.\n *\n * The changes made to the passed experience entry are done inplace.\n **/\nconst prepareExperienceEntry = (experienceEntry) => {\n removeCircularPatternReferences(experienceEntry);\n removeSelfReferencingDataSource(experienceEntry);\n};\n\nconst errorMessagesWhileFetching$1 = {\n experience: 'Failed to fetch experience',\n experienceReferences: 'Failed to fetch entities, referenced in experience',\n};\nconst handleError$1 = (generalMessage, error) => {\n const message = error instanceof Error ? error.message : `Unknown error: ${error}`;\n throw Error(message);\n};\n/**\n * Fetches an experience entry by its slug and additionally fetches all its references to return\n * an initilized experience instance.\n * @param {FetchBySlugParams} options - options to fetch the experience\n */\nasync function fetchBySlug({ client, experienceTypeId, slug, localeCode, isEditorMode, }) {\n // Be a no-op if in editor mode\n if (isEditorMode)\n return;\n let experienceEntry = undefined;\n if (!localeCode) {\n throw new Error('Failed to fetch by slug. Required \"localeCode\" parameter was not provided');\n }\n try {\n experienceEntry = await fetchExperienceEntry({\n client,\n experienceTypeId,\n locale: localeCode,\n identifier: {\n slug,\n },\n });\n if (!experienceEntry) {\n throw new Error(`No experience entry with slug: ${slug} exists`);\n }\n prepareExperienceEntry(experienceEntry);\n try {\n const { entries, assets } = await fetchReferencedEntities({\n client,\n experienceEntry,\n locale: localeCode,\n });\n const experience = createExperience({\n experienceEntry,\n referencedAssets: assets,\n referencedEntries: entries,\n locale: localeCode,\n });\n return experience;\n }\n catch (error) {\n handleError$1(errorMessagesWhileFetching$1.experienceReferences, error);\n }\n }\n catch (error) {\n handleError$1(errorMessagesWhileFetching$1.experience, error);\n }\n}\n\nconst errorMessagesWhileFetching = {\n experience: 'Failed to fetch experience',\n experienceReferences: 'Failed to fetch entities, referenced in experience',\n};\nconst handleError = (generalMessage, error) => {\n const message = error instanceof Error ? error.message : `Unknown error: ${error}`;\n throw Error(message);\n};\n/**\n * Fetches an experience entry by its id and additionally fetches all its references to return\n * an initilized experience instance.\n * @param {FetchByIdParams} options - options to fetch the experience\n */\nasync function fetchById({ client, experienceTypeId, id, localeCode, isEditorMode, }) {\n //Be a no-op if in editor mode\n if (isEditorMode)\n return;\n let experienceEntry = undefined;\n if (!localeCode) {\n throw new Error('Failed to fetch by id. Required \"localeCode\" parameter was not provided');\n }\n try {\n experienceEntry = await fetchExperienceEntry({\n client,\n experienceTypeId,\n locale: localeCode,\n identifier: {\n id,\n },\n });\n if (!experienceEntry) {\n throw new Error(`No experience entry with id: ${id} exists`);\n }\n prepareExperienceEntry(experienceEntry);\n try {\n const { entries, assets } = await fetchReferencedEntities({\n client,\n experienceEntry,\n locale: localeCode,\n });\n const experience = createExperience({\n experienceEntry,\n referencedAssets: assets,\n referencedEntries: entries,\n locale: localeCode,\n });\n return experience;\n }\n catch (error) {\n handleError(errorMessagesWhileFetching.experienceReferences, error);\n }\n }\n catch (error) {\n handleError(errorMessagesWhileFetching.experience, error);\n }\n}\n\nexport { BREAKPOINTS_STRATEGY_DESKTOP_FIRST, BREAKPOINTS_STRATEGY_MOBILE_FIRST, DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createAssemblyDefinition, createExperience, debug, defineBreakpoints, defineDesignTokens, defineSdkOptions, designTokensRegistry, detachExperienceStyles, detectBreakpointsStrategy, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, extractLeafLinksReferencedFromExperience, extractPrebindingDataByPatternId, extractReferencesFromEntries, extractReferencesFromEntriesAsIds, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, flattenNestedPatterns, gatherDeepPrebindingReferencesFromExperienceEntry, gatherDeepPrebindingReferencesFromPatternEntry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateDefaultDataSourceForPrebindingDefinition, generateRandomId, getActiveBreakpointIndex, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getPrebindingPathBySourceEntry, getSdkOptions, getTargetPatternMappingsForParameter, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, inMemoryEntities, inMemoryEntitiesStore, indexByBreakpoint, isArrayOfLinks, isAsset, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isDeepPrebinding, isElementHidden, isEntry, isExperienceEntry, isLink, isLinkToAsset, isLinkToEntry, isPatternComponent, isPatternEntry, isPreboundProp, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, mergeDesignValuesByBreakpoint, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, referencesOf, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sdkOptionsRegistry, sectionBuiltInStyles, sendMessage, setDebugLevel, singleColumnBuiltInStyles, splitDirectAndSlotChildren, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, transformVisibility, treeMap, treeVisit, tryParseMessage, uniqueById, useInMemoryEntities, validateExperienceBuilderConfig };\n//# sourceMappingURL=index.js.map\n",null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["StudioCanvasMode","CONTENTFUL_COMPONENTS","PostMessageMethods"],"mappings":";;;;;;;;;;;;AAAA;AAiEA;AACA;AACA;AACA;AACA;AACA,IAAIA,kBAAgB,CAAC;AACrB,CAAC,UAAU,gBAAgB,EAAE;AAC7B,IAAI,gBAAgB,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC;AACnD,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC;AAC9C,IAAI,gBAAgB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AACtC,CAAC,EAAEA,kBAAgB,KAAKA,kBAAgB,GAAG,EAAE,CAAC,CAAC,CAAC;AAEhD,MAAM,6BAA6B,GAAG,sBAAsB,CAAC;AAC7D,MAAM,2BAA2B,GAAG,YAAY,CAAC;AACjD,MAAMC,uBAAqB,GAAG;AAC9B,IAAI,OAAO,EAAE;AACb,QAAQ,EAAE,EAAE,oBAAoB;AAChC,QAAQ,IAAI,EAAE,SAAS;AACvB,KAAK;AACL,IAAI,SAAS,EAAE;AACf,QAAQ,EAAE,EAAE,sBAAsB;AAClC,QAAQ,IAAI,EAAE,WAAW;AACzB,KAAK;AACL,IAAI,OAAO,EAAE;AACb,QAAQ,EAAE,EAAE,oBAAoB;AAChC,QAAQ,IAAI,EAAE,SAAS;AACvB,KAAK;AACL,IAAI,YAAY,EAAE;AAClB,QAAQ,EAAE,EAAE,0BAA0B;AACtC,QAAQ,IAAI,EAAE,QAAQ;AACtB,KAAK;AACL,IAAI,MAAM,EAAE;AACZ,QAAQ,EAAE,EAAE,mBAAmB;AAC/B,QAAQ,IAAI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QAAQ,CACL,EACN;AACJ;;ACNa,MAAA,kBAAkB,GAAwB;AACrD,IAAA,EAAE,EAAEA,uBAAqB,CAAC,QAAQ,CAAC,EAAE;AACrC,IAAA,IAAI,EAAEA,uBAAqB,CAAC,QAAQ,CAAC,IAAI;AACzC,IAAA,QAAQ,EAAE,2BAA2B;AACrC,IAAA,QAAQ,EAAE,IAAI;AACd,IAAA,aAAa,EAAE;QACb,WAAW;QACX,UAAU;QACV,UAAU;QACV,SAAS;QACT,YAAY;QACZ,gBAAgB;QAChB,mBAAmB;QACnB,UAAU;AACX,KAAA;AACD,IAAA,SAAS,EAAE,EAAE;AACb,IAAA,OAAO,EAAE;AACP,QAAA,WAAW,EAAE,yCAAyC;AACvD,KAAA;;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../core/dist/esm/constants.js","../src/utils/combineClasses.ts","../src/components/Button/Button.tsx","../src/components/Button/index.ts","../src/components/Heading/Heading.tsx","../src/components/Heading/index.ts","../src/components/RichText/RichText.tsx","../src/components/RichText/index.ts","../src/components/Text/Text.tsx","../src/components/Text/index.ts","../src/components/Image/Image.tsx","../src/components/Image/index.ts","../../core/dist/esm/index.js","../src/components/Layout/Flex.tsx","../src/utils/extractRenderProps.ts","../src/components/ContentfulContainer/ContentfulContainerAsHyperlink.tsx","../src/components/ContentfulContainer/ContentfulContainer.tsx","../src/components/ContentfulContainer/index.ts","../src/components/Divider/ContentfulDivider.tsx","../src/components/Divider/index.ts","../src/components/Columns/Columns.tsx","../src/components/Columns/SingleColumn.tsx","../src/components/Columns/index.ts","../src/components/Assembly/Assembly.tsx","../src/components/Carousel/Carousel.tsx","../src/components/Carousel/index.ts"],"sourcesContent":["/** @deprecated will be removed when dropping backward compatibility for old DND */\nconst SCROLL_STATES = {\n Start: 'scrollStart',\n IsScrolling: 'isScrolling',\n End: 'scrollEnd',\n};\nconst OUTGOING_EVENTS = {\n Connected: 'connected',\n DesignTokens: 'registerDesignTokens',\n RegisteredBreakpoints: 'registeredBreakpoints',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n MouseMove: 'mouseMove',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentSelected: 'componentSelected',\n RegisteredComponents: 'registeredComponents',\n RequestComponentTreeUpdate: 'requestComponentTreeUpdate',\n CanvasReload: 'canvasReload',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n UpdateSelectedComponentCoordinates: 'updateSelectedComponentCoordinates',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasScroll: 'canvasScrolling',\n CanvasError: 'canvasError',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n OutsideCanvasClick: 'outsideCanvasClick',\n SDKFeatures: 'sdkFeatures',\n RequestEntities: 'REQUEST_ENTITIES',\n CanvasGeometryUpdated: 'canvasGeometryUpdated',\n CanvasPan: 'canvasPan',\n};\nconst INCOMING_EVENTS = {\n RequestEditorMode: 'requestEditorMode',\n RequestReadOnlyMode: 'requestReadOnlyMode',\n ExperienceUpdated: 'componentTreeUpdated',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDraggingChanged: 'componentDraggingChanged',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragCanceled: 'componentDragCanceled',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragStarted: 'componentDragStarted',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragEnded: 'componentDragEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentMoveEnded: 'componentMoveEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasResized: 'canvasResized',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n SelectComponent: 'selectComponent',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n HoverComponent: 'hoverComponent',\n UpdatedEntity: 'updatedEntity',\n /** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */\n AssembliesAdded: 'assembliesAdded',\n /** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */\n AssembliesRegistered: 'assembliesRegistered',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n MouseMove: 'mouseMove',\n RequestedEntities: 'REQUESTED_ENTITIES',\n};\nconst INTERNAL_EVENTS = {\n ComponentsRegistered: 'cfComponentsRegistered',\n VisualEditorInitialize: 'cfVisualEditorInitialize',\n};\nconst VISUAL_EDITOR_EVENTS = {\n Ready: 'cfVisualEditorReady',\n};\n/**\n * These modes are ONLY intended to be internally used within the context of\n * editing an experience inside of Contentful Studio. i.e. these modes\n * intentionally do not include preview/delivery modes.\n */\nvar StudioCanvasMode;\n(function (StudioCanvasMode) {\n StudioCanvasMode[\"READ_ONLY\"] = \"readOnlyMode\";\n StudioCanvasMode[\"EDITOR\"] = \"editorMode\";\n StudioCanvasMode[\"NONE\"] = \"none\";\n})(StudioCanvasMode || (StudioCanvasMode = {}));\nconst VISUAL_EDITOR_CONTAINER_ID = 'cf-visual-editor';\nconst CONTENTFUL_COMPONENT_CATEGORY = 'contentful-component';\nconst CONTENTFUL_DEFAULT_CATEGORY = 'Contentful';\nconst CONTENTFUL_COMPONENTS = {\n section: {\n id: 'contentful-section',\n name: 'Section',\n },\n container: {\n id: 'contentful-container',\n name: 'Container',\n },\n columns: {\n id: 'contentful-columns',\n name: 'Columns',\n },\n singleColumn: {\n id: 'contentful-single-column',\n name: 'Column',\n },\n button: {\n id: 'contentful-button',\n name: 'Button',\n },\n heading: {\n id: 'contentful-heading',\n name: 'Heading',\n },\n image: {\n id: 'contentful-image',\n name: 'Image',\n },\n richText: {\n id: 'contentful-richText',\n name: 'Rich Text',\n },\n text: {\n id: 'contentful-text',\n name: 'Text',\n },\n divider: {\n id: 'contentful-divider',\n name: 'Divider',\n },\n carousel: {\n id: 'contentful-carousel',\n name: 'Carousel',\n },\n};\nconst ASSEMBLY_NODE_TYPE = 'assembly';\nconst ASSEMBLY_DEFAULT_CATEGORY = 'Assemblies';\nconst ASSEMBLY_BLOCK_NODE_TYPE = 'assemblyBlock';\nconst ASSEMBLY_NODE_TYPES = [ASSEMBLY_NODE_TYPE, ASSEMBLY_BLOCK_NODE_TYPE];\nconst LATEST_SCHEMA_VERSION = '2023-09-28';\nconst CF_STYLE_ATTRIBUTES = [\n 'cfVisibility',\n 'cfHorizontalAlignment',\n 'cfVerticalAlignment',\n 'cfMargin',\n 'cfPadding',\n 'cfBackgroundColor',\n 'cfWidth',\n 'cfMaxWidth',\n 'cfHeight',\n 'cfImageAsset',\n 'cfImageOptions',\n 'cfBackgroundImageUrl',\n 'cfBackgroundImageOptions',\n 'cfFlexDirection',\n 'cfFlexWrap',\n 'cfFlexReverse',\n 'cfBorder',\n 'cfBorderRadius',\n 'cfGap',\n 'cfColumnSpan',\n 'cfColumnSpanLock',\n 'cfColumns',\n 'cfFontSize',\n 'cfFontWeight',\n 'cfLineHeight',\n 'cfLetterSpacing',\n 'cfTextColor',\n 'cfTextAlign',\n 'cfTextTransform',\n 'cfTextBold',\n 'cfTextItalic',\n 'cfTextUnderline',\n];\nconst EMPTY_CONTAINER_SIZE = '80px';\nconst HYPERLINK_DEFAULT_PATTERN = `/{locale}/{entry.fields.slug}/`;\nvar PostMessageMethods;\n(function (PostMessageMethods) {\n PostMessageMethods[\"REQUEST_ENTITIES\"] = \"REQUEST_ENTITIES\";\n PostMessageMethods[\"REQUESTED_ENTITIES\"] = \"REQUESTED_ENTITIES\";\n})(PostMessageMethods || (PostMessageMethods = {}));\nconst SUPPORTED_IMAGE_FORMATS = ['jpg', 'png', 'webp', 'gif', 'avif'];\n\nexport { ASSEMBLY_BLOCK_NODE_TYPE, ASSEMBLY_DEFAULT_CATEGORY, ASSEMBLY_NODE_TYPE, ASSEMBLY_NODE_TYPES, CF_STYLE_ATTRIBUTES, CONTENTFUL_COMPONENTS, CONTENTFUL_COMPONENT_CATEGORY, CONTENTFUL_DEFAULT_CATEGORY, EMPTY_CONTAINER_SIZE, HYPERLINK_DEFAULT_PATTERN, INCOMING_EVENTS, INTERNAL_EVENTS, LATEST_SCHEMA_VERSION, OUTGOING_EVENTS, PostMessageMethods, SCROLL_STATES, SUPPORTED_IMAGE_FORMATS, StudioCanvasMode, VISUAL_EDITOR_CONTAINER_ID, VISUAL_EDITOR_EVENTS };\n//# sourceMappingURL=constants.js.map\n",null,null,null,null,null,null,null,null,null,null,null,"import { z, ZodIssueCode } from 'zod';\nimport cloneDeep from 'lodash.clonedeep';\nimport md5 from 'md5';\nimport { BLOCKS } from '@contentful/rich-text-types';\nimport { create } from 'zustand';\n\n/** @deprecated will be removed when dropping backward compatibility for old DND */\nconst INCOMING_EVENTS = {\n RequestEditorMode: 'requestEditorMode',\n RequestReadOnlyMode: 'requestReadOnlyMode',\n ExperienceUpdated: 'componentTreeUpdated',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDraggingChanged: 'componentDraggingChanged',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragCanceled: 'componentDragCanceled',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragStarted: 'componentDragStarted',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentDragEnded: 'componentDragEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n ComponentMoveEnded: 'componentMoveEnded',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n CanvasResized: 'canvasResized',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n SelectComponent: 'selectComponent',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n HoverComponent: 'hoverComponent',\n UpdatedEntity: 'updatedEntity',\n /** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */\n AssembliesAdded: 'assembliesAdded',\n /** @deprecated not needed after `patternResolution` was introduced. Will be removed in the next major version. */\n AssembliesRegistered: 'assembliesRegistered',\n /** @deprecated will be removed when dropping backward compatibility for old DND */\n MouseMove: 'mouseMove',\n RequestedEntities: 'REQUESTED_ENTITIES',\n};\n/**\n * These modes are ONLY intended to be internally used within the context of\n * editing an experience inside of Contentful Studio. i.e. these modes\n * intentionally do not include preview/delivery modes.\n */\nvar StudioCanvasMode;\n(function (StudioCanvasMode) {\n StudioCanvasMode[\"READ_ONLY\"] = \"readOnlyMode\";\n StudioCanvasMode[\"EDITOR\"] = \"editorMode\";\n StudioCanvasMode[\"NONE\"] = \"none\";\n})(StudioCanvasMode || (StudioCanvasMode = {}));\nconst CONTENTFUL_COMPONENTS = {\n section: {\n id: 'contentful-section',\n name: 'Section',\n },\n container: {\n id: 'contentful-container',\n name: 'Container',\n },\n columns: {\n id: 'contentful-columns',\n name: 'Columns',\n },\n singleColumn: {\n id: 'contentful-single-column',\n name: 'Column',\n },\n button: {\n id: 'contentful-button',\n name: 'Button',\n },\n heading: {\n id: 'contentful-heading',\n name: 'Heading',\n },\n image: {\n id: 'contentful-image',\n name: 'Image',\n },\n richText: {\n id: 'contentful-richText',\n name: 'Rich Text',\n },\n text: {\n id: 'contentful-text',\n name: 'Text',\n },\n divider: {\n id: 'contentful-divider',\n name: 'Divider',\n },\n carousel: {\n id: 'contentful-carousel',\n name: 'Carousel',\n },\n};\nconst ASSEMBLY_NODE_TYPE = 'assembly';\nconst ASSEMBLY_DEFAULT_CATEGORY = 'Assemblies';\nconst ASSEMBLY_BLOCK_NODE_TYPE = 'assemblyBlock';\nconst CF_STYLE_ATTRIBUTES = [\n 'cfVisibility',\n 'cfHorizontalAlignment',\n 'cfVerticalAlignment',\n 'cfMargin',\n 'cfPadding',\n 'cfBackgroundColor',\n 'cfWidth',\n 'cfMaxWidth',\n 'cfHeight',\n 'cfImageAsset',\n 'cfImageOptions',\n 'cfBackgroundImageUrl',\n 'cfBackgroundImageOptions',\n 'cfFlexDirection',\n 'cfFlexWrap',\n 'cfFlexReverse',\n 'cfBorder',\n 'cfBorderRadius',\n 'cfGap',\n 'cfColumnSpan',\n 'cfColumnSpanLock',\n 'cfColumns',\n 'cfFontSize',\n 'cfFontWeight',\n 'cfLineHeight',\n 'cfLetterSpacing',\n 'cfTextColor',\n 'cfTextAlign',\n 'cfTextTransform',\n 'cfTextBold',\n 'cfTextItalic',\n 'cfTextUnderline',\n];\nconst EMPTY_CONTAINER_SIZE = '80px';\nvar PostMessageMethods;\n(function (PostMessageMethods) {\n PostMessageMethods[\"REQUEST_ENTITIES\"] = \"REQUEST_ENTITIES\";\n PostMessageMethods[\"REQUESTED_ENTITIES\"] = \"REQUESTED_ENTITIES\";\n})(PostMessageMethods || (PostMessageMethods = {}));\nconst SUPPORTED_IMAGE_FORMATS = ['jpg', 'png', 'webp', 'gif', 'avif'];\n\nconst structureComponentIds = new Set([\n CONTENTFUL_COMPONENTS.section.id,\n CONTENTFUL_COMPONENTS.columns.id,\n CONTENTFUL_COMPONENTS.container.id,\n CONTENTFUL_COMPONENTS.singleColumn.id,\n]);\nconst patternTypes = new Set([ASSEMBLY_NODE_TYPE, ASSEMBLY_BLOCK_NODE_TYPE]);\nconst allContentfulComponentIds = new Set(Object.values(CONTENTFUL_COMPONENTS).map((component) => component.id));\nconst isPatternComponent = (type) => patternTypes.has(type ?? '');\nconst isContentfulStructureComponent = (componentId) => structureComponentIds.has((componentId ?? ''));\nconst isContentfulComponent = (componentId) => allContentfulComponentIds.has((componentId ?? ''));\nconst isComponentAllowedOnRoot = ({ type, category, componentId }) => isPatternComponent(type) ||\n category === ASSEMBLY_DEFAULT_CATEGORY ||\n isContentfulStructureComponent(componentId) ||\n componentId === CONTENTFUL_COMPONENTS.divider.id;\nconst isStructureWithRelativeHeight = (componentId, height) => {\n return isContentfulStructureComponent(componentId) && !height?.toString().endsWith('px');\n};\n\n// These styles get added to every component, user custom or contentful provided\nconst builtInStyles = {\n cfVerticalAlignment: {\n validations: {\n in: [\n {\n value: 'start',\n displayName: 'Align left',\n },\n {\n value: 'center',\n displayName: 'Align center',\n },\n {\n value: 'end',\n displayName: 'Align right',\n },\n {\n value: 'stretch',\n displayName: 'Stretch',\n },\n ],\n },\n type: 'Text',\n group: 'style',\n defaultValue: 'center',\n displayName: 'Vertical alignment',\n },\n cfHorizontalAlignment: {\n validations: {\n in: [\n {\n value: 'start',\n displayName: 'Align top',\n },\n {\n value: 'center',\n displayName: 'Align center',\n },\n {\n value: 'end',\n displayName: 'Align bottom',\n },\n {\n value: 'stretch',\n displayName: 'Stretch',\n },\n ],\n },\n type: 'Text',\n group: 'style',\n defaultValue: 'center',\n displayName: 'Horizontal alignment',\n },\n cfVisibility: {\n displayName: 'Visibility toggle',\n type: 'Boolean',\n group: 'style',\n defaultValue: true,\n },\n cfMargin: {\n displayName: 'Margin',\n type: 'Text',\n group: 'style',\n defaultValue: '0 0 0 0',\n },\n cfPadding: {\n displayName: 'Padding',\n type: 'Text',\n group: 'style',\n defaultValue: '0 0 0 0',\n },\n cfBackgroundColor: {\n displayName: 'Background color',\n type: 'Text',\n group: 'style',\n defaultValue: 'rgba(0, 0, 0, 0)',\n },\n cfWidth: {\n displayName: 'Width',\n type: 'Text',\n group: 'style',\n defaultValue: '100%',\n },\n cfHeight: {\n displayName: 'Height',\n type: 'Text',\n group: 'style',\n defaultValue: 'fit-content',\n },\n cfMaxWidth: {\n displayName: 'Max width',\n type: 'Text',\n group: 'style',\n defaultValue: 'none',\n },\n cfFlexDirection: {\n displayName: 'Direction',\n type: 'Text',\n group: 'style',\n defaultValue: 'column',\n },\n cfFlexReverse: {\n displayName: 'Reverse Direction',\n type: 'Boolean',\n group: 'style',\n defaultValue: false,\n },\n cfFlexWrap: {\n displayName: 'Wrap objects',\n type: 'Text',\n group: 'style',\n defaultValue: 'nowrap',\n },\n cfBorder: {\n displayName: 'Border',\n type: 'Text',\n group: 'style',\n defaultValue: '0px solid rgba(0, 0, 0, 0)',\n },\n cfGap: {\n displayName: 'Gap',\n type: 'Text',\n group: 'style',\n defaultValue: '0px',\n },\n cfHyperlink: {\n displayName: 'URL',\n type: 'Hyperlink',\n defaultValue: '',\n validations: {\n format: 'URL',\n bindingSourceType: ['entry', 'experience', 'manual'],\n },\n },\n cfOpenInNewTab: {\n displayName: 'URL behaviour',\n type: 'Boolean',\n defaultValue: false,\n description: 'Open in new tab',\n },\n};\nconst optionalBuiltInStyles = {\n cfFontSize: {\n displayName: 'Font Size',\n type: 'Text',\n group: 'style',\n defaultValue: '16px',\n },\n cfFontWeight: {\n validations: {\n in: [\n {\n value: '400',\n displayName: 'Normal',\n },\n {\n value: '500',\n displayName: 'Medium',\n },\n {\n value: '600',\n displayName: 'Semi Bold',\n },\n ],\n },\n displayName: 'Font Weight',\n type: 'Text',\n group: 'style',\n defaultValue: '400',\n },\n cfImageAsset: {\n displayName: 'Image',\n type: 'Media',\n validations: {\n bindingSourceType: ['asset', 'entry', 'manual'],\n },\n },\n cfImageOptions: {\n displayName: 'Image options',\n type: 'Object',\n group: 'style',\n defaultValue: {\n width: '100%',\n height: '100%',\n targetSize: 'unset',\n },\n },\n cfBackgroundColor: {\n displayName: 'Background color',\n type: 'Text',\n group: 'style',\n defaultValue: 'rgba(0, 0, 0, 0)',\n },\n cfBackgroundImageUrl: {\n displayName: 'Background image',\n type: 'Media',\n validations: {\n bindingSourceType: ['asset', 'entry', 'manual'],\n },\n },\n cfBackgroundImageOptions: {\n displayName: 'Background image options',\n type: 'Object',\n group: 'style',\n defaultValue: {\n scaling: 'fill',\n alignment: 'left top',\n targetSize: '2000px',\n },\n },\n cfBorderRadius: {\n displayName: 'Border Radius',\n type: 'Text',\n group: 'style',\n defaultValue: '0px',\n },\n cfLineHeight: {\n displayName: 'Line Height',\n type: 'Text',\n group: 'style',\n defaultValue: '20px',\n },\n cfLetterSpacing: {\n displayName: 'Letter Spacing',\n type: 'Text',\n group: 'style',\n defaultValue: '0px',\n },\n cfTextColor: {\n displayName: 'Text Color',\n type: 'Text',\n group: 'style',\n defaultValue: 'rgba(0, 0, 0, 1)',\n },\n cfTextAlign: {\n validations: {\n in: [\n {\n value: 'start',\n displayName: 'Align start',\n },\n {\n value: 'center',\n displayName: 'Align center',\n },\n {\n value: 'end',\n displayName: 'Align end',\n },\n ],\n },\n displayName: 'Text Align',\n type: 'Text',\n group: 'style',\n defaultValue: 'start',\n },\n cfTextTransform: {\n validations: {\n in: [\n {\n value: 'none',\n displayName: 'Normal',\n },\n {\n value: 'capitalize',\n displayName: 'Capitalize',\n },\n {\n value: 'uppercase',\n displayName: 'Uppercase',\n },\n {\n value: 'lowercase',\n displayName: 'Lowercase',\n },\n ],\n },\n displayName: 'Text Transform',\n type: 'Text',\n group: 'style',\n defaultValue: 'none',\n },\n cfTextBold: {\n displayName: 'Bold',\n type: 'Boolean',\n group: 'style',\n defaultValue: false,\n },\n cfTextItalic: {\n displayName: 'Italic',\n type: 'Boolean',\n group: 'style',\n defaultValue: false,\n },\n cfTextUnderline: {\n displayName: 'Underline',\n type: 'Boolean',\n group: 'style',\n defaultValue: false,\n },\n};\nconst sectionBuiltInStyles = {\n ...builtInStyles,\n cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,\n cfBackgroundImageUrl: optionalBuiltInStyles.cfBackgroundImageUrl,\n cfBackgroundImageOptions: optionalBuiltInStyles.cfBackgroundImageOptions,\n};\nconst containerBuiltInStyles = {\n ...builtInStyles,\n cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,\n cfBackgroundImageUrl: optionalBuiltInStyles.cfBackgroundImageUrl,\n cfBackgroundImageOptions: optionalBuiltInStyles.cfBackgroundImageOptions,\n cfMargin: {\n displayName: 'Margin',\n type: 'Text',\n group: 'style',\n // Note: The UI overwrites '0 Auto 0 Auto' as the default value for top-level containers\n defaultValue: '0 0 0 0',\n },\n cfMaxWidth: {\n displayName: 'Max Width',\n type: 'Text',\n group: 'style',\n defaultValue: '1192px',\n },\n};\nconst dividerBuiltInStyles = {\n cfVisibility: builtInStyles.cfVisibility,\n cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,\n cfMargin: {\n displayName: 'Margin',\n type: 'Text',\n group: 'style',\n defaultValue: '20px 0px 20px 0px',\n },\n cfWidth: {\n displayName: 'Width',\n type: 'Text',\n group: 'style',\n defaultValue: '100%',\n },\n cfHeight: {\n displayName: 'Height',\n type: 'Text',\n group: 'style',\n defaultValue: '1px',\n },\n cfMaxWidth: {\n displayName: 'Max width',\n type: 'Text',\n group: 'style',\n defaultValue: 'none',\n },\n cfBackgroundColor: {\n displayName: 'Background color',\n type: 'Text',\n group: 'style',\n defaultValue: 'rgba(204, 204, 204, 1)',\n },\n};\nconst singleColumnBuiltInStyles = {\n cfVisibility: builtInStyles.cfVisibility,\n cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,\n cfBackgroundColor: optionalBuiltInStyles.cfBackgroundColor,\n cfBackgroundImageUrl: optionalBuiltInStyles.cfBackgroundImageUrl,\n cfBackgroundImageOptions: optionalBuiltInStyles.cfBackgroundImageOptions,\n cfVerticalAlignment: {\n validations: {\n in: [\n {\n value: 'start',\n displayName: 'Align left',\n },\n {\n value: 'center',\n displayName: 'Align center',\n },\n {\n value: 'end',\n displayName: 'Align right',\n },\n {\n value: 'stretch',\n displayName: 'Stretch',\n },\n ],\n },\n type: 'Text',\n group: 'style',\n defaultValue: 'center',\n displayName: 'Vertical alignment',\n },\n cfHorizontalAlignment: {\n validations: {\n in: [\n {\n value: 'start',\n displayName: 'Align top',\n },\n {\n value: 'center',\n displayName: 'Align center',\n },\n {\n value: 'end',\n displayName: 'Align bottom',\n },\n {\n value: 'stretch',\n displayName: 'Stretch',\n },\n ],\n },\n type: 'Text',\n group: 'style',\n defaultValue: 'center',\n displayName: 'Horizontal alignment',\n },\n cfPadding: {\n displayName: 'Padding',\n type: 'Text',\n group: 'style',\n defaultValue: '0 0 0 0',\n },\n cfFlexDirection: {\n displayName: 'Direction',\n type: 'Text',\n group: 'style',\n defaultValue: 'column',\n },\n cfFlexWrap: {\n displayName: 'Wrap objects',\n type: 'Text',\n group: 'style',\n defaultValue: 'nowrap',\n },\n cfBorder: {\n displayName: 'Border',\n type: 'Text',\n group: 'style',\n defaultValue: '0px solid rgba(0, 0, 0, 0)',\n },\n cfGap: {\n displayName: 'Gap',\n type: 'Text',\n group: 'style',\n defaultValue: '0px',\n },\n cfColumnSpan: {\n type: 'Text',\n defaultValue: '6',\n group: 'style',\n },\n cfColumnSpanLock: {\n type: 'Boolean',\n defaultValue: false,\n group: 'style',\n },\n};\nconst columnsBuiltInStyles = {\n cfVisibility: builtInStyles.cfVisibility,\n cfBorderRadius: optionalBuiltInStyles.cfBorderRadius,\n cfBackgroundColor: optionalBuiltInStyles.cfBackgroundColor,\n cfBackgroundImageUrl: optionalBuiltInStyles.cfBackgroundImageUrl,\n cfBackgroundImageOptions: optionalBuiltInStyles.cfBackgroundImageOptions,\n cfMargin: {\n displayName: 'Margin',\n type: 'Text',\n group: 'style',\n // Note: The UI overwrites '0 Auto 0 Auto' as the default value for top-level columns\n defaultValue: '0 0 0 0',\n },\n cfWidth: {\n displayName: 'Width',\n type: 'Text',\n group: 'style',\n defaultValue: '100%',\n },\n cfMaxWidth: {\n displayName: 'Max width',\n type: 'Text',\n group: 'style',\n defaultValue: '1192px',\n },\n cfPadding: {\n displayName: 'Padding',\n type: 'Text',\n group: 'style',\n defaultValue: '10px 10px 10px 10px',\n },\n cfBorder: {\n displayName: 'Border',\n type: 'Text',\n group: 'style',\n defaultValue: '0px solid rgba(0, 0, 0, 0)',\n },\n cfGap: {\n displayName: 'Gap',\n type: 'Text',\n group: 'style',\n defaultValue: '10px 10px',\n },\n cfColumns: {\n type: 'Text',\n defaultValue: '[6,6]',\n group: 'style',\n },\n cfWrapColumns: {\n type: 'Boolean',\n defaultValue: false,\n group: 'style',\n },\n cfWrapColumnsCount: {\n type: 'Text',\n defaultValue: '2',\n group: 'style',\n },\n};\n\nlet designTokensRegistry = {};\n// This function is used to ensure that the composite values are valid since composite values are optional.\n// Therefore only border and in the future text related design tokens are/will be checked in this funciton.\n// Ensuring values for simple key-value design tokens are not neccessary since they are required via typescript.\nconst ensureValidCompositeValues = (designTokenDefinition) => {\n // Text token validation\n if (designTokenDefinition.text) {\n for (const textKey in designTokenDefinition.text) {\n const textValue = designTokenDefinition.text[textKey];\n designTokenDefinition.text[textKey] = {\n emphasis: textValue.emphasis || 'none',\n fontSize: textValue.fontSize || '16px',\n case: textValue.case || 'normal',\n fontWeight: textValue.fontWeight || '400',\n lineHeight: textValue.lineHeight || '20px',\n letterSpacing: textValue.letterSpacing || '0px',\n color: textValue.color || '#000000',\n };\n }\n }\n // Border validation\n if (designTokenDefinition.border) {\n for (const borderKey in designTokenDefinition.border) {\n const borderValue = designTokenDefinition.border[borderKey];\n designTokenDefinition.border[borderKey] = {\n width: borderValue.width || '1px',\n style: borderValue.style || 'solid',\n color: borderValue.color || '#000000',\n };\n }\n }\n return designTokenDefinition;\n};\n/**\n * Register design tokens styling\n * @param designTokenDefinition - {[key:string]: Record<string, string>}\n * @returns void\n */\nconst defineDesignTokens = (designTokenDefinition) => {\n Object.assign(designTokensRegistry, ensureValidCompositeValues(designTokenDefinition));\n};\nconst templateStringRegex = /\\${(\\w.+?)}/g;\nconst getDesignTokenRegistration = (breakpointValue, variableName) => {\n if (!breakpointValue)\n return breakpointValue;\n let resolvedValue = '';\n // Match all parts of the string, including design tokens and other parts\n const parts = breakpointValue.match(/(\\${.+?}|\\S+)/g);\n if (parts) {\n for (const part of parts) {\n const isDesignToken = templateStringRegex.test(part);\n const tokenValue = isDesignToken ? resolveSimpleDesignToken(part, variableName) : part;\n resolvedValue += `${tokenValue} `;\n }\n }\n // Not trimming would end up with a trailing space that breaks the check in `calculateNodeDefaultHeight`\n return resolvedValue.trim();\n};\nconst resolveSimpleDesignToken = (templateString, variableName) => {\n const nonTemplateValue = templateString.replace(templateStringRegex, '$1');\n const [tokenCategory, tokenName] = nonTemplateValue.split('.');\n const tokenValues = designTokensRegistry[tokenCategory];\n if (tokenValues && tokenValues[tokenName]) {\n if (variableName === 'cfBorder') {\n const { width, style, color } = tokenValues[tokenName];\n return `${width} ${style} ${color}`;\n }\n return tokenValues[tokenName];\n }\n if (builtInStyles[variableName]) {\n return builtInStyles[variableName].defaultValue;\n }\n if (optionalBuiltInStyles[variableName]) {\n return optionalBuiltInStyles[variableName].defaultValue;\n }\n return '0px';\n};\n// Used in unit tests to reset the design token registry\nconst resetDesignTokenRegistry = () => {\n designTokensRegistry = {};\n};\n\n// If more than one version is supported, use z.union\nconst SchemaVersions = z.literal('2023-09-28');\n// Keep deprecated versions here just for reference\nz.union([\n z.literal('2023-08-23'),\n z.literal('2023-07-26'),\n z.literal('2023-06-27'),\n]);\n\nconst DefinitionPropertyTypeSchema = z.enum([\n 'Text',\n 'RichText',\n 'Number',\n 'Date',\n 'Boolean',\n 'Location',\n 'Media',\n 'Object',\n 'Hyperlink',\n 'Array',\n 'Link',\n]);\nconst DefinitionPropertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,32}$/, { message: 'Property needs to match: /^[a-zA-Z0-9-_]{1,32}$/' });\nconst PrimitiveValueSchema = z.union([\n z.string(),\n z.boolean(),\n z.number(),\n z.record(z.any(), z.any()),\n z.undefined(),\n]);\nconst UsedComponentsSchema = z.array(z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.literal('Entry'),\n }),\n}));\nconst uuidKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,21}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,21}$/' });\nconst DataSourceSchema = z.record(uuidKeySchema, z.object({\n sys: z.object({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry', 'Asset']),\n }),\n}));\nconst UnboundValuesSchema = z.record(uuidKeySchema, z.object({\n value: PrimitiveValueSchema,\n}));\n/**\n * Property keys for imported components have a limit of 32 characters (to be implemented) while\n * property keys for patterns have a limit of 54 characters (<32-char-variable-name>_<21-char-nanoid-id>).\n * Because we cannot distinguish between the two in the componentTree, we will use the larger limit for both.\n */\nconst propertyKeySchema = z\n .string()\n .regex(/^[a-zA-Z0-9-_]{1,54}$/, { message: 'Does not match /^[a-zA-Z0-9-_]{1,54}$/' });\nconst ComponentTreeNodeIdSchema = z\n .string()\n .regex(/^[a-zA-Z0-9]{1,8}$/, { message: 'Does not match /^[a-zA-Z0-9]{1,8}$/' });\nconst breakpointsRefinement = (value, ctx) => {\n if (!value.length || value[0].query !== '*') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The first breakpoint should include the following attributes: { \"query\": \"*\" }`,\n });\n return;\n }\n // Return early if there's only one generic breakpoint\n const hasNoBreakpointsStrategy = value.length === 1;\n if (hasNoBreakpointsStrategy) {\n return;\n }\n // Check if any breakpoint id occurs twice\n const ids = value.map((breakpoint) => breakpoint.id);\n const hasDuplicateIds = new Set(ids).size !== ids.length;\n if (hasDuplicateIds) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint IDs must be unique`,\n });\n return;\n }\n // Skip the first one which is guaranteed to be a wildcard query\n const nonBaseBreakpoints = value.slice(1);\n const isMobileFirstStrategy = nonBaseBreakpoints[0].query.startsWith('>');\n const isDesktopFirstStrategy = nonBaseBreakpoints[0].query.startsWith('<');\n if (isMobileFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('>'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \">[size]px\" for mobile-first strategy`,\n });\n }\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n // Starting with the third breakpoint, check that every query is higher than the one above\n const isIncreasing = queries.every((value, index, array) => index === 0 || value > array[index - 1]);\n if (!isIncreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a mobile-first strategy, all breakpoints must have strictly increasing pixel values`,\n });\n }\n }\n else if (isDesktopFirstStrategy) {\n const areOperatorsEqual = nonBaseBreakpoints.every(({ query }) => query.startsWith('<'));\n if (!areOperatorsEqual) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Breakpoint queries must be in the format \"<[size]px\" for desktop-first strategy`,\n });\n }\n // Extract the queries boundary by removing the special characters around it\n const queries = nonBaseBreakpoints.map((bp) => parseInt(bp.query.replace(/px|<|>/, '')));\n // Starting with the third breakpoint, check that every query is lower than the one above\n const isDecreasing = queries.every((value, index, array) => index === 0 || value < array[index - 1]);\n if (!isDecreasing) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `When using a desktop-first strategy, all breakpoints must have strictly decreasing pixel values`,\n });\n }\n }\n else if (!isMobileFirstStrategy && !isDesktopFirstStrategy) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `You may only use a mobile-first or desktop-first strategy for breakpoints using '<' or '>' queries`,\n });\n }\n};\nconst ValuesByBreakpointSchema = z.record(z.lazy(() => PrimitiveValueSchema));\nconst BindingSourceTypeEnumSchema = z\n .array(z.enum(['entry', 'asset', 'manual', 'experience']))\n .nonempty();\nconst DesignValueSchema = z\n .object({\n type: z.literal('DesignValue'),\n valuesByBreakpoint: ValuesByBreakpointSchema,\n})\n .strict();\nconst BoundValueSchema = z\n .object({\n type: z.literal('BoundValue'),\n path: z.string(),\n})\n .strict();\nconst HyperlinkValueSchema = z\n .object({\n type: z.literal('HyperlinkValue'),\n linkTargetKey: z.string(),\n /** Allows to override parts of the URL, e.g. the locale */\n overrides: z.object({}).optional(),\n})\n .strict();\nconst UnboundValueSchema = z\n .object({\n type: z.literal('UnboundValue'),\n key: z.string(),\n})\n .strict();\nconst ComponentValueSchema = z\n .object({\n type: z.literal('ComponentValue'),\n key: z.string(),\n})\n .strict();\nconst NoValueSchema = z.object({ type: z.literal('NoValue') }).strict();\nconst ComponentPropertyValueSchema = z.discriminatedUnion('type', [\n DesignValueSchema,\n BoundValueSchema,\n UnboundValueSchema,\n HyperlinkValueSchema,\n ComponentValueSchema,\n NoValueSchema,\n]);\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nconst ParameterSchema = z.object({\n type: z.literal('BoundValue'),\n path: z.string(),\n});\nconst ParametersSchema = z.record(propertyKeySchema, ParameterSchema);\nconst BREAKPOINT_QUERY_REGEX = /^\\*$|^[<>][0-9]+px$/;\nconst BreakpointSchema = z\n .object({\n id: propertyKeySchema,\n // Can be replaced with z.templateLiteral when upgrading to zod v4\n query: z.string().refine((s) => BREAKPOINT_QUERY_REGEX.test(s)),\n previewSize: z.string().optional(),\n displayName: z.string(),\n displayIcon: z.enum(['desktop', 'tablet', 'mobile']).optional(),\n})\n .strict();\n// Use helper schema to define a recursive schema with its type correctly below\nconst BaseComponentTreeNodeSchema = z.object({\n id: ComponentTreeNodeIdSchema.optional(),\n definitionId: DefinitionPropertyKeySchema,\n prebindingId: z.string().optional(),\n displayName: z.string().optional(),\n slotId: z.string().optional(),\n variables: z.record(propertyKeySchema, ComponentPropertyValueSchema),\n parameters: ParametersSchema.optional(),\n});\nconst ComponentVariableSchema = z.object({\n displayName: z.string().optional(),\n type: DefinitionPropertyTypeSchema,\n description: z.string().optional(),\n group: z.string().optional(),\n defaultValue: PrimitiveValueSchema.or(ComponentPropertyValueSchema).optional(),\n validations: z\n .object({\n bindingSourceType: BindingSourceTypeEnumSchema.optional(),\n required: z.boolean().optional(),\n format: z.literal('URL').optional(),\n in: z\n .array(z.object({\n value: z.union([z.string(), z.number()]),\n displayName: z.string().optional(),\n }))\n .optional(),\n })\n .optional(),\n});\nconst ComponentTreeNodeSchema = BaseComponentTreeNodeSchema.extend({\n children: z.lazy(() => ComponentTreeNodeSchema.array()),\n}).superRefine(({ id, prebindingId, parameters }, ctx) => {\n // We don't fail if parameters are present but prebindingId is not because\n // older experiences (updated before 21-09-2025) always included parameters\n // and they will start failing if we do.\n if (prebindingId && !parameters) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found \"prebindingId\" but no \"parameters\" for node with id: \"${id}\"`,\n });\n }\n});\nconst ComponentTreeSchema = z\n .object({\n breakpoints: z.array(BreakpointSchema).superRefine(breakpointsRefinement),\n children: z.array(ComponentTreeNodeSchema),\n schemaVersion: SchemaVersions,\n})\n .strict();\nconst localeWrapper = (fieldSchema) => z.record(z.string(), fieldSchema);\n\nz.object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n});\n\nfunction treeVisit$1(initialNode, onNode) {\n const _treeVisit = (currentNode) => {\n const children = [...currentNode.children];\n onNode(currentNode);\n for (const child of children) {\n _treeVisit(child);\n }\n };\n if (Array.isArray(initialNode)) {\n for (const node of initialNode) {\n _treeVisit(node);\n }\n }\n else {\n _treeVisit(initialNode);\n }\n}\n\nconst MAX_ALLOWED_PATHS = 200;\nconst THUMBNAIL_IDS = [\n 'columns',\n 'columnsPlusRight',\n 'imagesSquare',\n 'subtitles',\n 'rowsPlusBottom',\n 'userRectangle',\n 'textbox',\n 'monitorPlay',\n 'article',\n 'table',\n 'star',\n 'heartStraight',\n 'frameCorners',\n 'rows',\n 'dotsThreeOutline',\n 'listDashes',\n 'checkerBoard',\n 'gridFour',\n 'slideshow',\n 'diamondsFour',\n 'cards',\n 'textColumns',\n 'duplex',\n];\n// TODO: finalize schema structure before release\n// https://contentful.atlassian.net/browse/LUMOS-523\nconst VariableMappingSchema = z.object({\n parameterId: propertyKeySchema,\n type: z.literal('ContentTypeMapping'),\n pathsByContentType: z\n .record(z.string(), z.object({ path: z.string() }))\n .superRefine((paths, ctx) => {\n const variableId = ctx.path[ctx.path.length - 2];\n if (Object.keys(paths).length > MAX_ALLOWED_PATHS) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Too many paths defined for variable mapping with id \"${variableId}\", maximum allowed is ${MAX_ALLOWED_PATHS}`,\n });\n }\n }),\n});\nconst PassToNodeSchema = z\n .object({\n nodeId: propertyKeySchema,\n parameterId: propertyKeySchema,\n prebindingId: propertyKeySchema,\n})\n .strict();\nconst ParameterDefinitionSchema = z.object({\n defaultSource: z\n .strictObject({\n type: z.enum(['Entry']),\n contentTypeId: z.string(),\n link: z.strictObject({\n sys: z.strictObject({\n type: z.literal('Link'),\n id: z.string(),\n linkType: z.enum(['Entry']),\n }),\n }),\n })\n .optional(),\n contentTypes: z.array(z.string()).min(1),\n passToNodes: z\n .array(PassToNodeSchema)\n .max(1, 'At most one \"passToNodes\" element is allowed per parameter definition.'),\n});\nconst ParameterDefinitionsSchema = z.record(propertyKeySchema, ParameterDefinitionSchema);\nconst VariableMappingsSchema = z.record(propertyKeySchema, VariableMappingSchema);\nconst ComponentVariablesSchema = z.record(z.string().regex(/^[a-zA-Z0-9-_]{1,54}$/), // Here the key is <variableName>_<nanoidId> so we need to allow for a longer length\nComponentVariableSchema);\nconst PrebindingDefinitionSchema = z\n .object({\n id: propertyKeySchema,\n parameterDefinitions: ParameterDefinitionsSchema,\n variableMappings: VariableMappingsSchema.optional(),\n allowedVariableOverrides: z.array(z.string()).optional(),\n})\n .strict();\nconst ComponentSettingsSchema = z\n .object({\n variableDefinitions: ComponentVariablesSchema,\n thumbnailId: z.enum(THUMBNAIL_IDS).optional(),\n category: z.string().max(50, 'Category must contain at most 50 characters').optional(),\n prebindingDefinitions: z.array(PrebindingDefinitionSchema).length(1).optional(),\n})\n .strict()\n .superRefine((componentSettings, ctx) => {\n const { variableDefinitions, prebindingDefinitions } = componentSettings;\n if (!prebindingDefinitions || prebindingDefinitions.length === 0) {\n return;\n }\n const { parameterDefinitions, variableMappings, allowedVariableOverrides } = prebindingDefinitions[0];\n validateAtMostOneNativeParameterDefinition(parameterDefinitions, ctx);\n validateNoOverlapBetweenMappingAndOverrides(variableMappings, allowedVariableOverrides, ctx);\n validateMappingsAgainstVariableDefinitions(variableMappings, allowedVariableOverrides, variableDefinitions, ctx);\n validateMappingsAgainstParameterDefinitions(variableMappings, parameterDefinitions, ctx);\n});\nz\n .object({\n componentTree: localeWrapper(ComponentTreeSchema),\n dataSource: localeWrapper(DataSourceSchema),\n unboundValues: localeWrapper(UnboundValuesSchema),\n usedComponents: localeWrapper(UsedComponentsSchema).optional(),\n componentSettings: localeWrapper(ComponentSettingsSchema),\n})\n .superRefine((patternFields, ctx) => {\n const { componentTree, componentSettings } = patternFields;\n // values at this point are wrapped under locale code\n const nonLocalisedComponentTree = Object.values(componentTree)[0];\n const nonLocalisedComponentSettings = Object.values(componentSettings)[0];\n if (!nonLocalisedComponentSettings || !nonLocalisedComponentTree) {\n return;\n }\n validatePassToNodes(nonLocalisedComponentTree.children || [], nonLocalisedComponentSettings || {}, ctx);\n});\nconst validateAtMostOneNativeParameterDefinition = (parameterDefinitions, ctx) => {\n const nativeParamDefinitions = Object.values(parameterDefinitions).filter((paramDefinition) => !(paramDefinition.passToNodes && paramDefinition.passToNodes.length > 0));\n if (nativeParamDefinitions.length > 1) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Only one native parameter definition (parameter definition without passToNodes) is allowed per prebinding definition.`,\n });\n }\n};\nconst validateNoOverlapBetweenMappingAndOverrides = (variableMappings, allowedVariableOverrides, ctx) => {\n const variableMappingKeys = Object.keys(variableMappings || {});\n const overridesSet = new Set(allowedVariableOverrides || []);\n const overlap = variableMappingKeys.filter((key) => overridesSet.has(key));\n if (overlap.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Found both variable mapping and allowed override for the following keys: ${overlap.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\nconst validateMappingsAgainstVariableDefinitions = (variableMappings, allowedVariableOverrides, variableDefinitions, ctx) => {\n const nonDesignVariableDefinitionKeys = Object.entries(variableDefinitions)\n .filter(([_, def]) => def.group !== 'style')\n .map(([key]) => key);\n const variableMappingKeys = Object.keys(variableMappings || {});\n const allKeys = [...variableMappingKeys, ...(allowedVariableOverrides || [])];\n const invalidMappings = allKeys.filter((key) => !nonDesignVariableDefinitionKeys.includes(key));\n if (invalidMappings.length > 0) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following variable mappings or overrides are missing from the variable definitions: ${invalidMappings.map((key) => `\"${key}\"`).join(', ')}.`,\n });\n }\n};\nconst validateMappingsAgainstParameterDefinitions = (variableMappings, parameterDefinitions, ctx) => {\n const parameterDefinitionKeys = Object.keys(parameterDefinitions || {});\n for (const [mappingKey, mappingValue] of Object.entries(variableMappings || {})) {\n if (!parameterDefinitionKeys.includes(mappingValue.parameterId)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The variable mapping with id \"${mappingKey}\" references a non-existing parameterId \"${mappingValue.parameterId}\".`,\n });\n }\n }\n};\nconst validatePassToNodes = (rootChildren, componentSettings, ctx) => {\n if (!componentSettings.prebindingDefinitions ||\n componentSettings.prebindingDefinitions.length === 0) {\n return;\n }\n const { parameterDefinitions } = componentSettings.prebindingDefinitions[0];\n const nodeIds = new Set();\n for (const paramDef of Object.values(parameterDefinitions || {})) {\n paramDef.passToNodes?.forEach((n) => nodeIds.add(n.nodeId));\n }\n treeVisit$1(rootChildren, (node) => {\n if (!node.id)\n return;\n if (nodeIds.has(node.id)) {\n nodeIds.delete(node.id);\n }\n });\n if (nodeIds.size > 0) {\n const stringifiedNodeIds = Array.from(nodeIds)\n .map((id) => `\"${id}\"`)\n .join(', ');\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `The following node IDs referenced in passToNodes are not present in the component tree: ${stringifiedNodeIds}.`,\n });\n }\n};\n\nz\n .object({\n id: DefinitionPropertyKeySchema,\n name: z.string(),\n category: z.string().optional(),\n thumbnailUrl: z.string().optional(),\n thumbnailId: z.string().optional(),\n hyperlinkPattern: z.string().optional(),\n children: z.boolean().optional(),\n slots: z\n .record(DefinitionPropertyKeySchema, z.object({ displayName: z.string().optional() }))\n .optional(),\n builtInStyles: z.array(z.string()).optional(),\n tooltip: z.object({ imageUrl: z.string().optional(), description: z.string() }).optional(),\n variables: z.record(DefinitionPropertyKeySchema, ComponentVariableSchema.extend({\n defaultValue: PrimitiveValueSchema.optional(),\n }).superRefine((val, ctx) => {\n switch (val.type) {\n case 'Array':\n if (typeof val.defaultValue !== 'undefined') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Array\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Boolean':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'boolean') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a boolean when type is \"Boolean\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Date':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Date\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Hyperlink':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Hyperlink\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Link':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue is not supported for \"Link\" type for ${ctx.path.join('.')}`,\n fatal: false,\n });\n }\n break;\n case 'Location':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Location\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Media':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Media\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Number':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'number') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a number when type is \"Number\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Object':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"Object\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'RichText':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'object') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be an object when type is \"RichText\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n case 'Text':\n if (typeof val.defaultValue !== 'undefined' && typeof val.defaultValue !== 'string') {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `defaultValue must be a string when type is \"Text\" for ${ctx.path.join('.')}, got ${typeof val.defaultValue} instead`,\n fatal: false,\n });\n }\n break;\n }\n })),\n})\n .superRefine((val, ctx) => {\n if (val.children === true && (!!val.variables.children || !!val.slots?.children)) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Cannot activate 'children: true' and name a variable or slot 'children' at the same time`,\n fatal: false,\n });\n }\n // Ensure that slots and variables don't use the same names\n if (val.variables && val.slots) {\n Object.keys(val.variables).forEach((name) => {\n if (val.slots[name]) {\n ctx.addIssue({\n code: z.ZodIssueCode.custom,\n message: `Variable and slot cannot have the same name: ${name}`,\n fatal: false,\n });\n }\n });\n }\n});\n\nvar CodeNames;\n(function (CodeNames) {\n CodeNames[\"Type\"] = \"type\";\n CodeNames[\"Required\"] = \"required\";\n CodeNames[\"Unexpected\"] = \"unexpected\";\n CodeNames[\"Regex\"] = \"regex\";\n CodeNames[\"In\"] = \"in\";\n CodeNames[\"Size\"] = \"size\";\n CodeNames[\"Custom\"] = \"custom\";\n})(CodeNames || (CodeNames = {}));\nconst convertInvalidType = (issue) => {\n const name = issue.received === 'undefined' ? CodeNames.Required : CodeNames.Type;\n const details = issue.received === 'undefined'\n ? `The property \"${issue.path.slice(-1)}\" is required here`\n : `The type of \"${issue.path.slice(-1)}\" is incorrect, expected type: ${issue.expected}`;\n return {\n details: details,\n name: name,\n path: issue.path,\n value: issue.received.toString(),\n };\n};\nconst convertUnrecognizedKeys = (issue) => {\n const missingProperties = issue.keys.map((k) => `\"${k}\"`).join(', ');\n return {\n details: issue.keys.length > 1\n ? `The properties ${missingProperties} are not expected`\n : `The property ${missingProperties} is not expected`,\n name: CodeNames.Unexpected,\n path: issue.path,\n };\n};\nconst convertInvalidString = (issue) => {\n return {\n details: issue.message || 'Invalid string',\n name: issue.validation === 'regex' ? CodeNames.Regex : CodeNames.Unexpected,\n path: issue.path,\n };\n};\nconst convertInvalidEnumValue = (issue) => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received.toString(),\n expected: issue.options,\n };\n};\nconst convertInvalidLiteral = (issue) => {\n return {\n details: issue.message || 'Value must be one of expected values',\n name: CodeNames.In,\n path: issue.path,\n value: issue.received,\n expected: [issue.expected],\n };\n};\nconst convertTooBig = (issue) => {\n return {\n details: issue.message || `Size should be at most ${issue.maximum}`,\n name: CodeNames.Size,\n path: issue.path,\n max: issue.maximum,\n };\n};\nconst convertTooSmall = (issue) => {\n return {\n details: issue.message || `Size should be at least ${issue.minimum}`,\n name: CodeNames.Size,\n path: issue.path,\n min: issue.minimum,\n };\n};\nconst defaultConversion = (issue) => {\n return {\n details: issue.message || 'An unexpected error occurred',\n name: CodeNames.Custom,\n path: issue.path.map(String),\n };\n};\nconst zodToContentfulError = (issue) => {\n switch (issue.code) {\n case ZodIssueCode.invalid_type:\n return convertInvalidType(issue);\n case ZodIssueCode.unrecognized_keys:\n return convertUnrecognizedKeys(issue);\n case ZodIssueCode.invalid_enum_value:\n return convertInvalidEnumValue(issue);\n case ZodIssueCode.invalid_string:\n return convertInvalidString(issue);\n case ZodIssueCode.too_small:\n return convertTooSmall(issue);\n case ZodIssueCode.too_big:\n return convertTooBig(issue);\n case ZodIssueCode.invalid_literal:\n return convertInvalidLiteral(issue);\n default:\n return defaultConversion(issue);\n }\n};\n\nconst validateBreakpointsDefinition = (breakpoints) => {\n const result = z\n .array(BreakpointSchema)\n .superRefine(breakpointsRefinement)\n .safeParse(breakpoints);\n if (!result.success) {\n return {\n success: false,\n errors: result.error.issues.map(zodToContentfulError),\n };\n }\n return { success: true };\n};\n\nconst breakpointsRegistry = [];\n/**\n * Define custom breakpoints that should be used for all your experiences.\n * A breakpoint consists of:\n * - id: a unique identifier for this breakpoint\n * - query: a media query string that defines when this breakpoint is active\n * - previewSize: an optional fixed preview size to be used in the Studio editor when selecting this breakpoint\n * - displayName: the name to be displayed in the Studio editor for this breakpoint\n * - displayIcon: an optional icon to be displayed in the Studio editor for this breakpoint\n *\n * The first breakpoint must use a wildcard query (`*`) to match all sizes.\n *\n * Every subsequent breakpoint inherits the designs of the previous ones by default.\n *\n * The order of breakpoints must be either:\n * - desktop first: from largest to smallest, using `<` operators\n * - mobile first: from smallest to largest, using `>` operators\n *\n * @note changing breakpoints after you have created experiences may break those experiences\n * @example\n * defineBreakpoints([{\n * id: 'desktop',\n * query: '*',\n * displayName: 'Desktop',\n * displayIcon: 'desktop',\n * }, {\n * id: 'tablet',\n * query: '<992px',\n * displayName: 'Tablet',\n * displayIcon: 'tablet',\n * }, {\n * id: 'mobile',\n * query: '<576px',\n * displayName: 'Mobile',\n * displayIcon: 'mobile',\n * }]);\n */\nconst defineBreakpoints = (breakpoints) => {\n Object.assign(breakpointsRegistry, breakpoints);\n};\nconst runBreakpointsValidation = () => {\n if (!breakpointsRegistry.length)\n return;\n const validation = validateBreakpointsDefinition(breakpointsRegistry);\n if (!validation.success) {\n throw new Error(`Invalid breakpoints definition. Failed with errors: \\n${JSON.stringify(validation.errors, null, 2)}`);\n }\n};\n\nconst sdkOptionsRegistry = {};\n/**\n * Used inside defineComponents to forward registry arguments to this registry\n * of SDK options.\n */\nconst defineSdkOptions = (options) => {\n Object.assign(sdkOptionsRegistry, options);\n};\nconst getSdkOptions = () => {\n return { ...sdkOptionsRegistry };\n};\n\nconst MEDIA_QUERY_REGEXP = /(<|>)(\\d{1,})(px|cm|mm|in|pt|pc)$/;\nconst toCSSMediaQuery = ({ query }) => {\n if (query === '*')\n return undefined;\n const match = query.match(MEDIA_QUERY_REGEXP);\n if (!match)\n return undefined;\n const [, operator, value, unit] = match;\n if (operator === '<') {\n const maxScreenWidth = Number(value) - 1;\n return `(max-width: ${maxScreenWidth}${unit})`;\n }\n else if (operator === '>') {\n const minScreenWidth = Number(value) + 1;\n return `(min-width: ${minScreenWidth}${unit})`;\n }\n return undefined;\n};\n// Remove this helper when upgrading to TypeScript 5.0 - https://github.com/microsoft/TypeScript/issues/48829\nconst findLast = (array, predicate) => {\n return [...array].reverse().find(predicate);\n};\n// Initialise media query matchers. This won't include the always matching fallback breakpoint.\nconst mediaQueryMatcher = (breakpoints) => {\n const mediaQueryMatches = {};\n const mediaQueryMatchers = breakpoints\n .map((breakpoint) => {\n const cssMediaQuery = toCSSMediaQuery(breakpoint);\n if (!cssMediaQuery)\n return undefined;\n if (typeof window === 'undefined')\n return undefined;\n const mediaQueryMatcher = window.matchMedia(cssMediaQuery);\n mediaQueryMatches[breakpoint.id] = mediaQueryMatcher.matches;\n return { id: breakpoint.id, signal: mediaQueryMatcher };\n })\n .filter((matcher) => !!matcher);\n return [mediaQueryMatchers, mediaQueryMatches];\n};\nconst getActiveBreakpointIndex = (breakpoints, mediaQueryMatches, fallbackBreakpointIndex) => {\n // The breakpoints are ordered (desktop-first: descending by screen width, mobile-first: ascending by screen width).\n const breakpointsWithMatches = breakpoints.map(({ id }, index) => ({\n id,\n index,\n // The fallback breakpoint with wildcard query will always match\n isMatch: mediaQueryMatches[id] ?? index === fallbackBreakpointIndex,\n }));\n // Find the last breakpoint in the list that matches (desktop-first: the narrowest one, mobile-first: the widest one)\n const mostSpecificIndex = findLast(breakpointsWithMatches, ({ isMatch }) => isMatch)?.index;\n return mostSpecificIndex ?? fallbackBreakpointIndex;\n};\nconst getFallbackBreakpointIndex = (breakpoints) => {\n // The validation ensures that there will be exactly one breakpoint using the wildcard query.\n // If there is none, we just take the first one in the list.\n return Math.max(breakpoints.findIndex(({ query }) => query === '*'), 0);\n};\nconst builtInStylesWithDesignTokens = [\n 'cfMargin',\n 'cfPadding',\n 'cfGap',\n 'cfWidth',\n 'cfHeight',\n 'cfBackgroundColor',\n 'cfBorder',\n 'cfBorderRadius',\n 'cfFontSize',\n 'cfLineHeight',\n 'cfLetterSpacing',\n 'cfTextColor',\n 'cfMaxWidth',\n];\nconst isValidBreakpointValue = (value) => {\n return value !== undefined && value !== null && value !== '';\n};\nconst getValueForBreakpoint = (valuesByBreakpoint, breakpoints, activeBreakpointIndex, fallbackBreakpointIndex, \n/** Provide the name for built-in styles to replace design tokens. Supported properties are:\n * cfMargin, cfPadding, cfGap, cfWidth, cfHeight, cfBackgroundColor,\n * cfBorder, cfBorderRadius, cfFontSize, cfLineHeight, cfLetterSpacing,\n * cfTextColor, cfMaxWidth\n */\npropertyName, resolveDesignTokens = true) => {\n const eventuallyResolveDesignTokens = (value) => {\n // This is used externally in the web app to determine the original persisted value\n if (!resolveDesignTokens) {\n return value;\n }\n // For some built-in design properties, we support design tokens\n if (propertyName && builtInStylesWithDesignTokens.includes(propertyName)) {\n return getDesignTokenRegistration(value, propertyName);\n }\n // For all other properties, we just return the breakpoint-specific value\n return value;\n };\n if (valuesByBreakpoint instanceof Object) {\n // Assume that the values are sorted by media query to apply the cascading CSS logic\n for (let index = activeBreakpointIndex; index >= 0; index--) {\n const breakpointId = breakpoints[index]?.id;\n if (isValidBreakpointValue(valuesByBreakpoint[breakpointId])) {\n // If the value is defined, we use it and stop the breakpoints cascade\n return eventuallyResolveDesignTokens(valuesByBreakpoint[breakpointId]);\n }\n }\n const fallbackBreakpointId = breakpoints[fallbackBreakpointIndex]?.id;\n if (isValidBreakpointValue(valuesByBreakpoint[fallbackBreakpointId])) {\n return eventuallyResolveDesignTokens(valuesByBreakpoint[fallbackBreakpointId]);\n }\n }\n else {\n // Old design properties did not support breakpoints, keep for backward compatibility\n return valuesByBreakpoint;\n }\n};\n/** Overwrites the default value breakpoint by breakpoint. If a breakpoint\n * is not overwritten, it will fall back to the default. */\nfunction mergeDesignValuesByBreakpoint(defaultValue, overwriteValue) {\n if (!defaultValue || !overwriteValue) {\n return defaultValue ?? overwriteValue;\n }\n const mergedValuesByBreakpoint = { ...defaultValue.valuesByBreakpoint };\n for (const [breakpointId, value] of Object.entries(overwriteValue.valuesByBreakpoint)) {\n if (!isValidBreakpointValue(value)) {\n continue;\n }\n mergedValuesByBreakpoint[breakpointId] = value;\n }\n return {\n type: 'DesignValue',\n valuesByBreakpoint: mergedValuesByBreakpoint,\n };\n}\nconst BREAKPOINTS_STRATEGY_DESKTOP_FIRST = 'desktop-first';\nconst BREAKPOINTS_STRATEGY_MOBILE_FIRST = 'mobile-first';\n/**\n * Detects the breakpoint strategy based on the provided breakpoints.\n *\n * @param breakpoints The array of breakpoints to analyze.\n * @returns The detected breakpoint strategy or undefined if not determinable.\n */\nconst detectBreakpointsStrategy = (breakpoints) => {\n if (breakpoints.length < 2) {\n return undefined;\n }\n const hasMobileFirst = breakpoints.slice(1).every((bp) => bp.query.startsWith('>'));\n if (hasMobileFirst) {\n return BREAKPOINTS_STRATEGY_MOBILE_FIRST;\n }\n const hasDesktopFirst = breakpoints.slice(1).every((bp) => bp.query.startsWith('<'));\n if (hasDesktopFirst) {\n return BREAKPOINTS_STRATEGY_DESKTOP_FIRST;\n }\n return undefined;\n};\n\nconst CF_DEBUG_KEY = 'cf_debug';\n/**\n * To ensure that the localStorage API can be used safely, we check\n * for availability (e.g. undefined in Node.js). Additionally, we\n * check if the localStorage can be used as some browsers throw a\n * SecurityError (e.g. Brave or Chromium with specific settings).\n */\nconst checkLocalStorageAvailability = () => {\n try {\n // Even the typeof check can throw an error in an agressive browser like Brave (requires using the deprecated flag #block-all-cookies-toggle)\n if (typeof localStorage === 'undefined' || localStorage === null) {\n return false;\n }\n // Attempt to set and remove an item to check if localStorage is enabled\n const TEST_KEY = 'cf_test_local_storage';\n localStorage.setItem(TEST_KEY, 'yes');\n if (localStorage.getItem(TEST_KEY) === 'yes') {\n localStorage.removeItem(TEST_KEY);\n return true;\n }\n else {\n return false;\n }\n }\n catch (_error) {\n return false;\n }\n};\nconst DEBUG_LEVELS_HIERARCHY = ['error', 'warn', 'log', 'debug'];\nclass DebugLogger {\n constructor() {\n this.activeLevel = 'warn';\n // Public methods for logging\n this.error = this.logger('error');\n this.warn = this.logger('warn');\n this.log = this.logger('log');\n this.debug = this.logger('debug');\n if (!checkLocalStorageAvailability()) {\n return;\n }\n // Default to checking localStorage for the debug mode on initialization if in browser\n if (localStorage.getItem(CF_DEBUG_KEY) === 'true') {\n this.activeLevel = 'debug';\n }\n }\n static getInstance() {\n if (this.instance === null) {\n this.instance = new DebugLogger();\n }\n return this.instance;\n }\n getActiveLevel() {\n return this.activeLevel;\n }\n setActiveLevel(level) {\n this.activeLevel = level;\n if (!checkLocalStorageAvailability()) {\n return;\n }\n if (this.activeLevel === 'debug' || this.activeLevel === 'log') {\n localStorage.setItem(CF_DEBUG_KEY, 'true');\n }\n else {\n localStorage.removeItem(CF_DEBUG_KEY);\n }\n }\n // Log method for different levels (error, warn, log)\n logger(level) {\n return (...args) => {\n const levelPriority = DEBUG_LEVELS_HIERARCHY.indexOf(level);\n const activeLevelPriority = DEBUG_LEVELS_HIERARCHY.indexOf(this.activeLevel);\n const enabled = levelPriority <= activeLevelPriority;\n if (enabled) {\n console[level](...args);\n }\n };\n }\n}\nDebugLogger.instance = null;\nconst debug = DebugLogger.getInstance();\n/** Set the logging level to `debug` */\nconst enableDebug = () => {\n debug.setActiveLevel('debug');\n console.log('Debug mode enabled');\n};\n/** Set the debug level to `warn` */\nconst disableDebug = () => {\n debug.setActiveLevel('warn');\n console.log('Debug mode disabled');\n};\n/** Set the debug level to the provided level */\nconst setDebugLevel = (level) => {\n debug.setActiveLevel(level);\n console.log(`Debug mode set to ${level}`);\n};\n\nconst findOutermostCoordinates = (first, second) => {\n return {\n top: Math.min(first.top, second.top),\n right: Math.max(first.right, second.right),\n bottom: Math.max(first.bottom, second.bottom),\n left: Math.min(first.left, second.left),\n };\n};\nconst isElementHidden = (rect) => {\n /** if the rect has no size and position, its element is not rendered in the DOM */\n return rect.width === 0 && rect.height === 0 && rect.x === 0 && rect.y === 0;\n};\nconst getElementCoordinates = (element) => {\n const rect = element.getBoundingClientRect();\n /**\n * If element does not have children, or element has it's own width or height,\n * return the element's coordinates.\n */\n if (element.children.length === 0 || rect.width !== 0 || rect.height !== 0) {\n return rect;\n }\n const rects = [];\n /**\n * If element has children, or element does not have it's own width and height,\n * we find the cordinates of the children, and assume the outermost coordinates of the children\n * as the coordinate of the element.\n *\n * E.g child1 => {top: 2, bottom: 3, left: 4, right: 6} & child2 => {top: 1, bottom: 8, left: 12, right: 24}\n * The final assumed coordinates of the element would be => { top: 1, right: 24, bottom: 8, left: 4 }\n */\n for (const child of element.children) {\n const childRect = getElementCoordinates(child);\n if (childRect.width !== 0 || childRect.height !== 0) {\n const { top, right, bottom, left } = childRect;\n rects.push({ top, right, bottom, left });\n }\n }\n if (rects.length === 0) {\n return rect;\n }\n const { top, right, bottom, left } = rects.reduce(findOutermostCoordinates);\n return DOMRect.fromRect({\n x: left,\n y: top,\n height: bottom - top,\n width: right - left,\n });\n};\n\nconst isLinkToAsset = (variable) => {\n if (variable === null || typeof variable !== 'object')\n return false;\n // The `'prop' in` pattern is informing TypeScript of the object shape, no need to cast `as`.\n if (!('sys' in variable))\n return false;\n if (variable.sys === null || typeof variable.sys !== 'object')\n return false;\n if (!('linkType' in variable.sys))\n return false;\n if (!('id' in variable.sys))\n return false;\n if (!('type' in variable.sys))\n return false;\n return (variable.sys?.linkType === 'Asset' &&\n typeof variable.sys?.id === 'string' &&\n !!variable.sys?.id &&\n variable.sys?.type === 'Link');\n};\n\nconst isLinkToEntry = (variable) => {\n if (variable === null || typeof variable !== 'object')\n return false;\n // The `'prop' in` pattern is informing TypeScript of the object shape, no need to cast `as`.\n if (!('sys' in variable))\n return false;\n if (variable.sys === null || typeof variable.sys !== 'object')\n return false;\n if (!('linkType' in variable.sys))\n return false;\n if (!('id' in variable.sys))\n return false;\n if (!('type' in variable.sys))\n return false;\n return (variable.sys?.linkType === 'Entry' &&\n typeof variable.sys?.id === 'string' &&\n !!variable.sys?.id &&\n variable.sys?.type === 'Link');\n};\n\nfunction isLink(maybeLink) {\n if (maybeLink === null)\n return false;\n if (typeof maybeLink !== 'object')\n return false;\n const link = maybeLink;\n return Boolean(link.sys?.id) && link.sys?.type === 'Link' && Boolean(link.sys?.linkType);\n}\n\n/**\n * Localizes the provided entry or asset to match the regular format of CDA/CPA entities.\n * Note that this function does not apply a fallback to the default locale nor does it check\n * the content type for the localization setting of each field.\n * It will simply resolve each field to the requested locale. As using single and multiple\n * reference fields is still considered an experimental feature, this function does not handle\n * recursive localization of deeper referenced entities.\n *\n * If the entity is already localized, it will return the entity as is.\n *\n * Note that localization is later on determined by the existence of the `sys.locale` property (matching the API shape).\n *\n * @example\n * ```\n * const multiLocaleEntry = { fields: { title: { 'en-US': 'Hello' } } };\n * const localizedEntry = localizeEntity(multiLocaleEntry, 'en-US');\n * console.log(localizedEntry.fields.title); // 'Hello'\n * ```\n */\nfunction localizeEntity(entity, locale) {\n if (!entity || !entity.fields) {\n throw new Error('Invalid entity provided');\n }\n if (entity.sys.locale) {\n return entity;\n }\n const cloned = cloneDeep(entity);\n // Set the requested locale as entry locale to follow the API shape:\n // https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/common-resource-attributes\n cloned.sys.locale = locale;\n for (const key in cloned.fields) {\n cloned.fields[key] = cloned.fields[key][locale];\n }\n return cloned;\n}\n\n/**\n * This module encapsulates format of the path to a deep reference.\n */\nconst isPreboundProp = (variable) => {\n return (variable.type === 'BoundValue' &&\n typeof variable.isPrebound === 'boolean' &&\n !!variable.pathsByContentType);\n};\nconst parseDataSourcePathIntoFieldset = (path) => {\n const parsedPath = parseDeepPath(path);\n if (null === parsedPath) {\n throw new Error(`Cannot parse path '${path}' as deep path`);\n }\n return parsedPath.fields.map((field) => [null, field, '~locale']);\n};\n/**\n * Parse path into components, supports L1 references (one reference follow) atm.\n * @param path from data source. eg. `/uuid123/fields/image/~locale/fields/file/~locale`\n * eg. `/uuid123/fields/file/~locale/fields/title/~locale`\n * @returns\n */\nconst parseDataSourcePathWithL1DeepBindings = (path) => {\n const parsedPath = parseDeepPath(path);\n if (null === parsedPath) {\n throw new Error(`Cannot parse path '${path}' as deep path`);\n }\n return {\n key: parsedPath.key,\n field: parsedPath.fields[0],\n referentField: parsedPath.fields[1],\n };\n};\n/**\n * Detects if paths is valid deep-path, like:\n * - /gV6yKXp61hfYrR7rEyKxY/fields/mainStory/~locale/fields/cover/~locale/fields/title/~locale\n * or regular, like:\n * - /6J8eA60yXwdm5eyUh9fX6/fields/mainStory/~locale\n * @returns\n */\nconst isDeepPath = (deepPathCandidate) => {\n const deepPathParsed = parseDeepPath(deepPathCandidate);\n if (!deepPathParsed) {\n return false;\n }\n return deepPathParsed.fields.length > 1;\n};\nconst isDeepPrebinding = (boundValueProperty) => {\n if (!boundValueProperty?.path || boundValueProperty.type !== 'BoundValue') {\n return false;\n }\n if (!isPreboundProp(boundValueProperty)) {\n return false;\n }\n if (isDeepPath(boundValueProperty.path)) {\n return true;\n }\n const hasDeepPathByContentType = Object.values(boundValueProperty.pathsByContentType || {}).some((val) => isDeepPath(val.path));\n return hasDeepPathByContentType;\n};\nconst getPrebindingPathBySourceEntry = (preboundValueProperty, getHeadEntityByDataSourceKey) => {\n if (!isPreboundProp(preboundValueProperty)) {\n return undefined;\n }\n // incomplete path due to several content types and not known default source\n const [, dataSourceKey] = preboundValueProperty.path.split('/');\n if (!dataSourceKey) {\n return undefined;\n }\n const headEntity = getHeadEntityByDataSourceKey(dataSourceKey);\n if (headEntity?.sys.type !== 'Entry') {\n return undefined;\n }\n const contentTypeId = headEntity.sys.contentType.sys.id;\n if (!preboundValueProperty.pathsByContentType?.[contentTypeId]) {\n return undefined;\n }\n return preboundValueProperty.pathsByContentType?.[contentTypeId]?.path;\n};\nconst parseDeepPath = (deepPathCandidate) => {\n // ALGORITHM:\n // We start with deep path in form:\n // /uuid123/fields/mainStory/~locale/fields/cover/~locale/fields/title/~locale\n // First turn string into array of segments\n // ['', 'uuid123', 'fields', 'mainStory', '~locale', 'fields', 'cover', '~locale', 'fields', 'title', '~locale']\n // Then group segments into intermediate represenatation - chunks, where each non-initial chunk starts with 'fields'\n // [\n // [ \"\", \"uuid123\" ],\n // [ \"fields\", \"mainStory\", \"~locale\" ],\n // [ \"fields\", \"cover\", \"~locale\" ],\n // [ \"fields\", \"title\", \"~locale\" ]\n // ]\n // Then check \"initial\" chunk for corretness\n // Then check all \"field-leading\" chunks for correctness\n const isValidInitialChunk = (initialChunk) => {\n // must have start with '' and have at least 2 segments, second non-empty\n // eg. /-_432uuid123123\n return /^\\/([^/^~]+)$/.test(initialChunk.join('/'));\n };\n const isValidFieldChunk = (fieldChunk) => {\n // must start with 'fields' and have at least 3 segments, second non-empty and last segment must be '~locale'\n // eg. fields/-32234mainStory/~locale\n return /^fields\\/[^/^~]+\\/~locale$/.test(fieldChunk.join('/'));\n };\n const deepPathSegments = deepPathCandidate.split('/');\n const chunks = chunkSegments(deepPathSegments, { startNextChunkOnElementEqualTo: 'fields' });\n if (chunks.length <= 1) {\n return null; // malformed path, even regular paths have at least 2 chunks\n }\n else if (chunks.length === 2) {\n return null; // deep paths have at least 3 chunks\n }\n // With 3+ chunks we can now check for deep path correctness\n const [initialChunk, ...fieldChunks] = chunks;\n if (!isValidInitialChunk(initialChunk)) {\n return null;\n }\n if (!fieldChunks.every(isValidFieldChunk)) {\n return null;\n }\n return {\n key: initialChunk[1], // pick uuid from initial chunk ['','uuid123'],\n fields: fieldChunks.map((fieldChunk) => fieldChunk[1]), // pick only fieldName eg. from ['fields','mainStory', '~locale'] we pick `mainStory`\n };\n};\nconst chunkSegments = (segments, { startNextChunkOnElementEqualTo }) => {\n const chunks = [];\n let currentChunk = [];\n const isSegmentBeginningOfChunk = (segment) => segment === startNextChunkOnElementEqualTo;\n const excludeEmptyChunks = (chunk) => chunk.length > 0;\n for (let i = 0; i < segments.length; i++) {\n const isInitialElement = i === 0;\n const segment = segments[i];\n if (isInitialElement) {\n currentChunk = [segment];\n }\n else if (isSegmentBeginningOfChunk(segment)) {\n chunks.push(currentChunk);\n currentChunk = [segment];\n }\n else {\n currentChunk.push(segment);\n }\n }\n chunks.push(currentChunk);\n return chunks.filter(excludeEmptyChunks);\n};\nconst lastPathNamedSegmentEq = (path, expectedName) => {\n // `/key123/fields/featureImage/~locale/fields/file/~locale`\n // ['', 'key123', 'fields', 'featureImage', '~locale', 'fields', 'file', '~locale']\n const segments = path.split('/');\n if (segments.length < 2) {\n debug.warn(`[experiences-core::pathSchema] Attempting to check whether last named segment of the path (${path}) equals to '${expectedName}', but the path doesn't have enough segments.`);\n return false;\n }\n const secondLast = segments[segments.length - 2]; // skipping trailing '~locale'\n return secondLast === expectedName;\n};\n\nconst resolveHyperlinkPattern = (pattern, entry, locale) => {\n if (!entry || !locale)\n return null;\n const variables = {\n entry,\n locale,\n };\n return buildTemplate({ template: pattern, context: variables });\n};\nfunction getValue(obj, path) {\n return path\n .replace(/\\[/g, '.')\n .replace(/\\]/g, '')\n .split('.')\n .reduce((o, k) => (o || {})[k], obj);\n}\nfunction addLocale(str, locale) {\n const fieldsIndicator = 'fields';\n const fieldsIndex = str.indexOf(fieldsIndicator);\n if (fieldsIndex !== -1) {\n const dotIndex = str.indexOf('.', fieldsIndex + fieldsIndicator.length + 1); // +1 for '.'\n if (dotIndex !== -1) {\n return str.slice(0, dotIndex + 1) + locale + '.' + str.slice(dotIndex + 1);\n }\n }\n return str;\n}\nfunction getTemplateValue(ctx, path) {\n const pathWithLocale = addLocale(path, ctx.locale);\n const retrievedValue = getValue(ctx, pathWithLocale);\n return typeof retrievedValue === 'object' && retrievedValue !== null\n ? retrievedValue[ctx.locale]\n : retrievedValue;\n}\nfunction buildTemplate({ template, context, }) {\n const localeVariable = /{\\s*locale\\s*}/g;\n // e.g. \"{ page.sys.id }\"\n const variables = /{\\s*([\\S]+?)\\s*}/g;\n return (template\n // first replace the locale pattern\n .replace(localeVariable, context.locale)\n // then resolve the remaining variables\n .replace(variables, (_, path) => {\n const fallback = path + '_NOT_FOUND';\n const value = getTemplateValue(context, path) ?? fallback;\n // using _.result didn't gave proper results so we run our own version of it\n return String(typeof value === 'function' ? value() : value);\n }));\n}\n\nconst stylesToKeep = ['cfImageAsset'];\nconst stylesToRemove = CF_STYLE_ATTRIBUTES.filter((style) => !stylesToKeep.includes(style));\n// cfWrapColumns & cfWrapColumnsCount are no real style attributes as they are handled on the editor side\nconst propsToRemove = ['cfSsrClassName', 'cfWrapColumns', 'cfWrapColumnsCount'];\nconst sanitizeNodeProps = (nodeProps) => {\n const keysToRemove = [...stylesToRemove, ...propsToRemove];\n const sanitizedProps = Object.fromEntries(Object.entries(nodeProps).filter(([key]) => !keysToRemove.includes(key)));\n return sanitizedProps;\n};\n\n/** Turn the visibility value into a style object that can be used for inline styles in React */\nconst transformVisibility = (value) => {\n if (value === false) {\n return {\n display: 'none !important',\n };\n }\n // Don't explicitly set anything when visible to not overwrite values like `grid` or `flex`.\n return {};\n};\nconst transformGridColumn = (span) => {\n if (!span) {\n return {};\n }\n return {\n gridColumn: `span ${span}`,\n };\n};\nconst transformBorderStyle = (value) => {\n if (!value)\n return {};\n const parts = value.split(' ');\n // Just accept the passed value\n if (parts.length < 3)\n return { border: value };\n const [borderSize, borderStyle, ...borderColorParts] = parts;\n const borderColor = borderColorParts.join(' ');\n return {\n border: `${borderSize} ${borderStyle} ${borderColor}`,\n };\n};\nconst transformAlignment = (cfHorizontalAlignment, cfVerticalAlignment, cfFlexDirection = 'column') => cfFlexDirection === 'row'\n ? {\n alignItems: cfHorizontalAlignment,\n justifyContent: cfVerticalAlignment === 'center' ? `safe ${cfVerticalAlignment}` : cfVerticalAlignment,\n }\n : {\n alignItems: cfVerticalAlignment,\n justifyContent: cfHorizontalAlignment === 'center'\n ? `safe ${cfHorizontalAlignment}`\n : cfHorizontalAlignment,\n };\nconst transformBackgroundImage = (cfBackgroundImageUrl, cfBackgroundImageOptions) => {\n const matchBackgroundSize = (scaling) => {\n if ('fill' === scaling)\n return 'cover';\n if ('fit' === scaling)\n return 'contain';\n };\n const matchBackgroundPosition = (alignment) => {\n if (!alignment || 'string' !== typeof alignment) {\n return;\n }\n let [horizontalAlignment, verticalAlignment] = alignment.trim().split(/\\s+/, 2);\n const isHorizontalValid = ['left', 'right', 'center'].includes(horizontalAlignment);\n const isVerticalValid = ['top', 'bottom', 'center'].includes(verticalAlignment);\n horizontalAlignment = isHorizontalValid ? horizontalAlignment : 'left';\n verticalAlignment = isVerticalValid ? verticalAlignment : 'top';\n return `${horizontalAlignment} ${verticalAlignment}`;\n };\n if (!cfBackgroundImageUrl) {\n return;\n }\n let backgroundImage;\n let backgroundImageSet;\n if (typeof cfBackgroundImageUrl === 'string') {\n backgroundImage = `url(${cfBackgroundImageUrl})`;\n }\n else {\n const imgSet = cfBackgroundImageUrl.srcSet?.join(',');\n backgroundImage = `url(${cfBackgroundImageUrl.url})`;\n backgroundImageSet = `image-set(${imgSet})`;\n }\n return {\n backgroundImage,\n backgroundImage2: backgroundImageSet,\n backgroundRepeat: cfBackgroundImageOptions?.scaling === 'tile' ? 'repeat' : 'no-repeat',\n backgroundPosition: matchBackgroundPosition(cfBackgroundImageOptions?.alignment),\n backgroundSize: matchBackgroundSize(cfBackgroundImageOptions?.scaling),\n };\n};\nconst transformTextAlign = (value) => {\n if (!value)\n return undefined;\n const sdkOptions = getSdkOptions();\n // New behavior: translate left/right to start/end\n // Customer can opt out by activating this global option toggle\n if (!sdkOptions.__disableTextAlignmentTransform) {\n if (value === 'left')\n return 'start';\n if (value === 'right')\n return 'end';\n }\n return value;\n};\n\nconst toCSSAttribute = (key) => {\n let val = key.replace(/[A-Z]/g, (m) => '-' + m.toLowerCase());\n // Remove the number from the end of the key to allow for overrides on style properties\n val = val.replace(/\\d+$/, '');\n return val;\n};\n/**\n * Turns a list of CSSProperties into a joined CSS string that can be\n * used for <style> tags. Per default it creates a minimized version.\n * For editor mode, use the `useWhitespaces` flag to create a more readable version.\n *\n * @param cssProperties list of CSS properties\n * @param useWhitespaces adds whitespaces and newlines between each rule\n * @returns a string of CSS rules\n */\nconst stringifyCssProperties = (cssProperties, useWhitespaces = false) => {\n const rules = Object.entries(cssProperties)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => useWhitespaces ? `${toCSSAttribute(key)}: ${value};` : `${toCSSAttribute(key)}:${value};`);\n return rules.join(useWhitespaces ? '\\n' : '');\n};\nconst buildStyleTag = ({ styles, nodeId }) => {\n const generatedStyles = stringifyCssProperties(styles, true);\n const className = `cfstyles-${nodeId ? nodeId : md5(generatedStyles)}`;\n const styleRule = `.${className}{ ${generatedStyles} }`;\n return [className, styleRule];\n};\n/**\n * Takes plain design values and transforms them into CSS properties. Undefined values will\n * be filtered out.\n *\n * **Example Input**\n * ```\n * values = {\n * cfVisibility: 'visible',\n * cfMargin: '10px',\n * cfFlexReverse: true,\n * cfImageOptions: { objectFit: 'cover' },\n * // ...\n * }\n * ```\n * **Example Output**\n * ```\n * cssProperties = {\n * margin: '10px',\n * flexDirection: 'row-reverse',\n * objectFit: 'cover',\n * // ...\n * }\n * ```\n */\nconst buildCfStyles = (values) => {\n const cssProperties = {\n margin: values.cfMargin,\n padding: values.cfPadding,\n backgroundColor: values.cfBackgroundColor,\n width: values.cfWidth || values.cfImageOptions?.width,\n height: values.cfHeight || values.cfImageOptions?.height,\n maxWidth: values.cfMaxWidth,\n ...transformGridColumn(values.cfColumnSpan),\n ...transformBorderStyle(values.cfBorder),\n borderRadius: values.cfBorderRadius,\n gap: values.cfGap,\n ...transformAlignment(values.cfHorizontalAlignment, values.cfVerticalAlignment, values.cfFlexDirection),\n flexDirection: values.cfFlexReverse && values.cfFlexDirection\n ? `${values.cfFlexDirection}-reverse`\n : values.cfFlexDirection,\n flexWrap: values.cfFlexWrap,\n ...transformBackgroundImage(values.cfBackgroundImageUrl, values.cfBackgroundImageOptions),\n fontSize: values.cfFontSize,\n fontWeight: values.cfTextBold ? 'bold' : values.cfFontWeight,\n fontStyle: values.cfTextItalic ? 'italic' : undefined,\n textDecoration: values.cfTextUnderline ? 'underline' : undefined,\n lineHeight: values.cfLineHeight,\n letterSpacing: values.cfLetterSpacing,\n color: values.cfTextColor,\n textAlign: transformTextAlign(values.cfTextAlign),\n textTransform: values.cfTextTransform,\n objectFit: values.cfImageOptions?.objectFit,\n objectPosition: values.cfImageOptions?.objectPosition,\n };\n const cssPropertiesWithoutUndefined = Object.fromEntries(Object.entries(cssProperties).filter(([, value]) => value !== undefined));\n return cssPropertiesWithoutUndefined;\n};\n/**\n * **Only meant to be used in editor mode!**\n *\n * If the node is an empty structure component with a relative height (e.g. '100%'),\n * it might render with a zero height. In this case, add a min height of 80px to ensure\n * that child nodes can be added via drag & drop.\n */\nconst addMinHeightForEmptyStructures = (cssProperties, node) => {\n if (!node.children.length &&\n isStructureWithRelativeHeight(node.definitionId, cssProperties.height)) {\n return {\n ...cssProperties,\n minHeight: EMPTY_CONTAINER_SIZE,\n };\n }\n return cssProperties;\n};\n/**\n * Container/section default behavior:\n * Default height => height: EMPTY_CONTAINER_SIZE\n * If a container component has children => height: 'fit-content'\n */\nconst calculateNodeDefaultHeight = ({ blockId, children, value, }) => {\n if (!blockId || !isContentfulStructureComponent(blockId) || value !== 'auto') {\n return value;\n }\n if (children.length) {\n return '100%';\n }\n return EMPTY_CONTAINER_SIZE;\n};\n\nconst getDataFromTree = (tree) => {\n let dataSource = {};\n let unboundValues = {};\n const queue = [...tree.root.children];\n while (queue.length) {\n const node = queue.shift();\n if (!node) {\n continue;\n }\n dataSource = { ...dataSource, ...node.data.dataSource };\n unboundValues = { ...unboundValues, ...node.data.unboundValues };\n if (node.children.length) {\n queue.push(...node.children);\n }\n }\n return {\n dataSource,\n unboundValues,\n };\n};\nconst generateRandomId = (letterCount) => {\n const LETTERS = 'abcdefghijklmnopqvwxyzABCDEFGHIJKLMNOPQVWXYZ';\n const NUMS = '0123456789';\n const ALNUM = NUMS + LETTERS;\n const times = (n, callback) => Array.from({ length: n }, callback);\n const random = (min, max) => Math.floor(Math.random() * (max - min + 1)) + min;\n return times(letterCount, () => ALNUM[random(0, ALNUM.length - 1)]).join('');\n};\nconst checkIsAssemblyNode = ({ componentId, usedComponents, }) => {\n if (!usedComponents?.length)\n return false;\n return usedComponents.some((usedComponent) => usedComponent.sys.id === componentId);\n};\n/**\n * This check assumes that the entry is already ensured to be an experience, i.e. the\n * content type of the entry is an experience type with the necessary annotations.\n **/\nconst checkIsAssemblyEntry = (entry) => {\n return Boolean(entry.fields?.componentSettings);\n};\nconst checkIsAssemblyDefinition = (component) => component?.category === ASSEMBLY_DEFAULT_CATEGORY;\nfunction parseCSSValue(input) {\n const regex = /^(\\d+(\\.\\d+)?)(px|em|rem)$/;\n const match = input.match(regex);\n if (match) {\n return {\n value: parseFloat(match[1]),\n unit: match[3],\n };\n }\n return null;\n}\nfunction getTargetValueInPixels(targetWidthObject) {\n switch (targetWidthObject.unit) {\n case 'px':\n return targetWidthObject.value;\n case 'em':\n return targetWidthObject.value * 16;\n case 'rem':\n return targetWidthObject.value * 16;\n default:\n return targetWidthObject.value;\n }\n}\n/**\n * Creates a component definition for an assembly. As all assemblies use the same definition in the SDK,\n * all should be registered via this function.\n */\nconst createAssemblyDefinition = (definitionId) => {\n return {\n id: definitionId,\n name: 'Component',\n variables: {},\n children: true,\n category: ASSEMBLY_DEFAULT_CATEGORY,\n };\n};\n\n/**\n * Turns a condition like `<768px` or `>1024px` into a media query rule.\n * For example, `<768px` becomes `max-width:768px` and `>1024px` becomes `min-width:1024px`.\n */\nconst toMediaQueryRule = (condition) => {\n const [evaluation, pixelValue] = [condition[0], condition.substring(1)];\n const mediaQueryRule = evaluation === '<' ? 'max-width' : 'min-width';\n return `(${mediaQueryRule}:${pixelValue})`;\n};\n/**\n * Converts a map of class names to CSS strings into a single CSS string.\n *\n * @param cssByClassName map of class names to CSS strings containing all rules for each class\n * @returns joined string of all CSS class definitions\n */\nconst toCompoundCss = (cssByClassName) => {\n return Object.entries(cssByClassName).reduce((acc, [className, css]) => {\n if (css === '')\n return acc;\n return `${acc}.${className}{${css}}`;\n }, ``);\n};\n/**\n * Create a single CSS string containing all class definitions for a given media query.\n *\n * @param cssByClassName map of class names to CSS strings containing all rules for each class\n * @param condition e.g. \"*\", \"<520px\", \">520px\"\n * @param nextCondition optional next condition to create a disjunct media query that doesn't affect the next breakpoint\n * @returns joined string of all CSS class definitions wrapped into media queries\n */\nconst toMediaQuery = ({ cssByClassName, condition, nextCondition, }) => {\n const compoundCss = toCompoundCss(cssByClassName);\n if (compoundCss === '') {\n return '';\n }\n const queryRule = toMediaQueryRule(condition);\n if (!nextCondition) {\n if (condition === '*') {\n return compoundCss;\n }\n return `@media${queryRule}{${compoundCss}}`;\n }\n const nextRule = toMediaQueryRule(nextCondition);\n if (condition === '*') {\n return `@media not ${nextRule}{${compoundCss}}`;\n }\n return `@media${queryRule} and (not ${nextRule}){${compoundCss}}`;\n};\n\nfunction getOptimizedImageUrl(url, width, quality, format) {\n if (url.startsWith('//')) {\n url = 'https:' + url;\n }\n const params = new URLSearchParams();\n if (width) {\n params.append('w', width.toString());\n }\n if (quality && quality > 0 && quality < 100) {\n params.append('q', quality.toString());\n }\n if (format) {\n params.append('fm', format);\n }\n const queryString = params.toString();\n return `${url}${queryString ? '?' + queryString : ''}`;\n}\n\nfunction validateParams(file, quality, format) {\n if (!file.details.image) {\n throw Error('No image in file asset to transform');\n }\n if (quality < 0 || quality > 100) {\n throw Error('Quality must be between 0 and 100');\n }\n if (format && !SUPPORTED_IMAGE_FORMATS.includes(format)) {\n throw Error(`Format must be one of ${SUPPORTED_IMAGE_FORMATS.join(', ')}`);\n }\n return true;\n}\n\nconst MAX_WIDTH_ALLOWED$1 = 2000;\nconst getOptimizedBackgroundImageAsset = (file, widthStyle, quality = '100%', format) => {\n const qualityNumber = Number(quality.replace('%', ''));\n if (!validateParams(file, qualityNumber, format)) ;\n if (!validateParams(file, qualityNumber, format)) ;\n const url = file.url;\n const { width1x, width2x } = getWidths(widthStyle, file);\n const imageUrl1x = getOptimizedImageUrl(url, width1x, qualityNumber, format);\n const imageUrl2x = getOptimizedImageUrl(url, width2x, qualityNumber, format);\n const srcSet = [`url(${imageUrl1x}) 1x`, `url(${imageUrl2x}) 2x`];\n const returnedUrl = getOptimizedImageUrl(url, width2x, qualityNumber, format);\n const optimizedBackgroundImageAsset = {\n url: returnedUrl,\n srcSet,\n file,\n };\n return optimizedBackgroundImageAsset;\n function getWidths(widthStyle, file) {\n let width1x = 0;\n let width2x = 0;\n const intrinsicImageWidth = file.details.image.width;\n if (widthStyle.endsWith('px')) {\n width1x = Math.min(Number(widthStyle.replace('px', '')), intrinsicImageWidth);\n }\n else {\n width1x = Math.min(MAX_WIDTH_ALLOWED$1, intrinsicImageWidth);\n }\n width2x = Math.min(width1x * 2, intrinsicImageWidth);\n return { width1x, width2x };\n }\n};\n\nconst detachExperienceStyles = (experience) => {\n const experienceTreeRoot = experience.entityStore?.experienceEntryFields\n ?.componentTree;\n if (!experienceTreeRoot) {\n return;\n }\n const isRenderingAPatternEntry = experience.entityStore?.isExperienceAPatternEntry;\n const mapOfDesignVariableKeys = flattenDesignTokenRegistry(designTokensRegistry);\n // getting breakpoints from the entry componentTree field\n const { breakpoints } = experienceTreeRoot;\n // creating the structure which I thought would work best for aggregation\n const mediaQueryDataByBreakpoint = breakpoints.reduce((mediaQueryTemplate, breakpoint) => ({\n ...mediaQueryTemplate,\n [breakpoint.id]: {\n condition: breakpoint.query,\n cssByClassName: {},\n visibilityCssByClassName: {},\n },\n }), {});\n // getting the breakpoint ids\n const breakpointIds = Object.keys(mediaQueryDataByBreakpoint);\n const iterateOverTreeAndExtractStyles = ({ componentTree, dataSource, unboundValues, componentSettings, componentVariablesOverwrites, patternWrapper, wrappingPatternIds, wrappingPatternNodeIds = isRenderingAPatternEntry ? ['root'] : [], }) => {\n // traversing the tree\n const queue = [];\n queue.push(...componentTree.children);\n // for each tree node\n while (queue.length) {\n const currentNode = queue.shift();\n if (!currentNode) {\n break;\n }\n const usedComponents = experience.entityStore?.usedComponents ?? [];\n const isPatternNode = checkIsAssemblyNode({\n componentId: currentNode.definitionId,\n usedComponents,\n });\n if (isPatternNode) {\n // When detecting a circular dependency among patterns, stop to avoid an infinite loop\n if (wrappingPatternIds.has(currentNode.definitionId)) {\n continue;\n }\n const patternEntry = usedComponents.find((component) => component.sys.id === currentNode.definitionId);\n if (!patternEntry || !('fields' in patternEntry)) {\n continue;\n }\n const nextComponentVariablesOverwrites = resolveComponentVariablesOverwrites({\n patternNode: currentNode,\n wrapperComponentVariablesOverwrites: componentVariablesOverwrites,\n wrapperComponentSettings: componentSettings,\n });\n // the node of a used pattern contains only the definitionId (id of the patter entry)\n // as well as the variables overwrites\n // the layout of a pattern is stored in it's entry\n iterateOverTreeAndExtractStyles({\n // that is why we pass it here to iterate of the pattern tree\n componentTree: patternEntry.fields.componentTree,\n // but we pass the data source of the experience entry cause that's where the binding is stored\n dataSource,\n // unbound values of a pattern store the default values of pattern variables\n unboundValues: patternEntry.fields.unboundValues,\n // this is where we can map the pattern variable to it's default value\n componentSettings: patternEntry.fields.componentSettings,\n // and this is where the over-writes for the default values are stored\n // yes, I know, it's a bit confusing\n componentVariablesOverwrites: nextComponentVariablesOverwrites,\n // pass top-level pattern node to store instance-specific child styles for rendering\n patternWrapper: currentNode,\n wrappingPatternIds: new Set([...wrappingPatternIds, currentNode.definitionId]),\n wrappingPatternNodeIds: [...wrappingPatternNodeIds, currentNode.id || ''],\n });\n continue;\n }\n /* [Data format] `currentNode.variables` uses the following serialized shape:\n * {\n * cfMargin: { type: 'DesignValue', valuesByBreakpoint: { desktop: '1px', tablet: '2px' } },\n * cfPadding: { type: 'DesignValue', valuesByBreakpoint: { desktop: '3px' } }\n * cfBackgroundImageUrl: { type: 'BoundValue', path: '/lUERH7tX7nJTaPX6f0udB/fields/assetReference/~locale/fields/file/~locale' }\n * asdf1234: { type: 'ComponentValue', key: 'qwer567' }\n * // ...\n * }\n */\n // so first, I convert it into a map to help me make it easier to access the values\n const propsByBreakpoint = indexByBreakpoint({\n variables: currentNode.variables,\n breakpointIds,\n unboundValues: unboundValues,\n dataSource: dataSource,\n componentSettings,\n componentVariablesOverwrites,\n getBoundEntityById: (id) => {\n return experience.entityStore?.entities.find((entity) => entity.sys.id === id);\n },\n });\n // When the node is hidden for any breakpoint, we need to handle this separately with a disjunct media query.\n const isAnyVisibilityValueHidden = Object.values(propsByBreakpoint).some((designProperties) => designProperties.cfVisibility === false);\n // We always need an explicit value when using disjunct media queries\n // Example: desktop uses \"false\" and tablet is undefined -> we need to set `display: none` for tablet as well.\n let previousVisibilityValue = undefined;\n /* [Data format] `propsByBreakpoint` is a map of \"breakpointId > propertyName > plainValue\":\n * {\n * desktop: {\n * cfMargin: '1px',\n * cfWidth: '100%',\n * cfBackgroundImageUrl: 'https://example.com/image.jpg'\n * //...\n * }\n * }\n */\n const currentNodeClassNames = [];\n // Chain IDs to avoid overwriting styles across multiple instances of the same pattern\n // e.g. `{outerPatternNodeId}{innerPatternNodeId}-{currentNodeId}`\n // (!) Notice that the chain of patterns (before the dash) follows the format of prebinding/ parameters\n const currentNodeIdsChain = [...wrappingPatternNodeIds, currentNode.id].join('-');\n // For each breakpoint, resolve design tokens, create the CSS and generate a unique className.\n for (const breakpointId of breakpointIds) {\n const propsByBreakpointWithResolvedDesignTokens = Object.entries(propsByBreakpoint[breakpointId]).reduce((acc, [variableName, variableValue]) => {\n return {\n ...acc,\n [variableName]: maybePopulateDesignTokenValue(variableName, variableValue, mapOfDesignVariableKeys),\n };\n }, {});\n // Convert CF-specific property names to CSS variables, e.g. `cfMargin` -> `margin`\n const cfStyles = buildCfStyles(propsByBreakpointWithResolvedDesignTokens);\n /* [Data format] `cfStyles` is a list of CSSProperties (React format):\n * {\n * margin: '1px',\n * width: '100%',\n * backgroundImage: 'url(https://example.com/image.jpg)'\n * //...\n * }\n */\n const generatedCss = stringifyCssProperties(cfStyles);\n if (!generatedCss && !isAnyVisibilityValueHidden) {\n // If there are no styles to apply, skip this breakpoint completely including the class name\n continue;\n }\n /* [Data format] `generatedCss` is the minimized CSS string that will be added to the DOM:\n * generatedCss = \"margin: 1px;width: 100%;...\"\n */\n // - Adding breakpointId to ensure not using the same IDs between breakpoints as this leads to\n // conflicts between different breakpoint values from multiple nodes where the hash would be equal\n // - Adding wrapping pattern nodes IDs to avoid conflicts between similar nested patterns as those\n // could override each others CSS for some breakpoints just through the order of `<style>` tags in the DOM.\n // - We're only considering the regular CSS (not the visibility-specific one) but that doesn't cause an issue\n // since we already use the breakpointId (which is not used in CSR, see createStylesheetsForBuiltInStyles).\n // Theoretically, we could drop `generatedCss` from the hash generation and still be safe from conflicts (unless\n // the node IDs are similar but visibility is different?)\n const styleHash = md5(currentNodeIdsChain + breakpointId + generatedCss);\n // and prefix the className to make sure the value can be processed\n const className = `cf-${styleHash}`;\n // I save the generated hashes into an array to later save it in the tree node\n // as cfSsrClassName prop\n // making sure to avoid the duplicates in case styles for > 1 breakpoints are the same\n if (!currentNodeClassNames.includes(className)) {\n currentNodeClassNames.push(className);\n }\n // Only if the hash was not used yet, save the CSS to the stylesheet\n if (!mediaQueryDataByBreakpoint[breakpointId].cssByClassName[className]) {\n mediaQueryDataByBreakpoint[breakpointId].cssByClassName[className] = generatedCss;\n }\n // Special case for visibility to override any custom `display` values but only for a specific breakpoint.\n if (isAnyVisibilityValueHidden) {\n const visibilityValue = propsByBreakpointWithResolvedDesignTokens.cfVisibility ?? previousVisibilityValue;\n previousVisibilityValue = visibilityValue;\n const visibilityStyles = transformVisibility(visibilityValue);\n const visibilityCss = stringifyCssProperties(visibilityStyles);\n if (!mediaQueryDataByBreakpoint[breakpointId].visibilityCssByClassName[className]) {\n mediaQueryDataByBreakpoint[breakpointId].visibilityCssByClassName[className] =\n visibilityCss;\n }\n }\n }\n // all generated classNames are saved in the tree node\n // to be handled by the sdk later\n // each node will get N classNames, where N is the number of breakpoints\n // browsers process classNames in the order they are defined\n // meaning that in case of className1 className2 className3\n // className3 will win over className2 and className1\n // making sure that we respect the order of breakpoints from\n // we can achieve \"desktop first\" or \"mobile first\" approach to style over-writes\n if (patternWrapper) {\n // @ts-expect-error -- valueByBreakpoint is not explicitly defined, but it's already defined in the patternWrapper styles\n patternWrapper.variables.cfSsrClassName = {\n ...(patternWrapper.variables.cfSsrClassName ?? {}),\n type: 'DesignValue',\n [currentNodeIdsChain]: {\n valuesByBreakpoint: {\n [breakpointIds[0]]: currentNodeClassNames.join(' '),\n },\n },\n };\n }\n else {\n currentNode.variables.cfSsrClassName = {\n type: 'DesignValue',\n valuesByBreakpoint: {\n [breakpointIds[0]]: currentNodeClassNames.join(' '),\n },\n };\n }\n queue.push(...currentNode.children);\n }\n };\n iterateOverTreeAndExtractStyles({\n componentTree: experienceTreeRoot,\n dataSource: experience.entityStore?.dataSource ?? {},\n unboundValues: experience.entityStore?.unboundValues ?? {},\n componentSettings: experience.entityStore?.experienceEntryFields?.componentSettings,\n wrappingPatternIds: new Set(experience.entityStore?.experienceEntryId ? [experience.entityStore.experienceEntryId] : []),\n });\n // once the whole tree was traversed, for each breakpoint, I aggregate the styles\n // for each generated className into one css string\n return Object.values(mediaQueryDataByBreakpoint).reduce((acc, { condition, cssByClassName, visibilityCssByClassName }, index) => {\n const mediaQueryCss = toMediaQuery({ cssByClassName, condition });\n // Handle visibility separately to use disjunct media queries (\"if desktop but not tablet ...\")\n // Enables to hide on one breakpoint but render any unknown custom `display` value on another breakpoint.\n const visibilityMediaQueryCss = toMediaQuery({\n cssByClassName: visibilityCssByClassName,\n condition,\n // Breakpoint validation ensures that it starts with the '*' breakpoint\n nextCondition: Object.values(mediaQueryDataByBreakpoint)[index + 1]?.condition,\n });\n return `${acc}${mediaQueryCss}${visibilityMediaQueryCss}`;\n }, '');\n};\n/**\n * Rendering pattern nodes inside pattern entry by injecting default values from the top:\n * When there is a ComponentValue but the recursive logic is not wrapped by a pattern node (no `componentVariablesOverwrites`),\n * a pattern entry is rendered directly. In this case, we replace each ComponentValue with the default value from componentSettings.\n */\nconst injectDefaultValuesForComponentValues = ({ patternNode, wrapperComponentSettings, }) => {\n const propertyDefinitions = wrapperComponentSettings?.variableDefinitions;\n return Object.entries(patternNode.variables).reduce((resolvedProperties, [propertyName, propertyValue]) => {\n if (propertyValue.type === 'ComponentValue') {\n const componentValueKey = propertyValue.key;\n const componentDefaultValue = propertyDefinitions?.[componentValueKey].defaultValue;\n // We're only considering design properties for styles generation\n if (componentDefaultValue?.type === 'DesignValue') {\n resolvedProperties[propertyName] = componentDefaultValue;\n }\n }\n else {\n // Do nothing when it's not a ComponentValue & just keep the defined value\n resolvedProperties[propertyName] = propertyValue;\n }\n return resolvedProperties;\n }, {});\n};\n/**\n * In case of nested patterns, we need to resolve the ComponentValue properties and overwrite them with the value\n * stored in the parent component.\n *\n *\n * @param patternNode - pattern node which contains the variables\n * @param componentVariablesOverwrites - object which contains the variables of the parent component\n */\nconst resolveComponentVariablesOverwrites = ({ patternNode, wrapperComponentVariablesOverwrites, wrapperComponentSettings, }) => {\n // In case of rendering a pattern entry, there are no custom ComponentValues.\n // So we pass down the default values from this pattern node down to each deeper pattern level.\n if (!wrapperComponentVariablesOverwrites) {\n return injectDefaultValuesForComponentValues({\n patternNode,\n wrapperComponentSettings,\n });\n }\n // Rendering (nested) pattern node inside another pattern node (for both experience & pattern entry):\n // The `wrapperComponentVariablesOverwrites` from the top-most pattern node is passed through to each child\n // node (and nested pattern nodes). It replaces each ComponentValue in the subtree with either the overwrite\n // or the default value.\n return Object.entries(patternNode?.variables).reduce((resolvedValues, [propertyName, propertyValue]) => {\n if (propertyValue.type === 'ComponentValue') {\n // Copying the values from the parent node\n const overwritingValue = wrapperComponentVariablesOverwrites?.[propertyValue.key];\n // Property definition from the parent pattern\n const propertyDefinition = wrapperComponentSettings?.variableDefinitions?.[propertyValue.key];\n const defaultValue = propertyDefinition?.defaultValue;\n // The overwriting value is either a custom value from the experience or default value from a\n // wrapping pattern node that got trickled down to this nesting level.\n resolvedValues[propertyName] = mergeDefaultAndOverwriteValues(defaultValue, overwritingValue);\n }\n else {\n // Keep raw values\n resolvedValues[propertyName] = propertyValue;\n }\n return resolvedValues;\n }, {});\n};\nconst isCfStyleAttribute = (variableName) => {\n return CF_STYLE_ATTRIBUTES.includes(variableName);\n};\nconst maybePopulateDesignTokenValue = (variableName, variableValue, mapOfDesignVariableKeys) => {\n // TODO: refactor to reuse fn from core package\n if (typeof variableValue !== 'string') {\n return variableValue;\n }\n if (!isCfStyleAttribute(variableName)) {\n return variableValue;\n }\n // matches ${...} and captures the content between ${ and }\n // ${color.Blue}, ${spacing.Sizes.Large} or ${border.Text Heading.Small}\n const templateStringRegex = /\\$\\{(\\w[^}]*)}/g;\n const result = variableValue\n .replace(templateStringRegex, (_, rawKey) => {\n const value = mapOfDesignVariableKeys[rawKey];\n if (!value) {\n if (builtInStyles[variableName]?.defaultValue) {\n return String(builtInStyles[variableName].defaultValue);\n }\n if (optionalBuiltInStyles[variableName]?.defaultValue) {\n return String(optionalBuiltInStyles[variableName].defaultValue);\n }\n return '0px';\n }\n if (variableName === 'cfBorder' || variableName.startsWith('cfBorder_')) {\n if (typeof value === 'object') {\n const { width, style, color } = value;\n return `${width} ${style} ${color}`;\n }\n }\n return String(value);\n })\n // Replace all multiple spaces with a single space\n .replace(/ +/g, ' ');\n return result;\n};\nconst transformMedia$1 = (boundAsset, width, options) => {\n try {\n const asset = boundAsset;\n // Target width (px/rem/em) will be applied to the css url if it's lower than the original image width (in px)\n const assetDetails = asset.fields.file?.details;\n const assetWidth = assetDetails?.image?.width || 0; // This is always in px\n if (!options) {\n return asset.fields.file?.url;\n }\n const targetWidthObject = parseCSSValue(options.targetSize); // Contains value and unit (px/rem/em) so convert and then compare to assetWidth\n const targetValue = targetWidthObject ? getTargetValueInPixels(targetWidthObject) : assetWidth;\n if (targetValue < assetWidth)\n width = `${targetValue}px`;\n return getOptimizedBackgroundImageAsset(asset.fields.file, width, options.quality, options.format);\n }\n catch (error) {\n debug.error('[experiences-core::ssrStyles] Error transforming image asset', error);\n }\n return boundAsset.fields.file?.url;\n};\nconst resolveBackgroundImageBinding = ({ variableData, getBoundEntityById, dataSource = {}, unboundValues = {}, componentVariablesOverwrites, componentSettings = { variableDefinitions: {} }, options, width, }) => {\n if (variableData.type === 'UnboundValue') {\n const uuid = variableData.key;\n return unboundValues[uuid]?.value;\n }\n if (variableData.type === 'ComponentValue') {\n const variableDefinitionKey = variableData.key;\n const variableDefinition = componentSettings.variableDefinitions[variableDefinitionKey];\n // @ts-expect-error TODO: Types coming from validations erroneously assume that `defaultValue` can be a primitive value (e.g. string or number)\n const defaultValueKey = variableDefinition.defaultValue?.key;\n const defaultValue = unboundValues[defaultValueKey].value;\n const overwriteValue = componentVariablesOverwrites?.[variableDefinitionKey];\n // overwriteValue is a ComponentValue we can safely return the default value\n if (!overwriteValue || overwriteValue.type === 'ComponentValue') {\n return defaultValue;\n }\n // at this point overwriteValue will either be type of 'DesignValue' or 'BoundValue'\n // so we recursively run resolution again to resolve it\n const resolvedValue = resolveBackgroundImageBinding({\n variableData: overwriteValue,\n getBoundEntityById,\n dataSource,\n unboundValues,\n componentVariablesOverwrites,\n componentSettings,\n options,\n width,\n });\n return resolvedValue || defaultValue;\n }\n if (variableData.type === 'BoundValue') {\n // '/lUERH7tX7nJTaPX6f0udB/fields/assetReference/~locale/fields/file/~locale'\n const [, uuid] = variableData.path.split('/');\n const binding = dataSource[uuid];\n // Safeguard against edge cases - we should not have bound style values that do not have a data source entry.\n // However, just in case, we handle it here as empty and allow the user to replace without errors.\n if (!binding) {\n return;\n }\n const boundEntity = getBoundEntityById(binding.sys.id);\n if (!boundEntity) {\n return;\n }\n if (boundEntity.sys.type === 'Asset') {\n return transformMedia$1(boundEntity, width, options);\n }\n else {\n // '/lUERH7tX7nJTaPX6f0udB/fields/assetReference/~locale/fields/file/~locale'\n // becomes\n // '/fields/assetReference/~locale/fields/file/~locale'\n const pathWithoutUUID = variableData.path.split(uuid)[1];\n // '/fields/assetReference/~locale/fields/file/~locale'\n // becomes\n // '/fields/assetReference/'\n const pathToReferencedAsset = pathWithoutUUID.split('~locale')[0];\n // '/fields/assetReference/'\n // becomes\n // '[fields, assetReference]'\n const [, fieldName] = pathToReferencedAsset.substring(1).split('/') ?? undefined;\n const referenceToAsset = boundEntity.fields[fieldName];\n if (!referenceToAsset) {\n return;\n }\n if (referenceToAsset.sys?.linkType === 'Asset') {\n const referencedAsset = getBoundEntityById(referenceToAsset.sys.id);\n if (!referencedAsset) {\n return;\n }\n return transformMedia$1(referencedAsset, width, options);\n }\n }\n }\n};\nconst resolveVariable = ({ variableData, defaultBreakpoint, componentSettings = { variableDefinitions: {} }, componentVariablesOverwrites, }) => {\n if (variableData?.type === 'DesignValue') {\n return variableData.valuesByBreakpoint[defaultBreakpoint] || {};\n }\n else if (variableData?.type === 'ComponentValue') {\n const variableDefinitionKey = variableData.key;\n const variableDefinition = componentSettings.variableDefinitions[variableDefinitionKey];\n const defaultValue = variableDefinition.defaultValue;\n const userSetValue = componentVariablesOverwrites?.[variableDefinitionKey];\n if (!userSetValue || userSetValue.type === 'ComponentValue') {\n return defaultValue?.valuesByBreakpoint[defaultBreakpoint] || '';\n }\n return resolveVariable({\n variableData: userSetValue,\n defaultBreakpoint,\n componentSettings,\n componentVariablesOverwrites,\n });\n }\n};\n/**\n * Takes the initial set of properties, filters only design properties that will be mapped to CSS and\n * re-organizes them to be indexed by breakpoint ID (\"breakpoint > variable > value\"). It will\n * also resolve the design/ component values to plain values.\n *\n * **Example Input**\n * ```\n * variables = {\n * cfMargin: { type: 'DesignValue', valuesByBreakpoint: { desktop: '1px', tablet: '2px' } },\n * cfPadding: { type: 'DesignValue', valuesByBreakpoint: { desktop: '3px', mobile: '4px' } }\n * }\n * ```\n *\n * **Example Output**\n * ```\n * variableValuesByBreakpoints = {\n * desktop: {\n * cfMargin: '1px',\n * cfPadding: '3px'\n * },\n * tablet: {\n * cfMargin: '2px'\n * },\n * mobile: {\n * cfPadding: '4px'\n * }\n * }\n * ```\n *\n * **Note**\n * - The property cfBackgroundImageUrl is the only content property that gets mapped to CSS as well.\n * It will be solely stored on the default breakpoint.\n * - For ComponentValues, it will either take the override from the pattern instance or fallback to\n * the defaultValue defined in variableDefinitions.\n */\nconst indexByBreakpoint = ({ variables, breakpointIds, getBoundEntityById, unboundValues = {}, dataSource = {}, componentVariablesOverwrites, componentSettings = { variableDefinitions: {} }, }) => {\n const variableValuesByBreakpoints = breakpointIds.reduce((acc, breakpointId) => {\n return {\n ...acc,\n [breakpointId]: {},\n };\n }, {});\n const defaultBreakpoint = breakpointIds[0];\n for (const [variableName, variableData] of Object.entries(variables)) {\n // handling the special case - cfBackgroundImageUrl variable, which can be bound or unbound\n // so, we need to resolve it here and pass it down as a css property to be converted into the CSS\n // I used .startsWith() cause it can be part of a pattern node\n if (variableName === 'cfBackgroundImageUrl' ||\n // TODO: Test this for nested patterns as the name might be just a random hash without the actual name (needs to be validated).\n variableName.startsWith('cfBackgroundImageUrl_')) {\n const width = resolveVariable({\n variableData: variables['cfWidth'],\n defaultBreakpoint,\n componentSettings,\n componentVariablesOverwrites,\n });\n const options = resolveVariable({\n variableData: variables['cfBackgroundImageOptions'],\n defaultBreakpoint,\n componentSettings,\n componentVariablesOverwrites,\n });\n if (!options) {\n debug.error('[experiences-core::ssrStyles] Error transforming image asset: Required variable [cfBackgroundImageOptions] missing from component definition');\n continue;\n }\n const imageUrl = resolveBackgroundImageBinding({\n variableData,\n getBoundEntityById,\n unboundValues,\n dataSource,\n componentSettings,\n componentVariablesOverwrites,\n width,\n options,\n });\n if (imageUrl) {\n variableValuesByBreakpoints[defaultBreakpoint][variableName] = imageUrl;\n }\n continue;\n }\n let resolvedVariableData = variableData;\n if (variableData.type === 'ComponentValue') {\n const variableDefinition = componentSettings?.variableDefinitions[variableData.key];\n const defaultValue = variableDefinition.defaultValue;\n if (variableDefinition.group === 'style' && defaultValue !== undefined) {\n const overwriteVariableData = componentVariablesOverwrites?.[variableData.key];\n resolvedVariableData = mergeDefaultAndOverwriteValues(defaultValue, overwriteVariableData);\n }\n }\n if (resolvedVariableData.type !== 'DesignValue') {\n continue;\n }\n for (const [breakpointId, variableValue] of Object.entries(resolvedVariableData.valuesByBreakpoint)) {\n if (!isValidBreakpointValue(variableValue)) {\n continue;\n }\n variableValuesByBreakpoints[breakpointId] = {\n ...variableValuesByBreakpoints[breakpointId],\n [variableName]: variableValue,\n };\n }\n }\n return variableValuesByBreakpoints;\n};\n/**\n * Flattens the object from\n * `{ color: { [key]: [value] } }`\n * to\n * `{ 'color.key': [value] }`\n */\nconst flattenDesignTokenRegistry = (designTokenRegistry) => {\n const flattenObject = (obj, prefix = '') => {\n return Object.entries(obj).reduce((acc, [key, value]) => {\n const newKey = prefix ? `${prefix}.${key}` : key;\n if (value &&\n typeof value === 'object' &&\n !Array.isArray(value) &&\n // handle border types\n !(typeof value === 'object' && ('width' in value || 'style' in value || 'color' in value))) {\n // Recursively flatten nested objects, but skip objects that look like border definitions\n return {\n ...acc,\n ...flattenObject(value, newKey),\n };\n }\n else {\n // This is a leaf value (string, number, or border object)\n return {\n ...acc,\n [newKey]: value,\n };\n }\n }, {});\n };\n return flattenObject(designTokenRegistry);\n};\nfunction mergeDefaultAndOverwriteValues(defaultValue, overwriteValue) {\n if (defaultValue?.type === 'DesignValue' && overwriteValue?.type === 'DesignValue') {\n return mergeDesignValuesByBreakpoint(defaultValue, overwriteValue);\n }\n return overwriteValue ?? defaultValue;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction get(obj, path) {\n if (!path.length) {\n return obj;\n }\n try {\n const [currentPath, ...nextPath] = path;\n return get(obj[currentPath], nextPath);\n }\n catch (err) {\n return undefined;\n }\n}\n\nconst getBoundValue = (entryOrAsset, path) => {\n const value = get(entryOrAsset, path.split('/').slice(2, -1));\n return value && typeof value == 'object' && value.url\n ? value.url\n : value;\n};\n\nconst transformRichText = (entryOrAsset, entityStore, path) => {\n const value = getBoundValue(entryOrAsset, path);\n if (typeof value === 'string') {\n return {\n data: {},\n content: [\n {\n nodeType: BLOCKS.PARAGRAPH,\n data: {},\n content: [\n {\n data: {},\n nodeType: 'text',\n value: value,\n marks: [],\n },\n ],\n },\n ],\n nodeType: BLOCKS.DOCUMENT,\n };\n }\n if (typeof value === 'object' && value.nodeType === BLOCKS.DOCUMENT) {\n // resolve any links to assets/entries/hyperlinks\n // we need to clone, as we want to keep the original Entity in the EntityStore intact,\n // and resolveLinks() is mutating the node object.\n const richTextDocument = cloneDeep(value);\n resolveLinks(richTextDocument, entityStore);\n return richTextDocument;\n }\n return undefined;\n};\nconst isLinkTarget = (node) => {\n return node?.data?.target?.sys?.type === 'Link';\n};\nconst resolveLinks = (node, entityStore) => {\n if (!node)\n return;\n // Resolve link if current node has one\n if (isLinkTarget(node)) {\n const entity = entityStore.getEntityFromLink(node.data.target);\n if (entity) {\n node.data.target = entity;\n }\n }\n // Process content array if it exists\n if ('content' in node && Array.isArray(node.content)) {\n node.content.forEach((childNode) => resolveLinks(childNode, entityStore));\n }\n};\n\nconst MAX_WIDTH_ALLOWED = 4000;\nconst getOptimizedImageAsset = ({ file, sizes, loading, quality = '100%', format, }) => {\n const qualityNumber = Number(quality.replace('%', ''));\n if (!validateParams(file, qualityNumber, format)) ;\n const url = file.url;\n const maxWidth = Math.min(file.details.image.width, MAX_WIDTH_ALLOWED);\n const numOfParts = Math.max(2, Math.ceil(maxWidth / 500));\n const widthParts = Array.from({ length: numOfParts }, (_, index) => Math.ceil((index + 1) * (maxWidth / numOfParts)));\n const srcSet = sizes\n ? widthParts.map((width) => `${getOptimizedImageUrl(url, width, qualityNumber, format)} ${width}w`)\n : [];\n const intrinsicImageWidth = file.details.image.width;\n if (intrinsicImageWidth > MAX_WIDTH_ALLOWED) {\n srcSet.push(`${getOptimizedImageUrl(url, undefined, qualityNumber, format)} ${intrinsicImageWidth}w`);\n }\n const returnedUrl = getOptimizedImageUrl(url, file.details.image.width > 2000 ? 2000 : undefined, qualityNumber, format);\n const optimizedImageAsset = {\n url: returnedUrl,\n srcSet,\n sizes,\n file,\n loading,\n };\n return optimizedImageAsset;\n};\n\nconst transformMedia = (asset, variables, resolveDesignValue, variableName, path) => {\n let value;\n // If it is not a deep path and not pointing to the file of the asset,\n // it is just pointing to a normal field and therefore we just resolve the value as normal field\n if (!isDeepPath(path) && !lastPathNamedSegmentEq(path, 'file')) {\n return getBoundValue(asset, path);\n }\n //TODO: this will be better served by injectable type transformers instead of if statement\n if (variableName === 'cfImageAsset') {\n const optionsVariableName = 'cfImageOptions';\n const options = resolveDesignValue(variables[optionsVariableName]?.type === 'DesignValue'\n ? variables[optionsVariableName].valuesByBreakpoint\n : {});\n if (!options) {\n debug.error(`[experiences-core::transformMedia] Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);\n return;\n }\n try {\n value = getOptimizedImageAsset({\n file: asset.fields.file,\n loading: options.loading,\n sizes: options.targetSize,\n quality: options.quality,\n format: options.format,\n });\n return value;\n }\n catch (error) {\n debug.error('[experiences-core::transformMedia] Error transforming image asset', error);\n }\n return;\n }\n if (variableName === 'cfBackgroundImageUrl') {\n let width = resolveDesignValue(variables['cfWidth']?.type === 'DesignValue' ? variables['cfWidth'].valuesByBreakpoint : {}, 'cfWidth') || '100%';\n const optionsVariableName = 'cfBackgroundImageOptions';\n const options = resolveDesignValue(variables[optionsVariableName]?.type === 'DesignValue'\n ? variables[optionsVariableName].valuesByBreakpoint\n : {});\n if (!options) {\n debug.error(`[experiences-core::transformMedia] Error transforming image asset: Required variable [${optionsVariableName}] missing from component definition`);\n return;\n }\n try {\n // Target width (px/rem/em) will be applied to the css url if it's lower than the original image width (in px)\n const assetDetails = asset.fields.file?.details;\n const assetWidth = assetDetails?.image?.width || 0; // This is always in px\n const targetWidthObject = parseCSSValue(options.targetSize); // Contains value and unit (px/rem/em) so convert and then compare to assetWidth\n const targetValue = targetWidthObject\n ? getTargetValueInPixels(targetWidthObject)\n : assetWidth;\n if (targetValue < assetWidth)\n width = `${targetValue}px`;\n value = getOptimizedBackgroundImageAsset(asset.fields.file, width, options.quality, options.format);\n return value;\n }\n catch (error) {\n debug.error('[experiences-core::transformMedia] Error transforming image asset', error);\n }\n return;\n }\n return asset.fields.file?.url;\n};\n\nconst isExperienceEntry = (entry) => {\n return (entry?.sys?.type === 'Entry' &&\n !!entry.fields?.title &&\n !!entry.fields?.slug &&\n !!entry.fields?.componentTree &&\n Array.isArray(entry.fields.componentTree.breakpoints) &&\n Array.isArray(entry.fields.componentTree.children) &&\n typeof entry.fields.componentTree.schemaVersion === 'string');\n};\nconst isPatternEntry = (entry) => {\n return isExperienceEntry(entry) && !!entry.fields?.componentSettings; // signals that this is pattern (not experience) entry\n};\nconst isEntry = (value) => {\n return (null !== value &&\n typeof value === 'object' &&\n 'sys' in value &&\n value.sys?.type === 'Entry');\n};\nconst isAsset = (value) => {\n return (null !== value &&\n typeof value === 'object' &&\n 'sys' in value &&\n value.sys?.type === 'Asset');\n};\n/**\n * Checks if the values is an array of links.\n * Note: we use convention where empty arrays are considered valid \"arrays of links\"\n * as they don't contradict the type definition.\n */\nconst isArrayOfLinks = (value) => {\n return Array.isArray(value) && value.every((item) => isLink(item));\n};\n\nfunction getResolvedEntryFromLink(entryOrAsset, path, entityStore) {\n if (isAsset(entryOrAsset)) {\n return entryOrAsset;\n }\n else if (!isEntry(entryOrAsset)) {\n throw new Error(`Expected an Entry or Asset, but got: ${JSON.stringify(entryOrAsset)}`);\n }\n const fieldName = path.split('/').slice(2, -1);\n const value = get(entryOrAsset, fieldName);\n let resolvedEntity;\n if (isAsset(value) || isEntry(value)) {\n // In some cases, reference fields are already resolved\n resolvedEntity = value;\n }\n else if (value?.sys.type === 'Link') {\n // Look up the reference in the entity store\n resolvedEntity = entityStore.getEntityFromLink(value);\n }\n else {\n debug.warn(`[experiences-core::getResolvedEntryFromLink] When attempting to follow link in field '${fieldName}' of entity, the value is expected to be a link, but got: ${JSON.stringify(value)}`, { entity: entryOrAsset });\n return;\n }\n // no need to make structuredClone(entityStore.getEntityFromLink(value)) because\n // we provide component with the original Object.frozen object of the entity.\n // As we don't resolve L3 and don't mutate the entity before returning anymore,\n // we don't need to make a copy of the entity. And even provide better referential integrity\n // for the component for the same entity.\n if (!resolvedEntity) {\n return;\n }\n return resolvedEntity;\n}\n\nconst excludeUndefined = (value) => {\n return value !== undefined;\n};\nfunction getArrayValue(entryOrAsset, path, entityStore) {\n // NOTE: Not sure if we need this if-statement,\n // as it is NOT possible to bind to Array variable an Asset\n // (as Assets don't have multi-reference fields) unless it's a degenerate case.\n if (entryOrAsset.sys.type === 'Asset') {\n return entryOrAsset;\n }\n const fieldName = path.split('/').slice(2, -1);\n const arrayValue = get(entryOrAsset, fieldName);\n if (!Array.isArray(arrayValue)) {\n debug.warn(`[experiences-core::getArrayValue] A field '${fieldName}' of an entity was bound to an Array variable. Expected value of that field to be an array, but got: ${JSON.stringify(arrayValue)}`, { entity: entryOrAsset });\n return;\n }\n const result = arrayValue\n .map((value) => {\n if (typeof value === 'string') {\n return value; // handles case where Text array is bound (in [Content Model] tab of the platform, select Text and make it a list)\n }\n else if (value?.sys?.type === 'Link') {\n const resolvedEntity = entityStore.getEntityFromLink(value);\n if (!resolvedEntity) {\n // We return undefined, which means that entity wasn't availble in the Entity Store due to:\n // - because it's archived entity (and they normally wouldn't be sent to the Entity Store)\n // - bug where some entity wasn't added to the Entity Store\n // BTW, deleted entities shouldn't even be possible here as they require CT deletion first and that shouldn't allow us to load them at all)\n return;\n }\n return resolvedEntity;\n }\n else {\n debug.warn(`[experiences-core::getArrayValue] Expected value to be a string or Link, but got: ${JSON.stringify(value)}`);\n return undefined;\n }\n })\n .filter(excludeUndefined);\n // eg. imagine you have multi-referene field with 3 links to archived entries,\n // all of them will be undefined on previous step and will be filtered out\n // of resultWithoutUndefined. Instead of passing to component an empty array,\n // we pass undefined. This means that develloper making custom component\n // does not have to handle empty array case. But only undefiened, which signals:\n // user didn't bind anything; user bound to reference field which is unset; all references are archived\n return result.length > 0 ? result : undefined;\n}\n\nconst transformBoundContentValue = (variables, entityStore, binding, resolveDesignValue, variableName, variableType, path) => {\n const entityOrAsset = entityStore.getEntryOrAsset(binding, path);\n if (!entityOrAsset)\n return;\n switch (variableType) {\n case 'Media':\n // If we bound a normal entry field to the media variable we just return the bound value\n if (entityOrAsset.sys.type === 'Entry') {\n return getBoundValue(entityOrAsset, path);\n }\n return transformMedia(entityOrAsset, variables, resolveDesignValue, variableName, path);\n case 'RichText':\n return transformRichText(entityOrAsset, entityStore, path);\n case 'Array':\n return getArrayValue(entityOrAsset, path, entityStore);\n case 'Link':\n return getResolvedEntryFromLink(entityOrAsset, path, entityStore);\n default:\n return getBoundValue(entityOrAsset, path);\n }\n};\n\nfunction treeVisit(initialNode, onNode) {\n // returns last used index\n const _treeVisit = (currentNode, currentIndex, currentDepth) => {\n // Copy children in case of onNode removing it as we pass the node by reference\n const children = [...currentNode.children];\n onNode(currentNode, currentIndex, currentDepth);\n let nextAvailableIndex = currentIndex + 1;\n const lastUsedIndex = currentIndex;\n for (const child of children) {\n const lastUsedIndex = _treeVisit(child, nextAvailableIndex, currentDepth + 1);\n nextAvailableIndex = lastUsedIndex + 1;\n }\n return lastUsedIndex;\n };\n _treeVisit(initialNode, 0, 0);\n}\n/**\n * Traverses all nodes of a tree and maps all of them.\n * Intuitively works similarly to Array.map().\n * When returning mapped object from the mapper function\n * you _do not_ need to return about `.children[]` field.\n * This field is automatically managed by the treeMap() function.\n *\n * You can map each node to whatever you want, but shouldn't\n * modify the structure of the tree from the mapping function.\n */\nfunction treeMap(node, onNode) {\n // Copy children in case of onNode removing it as we pass the node by reference\n const children = [...node.children];\n const newNode = {\n ...onNode(node),\n children: children.map((child) => treeMap(child, onNode)),\n };\n return newNode;\n}\n\nclass ParseError extends Error {\n constructor(message) {\n super(message);\n }\n}\nconst isValidJsonObject = (s) => {\n try {\n const result = JSON.parse(s);\n if ('object' !== typeof result) {\n return false;\n }\n return true;\n }\n catch (e) {\n return false;\n }\n};\nconst doesMismatchMessageSchema = (event) => {\n try {\n tryParseMessage(event);\n return false;\n }\n catch (e) {\n if (e instanceof ParseError) {\n return e.message;\n }\n throw e;\n }\n};\nconst tryParseMessage = (event) => {\n if (!event.data) {\n throw new ParseError('Field event.data is missing');\n }\n if ('string' !== typeof event.data) {\n throw new ParseError(`Field event.data must be a string, instead of '${typeof event.data}'`);\n }\n if (!isValidJsonObject(event.data)) {\n throw new ParseError('Field event.data must be a valid JSON object serialized as string');\n }\n const eventData = JSON.parse(event.data);\n if (!eventData.source) {\n throw new ParseError(`Field eventData.source must be equal to 'composability-app'`);\n }\n if ('composability-app' !== eventData.source) {\n throw new ParseError(`Field eventData.source must be equal to 'composability-app', instead of '${eventData.source}'`);\n }\n // check eventData.eventType\n const supportedEventTypes = Object.values(INCOMING_EVENTS);\n if (!supportedEventTypes.includes(eventData.eventType)) {\n // Expected message: This message is handled in the EntityStore to store fetched entities\n if (eventData.eventType !== PostMessageMethods.REQUESTED_ENTITIES) {\n throw new ParseError(`Field eventData.eventType must be one of the supported values: [${supportedEventTypes.join(', ')}]`);\n }\n }\n return eventData;\n};\nconst validateExperienceBuilderConfig = ({ locale, mode, }) => {\n if (mode === StudioCanvasMode.EDITOR || mode === StudioCanvasMode.READ_ONLY) {\n return;\n }\n if (!locale) {\n throw new Error('Parameter \"locale\" is required for experience builder initialization outside of editor mode');\n }\n};\n\nconst uniqueById = (arr) => {\n const map = new Map();\n arr.forEach((item) => map.set(item.sys.id, item));\n return [...map.values()];\n};\nconst isObject = (value) => {\n return typeof value === 'object' && value !== null;\n};\n/**\n * Extracts all references from an entry.\n * Handles both: reference and multi-reference fields.\n * Returns unique array of references (even if they repeat within the entry).\n */\nconst referencesOf = (entry, fnShouldFollowReferencesOfEntryField) => {\n const references = [];\n const handleArray = (fieldValue, _fieldName) => {\n for (const item of fieldValue) {\n if (isObject(item) && item.sys?.type === 'Link') {\n references.push(item);\n }\n }\n };\n const handleLink = (fieldValue, _fieldName) => {\n references.push(fieldValue);\n };\n for (const [fieldName, fieldValue] of Object.entries(entry.fields)) {\n if (fnShouldFollowReferencesOfEntryField &&\n !fnShouldFollowReferencesOfEntryField(fieldName, entry)) {\n continue;\n }\n if (fieldValue === undefined) {\n continue; // edge case when field is present on object, but is set to undefined explicitly e.g. during test mocking { myField: undefined }\n }\n if (Array.isArray(fieldValue)) {\n handleArray(fieldValue);\n }\n else if (fieldValue !== null &&\n isObject(fieldValue) &&\n fieldValue.sys?.type === 'Link') {\n handleLink(fieldValue);\n }\n }\n return uniqueById(references);\n};\n// -- REFERENCE EXTRACTION UTILITIES --\nfunction extractReferencesFromEntriesAsIds(entries) {\n const [uniqueEntries, uniqueAssets, uniqueReferences] = extractReferencesFromEntries(entries);\n const entryIds = uniqueEntries.map((link) => link.sys.id);\n const assetIds = uniqueAssets.map((link) => link.sys.id);\n const referenceIds = uniqueReferences.map((link) => link.sys.id);\n return [entryIds, assetIds, referenceIds];\n}\nfunction extractReferencesFromEntries(entries) {\n const allReferences = entries.flatMap((entry) => referencesOf(entry));\n const uniqueReferences = uniqueById(allReferences);\n const uniqueAssets = uniqueReferences.filter((link) => link.sys.linkType === 'Asset');\n const uniqueEntries = uniqueReferences.filter((link) => link.sys.linkType === 'Entry');\n return [uniqueEntries, uniqueAssets, uniqueReferences];\n}\n\nconst excludeAssets = (entity) => !isAsset(entity);\nconst excludePatternEntries = (entry) => !isPatternEntry(entry);\n/**\n * Parses experience and extracts all leaf links that are referenced from the experience.\n * PRECONDITION: Relies on the fact that entityStore is preloaded with all dataSource\n * entries using include=2 (meaning that up to L3 entries are already preloaded into EntitStore).\n *\n * The function iterates over all entries in the entityStore (assuming they can be L1, L2, L3) and\n * over all of their references. Any references that are NOT available in the entityStore are considered\n * \"leaf references\" aka \"leaf links\" and are returned.\n *\n * The EntityStore happens to contain also entities representing patterns, which we do NOT consider\n * as entries that point to leaf links. So we don't iterate over patterns only over entries which\n * can be used for binding.\n */\nconst extractLeafLinksReferencedFromExperience = (experience) => {\n const assetLinks = [];\n const entryLinks = [];\n if (!experience.entityStore) {\n throw new Error('Parameter `experience` should have valid `experience.entityStore` object. Without it, we cannot extract leaf links. Most likely you passed `experience` instance that was not fully fetched. Check your experience fetching logic.');\n }\n // We want only leaf links which can be used for binding. We use two filters:\n // excludeAssets: because assets do not have references, so we don't need to traverse them\n // excludePatternEntries: because EntityStore happens to also store pattern-entries.\n // Those point to other patterns, and we don't want to consider them as\n // parents of leaf links pointing to actual data carrying entries used for binding.\n const entries = experience.entityStore.entities\n .filter(excludeAssets)\n .filter(excludePatternEntries);\n // We assume that ALL of the entries in the experience\n for (const entry of entries) {\n const references = referencesOf(entry);\n for (const ref of references) {\n if (isLinkToAsset(ref)) {\n if (!experience.entityStore.getEntityFromLink(ref)) {\n assetLinks.push(ref);\n }\n }\n else if (isLinkToEntry(ref)) {\n if (!experience.entityStore.getEntityFromLink(ref)) {\n entryLinks.push(ref);\n }\n }\n else {\n debug.warn(`[experiences-core::experienceSchema] Unexpected reference type found in entry \"${entry.sys.id}\": ${JSON.stringify(ref)}`);\n }\n }\n }\n const dedupedAssetLinks = uniqueById(assetLinks);\n const dedupedEntryLinks = uniqueById(entryLinks);\n return {\n assetLinks: dedupedAssetLinks,\n entryLinks: dedupedEntryLinks,\n assetIds: dedupedAssetLinks.map((link) => link.sys.id),\n entryIds: dedupedEntryLinks.map((link) => link.sys.id),\n };\n};\n\nconst splitDirectAndSlotChildren = (allChildNodes, componentDefinition) => {\n // Bridge difference between editor and delivery mode\n const getSlotId = (child) => {\n if ('data' in child)\n return child.data.slotId;\n return child.slotId;\n };\n const slotNodesMap = {};\n for (const slotId in componentDefinition.slots) {\n // We only allow one component per slot (container). This is just safer to not render components twice or not at all\n const nodes = allChildNodes.filter((child) => getSlotId(child) === slotId);\n slotNodesMap[slotId] = nodes.length ? nodes : null;\n }\n const directChildNodes = allChildNodes.filter((child) => getSlotId(child) === undefined);\n if (!componentDefinition.children || !directChildNodes.length) {\n // If there are no children allowed in the component or no children added, render as undefined\n return { slotNodesMap, directChildNodes: undefined };\n }\n return { slotNodesMap, directChildNodes };\n};\n\nconst flattenNestedPatterns = (fetchedPatterns) => {\n const patternsById = {};\n const queue = [...fetchedPatterns];\n while (queue.length) {\n const pattern = queue.shift();\n if (!pattern) {\n continue;\n }\n if (patternsById[pattern.sys.id]) {\n continue;\n }\n patternsById[pattern.sys.id] = pattern;\n if (!Array.isArray(pattern.fields.usedComponents) || !pattern.fields.usedComponents.length) {\n continue;\n }\n for (const nestedPattern of pattern.fields.usedComponents) {\n if (!isLink(nestedPattern)) {\n queue.push(nestedPattern);\n }\n }\n }\n return Object.values(patternsById);\n};\n/**\n * Given a list of patterns, extract the prebinding data into a more digestable format indexed by the pattern entry id\n * @param patterns a list of pattern entries\n * @returns a map of pattern entry ids to their prebinding data\n */\nconst extractPrebindingDataByPatternId = (patterns) => {\n const prebindingDataByPatternId = {};\n for (const pattern of patterns) {\n const patternId = pattern.sys.id;\n const [prebindingDefinition] = pattern.fields.componentSettings?.prebindingDefinitions ?? [];\n if (!prebindingDefinition)\n continue;\n const [nativeParameterId] = Object.entries(prebindingDefinition.parameterDefinitions ?? {}).find(([, value]) => !value.passToNodes?.length) ?? [];\n const prebindingData = {\n prebindingDefinitionId: prebindingDefinition.id,\n parameterIds: Object.keys(prebindingDefinition.parameterDefinitions),\n nativeParameterId,\n parameterDefinitions: prebindingDefinition.parameterDefinitions,\n variableMappings: prebindingDefinition.variableMappings,\n };\n prebindingDataByPatternId[patternId] = prebindingData;\n }\n return prebindingDataByPatternId;\n};\nconst generateDefaultDataSourceForPrebindingDefinition = (prebindingDefinitions = []) => {\n if (!prebindingDefinitions ||\n !Array.isArray(prebindingDefinitions) ||\n !prebindingDefinitions.length) {\n return { dataSource: {}, parameters: {} };\n }\n const prebindingDefinition = prebindingDefinitions[0];\n const dataSource = {};\n const parameters = {};\n for (const [parameterId, parameterDefinition] of Object.entries(prebindingDefinition.parameterDefinitions ?? {})) {\n if (parameterDefinition.defaultSource && isLink(parameterDefinition.defaultSource.link)) {\n const dataSourceKey = parameterDefinition.defaultSource.link.sys.id;\n dataSource[dataSourceKey] = parameterDefinition.defaultSource.link;\n parameters[parameterId] = {\n type: 'BoundValue',\n path: `/${dataSourceKey}`,\n };\n }\n }\n return {\n dataSource,\n parameters,\n };\n};\nfunction getTargetPatternMappingsForParameter({ fetchedPatterns, prebindingDataByPatternId, patternNodeDefinitionId, parameterId, }) {\n const patternPrebindingData = prebindingDataByPatternId[patternNodeDefinitionId];\n if (!patternPrebindingData)\n return undefined;\n if (patternPrebindingData.parameterIds.includes(parameterId)) {\n if (patternPrebindingData.nativeParameterId === parameterId) {\n if (!patternPrebindingData.variableMappings)\n return undefined;\n return Object.fromEntries(Object.entries(patternPrebindingData.variableMappings).filter(([, mapping]) => mapping.parameterId === parameterId));\n }\n else {\n const parameterDefinition = patternPrebindingData.parameterDefinitions[parameterId];\n if (!parameterDefinition || !parameterDefinition.passToNodes?.length)\n return undefined;\n const patternEntry = fetchedPatterns.find((entry) => entry.sys.id === patternNodeDefinitionId);\n if (!patternEntry)\n return undefined;\n let nestedPatternNode;\n treeVisit({\n definitionId: 'root',\n parameters: {},\n children: patternEntry.fields.componentTree.children,\n }, (node) => {\n if (node.id === parameterDefinition.passToNodes?.[0]?.nodeId) {\n nestedPatternNode = node;\n }\n return undefined;\n });\n if (!nestedPatternNode) {\n return undefined;\n }\n return getTargetPatternMappingsForParameter({\n fetchedPatterns,\n prebindingDataByPatternId,\n patternNodeDefinitionId: nestedPatternNode.definitionId,\n parameterId: parameterDefinition.passToNodes?.[0]?.parameterId,\n });\n }\n }\n}\n\nconst sendMessage = (eventType, data) => {\n if (typeof window === 'undefined') {\n return;\n }\n debug.debug(`[experiences-sdk-react::sendMessage] Sending message [${eventType}]`, {\n source: 'customer-app',\n eventType,\n payload: data,\n });\n window.parent?.postMessage({\n source: 'customer-app',\n eventType,\n payload: data,\n }, '*');\n};\n\nfunction deepFreeze(obj) {\n const propNames = Object.getOwnPropertyNames(obj);\n for (const name of propNames) {\n const value = obj[name];\n if (value && typeof value === 'object') {\n deepFreeze(value);\n }\n }\n return Object.freeze(obj);\n}\n\n/**\n * Base Store for entities\n * Can be extended for the different loading behaviours (editor, production, ..)\n */\nclass EntityStoreBase {\n constructor({ entities, locale }) {\n /* serialized */ this.entryMap = new Map();\n /* serialized */ this.assetMap = new Map();\n this.locale = locale;\n for (const entity of entities) {\n this.addEntity(entity);\n }\n }\n get entities() {\n return [...this.entryMap.values(), ...this.assetMap.values()];\n }\n updateEntity(entity) {\n this.addEntity(entity);\n }\n getEntryOrAsset(linkOrEntryOrAsset, path) {\n if (isDeepPath(path)) {\n return this.getDeepEntry(linkOrEntryOrAsset, path);\n }\n let entity;\n if (isLink(linkOrEntryOrAsset)) {\n const resolvedEntity = linkOrEntryOrAsset.sys.linkType === 'Entry'\n ? this.entryMap.get(linkOrEntryOrAsset.sys.id)\n : this.assetMap.get(linkOrEntryOrAsset.sys.id);\n if (!resolvedEntity || resolvedEntity.sys.type !== linkOrEntryOrAsset.sys.linkType) {\n debug.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(linkOrEntryOrAsset)}`);\n return;\n }\n entity = resolvedEntity;\n }\n else if (isAsset(linkOrEntryOrAsset) || isEntry(linkOrEntryOrAsset)) {\n // We already have the complete entity in preview & delivery (resolved by the CMA client)\n entity = linkOrEntryOrAsset;\n }\n else {\n throw new Error(`[experiences-core::EntityStoreBase] Unexpected object when resolving entity: ${JSON.stringify(linkOrEntryOrAsset)}`);\n }\n return entity;\n }\n /**\n * @deprecated in the base class this should be simply an abstract method\n * @param entityLink\n * @param path\n * @returns\n */\n getValue(entityLink, path) {\n const entity = this.getEntity(entityLink.sys.linkType, entityLink.sys.id);\n if (!entity) {\n // TODO: move to `debug` utils once it is extracted\n debug.warn(`Unresolved entity reference: ${entityLink.sys.linkType} with ID ${entityLink.sys.id}`);\n return;\n }\n return get(entity, path);\n }\n getEntityFromLink(link) {\n const resolvedEntity = link.sys.linkType === 'Entry'\n ? this.entryMap.get(link.sys.id)\n : this.assetMap.get(link.sys.id);\n if (!resolvedEntity || resolvedEntity.sys.type !== link.sys.linkType) {\n debug.warn(`[experiences-core::EntityStoreBase] Experience references unresolved entity: ${JSON.stringify(link)}`);\n return;\n }\n return resolvedEntity;\n }\n getAssetById(assetId) {\n const asset = this.assetMap.get(assetId);\n if (!asset) {\n debug.warn(`[experiences-core::EntityStoreBase] Asset with ID \"${assetId}\" is not found in the store`);\n return;\n }\n return asset;\n }\n getEntryById(entryId) {\n const entry = this.entryMap.get(entryId);\n if (!entry) {\n debug.warn(`[experiences-core::EntityStoreBase] Entry with ID \"${entryId}\" is not found in the store`);\n return;\n }\n return entry;\n }\n getEntitiesFromMap(type, ids) {\n const resolved = [];\n const missing = [];\n for (const id of ids) {\n const entity = this.getEntity(type, id);\n if (entity) {\n resolved.push(entity);\n }\n else {\n missing.push(id);\n }\n }\n return {\n resolved,\n missing,\n };\n }\n addEntity(entity) {\n if (isAsset(entity)) {\n // cloned and frozen\n this.assetMap.set(entity.sys.id, deepFreeze(cloneDeep(entity)));\n }\n else if (isEntry(entity)) {\n // cloned and frozen\n this.entryMap.set(entity.sys.id, deepFreeze(cloneDeep(entity)));\n }\n else {\n throw new Error(`Attempted to add an entity to the store that is neither Asset nor Entry: '${JSON.stringify(entity)}'`);\n }\n }\n async fetchAsset(id) {\n const { resolved, missing } = this.getEntitiesFromMap('Asset', [id]);\n if (missing.length) {\n // TODO: move to `debug` utils once it is extracted\n debug.warn(`[experiences-core::EntityStoreBase] Asset \"${id}\" is not in the store`);\n return;\n }\n return resolved[0];\n }\n async fetchAssets(ids) {\n const { resolved, missing } = this.getEntitiesFromMap('Asset', ids);\n if (missing.length) {\n throw new Error(`Missing assets in the store (${missing.join(',')})`);\n }\n return resolved;\n }\n async fetchEntry(id) {\n const { resolved, missing } = this.getEntitiesFromMap('Entry', [id]);\n if (missing.length) {\n // TODO: move to `debug` utils once it is extracted\n debug.warn(`[experiences-core::EntityStoreBase] Entry \"${id}\" is not in the store`);\n return;\n }\n return resolved[0];\n }\n async fetchEntries(ids) {\n const { resolved, missing } = this.getEntitiesFromMap('Entry', ids);\n if (missing.length) {\n throw new Error(`Missing assets in the store (${missing.join(',')})`);\n }\n return resolved;\n }\n getDeepEntry(linkOrEntryOrAsset, path) {\n const resolveFieldset = (unresolvedFieldset, headEntry) => {\n const resolvedFieldset = [];\n let entityToResolveFieldsFrom = headEntry;\n for (let i = 0; i < unresolvedFieldset.length; i++) {\n const isLeaf = i === unresolvedFieldset.length - 1; // with last row, we are not expecting a link, but a value\n const row = unresolvedFieldset[i];\n const [, field, _localeQualifier] = row;\n if (!entityToResolveFieldsFrom) {\n throw new Error(`Logic Error: Cannot resolve field ${field} of a fieldset as there is no entity to resolve it from.`);\n }\n if (isLeaf) {\n resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);\n break;\n }\n const fieldValue = get(entityToResolveFieldsFrom, ['fields', field]);\n if (undefined === fieldValue) {\n return {\n resolvedFieldset,\n isFullyResolved: false,\n reason: `Cannot resolve field Link<${entityToResolveFieldsFrom.sys.type}>(sys.id=${entityToResolveFieldsFrom.sys.id}).fields[${field}] as field value is not defined`,\n };\n }\n else if (isLink(fieldValue)) {\n const entity = this.getEntityFromLink(fieldValue);\n if (entity === undefined) {\n return {\n resolvedFieldset,\n isFullyResolved: false,\n reason: `Field reference Link (sys.id=${fieldValue.sys.id}) not found in the EntityStore, waiting...`,\n };\n }\n resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);\n entityToResolveFieldsFrom = entity; // we move up\n }\n else if (isAsset(fieldValue) || isEntry(fieldValue)) {\n resolvedFieldset.push([entityToResolveFieldsFrom, field, _localeQualifier]);\n entityToResolveFieldsFrom = fieldValue; // we move up\n }\n else {\n return {\n resolvedFieldset,\n isFullyResolved: false,\n reason: `Deep path points to an invalid field value of type '${typeof fieldValue}' (value=${fieldValue})`,\n };\n }\n }\n return {\n resolvedFieldset,\n isFullyResolved: true,\n };\n };\n const headEntity = isLink(linkOrEntryOrAsset)\n ? this.getEntityFromLink(linkOrEntryOrAsset)\n : linkOrEntryOrAsset;\n if (undefined === headEntity) {\n return;\n }\n const unresolvedFieldset = parseDataSourcePathIntoFieldset(path);\n // The purpose here is to take this intermediate representation of the deep-path\n // and to follow the links to the leaf-entity and field\n // in case we can't follow till the end, we should signal that there was null-reference in the path\n const { resolvedFieldset, isFullyResolved, reason } = resolveFieldset(unresolvedFieldset, headEntity);\n if (!isFullyResolved) {\n if (reason) {\n debug.log(`[experiences-core::EntityStoreBase] Deep path wasn't resolved till leaf node, falling back to undefined, because: ${reason}`);\n }\n return;\n }\n const [leafEntity] = resolvedFieldset[resolvedFieldset.length - 1];\n return leafEntity;\n }\n getEntity(type, id) {\n if (type === 'Asset') {\n return this.assetMap.get(id);\n }\n return this.entryMap.get(id);\n }\n toJSON() {\n return {\n entryMap: Object.fromEntries(this.entryMap),\n assetMap: Object.fromEntries(this.assetMap),\n locale: this.locale,\n };\n }\n}\n\n/**\n * EntityStore which resolves entries and assets from the editor\n * over the sendMessage and subscribe functions.\n */\nclass EditorEntityStore extends EntityStoreBase {\n constructor({ entities, locale, sendMessage, subscribe, timeoutDuration = 3000, }) {\n super({ entities, locale });\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n this.requestCache = new Map();\n this.cacheIdSeperator = ',';\n this.sendMessage = sendMessage;\n this.subscribe = subscribe;\n this.timeoutDuration = timeoutDuration;\n }\n cleanupPromise(referenceId) {\n setTimeout(() => {\n this.requestCache.delete(referenceId);\n }, 300);\n }\n getCacheId(id) {\n return id.length === 1 ? id[0] : id.join(this.cacheIdSeperator);\n }\n async fetchEntity(type, ids, skipCache = false) {\n let missing;\n if (!skipCache) {\n const { missing: missingFromCache, resolved } = this.getEntitiesFromMap(type, ids);\n if (missingFromCache.length === 0) {\n // everything is already in cache\n return resolved;\n }\n missing = missingFromCache;\n }\n else {\n missing = [...ids];\n }\n const cacheId = this.getCacheId(missing);\n const openRequest = this.requestCache.get(cacheId);\n if (openRequest) {\n return openRequest;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const newPromise = new Promise((resolve, reject) => {\n const unsubscribe = this.subscribe(PostMessageMethods.REQUESTED_ENTITIES, (message) => {\n const messageIds = [\n ...message.entities.map((entity) => entity.sys.id),\n ...(message.missingEntityIds ?? []),\n ];\n if (missing.every((id) => messageIds.includes(id))) {\n clearTimeout(timeout);\n resolve(message.entities);\n this.cleanupPromise(cacheId);\n ids.forEach((id) => this.cleanupPromise(id));\n unsubscribe();\n }\n else {\n debug.warn('[experiences-core::EditorEntityStore] Unexpected entities received in REQUESTED_ENTITIES. Ignoring this response.');\n }\n });\n const timeout = setTimeout(() => {\n reject(new Error(`Request for entities timed out ${this.timeoutDuration}ms for ${cacheId}`));\n this.cleanupPromise(cacheId);\n ids.forEach((id) => this.cleanupPromise(id));\n unsubscribe();\n }, this.timeoutDuration);\n this.sendMessage(PostMessageMethods.REQUEST_ENTITIES, {\n entityIds: missing,\n entityType: type,\n locale: this.locale,\n });\n });\n this.requestCache.set(cacheId, newPromise);\n ids.forEach((cid) => {\n this.requestCache.set(cid, newPromise);\n });\n const result = (await newPromise);\n result.forEach((value) => {\n this.addEntity(value);\n });\n return this.getEntitiesFromMap(type, ids).resolved;\n }\n async fetchAsset(id, skipCache = false) {\n try {\n return (await this.fetchAssets([id], skipCache))[0];\n }\n catch (err) {\n // TODO: move to debug utils once it is extracted\n debug.warn(`[experiences-core::EditorEntityStore] Failed to request asset ${id}`);\n return undefined;\n }\n }\n fetchAssets(ids, skipCache = false) {\n return this.fetchEntity('Asset', ids, skipCache);\n }\n async fetchEntry(id, skipCache = false) {\n try {\n return (await this.fetchEntries([id], skipCache))[0];\n }\n catch (err) {\n // TODO: move to debug utils once it is extracted\n debug.warn(`[experiences-core::EditorEntityStore] Failed to request entry ${id}`, err);\n return undefined;\n }\n }\n fetchEntries(ids, skipCache = false) {\n return this.fetchEntity('Entry', ids, skipCache);\n }\n}\n\nfunction transformAssetFileToUrl(fieldValue) {\n return fieldValue && typeof fieldValue == 'object' && fieldValue.url\n ? fieldValue.url\n : fieldValue;\n}\n\n// The default of 3s in the EditorEntityStore is sometimes timing out and\n// leads to not rendering bound content and assemblies.\nconst REQUEST_TIMEOUT = 10000;\nclass EditorModeEntityStore extends EditorEntityStore {\n constructor({ entities, locale }) {\n debug.debug(`[experiences-core::EditorModeEntityStore] Initializing editor entity store with ${entities.length} entities for locale ${locale}.`, { entities });\n const subscribe = (method, cb) => {\n const handleMessage = (event) => {\n const data = JSON.parse(event.data);\n if (typeof data !== 'object' || !data)\n return;\n if (data.source !== 'composability-app')\n return;\n if (data.eventType === method) {\n cb(data.payload);\n }\n };\n if (typeof window !== 'undefined') {\n window.addEventListener('message', handleMessage);\n }\n return () => {\n if (typeof window !== 'undefined') {\n window.removeEventListener('message', handleMessage);\n }\n };\n };\n super({ entities, sendMessage, subscribe, locale, timeoutDuration: REQUEST_TIMEOUT });\n }\n /**\n * This function collects and returns the list of requested entries and assets. Additionally, it checks\n * upfront whether any async fetching logic is actually happening. If not, it returns a plain `false` value, so we\n * can detect this early and avoid unnecessary re-renders.\n * @param entityLinks\n * @returns false if no async fetching is happening, otherwise a promise that resolves when all entities are fetched\n */\n async fetchEntities({ missingEntryIds, missingAssetIds, skipCache = false, }) {\n // Entries and assets will be stored in entryMap and assetMap\n await Promise.all([\n super.fetchEntries(missingEntryIds, skipCache),\n super.fetchAssets(missingAssetIds, skipCache),\n ]);\n }\n getMissingEntityIds(entityLinks) {\n const entryLinks = entityLinks.filter((link) => link.sys?.linkType === 'Entry');\n const assetLinks = entityLinks.filter((link) => link.sys?.linkType === 'Asset');\n const uniqueEntryIds = [...new Set(entryLinks.map((link) => link.sys.id))];\n const uniqueAssetIds = [...new Set(assetLinks.map((link) => link.sys.id))];\n const { missing: missingEntryIds } = this.getEntitiesFromMap('Entry', uniqueEntryIds);\n const { missing: missingAssetIds } = this.getEntitiesFromMap('Asset', uniqueAssetIds);\n return { missingEntryIds, missingAssetIds };\n }\n getValue(entityLinkOrEntity, path) {\n const entity = this.getEntryOrAsset(entityLinkOrEntity, path.join('/'));\n if (!entity) {\n return;\n }\n const fieldValue = get(entity, path);\n return transformAssetFileToUrl(fieldValue);\n }\n}\n\nconst resolveDeepUsedComponents = ({ experienceEntryFields, parentComponents, }) => {\n const totalUsedComponents = [];\n const usedComponents = experienceEntryFields?.usedComponents;\n if (!usedComponents || usedComponents.length === 0) {\n return [];\n }\n for (const component of usedComponents) {\n if ('fields' in component) {\n totalUsedComponents.push(component);\n if (parentComponents.has(component.sys.id)) {\n continue;\n }\n totalUsedComponents.push(...resolveDeepUsedComponents({\n experienceEntryFields: component.fields,\n parentComponents: new Set([...parentComponents, component.sys.id]),\n }));\n }\n }\n return totalUsedComponents;\n};\n\nclass EntityStore extends EntityStoreBase {\n constructor(options) {\n if (typeof options === 'string') {\n // For SSR/SSG, the entity store is created server-side and passed to the client as a serialised JSON.\n // So the properties in data.entityStore are equal to the attributes of this class (see `toJSON()`)\n const serializedAttributes = JSON.parse(options).entityStore;\n super({\n entities: [\n ...Object.values(serializedAttributes.entryMap),\n ...Object.values(serializedAttributes.assetMap),\n ],\n locale: serializedAttributes.locale,\n });\n this._hoistedParameterDefinitions = {};\n this._hoistedVariableMappings = {};\n this._experienceEntryFields = serializedAttributes._experienceEntryFields; // non-broken deserialization always should result in valid ExperienceFields\n this._experienceEntryId = serializedAttributes._experienceEntryId; // // non-broken deserialization always should result in valid experienceEntryId\n this._unboundValues = serializedAttributes._unboundValues; // non-broken deserialization always should result in valid unboundValues\n }\n else {\n const { experienceEntry, entities, locale } = options;\n if (!isExperienceEntry(experienceEntry)) {\n throw new Error('Provided entry is not an experience entry');\n }\n super({ entities, locale });\n this._hoistedParameterDefinitions = {};\n this._hoistedVariableMappings = {};\n this._experienceEntryFields = experienceEntry.fields;\n this._experienceEntryId = experienceEntry.sys.id;\n this._unboundValues = experienceEntry.fields.unboundValues;\n }\n this._isExperienceAPatternEntry = checkIsAssemblyEntry({\n fields: this._experienceEntryFields,\n });\n // DERIVE ENTITY STORE INSTANCE VARIBLES\n // Register prebindings\n {\n const usedComponentLinks = this._experienceEntryFields.usedComponents ?? [];\n const usedComponents = usedComponentLinks\n .map((component) => (isLink(component) ? this.getEntityFromLink(component) : component))\n .filter((component) => component !== undefined);\n this._hoistedParameterDefinitions = EntityStore.calculateHoistedParameterDefinitions(this._experienceEntryFields, usedComponents);\n this._hoistedVariableMappings = EntityStore.calculateHoistedVariableMappings(this._experienceEntryFields, usedComponents);\n }\n // Register deep references\n this._usedComponentsWithDeepReferences = resolveDeepUsedComponents({\n experienceEntryFields: this._experienceEntryFields,\n parentComponents: new Set([this._experienceEntryId]),\n });\n }\n static calculateHoistedParameterDefinitions(parentEntryFields, usedComponents) {\n let hoistedDefinitions = {};\n // --------------------\n // Hoist prebinding for the L1 parent pattern aka `pA`\n // --------------------\n hoistedDefinitions = Object.assign(hoistedDefinitions, parentEntryFields.componentSettings?.prebindingDefinitions?.[0].parameterDefinitions || {});\n // --------------------\n // Hoist prebinding for the L2 nested patterns, patterns aka`pB`\n // --------------------\n usedComponents.forEach((patternEntryLevel2) => {\n hoistedDefinitions = {\n ...hoistedDefinitions,\n ...patternEntryLevel2.fields.componentSettings?.prebindingDefinitions?.[0]\n .parameterDefinitions,\n };\n });\n // --------------------\n // Hoist prebinding for L3 nested patterns, patterns aka `pC`\n // --------------------\n const usedComponentsLevel3 = usedComponents.flatMap((patternEntryLevel2) => {\n const usedComponents = patternEntryLevel2.fields.usedComponents || [];\n const filteredUsedComponents = usedComponents.filter((component) => component !== undefined && isExperienceEntry(component));\n return filteredUsedComponents;\n });\n usedComponentsLevel3.forEach((patternEntryLevel3) => {\n hoistedDefinitions = {\n ...hoistedDefinitions,\n ...patternEntryLevel3.fields.componentSettings?.prebindingDefinitions?.[0]\n .parameterDefinitions,\n };\n });\n return hoistedDefinitions;\n }\n static calculateHoistedVariableMappings(parentEntryFields, usedComponents) {\n let hoistedMappings = {};\n // --------------------\n // Hoist prebinding for the L1 parent pattern aka `pA`\n // --------------------\n hoistedMappings = Object.assign(hoistedMappings, parentEntryFields.componentSettings?.prebindingDefinitions?.[0].variableMappings || {});\n // --------------------\n // Hoist prebinding for the L2 nested patterns, patterns aka`pB`\n // --------------------\n usedComponents.forEach((patternEntryLevel2) => {\n hoistedMappings = {\n ...hoistedMappings,\n ...patternEntryLevel2.fields.componentSettings?.prebindingDefinitions?.[0].variableMappings,\n };\n });\n // --------------------\n // Hoist prebinding for L3 nested patterns, patterns aka `pC`\n // --------------------\n const usedComponentsLevel3 = usedComponents.flatMap((patternEntryLevel2) => {\n const usedComponents = patternEntryLevel2.fields.usedComponents || [];\n const filteredUsedComponents = usedComponents.filter((component) => component !== undefined && isExperienceEntry(component));\n return filteredUsedComponents;\n });\n usedComponentsLevel3.forEach((patternEntryLevel3) => {\n hoistedMappings = {\n ...hoistedMappings,\n ...patternEntryLevel3.fields.componentSettings?.prebindingDefinitions?.[0].variableMappings,\n };\n });\n return hoistedMappings;\n }\n getCurrentLocale() {\n return this.locale;\n }\n get isExperienceAPatternEntry() {\n return this._isExperienceAPatternEntry;\n }\n get hoistedVariableMappings() {\n return this._hoistedVariableMappings;\n }\n get hoistedParameterDefinitions() {\n return this._hoistedParameterDefinitions;\n }\n get experienceEntryFields() {\n return this._experienceEntryFields;\n }\n get experienceEntryId() {\n return this._experienceEntryId;\n }\n get schemaVersion() {\n return this._experienceEntryFields?.componentTree.schemaVersion;\n }\n get breakpoints() {\n return this._experienceEntryFields?.componentTree.breakpoints ?? [];\n }\n get dataSource() {\n return this._experienceEntryFields?.dataSource ?? {};\n }\n get unboundValues() {\n return this._unboundValues ?? {};\n }\n get usedComponents() {\n return this._usedComponentsWithDeepReferences ?? [];\n }\n /**\n * Extend the existing set of unbound values with the ones from the assembly definition.\n * When creating a new assembly out of a container, the unbound value keys are copied and\n * thus the existing and the added ones have colliding keys. In the case of overlapping value\n * keys, the ones from the experience overrule the ones from the assembly definition as\n * the latter one is certainly just a default value while the other one is from the actual instance.\n * @param unboundValues set of unbound values defined in the assembly definition\n */\n addAssemblyUnboundValues(unboundValues) {\n this._unboundValues = { ...unboundValues, ...(this._unboundValues ?? {}) };\n }\n getValue(entityLinkOrEntity, path) {\n const entity = isLink(entityLinkOrEntity)\n ? this.getEntityFromLink(entityLinkOrEntity)\n : entityLinkOrEntity;\n if (entity === undefined) {\n return;\n }\n const fieldValue = get(entity, path);\n return transformAssetFileToUrl(fieldValue);\n }\n toJSON() {\n return {\n _experienceEntryFields: this._experienceEntryFields,\n _experienceEntryId: this._experienceEntryId,\n _unboundValues: this._unboundValues,\n ...super.toJSON(),\n };\n }\n}\n\nclass UninitializedEntityStore extends EntityStoreBase {\n constructor() {\n super({ entities: [], locale: 'uninitialized-locale-in-uninitialized-entity-store' });\n }\n}\n\nconst inMemoryEntitiesStore = create((set, get) => ({\n // The UninitializedEntityStore is a placeholder instance and is here to highlight the\n // // fact that it's not used by anything until during loading lifecycle it'sreplaced by real entity store:\n // - in Preview+Delivery mode: right after we fetch Expereince and it entities\n // - in EDITOR (VisualEditor) mode: right after the VisualEditor is async imported and initialize event happens\n entityStore: new UninitializedEntityStore(),\n areEntitiesFetched: false,\n setEntitiesFetched(fetched) {\n set({ areEntitiesFetched: fetched });\n },\n resolveAssetById(assetId) {\n if (!assetId)\n return undefined;\n const { entityStore } = get();\n return entityStore.getAssetById(assetId);\n },\n resolveEntryById(entryId) {\n if (!entryId)\n return undefined;\n const { entityStore } = get();\n return entityStore.getEntryById(entryId);\n },\n resolveEntity(link) {\n if (!link)\n return undefined;\n const { entityStore } = get();\n return entityStore.getEntityFromLink(link);\n },\n resetEntityStore(entityStore) {\n set({\n entityStore,\n areEntitiesFetched: false,\n });\n },\n}));\n\nfunction maybeResolveLink(maybeLink) {\n if (!isLink(maybeLink)) {\n debug.warn('[experiences-core::InMemoryEntitiesStore] maybeResolveLink function must receive Link shape. Provided argument does not match the Link shape: ', maybeLink);\n return undefined;\n }\n return inMemoryEntitiesStore.getState().resolveEntity(maybeLink);\n}\nfunction maybeResolveByAssetId(assetId) {\n return inMemoryEntitiesStore.getState().resolveAssetById(assetId);\n}\nfunction maybeResolveByEntryId(entryId) {\n return inMemoryEntitiesStore.getState().resolveEntryById(entryId);\n}\nfunction hasEntry(entryId) {\n return Boolean(maybeResolveByEntryId(entryId));\n}\nfunction hasAsset(assetId) {\n return Boolean(maybeResolveByAssetId(assetId));\n}\nfunction addEntities(entities) {\n if (!Array.isArray(entities) || entities.length === 0) {\n return;\n }\n const { entityStore } = inMemoryEntitiesStore.getState();\n const definedEntities = entities.filter(Boolean);\n for (const entity of definedEntities) {\n entityStore.updateEntity(entity);\n }\n}\nconst inMemoryEntities = {\n maybeResolveLink,\n maybeResolveByAssetId,\n maybeResolveByEntryId,\n hasEntry,\n hasAsset,\n addEntities,\n};\nconst useInMemoryEntities = () => {\n return inMemoryEntities;\n};\n\nvar VisualEditorMode;\n(function (VisualEditorMode) {\n VisualEditorMode[\"LazyLoad\"] = \"lazyLoad\";\n VisualEditorMode[\"InjectScript\"] = \"injectScript\";\n})(VisualEditorMode || (VisualEditorMode = {}));\n\nfunction createExperience(options) {\n let entityStore;\n if (typeof options === 'string') {\n entityStore = new EntityStore(options);\n }\n else {\n const { experienceEntry, referencedAssets, referencedEntries, locale } = options;\n if ([experienceEntry, ...referencedAssets, ...referencedEntries].some(isNotLocalized)) {\n throw new Error('Some of the provided content is not localized. Please localize every entity before passing it to this function. Note that this is solely determined by `sys.locale` being set respectively.');\n }\n if (!isExperienceEntry(experienceEntry)) {\n throw new Error('Provided entry is not an experience entry');\n }\n entityStore = new EntityStore({\n experienceEntry,\n entities: [...referencedEntries, ...referencedAssets],\n locale,\n });\n }\n inMemoryEntitiesStore.getState().resetEntityStore(entityStore);\n return {\n entityStore,\n };\n}\n// Following the API shape, we check the `sys.locale` property as we can't rely on the shape of\n// fields to determine whether it's localized or not.\n// See CDA documentation mentioning it here: https://www.contentful.com/developers/docs/references/content-delivery-api/#/introduction/common-resource-attributes\nconst isNotLocalized = (entity) => {\n return !entity.sys.locale;\n};\n\n/**\n * Fetches an experience entry by its slug or id. Throws an error if there are multiple\n * entries with the same slug. Additionally, it resolves all nested pattern entries inside `fields.usedComponents`.\n * @param options.client - Instantiated client from the Contentful SDK. If this is using the `withAllLocales` modifier, you may not provide a specific locale.\n * @param options.locale - Provide a locale if your experience contains custom localized fields. Otherwise, it will fallback to the default locale.\n * @param options.experienceTypeId - id of the content type associated with the experience\n * @param options.identifier - identifying condition to find the correct experience entry\n *\n */\nconst fetchExperienceEntry = async ({ client, experienceTypeId, locale, identifier, }) => {\n if (!client) {\n throw new Error('Failed to fetch experience entities. Required \"client\" parameter was not provided');\n }\n if (!experienceTypeId) {\n throw new Error('Failed to fetch experience entities. Required \"experienceTypeId\" parameter was not provided');\n }\n if (!('slug' in identifier) && !('id' in identifier)) {\n throw new Error(`Failed to fetch experience entities. At least one identifier must be provided. Received: ${JSON.stringify(identifier)}`);\n }\n const filter = 'slug' in identifier ? { 'fields.slug': identifier.slug } : { 'sys.id': identifier.id };\n const entries = await client.getEntries({\n content_type: experienceTypeId,\n locale,\n include: 3, // fetching max 3 level deep references due to nested patterns\n ...filter,\n });\n if (entries.items.length > 1) {\n throw new Error(`More than one experience with identifier: ${JSON.stringify(identifier)} was found`);\n }\n return entries.items[0];\n};\n\nclass DeepReference {\n constructor({ path, dataSource }) {\n const { key, field, referentField } = parseDataSourcePathWithL1DeepBindings(path);\n this.originalPath = path;\n this.entityId = dataSource[key].sys.id;\n this.entityLink = dataSource[key];\n this.field = field;\n this.referentField = referentField;\n }\n get headEntityId() {\n return this.entityId;\n }\n /**\n * Extracts referent from the path, using EntityStore as source of\n * entities during the resolution path.\n */\n extractReferent(entityStore) {\n const headEntity = entityStore.getEntityFromLink(this.entityLink);\n const maybeReferentLink = headEntity?.fields[this.field];\n if (undefined === maybeReferentLink) {\n // field references nothing (or even field doesn't exist)\n return undefined;\n }\n if (!isLink(maybeReferentLink)) {\n // Scenario of \"impostor referent\", where one of the deepPath's segments is not a Link but some other type\n // Under normal circumstance we expect field to be a Link, but it could be an \"impostor\"\n // eg. `Text` or `Number` or anything like that; could be due to CT changes or manual path creation via CMA\n return undefined;\n }\n return maybeReferentLink;\n }\n static from(opt) {\n return new DeepReference(opt);\n }\n}\nfunction gatherDeepReferencesFromExperienceEntry(experienceEntry) {\n const deepReferences = [];\n const dataSource = experienceEntry.fields.dataSource;\n const { children } = experienceEntry.fields.componentTree;\n treeVisit({\n definitionId: 'root',\n variables: {},\n children,\n }, (node) => {\n if (!node.variables)\n return;\n for (const variableMapping of Object.values(node.variables)) {\n if (variableMapping.type !== 'BoundValue')\n continue;\n if (!isDeepPath(variableMapping.path))\n continue;\n deepReferences.push(DeepReference.from({\n path: variableMapping.path,\n dataSource,\n }));\n }\n });\n return deepReferences;\n}\nfunction gatherDeepPrebindingReferencesFromExperienceEntry({ experienceEntry, fetchedPatterns, prebindingDataByPatternId, fetchedLevel1Entries, }) {\n const deepPrebindingReferences = [];\n const dataSource = experienceEntry.fields.dataSource;\n const { children } = experienceEntry.fields.componentTree;\n treeVisit({\n definitionId: 'root',\n parameters: {},\n children,\n }, (node) => {\n if (!node.parameters)\n return;\n for (const [parameterId, parameterValue] of Object.entries(node.parameters)) {\n const dataSourceKey = parameterValue.path.split('/')[1];\n const headEntryLink = dataSource[dataSourceKey];\n if (!headEntryLink)\n continue;\n if (headEntryLink.sys.linkType !== 'Entry')\n continue;\n const headEntry = fetchedLevel1Entries.find((entry) => entry.sys.id === headEntryLink.sys.id);\n if (!headEntry)\n continue;\n const headEntryContentTypeId = headEntry.sys.contentType.sys.id;\n // if experience, we don't have any hoisted data on the given experienceEntry\n // and we have to lookup the pattern instead\n const variableMappings = getTargetPatternMappingsForParameter({\n fetchedPatterns,\n prebindingDataByPatternId,\n patternNodeDefinitionId: node.definitionId,\n parameterId,\n });\n if (!variableMappings)\n continue;\n for (const mappingData of Object.values(variableMappings)) {\n const targetMapping = mappingData.pathsByContentType[headEntryContentTypeId];\n if (!targetMapping)\n continue;\n // mapping doesn't start with /uuid, but instead starts with /fields\n // so we add /uuid to make it match the binding path format\n const path = `/${dataSourceKey}${targetMapping.path}`;\n if (!isDeepPath(path))\n continue;\n deepPrebindingReferences.push(DeepReference.from({\n path,\n dataSource,\n }));\n }\n }\n });\n return deepPrebindingReferences;\n}\nfunction gatherDeepPrebindingReferencesFromPatternEntry({ patternEntry, fetchedPatterns, prebindingDataByPatternId, fetchedLevel1Entries, }) {\n const deepPrebindingReferences = [];\n // patterns can't have parameters in their CDA/CMA JSON, so we can generate random ids here\n const { dataSource, parameters } = generateDefaultDataSourceForPrebindingDefinition(patternEntry.fields.componentSettings?.prebindingDefinitions);\n for (const [parameterId, parameterValue] of Object.entries(parameters)) {\n const dataSourceKey = parameterValue.path.split('/')[1];\n const headEntryLink = dataSource[dataSourceKey];\n if (!headEntryLink)\n continue;\n if (headEntryLink.sys.linkType !== 'Entry')\n continue;\n const headEntry = fetchedLevel1Entries.find((entry) => entry.sys.id === headEntryLink.sys.id);\n if (!headEntry)\n continue;\n const headEntryContentTypeId = headEntry.sys.contentType.sys.id;\n const variableMappings = getTargetPatternMappingsForParameter({\n fetchedPatterns,\n prebindingDataByPatternId,\n patternNodeDefinitionId: patternEntry.sys.id,\n parameterId,\n });\n if (!variableMappings)\n continue;\n for (const mappingData of Object.values(variableMappings)) {\n const targetMapping = mappingData.pathsByContentType[headEntryContentTypeId];\n if (!targetMapping)\n continue;\n // mapping doesn't start with /uuid, but instead starts with /fields\n // so we add /uuid to make it match the binding path format\n const path = `/${dataSourceKey}${targetMapping.path}`;\n if (!isDeepPath(path))\n continue;\n deepPrebindingReferences.push(DeepReference.from({\n path,\n dataSource,\n }));\n }\n }\n return deepPrebindingReferences;\n}\n/**\n * used in editor mode. for delivery mode see `gatherDeepReferencesFromExperienceEntry`\n */\nfunction gatherDeepReferencesFromTree(startingNode, dataSource, getEntityFromLink) {\n const deepReferences = [];\n treeVisit(startingNode, (node) => {\n if (!node.data.props)\n return;\n for (const [, variableMapping] of Object.entries(node.data.props)) {\n if (variableMapping.type !== 'BoundValue')\n continue;\n if (isDeepPath(variableMapping.path)) {\n deepReferences.push(DeepReference.from({\n path: variableMapping.path,\n dataSource,\n }));\n }\n else if (isPreboundProp(variableMapping) && isDeepPrebinding(variableMapping)) {\n const getEntityByDataSourceKey = (dataSourceKey) => {\n const entityLink = dataSource[dataSourceKey];\n if (!entityLink)\n return undefined;\n return getEntityFromLink(entityLink);\n };\n const deepPrebindingPath = getPrebindingPathBySourceEntry(variableMapping, getEntityByDataSourceKey);\n if (!deepPrebindingPath)\n continue;\n deepReferences.push(DeepReference.from({\n path: deepPrebindingPath,\n dataSource,\n }));\n }\n }\n });\n return deepReferences;\n}\n\n/**\n * Traverses deep-references and extracts referents from valid deep-paths.\n * The referents are received from the CDA/CPA response `.includes` field.\n *\n * In case deep-paths not resolving till the end, eg.:\n * - non-link referents: are ignored\n * - unset references: are ignored\n *\n * Errors are thrown in case of deep-paths being correct,\n * but referents not found. Because if we don't throw now, the EntityStore will\n * be missing entities and upon rendering will not be able to render bindings.\n */\nfunction gatherAutoFetchedReferentsFromIncludes(deepReferences, entriesResponse) {\n const autoFetchedReferentEntries = [];\n const autoFetchedReferentAssets = [];\n for (const reference of deepReferences) {\n const headEntry = entriesResponse.items.find((entry) => entry.sys.id === reference.headEntityId);\n if (!headEntry) {\n debug.debug(`[experiences-sdk-core::fetchers] When resolving deep-references could not find headEntry with id '${reference.entityId}'`);\n continue;\n }\n const linkToReferent = headEntry.fields[reference.field];\n if (undefined === linkToReferent) {\n debug.debug(`[experiences-sdk-core::fetchers] Empty reference in headEntity. Probably reference is simply not set.`);\n continue;\n }\n if (!isLink(linkToReferent)) {\n debug.debug(`[experiences-sdk-core::fetchers] Non-link value in headEntity. Probably broken path '${reference.originalPath}'`);\n continue;\n }\n const linkType = linkToReferent.sys.linkType;\n if (!['Entry', 'Asset'].includes(linkType)) {\n debug.debug(`[experiences-sdk-core::fetchers] Unhandled linkType :${JSON.stringify(linkToReferent)}`);\n continue;\n }\n const referentEntity = entriesResponse.includes?.[linkType]?.find((entity) => entity.sys.id === linkToReferent.sys.id);\n if (!referentEntity) {\n debug.debug(`[experiences-sdk-core::fetchers] L2-referent ${linkType} was not found within .includes (${JSON.stringify({\n linkToReferent,\n })})`);\n continue;\n }\n linkType === 'Entry'\n ? autoFetchedReferentEntries.push(referentEntity)\n : autoFetchedReferentAssets.push(referentEntity);\n } // for (reference of deepReferences)\n return { autoFetchedReferentAssets, autoFetchedReferentEntries };\n}\n\nconst MIN_FETCH_LIMIT = 1;\nconst fetchAllEntries = async ({ client, ids, locale, skip = 0, limit = 100, responseItems = [], responseIncludes = { Entry: [], Asset: [] }, }) => {\n try {\n if (!client) {\n throw new Error('Failed to fetch experience entities. Required \"client\" parameter was not provided');\n }\n if (!ids.length) {\n return {\n items: [],\n includes: {\n Entry: [],\n Asset: [],\n },\n };\n }\n const query = { 'sys.id[in]': ids, locale, limit, skip, include: 2 };\n const { items, includes, total: responseTotal, } = await client.withoutLinkResolution.getEntries({ ...query });\n responseItems.push(...items);\n responseIncludes?.Entry?.push(...(includes?.Entry || []));\n responseIncludes?.Asset?.push(...(includes?.Asset || []));\n // E.g Total entries = 99\n // First fetch => { skip: 0, limit: 50, total: 99 } => 50 Entries fetched in Page 0\n // Total Entries fetched = 50, 49 remaining\n // 0(skip) + 50(limit) < 99(total) => Fetch again\n // Second fetch => { skip: 50, limit: 50, total: 99 } => 49 Entries fetched in Page 1\n // Total Entries fetched = 50(Page 0) + 49(Page 1) = 99, 0 remaining\n // 50(skip) + 50(limit) > 99(total) => Stop fetching\n if (skip + limit < responseTotal) {\n return await fetchAllEntries({\n client,\n ids,\n locale,\n skip: skip + limit,\n limit,\n responseItems,\n responseIncludes,\n });\n }\n const dedupedEntries = uniqueById(responseIncludes?.Entry);\n const dedupedAssets = uniqueById(responseIncludes?.Asset);\n return {\n items: responseItems,\n includes: {\n Entry: dedupedEntries,\n Asset: dedupedAssets,\n },\n };\n }\n catch (error) {\n if (error instanceof Error &&\n error.message.includes('size too big') &&\n limit > MIN_FETCH_LIMIT) {\n const newLimit = Math.max(MIN_FETCH_LIMIT, Math.floor(limit / 2));\n return fetchAllEntries({\n client,\n ids,\n locale,\n skip,\n limit: newLimit,\n responseItems,\n });\n }\n throw error;\n }\n};\nconst fetchAllAssets = async ({ client, ids, locale, skip = 0, limit = 100, responseItems = [], }) => {\n try {\n if (!client) {\n throw new Error('Failed to fetch experience entities. Required \"client\" parameter was not provided');\n }\n if (!ids.length) {\n return { items: [] };\n }\n const query = { 'sys.id[in]': ids, locale, limit, skip };\n const { items, total: responseTotal } = await client.getAssets({ ...query });\n responseItems.push(...items);\n if (skip + limit < responseTotal) {\n return await fetchAllAssets({\n client,\n ids,\n locale,\n skip: skip + limit,\n limit,\n responseItems,\n });\n }\n return {\n items: responseItems,\n };\n }\n catch (error) {\n if (error instanceof Error &&\n error.message.includes('size too big') &&\n limit > MIN_FETCH_LIMIT) {\n const newLimit = Math.max(MIN_FETCH_LIMIT, Math.floor(limit / 2));\n return fetchAllAssets({\n client,\n ids,\n locale,\n skip,\n limit: newLimit,\n responseItems,\n });\n }\n throw error;\n }\n};\n\n/**\n * Fetches all entries and assets from the `dataSource` of the given experience entry. This will\n * also consider deep references that are not listed explicitly but linked through deep binding paths.\n * @param options.client - Instantiated client from the Contentful SDK. If this is using the `withAllLocales` modifier, you may not provide a specific locale.\n * @param options.experienceEntry - Localized experience entry. To localize a multi locale entry, use the `localizeEntity` function.\n * @param options.locale - Retrieve a specific localized version of the referenced entities. Otherwise, it will fallback to the default locale.\n * @returns object with a list of `entries` and a list of `assets`\n */\nconst fetchReferencedEntities = async ({ client, experienceEntry, locale, }) => {\n if (!client) {\n throw new Error('Failed to fetch experience entities. Required \"client\" parameter was not provided');\n }\n if (!isExperienceEntry(experienceEntry)) {\n throw new Error('Failed to fetch experience entities. Provided \"experienceEntry\" does not match experience entry schema');\n }\n const entryIds = new Set();\n const assetIds = new Set();\n for (const dataBinding of Object.values(experienceEntry.fields.dataSource)) {\n if (!('sys' in dataBinding)) {\n continue;\n }\n if (dataBinding.sys.linkType === 'Entry') {\n entryIds.add(dataBinding.sys.id);\n }\n if (dataBinding.sys.linkType === 'Asset') {\n assetIds.add(dataBinding.sys.id);\n }\n }\n const [entriesResponse, assetsResponse] = await Promise.all([\n fetchAllEntries({ client, ids: [...entryIds], locale }),\n fetchAllAssets({ client, ids: [...assetIds], locale }),\n ]);\n const usedPatterns = experienceEntry.fields.usedComponents ?? [];\n const isRenderingExperience = Boolean(!experienceEntry.fields.componentSettings);\n const deepReferences = gatherDeepReferencesFromExperienceEntry(experienceEntry);\n // If we are previewing a pattern, we want to include the entry itself as well\n const fetchedPatterns = (isRenderingExperience ? usedPatterns : [...usedPatterns, experienceEntry]);\n const allFetchedPatterns = flattenNestedPatterns(fetchedPatterns);\n const prebindingDataByPatternId = extractPrebindingDataByPatternId(allFetchedPatterns);\n // Patterns do not have dataSource stored in their dataSource field, so head entities won't be there and we need to fetch them\n if (!isRenderingExperience) {\n const { dataSource } = generateDefaultDataSourceForPrebindingDefinition(experienceEntry.fields.componentSettings?.prebindingDefinitions);\n if (Object.keys(dataSource).length) {\n const prebindingEntriesResponse = await fetchAllEntries({\n client,\n ids: Object.values(dataSource).map((link) => link.sys.id),\n locale,\n });\n entriesResponse.items.push(...prebindingEntriesResponse.items);\n entriesResponse.includes.Asset.push(...(prebindingEntriesResponse.includes?.Asset ?? []));\n entriesResponse.includes.Entry.push(...(prebindingEntriesResponse.includes?.Entry ?? []));\n }\n }\n // normally, for experience entry, there should be no need to call this method, as `includes=2` will have them resolved\n // because the entries used for pre-binding are stored in both - the layout of the experience, as well as the dataSource field\n const deepPrebindingReferences = isRenderingExperience\n ? gatherDeepPrebindingReferencesFromExperienceEntry({\n experienceEntry: experienceEntry,\n fetchedPatterns: allFetchedPatterns,\n prebindingDataByPatternId,\n fetchedLevel1Entries: entriesResponse.items,\n })\n : // however, for patterns, we have to do it by hand, because a pattern entry doesn't save the pre-binding data neither in the\n // layout nor in the dataSource field.\n // for consistency, as well as to be future safe from the change to \"includes=2\", I added methods for both\n gatherDeepPrebindingReferencesFromPatternEntry({\n patternEntry: experienceEntry,\n fetchedPatterns: allFetchedPatterns,\n prebindingDataByPatternId,\n fetchedLevel1Entries: entriesResponse.items,\n });\n const allDeepReferences = [...deepReferences, ...deepPrebindingReferences];\n const { autoFetchedReferentAssets, autoFetchedReferentEntries } = gatherAutoFetchedReferentsFromIncludes(allDeepReferences, entriesResponse);\n // Using client getEntries resolves all linked entry references, so we do not need to resolve entries in usedComponents\n const allResolvedEntries = [\n ...(entriesResponse?.items ?? []),\n ...(entriesResponse.includes?.Entry ?? []),\n ...(usedPatterns || []),\n ...autoFetchedReferentEntries,\n ];\n const allResolvedAssets = [\n ...(assetsResponse.items ?? []),\n ...(entriesResponse?.includes?.Asset ?? []),\n ...autoFetchedReferentAssets,\n ];\n return {\n // we have to drop duplicates, becasue of the merge of deepReferences and deepPrebindingReferences above\n // If not, the same entity might appear in this array more than once\n entries: [\n ...new Map(allResolvedEntries.map((entry) => [entry.sys.id, entry])).values(),\n ],\n assets: [\n ...new Map(allResolvedAssets.map((asset) => [asset.sys.id, asset])).values(),\n ],\n };\n};\n\n/**\n * The CMA client will automatically replace links with entry references.\n * As we're including all referenced pattern entries in usedComponents, this can lead\n * to a circular reference. This function replaces those with plain links inplace (!).\n *\n * @see https://github.com/contentful/contentful.js/issues/377\n */\nconst removeCircularPatternReferences = (experienceEntry, _parentIds) => {\n const parentIds = _parentIds ?? new Set([experienceEntry.sys.id]);\n const usedComponents = experienceEntry.fields.usedComponents;\n const newUsedComponents = usedComponents?.reduce((acc, linkOrEntry) => {\n if (!('fields' in linkOrEntry)) {\n // It is a link, we're good\n return [...acc, linkOrEntry];\n }\n const entry = linkOrEntry;\n if (parentIds.has(entry.sys.id)) {\n // It is an entry that already occurred -> turn it into a link to remove the circularity\n const link = {\n sys: {\n id: entry.sys.id,\n linkType: 'Entry',\n type: 'Link',\n },\n };\n return [...acc, link];\n }\n // Remove circularity for its usedComponents as well (inplace)\n removeCircularPatternReferences(entry, new Set([...parentIds, entry.sys.id]));\n return [...acc, entry];\n }, []);\n // @ts-expect-error - type of usedComponents doesn't yet allow a mixed list of both links and entries\n experienceEntry.fields.usedComponents = newUsedComponents;\n};\n/**\n * The CMA client will automatically replace links with entry references if they are available.\n * While we're not fetching the data sources, a self reference would be replaced as the entry is\n * fetched. Any circuar reference in the object breaks SSR where we have to stringify the JSON.\n * This would fail if the object contains circular references.\n */\nconst removeSelfReferencingDataSource = (experienceEntry) => {\n const dataSources = experienceEntry.fields.dataSource;\n const newDataSource = Object.entries(dataSources).reduce((acc, [key, linkOrEntry]) => {\n if ('fields' in linkOrEntry && linkOrEntry.sys.id === experienceEntry.sys.id) {\n const entry = linkOrEntry;\n acc[key] = {\n sys: {\n id: entry.sys.id,\n linkType: 'Entry',\n type: 'Link',\n },\n };\n }\n else {\n const link = linkOrEntry;\n acc[key] = link;\n }\n return acc;\n }, {});\n experienceEntry.fields.dataSource = newDataSource;\n};\n\n/**\n * Run additional checks on the references used in the experience entry and\n * process data required for prebinding. This must be used after fetching an\n * experience entry.\n *\n * The changes made to the passed experience entry are done inplace.\n **/\nconst prepareExperienceEntry = (experienceEntry) => {\n removeCircularPatternReferences(experienceEntry);\n removeSelfReferencingDataSource(experienceEntry);\n};\n\nconst errorMessagesWhileFetching$1 = {\n experience: 'Failed to fetch experience',\n experienceReferences: 'Failed to fetch entities, referenced in experience',\n};\nconst handleError$1 = (generalMessage, error) => {\n const message = error instanceof Error ? error.message : `Unknown error: ${error}`;\n throw Error(message);\n};\n/**\n * Fetches an experience entry by its slug and additionally fetches all its references to return\n * an initilized experience instance.\n * @param {FetchBySlugParams} options - options to fetch the experience\n */\nasync function fetchBySlug({ client, experienceTypeId, slug, localeCode, isEditorMode, }) {\n // Be a no-op if in editor mode\n if (isEditorMode)\n return;\n let experienceEntry = undefined;\n if (!localeCode) {\n throw new Error('Failed to fetch by slug. Required \"localeCode\" parameter was not provided');\n }\n try {\n experienceEntry = await fetchExperienceEntry({\n client,\n experienceTypeId,\n locale: localeCode,\n identifier: {\n slug,\n },\n });\n if (!experienceEntry) {\n throw new Error(`No experience entry with slug: ${slug} exists`);\n }\n prepareExperienceEntry(experienceEntry);\n try {\n const { entries, assets } = await fetchReferencedEntities({\n client,\n experienceEntry,\n locale: localeCode,\n });\n const experience = createExperience({\n experienceEntry,\n referencedAssets: assets,\n referencedEntries: entries,\n locale: localeCode,\n });\n return experience;\n }\n catch (error) {\n handleError$1(errorMessagesWhileFetching$1.experienceReferences, error);\n }\n }\n catch (error) {\n handleError$1(errorMessagesWhileFetching$1.experience, error);\n }\n}\n\nconst errorMessagesWhileFetching = {\n experience: 'Failed to fetch experience',\n experienceReferences: 'Failed to fetch entities, referenced in experience',\n};\nconst handleError = (generalMessage, error) => {\n const message = error instanceof Error ? error.message : `Unknown error: ${error}`;\n throw Error(message);\n};\n/**\n * Fetches an experience entry by its id and additionally fetches all its references to return\n * an initilized experience instance.\n * @param {FetchByIdParams} options - options to fetch the experience\n */\nasync function fetchById({ client, experienceTypeId, id, localeCode, isEditorMode, }) {\n //Be a no-op if in editor mode\n if (isEditorMode)\n return;\n let experienceEntry = undefined;\n if (!localeCode) {\n throw new Error('Failed to fetch by id. Required \"localeCode\" parameter was not provided');\n }\n try {\n experienceEntry = await fetchExperienceEntry({\n client,\n experienceTypeId,\n locale: localeCode,\n identifier: {\n id,\n },\n });\n if (!experienceEntry) {\n throw new Error(`No experience entry with id: ${id} exists`);\n }\n prepareExperienceEntry(experienceEntry);\n try {\n const { entries, assets } = await fetchReferencedEntities({\n client,\n experienceEntry,\n locale: localeCode,\n });\n const experience = createExperience({\n experienceEntry,\n referencedAssets: assets,\n referencedEntries: entries,\n locale: localeCode,\n });\n return experience;\n }\n catch (error) {\n handleError(errorMessagesWhileFetching.experienceReferences, error);\n }\n }\n catch (error) {\n handleError(errorMessagesWhileFetching.experience, error);\n }\n}\n\nexport { BREAKPOINTS_STRATEGY_DESKTOP_FIRST, BREAKPOINTS_STRATEGY_MOBILE_FIRST, DebugLogger, DeepReference, EditorModeEntityStore, EntityStore, EntityStoreBase, MEDIA_QUERY_REGEXP, VisualEditorMode, addLocale, addMinHeightForEmptyStructures, breakpointsRegistry, buildCfStyles, buildStyleTag, buildTemplate, builtInStyles, calculateNodeDefaultHeight, checkIsAssemblyDefinition, checkIsAssemblyEntry, checkIsAssemblyNode, columnsBuiltInStyles, containerBuiltInStyles, createAssemblyDefinition, createExperience, debug, defineBreakpoints, defineDesignTokens, defineSdkOptions, designTokensRegistry, detachExperienceStyles, detectBreakpointsStrategy, disableDebug, dividerBuiltInStyles, doesMismatchMessageSchema, enableDebug, extractLeafLinksReferencedFromExperience, extractPrebindingDataByPatternId, extractReferencesFromEntries, extractReferencesFromEntriesAsIds, fetchAllAssets, fetchAllEntries, fetchById, fetchBySlug, fetchExperienceEntry, fetchReferencedEntities, findOutermostCoordinates, flattenDesignTokenRegistry, flattenNestedPatterns, gatherDeepPrebindingReferencesFromExperienceEntry, gatherDeepPrebindingReferencesFromPatternEntry, gatherDeepReferencesFromExperienceEntry, gatherDeepReferencesFromTree, generateDefaultDataSourceForPrebindingDefinition, generateRandomId, getActiveBreakpointIndex, getDataFromTree, getDesignTokenRegistration, getElementCoordinates, getFallbackBreakpointIndex, getPrebindingPathBySourceEntry, getSdkOptions, getTargetPatternMappingsForParameter, getTargetValueInPixels, getTemplateValue, getValueForBreakpoint, inMemoryEntities, inMemoryEntitiesStore, indexByBreakpoint, isArrayOfLinks, isAsset, isCfStyleAttribute, isComponentAllowedOnRoot, isContentfulComponent, isContentfulStructureComponent, isDeepPath, isDeepPrebinding, isElementHidden, isEntry, isExperienceEntry, isLink, isLinkToAsset, isLinkToEntry, isPatternComponent, isPatternEntry, isPreboundProp, isStructureWithRelativeHeight, isValidBreakpointValue, lastPathNamedSegmentEq, localizeEntity, maybePopulateDesignTokenValue, mediaQueryMatcher, mergeDesignValuesByBreakpoint, optionalBuiltInStyles, parseCSSValue, parseDataSourcePathIntoFieldset, parseDataSourcePathWithL1DeepBindings, referencesOf, resetDesignTokenRegistry, resolveBackgroundImageBinding, resolveHyperlinkPattern, runBreakpointsValidation, sanitizeNodeProps, sdkOptionsRegistry, sectionBuiltInStyles, sendMessage, setDebugLevel, singleColumnBuiltInStyles, splitDirectAndSlotChildren, stringifyCssProperties, toCSSAttribute, toMediaQuery, transformBoundContentValue, transformVisibility, treeMap, treeVisit, tryParseMessage, uniqueById, useInMemoryEntities, validateExperienceBuilderConfig };\n//# sourceMappingURL=index.js.map\n",null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["StudioCanvasMode","CONTENTFUL_COMPONENTS","PostMessageMethods"],"mappings":";;;;;;;;;;;;AAAA;AAiEA;AACA;AACA;AACA;AACA;AACA,IAAIA,kBAAgB,CAAC;AACrB,CAAC,UAAU,gBAAgB,EAAE;AAC7B,IAAI,gBAAgB,CAAC,WAAW,CAAC,GAAG,cAAc,CAAC;AACnD,IAAI,gBAAgB,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC;AAC9C,IAAI,gBAAgB,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AACtC,CAAC,EAAEA,kBAAgB,KAAKA,kBAAgB,GAAG,EAAE,CAAC,CAAC,CAAC;AAEhD,MAAM,6BAA6B,GAAG,sBAAsB,CAAC;AAC7D,M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