{
  "version": 3,
  "sources": ["../../src/app/ai/utils/flatten.ts", "../../src/app/ai/agents/schemaUtils.ts", "../../src/app/ai/agents/dsl.ts", "../../src/app/agent/attachments.ts", "../../src/app/ai/agents/tools/toolNames.ts", "../../src/document/components/chrome/properties/panels/breakpointUtils.tsx", "../../src/app/ai/agents/traits/textStylePresetBreakpointSlots.ts", "../../src/app/ai/agents/tools/readProjectQueryTypes.ts", "../../src/app/ai/agents/fencedBlock.ts", "../../src/app/ai/agents/prompt/utils.ts", "../../src/app/ai/agents/context/richtext/document.ts", "../../src/app/ai/agents/traits/invalidValues.ts", "../../../../../node_modules/@framerjs/framer-events/lib/esm/generated/ColorTokenCreate.js", "../../src/app/ai/agents/context/dslNodeClass.ts", "../../src/app/ai/agents/traits/types.ts", "../../src/app/ai/agents/traits/helpers.ts", "../../src/app/ai/utils/siteMap.ts", "../../src/app/ai/agents/traits/zodErrorToWarnings.ts", "../../src/app/ai/agents/traits/transforms.ts", "../../src/app/ai/agents/context/DeferTraitError.ts", "../../src/app/ai/agents/context/dynamicValues.ts", "../../src/app/ai/agents/eventHandlerKeys.ts", "../../src/app/ai/agents/RejectedCommandError.ts", "../../src/document/components/utils/createSmartComponent.ts", "../../src/document/components/utils/tokenContextActions.ts", "../../src/plugins/entityReference.ts", "../../src/app/ai/agents/context/stylePresetType.ts", "../../src/app/ai/agents/nodesMutatedByAgent.ts", "../../src/app/ai/agents/TreeResolver.ts", "../../src/app/ai/agents/context/issues.ts", "../../src/app/ai/agents/context/controlDefinitions.ts", "../../src/app/ai/agents/context/richtext/textComponentControls.ts", "../../src/app/ai/agents/context/richtext/targets.ts", "../../src/app/ai/agents/context/deferred.ts", "../../src/document/components/chrome/properties/codeComponentRows/utils/Slot.ts", "../../src/utils/removeImagesWithInvalidSrc.ts", "../../src/document/components/chrome/shared/utils/convertHTMLToRichText.ts", "../../src/utils/url.ts", "../../src/app/ai/agents/context/metadataTags.ts", "../../src/utils/objectHasOwn.ts", "../../src/app/ai/agents/context/richtext/traversal.ts", "../../src/app/ai/agents/context/richtext/styleInheritance.ts", "../../src/app/ai/agents/traits/traitDescriptions.ts", "../../src/app/ai/agents/traits/link.ts", "../../src/document/components/chrome/shared/FontPopout/utils/deprecatedFonts.ts", "../../src/app/ai/agents/traits/textStyle/fontSelector.ts", "../../src/app/ai/agents/traits/controls.ts", "../../src/app/ai/agents/traits/inlineCode.ts", "../../src/app/ai/agents/traits/inlineCodeStylePreset.ts", "../../src/app/ai/agents/traits/linkStylePreset.ts", "../../src/app/ai/agents/traits/media.ts", "../../src/document/models/CanvasTree/nodes/utils/couldCollapse.ts", "../../src/app/ai/agents/traits/gridWarningAnalyzers.ts", "../../src/app/ai/utils/updateWithFallback.ts", "../../src/app/ai/agents/traits/layoutDefaults.ts", "../../src/app/ai/agents/traits/layout.ts", "../../src/app/ai/agents/traits/size.ts", "../../src/app/ai/agents/traits/tableCell.ts", "../../src/app/ai/utils/typography.ts", "../../src/app/ai/agents/traits/text.ts", "../../src/app/ai/agents/traits/textComponentAlignment.ts", "../../src/app/ai/agents/traits/textRunMarks.ts", "../../src/document/components/utils/getFontUpdateValues.ts", "../../src/app/ai/agents/traits/textStyle/utils.ts", "../../src/app/ai/agents/traits/textStyle/font.ts", "../../src/app/ai/agents/traits/textStyle/fontSize.ts", "../../src/app/ai/agents/traits/textStyle/letterSpacing.ts", "../../src/app/ai/agents/traits/textStyle/lineHeight.ts", "../../src/app/ai/agents/traits/textStyle/openType.ts", "../../src/app/ai/agents/traits/textStyle/textAlignment.ts", "../../../../shared/src/identity.ts", "../../src/app/ai/agents/traits/textStyle/textAppearance.ts", "../../src/app/ai/agents/traits/textStyle/textBackground.ts", "../../src/app/ai/agents/traits/textStyle/textBackgroundColor.ts", "../../src/app/ai/agents/traits/textStyle/textColor.ts", "../../src/app/ai/agents/traits/textStyle/textStyle.ts", "../../src/app/ai/agents/traits/textTag.ts", "../../src/app/ai/agents/traits/traitsToAttributes.ts", "../../src/app/ai/agents/traits/virtualAttributes.ts", "../../src/app/ai/agents/context/serializeAttributes.ts", "../../src/app/ai/agents/context/richtext/serialize.ts", "../../src/app/ai/agents/context/serializeVariable.ts", "../../src/app/ai/agents/tools/collectionSchema.ts", "../../src/app/ai/agents/tools/nodeById/truncatedPlaceholderType.ts", "../../../../library/src/utils/objectValues.ts", "../../src/app/ai/agents/traits/transition.ts", "../../src/app/ai/agents/traits/appearEffect.ts", "../../src/app/ai/agents/traits/aspectRatio.ts", "../../src/app/ai/agents/traits/backdrop.ts", "../../src/app/ai/agents/traits/blendingMode.ts", "../../src/app/ai/agents/traits/blockquote.ts", "../../src/app/ai/agents/traits/blockquoteStylePreset.ts", "../../src/app/ai/agents/traits/border.ts", "../../src/app/ai/agents/traits/boxShadows.ts", "../../src/app/ai/agents/traits/colorStyle.ts", "../../src/app/ai/agents/traits/componentPreset.ts", "../../src/app/ai/agents/traits/cursor.ts", "../../src/app/ai/agents/traits/dragEffect.ts", "../../src/app/ai/agents/traits/parseColor.ts", "../../src/app/ai/agents/traits/fill.ts", "../../src/app/ai/agents/traits/filters.ts", "../../src/app/ai/agents/traits/flowEffect.ts", "../../src/app/ai/agents/traits/formBooleanInputType.ts", "../../src/app/ai/agents/traits/formContainer.ts", "../../src/app/ai/agents/traits/formInput.ts", "../../src/app/ai/agents/traits/formInputAutofillEnabled.ts", "../../src/app/ai/agents/traits/formInputFocusedStyle.ts", "../../src/app/ai/agents/traits/formInputIcon.ts", "../../src/app/ai/agents/traits/shared/formInputPlaceholderColor.ts", "../../src/app/ai/agents/traits/formInputInvalidStyles.ts", "../../src/app/ai/agents/traits/formInputPlaceholder.ts", "../../src/app/ai/agents/traits/formInputStep.ts", "../../src/app/ai/agents/traits/formInputType.ts", "../../src/app/ai/agents/traits/formSelect.ts", "../../src/utils/keys.ts", "../../src/app/ai/agents/traits/formVariants.ts", "../../src/app/ai/agents/traits/frameEvents.ts", "../../src/app/ai/agents/traits/gridItem.ts", "../../src/app/ai/agents/traits/hoverEffect.ts", "../../src/app/ai/agents/traits/htmlTag.ts", "../../src/app/ai/agents/traits/imageStylePreset.ts", "../../src/app/ai/agents/traits/inlineCodeStyle.ts", "../../src/app/ai/agents/traits/layoutTemplate.ts", "../../src/app/ai/agents/traits/lightboxEffect.ts", "../../src/app/ai/agents/traits/linkStyle.ts", "../../src/app/ai/agents/traits/linkTransition.ts", "../../src/app/ai/agents/traits/loopEffect.ts", "../../src/app/ai/agents/traits/masks.ts", "../../src/app/ai/agents/traits/metadata.ts", "../../src/app/ai/agents/presetNaming.ts", "../../src/app/ai/agents/traits/name.ts", "../../src/app/ai/agents/traits/opacity.ts", "../../src/app/ai/agents/traits/overflow.ts", "../../src/app/ai/agents/traits/overscroll.ts", "../../src/app/ai/agents/traits/padding.ts", "../../src/app/ai/agents/traits/paragraphSpacing.ts", "../../src/app/ai/agents/traits/parallaxEffect.ts", "../../src/document/models/CanvasTree/traits/utils/updateConstraintsForPosition.ts", "../../src/app/ai/agents/traits/placement.ts", "../../src/app/ai/agents/traits/radius.ts", "../../src/app/ai/agents/traits/redirect.ts", "../../src/app/ai/agents/traits/relativeOverlay.ts", "../../src/document/components/utils/pagination.ts", "../../src/app/ai/agents/traits/repeater.ts", "../../src/app/ai/agents/traits/rootFontSize.ts", "../../src/app/ai/agents/traits/rotation.ts", "../../src/app/ai/agents/traits/scrollTarget.ts", "../../src/app/ai/agents/traits/scrollVariantEffect.ts", "../../src/app/ai/agents/traits/sizeConstraints.ts", "../../src/app/ai/agents/traits/squircle.ts", "../../src/app/ai/agents/traits/styleTransformEffect.ts", "../../src/app/ai/agents/traits/tableStyle.ts", "../../src/app/ai/agents/traits/tableStylePreset.ts", "../../src/app/ai/agents/traits/tapEffect.ts", "../../src/app/ai/agents/traits/textEffect.ts", "../../src/app/ai/agents/traits/textSelection.ts", "../../src/app/ai/agents/traits/textStylePreset.ts", "../../src/app/ai/agents/traits/textStylePresetBreakpoint.ts", "../../src/app/ai/agents/traits/textStylePresetsByTag.ts", "../../src/app/ai/agents/traits/textTruncation.ts", "../../src/app/ai/agents/traits/textVerticalAlignment.ts", "../../src/app/ai/agents/traits/textWrapBalance.ts", "../../src/app/ai/agents/traits/tickerEffect.ts", "../../src/app/ai/agents/traits/userSelect.ts", "../../src/document/components/chrome/properties/rows/FormInputRows/formNodeVariableTypes.ts", "../../src/app/ai/agents/traits/variableBinding.ts", "../../src/app/ai/agents/traits/vectors.ts", "../../src/app/ai/agents/traits/visible.ts", "../../src/app/ai/agents/traits/whileOpen.ts", "../../src/app/ai/agents/traits/zIndex.ts", "../../src/app/ai/agents/traits/attributes.ts", "../../src/app/ai/agents/context/nodes.ts", "../../src/app/ai/agents/tools/nodeById/cursor.ts", "../../src/app/ai/agents/tools/nodeById/cursorStore.ts", "../../src/utils/createUnusedObject.ts", "../../src/app/ai/agents/statusMessages.ts", "../../../../../node_modules/@raindrop-ai/ai-sdk/dist/index.browser.mjs", "../../src/app/ai/raindrop/client.ts", "../../src/app/ai/raindrop/error.ts", "../../src/app/ai/raindrop/agentStreamTrace.ts", "../../src/app/ai/agents/tools/transformers/createUIConnectedTool.ts", "../../src/app/ai/agents/tools/checklist.ts", "../../src/app/ai/agents/context/additionalContextMessage.ts", "../../src/app/ai/agents/context/collections.ts", "../../src/app/ai/agents/context/moduleDefinitions.ts", "../../src/app/ai/agents/context/components.ts", "../../src/app/ai/agents/examples/agent-examples.json", "../../src/app/ai/agents/examples/localExamplesState.ts", "../../src/app/ai/agents/examples/exampleLoader.ts", "../../src/app/ai/agents/context/guidesSystemState.ts", "../../src/app/ai/agents/context/examples.ts", "../../src/app/ai/agents/context/richtext/apply.ts", "../../src/app/ai/agents/context/turnChangeset.ts", "../../src/app/ai/agents/context/files.ts", "../../src/document/components/chrome/properties/rows/OpenTypeRow/utils/common.ts", "../../src/document/components/chrome/properties/rows/OpenTypeRow/utils/getOpenTypeFeatureMetadata.ts", "../../src/document/components/chrome/properties/rows/OpenTypeRow/utils/categorizeOpenTypeFeatures.ts", "../../src/document/components/chrome/properties/rows/OpenTypeRow/utils/filterSupportedOpenTypeFeatures.ts", "../../src/document/components/chrome/properties/rows/OpenTypeRow/utils/getOpenTypeFeaturesJSON.ts", "../../src/app/ai/agents/context/fonts.ts", "../../src/app/ai/agents/context/forms.ts", "../../src/app/ai/agents/context/layoutTemplates.ts", "../../src/app/ai/agents/context/nodeAttributeChanges.ts", "../../src/app/ai/agents/context/renamedIds.ts", "../../src/utils/invert.ts", "../../src/app/ai/agents/context/richtext/prosemirror.ts", "../../src/app/ai/agents/context/richtext/editor.ts", "../../src/app/ai/agents/context/richtext/virtualText.ts", "../../src/app/ai/agents/context/shaders.ts", "../../src/app/ai/agents/context/stylePresets.ts", "../../src/app/ai/agents/context/tokens.ts", "../../src/app/ai/agents/context/vectors.ts", "../../src/app/ai/agents/context/AgentContext.ts"],
  "sourcesContent": ["import { tryParseJSON } from \"utils/tryParseJSON.ts\"\nimport { isArray, isNull, isObject, isPrimitive, isUndefined, type Primitive } from \"utils/typeChecks.ts\"\n\n// don't pull in helpers.ts just for this because it can create a circular dependency\nconst nullString = \"null\"\nconst separator = \".\"\nconst indexSegmentRegex = /^\\d+$/u\n\n/** Dangerous keys that could lead to prototype pollution */\nconst DANGEROUS_KEYS = new Set([\"__proto__\", \"constructor\", \"prototype\"])\n/** Keys that could target false positive JSON array strings */\nconst SKIP_ARRAY_PARSE_KEYS = new Set([\"text\"])\n\nexport function createFlattenedKey(prefix: string, key: string) {\n\treturn prefix ? `${prefix}${separator}${key}` : key\n}\n\nfunction serializer(_key: string, value: Primitive): string | undefined {\n\tif (isNull(value)) return nullString\n\tif (isUndefined(value)) return undefined\n\treturn value.toString()\n}\n\nexport function flatten(obj: Record<string, unknown> | unknown[], prefix = \"\"): Record<string, string | undefined> {\n\tconst result: Record<string, string | undefined> = {}\n\tfor (const [key, value] of Object.entries(obj)) {\n\t\tif (isUndefined(value)) continue\n\t\tconst newKey = createFlattenedKey(prefix, key)\n\t\tif (isArray(value)) {\n\t\t\tfor (const [index, item] of value.entries()) {\n\t\t\t\tconst arrayKey = createFlattenedKey(newKey, index.toString())\n\t\t\t\tif (isArray(item) || isObject(item)) {\n\t\t\t\t\tObject.assign(result, flatten(item, arrayKey))\n\t\t\t\t} else if (isPrimitive(item)) {\n\t\t\t\t\tresult[arrayKey] = serializer(newKey, item)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (isObject(value)) {\n\t\t\tObject.assign(result, flatten(value, newKey))\n\t\t} else if (isPrimitive(value)) {\n\t\t\tconst newValue = serializer(newKey, value)\n\t\t\tresult[newKey] = newValue\n\t\t}\n\t}\n\treturn result\n}\n\nexport function isIndexSegment(segment: string) {\n\treturn indexSegmentRegex.test(segment)\n}\n\nexport function unflatten<T extends Primitive>(obj: Record<string, T>): Record<string, NestedPrimitive<T>> {\n\tconst result: Record<string, NestedPrimitive<T>> = {}\n\n\tfor (const [key, value] of Object.entries(obj)) {\n\t\t// Filter out empty segments.\n\t\tconst segments = key.split(separator).filter(segment => Boolean(segment))\n\t\tif (segments.length === 0) continue\n\n\t\tif (segments.some(segment => DANGEROUS_KEYS.has(segment))) {\n\t\t\tcontinue\n\t\t}\n\n\t\ttype NestedContainer = Record<string, NestedPrimitive<T> | undefined> | NestedPrimitive<T>[]\n\t\tlet current: NestedContainer = result\n\n\t\t// Initialize the nested objects up to (but not including) the last non-empty segment.\n\t\tfor (let i = 0; i < segments.length - 1; i++) {\n\t\t\tconst segment = segments[i]\n\t\t\tif (!segment) continue\n\t\t\tconst nextSegment = segments[i + 1]\n\t\t\tconst nextIsIndex = nextSegment ? isIndexSegment(nextSegment) : false\n\n\t\t\tif (isArray(current)) {\n\t\t\t\tif (!isIndexSegment(segment)) continue\n\t\t\t\tconst index = Number(segment)\n\t\t\t\tconst existing: NestedPrimitive<T> | undefined = current[index]\n\t\t\t\tif (isObject(existing) || isArray(existing)) {\n\t\t\t\t\tcurrent = existing\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst container: NestedPrimitive<T> = nextIsIndex ? [] : {}\n\t\t\t\tcurrent[index] = container\n\t\t\t\tcurrent = container\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst existing: NestedPrimitive<T> | undefined = current[segment]\n\t\t\tif (isObject(existing) || isArray(existing)) {\n\t\t\t\tcurrent = existing\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tconst container: NestedPrimitive<T> = nextIsIndex ? [] : {}\n\t\t\tcurrent[segment] = container\n\t\t\tcurrent = container\n\t\t}\n\n\t\t// Set the value at the last non-empty segment\n\t\tconst lastKey = segments[segments.length - 1]\n\t\tif (!lastKey) continue\n\n\t\tif (isArray(current)) {\n\t\t\tif (isIndexSegment(lastKey)) {\n\t\t\t\tcurrent[Number(lastKey)] = parseJsonArrayString(key, value) ?? value\n\t\t\t}\n\t\t} else {\n\t\t\tcurrent[lastKey] = parseJsonArrayString(key, value) ?? value\n\t\t}\n\t}\n\n\treturn result\n}\n\ntype NestedPrimitive<T extends Primitive> = T | { [key: string]: NestedPrimitive<T> | undefined } | NestedPrimitive<T>[]\n\n/** Ensures the parsed value has not been polluted with DANGEROUS_KEYS somewhere in the structure */\nfunction isSafeNestedPrimitive<T extends Primitive>(value: unknown): value is NestedPrimitive<T> {\n\tif (isPrimitive(value)) return true\n\n\tif (isArray(value)) {\n\t\treturn value.every(arrayItem => isSafeNestedPrimitive<T>(arrayItem))\n\t}\n\n\tif (isObject(value)) {\n\t\treturn Object.entries(value).every(\n\t\t\t([objectKey, objectValue]) => !DANGEROUS_KEYS.has(objectKey) && isSafeNestedPrimitive<T>(objectValue),\n\t\t)\n\t}\n\n\treturn false\n}\n\n/** Attempt to parse the input value as a JSON array. If the parsed value is a safe array then it is assumed that the agent sent it instead of a correctly flattened array. */\nfunction parseJsonArrayString<T extends Primitive>(key: string, value: T): NestedPrimitive<T>[] | undefined {\n\tif (typeof value !== \"string\" || SKIP_ARRAY_PARSE_KEYS.has(key)) return undefined\n\n\tconst trimmedValue = value.trim()\n\tif (!trimmedValue.startsWith(\"[\") || !trimmedValue.endsWith(\"]\")) return undefined\n\n\tconst parsedValue: unknown = tryParseJSON(trimmedValue)\n\tif (isArray(parsedValue) && parsedValue.every(arrayItem => isSafeNestedPrimitive<T>(arrayItem))) return parsedValue\n\n\treturn undefined\n}\n", "import { tryParseJSON } from \"utils/tryParseJSON.ts\"\nimport { z } from \"zod/v4\"\nimport type { DSLAttributeValue, RoundedNumber } from \"./traits/types.ts\"\n\nexport const booleanString = z.enum([\"true\", \"false\"]).transform(value => value === \"true\")\n\nexport const numericString = z.string().transform((value, zodContext) => {\n\tconst parsed = Number(value)\n\tif (Number.isNaN(parsed)) {\n\t\tzodContext.addIssue({ code: \"custom\", message: `\"${value}\" is not a valid number` })\n\t\treturn z.NEVER\n\t}\n\treturn parsed\n})\n\nexport const jsonString = z.string().transform(tryParseJSON).describe(\"json string\")\n\nexport const multiCollectionReferenceArray = jsonString.pipe(z.array(z.string())).or(z.array(z.string()))\n\nconst roundedNumberSchema = z.custom<RoundedNumber>(value => typeof value === \"number\")\n\nconst dslAttributeValueSchema: z.ZodType<DSLAttributeValue> = z.lazy(() =>\n\tz.union([\n\t\tz.string(),\n\t\troundedNumberSchema,\n\t\tz.boolean(),\n\t\tz.null(),\n\t\tz.undefined(),\n\t\tz.array(dslAttributeValueSchema),\n\t\tz.record(z.string(), dslAttributeValueSchema),\n\t]),\n)\n\nconst dslComputedValueFromVariableObject = z.object({\n\tfrom: z.string(),\n\ttransforms: z.array(dslAttributeValueSchema),\n})\n\nexport const dslComputedValueFromVariableSchema = jsonString\n\t.pipe(dslComputedValueFromVariableObject)\n\t.or(dslComputedValueFromVariableObject)\n", "import { assert, isEmptyObject } from \"@framerjs/shared\"\nimport { unflatten } from \"app/ai/utils/flatten.ts\"\nimport { richTextTags } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport type {\n\tArrayVariableDefinition,\n\tBooleanVariableDefinition,\n\tCollectionReferenceVariableDefinition,\n\tColorVariableDefinition,\n\tDateVariableDefinition,\n\tEnumVariableDefinition,\n\tEventHandlerVariableDefinition,\n\tFileVariableDefinition,\n\tImageVariableDefinition,\n\tLinkVariableDefinition,\n\tMultiCollectionReferenceVariableDefinition,\n\tNumberVariableDefinition,\n\tRichTextVariableDefinition,\n\tStringVariableDefinition,\n\tVariableDefinition,\n\tVariableOrDivider,\n\tVectorSetItemVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { variantInteractionGestures } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { richTextTableCellTypes } from \"document/models/richText/RichTextDocument.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { z } from \"zod/v4\"\nimport { booleanString, numericString } from \"./schemaUtils.ts\"\n\nexport const COMMAND_SEPARATOR = \";\"\nexport const QUOTE_REPAIR_WARNING = \"[applied] Auto-closed an unterminated quote while repairing this command.\"\n\nexport enum CommandType {\n\tAdd = \"+\", // +FrameNode ...\n\tUpdate = \"SET\",\n\tRemove = \"DEL\",\n\tMove = \"MOVE\",\n\tDuplicate = \"DUPE\",\n\t// An alias of Duplicate for creating variants that may support gestures.\n\tCreateVariant = \"CREATE_VARIANT\",\n}\n\nexport const TextBlockClass = \"TextBlock\" as const\nexport const TextBlockquoteClass = \"TextBlockquote\" as const\nexport const TextTableClass = \"TextTable\" as const\nexport const TextTableRowClass = \"TextTableRow\" as const\nexport const TextTableCellClass = \"TextTableCell\" as const\nexport const TextBulletListClass = \"TextBulletList\" as const\nexport const TextNumberedListClass = \"TextNumberedList\" as const\nexport const TextListItemClass = \"TextListItem\" as const\nexport const TextRunClass = \"TextRun\" as const\nexport const TextLineBreakClass = \"TextLineBreak\" as const\nexport const TextMediaBlockClass = \"TextMediaBlock\" as const\nexport const TextComponentInstanceClass = \"TextComponentInstance\" as const\nexport const virtualNodeClasses = [\n\tTextBlockClass,\n\tTextBlockquoteClass,\n\tTextTableClass,\n\tTextTableRowClass,\n\tTextTableCellClass,\n\tTextBulletListClass,\n\tTextNumberedListClass,\n\tTextListItemClass,\n\tTextRunClass,\n\tTextLineBreakClass,\n\tTextMediaBlockClass,\n\tTextComponentInstanceClass,\n] as const\n\nexport type InsertableVirtualNodeClass = (typeof virtualNodeClasses)[number]\nexport const TextUnsupportedBlockClass = \"TextUnsupportedBlock\" as const\nexport type VirtualNodeClass = InsertableVirtualNodeClass | typeof TextUnsupportedBlockClass\n\nconst virtualNodeClassesSet = new Set<string>(virtualNodeClasses)\nexport function isInsertableVirtualNodeClass(nodeClass: string): nodeClass is InsertableVirtualNodeClass {\n\treturn virtualNodeClassesSet.has(nodeClass)\n}\n\nexport function isVirtualNodeClass(nodeType: string): nodeType is VirtualNodeClass {\n\treturn nodeType === TextUnsupportedBlockClass || isInsertableVirtualNodeClass(nodeType)\n}\n\n/** Human-readable display name for the EventHandler control type, used in prompt text. */\nexport const EventHandlerControlName = \"EventHandler\" as const\n\nexport const IconNodeClass = \"IconNode\" as const\nexport const ComponentNodeClass = \"ComponentNode\" as const\nexport const ComponentInstanceNodeClass = \"ComponentInstanceNode\" as const\nexport const CollectionReferenceVariableAliasNodeClass = \"CollectionReferenceVariable\" as const\nexport const DateVariableAliasNodeClass = \"DateVariable\" as const\nexport const OptionVariableAliasNodeClass = \"OptionVariable\" as const\nexport const EventHandlerVariableAliasNodeClass = \"EventHandlerVariable\" as const\nexport const FileVariableAliasNodeClass = \"FileVariable\" as const\nexport const IconVariableAliasNodeClass = \"IconVariable\" as const\nexport const GalleryVariableAliasNodeClass = \"GalleryVariable\" as const\nexport const LinkVariableAliasNodeClass = \"LinkVariable\" as const\n// oxlint-disable-next-line framer-studio/use-dictionary-enum\nexport const VariableNodeClass = \"Variable\" as const\nexport const FixedOverlayNodeClass = \"FixedOverlayNode\" as const\nexport const IconVariableType = \"icon\" as const\nexport const GalleryVariableType = \"gallery\" as const\nexport const RelativeOverlayNodeClass = \"RelativeOverlayNode\" as const\nexport const RedirectNodeClass = \"RedirectNode\" as const\n\nexport const rootNodeId = \"rootNode\" as const\n\n/** Serialized `action` value for show-overlay handlers (matches frame event definitions). */\nexport const ShowOverlayActionName = \"SHOW_OVERLAY\" as const\n\n/** Serialized `action` value for dismiss-overlay handlers (matches frame event definitions). */\nexport const DismissOverlayActionName = \"DISMISS_OVERLAY\" as const\n\n/** Serialized `action` value for set-variant handlers (matches frame event definitions). */\nexport const SetVariantActionName = \"SET_VARIANT\" as const\n\n/** Serialized `action` value for trigger-event handlers (matches frame event definitions). */\nexport const TriggerEventActionName = \"TRIGGER_EVENT\" as const\n\n/** Serialized `action` value for set-variable-value handlers (matches frame event definitions). */\nexport const SetVariableValueActionName = \"SET_VARIABLE_VALUE\" as const\n\n/** Serialized `action` value for reset-variable-values handlers (matches frame event definitions). */\nexport const ResetVariableValuesActionName = \"RESET_VARIABLE_VALUES\" as const\n\nconst nodeAliases = [\n\tIconNodeClass,\n\tComponentInstanceNodeClass,\n\tComponentNodeClass,\n\tFixedOverlayNodeClass,\n\tRelativeOverlayNodeClass,\n\tRedirectNodeClass,\n] as const\n\nexport type NodeAliases = (typeof nodeAliases)[number]\n\nconst nodeAliasesSet = new Set<string>(nodeAliases)\nfunction isNodeAlias(type: string): type is NodeAliases {\n\treturn nodeAliasesSet.has(type)\n}\n\nconst contextNodeTypeClassDiscriminators = {\n\t[IconNodeClass]: ClassDiscriminator.CodeComponentNode,\n\t[ComponentInstanceNodeClass]: ClassDiscriminator.CodeComponentNode,\n\t[ComponentNodeClass]: ClassDiscriminator.SmartComponentNode,\n\t[FixedOverlayNodeClass]: ClassDiscriminator.OverlayNode,\n\t[RelativeOverlayNodeClass]: ClassDiscriminator.FrameNode,\n\t[RedirectNodeClass]: ClassDiscriminator.RedirectRouteNode,\n} as const satisfies Record<NodeAliases, ClassDiscriminator>\n\ntype ContextNodeTypeClassDiscriminator = (typeof contextNodeTypeClassDiscriminators)[NodeAliases]\nexport type SpecialCaseClassDiscriminator = Exclude<ContextNodeTypeClassDiscriminator, ClassDiscriminator.FrameNode>\n\nconst specialCaseClassDiscriminators = new Set<ClassDiscriminator>(\n\tObject.values(contextNodeTypeClassDiscriminators).filter(\n\t\tclassDiscriminator => classDiscriminator !== ClassDiscriminator.FrameNode,\n\t),\n)\n\nexport function isSpecialCaseClassDiscriminator(\n\tclassDiscriminator: ClassDiscriminator,\n): classDiscriminator is SpecialCaseClassDiscriminator {\n\treturn specialCaseClassDiscriminators.has(classDiscriminator)\n}\n\nexport function getClassDiscriminatorForContextNodeType(\n\ttype: Exclude<SupportedDSLNodeClass, (typeof virtualNodeClasses)[number]>,\n): ClassDiscriminator {\n\tif (isNodeAlias(type)) return contextNodeTypeClassDiscriminators[type]\n\treturn type\n}\n\n/**\n * DSL-facing scope-like node classes the agent can reason about as top-level authoring containers.\n */\nexport const supportedScopeNodeClasses = [\n\tComponentNodeClass,\n\tClassDiscriminator.DesignPageNode,\n\tClassDiscriminator.WebPageNode,\n\tClassDiscriminator.LayoutTemplateNode,\n\tClassDiscriminator.CollectionNode,\n] as const\nexport type SupportedScopeNodeClass = (typeof supportedScopeNodeClasses)[number]\n\nexport type DSLNodeClass =\n\t| Exclude<\n\t\t\tClassDiscriminator,\n\t\t\tClassDiscriminator.CodeComponentNode | ClassDiscriminator.SmartComponentNode | ClassDiscriminator.OverlayNode\n\t  >\n\t| NodeAliases\n\t| InsertableVirtualNodeClass\n\nexport const supportedNodeClasses = [\n\tClassDiscriminator.FrameNode,\n\tClassDiscriminator.RichTextNode,\n\tClassDiscriminator.ColorStyleTokenNode,\n\tClassDiscriminator.TextStylePresetNode,\n\tClassDiscriminator.LinkStylePresetNode,\n\tClassDiscriminator.InlineCodeStylePresetNode,\n\tClassDiscriminator.BlockquoteStylePresetNode,\n\tClassDiscriminator.TableStylePresetNode,\n\tClassDiscriminator.ImageStylePresetNode,\n\tClassDiscriminator.ComponentPresetNode,\n\tClassDiscriminator.WebPageNode,\n\tClassDiscriminator.LayoutTemplateNode,\n\tClassDiscriminator.DesignPageNode,\n\tClassDiscriminator.FormPlainTextInputNode,\n\tClassDiscriminator.FormBooleanInputNode,\n\tClassDiscriminator.FormSelectNode,\n\tClassDiscriminator.CollectionItemNode,\n\tClassDiscriminator.CollectionNode,\n\tClassDiscriminator.ShaderNode,\n\tClassDiscriminator.RootNode,\n\t...nodeAliases,\n\t...virtualNodeClasses,\n] as const\nconst whitespaceSeparatorRegex = /\\s+/u\n\nexport type SupportedDSLNodeClass = (typeof supportedNodeClasses)[number]\n\nconst supportedNodeClassesSet = new Set<string>(supportedNodeClasses)\nexport function isSupportedDSLNodeClass(nodeType: string): nodeType is SupportedDSLNodeClass {\n\treturn supportedNodeClassesSet.has(nodeType)\n}\n\n/**\n * Returns true when ADD for this class should be documented with a custom alias/example in\n * prompt/dslCommands.ts instead of the generic ADD node list. This is prompt ergonomics for the\n * LLM, not command parsing behavior.\n */\nconst nodeClassesWithCustomAddSyntax = new Set<string>([\n\tClassDiscriminator.ColorStyleTokenNode,\n\tClassDiscriminator.ComponentPresetNode,\n\tClassDiscriminator.DesignPageNode,\n\tClassDiscriminator.ImageStylePresetNode,\n\tClassDiscriminator.InlineCodeStylePresetNode,\n\tClassDiscriminator.BlockquoteStylePresetNode,\n\tClassDiscriminator.TableStylePresetNode,\n\tClassDiscriminator.TextStylePresetNode,\n\tClassDiscriminator.LinkStylePresetNode,\n\tClassDiscriminator.LayoutTemplateNode,\n\tClassDiscriminator.WebPageNode,\n\tClassDiscriminator.ShaderNode,\n\tCollectionReferenceVariableAliasNodeClass,\n\tComponentInstanceNodeClass,\n\tComponentNodeClass,\n\tDateVariableAliasNodeClass,\n\tEventHandlerVariableAliasNodeClass,\n\tFileVariableAliasNodeClass,\n\tGalleryVariableAliasNodeClass,\n\tIconNodeClass,\n\tIconVariableAliasNodeClass,\n\tLinkVariableAliasNodeClass,\n\tTextBlockClass,\n\tTextBlockquoteClass,\n\tTextTableClass,\n\tTextTableRowClass,\n\tTextTableCellClass,\n\tTextBulletListClass,\n\tTextComponentInstanceClass,\n\tTextLineBreakClass,\n\tTextListItemClass,\n\tTextMediaBlockClass,\n\tTextNumberedListClass,\n\tTextRunClass,\n\tVariableNodeClass,\n\tOptionVariableAliasNodeClass,\n\tFixedOverlayNodeClass,\n\tRelativeOverlayNodeClass,\n])\n\nexport function hasCustomAddSyntax(classDiscriminator: string): boolean {\n\treturn nodeClassesWithCustomAddSyntax.has(classDiscriminator)\n}\n\nconst nodeClassesWithoutAddSyntax = new Set<string>([\n\tClassDiscriminator.RootNode,\n\tClassDiscriminator.ComponentPresetNode,\n])\nexport function hasGenericAddSyntax(classDiscriminator: SupportedDSLNodeClass): boolean {\n\treturn !hasCustomAddSyntax(classDiscriminator) && !nodeClassesWithoutAddSyntax.has(classDiscriminator)\n}\n\nconst allNodeClassesArray = [...supportedNodeClasses, VariableNodeClass] as const\nexport type AllNodeClass = (typeof allNodeClassesArray)[number]\n\nconst insertableNodeClasses = [\n\tClassDiscriminator.DesignPageNode,\n\tClassDiscriminator.RichTextNode,\n\tClassDiscriminator.CollectionItemNode,\n\tClassDiscriminator.CollectionNode,\n] satisfies SupportedDSLNodeClass[]\n\ntype InsertableNodeClass = (typeof insertableNodeClasses)[number]\n\nconst insertable = new Set<string>(insertableNodeClasses)\n\n/**\n * A subset of nodes can be inserted at the time of the ADD command. Others wait for the next SET.\n */\nexport function shouldInsertNodeImmediately(nodeClass: SupportedDSLNodeClass): nodeClass is InsertableNodeClass {\n\treturn insertable.has(nodeClass)\n}\n\nconst baseAddAttributes = z.object({\n\tid: z.string(),\n\tparent: z.string().optional(),\n\tposition: z\n\t\t.string()\n\t\t.transform(value => (value ? Number.parseInt(value) : undefined))\n\t\t.optional(),\n\tname: z.string().optional(),\n})\n\nconst iconNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(\"IconNode\"),\n\tset: z.string().optional(),\n\t$control__icon: z.string().optional(),\n})\n\nconst componentNodeAttributes = z.strictObject({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(\"ComponentNode\"),\n})\n\nconst componentInstanceNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(\"ComponentInstanceNode\"),\n\tcomponent: z.string().optional(),\n})\n\nconst webPageNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(ClassDiscriminator.WebPageNode),\n\tpath: z.string().optional(),\n})\n\nconst layoutTemplateNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(ClassDiscriminator.LayoutTemplateNode),\n})\n\nconst redirectNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(RedirectNodeClass),\n})\n\nconst componentPresetNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(ClassDiscriminator.ComponentPresetNode),\n\tcomponent: z.string().optional(),\n})\n\nexport const standardVariableTypes = [\n\tControlType.Number,\n\tControlType.String,\n\tControlType.RichText,\n\tControlType.Boolean,\n\tControlType.Color,\n\tControlType.Image,\n] as const\n\nexport const supportedVariableTypes = [\n\t...standardVariableTypes,\n\tControlType.Link,\n\tControlType.Enum,\n\tControlType.Date,\n\tControlType.EventHandler,\n\tControlType.File,\n\tControlType.CollectionReference,\n\tControlType.MultiCollectionReference,\n\t// Only Gallery type variables\n\tControlType.Array,\n\tIconVariableType,\n] as const\nexport type SupportedVariableType = (typeof supportedVariableTypes)[number]\nconst supportedVariableTypesSet: Set<string> = new Set(supportedVariableTypes)\nfunction isSupportedVariableType(type: string): type is SupportedVariableType {\n\treturn supportedVariableTypesSet.has(type)\n}\n\nexport function serializeVariableType(type: VariableOrDivider[\"type\"]): SupportedVariableType | undefined {\n\treturn type === ControlType.VectorSetItem ? IconVariableType : isSupportedVariableType(type) ? type : undefined\n}\n\ntype RequireSchemaKey<T, K extends string> = K extends keyof T ? Record<K, z.ZodType> : { [P in K]?: never }\n\n/**\n * Asserts that a Zod schema includes the keys required by a variable definition type.\n * e.g., for variables supporting WithQueryParam, the schema must include a `queryParam` field.\n *\n * This just checks that a schema key exists, not that the type of the schema key matches.\n * The latter would be too complex / not worth it.\n */\ntype AgentVariableSchemaKeys<T extends VariableDefinition> = RequireSchemaKey<T, \"id\"> &\n\tRequireSchemaKey<T, \"name\"> &\n\tRequireSchemaKey<T, \"description\"> &\n\tRequireSchemaKey<T, \"initialValue\"> &\n\tRequireSchemaKey<T, \"queryParam\"> &\n\tRequireSchemaKey<T, \"cases\"> &\n\tRequireSchemaKey<T, \"allowedFileTypes\">\n\ninterface AgentVariableSchema<T extends VariableDefinition> {\n\tshape: { type: z.ZodLiteral<T[\"type\"]> } & AgentVariableSchemaKeys<T>\n}\n\ninterface AgentVariableAliasSchema<T extends VariableDefinition> {\n\tshape: AgentVariableSchemaKeys<T>\n}\n\nconst baseVariableAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(VariableNodeClass),\n\tscope: z.string(),\n\tdescription: z.string().optional(),\n})\n\nconst baseVariableAliasAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tscope: z.string(),\n\tdescription: z.string().optional(),\n})\n\nconst imageVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.Image),\n\tinitialValue: z.unknown().optional(),\n}) satisfies AgentVariableSchema<ImageVariableDefinition>\n\nconst linkVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.Link),\n\tinitialValue: z.unknown().optional(),\n}) satisfies AgentVariableSchema<LinkVariableDefinition>\n\nconst linkVariableAliasAttributes = z.object({\n\t...baseVariableAliasAttributes.shape,\n\tnode: z.literal(LinkVariableAliasNodeClass),\n})\n\nconst collectionReferenceVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.CollectionReference),\n\tcollection: z.string(),\n\tinitialValue: z.unknown().optional(),\n\tqueryParam: z.string().optional(),\n}) satisfies AgentVariableSchema<CollectionReferenceVariableDefinition>\n\nconst multiCollectionReferenceVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.MultiCollectionReference),\n\tcollection: z.string(),\n\tinitialValue: z.unknown().optional(),\n\tqueryParam: z.string().optional(),\n}) satisfies AgentVariableSchema<MultiCollectionReferenceVariableDefinition>\n\nconst collectionReferenceVariableAliasAttributes = z.object({\n\t...baseVariableAliasAttributes.shape,\n\tnode: z.literal(CollectionReferenceVariableAliasNodeClass),\n\ttype: z.enum([\"single\", \"multi\"]),\n\tcollection: z.string(),\n\tinitialValue: z.unknown().optional(),\n\tqueryParam: z.string().optional(),\n}) satisfies AgentVariableAliasSchema<CollectionReferenceVariableDefinition>\n\nconst iconVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(IconVariableType),\n\tset: z.string(),\n\tinitialValue: z.string().optional(),\n}) satisfies AgentVariableAliasSchema<VectorSetItemVariableDefinition>\n\nconst iconVariableAliasAttributes = z.object({\n\t...baseVariableAliasAttributes.shape,\n\tnode: z.literal(IconVariableAliasNodeClass),\n\tset: z.string(),\n\tinitialValue: z.string().optional(),\n}) satisfies AgentVariableAliasSchema<VectorSetItemVariableDefinition>\n\nconst numberVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.Number),\n\tinitialValue: z.unknown(),\n\tqueryParam: z.string().optional(),\n}) satisfies AgentVariableSchema<NumberVariableDefinition>\n\nconst stringVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.String),\n\tinitialValue: z.unknown(),\n\tqueryParam: z.string().optional(),\n\tdisplayTextArea: booleanString.optional(),\n}) satisfies AgentVariableSchema<StringVariableDefinition>\n\nconst booleanVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.Boolean),\n\tinitialValue: z.unknown(),\n\tqueryParam: z.string().optional(),\n}) satisfies AgentVariableSchema<BooleanVariableDefinition>\n\nconst dateVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.Date),\n\tinitialValue: z.unknown().optional(),\n\tdisplayTime: booleanString.optional(),\n\tqueryParam: z.string().optional(),\n}) satisfies AgentVariableSchema<DateVariableDefinition>\n\nconst dateVariableAliasAttributes = z.object({\n\t...baseVariableAliasAttributes.shape,\n\tnode: z.literal(DateVariableAliasNodeClass),\n\tinitialValue: z.string().optional(),\n\tdisplayTime: z.string().optional(),\n\tqueryParam: z.string().optional(),\n}) satisfies AgentVariableAliasSchema<DateVariableDefinition>\n\nconst optionVariableAliasAttributes = z.object({\n\t...baseVariableAliasAttributes.shape,\n\tnode: z.literal(OptionVariableAliasNodeClass),\n\tcases: z.array(z.string()),\n\tinitialValue: z.string().optional(),\n}) satisfies AgentVariableAliasSchema<EnumVariableDefinition>\n\nconst eventHandlerVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.EventHandler),\n\tinitialValue: z.unknown().optional(),\n}) satisfies AgentVariableSchema<EventHandlerVariableDefinition>\n\nconst eventHandlerVariableAliasAttributes = z.object({\n\t...baseVariableAliasAttributes.shape,\n\tnode: z.literal(EventHandlerVariableAliasNodeClass),\n\tinitialValue: z.unknown().optional(),\n}) satisfies AgentVariableAliasSchema<EventHandlerVariableDefinition>\n\nconst fileVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.File),\n\tallowedFileTypes: z.array(z.string()).optional().default([]),\n\tinitialValue: z.never().optional(),\n}) satisfies AgentVariableSchema<FileVariableDefinition>\n\nconst fileVariableAliasAttributes = z.object({\n\t...baseVariableAliasAttributes.shape,\n\tnode: z.literal(FileVariableAliasNodeClass),\n\tallowedFileTypes: z.array(z.string()).optional().default([]),\n\tinitialValue: z.never().optional(),\n}) satisfies AgentVariableAliasSchema<FileVariableDefinition>\n\nconst galleryVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.Array),\n\tinitialValue: z.array(z.string()).optional().default([]),\n\tminCount: numericString.optional(),\n\tmaxCount: numericString.optional(),\n}) satisfies AgentVariableAliasSchema<ArrayVariableDefinition>\n\nconst galleryVariableAliasAttributes = z.object({\n\t...baseVariableAliasAttributes.shape,\n\tnode: z.literal(GalleryVariableAliasNodeClass),\n\tinitialValue: z.array(z.string()).optional().default([]),\n\tminCount: numericString.optional(),\n\tmaxCount: numericString.optional(),\n}) satisfies AgentVariableAliasSchema<ArrayVariableDefinition>\n\nconst richTextVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.RichText),\n\tinitialValue: z.unknown(),\n}) satisfies AgentVariableSchema<RichTextVariableDefinition>\n\nconst colorVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.Color),\n\tinitialValue: z.unknown(),\n}) satisfies AgentVariableSchema<ColorVariableDefinition>\n\nconst enumVariableAttributes = z.object({\n\t...baseVariableAttributes.shape,\n\ttype: z.literal(ControlType.Enum),\n\tcases: z.array(z.string()),\n\tinitialValue: z.string().optional(),\n}) satisfies AgentVariableSchema<EnumVariableDefinition>\n\n// TODO: add other variable types\nconst variableAttributes = z.discriminatedUnion(\"type\", [\n\timageVariableAttributes,\n\tdateVariableAttributes,\n\teventHandlerVariableAttributes,\n\tgalleryVariableAttributes,\n\tfileVariableAttributes,\n\tcollectionReferenceVariableAttributes,\n\tmultiCollectionReferenceVariableAttributes,\n\ticonVariableAttributes,\n\tnumberVariableAttributes,\n\tstringVariableAttributes,\n\tbooleanVariableAttributes,\n\tlinkVariableAttributes,\n\trichTextVariableAttributes,\n\tcolorVariableAttributes,\n\tenumVariableAttributes,\n])\n\nconst textStylePresetNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(ClassDiscriminator.TextStylePresetNode),\n\ttag: z.enum(richTextTags).optional(),\n})\n\nconst linkStylePresetNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(ClassDiscriminator.LinkStylePresetNode),\n})\n\nconst textBlockAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(\"TextBlock\" as const),\n\ttag: z.enum(richTextTags).optional(),\n})\n\nconst textBlockquoteAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(TextBlockquoteClass),\n})\n\nconst textTableAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(TextTableClass),\n})\n\nconst textTableRowAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(TextTableRowClass),\n})\n\nconst textTableCellAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(TextTableCellClass),\n\tcellType: z.enum(richTextTableCellTypes).optional(),\n})\n\nconst textBulletListAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(\"TextBulletList\" as const),\n})\n\nconst textNumberedListAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(\"TextNumberedList\" as const),\n})\n\nconst textListItemAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(\"TextListItem\" as const),\n})\n\nconst textRunAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(\"TextRun\" as const),\n})\n\nconst textLineBreakAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(\"TextLineBreak\" as const),\n})\n\nconst mediaBlockAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(\"TextMediaBlock\" as const),\n})\n\nconst textComponentInstanceAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(TextComponentInstanceClass),\n\tcomponent: z.string().optional(),\n})\n\nconst shaderNodeAttributes = baseAddAttributes.extend({\n\tnode: z.literal(ClassDiscriminator.ShaderNode),\n\tshader: z.string().optional(),\n})\n\nconst fixedOverlayNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(FixedOverlayNodeClass),\n\tparent: z.string(),\n})\n\nconst imageStylePresetNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(ClassDiscriminator.ImageStylePresetNode),\n})\n\nconst inlineCodeStylePresetNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(ClassDiscriminator.InlineCodeStylePresetNode),\n})\n\nconst blockquoteStylePresetNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(ClassDiscriminator.BlockquoteStylePresetNode),\n})\n\nconst tableStylePresetNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(ClassDiscriminator.TableStylePresetNode),\n})\n\nconst relativeOverlayNodeAttributes = z.object({\n\t...baseAddAttributes.shape,\n\tnode: z.literal(RelativeOverlayNodeClass),\n\tparent: z.string(),\n})\n\nconst addNodeAttributes = z.discriminatedUnion(\"node\", [\n\tz.object({\n\t\t...baseAddAttributes.shape,\n\t\tnode: z.union([\n\t\t\tz.literal(ClassDiscriminator.FrameNode),\n\t\t\tz.literal(ClassDiscriminator.RichTextNode),\n\t\t\tz.literal(ClassDiscriminator.CollectionNode),\n\t\t\tz.literal(ClassDiscriminator.CollectionItemNode),\n\t\t\tz.literal(ClassDiscriminator.DesignPageNode),\n\t\t\tz.literal(ClassDiscriminator.ColorStyleTokenNode),\n\t\t\tz.literal(ClassDiscriminator.FormPlainTextInputNode),\n\t\t\tz.literal(ClassDiscriminator.FormBooleanInputNode),\n\t\t\tz.literal(ClassDiscriminator.FormSelectNode),\n\t\t]),\n\t}),\n\tcomponentNodeAttributes,\n\ticonNodeAttributes,\n\tcomponentInstanceNodeAttributes,\n\tcomponentPresetNodeAttributes,\n\twebPageNodeAttributes,\n\tlayoutTemplateNodeAttributes,\n\tredirectNodeAttributes,\n\tvariableAttributes,\n\tcollectionReferenceVariableAliasAttributes,\n\tdateVariableAliasAttributes,\n\toptionVariableAliasAttributes,\n\teventHandlerVariableAliasAttributes,\n\tfileVariableAliasAttributes,\n\ticonVariableAliasAttributes,\n\tgalleryVariableAliasAttributes,\n\tlinkVariableAliasAttributes,\n\ttextStylePresetNodeAttributes,\n\tlinkStylePresetNodeAttributes,\n\tinlineCodeStylePresetNodeAttributes,\n\tblockquoteStylePresetNodeAttributes,\n\ttableStylePresetNodeAttributes,\n\timageStylePresetNodeAttributes,\n\ttextBlockAttributes,\n\ttextBlockquoteAttributes,\n\ttextTableAttributes,\n\ttextTableRowAttributes,\n\ttextTableCellAttributes,\n\ttextBulletListAttributes,\n\ttextNumberedListAttributes,\n\ttextListItemAttributes,\n\tmediaBlockAttributes,\n\ttextComponentInstanceAttributes,\n\ttextRunAttributes,\n\ttextLineBreakAttributes,\n\tshaderNodeAttributes,\n\tfixedOverlayNodeAttributes,\n\trelativeOverlayNodeAttributes,\n])\n\nconst addNodeCommand = z.object({\n\ttype: z.literal(CommandType.Add),\n\tattributes: addNodeAttributes,\n})\ntype AddCommand = z.infer<typeof addNodeCommand>\nexport type AddCommandAttributes = AddCommand[\"attributes\"]\nexport type AddVariableAttributes = Extract<AddCommandAttributes, { node: typeof VariableNodeClass }>\nexport type AddVariableCommandAttributes =\n\t| AddVariableAttributes\n\t| Extract<AddCommandAttributes, { node: typeof CollectionReferenceVariableAliasNodeClass }>\n\t| Extract<AddCommandAttributes, { node: typeof DateVariableAliasNodeClass }>\n\t| Extract<AddCommandAttributes, { node: typeof OptionVariableAliasNodeClass }>\n\t| Extract<AddCommandAttributes, { node: typeof EventHandlerVariableAliasNodeClass }>\n\t| Extract<AddCommandAttributes, { node: typeof FileVariableAliasNodeClass }>\n\t| Extract<AddCommandAttributes, { node: typeof IconVariableAliasNodeClass }>\n\t| Extract<AddCommandAttributes, { node: typeof GalleryVariableAliasNodeClass }>\n\t| Extract<AddCommandAttributes, { node: typeof LinkVariableAliasNodeClass }>\n\nconst addVariableNodeClasses = [\n\tVariableNodeClass,\n\tCollectionReferenceVariableAliasNodeClass,\n\tDateVariableAliasNodeClass,\n\tOptionVariableAliasNodeClass,\n\tEventHandlerVariableAliasNodeClass,\n\tFileVariableAliasNodeClass,\n\tIconVariableAliasNodeClass,\n\tGalleryVariableAliasNodeClass,\n\tLinkVariableAliasNodeClass,\n] as const\nconst addVariableNodeClassesSet = new Set<string>(addVariableNodeClasses)\n\nexport function isAddVariableCommandAttributes(\n\tattributes: AddCommandAttributes,\n): attributes is AddVariableCommandAttributes {\n\treturn addVariableNodeClassesSet.has(attributes.node)\n}\n\nconst updateNodeCommand = z.object({\n\ttype: z.literal(CommandType.Update),\n\tattributes: z.object({ id: z.string() }).and(z.record(z.string(), z.string().optional())),\n})\ntype UpdateCommand = z.infer<typeof updateNodeCommand>\nexport type UpdateCommandAttributes = UpdateCommand[\"attributes\"]\n\nconst removeNodeCommand = z.object({\n\ttype: z.literal(CommandType.Remove),\n\tattributes: z.object({\n\t\tid: z.string(),\n\t}),\n})\n\nconst moveNodeCommand = z.object({\n\ttype: z.literal(CommandType.Move),\n\tattributes: z.object({\n\t\tid: z.string(),\n\t\tparent: z.string(),\n\t\tposition: z\n\t\t\t.string()\n\t\t\t.optional()\n\t\t\t.transform(value => (value ? Number.parseInt(value) : undefined)),\n\t}),\n})\n\nconst duplicateNodeCommand = z.object({\n\ttype: z.literal(CommandType.Duplicate),\n\tattributes: z.object({\n\t\tid: z.string(),\n\t\tnewId: z.string(),\n\t\tparent: z.string().optional(),\n\t\tposition: z\n\t\t\t.string()\n\t\t\t.optional()\n\t\t\t.transform(value => (value ? Number.parseInt(value) : undefined)),\n\t}),\n})\n\nconst createVariantCommand = z.object({\n\ttype: z.literal(CommandType.CreateVariant),\n\tattributes: z.object({\n\t\tid: z.string(),\n\t\tfrom: z.string(),\n\t\tgesture: z\n\t\t\t.union([z.enum(variantInteractionGestures), z.literal(\"\")])\n\t\t\t.optional()\n\t\t\t.transform(value => (value === \"\" ? undefined : value))\n\t\t\t.pipe(z.enum(variantInteractionGestures).optional()),\n\t}),\n})\n\nconst Commands = z.discriminatedUnion(\"type\", [\n\taddNodeCommand,\n\tupdateNodeCommand,\n\tremoveNodeCommand,\n\tmoveNodeCommand,\n\tduplicateNodeCommand,\n\tcreateVariantCommand,\n])\nexport type Command = z.infer<typeof Commands>\n\nconst type = \"type\" satisfies keyof Command\nexport function isCommand(command: unknown): command is Command {\n\tif (!isObject(command)) return false\n\treturn type in command && isString(command.type) && isCommandType(command.type)\n}\n\nconst commandTypesSet = new Set<string>(Object.values(CommandType))\nfunction isCommandType(prefix: string): prefix is CommandType {\n\treturn commandTypesSet.has(prefix)\n}\n\n// Matches `+Something`\nconst addCommandStartRegex = /^\\+\\w/u\n\n/**\n * Keep ADD broad here so \"typoed\" or \"unknown\" `+Something` commands still fence the previous broken\n * command and surface a parser error instead of swallowing them as undetected commands.\n */\nexport function isDSLCommandStart(text: string): boolean {\n\tconst trimmed = text.trimStart()\n\tif (addCommandStartRegex.test(trimmed)) return true\n\n\tconst [first] = trimmed.split(whitespaceSeparatorRegex)\n\treturn isString(first) && first !== CommandType.Add && isCommandType(first)\n}\n\n// Match key=\"value\", key='value', and for leniency unquoted values like key=800, key=800px, key=true, where keys use [A-Za-z0-9_$.-]+ and unquoted values use [A-Za-z0-9_.%-]+.\nconst attributeRegex = /([\\w$.-]+)=(?:([\"'])((?:\\\\.|(?!\\2)[\\s\\S])*)\\2|([\\w.%-]+))/g\n\nconst escapeSequenceRegex = /\\\\(?<seq>u[\\da-fA-F]{4}|[\"\\\\nrt])/gu\n\n/** Inverse of escapeAttributeValue in nodeToDSLCommands.ts: `\\uXXXX` \u2192 char, `\\\"` \u2192 `\"`, `\\\\` \u2192 `\\`, `\\n` \u2192 newline, `\\r` \u2192 CR, `\\t` \u2192 tab */\nfunction unescapeAttributeValue(value: string): string {\n\treturn value.replace(escapeSequenceRegex, (_, seq: string) => {\n\t\tif (seq.startsWith(\"u\")) return String.fromCharCode(parseInt(seq.slice(1), 16))\n\t\tif (seq === \"n\") return \"\\n\"\n\t\tif (seq === \"r\") return \"\\r\"\n\t\tif (seq === \"t\") return \"\\t\"\n\t\treturn seq\n\t})\n}\n\nfunction unquoteCommandArgument(value: string | undefined): string | undefined {\n\tif (!isString(value) || value.length < 2) return value\n\n\tconst quote = value[0]\n\tconst isQuoteOpening = quote === `\"` || quote === `'`\n\tif (isQuoteOpening && value.endsWith(quote)) {\n\t\treturn unescapeAttributeValue(value.slice(1, -1))\n\t}\n\n\treturn value\n}\n\nfunction parsePrefix(parts: string[]) {\n\tconst [first, arg] = parts\n\tassert(isString(first), \"Invalid command type\")\n\tconst id = unquoteCommandArgument(arg)\n\n\tif (isCommandType(first)) {\n\t\treturn { type: first, id } as const\n\t}\n\n\tassert(first.startsWith(CommandType.Add), \"Invalid command type\")\n\tconst node = first.slice(CommandType.Add.length)\n\n\treturn { type: CommandType.Add, node, id } as const\n}\n\n/**\n * Parses a single command string into a Command object\n */\nexport function parseDSLCommand(commandStr: string): Command {\n\tconst trimmed = commandStr.trim()\n\tassert(trimmed, \"Empty command\")\n\n\t// Extract command type and attributes\n\tconst parts = trimmed.split(whitespaceSeparatorRegex)\n\tconst { type, ...rest } = parsePrefix(parts)\n\n\t// Parse attributes (key=\"value\" pairs)\n\tconst attributes: Record<string, string> = {}\n\tfor (const [key, value] of Object.entries(rest)) {\n\t\tif (isString(value)) attributes[key] = value\n\t}\n\tconst matches = trimmed.matchAll(attributeRegex)\n\n\tfor (const match of matches) {\n\t\tconst key = match[1]\n\t\tassert(!isUndefined(key), \"Invalid attribute key\")\n\t\tconst quotedValue = match[3]\n\t\tconst unquotedValue = match[4]\n\t\tif (!isUndefined(quotedValue)) {\n\t\t\tattributes[key] = unescapeAttributeValue(quotedValue)\n\t\t} else {\n\t\t\tassert(!isUndefined(unquotedValue), \"Invalid attribute value\")\n\t\t\tattributes[key] = unquotedValue\n\t\t}\n\t}\n\n\tconst parsedAttributes = type === CommandType.Add && !isEmptyObject(attributes) ? unflatten(attributes) : attributes\n\n\t// Validate with Zod\n\treturn Commands.parse({\n\t\ttype,\n\t\tattributes: !isEmptyObject(parsedAttributes) ? parsedAttributes : undefined,\n\t})\n}\n", "import { createAbsoluteImageAssetURLFromAsset } from \"@framerjs/assets\"\nimport type { FileUploadResult, ImageUploadResult, VideoUploadResult } from \"web/pages/project/lib/UploadService.ts\"\n\nexport interface AgentAttachmentImageUploadResult extends ImageUploadResult {\n\tsizeKB?: number\n}\n\nexport type AgentAttachmentFileUploadResult = (FileUploadResult | VideoUploadResult) & { sizeKB?: number }\n\nexport type AgentAttachmentFileType = \"csv\" | \"json\" | \"markdown\" | \"plain\" | \"tsv\" | \"video\"\n\nexport const textFileTypes = new Set<AgentAttachmentFileType>([\"csv\", \"json\", \"markdown\", \"plain\", \"tsv\"])\n\nexport const videoFileExtensions = new Set([\"avi\", \"mkv\", \"m4v\", \"mov\", \"mp4\", \"ogv\", \"webm\", \"wmv\"])\n\nexport function isVideoFileName(name: string): boolean {\n\tconst dotIdx = name.lastIndexOf(\".\")\n\tif (dotIdx === -1) return false\n\treturn videoFileExtensions.has(name.slice(dotIdx + 1).toLowerCase())\n}\n\nexport interface AgentAttachmentFile {\n\ttype: \"file\"\n\tfileName: string\n\tfileType: AgentAttachmentFileType\n\tuploadResult: AgentAttachmentFileUploadResult\n\ttext?: string\n\tsizeBytes: number\n}\n\nexport interface AgentAttachmentImage {\n\treferenceImage: AgentAttachmentImageUploadResult\n\t/**\n\t * Optional rasterized upload used when the canonical asset cannot be passed directly to\n\t * the model. SVG attachments keep `referenceImage` as the real SVG so asset references\n\t * still work, and store the derived PNG here so the model can see the image.\n\t */\n\tmodelImage?: AgentAttachmentImageUploadResult\n}\n\nexport type AgentAttachmentResult = AgentAttachmentImage | AgentAttachmentFile\n\nexport function createAgentAttachmentImage(image: AgentAttachmentImageUploadResult): AgentAttachmentImage {\n\treturn {\n\t\treferenceImage: image,\n\t}\n}\n\nexport interface AgentAttachmentUrls {\n\treferenceUrl: string\n\tmessageUrl: string\n}\n\nexport function getImageUploadResultForMessageAttachment(\n\timage: AgentAttachmentImage,\n): AgentAttachmentImageUploadResult {\n\treturn image.modelImage ?? image.referenceImage\n}\n\nexport function getImageUrls(image: AgentAttachmentImage): AgentAttachmentUrls {\n\treturn {\n\t\treferenceUrl: createAbsoluteAttachmentUrl(image.referenceImage),\n\t\tmessageUrl: createAbsoluteAttachmentUrl(getImageUploadResultForMessageAttachment(image)),\n\t}\n}\n\nexport function getAttachmentPreviewUrl(image: AgentAttachmentImage): string {\n\treturn getImageUploadResultForMessageAttachment(image).url\n}\n\nfunction normalizeAssetExtension<T extends Pick<ImageUploadResult[\"asset\"], \"extension\">>(asset: T): T {\n\tif (asset.extension.startsWith(\".\")) return asset\n\treturn {\n\t\t...asset,\n\t\textension: `.${asset.extension}`,\n\t}\n}\n\nfunction createAbsoluteAttachmentUrl(image: AgentAttachmentImageUploadResult): string {\n\tconst url = createAbsoluteImageAssetURLFromAsset(normalizeAssetExtension(image.asset))\n\tif (!image.sizeKB) return url\n\t// add size in KB to the URL so large images can be excluded from vision for models with hard size limits\n\tconst withSizeKB = new URL(url)\n\twithSizeKB.searchParams.set(\"kb\", image.sizeKB.toString())\n\treturn withSizeKB.toString()\n}\n", "export const ASK_CLARIFICATION_TOOL_NAME = \"ask_clarification\"\nexport const CHECKLIST_COMPLETE_TASK_TOOL_NAME = \"checklist_complete_task\"\nexport const CHECKLIST_CREATE_TOOL_NAME = \"checklist_create\"\nexport const CREATE_COMPONENT_FROM_FRAME_TOOL_NAME = \"create_component_from_frame\"\nexport const FETCH_EXTERNAL_URL_TOOL_NAME = \"fetch_url\"\nexport const FLATTEN_COMPONENT_INSTANCE_TOOL_NAME = \"flatten_component_instance\"\nexport const MAKE_EXTERNAL_COMPONENT_LOCAL_TOOL_NAME = \"make_external_component_local\"\nexport const PUBLISH_TOOL_NAME = \"publish\"\nexport const QUERY_IMAGES_TOOL_NAME = \"query_images\"\nexport const READ_PROJECT_TOOL_NAME = \"read_project\"\nexport const REVIEW_CHANGES_TOOL_NAME = \"review_changes\"\nexport const REQUEST_CODE_FILE_CHANGES_TOOL_NAME = \"request_code_file_changes\"\nexport const SCRIPT_TOOL_NAME = \"script\"\nexport const VIEW_IMAGE_TOOL_NAME = \"view_image\"\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { isFrameNode, isRichTextNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { WithStylePresetBreakpoint } from \"document/models/CanvasTree/traits/WithStylePresetBreakpoint.ts\"\nimport {\n\ttype FontSizeCSSDimension,\n\tfontSizeRoundingPerUnit,\n\tisFontSizeCSSDimension,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { roundedNumber } from \"library/index.ts\"\n\n// These widths are used when first adding new breakpoints.\nexport const defaultBreakpointWidths = [1200, 810]\n\nconst MAX_BREAKPOINTS = 4\n\nconst DEFAULT_BREAKPOINT_LABELS = [\"L\", \"M\", \"S\"]\n\nexport function getBreakpointLabel(index: number, amount: number) {\n\tif (amount <= DEFAULT_BREAKPOINT_LABELS.length) {\n\t\treturn DEFAULT_BREAKPOINT_LABELS[index] ?? Dictionary.Unknown\n\t}\n\n\tconst middle = Math.floor((amount - 1) / 2)\n\n\tif (index < middle) {\n\t\treturn \"L\".padStart(middle - index, \"X\")\n\t}\n\n\tif (index > middle) {\n\t\treturn \"S\".padStart(index - middle, \"X\")\n\t}\n\n\treturn \"M\"\n}\n\n/**\n * Returns the breakpoint that is rendered on the canvas for the active\n * screen.\n * @param breakpoints An array of breakpoints sorted from largest to smallest.\n */\nexport function getBreakpointFromActiveScreen<PresetNode extends WithStylePresetBreakpoint>(\n\tengine: VekterEngine,\n\tbreakpoints: PresetNode[],\n) {\n\tconst richTextNode = engine.stores.selectionStore.nodes.find(isRichTextNode)\n\tif (!richTextNode) return undefined\n\n\tconst groundNode = engine.tree.getGroundNodeFor(richTextNode)\n\tif (!isBreakpointVariant(groundNode) || !isFrameNode(groundNode)) return undefined\n\n\t// TODO: Use Array.prototype.findLast\n\t// https://github.com/tc39/proposal-array-find-from-last\n\tconst reversedBreakpoints = Array.from(breakpoints).reverse()\n\tconst breakpoint = reversedBreakpoints.find(b => (b.breakpointWidth ?? 0) > groundNode.width)\n\tif (!breakpoint) return undefined\n\n\treturn breakpoint\n}\n\n/**\n * Returns the breakpoints widths for the active webpage or default widths if\n * the active webpage has no breakpoints.\n */\nexport function getBreakpointWidths(engine: VekterEngine) {\n\tconst scopeNode = engine.stores.scopeStore.active\n\tconst webPageNode = isWebPageNode(scopeNode) ? scopeNode : undefined\n\tif (!webPageNode) return defaultBreakpointWidths\n\tconst canvasDesktop = engine.tree.get(webPageNode?.baseVariantId)\n\n\tif (\n\t\tcanvasDesktop &&\n\t\tisFrameNode(canvasDesktop) &&\n\t\tcanvasDesktop.cache.replicaInstances &&\n\t\tcanvasDesktop.cache.replicaInstances.length > 0\n\t) {\n\t\tconst uniqueCanvasBreakpoints = new Set([canvasDesktop.width])\n\n\t\tconst frameNodes = engine.tree.getNodesWithTrait(canvasDesktop.cache.replicaInstances, isFrameNode)\n\t\tframeNodes.forEach(node => uniqueCanvasBreakpoints.add(node.width))\n\n\t\tconst canvasBreakpoints = Array.from(uniqueCanvasBreakpoints)\n\t\tcanvasBreakpoints.sort((left, right) => right - left)\n\n\t\tif (canvasBreakpoints.length > 1) {\n\t\t\t// Create a maximum of 4 breakpoints.\n\t\t\tconst end = Math.min(canvasBreakpoints.length - 1, MAX_BREAKPOINTS)\n\t\t\treturn canvasBreakpoints.slice(0, end)\n\t\t}\n\t}\n\n\treturn defaultBreakpointWidths\n}\n\nexport const stylePresetFallbackWidths = [...defaultBreakpointWidths, 640]\n\n/**\n * Picks a breakpoint width for a new style preset replica.\n * Tries canvas-derived widths first, then hardcoded fallbacks, then a computed step-down.\n */\nexport function pickStylePresetBreakpointWidth(\n\tcanvasWidths: number[],\n\texistingSizes: Set<number>,\n\tlastBreakpointWidth: number | undefined,\n): number {\n\tfor (const width of canvasWidths) {\n\t\tif (!existingSizes.has(width)) return width\n\t}\n\tfor (const width of stylePresetFallbackWidths) {\n\t\tif (!existingSizes.has(width)) return width\n\t}\n\tconst lastWidth = lastBreakpointWidth ?? 1200\n\treturn Math.max(lastWidth - 100, 200)\n}\n\n/** \"Major third\" scale \u2014 https://type-scale.com/ */\nexport function scaleStylePresetFontSize(fontSize: number | FontSizeCSSDimension, index: number): FontSizeCSSDimension {\n\tconst [size, unit = \"px\"] = isFontSizeCSSDimension(fontSize) ? parseCSSDimension(fontSize) : [fontSize, \"px\"]\n\treturn createCSSDimension(roundedNumber(0.8 ** (index + 1) * size, fontSizeRoundingPerUnit[unit]), unit)\n}\n", "import { getBreakpointLabel } from \"document/components/chrome/properties/panels/breakpointUtils.tsx\"\nimport { getTextStylePresetBreakpointsFromTree } from \"document/components/chrome/properties/panels/utils/getTextStylePresetBreakpoints.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/CanvasTree.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport { isTextStylePresetPrimaryNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isFontSizeCSSDimension } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { createCSSDimension, isCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\n\n/**\n * Agent-facing labels for text style preset breakpoint slots.\n * `default` always refers to the primary node. Replica labels are dynamic\n * and mirror the UI's positional letter scheme (L/M/S/XL/XS):\n *\n * - 0 replicas: default\n * - 1 replica:  default, medium\n * - 2 replicas: default, medium, small\n * - 3 replicas: default, medium, small, extraSmall\n * - 4 replicas: default, large, medium, small, extraSmall\n *\n * Relabeling only occurs at the 3\u21924 replica transition.\n */\nexport const defaultBreakpointLabel = \"default\"\nexport const breakpointLabels = [defaultBreakpointLabel, \"large\", \"medium\", \"small\", \"extraSmall\"] as const\nexport type BreakpointLabel = (typeof breakpointLabels)[number]\n\ntype ReplicaBreakpointLabel = Exclude<BreakpointLabel, typeof defaultBreakpointLabel>\n\nconst breakpointLabelSet = new Set<string>(breakpointLabels)\n\nexport function isBreakpointLabel(value: string): value is BreakpointLabel {\n\treturn breakpointLabelSet.has(value)\n}\n\nconst uiLabelToAgentLabel: Record<string, BreakpointLabel> = {\n\tL: \"large\",\n\tM: \"medium\",\n\tS: \"small\",\n\tXS: \"extraSmall\",\n}\n\n/**\n * Returns the agent label for a given segment index, taking into account\n * the total number of segments (primary + replicas). This mirrors the UI's\n * `getBreakpointLabel` which produces dynamic letters (L/M/S/XL/XS) based\n * on the total count.\n */\nfunction labelForSegmentIndex(segmentIndex: number, totalSegments: number): BreakpointLabel | undefined {\n\tif (segmentIndex === 0) return defaultBreakpointLabel\n\treturn uiLabelToAgentLabel[getBreakpointLabel(segmentIndex, totalSegments)]\n}\n\nexport function replicaLabelsForCount(replicaCount: number): BreakpointLabel[] {\n\tconst totalSegments = replicaCount + 1\n\tconst labels: BreakpointLabel[] = []\n\tfor (let i = 1; i < totalSegments; i++) {\n\t\tconst label = labelForSegmentIndex(i, totalSegments)\n\t\tif (label) labels.push(label)\n\t}\n\n\treturn labels\n}\n\n/**\n * Returns the replica index for a non-default label given the current\n * replica count. The mapping is dynamic: e.g. `medium` resolves to index 0\n * when there are 1\u20133 replicas, but index 1 when there are 4.\n */\nexport function replicaIndexForLabel(label: ReplicaBreakpointLabel, totalReplicas: number): number | undefined {\n\tconst totalSegments = totalReplicas + 1\n\tfor (let i = 1; i < totalSegments; i++) {\n\t\tif (labelForSegmentIndex(i, totalSegments) === label) return i - 1\n\t}\n\treturn undefined\n}\n\n/**\n * Resolves an agent label to the corresponding TextStylePresetNode.\n * Returns the primary node for \"default\", or the positional replica for\n * other labels based on the current breakpoint count.\n */\nexport function resolveBreakpointLabel(\n\tlabel: BreakpointLabel,\n\tprimary: TextStylePresetNode,\n\tbreakpoints: TextStylePresetNode[],\n): TextStylePresetNode | undefined {\n\tif (label === defaultBreakpointLabel) return primary\n\tconst index = replicaIndexForLabel(label, breakpoints.length)\n\tif (index === undefined) return undefined\n\treturn breakpoints[index]\n}\n\n/**\n * Returns breakpoint replicas for a primary preset, sorted by descending breakpointWidth.\n * Returns an empty array if the preset is a replica or the PresetsListNode is missing.\n */\nexport function getBreakpointsForPreset(tree: CanvasTree, preset: TextStylePresetNode): TextStylePresetNode[] {\n\tif (!isTextStylePresetPrimaryNode(preset)) return []\n\tif (!PresetsListNode.get(tree)) return []\n\treturn getTextStylePresetBreakpointsFromTree(tree, preset)\n}\n\nexport const breakpointEligibleProperties = [\n\t\"fontSize\",\n\t\"letterSpacing\",\n\t\"lineHeight\",\n\t\"paragraphSpacing\",\n] as const satisfies (keyof TextStylePresetNode)[]\n\nexport const breakpointSlotProperties = [\"minWidth\", ...breakpointEligibleProperties] as const\n\nexport type BreakpointSlot = Partial<Record<(typeof breakpointSlotProperties)[number], string>>\n\n/**\n * Serializes all breakpoint slots for a preset.\n */\nexport function serializeAllBreakpointSlots(\n\tpreset: TextStylePresetNode,\n\tbreakpoints: TextStylePresetNode[],\n): Record<string, BreakpointSlot> {\n\tconst result: Record<string, BreakpointSlot> = {}\n\tconst totalSegments = breakpoints.length + 1\n\n\tresult[defaultBreakpointLabel] = serializeBreakpointSlot(preset, breakpoints[0]?.breakpointWidth ?? 0)\n\n\tfor (let i = 0; i < breakpoints.length; i++) {\n\t\tconst label = labelForSegmentIndex(i + 1, totalSegments)\n\t\tif (!label) break\n\n\t\tconst replica = breakpoints[i]\n\t\tif (!replica) break\n\n\t\tresult[label] = serializeBreakpointSlot(replica, breakpoints[i + 1]?.breakpointWidth ?? 0)\n\t}\n\n\treturn result\n}\n\nfunction serializeBreakpointSlot(node: TextStylePresetNode, minWidth: number): BreakpointSlot {\n\tconst slot: BreakpointSlot = { minWidth: createCSSDimension(Math.round(minWidth), \"px\") }\n\n\tconst { fontSize } = node\n\tif (isFontSizeCSSDimension(fontSize)) {\n\t\tslot.fontSize = fontSize\n\t} else if (isNumber(fontSize)) {\n\t\tslot.fontSize = createCSSDimension(fontSize, \"px\")\n\t}\n\n\tconst { letterSpacing } = node\n\tif (isNumber(letterSpacing)) {\n\t\tslot.letterSpacing = createCSSDimension(letterSpacing, \"px\")\n\t} else if (isCSSDimension(letterSpacing)) {\n\t\tslot.letterSpacing = letterSpacing\n\t} else if (Array.isArray(letterSpacing)) {\n\t\tconst [value, unit] = letterSpacing\n\t\tslot.letterSpacing = createCSSDimension(value, unit)\n\t}\n\n\tconst { lineHeight } = node\n\tif (Array.isArray(lineHeight)) {\n\t\tconst [value, unit] = lineHeight\n\t\tslot.lineHeight = createCSSDimension(value, unit)\n\t}\n\n\tif (node.paragraphSpacing !== undefined) {\n\t\tslot.paragraphSpacing = String(Math.round(node.paragraphSpacing))\n\t}\n\n\treturn slot\n}\n", "export const CHANGES_QUERY = \"review-changes\" as const\nexport const SCREENSHOT_QUERY = \"screenshot\" as const\n// This is used by #proj-local-agents. If changing this query, please give #proj-local-agents a heads-up\nexport const COMPONENT_DEFINITION_QUERY = \"component-definition\" as const\nexport const FONT_SEARCH_QUERY = \"font-search\" as const\nexport const ICON_SET_DEFINITION_QUERY = \"icon-set-definition\" as const\nexport const IMPLEMENTATION_GUIDE_FROM_INDEX_QUERY = \"implementation-guide-from-index\" as const\nexport const SHADER_DEFINITION_QUERY = \"shader-definition\" as const\n", "import { join } from \"utils/join.ts\"\n\nexport const ticks = \"```\"\nexport function createBlock<T extends string>(type: T, value: string): string {\n\treturn join.lines(ticks + type, value, ticks)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { join } from \"utils/join.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport {\n\ttype CollectionReferenceVariableAliasNodeClass,\n\ttype Command,\n\tCommandType,\n\ttype DateVariableAliasNodeClass,\n\ttype OptionVariableAliasNodeClass,\n\ttype EventHandlerVariableAliasNodeClass,\n\ttype GalleryVariableAliasNodeClass,\n\ttype IconVariableAliasNodeClass,\n\ttype LinkVariableAliasNodeClass,\n\ttype SupportedDSLNodeClass,\n\ttype VariableNodeClass,\n\ttype FileVariableAliasNodeClass,\n} from \"../dsl.ts\"\nimport { createBlock } from \"../fencedBlock.ts\"\nimport type { TraitKey } from \"../traits/attributes.ts\"\nimport type { VirtualTraitKey } from \"../traits/virtualAttributes.ts\"\n\ntype MaxDepth = [never, 0, 1, 2, 3]\ntype WithArray<T, K extends Extract<keyof T, string>> = NonNullable<T[K]> extends readonly unknown[] ? `${K}[]` | K : K\ntype ToPaths<T, D extends number = 4> = [D] extends [0]\n\t? never\n\t: T extends readonly unknown[]\n\t\t? never\n\t\t: T extends object\n\t\t\t? {\n\t\t\t\t\t[K in Extract<keyof T, string>]: WithArray<T, K> | `${WithArray<T, K>}.${ToPaths<T[K], MaxDepth[D]>}`\n\t\t\t\t}[Extract<keyof T, string>]\n\t\t\t: never\n\nexport function escapeValue<TLiteral extends string>(value: TLiteral): string\nexport function escapeValue<TObject extends object = Record<string, unknown>>(value: ToPaths<TObject>): string\nexport function escapeValue(value: string): string\nexport function escapeValue(value: string) {\n\treturn \"`\" + value + \"`\"\n}\n\nexport function escapeBlock(value: string) {\n\treturn \"```\\n\" + value + \"\\n```\"\n}\n\nexport function referenceScript(source: string, functionName: string): string {\n\tconst lines = source.split(\"\\n\")\n\tconst functionStart = lines.findIndex(\n\t\tline =>\n\t\t\tline.startsWith(`export async function ${functionName}() {`) ||\n\t\t\tline.startsWith(`async function ${functionName}() {`),\n\t)\n\tassert(functionStart !== -1, `Could not find script function '${functionName}'.`)\n\n\tconst functionEnd = lines.findIndex((line, index) => index > functionStart && line === \"}\")\n\tassert(functionEnd !== -1, `Could not find script function body for '${functionName}'.`)\n\n\treturn createBlock(\"javascript\", dedentScriptBody(lines.slice(functionStart + 1, functionEnd)))\n}\n\nfunction dedentScriptBody(lines: string[]): string {\n\tconst nonEmptyLines = lines.filter(line => line.trim().length > 0)\n\tconst indentation = Math.min(\n\t\t...nonEmptyLines.map(line => {\n\t\t\treturn line.length - line.trimStart().length\n\t\t}),\n\t)\n\treturn lines\n\t\t.map(line => line.slice(indentation))\n\t\t.join(\"\\n\")\n\t\t.trim()\n}\n\n/**\n * Type-safe helper to reference trait attribute keys in the system prompt.\n * Returns the escaped key name for use in prompt text.\n *\n * @example\n * traits(\"fill\") // returns \"`fill`\"\n * traits(\"gap\") // returns \"`gap`\"\n * traits(\"collectionList.collection\") // returns \"`collectionList.collection`\"\n */\nexport function traitReference(key: TraitKey | VirtualTraitKey | `${TraitKey}.${string}`): string {\n\treturn escapeValue(key)\n}\n\nexport function keyValueReference(key: string, value: string) {\n\treturn escapeValue(`${key}=\"${value}\"`)\n}\n\nexport function traitValueReference(key: TraitKey, value: string) {\n\treturn keyValueReference(key, value)\n}\n\ntype AddCommandReferenceNodeType =\n\t| SupportedDSLNodeClass\n\t| typeof VariableNodeClass\n\t| typeof CollectionReferenceVariableAliasNodeClass\n\t| typeof DateVariableAliasNodeClass\n\t| typeof OptionVariableAliasNodeClass\n\t| typeof EventHandlerVariableAliasNodeClass\n\t| typeof IconVariableAliasNodeClass\n\t| typeof GalleryVariableAliasNodeClass\n\t| typeof LinkVariableAliasNodeClass\n\t| typeof FileVariableAliasNodeClass\n\t| \"<node>\"\n\nexport function commandReference(\n\tcommand:\n\t\t| CommandType.Move\n\t\t| CommandType.Update\n\t\t| CommandType.Remove\n\t\t| CommandType.Duplicate\n\t\t| CommandType.CreateVariant,\n): string\nexport function commandReference(command: CommandType.Add, nodeType: AddCommandReferenceNodeType): string\nexport function commandReference(command: CommandType, nodeType?: AddCommandReferenceNodeType): string {\n\tif (command === CommandType.Add) {\n\t\treturn escapeValue(`${command}${nodeType}`)\n\t}\n\treturn escapeValue(command)\n}\n\nexport function attributeReference<T extends CommandType>(\n\tattribute: keyof Extract<Command, { type: T }>[\"attributes\"],\n) {\n\tassert(isString(attribute), \"Attribute must be a string\")\n\treturn escapeValue(attribute)\n}\n\nexport type NestedStringArray = (string | NestedStringArray)[]\n\nexport function formatNestedArray(array: NestedStringArray, depth: number = 0): string {\n\tconst indent = \"  \".repeat(depth)\n\n\treturn array\n\t\t.map((item, index) => {\n\t\t\tconst prefix = depth === 0 ? `${index + 1}. ` : \"- \"\n\n\t\t\tif (isString(item)) {\n\t\t\t\treturn `${indent}${prefix}${item}`\n\t\t\t}\n\n\t\t\t// It's an array - check if all elements are strings\n\t\t\tconst allStrings = item.every(e => isString(e))\n\n\t\t\tif (allStrings) {\n\t\t\t\t// Expand all strings into bullets at current depth\n\t\t\t\treturn item.map(text => `${indent}- ${text}`).join(\"\\n\")\n\t\t\t}\n\n\t\t\t// Mixed: first element is text, rest are children\n\t\t\tconst [text, ...children] = item\n\n\t\t\tif (!isString(text)) {\n\t\t\t\t// Edge case: first element is also an array\n\t\t\t\treturn formatNestedArray(item, depth + 1)\n\t\t\t}\n\n\t\t\tconst textLine = `${indent}${prefix}${text}`\n\n\t\t\tif (children.length === 0) {\n\t\t\t\treturn textLine\n\t\t\t}\n\n\t\t\tconst childContent = formatNestedArray(children, depth + 1)\n\t\t\treturn join.lines(textLine, childContent)\n\t\t})\n\t\t.join(\"\\n\")\n}\n", "/**\n * NOTE: The interfaces in this file will be aligned with\n * src/app/vekter/src/document/models/richText/RichTextDocument.ts\n *\n * Currently the Agent* prefix is because the shapes are slightly different because the Agent Layer\n * does not support certain node types and it supports things like inline styles. Once aligned - the\n * agent prefix should be removed\n *\n * When adding new block types or attributes, try to be aligned as closely as possible to\n * RichTextDocument.ts in order To make the migration to JSON backed rich text model easier in the\n * future.\n */\n\nimport { assert, assertNever, type ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { richTextTagDefaults } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport type { Gradient } from \"document/models/Gradient.ts\"\nimport type { RawControlProps } from \"document/models/controlProps/RawControlProp.ts\"\nimport type {\n\tRichTextModuleAlignment,\n\tRichTextModuleWidth,\n\tRichTextTableCellType,\n} from \"document/models/richText/RichTextDocument.ts\"\nimport type { Node } from \"prosemirror-model\"\nimport {\n\ttype FramerProseMirrorSchema,\n\tschemaSupportsBlockquotes,\n\tschemaSupportsEmbeds,\n\tschemaSupportsLinks,\n\tschemaSupportsMedia,\n\tschemaSupportsStyles,\n\tschemaSupportsTables,\n} from \"prosemirror/schema/index.ts\"\nimport type { LinkAttrs } from \"prosemirror/schema/link.ts\"\nimport { BlockStyles, type BackgroundStyles, type InlineStyles } from \"prosemirror/styles.ts\"\nimport type { Mutable } from \"utils/Mutable.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport type { InsertableVirtualNodeClass } from \"../../dsl.ts\"\nimport {\n\tTextBlockClass,\n\tTextBlockquoteClass,\n\tTextBulletListClass,\n\tTextComponentInstanceClass,\n\tTextLineBreakClass,\n\tTextListItemClass,\n\tTextMediaBlockClass,\n\tTextNumberedListClass,\n\tTextRunClass,\n\tTextTableCellClass,\n\tTextTableClass,\n\tTextTableRowClass,\n\tTextUnsupportedBlockClass,\n} from \"../../dsl.ts\"\nimport type { RichTextTagAttributes } from \"../../traits/textTag.ts\"\n\nconst richTextTextBlockType = \"textBlock\" as const\nconst richTextBlockquoteType = \"blockquote\" as const\nconst richTextTableType = \"table\" as const\nconst richTextTableRowType = \"tableRow\" as const\nconst richTextTableCellType = \"tableCell\" as const\nconst richTextTextRunType = \"textRun\" as const\nconst richTextLineBreakType = \"lineBreak\" as const\nconst richTextBulletListType = \"bulletList\" as const\nconst richTextNumberedListType = \"numberedList\" as const\nconst richTextListItemType = \"listItem\" as const\nconst richTextMediaBlockType = \"mediaBlock\" as const\nconst richTextTextComponentInstanceType = \"componentInstance\" as const\nconst richTextUnsupportedType = \"unsupported\" as const\nconst richTextDocumentType = \"richText\" as const\nconst virtualNodeIdPrefix = \"v:\" as const\nexport const virtualRichTextComponentInstanceAliasPrefix = \"__virtualEmbed\" as const\n\nexport function getVirtualRichTextDSLNodeClass(\n\ttype: VirtualRichTextNode[\"type\"],\n): InsertableVirtualNodeClass | typeof TextUnsupportedBlockClass {\n\tswitch (type) {\n\t\tcase \"blockquote\":\n\t\t\treturn TextBlockquoteClass\n\t\tcase \"bulletList\":\n\t\t\treturn TextBulletListClass\n\t\tcase \"componentInstance\":\n\t\t\treturn TextComponentInstanceClass\n\t\tcase \"numberedList\":\n\t\t\treturn TextNumberedListClass\n\t\tcase \"lineBreak\":\n\t\t\treturn TextLineBreakClass\n\t\tcase \"listItem\":\n\t\t\treturn TextListItemClass\n\t\tcase \"mediaBlock\":\n\t\t\treturn TextMediaBlockClass\n\t\tcase \"table\":\n\t\t\treturn TextTableClass\n\t\tcase \"tableCell\":\n\t\t\treturn TextTableCellClass\n\t\tcase \"tableRow\":\n\t\t\treturn TextTableRowClass\n\t\tcase \"textBlock\":\n\t\t\treturn TextBlockClass\n\t\tcase \"textRun\":\n\t\t\treturn TextRunClass\n\t\tcase \"unsupported\":\n\t\t\treturn TextUnsupportedBlockClass\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\n/**\n * Identifies the target of a virtual text document.\n * - Plain `NodeID` -> RichTextNode (backwards compatible)\n * - `${NodeID}/${controlKey}` -> RichText control prop on a CodeComponentNode or CollectionItemNode\n */\nexport type RichTextTarget = NodeID | `${NodeID}/${string}`\nexport type VirtualTextDestination = RichTextTarget | VirtualRichTextNode\n\n/**\n * Abstracts how HTML is read from a rich text target.\n * Handles are short-lived and not reused. They may close over values during creation.\n * Therefore - they should not be reused or cached.\n */\nexport interface RichTextReaderHandle {\n\treadonly target: RichTextTarget\n\treadonly capabilities: VirtualTextCapabilities\n\treadonly schema: FramerProseMirrorSchema\n\t/** Target-level inline code preset used when serializing newly emitted inlineCode marks. */\n\treadonly inlineCodeStylePreset?: string\n\treadHTML: () => string | undefined\n}\n\n/**\n * Abstracts how HTML is read from and written to a rich text target.\n * Used when changes may later be applied back to the document tree.\n */\nexport interface RichTextTargetHandle extends RichTextReaderHandle {\n\treadonly nodeId: NodeID\n\treadonly ownerTarget?: RichTextTarget\n\twriteHTML: (nextHTML: string) => void\n}\n\nexport interface WithVirtualTextStyles {\n\tinlineStyles: Partial<Mutable<InlineStyles>>\n\tbackgroundStyles: Partial<Mutable<BackgroundStyles>>\n\tfontName: string | undefined\n\tfontWeight: number | undefined\n\tfontStyle: \"normal\" | \"italic\" | undefined\n}\n\ninterface WithVirtualRichTextTag {\n\ttag: RichTextTagAttributes[\"tag\"]\n}\n\nexport interface WithVirtualTextBlockStyles {\n\tblockStyles: Partial<Mutable<BlockStyles>>\n\ttextStylePreset?: string\n}\n\ninterface WithVirtualRichTextText {\n\ttext: string\n}\n\nexport interface WithVirtualRichTextLinkAttrs {\n\tlinkAttrs: LinkAttrs | undefined\n}\n\ninterface WithVirtualRichTextNumbering {\n\tlistStyleType: string\n\tstart: number\n}\n\nexport interface WithVirtualTextBackgroundMask {\n\tbackgroundMask: Gradient | null | undefined\n}\n\nexport interface RichTextDocument\n\textends\n\t\tWithVirtualTextBlockStyles,\n\t\tWithVirtualTextStyles,\n\t\tWithVirtualTextBackgroundMask,\n\t\tPartial<WithVirtualRichTextTag>,\n\t\tWithVirtualRichTextLinkAttrs {\n\treadonly type: typeof richTextDocumentType\n\tchildren: VirtualRichTextRoot[]\n}\n\nexport interface VirtualRichTextTextRun\n\textends WithVirtualTextStyles, WithVirtualRichTextText, WithVirtualRichTextLinkAttrs {\n\treadonly type: typeof richTextTextRunType\n\tid: string\n\tbold?: true\n\titalic?: true\n\tinlineCode?: true\n\tinlineCodeStylePreset?: string\n}\n\nexport interface VirtualRichTextLineBreak {\n\treadonly type: typeof richTextLineBreakType\n\tid: string\n}\n\nexport interface VirtualRichTextTextBlock\n\textends WithVirtualTextBlockStyles, WithVirtualTextStyles, WithVirtualRichTextTag {\n\treadonly type: typeof richTextTextBlockType\n\tid: string\n\ttag: RichTextTagAttributes[\"tag\"]\n\tchildren: VirtualRichTextInline[]\n}\n\nexport interface VirtualRichTextBlockquote {\n\treadonly type: typeof richTextBlockquoteType\n\tid: string\n\tchildren: VirtualRichTextRoot[]\n}\n\nexport interface VirtualRichTextTable {\n\treadonly type: typeof richTextTableType\n\tid: string\n\tchildren: VirtualRichTextTableRow[]\n}\n\nexport interface VirtualRichTextTableRow {\n\treadonly type: typeof richTextTableRowType\n\tid: string\n\tchildren: VirtualRichTextTableCell[]\n}\n\nexport interface VirtualRichTextTableCellPreservedAttrs {\n\tcolspan?: number\n\trowspan?: number\n\tcolwidth?: readonly number[] | null\n}\n\nexport interface VirtualRichTextTableCell {\n\treadonly type: typeof richTextTableCellType\n\tid: string\n\tcellType: RichTextTableCellType\n\t/** Round-trips ProseMirror table cell metadata that the agent does not expose or edit.\n\t * Hence preserving these if a table cell that contains them is edited.\n\t */\n\tpreservedAttrs?: VirtualRichTextTableCellPreservedAttrs\n\tchildren: VirtualRichTextRoot[]\n}\n\nexport interface VirtualRichTextBulletList extends WithVirtualTextBlockStyles, WithVirtualTextStyles {\n\treadonly type: typeof richTextBulletListType\n\tid: string\n\tchildren: VirtualRichTextListItem[]\n}\n\nexport interface VirtualRichTextNumberedList\n\textends WithVirtualTextBlockStyles, WithVirtualTextStyles, WithVirtualRichTextNumbering {\n\treadonly type: typeof richTextNumberedListType\n\tid: string\n\tchildren: VirtualRichTextListItem[]\n}\n\nexport interface VirtualRichTextListItem extends WithVirtualTextBlockStyles, WithVirtualTextStyles {\n\treadonly type: typeof richTextListItemType\n\tid: string\n\tchildren: VirtualRichTextRoot[]\n}\n\nexport interface VirtualRichTextMediaBlock {\n\treadonly type: typeof richTextMediaBlockType\n\tid: string\n\tsrc: string\n\talt?: string\n\tpixelWidth?: number\n\tpixelHeight?: number\n\tmediaType: \"image\" | \"video\"\n\tlinkAttrs: Partial<Omit<LinkAttrs, \"linkStylePreset\">> | undefined\n}\n\nexport interface VirtualRichTextTextComponentInstance {\n\treadonly type: typeof richTextTextComponentInstanceType\n\tid: string\n\tidentifier: ModuleExportIdentifierString\n\tprops: RawControlProps\n\twidth: RichTextModuleWidth\n\talignment: RichTextModuleAlignment\n}\n\n/**\n * FIXME: This document model is a JSON tree serializer for the ProseMirror document.\n * It is intended to be a stop-gap solution until the CMS and RichTextNode is fully JSON backed.\n *\n * Instead of adding new Virtual Block types or adding new ProseMirror parsing logic,\n * consider switching over to the JSON backed RichTextDocument and RichTextStorageDocument.\n *\n * see: src/app/vekter/src/document/models/richText/RichTextDocument.ts\n * and: src/app/vekter/src/document/models/richText/richTextStorageDocument.ts\n */\nexport interface VirtualRichTextUnsupported {\n\treadonly type: typeof richTextUnsupportedType\n\tid: string\n\tnodeType: string\n\treason?: string\n\tnodeJson: ReturnType<Node[\"toJSON\"]>\n}\n\nexport type VirtualRichTextInline = VirtualRichTextTextRun | VirtualRichTextLineBreak\n\nexport type VirtualRichTextList = VirtualRichTextBulletList | VirtualRichTextNumberedList\n\nexport type VirtualRichTextRoot =\n\t| VirtualRichTextTextBlock\n\t| VirtualRichTextBlockquote\n\t| VirtualRichTextTable\n\t| VirtualRichTextList\n\t| VirtualRichTextMediaBlock\n\t| VirtualRichTextTextComponentInstance\n\t| VirtualRichTextUnsupported\n\nexport type VirtualRichTextNode =\n\t| VirtualRichTextRoot\n\t| VirtualRichTextTableRow\n\t| VirtualRichTextTableCell\n\t| VirtualRichTextListItem\n\t| VirtualRichTextTextRun\n\t| VirtualRichTextLineBreak\n\nexport type VirtualNodeId = `v:${RichTextTarget}:${string}`\n\ninterface ParsedVirtualNodeId {\n\trichTextTarget: RichTextTarget\n\tlocalId: string\n}\n\nconst exampleVirtualNodeId = \"v:target:0:1 or v:nodeId/controlKey:0:1\"\nconst richTextTypeKey = \"type\" satisfies keyof VirtualRichTextNode\nconst richTextDocumentTypeKey = \"type\" satisfies keyof RichTextDocument\nconst virtualTextStylesKey = \"inlineStyles\" satisfies keyof WithVirtualTextStyles\nconst virtualTextBlockStylesKey = \"blockStyles\" satisfies keyof WithVirtualTextBlockStyles\nconst virtualTextBackgroundMaskKey = \"backgroundMask\" satisfies keyof WithVirtualTextBackgroundMask\nconst linkAttrsKey = \"linkAttrs\" satisfies keyof WithVirtualRichTextLinkAttrs\n\nexport function createVirtualNodeId(\n\trichTextTarget: RichTextTarget,\n\t...localId: readonly (string | number)[]\n): VirtualNodeId {\n\tassert(localId.length > 0, `Virtual text ID requires a local id segment. Must match: ${exampleVirtualNodeId}`)\n\n\treturn `${virtualNodeIdPrefix}${richTextTarget}:${localId.map(String).join(\":\")}` as const\n}\n\nexport function isVirtualNodeId(id: string): id is VirtualNodeId {\n\t// This check is deliberately not strict. It checks the LLMs intention with an ID.\n\treturn id.startsWith(virtualNodeIdPrefix)\n}\n\n/**\n * Parses a virtual node ID into its components.\n *\n * Formats:\n * - `v:nodeId:<local-id>` -> RichTextNode virtual node\n * - `v:nodeId/controlKey:<local-id>` -> control prop virtual node\n */\nexport function parseVirtualNodeId(id: VirtualNodeId): ParsedVirtualNodeId {\n\tassert(isVirtualNodeId(id), `Virtual text ID (${id}) is malformed. Must match: ${exampleVirtualNodeId}`)\n\n\tconst payload = id.slice(virtualNodeIdPrefix.length)\n\tconst separatorIndex = payload.indexOf(\":\")\n\n\tassert(separatorIndex > 0, `Virtual text ID (${id}) is malformed. Must match: ${exampleVirtualNodeId}`)\n\n\tconst richTextTarget = payload.slice(0, separatorIndex)\n\tconst localId = payload.slice(separatorIndex + 1)\n\tassert(\n\t\tisString(richTextTarget) && richTextTarget.length > 0 && localId.length > 0,\n\t\t`Virtual text ID (${id}) is malformed. Must match: ${exampleVirtualNodeId}`,\n\t)\n\n\treturn { richTextTarget, localId }\n}\n\nfunction isVirtualRichTextNodeType<T extends VirtualRichTextNode>(node: unknown, type: T[\"type\"]): node is T {\n\tif (!isObject(node)) return false\n\tif (!(richTextTypeKey in node)) return false\n\treturn node.type === type\n}\n\nexport function isRichTextDocument(node: unknown): node is RichTextDocument {\n\tif (!isObject(node)) return false\n\tif (!(richTextDocumentTypeKey in node)) return false\n\treturn node.type === richTextDocumentType\n}\n\nexport function isVirtualRichTextTextBlock(node: unknown): node is VirtualRichTextTextBlock {\n\treturn isVirtualRichTextNodeType(node, \"textBlock\")\n}\n\nexport function isVirtualRichTextBlockquote(node: unknown): node is VirtualRichTextBlockquote {\n\treturn isVirtualRichTextNodeType(node, \"blockquote\")\n}\n\nexport function isVirtualRichTextTable(node: unknown): node is VirtualRichTextTable {\n\treturn isVirtualRichTextNodeType(node, \"table\")\n}\n\nexport function isVirtualRichTextTableRow(node: unknown): node is VirtualRichTextTableRow {\n\treturn isVirtualRichTextNodeType(node, \"tableRow\")\n}\n\nexport function isVirtualRichTextTableCell(node: unknown): node is VirtualRichTextTableCell {\n\treturn isVirtualRichTextNodeType(node, \"tableCell\")\n}\n\nexport function isVirtualRichTextBulletList(node: unknown): node is VirtualRichTextBulletList {\n\treturn isVirtualRichTextNodeType(node, \"bulletList\")\n}\n\nexport function isVirtualRichTextNumberedList(node: unknown): node is VirtualRichTextNumberedList {\n\treturn isVirtualRichTextNodeType(node, \"numberedList\")\n}\n\nexport function isVirtualRichTextListItem(node: unknown): node is VirtualRichTextListItem {\n\treturn isVirtualRichTextNodeType(node, \"listItem\")\n}\n\nexport function isVirtualRichTextUnsupported(node: unknown): node is VirtualRichTextUnsupported {\n\treturn isVirtualRichTextNodeType(node, \"unsupported\")\n}\n\nexport function isVirtualRichTextMediaBlock(node: unknown): node is VirtualRichTextMediaBlock {\n\treturn isVirtualRichTextNodeType(node, \"mediaBlock\")\n}\n\nexport function isVirtualRichTextTextComponentInstance(node: unknown): node is VirtualRichTextTextComponentInstance {\n\treturn isVirtualRichTextNodeType(node, \"componentInstance\")\n}\n\nexport function isVirtualRichTextTextRun(node: unknown): node is VirtualRichTextTextRun {\n\treturn isVirtualRichTextNodeType(node, \"textRun\")\n}\n\nexport function isVirtualRichTextLineBreak(node: unknown): node is VirtualRichTextLineBreak {\n\treturn isVirtualRichTextNodeType(node, \"lineBreak\")\n}\n\nexport function isVirtualRichTextNode(node: unknown): node is VirtualRichTextNode {\n\treturn (\n\t\tisVirtualRichTextTextBlock(node) ||\n\t\tisVirtualRichTextBlockquote(node) ||\n\t\tisVirtualRichTextTable(node) ||\n\t\tisVirtualRichTextTableRow(node) ||\n\t\tisVirtualRichTextTableCell(node) ||\n\t\tisVirtualRichTextBulletList(node) ||\n\t\tisVirtualRichTextNumberedList(node) ||\n\t\tisVirtualRichTextListItem(node) ||\n\t\tisVirtualRichTextUnsupported(node) ||\n\t\tisVirtualRichTextTextRun(node) ||\n\t\tisVirtualRichTextLineBreak(node) ||\n\t\tisVirtualRichTextMediaBlock(node) ||\n\t\tisVirtualRichTextTextComponentInstance(node)\n\t)\n}\n\nexport function withVirtualTextStyles<T>(node: T): node is Extract<T, WithVirtualTextStyles> {\n\treturn isObject(node) && virtualTextStylesKey in node\n}\n\nexport function withVirtualTextBlockStyles<T>(node: T): node is T & WithVirtualTextBlockStyles {\n\treturn isObject(node) && virtualTextBlockStylesKey in node\n}\n\nexport function withVirtualTextBackgroundMask<T>(node: T): node is T & WithVirtualTextBackgroundMask {\n\treturn isObject(node) && virtualTextBackgroundMaskKey in node\n}\n\nexport function withVirtualTextLinkAttrs<T>(node: T): node is T & WithVirtualRichTextLinkAttrs {\n\treturn isObject(node) && linkAttrsKey in node\n}\n\nexport interface VirtualTextCapabilities {\n\t/** Whether blockquotes are supported by this target's schema. */\n\tblockquotes: boolean\n\t/** Whether tables are supported by this target's schema. */\n\ttables: boolean\n\t/** Whether inline styles (color, font, background etc.) are supported by this target's schema. */\n\tinlineStyles: boolean\n\t/** Whether the target's schema supports link marks on text runs. */\n\tlinks: boolean\n\t/** Whether media blocks are supported by this target's schema. */\n\tmedia: boolean\n\t/** Whether embedded component instances are supported by this target's schema. */\n\tembeds: boolean\n}\n\nexport function createVirtualTextCapabilities(schema: FramerProseMirrorSchema): VirtualTextCapabilities {\n\treturn {\n\t\tblockquotes: schemaSupportsBlockquotes(schema),\n\t\ttables: schemaSupportsTables(schema),\n\t\tembeds: schemaSupportsEmbeds(schema),\n\t\tinlineStyles: schemaSupportsStyles(schema),\n\t\tmedia: schemaSupportsMedia(schema),\n\t\tlinks: schemaSupportsLinks(schema),\n\t}\n}\n\nexport function createRichTextDocument(children: VirtualRichTextRoot[] = []): RichTextDocument {\n\treturn {\n\t\ttype: richTextDocumentType,\n\t\tchildren,\n\t\tinlineStyles: {},\n\t\tbackgroundStyles: {},\n\t\t// Block-style defaults live on the root by construction. Hoisting will overwrite them when\n\t\t// children agree on a non-default value, or clear them when children disagree \u2014 so absence\n\t\t// at the root means \"look at the children\". We don't do the same for inline/background\n\t\t// because the churn (materialized defaults on every no-override descendant in mixed docs)\n\t\t// outweighs the value to the agent \u2014 master never surfaced those on the root either.\n\t\tblockStyles: { ...BlockStyles.defaults },\n\t\ttextStylePreset: undefined,\n\t\ttag: undefined,\n\t\tfontName: undefined,\n\t\tfontWeight: undefined,\n\t\tfontStyle: undefined,\n\t\tbackgroundMask: undefined,\n\t\tlinkAttrs: undefined,\n\t}\n}\n\nexport function createRichTextTextBlock(\n\tid: string,\n\ttag: RichTextTagAttributes[\"tag\"] = richTextTagDefaults.tag,\n): VirtualRichTextTextBlock {\n\treturn {\n\t\ttype: richTextTextBlockType,\n\t\tid,\n\t\ttag,\n\t\tinlineStyles: {},\n\t\tbackgroundStyles: {},\n\t\tblockStyles: {},\n\t\ttextStylePreset: undefined,\n\t\tchildren: [],\n\t\tfontName: undefined,\n\t\tfontWeight: undefined,\n\t\tfontStyle: undefined,\n\t}\n}\n\nexport function createRichTextBlockquote(id: string): VirtualRichTextBlockquote {\n\treturn {\n\t\ttype: richTextBlockquoteType,\n\t\tid,\n\t\tchildren: [],\n\t}\n}\n\nexport function createRichTextTable(id: string): VirtualRichTextTable {\n\treturn {\n\t\ttype: richTextTableType,\n\t\tid,\n\t\tchildren: [],\n\t}\n}\n\nexport function createRichTextTableRow(id: string): VirtualRichTextTableRow {\n\treturn {\n\t\ttype: richTextTableRowType,\n\t\tid,\n\t\tchildren: [],\n\t}\n}\n\nexport function createRichTextTableCell(\n\tid: string,\n\tcellType: VirtualRichTextTableCell[\"cellType\"],\n): VirtualRichTextTableCell {\n\treturn {\n\t\ttype: richTextTableCellType,\n\t\tid,\n\t\tcellType,\n\t\tchildren: [],\n\t}\n}\n\nexport function createRichTextBulletList(id: string): VirtualRichTextBulletList {\n\treturn {\n\t\ttype: richTextBulletListType,\n\t\tid,\n\t\tinlineStyles: {},\n\t\tbackgroundStyles: {},\n\t\tblockStyles: {},\n\t\ttextStylePreset: undefined,\n\t\tchildren: [],\n\t\tfontName: undefined,\n\t\tfontWeight: undefined,\n\t\tfontStyle: undefined,\n\t}\n}\n\nexport function createRichTextNumberedList(id: string): VirtualRichTextNumberedList {\n\treturn {\n\t\ttype: richTextNumberedListType,\n\t\tid,\n\t\tinlineStyles: {},\n\t\tbackgroundStyles: {},\n\t\tblockStyles: {},\n\t\ttextStylePreset: undefined,\n\t\tchildren: [],\n\t\tfontName: undefined,\n\t\tfontWeight: undefined,\n\t\tfontStyle: undefined,\n\t\tlistStyleType: \"decimal\",\n\t\tstart: 1,\n\t}\n}\n\nexport function createRichTextListItem(id: string): VirtualRichTextListItem {\n\treturn {\n\t\ttype: richTextListItemType,\n\t\tid,\n\t\tinlineStyles: {},\n\t\tbackgroundStyles: {},\n\t\tblockStyles: {},\n\t\ttextStylePreset: undefined,\n\t\tchildren: [],\n\t\tfontName: undefined,\n\t\tfontWeight: undefined,\n\t\tfontStyle: undefined,\n\t}\n}\n\nexport function createRichTextUnsupported(\n\tid: string,\n\tnodeType: string,\n\tnodeJson: ReturnType<Node[\"toJSON\"]>,\n\treason?: string,\n): VirtualRichTextUnsupported {\n\treturn {\n\t\ttype: richTextUnsupportedType,\n\t\tid,\n\t\tnodeType,\n\t\treason,\n\t\tnodeJson,\n\t}\n}\n\nexport function createMediaBlock(id: string): VirtualRichTextMediaBlock {\n\treturn {\n\t\ttype: richTextMediaBlockType,\n\t\tid,\n\t\tsrc: \"\",\n\t\tmediaType: \"image\",\n\t\tlinkAttrs: undefined,\n\t}\n}\n\nexport function createRichTextTextComponentInstance(\n\tid: string,\n\tidentifier: ModuleExportIdentifierString,\n\tprops: RawControlProps = {},\n): VirtualRichTextTextComponentInstance {\n\treturn {\n\t\ttype: richTextTextComponentInstanceType,\n\t\tid,\n\t\tidentifier,\n\t\tprops,\n\t\twidth: \"fill\",\n\t\talignment: \"left\",\n\t}\n}\n\nexport function createRichTextTextRun(id: string): VirtualRichTextTextRun {\n\treturn {\n\t\ttype: richTextTextRunType,\n\t\tid,\n\t\ttext: \"\",\n\t\tinlineStyles: {},\n\t\tbackgroundStyles: {},\n\t\tfontName: undefined,\n\t\tfontWeight: undefined,\n\t\tfontStyle: undefined,\n\t\tlinkAttrs: undefined,\n\t}\n}\n\nexport function createRichTextLineBreak(id: string): VirtualRichTextLineBreak {\n\treturn { type: richTextLineBreakType, id }\n}\n", "import { parseModuleIdentifier } from \"@framerjs/shared\"\nimport { escapeValue } from \"app/ai/agents/prompt/utils.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { withDOMLayout } from \"document/models/CanvasTree/traits/WithDOMLayout.ts\"\nimport type { WithSizeConstraints } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { lookup } from \"mrmime\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { isVirtualRichTextTextRun, type VirtualRichTextNode } from \"../context/richtext/document.ts\"\nimport type { StylePresetType } from \"../context/stylePresetType.ts\"\nimport { breakpointLabels, breakpointSlotProperties } from \"./textStylePresetBreakpointSlots.ts\"\nimport type { TraitWarning } from \"./types.ts\"\nimport type { VirtualTraitKey } from \"./virtualAttributes.ts\"\n\nfunction formatValue(value: unknown): string {\n\tif (typeof value === \"object\" && value !== null) return JSON.stringify(value)\n\treturn String(value)\n}\n\nexport function invalidAttributeMessage(value: unknown, explanation: string): string {\n\treturn `Invalid value \"${formatValue(value)}\". ${explanation}.`\n}\n\nexport function expectedAttributeMessage(value: unknown, expected: string): string {\n\treturn invalidAttributeMessage(value, `Expected ${expected}`)\n}\n\nexport function singleWarning(key: string, attributes: unknown, expected: string): TraitWarning {\n\treturn { applied: false, key, message: expectedAttributeMessage(attributes, expected) }\n}\n\nexport function warning(key: string, attributes: unknown, expected: string): TraitWarning[] {\n\treturn [singleWarning(key, attributes, expected)]\n}\n\nexport function traitNotAppliedWarning(key: string, message: string): TraitWarning {\n\treturn { applied: false, key, message }\n}\n\nexport function unsupportedAttributeMessage(nodeType: string, options?: { didYouMean?: string }): string {\n\tlet message = `Attribute not supported in ${escapeValue(nodeType)}.`\n\tif (options?.didYouMean) {\n\t\tmessage += ` Did you mean ${options.didYouMean}?`\n\t}\n\treturn message\n}\n\nexport function invalidCodeComponentEventHandlerMessage(\n\teventKey: string,\n\tnodeId: string,\n\tvalidHandlersMessage: string,\n): string {\n\treturn `Cannot set ${escapeValue(eventKey)}: it is not a valid EventHandler event on \"${nodeId}\". ${validHandlersMessage}`\n}\n\nexport function unsupportedAttributeFormatMessage(nodeType: string, unsupportedFormat: string): string {\n\treturn `Attribute does not support *${unsupportedFormat}* in ${escapeValue(nodeType)}.`\n}\n\nexport function setToDefaultValueMessage(attributeName: string, nodeType: string, defaultValue: unknown): string {\n\treturn `${escapeValue(attributeName)} cannot be cleared on ${escapeValue(nodeType)}. It was set to the default value instead: \"${formatValue(defaultValue)}\".`\n}\n\n/** Message when the agent attaches event handlers directly to a vector set module item. */\nexport function vectorSetItemEventHandlerMessage(\n\tnodeType: string,\n\twrapperNodeType: string,\n\tattributeName: string,\n): string {\n\treturn `${escapeValue(attributeName)} cannot be set on ${escapeValue(nodeType)}. Wrap the graphic in a ${escapeValue(wrapperNodeType)} and attach the interaction to that node instead.`\n}\n\nexport function breakpointUnsupportedMessage(traitName: string): string {\n\treturn `Breakpoints do not support ${traitName}.`\n}\n\nexport function breakpointSizeConstraintsUnsupportedMessage(constraint: keyof WithSizeConstraints): string {\n\treturn `Never set ${escapeValue(constraint)} on the breakpoint node itself. Apply ${escapeValue(constraint)} to a direct child section instead.`\n}\n\nexport const expectedPercentageValue = 'a percentage like \"50%\"'\n\nexport const expectedBooleanValue = '\"true\" or \"false\"'\n\nexport const expectedNumberValue = \"a number\"\n\nexport const expectedDegreeValue = 'a degree value like \"45deg\"'\n\nexport const expectedConstraintValue = \"a number, pixel, percentage, or vh value\"\n\nexport const expectedPxValue = 'a pixel value like \"10px\"'\n\nexport const unresolvedVariableMessage = \"an existing variable, but it could not be found\"\n\nexport function variableTypeMismatchMessage(variableName: string, expectedType: string): string {\n\treturn `${expectedType} variable, but got ${escapeValue(variableName)}`\n}\n\nexport const expectedIdentifierWithoutSpaces = \"a string without spaces\"\n\nexport const expectedPositiveInteger = \"a positive integer\"\n\nexport const expectedNonNegativeInteger = \"a non-negative integer\"\n\nexport const expectedTextStylePresetReference = 'a text style preset name or id or \"null\"'\n\nexport function expectedTextStylePresetReferenceForTag(tagName: string): string {\n\treturn `a text style preset name or id for ${tagName} or \"null\"`\n}\n\nexport const richTextVariableDoesNotSupportTextStylePreset =\n\t'This text element has a rich text variable. Use per-tag presets (e.g. \"stylePresetHeading1\", \"stylePresetParagraph\") to assign different presets per block tag.'\n\nexport const richTextVariableDoesNotSupportInlineTextStyles =\n\t'This text element has a rich text variable. Inline text styles are not supported. Use per-tag presets (e.g. \"stylePresetHeading1\", \"stylePresetParagraph\") instead.'\n\nexport const perTagTextStylePresetsRequireRichTextVariable =\n\t'Per-tag text style presets only take effect when the text element has a rich text variable. Use \"textStylePreset\" to apply a text style to static text.'\n\nexport const borderStyleExplicitOverride =\n\t\"Framer uses one borderStyle for all sides. The explicit borderStyle overrides per-side values.\"\n\nexport function borderStyleConflict(style: string | undefined): string {\n\treturn `Framer uses one borderStyle for all sides. Applied \"${style}\" from the first side.`\n}\n\nexport const borderColorExplicitOverride =\n\t\"Framer uses one borderColor for all sides. The explicit borderColor overrides per-side values.\"\n\nexport function borderColorConflict(color: string | undefined): string {\n\treturn `Framer uses one borderColor for all sides. Applied \"${color}\" from the first side.`\n}\n\nexport function borderSideUnparseable(side: string, value: string): string {\n\treturn `Could not parse \"${value}\" on ${side}. Expected a pixel value like \"1px\" or a shorthand like \"1px solid red\".`\n}\n\nconst inlineStylesNotSupported = \"Inline styles are not supported on this node.\"\n\nconst fontWeightKey: VirtualTraitKey = \"fontWeight\"\nconst fontStyleKey: VirtualTraitKey = \"fontStyle\"\n\nexport function inlineStylesNotSupportedForAttribute(node: VirtualRichTextNode, key: string, value: unknown): string {\n\tif (!isVirtualRichTextTextRun(node)) return inlineStylesNotSupported\n\n\tif (key === fontWeightKey && value === \"700\") {\n\t\treturn 'Inline styles are not supported on this node. Use bold=\"true\" for semantic bold text.'\n\t}\n\n\tif (key === fontStyleKey && value === \"italic\") {\n\t\treturn 'Inline styles are not supported on this node. Use italic=\"true\" for semantic italic text.'\n\t}\n\n\treturn inlineStylesNotSupported\n}\n\nexport const inlineStyleIgnoredWhenPresetSet = \"This inline style is ignored when a text style preset is set.\"\n\nexport const imageStylePresetRequiresHtmlContentVariable =\n\t\"imageStylePreset can only be set when the RichTextNode content is bound to a RichText variable.\"\n\nexport const expectedStylePresetReference = `a preset name or \"null\"`\n\nexport function gradientNotSupportedMessage(attributeName: string, value: unknown): string {\n\treturn invalidAttributeMessage(value, `${escapeValue(attributeName)} does not support gradients`)\n}\n\nexport const gradientNotSupportedOnInlineText =\n\t\"Gradient textColor is only supported on the top-level RichTextNode. Use a solid color for TextRun and TextBlock nodes\"\n\nexport const inlineFontSizeNotSupportedWithAutoFit = `fontSize on inline text has no effect when \"auto-fit(...)\" is enabled on the parent ${escapeValue(ClassDiscriminator.RichTextNode)}. Set fontSize on the parent ${escapeValue(ClassDiscriminator.RichTextNode)} instead \u2014 this disables auto-fit and applies a fixed size.`\n\nexport const unknownBreakpointLabel = `Unknown breakpoint label. Use: ${breakpointLabels.map(label => escapeValue(label)).join(\", \")}`\n\nexport const cannotDeleteDefaultBreakpoint = \"Cannot delete the default breakpoint slot.\"\n\nexport const breakpointLabelNotAvailable = \"a valid breakpoint label for the current number of breakpoints\"\n\nexport function unsupportedBreakpointProperty(property: string): string {\n\treturn `Unsupported breakpoint property \"${property}\". Use: ${breakpointSlotProperties.map(escapeValue).join(\", \")}`\n}\n\nexport const breakpointMinWidthReadOnly =\n\t\"Cannot set a positive `minWidth` on the last/narrowest breakpoint slot. Defaulted to 0\"\n\nexport const defaultBreakpointMinWidthReadOnly =\n\t\"Cannot change `minWidth` on the default slot. It is determined by the first breakpoint replica\"\n\nexport function unsupportedValueForColorControl(key: string, value: unknown): TraitWarning {\n\treturn {\n\t\tapplied: false,\n\t\tkey,\n\t\tmessage: invalidAttributeMessage(\n\t\t\tvalue,\n\t\t\t\"`ControlType.Color` does not support gradients. Use a solid color or color style token\",\n\t\t),\n\t}\n}\n\nexport function unavailableEnumOptionMessage(value: unknown, options: readonly string[]): string {\n\treturn invalidAttributeMessage(value, `Use one of: ${options.map(escapeValue).join(\", \")}`)\n}\n\nexport function existingVariantNameOrId(target: string): string {\n\treturn `a valid variant name or id of ${escapeValue(target)}`\n}\n\nexport function untrustedUrlMessage(url: string): string {\n\treturn `URL \"${url}\" is not trusted. Use an exact URL from attachments, query_images results, traversed node context, user-provided URLs, or fetch_url results.`\n}\n\nexport function disallowedFileTypeMessage(\n\tvalue: unknown,\n\tallowedFileTypes: readonly string[],\n\tfileType: string,\n): string {\n\tconst expectedTypes =\n\t\tallowedFileTypes.length === 0\n\t\t\t? \"any file type\"\n\t\t\t: allowedFileTypes.map(type => escapeValue(lookup(type) ?? type)).join(\", \")\n\treturn invalidAttributeMessage(value, `Expected a file compatible with ${expectedTypes}, but got ${fileType}`)\n}\n\nconst supportedColorFormats =\n\t\"#rrggbb, rgb(r, g, b), rgba(r, g, b, a), hsl(h, s%, l%), hsla(h, s%, l%, a), or color(display-p3 r g b / a)\"\n\nexport function invalidColorMessage(value: string): string {\n\treturn invalidAttributeMessage(value, `Expected a valid color. Supported formats: ${supportedColorFormats}`)\n}\n\nexport function unsupportedColorFormatMessage(value: string): string {\n\treturn invalidAttributeMessage(value, `Color format is not supported. Supported formats: ${supportedColorFormats}`)\n}\n\nexport function expectedStylePresetTypeMessage(receivedType: StylePresetType, expectedType: StylePresetType): string {\n\treturn `a ${expectedType} style preset, but received a ${receivedType} style preset`\n}\n\nexport const textRunRequiresInlineCodeForPreset =\n\t\"This text run requires inlineCode=true to be set before a code style preset can be applied.\"\n\nexport function layoutTemplateOverridesMessage(attributeKey: string, layoutTemplateId: string): string {\n\treturn `${escapeValue(attributeKey)} is not supported on this breakpoint because a layout template is applied. Apply it on breakpoints in the layout template instead (${escapeValue(layoutTemplateId)}).`\n}\n\n/**\n * If the node is a breakpoint with a layout template, returns warnings for the given attribute\n * keys indicating the property should be set on the layout template instead.\n */\nexport function layoutTemplateBreakpointWarnings(node: CanvasNode, ...keys: string[]): TraitWarning[] | undefined {\n\tif (!withDOMLayout(node)) return\n\n\tconst identifier = node.usesLayoutTemplateRectForModuleIdentifierCached()\n\tif (!identifier) return\n\n\tconst layoutTemplateId = parseModuleIdentifier(identifier)?.localIdName ?? identifier\n\treturn keys.map(key => ({\n\t\tapplied: false,\n\t\tkey,\n\t\tmessage: layoutTemplateOverridesMessage(key, layoutTemplateId),\n\t}))\n}\n", "import { triggerEvent } from \"../listeners\";\nfunction createColorTokenCreateEvent(payload) {\n  console.warn(\"[DEPRECATED] Use triggerColorTokenCreateEvent instead of createColorTokenCreateEvent.\");\n  return {\n    ...payload,\n    event: \"color_token_create\"\n  };\n}\nconst meta = {\n  track: true\n};\nfunction triggerColorTokenCreateEvent(payload) {\n  const event = {\n    ...payload,\n    event: \"color_token_create\"\n  };\n  triggerEvent(event, meta);\n}\nexport {\n  createColorTokenCreateEvent,\n  triggerColorTokenCreateEvent\n};\n", "import { isModuleExportIdentifier } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport {\n\tisCodeComponentNode,\n\tisOverlayNode,\n\tisRedirectRouteNode,\n\tisSmartComponentNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isValidOverlay } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport {\n\tComponentInstanceNodeClass,\n\tComponentNodeClass,\n\tFixedOverlayNodeClass,\n\tIconNodeClass,\n\ttype NodeAliases,\n\tRedirectNodeClass,\n\tRelativeOverlayNodeClass,\n} from \"../dsl.ts\"\nimport type { AgentContext } from \"./AgentContext.ts\"\n\ntype NodeClassContext = Pick<AgentContext, \"components\" | \"treeStore\" | \"vectorSets\">\n\n/**\n * Resolves the singular DSL class for special-case canvas nodes whose user-facing DSL type differs\n * from their raw class discriminator. The tree used for overlay classification comes from\n * `ctx.treeStore.getDataTreeOrPartialTree()` (which prefers the data-tree proxy when the\n * dataOnlyTree experiment is active) \u2014 callers that need a different snapshot should use\n * `AgentContext.override(ctx, { tree })`, which intercepts both `tree` and\n * `getDataTreeOrPartialTree` on the proxied treeStore.\n */\nexport function getSpecialCaseDSLNodeClass(\n\tnode: CanvasNode,\n\tctx?: NodeClassContext,\n\tparent?: MaybeCanvasNode,\n): NodeAliases | undefined {\n\tif (isSmartComponentNode(node)) return ComponentNodeClass\n\tif (isOverlayNode(node)) return FixedOverlayNodeClass\n\tif (isRedirectRouteNode(node)) return RedirectNodeClass\n\n\tconst tree = ctx?.treeStore.getDataTreeOrPartialTree()\n\tif (tree && hasFloatingPosition(node) && isValidOverlay(node, tree)) {\n\t\treturn RelativeOverlayNodeClass\n\t}\n\n\t// Fresh floating overlays can be serialized before overlay bookkeeping exists on the current tree\n\t// snapshot. In that gap, a floating child of a plain trigger should still round-trip as a relative\n\t// overlay instead of collapsing back to FrameNode.\n\tif (\n\t\thasFloatingPosition(node) &&\n\t\tparent &&\n\t\t!isOverlayNode(parent) &&\n\t\t!hasFloatingPosition(parent) &&\n\t\t!tree?.isGroundNode(node) &&\n\t\t!tree?.getScopeNodeFor(node)\n\t) {\n\t\treturn RelativeOverlayNodeClass\n\t}\n\n\tif (!isCodeComponentNode(node)) return undefined\n\tif (node.isVectorInstance) return IconNodeClass\n\n\tif (ctx && isModuleExportIdentifier(node.codeComponentIdentifier)) {\n\t\tif (ctx.vectorSets.forInstanceIdentifier(node.codeComponentIdentifier)) return IconNodeClass\n\t}\n\n\treturn ComponentInstanceNodeClass\n}\n", "import { assert } from \"@framerjs/shared\"\nimport type { BaseEngineScheduler } from \"document/base-engine/BaseEngine.ts\"\nimport { type CanvasNode, CanvasTree, type ScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { Loaded } from \"document/models/CanvasTree/traits/WithScopeLoader.ts\"\nimport type { FormsStore } from \"document/stores/FormsStore.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { isArray, isObject, isString } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { getSpecialCaseDSLNodeClass } from \"../context/dslNodeClass.ts\"\nimport type { RichTextReaderHandle, VirtualRichTextNode } from \"../context/richtext/document.ts\"\nimport {\n\ttype AllNodeClass,\n\tComponentInstanceNodeClass,\n\tComponentNodeClass,\n\tFixedOverlayNodeClass,\n\tIconNodeClass,\n\tRedirectNodeClass,\n\ttype SupportedDSLNodeClass,\n} from \"../dsl.ts\"\n\nexport interface AttributeDefinition {\n\tdescription: string\n\texamples?: string[]\n\toptional?: true\n}\n\nexport interface AttributesDefinition {\n\t[key: string]: AttributesDefinition | AttributeDefinition | undefined\n}\n\ndeclare const roundedNumberBrand: unique symbol\nexport type RoundedNumber = number & { readonly [roundedNumberBrand]: \"RoundedNumber\" }\n\nexport type DSLAttributeValue =\n\t| string\n\t| RoundedNumber\n\t| boolean\n\t| null\n\t| DSLAttributes\n\t| DSLAttributeValue[]\n\t| readonly DSLAttributeValue[]\n\t| undefined\n\nexport interface DSLAttributes {\n\t[key: string]: DSLAttributeValue\n}\n\nconst defaultRoundDecimals = 2\n\nexport function toRoundedNumber(value: number, roundDecimals: number = defaultRoundDecimals): RoundedNumber {\n\treturn Number(value.toFixed(roundDecimals)) as RoundedNumber\n}\n\nexport interface TraitWarning {\n\tkey: string\n\tapplied: boolean\n\tmessage: string\n}\n\ninterface TraitIssues {\n\twarnings?: TraitWarning[]\n\terrors?: Error[]\n}\n\nexport type TraitAttributeDefinition<T, CustomShorthand extends string[] = []> = {\n\t[K in keyof T]: TraitAttributeDefinition<T[K], CustomShorthand> | AttributeDefinition | undefined\n} & (CustomShorthand extends [] ? object : Record<CustomShorthand[number], AttributeDefinition>)\n\ntype ReplaceNumbersWithRounded<T> = T extends number\n\t? RoundedNumber\n\t: T extends Array<infer U>\n\t\t? ReplaceNumbersWithRounded<U>[]\n\t\t: T extends object\n\t\t\t? { [K in keyof T]: ReplaceNumbersWithRounded<T[K]> }\n\t\t\t: T\n\ntype DeepPartial<T> =\n\tT extends Array<infer U> ? DeepPartial<U>[] : T extends object ? { [K in keyof T]?: DeepPartial<T[K]> } : T\n\nexport type TraitToAttributesOutput<T extends object> = DeepPartial<ReplaceNumbersWithRounded<T>>\n\nexport type TraitTargetNode = CanvasNode | VirtualRichTextNode\n\n/**\n * A trait guard function that checks if a node supports a specific trait.\n * Examples: `withZIndex`, `withStyleAppearPageEffect`, `isLinkStylePresetNode`\n */\nexport type TraitGuard<Node extends TraitTargetNode = CanvasNode> = (node: Node) => boolean\n\nexport type PrefixedKey<TPrefix extends string | undefined, TKey extends string> = TPrefix extends string\n\t? `${TPrefix}${Capitalize<TKey>}`\n\t: TKey\n\nexport type PrefixObjectKeys<TObject, TPrefix extends string | undefined> = {\n\t[K in keyof TObject as PrefixedKey<TPrefix, Extract<K, string>>]: TObject[K]\n}\n\n/**\n * Returns a human-readable DSL type name for a canvas node, for use in error/warning messages.\n * Uses AgentContext to disambiguate code components that can render as either IconNode or\n * ComponentInstanceNode, then falls back to the raw class discriminator when no DSL mapping exists.\n */\nexport function nodeToDSLType(node: CanvasNode, ctx?: AgentContext, parent?: MaybeCanvasNode): string {\n\tconst specialCaseClass = getSpecialCaseDSLNodeClass(node, ctx, parent)\n\tif (specialCaseClass) return specialCaseClass\n\n\tconst classes = getDSLClassesForNode(node)\n\tconst firstClass = classes[0]\n\tif (firstClass) return firstClass\n\treturn node.__class\n}\n/**\n * Maps a canvas node to its DSL class(es), handling aliases for code component variants.\n * CodeComponentNode returns both IconNode and ComponentInstanceNode since they share traits.\n * Returns empty array for nodes that don't have a corresponding DSL class.\n */\nexport function getDSLClassesForNode(node: CanvasNode): SupportedDSLNodeClass[] {\n\tswitch (node.__class) {\n\t\tcase ClassDiscriminator.CollectionItemNode:\n\t\tcase ClassDiscriminator.CollectionNode:\n\t\tcase ClassDiscriminator.ColorStyleTokenNode:\n\t\tcase ClassDiscriminator.DesignPageNode:\n\t\tcase ClassDiscriminator.FormBooleanInputNode:\n\t\tcase ClassDiscriminator.FormPlainTextInputNode:\n\t\tcase ClassDiscriminator.FormSelectNode:\n\t\tcase ClassDiscriminator.FrameNode:\n\t\tcase ClassDiscriminator.InlineCodeStylePresetNode:\n\t\tcase ClassDiscriminator.BlockquoteStylePresetNode:\n\t\tcase ClassDiscriminator.TableStylePresetNode:\n\t\tcase ClassDiscriminator.LinkStylePresetNode:\n\t\tcase ClassDiscriminator.ImageStylePresetNode:\n\t\tcase ClassDiscriminator.RichTextNode:\n\t\tcase ClassDiscriminator.TextStylePresetNode:\n\t\tcase ClassDiscriminator.WebPageNode:\n\t\tcase ClassDiscriminator.ShaderNode:\n\t\tcase ClassDiscriminator.RootNode:\n\t\tcase ClassDiscriminator.ComponentPresetNode:\n\t\t\treturn [node.__class]\n\t\tcase ClassDiscriminator.RedirectRouteNode:\n\t\t\treturn [RedirectNodeClass]\n\t\tcase ClassDiscriminator.SmartComponentNode:\n\t\t\treturn [ComponentNodeClass]\n\t\tcase ClassDiscriminator.OverlayNode:\n\t\t\treturn [FixedOverlayNodeClass]\n\t\tcase ClassDiscriminator.CodeComponentNode:\n\t\t\t// CodeComponentNode is used for both IconNode and ComponentInstanceNode\n\t\t\t// Both aliases share the same underlying traits, so include both\n\t\t\treturn [IconNodeClass, ComponentInstanceNodeClass]\n\t\tcase ClassDiscriminator.AbTestsEntityTypeRootNode:\n\t\tcase ClassDiscriminator.AgentPanelTool:\n\t\tcase ClassDiscriminator.AgentDragSelectTool:\n\t\tcase ClassDiscriminator.AgentSelectTool:\n\t\tcase ClassDiscriminator.AnalyticsScopeNode:\n\t\tcase ClassDiscriminator.BlockquoteEntityTypeRootNode:\n\t\tcase ClassDiscriminator.BooleanShapeNode:\n\t\tcase ClassDiscriminator.BoxShadow:\n\t\tcase ClassDiscriminator.BranchNode:\n\t\tcase ClassDiscriminator.BranchesNode:\n\t\tcase ClassDiscriminator.CanvasNode:\n\t\tcase ClassDiscriminator.CanvasPageNode:\n\t\tcase ClassDiscriminator.CanvasScopeNode:\n\t\tcase ClassDiscriminator.ChatTool:\n\t\tcase ClassDiscriminator.CMSEntityTypeRootNode:\n\t\tcase ClassDiscriminator.CodeFileEntityTypeRootNode:\n\t\tcase ClassDiscriminator.CollectionReferenceVariableEditTool:\n\t\tcase ClassDiscriminator.Color:\n\t\tcase ClassDiscriminator.ColorEntityTypeRootNode:\n\t\tcase ClassDiscriminator.ColorStyleTokenListNode:\n\t\tcase ClassDiscriminator.ComponentEntityTypeRootNode:\n\t\tcase ClassDiscriminator.ConicGradient:\n\t\tcase ClassDiscriminator.ContentManagementNode:\n\t\tcase ClassDiscriminator.CreateCodeComponentBaseTool:\n\t\tcase ClassDiscriminator.CreateFrameBaseTool:\n\t\tcase ClassDiscriminator.CreateShapeBaseTool:\n\t\tcase ClassDiscriminator.CreateTextTool:\n\t\tcase ClassDiscriminator.CustomCodeNode:\n\t\tcase ClassDiscriminator.CustomCodeScopeNode:\n\t\tcase ClassDiscriminator.DateVariableEditTool:\n\t\tcase ClassDiscriminator.EntityFolderNode:\n\t\tcase ClassDiscriminator.EntityReferenceNode:\n\t\tcase ClassDiscriminator.EntityRootNode:\n\t\tcase ClassDiscriminator.EnumVariableEditTool:\n\t\tcase ClassDiscriminator.ErrorListNode:\n\t\tcase ClassDiscriminator.ErrorNode:\n\t\tcase ClassDiscriminator.ExportOptions:\n\t\tcase ClassDiscriminator.ExternalModuleNode:\n\t\tcase ClassDiscriminator.ExternalModulesListNode:\n\t\tcase ClassDiscriminator.FeedbackTool:\n\t\tcase ClassDiscriminator.FunnelNode:\n\t\tcase ClassDiscriminator.FunnelStepActionNode:\n\t\tcase ClassDiscriminator.FunnelStepNode:\n\t\tcase ClassDiscriminator.FunnelsEntityTypeRootNode:\n\t\tcase ClassDiscriminator.GapTool:\n\t\tcase ClassDiscriminator.GradientColorStop:\n\t\tcase ClassDiscriminator.GradientToolManagerTool:\n\t\tcase ClassDiscriminator.GuideMoveTool:\n\t\tcase ClassDiscriminator.HeaderRouteNode:\n\t\tcase ClassDiscriminator.HighlightStackItemTool:\n\t\tcase ClassDiscriminator.HighlightTool:\n\t\tcase ClassDiscriminator.InitialTool:\n\t\tcase ClassDiscriminator.InlineCodeEntityTypeRootNode:\n\t\tcase ClassDiscriminator.LayoutTemplateEntityTypeRootNode:\n\t\tcase ClassDiscriminator.LayoutTemplateNode:\n\t\tcase ClassDiscriminator.LineAnchorMoveTool:\n\t\tcase ClassDiscriminator.LinearGradient:\n\t\tcase ClassDiscriminator.LinkEntityTypeRootNode:\n\t\tcase ClassDiscriminator.LinkTool:\n\t\tcase ClassDiscriminator.LoadingShieldTool:\n\t\tcase ClassDiscriminator.LocalizationGlossaryItemNode:\n\t\tcase ClassDiscriminator.LocalizationGlossaryNode:\n\t\tcase ClassDiscriminator.LocalModuleNode:\n\t\tcase ClassDiscriminator.LocalModulesListNode:\n\t\tcase ClassDiscriminator.MoveTool:\n\t\tcase ClassDiscriminator.MutableNode:\n\t\tcase ClassDiscriminator.OvalShapeNode:\n\t\tcase ClassDiscriminator.PaddingTool:\n\t\tcase ClassDiscriminator.PageLinkTool:\n\t\tcase ClassDiscriminator.PanTool:\n\t\tcase ClassDiscriminator.PathCurveBendTool:\n\t\tcase ClassDiscriminator.PathDefaultTool:\n\t\tcase ClassDiscriminator.PathNode:\n\t\tcase ClassDiscriminator.PathSegment:\n\t\tcase ClassDiscriminator.PathSegmentAdditionTool:\n\t\tcase ClassDiscriminator.PathSegmentHandleMoveTool:\n\t\tcase ClassDiscriminator.PathSegmentMoveTool:\n\t\tcase ClassDiscriminator.PathSegmentSelectTool:\n\t\tcase ClassDiscriminator.PolygonShapeNode:\n\t\tcase ClassDiscriminator.PresetsListNode:\n\t\tcase ClassDiscriminator.PreviewSettings:\n\t\tcase ClassDiscriminator.ProxyRouteNode:\n\t\tcase ClassDiscriminator.RadialGradient:\n\t\tcase ClassDiscriminator.RadiusTool:\n\t\tcase ClassDiscriminator.RecoveryTool:\n\t\tcase ClassDiscriminator.RectangleShapeNode:\n\t\tcase ClassDiscriminator.ResizeTool:\n\t\tcase ClassDiscriminator.RewriteRouteNode:\n\t\tcase ClassDiscriminator.RichTextEditTool:\n\t\tcase ClassDiscriminator.RichTextVariableEditTool:\n\t\tcase ClassDiscriminator.RotateTool:\n\t\tcase ClassDiscriminator.RouteLocaleNode:\n\t\tcase ClassDiscriminator.RouteNode:\n\t\tcase ClassDiscriminator.RouteSegmentNode:\n\t\tcase ClassDiscriminator.RouteSegmentRootNode:\n\t\tcase ClassDiscriminator.RoutesNode:\n\t\tcase ClassDiscriminator.SampleColorTool:\n\t\tcase ClassDiscriminator.ScaleTool:\n\t\tcase ClassDiscriminator.ScopeNode:\n\t\tcase ClassDiscriminator.SelectTool:\n\t\tcase ClassDiscriminator.Shadow:\n\t\tcase ClassDiscriminator.ShapeContainerNode:\n\t\tcase ClassDiscriminator.ShapeGroupNode:\n\t\tcase ClassDiscriminator.SlotConnectTool:\n\t\tcase ClassDiscriminator.SlotNode:\n\t\tcase ClassDiscriminator.SlotPropertyNode:\n\t\tcase ClassDiscriminator.StarShapeNode:\n\t\tcase ClassDiscriminator.StringVariableEditTool:\n\t\tcase ClassDiscriminator.StyledTextDraft:\n\t\tcase ClassDiscriminator.SVGNode:\n\t\tcase ClassDiscriminator.TestTool:\n\t\tcase ClassDiscriminator.TextEditTool:\n\t\tcase ClassDiscriminator.TextEntityTypeRootNode:\n\t\tcase ClassDiscriminator.TextNode:\n\t\tcase ClassDiscriminator.VectorSetEntityTypeRootNode:\n\t\tcase ClassDiscriminator.VectorSetNode:\n\t\tcase ClassDiscriminator.VekterGradientTool:\n\t\tcase ClassDiscriminator.VekterPathEngine:\n\t\tcase ClassDiscriminator.VekterTool:\n\t\tcase ClassDiscriminator.ViewportResizeTool:\n\t\tcase ClassDiscriminator.ZoomSelectTool:\n\t\tcase ClassDiscriminator.ContentManagementEntityTypeRootNode:\n\t\tcase ClassDiscriminator.ZoomTool:\n\t\t\treturn []\n\t\tdefault:\n\t\t\tassertNever(node.__class)\n\t}\n}\n\n// biome-ignore lint/suspicious/noConfusingVoidType: fromAttributes may return nothing `void`, `TraitWarning[]`, or collected trait issues.\nexport type TraitFromAttributesResult = TraitWarning[] | TraitIssues | void\n\nexport type RichTextControlSerializer = (\n\thandle: RichTextReaderHandle,\n\tctx: AgentContext,\n) => Promise<DSLAttributeValue | undefined>\n\nexport interface TraitSerializers {\n\trichText: RichTextControlSerializer\n}\n\nexport interface TraitDefinition<\n\tT extends object,\n\tCustomShorthand extends string[] = [],\n\tNode extends TraitTargetNode = CanvasNode,\n> {\n\t/**\n\t * Determines which nodes support this trait. Accepts either:\n\t * - A guard function (auto-scales to new nodes)\n\t * - An object with optional `guard` and/or explicit DSL classes for special cases\n\t *\n\t * Example: `for: withZIndex` \u2014 all nodes with the zIndex trait.\n\t * Example: `for: { guard: hasFloatingPosition, nodes: [RelativeOverlayNodeClass] }`\n\t */\n\tfor: TraitGuard<Node> | { guard?: TraitGuard<Node>; nodes?: readonly AllNodeClass[] }\n\t/**\n\t * Provide the attribute definitions for the trait keys.\n\t *\n\t * @TODO: Extract these with code-generation from the trait Typescript types.\n\t */\n\tdefinition: TraitAttributeDefinition<T, CustomShorthand>\n\t/**\n\t * Given DSLAttributes from an LLM, convert to Vekter Models and apply to the node.\n\t */\n\tfromAttributes(node: Node, attributes: DSLAttributes, ctx: AgentContext): TraitFromAttributesResult\n\t/**\n\t * Optionally convert Vekter Models to DSLAttributes for an LLM.\n\t */\n\ttoAttributes?(\n\t\tnode: Node,\n\t\tparent: MaybeCanvasNode,\n\t\tctx: AgentContext,\n\t\tserializers: TraitSerializers,\n\t):\n\t\t| Promise<TraitToAttributesOutput<T> | DSLAttributes | undefined>\n\t\t| TraitToAttributesOutput<T>\n\t\t| DSLAttributes\n\t\t| undefined\n}\n\nexport interface VirtualNodeTraitDefinition<\n\tT extends object,\n\tCustomShorthand extends string[] = [],\n\tNode extends VirtualRichTextNode = VirtualRichTextNode,\n> extends TraitDefinition<T, CustomShorthand, Node> {\n\tfor: TraitGuard<Node>\n}\n\n/** Creates a mock TreeStore for testing purposes. */\nexport function createMockTreeStore(tree?: CanvasTree, _scope?: Loaded<ScopeNode>): TreeStore {\n\tif (tree) return { tree, getDataTreeOrPartialTree: () => tree } as TreeStore\n\n\ttree = CanvasTree.createWithDefaultPage()\n\tassert(tree, \"Tree must be created\")\n\n\treturn { tree: tree, getDataTreeOrPartialTree: () => tree } as TreeStore\n}\n\nexport function createMockScheduler(): BaseEngineScheduler {\n\treturn {\n\t\tinRendering: false,\n\t\tchanges: {} as BaseEngineScheduler[\"changes\"],\n\t\tsignalChanges: () => {},\n\t\twrapHandler: <This, Args extends unknown[], Return>(handler: (this: This, ...args: Args) => Return) => handler,\n\t\tprocess: (task: () => void) => task(),\n\t\tprocessWhenReady: (task: () => void) => task(),\n\t\tprocessWhenReadyAsync: async <T>(task: () => T) => task(),\n\t\trunWhenIdle: (task: () => void) => task(),\n\t\trunWithFullyLoadedTree: (task: () => void) => {\n\t\t\ttask()\n\t\t\treturn () => {}\n\t\t},\n\t\trunWithFullyLoadedTreeAsync: (task: () => void) => {\n\t\t\ttask()\n\t\t\treturn Promise.resolve()\n\t\t},\n\t\trunBeforeNextFrame: (task: () => void) => task(),\n\t\tscheduleDocumentUpdateIgnoringUndo: (cb: VoidFunction) => cb(),\n\t\tscheduleAgentChanges: async (cb: VoidFunction) => cb(),\n\t}\n}\n\nexport function createMockFormsStore(): FormsStore {\n\treturn {\n\t\tupdateFormConfig: async () => {},\n\t} as unknown as FormsStore\n}\n\nexport function isAttributeDefinition(definition: unknown): definition is AttributeDefinition {\n\tif (!isObject(definition)) return false\n\n\tif (!(\"description\" in definition) || !isString(definition.description)) return false\n\n\t// optional props\n\tif (\"examples\" in definition && !isArray(definition.examples)) return false\n\tif (\"optional\" in definition && definition.optional !== true) return false\n\n\treturn true\n}\n", "import { createAbsoluteAssetURL, createAbsoluteImageAssetURL, parseAssetReference } from \"@framerjs/assets\"\nimport { isCompatibleFileType } from \"document/components/chrome/properties/utils/allowedFileTypes.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { WithBorder } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport { parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { parseBoxShadow } from \"document/models/CanvasTree/traits/utils/parseBoxShadowFromStyle.ts\"\nimport { type BoxShadow, isBoxShadowList } from \"document/models/Shadow.ts\"\nimport { isBorderStyle } from \"document/models/controlProps/BorderControlPropValue.ts\"\nimport { type BorderStyle, isFiniteNumber } from \"library/index.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isArray, isBooleanString, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { mimeTypes } from \"web/lib/images/supportedFormats.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\tborderColorConflict,\n\tborderColorExplicitOverride,\n\tborderSideUnparseable,\n\tborderStyleConflict,\n\tborderStyleExplicitOverride,\n\ttraitNotAppliedWarning,\n\tunsupportedAttributeMessage,\n} from \"./invalidValues.ts\"\nimport {\n\tnodeToDSLType,\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype PrefixedKey,\n\ttype TraitAttributeDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\n/**\n * Resolves an asset reference string (e.g. `data:framer/asset-reference,foo.jpg`) to an absolute\n * CDN URL. Returns the original value unchanged if it is not a valid asset reference.\n */\nexport function assetReferenceToURL(value: string): string {\n\tconst parsed = parseAssetReference(value)\n\tif (!parsed) return value\n\t// if it has image size then it is an image\n\tif (parsed.intrinsicSize) return createAbsoluteImageAssetURL(parsed.identifier)\n\t// if it doesn't have image size but is a supported image file type then it is an image\n\tif (parsed.fileExtension && isCompatibleFileType(parsed.fileExtension, mimeTypes)) {\n\t\treturn createAbsoluteImageAssetURL(parsed.identifier)\n\t}\n\n\t// otherwise it's any other asset\n\treturn createAbsoluteAssetURL(parsed.identifier)\n}\n\n/**\n * When encoding attributes we use a \"null\" string to represent a null value when it is important to\n * distinguish between a null value and a missing value.\n */\nexport const nullString = \"null\"\nexport function isNullString(value: unknown): value is typeof nullString {\n\treturn value === nullString\n}\n\nconst borderShorthandSplitRegex = /\\s+/u\n\nexport interface ParsedBorderShorthand {\n\twidth?: number\n\tstyle?: BorderStyle\n\tcolor?: string\n}\n\n/**\n * Parses a CSS border shorthand value like \"1px solid red\" or \"2px\".\n * Resolves color tokens via ctx when present.\n */\nexport function parseBorderShorthand(value: string, ctx: AgentContext): ParsedBorderShorthand | undefined {\n\tconst parts = value.trim().split(borderShorthandSplitRegex)\n\n\tif (parts.length >= 2) {\n\t\tconst [widthPart, stylePart, ...colorParts] = parts\n\t\tif (isBorderStyle(stylePart)) {\n\t\t\tassert(isString(widthPart), \"expected widthPart to be a string\")\n\n\t\t\tconst [numberValue, unit] = parseCSSDimension(widthPart, \"px\")\n\t\t\tconst width = !Number.isNaN(numberValue) && unit === \"px\" ? numberValue : undefined\n\t\t\tconst color = colorParts.join(\" \")\n\t\t\treturn {\n\t\t\t\twidth,\n\t\t\t\tstyle: stylePart,\n\t\t\t\tcolor: color ? (ctx.tokens.resolve(color)?.toCSS() ?? color) : undefined,\n\t\t\t}\n\t\t}\n\t}\n\n\tconst [numberValue, unit] = parseCSSDimension(value, \"px\")\n\tif (!Number.isNaN(numberValue) && unit === \"px\") {\n\t\treturn { width: numberValue }\n\t}\n\n\treturn undefined\n}\n\nexport const borderSideKeys = [\"borderTop\", \"borderRight\", \"borderBottom\", \"borderLeft\"] as const\ntype BorderSideKey = (typeof borderSideKeys)[number]\n\ninterface BorderSideParseError {\n\tside: BorderSideKey\n\tvalue: string\n}\n\ninterface CollectedBorderSides {\n\twidths: Partial<Record<BorderSideKey, number>>\n\thasWidths: boolean\n\tstyle?: BorderStyle\n\tcolor?: string\n\thasConflictingStyle: boolean\n\thasConflictingColor: boolean\n\tparseErrors: BorderSideParseError[]\n}\n\n/**\n * Parses per-side border values from attributes, extracting width, style, and color.\n * Supports both plain dimensions (\"1px\") and shorthand (\"1px solid red\").\n */\nfunction collectBorderSides<TPrefix extends string | undefined>(\n\tprefix: TPrefix,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): CollectedBorderSides {\n\tconst widths: Partial<Record<BorderSideKey, number>> = {}\n\tlet hasWidths = false\n\tlet style: BorderStyle | undefined\n\tlet color: string | undefined\n\tlet hasConflictingStyle = false\n\tlet hasConflictingColor = false\n\tconst parseErrors: BorderSideParseError[] = []\n\n\tfor (const side of borderSideKeys) {\n\t\tconst value = attributes[withOptionalPrefix(prefix, side)]\n\n\t\tif (isNullString(value)) {\n\t\t\twidths[side] = 0\n\t\t\thasWidths = true\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isFiniteNumber(value)) {\n\t\t\twidths[side] = value\n\t\t\thasWidths = true\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!isString(value)) continue\n\n\t\tconst parsed = parseBorderShorthand(value, ctx)\n\t\tif (!parsed || isUndefined(parsed.width)) {\n\t\t\tparseErrors.push({ side, value })\n\t\t\tcontinue\n\t\t}\n\n\t\twidths[side] = parsed.width\n\t\thasWidths = true\n\n\t\tif (parsed.style) {\n\t\t\tif (isUndefined(style)) style = parsed.style\n\t\t\telse if (parsed.style !== style) hasConflictingStyle = true\n\t\t}\n\t\tif (parsed.color) {\n\t\t\tif (isUndefined(color)) color = parsed.color\n\t\t\telse if (parsed.color !== color) hasConflictingColor = true\n\t\t}\n\t}\n\n\treturn { widths, hasWidths, style, color, hasConflictingStyle, hasConflictingColor, parseErrors }\n}\n\n/**\n * Generates warnings for per-side border style/color conflicts.\n */\nfunction collectBorderSideWarnings<TPrefix extends string | undefined>(\n\tprefix: TPrefix,\n\tcollected: CollectedBorderSides,\n\thasExplicitStyle: boolean,\n\thasExplicitColor: boolean,\n): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\n\tif (collected.style && hasExplicitStyle) {\n\t\twarnings.push({\n\t\t\tkey: withOptionalPrefix(prefix, \"borderStyle\"),\n\t\t\tapplied: true,\n\t\t\tmessage: borderStyleExplicitOverride,\n\t\t})\n\t} else if (collected.hasConflictingStyle) {\n\t\twarnings.push({\n\t\t\tkey: withOptionalPrefix(prefix, \"borderStyle\"),\n\t\t\tapplied: true,\n\t\t\tmessage: borderStyleConflict(collected.style),\n\t\t})\n\t}\n\n\tif (collected.color && hasExplicitColor) {\n\t\twarnings.push({\n\t\t\tkey: withOptionalPrefix(prefix, \"borderColor\"),\n\t\t\tapplied: true,\n\t\t\tmessage: borderColorExplicitOverride,\n\t\t})\n\t} else if (collected.hasConflictingColor) {\n\t\twarnings.push({\n\t\t\tkey: withOptionalPrefix(prefix, \"borderColor\"),\n\t\t\tapplied: true,\n\t\t\tmessage: borderColorConflict(collected.color),\n\t\t})\n\t}\n\n\tfor (const error of collected.parseErrors) {\n\t\twarnings.push({\n\t\t\tkey: withOptionalPrefix(prefix, error.side),\n\t\t\tapplied: false,\n\t\t\tmessage: borderSideUnparseable(error.side, error.value),\n\t\t})\n\t}\n\n\treturn warnings\n}\n\n/** Strips a CSS `url(...)` wrapper, returning the inner URL. */\nexport function unwrapCSSUrl(value: string): string {\n\tif (!value.startsWith(\"url(\") || !value.endsWith(\")\")) return value\n\tconst inner = value.slice(4, -1).trim()\n\tconst quote = inner[0]\n\tif ((quote === '\"' || quote === \"'\") && inner.endsWith(quote)) {\n\t\treturn inner.slice(1, -1)\n\t}\n\treturn inner\n}\n\ninterface RotateShorthandValue {\n\trotateX: number\n\trotateY: number\n\trotateZ: number\n}\n\nexport function withOptionalPrefix<TPrefix extends string | undefined, TKey extends string>(\n\tprefix: TPrefix,\n\tkey: TKey,\n): PrefixedKey<TPrefix, TKey> {\n\tif (prefix === undefined || !key[0]) return key as PrefixedKey<TPrefix, TKey>\n\n\treturn `${prefix}${key[0].toUpperCase()}${key.slice(1)}` as PrefixedKey<TPrefix, TKey>\n}\n\nexport function parseRotateShorthand(value: string): number | RotateShorthandValue | undefined {\n\tconst values = value.split(\" \").filter(Boolean)\n\tif (values.length === 1 && isString(values[0])) {\n\t\treturn parseCSSDimension(values[0], \"deg\")[0]\n\t}\n\n\tconst [rotateX, rotateY, rotateZ] = values\n\tif (isString(rotateX) && isString(rotateY) && isString(rotateZ)) {\n\t\treturn {\n\t\t\trotateX: parseCSSDimension(rotateX, \"deg\")[0],\n\t\t\trotateY: parseCSSDimension(rotateY, \"deg\")[0],\n\t\t\trotateZ: parseCSSDimension(rotateZ, \"deg\")[0],\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nexport function getExpectedObjectValue<T extends object>(definition: TraitAttributeDefinition<T>): string {\n\treturn `an object with supported keys: ${Object.keys(definition).join(\", \")}`\n}\n\n/**\n * Builds defensive `applied: false` warnings for each top-level attribute key in `definition`\n * that is present in `attributes`, using {@link unsupportedAttributeMessage} for the message.\n *\n * Use this in a trait's `fromAttributes` when the trait guard fails (i.e. the node does not\n * support the trait) so the agent learns the attribute could not be applied to that node type\n * instead of silently dropping the value.\n */\nexport function unsupportedAttributesWarnings<T extends object, CustomShorthand extends string[] = []>(\n\tnode: CanvasNode,\n\tattributes: DSLAttributes,\n\tdefinition: TraitAttributeDefinition<T, CustomShorthand>,\n\tctx: AgentContext,\n): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\tconst nodeType = nodeToDSLType(node, ctx)\n\n\tlet key: keyof typeof definition | undefined\n\tfor (key in definition) {\n\t\tif (!key || isUndefined(definition[key])) continue\n\t\tif (isUndefined(attributes[key])) continue\n\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey,\n\t\t\tmessage: unsupportedAttributeMessage(nodeType),\n\t\t})\n\t}\n\treturn warnings\n}\n\ntype StringOrVariableReferenceKey<T extends CanvasNode> = {\n\t[K in Extract<keyof T, string>]-?: Extract<T[K], string | VariableReference> extends never ? never : K\n}[Extract<keyof T, string>]\n\ntype BooleanOrVariableReferenceKey<T extends CanvasNode> = {\n\t[K in Extract<keyof T, string>]-?: Extract<T[K], boolean | VariableReference> extends never ? never : K\n}[Extract<keyof T, string>]\n\ntype NumberOrVariableReferenceKey<T extends CanvasNode> = {\n\t[K in Extract<keyof T, string>]-?: Extract<T[K], number | VariableReference> extends never ? never : K\n}[Extract<keyof T, string>]\n\ntype BoxShadowKey<T extends CanvasNode> = {\n\t[K in Extract<keyof T, string>]-?: Extract<T[K], readonly BoxShadow[]> extends never ? never : K\n}[Extract<keyof T, string>]\n\nexport function collectStringOrVariableReference<T extends CanvasNode, K extends StringOrVariableReferenceKey<T>>(\n\tnode: T,\n\tkey: K,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings?: TraitWarning[],\n) {\n\tconst value = attributes[key]\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, { node })\n\tswitch (resolveHandleResult.type) {\n\t\tcase \"resolved\":\n\t\t\tnode.set({ [key]: resolveHandleResult.handle.reference(node) } as Partial<T>)\n\t\t\treturn\n\n\t\tcase \"invalid\":\n\t\t\twarnings?.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(key, message)))\n\t\t\tbreak\n\n\t\tcase \"literal\":\n\t\t\tbreak\n\t}\n\n\tif (isNullString(value)) {\n\t\tnode.set({ [key]: undefined } as Partial<T>)\n\t\treturn\n\t}\n\n\tif (isString(value)) {\n\t\tnode.set({ [key]: value } as Partial<T>)\n\t}\n}\n\nexport function collectBooleanOrVariableReference<T extends CanvasNode, K extends BooleanOrVariableReferenceKey<T>>(\n\tnode: T,\n\tkey: K,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings?: TraitWarning[],\n) {\n\tconst value = attributes[key]\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, { node })\n\tswitch (resolveHandleResult.type) {\n\t\tcase \"resolved\":\n\t\t\tnode.set({ [key]: resolveHandleResult.handle.reference(node) } as Partial<T>)\n\t\t\treturn\n\n\t\tcase \"invalid\":\n\t\t\twarnings?.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(key, message)))\n\t\t\tbreak\n\n\t\tcase \"literal\":\n\t\t\tbreak\n\t}\n\n\tif (isNullString(value)) {\n\t\tnode.set({ [key]: undefined } as Partial<T>)\n\t\treturn\n\t}\n\n\tif (isBooleanString(value)) {\n\t\tnode.set({ [key]: value === \"true\" } as Partial<T>)\n\t}\n}\n\nexport function collectNumberOrVariableReference<T extends CanvasNode, K extends NumberOrVariableReferenceKey<T>>(\n\tnode: T,\n\tkey: K,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings?: TraitWarning[],\n) {\n\tconst value = attributes[key]\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, { node })\n\tswitch (resolveHandleResult.type) {\n\t\tcase \"resolved\":\n\t\t\tnode.set({ [key]: resolveHandleResult.handle.reference(node) } as Partial<T>)\n\t\t\treturn\n\n\t\tcase \"invalid\":\n\t\t\twarnings?.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(key, message)))\n\t\t\tbreak\n\n\t\tcase \"literal\":\n\t\t\tbreak\n\t}\n\n\tif (isNullString(value)) {\n\t\tnode.set({ [key]: undefined } as Partial<T>)\n\t\treturn\n\t}\n\n\tconst parsed = tryParseNumber(value)\n\tif (isFiniteNumber(parsed)) {\n\t\tnode.set({ [key]: parsed } as Partial<T>)\n\t}\n}\n\nexport type ArrayParsePatchItemCallback<TAttributeValue, TArrayItem> = (\n\tvalue: TAttributeValue,\n\tindex: number,\n) => readonly TArrayItem[] | undefined\ninterface ArrayAttributePatchConfig<TArrayItem, TAttributeValue> {\n\tcurrentItems: readonly TArrayItem[] | undefined\n\tpatch: readonly TAttributeValue[]\n\tparsePatchItem: ArrayParsePatchItemCallback<TAttributeValue, TArrayItem>\n}\n\nexport function applyArrayAttributePatch<TArrayItem, TAttributeValue>(\n\tconfig: ArrayAttributePatchConfig<TArrayItem, TAttributeValue>,\n): TArrayItem[] | undefined {\n\tconst { currentItems, patch, parsePatchItem } = config\n\tif (patch.length === 0) return undefined\n\n\tconst result = currentItems ? [...currentItems] : []\n\tconst indicesToRemove: number[] = []\n\n\tfor (const [index, value] of patch.entries()) {\n\t\tif (isUndefined(value)) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isNullString(value)) {\n\t\t\tindicesToRemove.push(index)\n\t\t\tcontinue\n\t\t}\n\n\t\tconst parsedItems = parsePatchItem(value, index)\n\t\tif (!parsedItems || parsedItems.length === 0) {\n\t\t\tcontinue\n\t\t}\n\n\t\tresult.splice(index, parsedItems.length, ...parsedItems)\n\t}\n\n\tfor (const index of indicesToRemove.sort((a, b) => b - a)) {\n\t\tif (index < result.length) {\n\t\t\tresult.splice(index, 1)\n\t\t}\n\t}\n\n\treturn result\n}\n\nconst boxShadowSplitRegex = /,(?![^(]*\\))/u\nexport function collectBoxShadows<T extends CanvasNode, K extends BoxShadowKey<T>>(\n\tnode: T,\n\tkey: K,\n\tattributes: DSLAttributes,\n) {\n\tconst boxShadows = attributes[key]\n\tif (!isArray(boxShadows)) return\n\n\tconst result = applyArrayAttributePatch({\n\t\tcurrentItems: isBoxShadowList(node[key]) ? node[key] : undefined,\n\t\tpatch: boxShadows,\n\t\tparsePatchItem: value => {\n\t\t\tif (!isString(value)) return\n\n\t\t\tconst parts = value.split(boxShadowSplitRegex)\n\t\t\tconst parsed: BoxShadow[] = []\n\t\t\tfor (const part of parts) {\n\t\t\t\tconst shadow = parseBoxShadow(part, randomID())\n\t\t\t\tif (shadow) parsed.push(shadow)\n\t\t\t}\n\t\t\treturn parsed\n\t\t},\n\t})\n\n\tnode.set({ [key]: result } as Partial<T>)\n}\n\ntype BorderPropPrefixes = \"formInputFocused\" | \"formInputChecked\"\nexport function fromAttributesToBorderProps<TPrefix extends BorderPropPrefixes | undefined>(\n\tprefix: TPrefix,\n\tnode: CanvasNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings?: TraitWarning[],\n) {\n\tlet borderProps: Partial<WithBorder> = {}\n\n\tconst borderEnabledKey = withOptionalPrefix(prefix, \"borderEnabled\")\n\tconst resolveBorderEnabledHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes[borderEnabledKey], {\n\t\tnode,\n\t})\n\tswitch (resolveBorderEnabledHandleResult.type) {\n\t\tcase \"resolved\":\n\t\t\tborderProps.borderEnabled = resolveBorderEnabledHandleResult.handle.reference(node)\n\t\t\treturn borderProps\n\n\t\tcase \"invalid\":\n\t\t\twarnings?.push(\n\t\t\t\t...resolveBorderEnabledHandleResult.errorMessages.map(message =>\n\t\t\t\t\ttraitNotAppliedWarning(borderEnabledKey, message),\n\t\t\t\t),\n\t\t\t)\n\t\t\tbreak\n\n\t\tcase \"literal\":\n\t\t\tbreak\n\t}\n\n\tif (attributes[withOptionalPrefix(prefix, \"borderEnabled\")] === \"false\") {\n\t\tborderProps.borderEnabled = false\n\t\treturn borderProps\n\t}\n\n\tlet borderWidth = attributes[withOptionalPrefix(prefix, \"borderWidth\")]\n\tlet borderStyle = attributes[withOptionalPrefix(prefix, \"borderStyle\")]\n\tlet borderColor = attributes[withOptionalPrefix(prefix, \"borderColor\")]\n\n\tconst borderValue = attributes[withOptionalPrefix(prefix, \"border\")]\n\tif (isString(borderValue)) {\n\t\tconst parsed = parseBorderShorthand(borderValue, ctx)\n\t\tif (parsed) {\n\t\t\tif (!isUndefined(parsed.width)) borderWidth = toRoundedNumber(parsed.width)\n\t\t\tif (!isUndefined(parsed.style)) borderStyle = parsed.style\n\t\t\tif (!isUndefined(parsed.color)) borderColor = parsed.color\n\t\t}\n\t}\n\n\tif (isString(borderColor)) {\n\t\tborderProps.borderEnabled = true\n\t\tborderProps.borderColor = ctx.tokens.resolve(borderColor)?.toCSS() ?? borderColor\n\t}\n\n\tif (isFiniteNumber(borderWidth)) {\n\t\tborderProps.borderEnabled = true\n\t\tborderProps.borderWidth = borderWidth\n\t\tborderProps.borderPerSide = false\n\t} else if (isString(borderWidth)) {\n\t\tconst [value, unit] = parseCSSDimension(borderWidth, \"px\")\n\t\tif (!Number.isNaN(value) && unit === \"px\") {\n\t\t\tborderProps.borderEnabled = true\n\t\t\tborderProps.borderWidth = value\n\t\t\tborderProps.borderPerSide = false\n\t\t}\n\t}\n\n\tif (isBorderStyle(borderStyle)) {\n\t\tborderProps.borderEnabled = true\n\t\tborderProps.borderStyle = borderStyle\n\t}\n\n\tconst borderPerSide = attributes[withOptionalPrefix(prefix, \"borderPerSide\")]\n\tif (borderPerSide === true || borderPerSide === \"true\") {\n\t\tborderProps.borderEnabled = true\n\t\tborderProps.borderPerSide = true\n\t}\n\n\tconst collected = collectBorderSides(prefix, attributes, ctx)\n\tif (collected.hasWidths) {\n\t\tborderProps = {\n\t\t\t...borderProps,\n\t\t\tborderEnabled: true,\n\t\t\tborderPerSide: true,\n\t\t\t...collected.widths,\n\t\t}\n\t}\n\n\tconst hasExplicitStyle = isBorderStyle(borderProps.borderStyle)\n\tconst hasExplicitColor = isString(borderProps.borderColor)\n\n\tif (collected.style && !hasExplicitStyle) {\n\t\tborderProps.borderEnabled = true\n\t\tborderProps.borderStyle = collected.style\n\t}\n\tif (collected.color && !hasExplicitColor) {\n\t\tborderProps.borderEnabled = true\n\t\tborderProps.borderColor = collected.color\n\t}\n\n\tif (warnings) {\n\t\twarnings.push(...collectBorderSideWarnings(prefix, collected, hasExplicitStyle, hasExplicitColor))\n\t}\n\n\treturn borderProps\n}\n\nexport function hasAnyAttribute<T>(attributes: DSLAttributes, definition: TraitAttributeDefinition<T>): boolean {\n\tfor (const key in definition) {\n\t\tif (!isUndefined(attributes[key])) return true\n\t}\n\treturn false\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport { getRawWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport { getDefaultName } from \"document/components/utils/nodes.ts\"\nimport { nameToPath } from \"document/components/utils/pathToName.ts\"\nimport type { AnyWebPageNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCollectionNode,\n\tisDesignPageNode,\n\tisKitPageNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport type { AIGenerationStore } from \"document/stores/AIGenerationStore.ts\"\nimport type { ScopeStore } from \"document/stores/ScopeStore.ts\"\nimport type { SelectionStore } from \"document/stores/SelectionStore.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { pathVariablesRegExp, pathVariablesRegExpGlobal } from \"library/router/pathVariables.ts\"\nimport { getCollectionIdForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { WireframerKit } from \"./wireframerKit.ts\"\n\nexport interface WireframerSiteMap {\n\tpages: Page[]\n\tcurrentPageRoute: string | undefined\n}\n\nexport interface Page {\n\troute: string\n\ttitle?: string\n\tstructure: PageSection[] | undefined\n\tisUserCreated: boolean\n\tcollectionName?: string\n}\n\ninterface PageSection {\n\tid: string\n\tcontent: Record<string, string>\n}\n\nexport function getWebPagesSiteMap(\n\ttree: CanvasTree,\n\tscopeStore: ScopeStore,\n\taiGenerationStore: AIGenerationStore,\n\tkit: WireframerKit,\n): WireframerSiteMap {\n\tconst activePageNodeId = scopeStore.activeId\n\n\tlet currentPageRoute: string | undefined\n\tconst webPages: Page[] = []\n\n\tfor (const node of tree.root.children) {\n\t\tif (!isWebPageNode(node)) continue\n\t\tconst route = getRawWebPagePath(tree, node)\n\t\tif (!route) continue\n\n\t\tconst collectionName = getCollectionNameForPage(tree, node)\n\t\tconst normalizedRoute = normalizeRouteForLLM(route, collectionName)\n\n\t\tif (node.isLoaded()) {\n\t\t\tconst primaryVariant = node.getPrimaryVariant()\n\t\t\tconst hasContent = primaryVariant.children.length > 0\n\t\t\tif (!hasContent) continue\n\t\t}\n\n\t\tif (node.id === activePageNodeId) {\n\t\t\tcurrentPageRoute = normalizedRoute\n\t\t}\n\n\t\tconst structure: PageSection[] | undefined = getPageStructure(node.id, aiGenerationStore, kit)\n\t\tconst isUserCreated = isUndefined(structure) || structure.length === 0\n\n\t\twebPages.push({\n\t\t\troute: normalizedRoute,\n\t\t\ttitle: node.webMetadata?.title,\n\t\t\tstructure,\n\t\t\tisUserCreated,\n\t\t\tcollectionName,\n\t\t})\n\t}\n\n\treturn { currentPageRoute, pages: webPages }\n}\n\nexport function createPageRouteLookup(tree: CanvasTree): Map<string, NodeID> {\n\tconst pageLookup = new Map<string, NodeID>()\n\tfor (const node of tree.root.children) {\n\t\tif (isKitPageNode(node)) continue\n\t\t// Exclude A/B test variants to avoid multiple pages mapping to the same path\n\t\tif (!isWebPageNode(node) || node.abTestingParentId) continue\n\n\t\tconst route = getRawWebPagePath(tree, node)\n\t\tif (!route) continue\n\n\t\tconst collectionName = getCollectionNameForPage(tree, node)\n\t\tconst normalizedRoute = normalizeRouteForLLM(route, collectionName)\n\t\tpageLookup.set(normalizedRoute, node.id)\n\t}\n\treturn pageLookup\n}\n\nexport function normalizeRouteForLLM(route: string, collectionName?: string): string {\n\tconst hasSlug = pathVariablesRegExp.test(route)\n\tif (!hasSlug) return route\n\n\tif (!collectionName) return route\n\n\treturn route.replace(pathVariablesRegExpGlobal, `:${collectionName}`)\n}\n\nexport function getCollectionNameForPage(tree: CanvasTree, node: AnyWebPageNode): string | undefined {\n\tif (!hasCollectionDataSource(node)) return\n\n\tconst collectionId = getCollectionIdForIdentifier(node.dataIdentifier)\n\tif (!collectionId) return\n\n\tconst collectionNode = tree.getNodeWithTrait(collectionId, isCollectionNode)\n\tif (!collectionNode) return\n\n\treturn collectionNode.resolveValue(\"name\") ?? undefined\n}\n\n/**\n * Converts the kit sections structure to a simplified and LLM friendly page structure.\n *\n * @param nodeId - The ID of the node to get the structure for.\n * @param aiGenerationStore - The AI generation store to get the kit sections structure from.\n * @param kit - The kit to get the structure from.\n * @returns The page structure.\n */\nfunction getPageStructure(\n\tnodeId: NodeID,\n\taiGenerationStore: AIGenerationStore,\n\tkit: WireframerKit,\n): PageSection[] | undefined {\n\tconst kitSectionsStructure = aiGenerationStore.getKitSectionsStructure(nodeId, kit)\n\tif (!kitSectionsStructure?.length) return undefined\n\n\treturn kitSectionsStructure.map(section => ({\n\t\tid: section._id,\n\t\tcontent: section.content.reduce<Record<string, string>>((acc, field) => {\n\t\t\tacc[field.field] = field.text\n\t\t\treturn acc\n\t\t}, {}),\n\t}))\n}\n\n/**\n * Collects all screens on the design page and returns them as a record of screen IDs to objects with the screen name,\n * route and kit sections structure.\n * It generates unique screen names by appending a number suffix if the screen name is already in use.\n *\n * @param tree The tree to collect the screens from.\n * @param aiGenerationStore The AI generation store to get the kit sections structure from.\n * @param designPageId The ID of the design page to collect the screens from.\n * @returns A record of screen IDs to objects with the screen name, route and kit sections structure.\n */\nexport function collectDesignPageScreens(\n\ttree: CanvasTree,\n\tcomponentLoader: ComponentLoader,\n\taiGenerationStore: AIGenerationStore,\n\tkit: WireframerKit,\n\tdesignPageId: NodeID,\n): Map<NodeID, Page> {\n\tconst screens: Map<NodeID, Page> = new Map()\n\n\tconst designPage = tree.get(designPageId)\n\tif (!isDesignPageNode(designPage) || !designPage.isLoaded()) return screens\n\n\tconst uniqueScreenRoutes = new Set<string>()\n\n\tfor (const screen of designPage.loaded.children) {\n\t\tconst structure = getPageStructure(screen.id, aiGenerationStore, kit)\n\t\tif (!structure?.length) continue\n\n\t\tconst screenName = screen.resolveValue(\"name\") ?? getDefaultName(componentLoader, screen)\n\t\tconst route = nameToPath(screenName)\n\t\tconst uniqueScreenRoute = uniqueName(route, uniqueScreenRoutes, { withDash: true, omitCountIfFirst: false })\n\t\tuniqueScreenRoutes.add(uniqueScreenRoute)\n\t\tscreens.set(screen.id, {\n\t\t\troute: uniqueScreenRoute,\n\t\t\ttitle: screenName,\n\t\t\tstructure,\n\t\t\tisUserCreated: false,\n\t\t})\n\t}\n\n\treturn screens\n}\n\n/**\n * Existing AI generated screens on the current design page.\n */\nexport function getDesignPageSiteMap(\n\ttree: CanvasTree,\n\tcomponentLoader: ComponentLoader,\n\tselectionStore: SelectionStore,\n\taiGenerationStore: AIGenerationStore,\n\tkit: WireframerKit,\n\tdesignPageId: NodeID,\n\tprecomputedScreens?: Map<NodeID, Page>,\n): WireframerSiteMap {\n\tconst screens =\n\t\tprecomputedScreens ?? collectDesignPageScreens(tree, componentLoader, aiGenerationStore, kit, designPageId)\n\tif (!screens?.size) return { currentPageRoute: undefined, pages: [] }\n\n\tconst commonGroundNode = tree.getCommonGroundNode(selectionStore.nodes)\n\tconst currentPageRoute = commonGroundNode ? screens.get(commonGroundNode.id)?.route : undefined\n\n\treturn { currentPageRoute, pages: Array.from(screens.values()) }\n}\n\n/**\n * Creates a lookup table for design page screens to improve performance when accessing screens by their unique route.\n *\n * @param tree The tree to create the lookup from.\n * @param aiGenerationStore The AI generation store to get the kit sections structure from.\n * @param kit The kit to get the structure from.\n * @param designPageId The ID of the design page to create the lookup from.\n * @param precomputedScreens The precomputed screens to use for the lookup.\n * @returns A lookup table for design page screens.\n */\nexport function createDesignPageLookup(\n\ttree: CanvasTree,\n\tcomponentLoader: ComponentLoader,\n\taiGenerationStore: AIGenerationStore,\n\tkit: WireframerKit,\n\tdesignPageId: NodeID,\n\tprecomputedScreens?: Map<NodeID, Page>,\n): Map<string, NodeID> {\n\tconst lookup = new Map<string, NodeID>()\n\n\tconst screens =\n\t\tprecomputedScreens ?? collectDesignPageScreens(tree, componentLoader, aiGenerationStore, kit, designPageId)\n\tif (!screens?.size) return lookup\n\n\tfor (const [id, screen] of screens) {\n\t\tlookup.set(screen.route, id)\n\t}\n\n\treturn lookup\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { TraitWarning } from \"./types.ts\"\n\nexport function zodErrorToWarnings({\n\terror,\n\tschema,\n\tkeyPrefix,\n\tinput,\n}: {\n\terror: z.ZodError\n\tschema: z.ZodType\n\tkeyPrefix: string\n\tinput: unknown\n}): TraitWarning[] {\n\treturn error.issues.map(issue => {\n\t\tconst path = issue.path.filter(isString)\n\t\tconst key = path.length > 0 ? `${keyPrefix}.${path.join(\".\")}` : keyPrefix\n\t\tconst issueSchema = getSchemaAtPath(schema, issue.path)\n\n\t\tconst value = getValueAtPath(input, issue.path)\n\t\tassert(!isUndefined(value), \"Expected Zod issue path to resolve through an indexable input\")\n\n\t\tconst message = formatZodIssue(issue, issueSchema, value)\n\n\t\treturn { applied: false, key, message }\n\t})\n}\n\ntype ExpectedItem = string | { heading: string; children: ExpectedItem[] }\n\nfunction formatZodIssue(issue: z.core.$ZodIssue, schema: z.core.$ZodType | undefined, input: unknown): string {\n\tconst items = collectExpectedItems(issue, schema, input)\n\tconst body = items.length > 0 ? renderExpectedHeading(items).join(\"\\n\") : issue.message\n\tconst separator = body.includes(\"\\n\") ? \"\\n\" : \" \"\n\treturn `Invalid value ${formatLiteral(input)}:${separator}${body}`\n}\n\nfunction collectExpectedItems(\n\tissue: z.core.$ZodIssue,\n\tschema: z.core.$ZodType | undefined,\n\tinput: unknown,\n): ExpectedItem[] {\n\tif (issue.code === \"invalid_union\") {\n\t\tif (schema instanceof z.ZodDiscriminatedUnion && issue.discriminator !== undefined) {\n\t\t\tconst values = [...(schema._zod.propValues[issue.discriminator] ?? [])]\n\t\t\treturn [{ heading: \"One of\", children: values.map(formatLiteral) }]\n\t\t}\n\t\tconst branchSchemas = getUnionBranchSchemas(schema)\n\t\treturn issue.errors.flatMap((branchIssues, branchIndex) =>\n\t\t\tcollectUnionBranchExpectedItems(branchIssues, branchSchemas?.[branchIndex], input),\n\t\t)\n\t}\n\n\tif (issue.code === \"invalid_value\") {\n\t\tif (issue.values.length === 1) return [formatLiteral(issue.values[0])]\n\t\treturn [{ heading: \"One of\", children: issue.values.map(formatLiteral) }]\n\t}\n\n\tif (issue.code === \"invalid_type\") return [issue.expected]\n\n\treturn []\n}\n\nfunction collectUnionBranchExpectedItems(\n\tbranchIssues: readonly z.core.$ZodIssue[],\n\tbranchSchema: z.core.$ZodType | undefined,\n\tunionInput: unknown,\n): ExpectedItem[] {\n\tconst description = getSchemaDescription(branchSchema)\n\tif (description === undefined) {\n\t\tconst shapeMismatchIssues = branchIssues.filter(issue => issue.path.length === 0 && issue.code !== \"custom\")\n\t\tif (shapeMismatchIssues.length > 0) {\n\t\t\treturn shapeMismatchIssues.flatMap(issue => collectExpectedItems(issue, branchSchema, unionInput))\n\t\t}\n\t}\n\n\tconst heading = buildBranchHeading(description ?? describeInputType(unionInput), branchIssues)\n\tconst nestedIssues = branchIssues.filter(issue => issue.path.length > 0)\n\tif (nestedIssues.length === 0) return [heading]\n\n\tconst children = nestedIssues.map(issue => formatNestedIssueExpectedItem(issue, branchSchema, unionInput))\n\treturn [{ heading, children }]\n}\n\nfunction buildBranchHeading(baseItem: string, branchIssues: readonly z.core.$ZodIssue[]): string {\n\tconst rootCustomMessages = branchIssues\n\t\t.filter(issue => issue.path.length === 0 && issue.code === \"custom\")\n\t\t.map(issue => issue.message)\n\tif (rootCustomMessages.length === 0) return baseItem\n\treturn `${baseItem} (${rootCustomMessages.join(\"; \")})`\n}\n\nfunction formatNestedIssueExpectedItem(\n\tissue: z.core.$ZodIssue,\n\tbranchSchema: z.core.$ZodType | undefined,\n\tbranchInput: unknown,\n): ExpectedItem {\n\tconst path = formatPath(issue.path)\n\tif (issue.code === \"invalid_union\") {\n\t\tconst innerSchema = branchSchema ? getSchemaAtPath(branchSchema, issue.path) : undefined\n\t\tconst innerInput = getValueAtPath(branchInput, issue.path)\n\t\tconst items = collectExpectedItems(issue, innerSchema, innerInput)\n\t\treturn { heading: path, children: items }\n\t}\n\treturn `${path}: ${issue.message}`\n}\n\nfunction renderExpectedHeading(items: readonly ExpectedItem[]): string[] {\n\tconst [first] = items\n\tif (first !== undefined && items.length === 1) {\n\t\tif (typeof first === \"string\") return [`Expected: ${first}`]\n\t\treturn [`Expected ${first.heading.toLowerCase()}: ${renderInlineItems(first.children)}`]\n\t}\n\treturn [`- Expected one of:`, ...renderItems(items, 1)]\n}\n\nfunction renderInlineItems(items: readonly ExpectedItem[]): string {\n\tassert(\n\t\titems.every(item => typeof item === \"string\"),\n\t\t\"Expected inline items to be flat\",\n\t)\n\treturn items.join(\" | \")\n}\n\nfunction renderItems(items: readonly ExpectedItem[], depth: number): string[] {\n\tconst indent = \"  \".repeat(depth)\n\treturn items.flatMap(item => {\n\t\tif (typeof item === \"string\") return [`${indent}- ${item}`]\n\t\tif (item.heading === \"One of\" && item.children.every(child => typeof child === \"string\")) {\n\t\t\treturn [`${indent}- ${item.heading}: ${renderInlineItems(item.children)}`]\n\t\t}\n\t\treturn [`${indent}- ${item.heading}:`, ...renderItems(item.children, depth + 1)]\n\t})\n}\n\nfunction getSchemaAtPath(schema: z.core.$ZodType, path: readonly PropertyKey[]): z.core.$ZodType | undefined {\n\tlet current: z.core.$ZodType | undefined = schema\n\tfor (const segment of path) {\n\t\tif (!current) return undefined\n\t\tcurrent = stepIntoSchema(current, segment)\n\t}\n\treturn current\n}\n\nfunction stepIntoSchema(schema: z.core.$ZodType, segment: PropertyKey): z.core.$ZodType | undefined {\n\tif (schema instanceof z.ZodObject) {\n\t\tif (typeof segment !== \"string\") return undefined\n\t\tconst next: unknown = schema.shape[segment]\n\t\treturn next instanceof z.core.$ZodType ? next : undefined\n\t}\n\tif (schema instanceof z.ZodArray) return schema.element\n\tif (schema instanceof z.ZodDiscriminatedUnion) {\n\t\treturn schema._zod.def.discriminator === segment ? schema : undefined\n\t}\n\treturn undefined\n}\n\nfunction getUnionBranchSchemas(schema: z.core.$ZodType | undefined): readonly z.core.$ZodType[] | undefined {\n\tif (schema instanceof z.ZodUnion) return schema.options\n\treturn undefined\n}\n\nfunction getSchemaDescription(schema: z.core.$ZodType | undefined): string | undefined {\n\tif (!(schema instanceof z.ZodType)) return undefined\n\tif (schema.description !== undefined) return schema.description\n\tif (schema instanceof z.ZodPipe) return getSchemaDescription(schema.in)\n\treturn undefined\n}\n\nfunction getValueAtPath(input: unknown, path: readonly PropertyKey[]): unknown {\n\tlet current = input\n\tfor (const segment of path) {\n\t\tif (!isIndexable(current)) return undefined\n\t\tcurrent = current[segment]\n\t}\n\treturn current\n}\n\nfunction isIndexable(value: unknown): value is Record<PropertyKey, unknown> {\n\treturn typeof value === \"object\" && value !== null\n}\n\nfunction formatLiteral(value: unknown): string {\n\tif (typeof value === \"string\") return JSON.stringify(value)\n\treturn `\\`${JSON.stringify(value)}\\``\n}\n\nfunction formatPath(path: readonly PropertyKey[]): string {\n\tlet formatted = \"\"\n\tfor (const segment of path) {\n\t\tif (typeof segment === \"number\") {\n\t\t\tformatted += `[${segment}]`\n\t\t} else {\n\t\t\tformatted += formatted.length > 0 ? `.${String(segment)}` : String(segment)\n\t\t}\n\t}\n\treturn formatted\n}\n\nfunction describeInputType(input: unknown): string {\n\tif (input === undefined) return \"undefined\"\n\tif (input === null) return \"null\"\n\tif (Array.isArray(input)) return \"array\"\n\treturn typeof input\n}\n", "import { assert, assertNever } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type {\n\tCollectionFilterTransform,\n\tCollectionFilterTransformName,\n\tPublicValueTransformName,\n\tValueTransform,\n\tValueTransformContains,\n\tValueTransformContainsAll,\n\tValueTransformContainsAny,\n\tValueTransformConvertFromBoolean,\n\tValueTransformConvertFromEnum,\n\tValueTransformConvertFromString,\n\tValueTransformEndsWith,\n\tValueTransformEnumToDisplayName,\n\tValueTransformEquals,\n\tValueTransformExtractDateSegment,\n\tValueTransformGreaterThan,\n\tValueTransformIsAfter,\n\tValueTransformIsBefore,\n\tValueTransformIsBetweenDates,\n\tValueTransformIsIncludedIn,\n\tValueTransformIsSet,\n\tValueTransformLessThan,\n\tValueTransformName,\n\tValueTransformNegate,\n\tValueTransformNumberToString,\n\tValueTransformStartsWith,\n\tValueTransformToDateString,\n\tValueTransformWithoutIdAndType,\n} from \"document/models/CanvasTree/traits/ValueTransform.ts\"\nimport {\n\tdateSegmentOptions,\n\tisCollectionFilterTransform,\n\tisPublicValueTransformName,\n\tnumberToStringCompactDisplayOptions,\n\tnumberToStringCurrencyDisplayOptions,\n\tnumberToStringNotationOptions,\n\tnumberToStringStyles,\n\tnumberToStringUnitDisplayOptions,\n\tqueryableValueTransformName,\n\tvalueTransformOutputTypes,\n} from \"document/models/CanvasTree/traits/ValueTransform.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\tdateDisplayOptions,\n\tdateStyleOptions,\n\tDEFAULT_DATE_STYLE,\n\tgetAllDateFormatOptions,\n} from \"document/models/CanvasTree/traits/utils/toDateStringTransformOptions.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { isArray, isBoolean, isNull, isNumber, isString } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { DynamicValues } from \"../context/dynamicValues.ts\"\nimport type { VirtualRichTextNode } from \"../context/richtext/document.ts\"\nimport { jsonString, numericString } from \"../schemaUtils.ts\"\nimport { type DSLAttributes, type DSLAttributeValue, toRoundedNumber, type TraitWarning } from \"./types.ts\"\nimport { zodErrorToWarnings } from \"./zodErrorToWarnings.ts\"\n\ntype PublicValueTransform = Extract<ValueTransform, { name: PublicValueTransformName }>\ntype ValueTransformSerializationNode = CanvasNode | VirtualRichTextNode\nexport interface FilterDefinition {\n\tvariableId: string\n\ttransforms: ValueTransformWithoutIdAndType<CollectionFilterTransform>[]\n}\n\nfunction isPublicValueTransform(transform: ValueTransform): transform is PublicValueTransform {\n\treturn isPublicValueTransformName(transform.name)\n}\n\nconst dateFormatOptions = getAllDateFormatOptions()\n\ninterface ValueTransformSchemaOptions {\n\tallowedNames?: ReadonlySet<ValueTransformName>\n}\n\nfunction createValueTransformSchema(\n\tnode: CanvasNode,\n\tdynamicValues: DynamicValues,\n\tresolveLlmIdToNodeId: (value: string) => NodeID | undefined,\n\toptions: ValueTransformSchemaOptions = {},\n) {\n\tconst variableReference = z.string().transform((value, zodContext) => {\n\t\tconst resolveHandleResult = dynamicValues.resolveHandleFromAttribute(value, { node })\n\n\t\tif (resolveHandleResult.type === \"resolved\") {\n\t\t\tconst resolved = resolveHandleResult.handle.reference(node)\n\n\t\t\tif (isComputedValue(resolved)) {\n\t\t\t\tzodContext.addIssue({ code: \"custom\", message: \"`ComputedValue`s can't be nested\" })\n\t\t\t\treturn z.NEVER\n\t\t\t}\n\n\t\t\treturn resolved\n\t\t}\n\n\t\tif (resolveHandleResult.type === \"invalid\") {\n\t\t\tresolveHandleResult.errorMessages.forEach(message => {\n\t\t\t\tzodContext.addIssue({ code: \"custom\", message })\n\t\t\t})\n\t\t\treturn z.NEVER\n\t\t}\n\n\t\tzodContext.addIssue({ code: \"custom\", message: `Failed to resolve \"${value}\"` })\n\t\treturn z.NEVER\n\t})\n\n\tconst llmId = z.string().transform((value, zodContext) => {\n\t\tconst resolvedId = resolveLlmIdToNodeId(value)\n\t\tif (!resolvedId) {\n\t\t\tzodContext.addIssue({ code: \"custom\", message: `Unknown alias: \"${value}\"` })\n\t\t\treturn z.NEVER\n\t\t}\n\t\treturn resolvedId\n\t})\n\n\tconst stringOrVariableReference = variableReference.or(z.string())\n\tconst stringArrayOrVariableReference = z.union([z.array(z.string()), variableReference])\n\tconst numberOrNumericString = z.union([z.number(), numericString])\n\tconst numericStringOrVariableReference = z.union([variableReference, numericString])\n\tconst transformOutputValue = z.union([variableReference, llmId, z.string(), z.number(), z.boolean(), z.null()])\n\n\tfunction valueTransform<T extends ValueTransform>(\n\t\tschema: z.ZodObject<z.core.$ZodShape> & z.ZodType<Omit<T, \"id\" | \"type\">>,\n\t): z.ZodType<T> & z.core.$ZodTypeDiscriminable {\n\t\treturn schema.transform(parsed => ({ id: randomID(), type: \"valueTransform\" as const, ...parsed }) as T)\n\t}\n\n\tconst TransformContains = valueTransform<ValueTransformContains>(\n\t\tz.object({\n\t\t\tname: z.literal(\"contains\"),\n\t\t\tvalue: stringOrVariableReference,\n\t\t}),\n\t)\n\n\tconst TransformContainsAll = valueTransform<ValueTransformContainsAll>(\n\t\tz.object({\n\t\t\tname: z.literal(\"containsAll\"),\n\t\t\tvalue: stringArrayOrVariableReference,\n\t\t}),\n\t)\n\n\tconst TransformContainsAny = valueTransform<ValueTransformContainsAny>(\n\t\tz.object({\n\t\t\tname: z.literal(\"containsAny\"),\n\t\t\tvalue: stringArrayOrVariableReference,\n\t\t}),\n\t)\n\n\tconst ConvertFromEnumCaseSchema = z.object({\n\t\tfrom: z.string(),\n\t\tto: transformOutputValue,\n\t})\n\n\tconst TransformConvertFromEnum = valueTransform<ValueTransformConvertFromEnum>(\n\t\tz.object({\n\t\t\tname: z.literal(\"convertFromEnum\"),\n\t\t\toutputType: z.enum(valueTransformOutputTypes.convertFromEnum),\n\t\t\tcases: z.array(ConvertFromEnumCaseSchema.transform(parsed => ({ id: randomID(), ...parsed }))),\n\t\t\tdefault: transformOutputValue,\n\t\t}),\n\t)\n\n\tconst ConvertFromStringCaseSchema = z.object({\n\t\tfrom: z.string(),\n\t\tto: transformOutputValue,\n\t})\n\n\tconst TransformConvertFromString = valueTransform<ValueTransformConvertFromString>(\n\t\tz.object({\n\t\t\tname: z.literal(\"convertFromString\"),\n\t\t\toutputType: z.enum(valueTransformOutputTypes.convertFromString),\n\t\t\tcases: z.array(ConvertFromStringCaseSchema.transform(parsed => ({ id: randomID(), ...parsed }))),\n\t\t\tdefault: transformOutputValue,\n\t\t}),\n\t)\n\n\tconst TransformConvertFromBoolean = valueTransform<ValueTransformConvertFromBoolean>(\n\t\tz.object({\n\t\t\tname: z.literal(\"convertFromBoolean\"),\n\t\t\toutputType: z.enum(valueTransformOutputTypes.convertFromBoolean),\n\t\t\ttruthy: transformOutputValue,\n\t\t\tfalsy: transformOutputValue,\n\t\t\tfallback: transformOutputValue.optional().transform(value => (value === undefined ? undefined : { value })),\n\t\t}),\n\t)\n\n\tconst TransformEndsWith = valueTransform<ValueTransformEndsWith>(\n\t\tz.object({\n\t\t\tname: z.literal(\"endsWith\"),\n\t\t\tvalue: stringOrVariableReference,\n\t\t}),\n\t)\n\n\tconst TransformEquals = valueTransform<ValueTransformEquals>(\n\t\tz.object({\n\t\t\tname: z.literal(\"equals\"),\n\t\t\tvalue: z.union([stringOrVariableReference, z.number(), z.boolean(), z.null()]),\n\t\t}),\n\t)\n\n\tconst TransformGreaterThan = valueTransform<ValueTransformGreaterThan>(\n\t\tz.object({\n\t\t\tname: z.literal(\"greaterThan\"),\n\t\t\tvalue: z.union([z.number(), numericStringOrVariableReference]),\n\t\t}),\n\t)\n\n\tconst TransformIsAfter = valueTransform<ValueTransformIsAfter>(\n\t\tz.object({\n\t\t\tname: z.literal(\"isAfter\"),\n\t\t\tvalue: stringOrVariableReference.or(z.undefined()),\n\t\t}),\n\t)\n\n\tconst TransformIsBefore = valueTransform<ValueTransformIsBefore>(\n\t\tz.object({\n\t\t\tname: z.literal(\"isBefore\"),\n\t\t\tvalue: stringOrVariableReference.or(z.undefined()),\n\t\t}),\n\t)\n\n\tconst TransformIsBetweenDates = valueTransform<ValueTransformIsBetweenDates>(\n\t\tz.object({\n\t\t\tname: z.literal(\"isBetweenDates\"),\n\t\t\tstart: stringOrVariableReference.or(z.undefined()),\n\t\t\tend: stringOrVariableReference.or(z.undefined()),\n\t\t}),\n\t)\n\n\tconst TransformIsIncludedIn = valueTransform<ValueTransformIsIncludedIn>(\n\t\tz.object({\n\t\t\tname: z.literal(\"isIncludedIn\"),\n\t\t\tvalue: stringArrayOrVariableReference.or(z.undefined()),\n\t\t}),\n\t)\n\n\tconst TransformIsSet = valueTransform<ValueTransformIsSet>(\n\t\tz.object({\n\t\t\tname: z.literal(\"isSet\"),\n\t\t}),\n\t)\n\n\tconst TransformLessThan = valueTransform<ValueTransformLessThan>(\n\t\tz.object({\n\t\t\tname: z.literal(\"lessThan\"),\n\t\t\tvalue: z.union([z.number(), numericStringOrVariableReference]),\n\t\t}),\n\t)\n\n\tconst TransformNegate = valueTransform<ValueTransformNegate>(\n\t\tz.object({\n\t\t\tname: z.literal(\"negate\"),\n\t\t}),\n\t)\n\n\tconst TransformStartsWith = valueTransform<ValueTransformStartsWith>(\n\t\tz.object({\n\t\t\tname: z.literal(\"startsWith\"),\n\t\t\tvalue: stringOrVariableReference,\n\t\t}),\n\t)\n\n\tconst TransformToString = valueTransform<Extract<ValueTransform, { name: \"toString\" }>>(\n\t\tz.object({ name: z.literal(\"toString\") }),\n\t)\n\n\tconst TransformPrefix = valueTransform<Extract<ValueTransform, { name: \"prefix\" }>>(\n\t\tz.object({\n\t\t\tname: z.literal(\"prefix\"),\n\t\t\tvalue: stringOrVariableReference,\n\t\t}),\n\t)\n\n\tconst TransformSuffix = valueTransform<Extract<ValueTransform, { name: \"suffix\" }>>(\n\t\tz.object({\n\t\t\tname: z.literal(\"suffix\"),\n\t\t\tvalue: stringOrVariableReference,\n\t\t}),\n\t)\n\n\tconst TransformEnumToDisplayName = valueTransform<ValueTransformEnumToDisplayName>(\n\t\tz.object({ name: z.literal(\"enumToDisplayName\") }),\n\t)\n\n\tconst TransformIsEven = valueTransform<Extract<ValueTransform, { name: \"isEven\" }>>(\n\t\tz.object({ name: z.literal(\"isEven\") }),\n\t)\n\n\tconst TransformIsOdd = valueTransform<Extract<ValueTransform, { name: \"isOdd\" }>>(\n\t\tz.object({ name: z.literal(\"isOdd\") }),\n\t)\n\n\tconst TransformArrayLength = valueTransform<Extract<ValueTransform, { name: \"arrayLength\" }>>(\n\t\tz.object({ name: z.literal(\"arrayLength\") }),\n\t)\n\n\tconst TransformExtractDateSegment = valueTransform<ValueTransformExtractDateSegment>(\n\t\tz.object({\n\t\t\tname: z.literal(\"extractDateSegment\"),\n\t\t\tsegment: z.enum(dateSegmentOptions),\n\t\t}),\n\t)\n\n\tconst TransformToggleInList = valueTransform<Extract<ValueTransform, { name: \"toggleInList\" }>>(\n\t\tz.object({\n\t\t\tname: z.literal(\"toggleInList\"),\n\t\t\tvalue: stringOrVariableReference,\n\t\t}),\n\t)\n\n\tconst TransformNumberToString = valueTransform<ValueTransformNumberToString>(\n\t\tz.object({\n\t\t\tname: z.literal(\"numberToString\"),\n\t\t\tlocale: z.string().optional(),\n\t\t\tgrouping: z.union([z.literal(\"auto\"), z.boolean()]).default(\"auto\"),\n\t\t\tnotation: z.enum(numberToStringNotationOptions).default(\"standard\"),\n\t\t\tcompactDisplay: z.enum(numberToStringCompactDisplayOptions).default(\"short\"),\n\t\t\tstyle: z.enum(numberToStringStyles).default(\"decimal\"),\n\t\t\tcurrency: z.string().default(\"USD\"),\n\t\t\tcurrencyDisplay: z.enum(numberToStringCurrencyDisplayOptions).default(\"symbol\"),\n\t\t\tunit: z.string().default(\"\"),\n\t\t\tunitDisplay: z.enum(numberToStringUnitDisplayOptions).default(\"short\"),\n\t\t\tminimumIntegerDigits: numberOrNumericString.pipe(z.number().int().min(1).max(21)).optional(),\n\t\t\tminimumFractionDigits: numberOrNumericString.pipe(z.number().int().min(0).max(20)).optional(),\n\t\t\tmaximumFractionDigits: numberOrNumericString.pipe(z.number().int().min(0).max(20)).optional(),\n\t\t}),\n\t)\n\n\tconst TransformToDateString = valueTransform<ValueTransformToDateString>(\n\t\tz.object({\n\t\t\tname: z.literal(\"toDateString\"),\n\t\t\tlocale: z.string().optional(),\n\t\t\tdisplay: z.enum(dateDisplayOptions).optional(),\n\t\t\tformat: z.enum(dateFormatOptions).optional(),\n\t\t\tdateStyle: z.enum(dateStyleOptions).default(DEFAULT_DATE_STYLE),\n\t\t\tcapitalize: z.boolean().optional(),\n\t\t}),\n\t)\n\n\tconst allTransformSchemas = {\n\t\tcontains: TransformContains,\n\t\tcontainsAll: TransformContainsAll,\n\t\tcontainsAny: TransformContainsAny,\n\t\tconvertFromEnum: TransformConvertFromEnum,\n\t\tconvertFromString: TransformConvertFromString,\n\t\tconvertFromBoolean: TransformConvertFromBoolean,\n\t\tendsWith: TransformEndsWith,\n\t\tequals: TransformEquals,\n\t\tgreaterThan: TransformGreaterThan,\n\t\tisAfter: TransformIsAfter,\n\t\tisBefore: TransformIsBefore,\n\t\tisBetweenDates: TransformIsBetweenDates,\n\t\tisIncludedIn: TransformIsIncludedIn,\n\t\tisSet: TransformIsSet,\n\t\tlessThan: TransformLessThan,\n\t\tnegate: TransformNegate,\n\t\tstartsWith: TransformStartsWith,\n\t\tprefix: TransformPrefix,\n\t\tsuffix: TransformSuffix,\n\t\ttoString: TransformToString,\n\t\ttoDateString: TransformToDateString,\n\t\tnumberToString: TransformNumberToString,\n\t\tisEven: TransformIsEven,\n\t\tisOdd: TransformIsOdd,\n\t\tenumToDisplayName: TransformEnumToDisplayName,\n\t\tarrayLength: TransformArrayLength,\n\t\textractDateSegment: TransformExtractDateSegment,\n\t\ttoggleInList: TransformToggleInList,\n\t} satisfies Record<PublicValueTransformName, z.ZodType<ValueTransform> & z.core.$ZodTypeDiscriminable>\n\n\ttype ValueTransformSchema = z.ZodType<ValueTransform> & z.core.$ZodTypeDiscriminable\n\tconst enabledSchemas: ValueTransformSchema[] = []\n\tfor (const [name, schema] of Object.entries(allTransformSchemas) as [ValueTransformName, ValueTransformSchema][]) {\n\t\tif (options.allowedNames && !options.allowedNames.has(name)) continue\n\t\tenabledSchemas.push(schema)\n\t}\n\n\tassert(enabledSchemas.length > 0, \"Must allow at least one trasform\")\n\n\tconst TransformEntryObject = z.discriminatedUnion(\n\t\t\"name\",\n\t\tenabledSchemas as [ValueTransformSchema, ...ValueTransformSchema[]],\n\t)\n\n\treturn jsonString.pipe(TransformEntryObject).or(TransformEntryObject)\n}\n\nexport function createFilterSchema(node: CanvasNode, dynamicValues: DynamicValues) {\n\tconst TransformEntry = createValueTransformSchema(\n\t\tnode,\n\t\tdynamicValues,\n\t\t// Filters don't need llmId -> nodeId resolution\n\t\t() => undefined,\n\t\t{\n\t\t\tallowedNames: queryableValueTransformName,\n\t\t},\n\t)\n\n\tconst FilterTransforms = z.array(TransformEntry).transform((transforms, zodContext): CollectionFilterTransform[] => {\n\t\tif (transforms.every(isCollectionFilterTransform)) return transforms\n\n\t\tconst invalidTransform = transforms.find(transform => !isCollectionFilterTransform(transform))\n\t\tif (!invalidTransform) {\n\t\t\tzodContext.addIssue({ code: \"custom\", message: \"Invalid collection filter transforms\" })\n\t\t\treturn z.NEVER\n\t\t}\n\n\t\tzodContext.addIssue({\n\t\t\tcode: \"custom\",\n\t\t\tmessage: `Transform \"${invalidTransform.name}\" is not supported in collection filters`,\n\t\t})\n\t\treturn z.NEVER\n\t})\n\n\tconst resolvedVariableId = z.string().transform(value => {\n\t\tconst handle = dynamicValues.getVariableReferenceHandleByVariableId(value)\n\t\treturn handle ? handle.variable.id : value\n\t})\n\n\tconst FilterEntryObject = z\n\t\t.object({\n\t\t\tvariableId: resolvedVariableId,\n\t\t\ttransforms: FilterTransforms,\n\t\t})\n\t\t.transform(entry => coerceStringBooleanForBooleanVariable(entry, dynamicValues))\n\t\t.transform(entry => coerceEnumCaseNameForEnumVariable(entry, dynamicValues))\n\n\tconst FilterEntry = jsonString.pipe(FilterEntryObject).or(FilterEntryObject)\n\treturn jsonString.pipe(z.array(FilterEntry)).or(z.array(FilterEntry))\n}\n\ntype ParseValueTransformsResult =\n\t| { success: true; data: ValueTransform[] }\n\t| { success: false; warnings: TraitWarning[] }\n\nexport function parseValueTransforms(\n\trawTransforms: unknown,\n\tnode: CanvasNode,\n\tdynamicValues: DynamicValues,\n\tresolveLlmIdToNodeId: (value: string) => NodeID | undefined,\n\tkeyPrefix = \"transforms\",\n): ParseValueTransformsResult {\n\tconst schema = z.array(createValueTransformSchema(node, dynamicValues, resolveLlmIdToNodeId))\n\tconst result = schema.safeParse(rawTransforms)\n\n\tif (result.success) return { success: true, data: result.data }\n\n\treturn {\n\t\tsuccess: false,\n\t\twarnings: zodErrorToWarnings({ error: result.error, schema, keyPrefix, input: rawTransforms }),\n\t}\n}\n\nconst filterPrefix = \"collectionList.filters.<i>.transforms.<i>\"\n\nexport const filterTransformDocumentation: Record<CollectionFilterTransformName, string> = {\n\tcontains: `${filterPrefix}.name=\"contains\" ${filterPrefix}.value=\"search term\"`,\n\tcontainsAll: `${filterPrefix}.name=\"containsAll\" ${filterPrefix}.value=\"[\"id1\", \"id2\"]\"`,\n\tcontainsAny: `${filterPrefix}.name=\"containsAny\" ${filterPrefix}.value=\"[\"id1\", \"id2\"]\"`,\n\tconvertFromEnum: `${filterPrefix}.name=\"convertFromEnum\" ${filterPrefix}.outputType=\"boolean\" ${filterPrefix}.cases.<i>.from=\"optionA\" ${filterPrefix}.cases.<i>.to=\"true\" ${filterPrefix}.default=\"false\" \u2014 map multiple enum options to a value`,\n\tconvertFromString: `${filterPrefix}.name=\"convertFromString\" ${filterPrefix}.outputType=\"boolean\" ${filterPrefix}.cases.<i>.from=\"Beginner\" ${filterPrefix}.cases.<i>.to=\"true\" ${filterPrefix}.default=\"false\" \u2014 map multiple string values to a value`,\n\tendsWith: `${filterPrefix}.name=\"endsWith\" ${filterPrefix}.value=\"suffix\"`,\n\tequals: `${filterPrefix}.name=\"equals\" ${filterPrefix}.value=\"text\" | 5 | true | null`,\n\tgreaterThan: `${filterPrefix}.name=\"greaterThan\" ${filterPrefix}.value=\"10\"`,\n\tisAfter: `${filterPrefix}.name=\"isAfter\" ${filterPrefix}.value=\"2025-01-01\"`,\n\tisBefore: `${filterPrefix}.name=\"isBefore\" ${filterPrefix}.value=\"2025-01-01\"`,\n\tisBetweenDates: `${filterPrefix}.name=\"isBetweenDates\" ${filterPrefix}.start=\"2025-01-01\" ${filterPrefix}.end=\"2025-12-31\"`,\n\tisIncludedIn: `${filterPrefix}.name=\"isIncludedIn\" ${filterPrefix}.value=\"[\"id1\", \"id2\"]\"`,\n\tisSet: `${filterPrefix}.name=\"isSet\"`,\n\tlessThan: `${filterPrefix}.name=\"lessThan\" ${filterPrefix}.value=\"100\"`,\n\tnegate: `${filterPrefix}.name=\"negate\" \u2014 inverts a boolean result, place after another transform`,\n\tstartsWith: `${filterPrefix}.name=\"startsWith\" ${filterPrefix}.value=\"prefix\"`,\n}\n\nfunction serializeTransformValue(\n\tvalue: unknown,\n\tnode: ValueTransformSerializationNode,\n\tdynamicValues: DynamicValues,\n): DSLAttributeValue {\n\tif (isVariableReference(value)) {\n\t\treturn dynamicValues.resolveAttributeFromDynamicValue(value, node)\n\t}\n\tif (isArray(value)) {\n\t\treturn value.map(item => serializeTransformValue(item, node, dynamicValues))\n\t}\n\tif (isString(value) || isBoolean(value) || isNull(value)) {\n\t\treturn value\n\t}\n\tif (isNumber(value)) {\n\t\treturn toRoundedNumber(value)\n\t}\n\treturn undefined\n}\n\nexport function serializeValueTransform(\n\ttransform: ValueTransform,\n\tnode: ValueTransformSerializationNode,\n\tdynamicValues: DynamicValues,\n): DSLAttributes {\n\tconst result: DSLAttributes = { name: transform.name }\n\n\tif (!isPublicValueTransform(transform)) return result\n\n\tswitch (transform.name) {\n\t\tcase \"contains\":\n\t\tcase \"containsAll\":\n\t\tcase \"containsAny\":\n\t\tcase \"endsWith\":\n\t\tcase \"equals\":\n\t\tcase \"greaterThan\":\n\t\tcase \"isAfter\":\n\t\tcase \"isBefore\":\n\t\tcase \"isIncludedIn\":\n\t\tcase \"lessThan\":\n\t\tcase \"startsWith\":\n\t\tcase \"prefix\":\n\t\tcase \"suffix\":\n\t\tcase \"toggleInList\": {\n\t\t\tresult.value = serializeTransformValue(transform.value, node, dynamicValues)\n\t\t\tbreak\n\t\t}\n\n\t\tcase \"isBetweenDates\": {\n\t\t\tresult.start = serializeTransformValue(transform.start, node, dynamicValues)\n\t\t\tresult.end = serializeTransformValue(transform.end, node, dynamicValues)\n\t\t\tbreak\n\t\t}\n\n\t\tcase \"convertFromEnum\":\n\t\tcase \"convertFromString\": {\n\t\t\tresult.cases = transform.cases.map(({ from, to }) => ({\n\t\t\t\tfrom,\n\t\t\t\tto: serializeTransformValue(to, node, dynamicValues),\n\t\t\t}))\n\t\t\tresult.default = serializeTransformValue(transform.default, node, dynamicValues)\n\t\t\tresult.outputType = transform.outputType\n\t\t\tbreak\n\t\t}\n\n\t\tcase \"convertFromBoolean\": {\n\t\t\tresult.outputType = transform.outputType\n\t\t\tresult.truthy = serializeTransformValue(transform.truthy, node, dynamicValues)\n\t\t\tresult.falsy = serializeTransformValue(transform.falsy, node, dynamicValues)\n\t\t\tif (transform.fallback) {\n\t\t\t\tresult.fallback = serializeTransformValue(transform.fallback.value, node, dynamicValues)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tcase \"toDateString\": {\n\t\t\tif (transform.locale) result.locale = transform.locale\n\t\t\tif (transform.display) result.display = transform.display\n\t\t\tif (transform.format) result.format = transform.format\n\t\t\tresult.dateStyle = transform.dateStyle\n\t\t\tif (transform.capitalize) result.capitalize = transform.capitalize\n\t\t\tbreak\n\t\t}\n\n\t\tcase \"numberToString\": {\n\t\t\tif (transform.locale) result.locale = transform.locale\n\t\t\tresult.grouping = transform.grouping\n\t\t\tresult.notation = transform.notation\n\t\t\tresult.compactDisplay = transform.compactDisplay\n\t\t\tresult.style = transform.style\n\t\t\tif (transform.currency) result.currency = transform.currency\n\t\t\tresult.currencyDisplay = transform.currencyDisplay\n\t\t\tif (transform.unit) result.unit = transform.unit\n\t\t\tresult.unitDisplay = transform.unitDisplay\n\t\t\tif (transform.minimumIntegerDigits !== undefined) {\n\t\t\t\tresult.minimumIntegerDigits = toRoundedNumber(transform.minimumIntegerDigits)\n\t\t\t}\n\t\t\tif (transform.minimumFractionDigits !== undefined) {\n\t\t\t\tresult.minimumFractionDigits = toRoundedNumber(transform.minimumFractionDigits)\n\t\t\t}\n\t\t\tif (transform.maximumFractionDigits !== undefined) {\n\t\t\t\tresult.maximumFractionDigits = toRoundedNumber(transform.maximumFractionDigits)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\n\t\tcase \"extractDateSegment\": {\n\t\t\tresult.segment = transform.segment\n\t\t\tbreak\n\t\t}\n\n\t\tcase \"isSet\":\n\t\tcase \"negate\":\n\t\tcase \"toString\":\n\t\tcase \"enumToDisplayName\":\n\t\tcase \"isEven\":\n\t\tcase \"isOdd\":\n\t\tcase \"arrayLength\": {\n\t\t\tbreak\n\t\t}\n\n\t\tdefault:\n\t\t\tassertNever(transform)\n\t}\n\n\treturn result\n}\n\n/**\n * The agent will send \"true\"/\"false\" strings for boolean variable filters.\n * Coerce them to actual booleans so the equals transform displays in the UI correctly.\n */\nfunction coerceStringBooleanForBooleanVariable(\n\tentry: { variableId: string; transforms: CollectionFilterTransform[] },\n\tdynamicValues: DynamicValues,\n): { variableId: string; transforms: CollectionFilterTransform[] } {\n\tif (!isBooleanVariable(entry.variableId, dynamicValues)) return entry\n\tconst first = entry.transforms[0]\n\tif (!first || first.name !== \"equals\") return entry\n\n\tconst coerced = first.value === \"true\" ? true : first.value === \"false\" ? false : first.value\n\tif (coerced === first.value) return entry\n\n\tconst coercedTransform: ValueTransformEquals = { ...first, value: coerced }\n\treturn {\n\t\t...entry,\n\t\ttransforms: [coercedTransform, ...entry.transforms.slice(1)],\n\t}\n}\n\nfunction isBooleanVariable(variableId: string, dynamicValues: DynamicValues): boolean {\n\tconst handle = dynamicValues.getVariableReferenceHandleByVariableId(variableId)\n\tif (!handle) return false\n\treturn handle.variable.type === ControlType.Boolean\n}\n\n/**\n * Allow the agent to use enum case names as aliases for enum case ids.\n */\nfunction coerceEnumCaseNameForEnumVariable(\n\tentry: { variableId: string; transforms: CollectionFilterTransform[] },\n\tdynamicValues: DynamicValues,\n): { variableId: string; transforms: CollectionFilterTransform[] } {\n\tconst variableHandle = dynamicValues.getVariableReferenceHandleByVariableId(entry.variableId)\n\tif (variableHandle?.variable.type !== ControlType.Enum) return entry\n\n\tconst firstTransform = entry.transforms[0]\n\tif (firstTransform?.name !== \"equals\" || !isString(firstTransform.value)) return entry\n\n\tconst matchingCase = variableHandle.variable.cases.find(enumCase => enumCase.name === firstTransform.value)\n\tif (!matchingCase) return entry\n\n\tconst coercedTransform: ValueTransformEquals = { ...firstTransform, value: matchingCase.id }\n\n\treturn {\n\t\t...entry,\n\t\ttransforms: [coercedTransform, ...entry.transforms.slice(1)],\n\t}\n}\n", "/**\n * Error thrown by traits when an update cannot be applied immediately.\n *\n * Traits should throw this when they encounter a condition that prevents the update from being\n * applied (e.g., setting auto-size on a frame before its children are added). The error will be\n * caught and the trait will be retried on subsequent passes.\n */\nexport class DeferTraitError extends Error {\n\tconstructor(message = \"Trait update deferred\") {\n\t\tsuper(message)\n\t\tthis.name = \"DeferTraitError\"\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { collectionIdKey } from \"code-generation/components/cms/dataIdKeys.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionNode, isCollectionRepeater } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ComputedValue, ComputedValueOutputType } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport {\n\tcreateComputedValue,\n\tisComputedValueFromVariableReference,\n\tisComputedValueOutputType,\n} from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\tgetOutputTypeForValueTransform,\n\tisKnownValueTransformName,\n\ttype ValueTransform,\n} from \"document/models/CanvasTree/traits/ValueTransform.ts\"\nimport {\n\tcreateVariableReference,\n\tisVariableReference,\n\ttype VariableReference,\n} from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport {\n\tisVariableDefinition,\n\ttype NumberVariableDefinition,\n\ttype VariableDefinition,\n\ttype VariableOrDivider,\n\ttype VariableType,\n\ttype WithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tisRepeaterVariableId,\n\tisRepeaterVariableIdAvailableToNonRepeatedChildren,\n\trepeaterVariables,\n} from \"document/utils/RepeaterVariables.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { parseCSSVariable } from \"library/render/utils/parseCSSVariable.ts\"\nimport { getCollectionIdForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { getRepeatedItemOfDataRepeater } from \"utils/repeaterUtils.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { TreeResolver } from \"../TreeResolver.ts\"\nimport { dslComputedValueFromVariableSchema } from \"../schemaUtils.ts\"\nimport { expectedAttributeMessage, unresolvedVariableMessage } from \"../traits/invalidValues.ts\"\nimport { parseValueTransforms, serializeValueTransform } from \"../traits/transforms.ts\"\nimport type { DSLAttributes, DSLAttributeValue } from \"../traits/types.ts\"\nimport { DeferTraitError } from \"./DeferTraitError.ts\"\nimport { isVirtualRichTextNode, type VirtualRichTextNode } from \"./richtext/document.ts\"\n\ntype ScopeId = NodeID\ntype VariableId = NodeID\ntype CSSVariableReference = `var(--${string})`\n\nconst variablePrefix = \"--variable-\" as const\n\nexport function createCSSVariable(id: VariableId): CSSVariableReference {\n\treturn `var(${variablePrefix}${id})`\n}\n\n/**\n * Returns true when a value looks like a CSS variable reference (e.g. `var(--variable-id)`).\n * Used to suppress misleading \"Invalid value\" warnings when an unresolved variable falls\n * through to type-checking \u2014 the agent intended a variable, not a literal value.\n *\n * @deprecated {@link DynamicValues.resolveHandleFromAttribute} should handle this case for you already.\n *  - If it is a variable reference, it will be either `resolved` or `invalid`.\n *  - If it isn't, it will be a `literal`.\n */\nexport function looksLikeVariableReference(value: unknown): value is string {\n\treturn isString(value) && value.startsWith(\"var(\")\n}\n\nfunction getRequestedVariableId(idOrReference: string): string {\n\tconst { customProperty } = parseCSSVariable(idOrReference)\n\tif (!customProperty) return idOrReference\n\tif (customProperty.startsWith(variablePrefix)) return customProperty.slice(variablePrefix.length)\n\treturn customProperty.startsWith(\"--\") ? customProperty.slice(2) : customProperty\n}\n\nfunction isVariableReferenceShape(value: DSLAttributeValue): value is string {\n\treturn isString(value) && (parseCSSVariable(value).customProperty?.startsWith(variablePrefix) ?? false)\n}\n\nfunction findCollectionProviderId(scopeId: ScopeId, node: CanvasNode): NodeID | undefined {\n\tif (!node.tree()) return\n\n\tfor (const ancestor of node.ancestors()) {\n\t\tif (!hasCollectionDataSource(ancestor)) continue\n\t\tif (getCollectionIdForIdentifier(ancestor.dataIdentifier) === scopeId) return ancestor.id\n\t}\n}\n\nexport function getCollectionItemIdVariableLlmId(collectionId: NodeID): string {\n\treturn `${collectionId}-${collectionIdKey}`\n}\n\nfunction getRepeaterVariableLlmSuffix(variableId: string): string {\n\treturn `-${variableId\n\t\t// To the agent, \"repeater\" is \"CMS Collection List\"\n\t\t.replaceAll(\"repeater_\", \"\")\n\t\t.replaceAll(\"_\", \"-\")}`\n}\n\nfunction getRepeaterVariableLlmId(repeaterId: NodeID, variableId: string): string {\n\treturn `${repeaterId}${getRepeaterVariableLlmSuffix(variableId)}`\n}\n\nfunction parseRepeaterVariableLlmId(\n\tllmId: string,\n): { repeaterId: NodeID; variable: NumberVariableDefinition } | undefined {\n\tfor (const variable of repeaterVariables) {\n\t\tconst suffix = getRepeaterVariableLlmSuffix(variable.id)\n\t\tif (llmId.endsWith(suffix)) {\n\t\t\treturn {\n\t\t\t\trepeaterId: llmId.slice(0, -suffix.length),\n\t\t\t\tvariable,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn undefined\n}\n\nfunction isVariableReferenceToCollectionItemId(\n\tvariableReference: VariableReference,\n): variableReference is VariableReference & { providerId: NodeID } {\n\treturn variableReference.id === collectionIdKey && Boolean(variableReference.providerId)\n}\n\nfunction isVariableReferenceToRepeaterVariable(\n\tvariableReference: VariableReference,\n): variableReference is VariableReference & { providerId: NodeID } {\n\treturn isRepeaterVariableId(variableReference.id) && Boolean(variableReference.providerId)\n}\n\nexport function isVariableReferenceHandleToCollectionItemId(handle: VariableReferenceHandle): boolean {\n\treturn handle.variable.id === getCollectionItemIdVariableLlmId(handle.scopeId)\n}\n\nfunction getProviderCollectionId(providerId: NodeID, node: CanvasNode | VirtualRichTextNode): NodeID {\n\tassert(\n\t\t!isVirtualRichTextNode(node),\n\t\t\"Cannot resolve a collection-item-id VariableReference from a virtual rich-text node\",\n\t)\n\n\tconst tree = node.tree()\n\tassert(tree, \"Node not in a tree, cannot resolve VariableReference provider\")\n\n\tconst provider = tree.getNode(providerId)\n\tassert(provider, \"VariableReference provider not found in tree\")\n\tassert(hasCollectionDataSource(provider), \"VariableReference provider must have a data source\")\n\n\tconst collectionId = getCollectionIdForIdentifier(provider.dataIdentifier)\n\tassert(collectionId, \"Could not get collection id from dataIdentifier\")\n\n\treturn collectionId\n}\n\nfunction makeCollectionItemIdHandle(\n\tvariableReference: VariableReference & { providerId: NodeID },\n): VariableReferenceHandle {\n\treturn {\n\t\ttype: \"variableReference\",\n\t\toutputType: ControlType.String,\n\t\tscopeId: variableReference.providerId,\n\t\tvariable: {\n\t\t\ttype: ControlType.String,\n\t\t\tid: variableReference.id,\n\t\t\tname: collectionIdKey,\n\t\t\tinitialValue: \"\",\n\t\t},\n\t\treference: () => variableReference,\n\t\ttoAttributes: (node: CanvasNode | VirtualRichTextNode) => {\n\t\t\tconst collectionId = getProviderCollectionId(variableReference.providerId, node)\n\t\t\treturn createCSSVariable(getCollectionItemIdVariableLlmId(collectionId))\n\t\t},\n\t}\n}\n\nfunction makeRepeaterVariableHandle(\n\tvariableReference: VariableReference & { providerId: NodeID },\n\tvariableDefinition: NumberVariableDefinition,\n): VariableReferenceHandle {\n\tconst llmId = getRepeaterVariableLlmId(variableReference.providerId, variableDefinition.id)\n\n\treturn {\n\t\ttype: \"variableReference\",\n\t\toutputType: getOutputTypeOfVariable(variableDefinition),\n\t\tscopeId: variableReference.providerId,\n\t\tvariable: {\n\t\t\t...variableDefinition,\n\t\t\tid: llmId,\n\t\t},\n\t\treference: () => variableReference,\n\t\ttoAttributes: () => createCSSVariable(llmId),\n\t}\n}\n\nexport interface AgentVariableDefinition {\n\tscopeId: ScopeId\n\tvariable: VariableOrDivider\n}\n\nexport interface VariableReferenceHandle extends AgentVariableDefinition {\n\ttype: \"variableReference\"\n\toutputType: VariableType\n\treference: (node: CanvasNode) => VariableReference\n\ttoAttributes: (node: CanvasNode | VirtualRichTextNode) => string\n}\n\ninterface ComputedValueHandle {\n\ttype: \"computedValue\"\n\toutputType: ComputedValueOutputType\n\treference: (node: CanvasNode) => ComputedValue\n\ttoAttributes: (node: CanvasNode | VirtualRichTextNode) => DSLAttributes\n}\n\nexport type DynamicValueHandle = VariableReferenceHandle | ComputedValueHandle\n\nexport function isVariableReferenceHandle(\n\thandle: DynamicValueHandle | null | undefined,\n): handle is VariableReferenceHandle {\n\treturn handle?.type === \"variableReference\"\n}\n\nfunction isComputedValueHandle(handle: DynamicValueHandle | null | undefined): handle is ComputedValueHandle {\n\treturn handle?.type === \"computedValue\"\n}\n\ninterface ResolveOptions {\n\tnode: CanvasNode | VirtualRichTextNode\n\texpectedType?: readonly ControlType[]\n}\n\ntype AttributeResolution =\n\t| { type: \"resolved\"; handle: DynamicValueHandle }\n\t| { type: \"literal\" }\n\t| { type: \"invalid\"; errorMessages: string[] }\n\nfunction toComputedValueHandle(\n\tstartHandle: VariableReferenceHandle,\n\ttransforms: readonly ValueTransform[],\n\tdynamicValues: DynamicValues,\n): ComputedValueHandle {\n\tconst lastTransform = transforms.at(-1)\n\tassert(lastTransform, \"ComputedValue must have at least one transform\")\n\n\tconst outputType = getOutputTypeForValueTransform(lastTransform)\n\tassert(isComputedValueOutputType(outputType), `Unexpected ComputedValue output type: ${outputType}`)\n\n\treturn {\n\t\ttype: \"computedValue\",\n\t\toutputType,\n\t\treference: (node: CanvasNode) => createComputedValue(outputType, startHandle.reference(node), transforms),\n\t\ttoAttributes: (node: CanvasNode | VirtualRichTextNode) => ({\n\t\t\tfrom: startHandle.toAttributes(node),\n\t\t\ttransforms: transforms.map(transform => serializeValueTransform(transform, node, dynamicValues)),\n\t\t}),\n\t}\n}\n\nexport class DynamicValues {\n\tprivate readonly definitions: Map<VariableId, AgentVariableDefinition> = new Map()\n\tprivate readonly variableIdByLlmId: Map<string, VariableId> = new Map()\n\tprivate treeResolver: TreeResolver | undefined\n\n\t// Accepting this in the constructor would create a circular dependency\n\tsetTreeResolver(treeResolver: TreeResolver) {\n\t\tassert(!this.treeResolver, \"DynamicValues.setTreeResolver can only be called once\")\n\t\tthis.treeResolver = treeResolver\n\t}\n\n\tadd(scopeId: NodeID, llmId: string, definition: VariableOrDivider) {\n\t\tconst entry: AgentVariableDefinition = { scopeId, variable: definition }\n\t\tthis.definitions.set(definition.id, entry)\n\t\tthis.variableIdByLlmId.set(llmId, definition.id)\n\t}\n\n\ttoJSON(): readonly AgentVariableDefinition[] {\n\t\treturn Array.from(this.definitions.values())\n\t}\n\n\tstatic fromJSON(json: readonly AgentVariableDefinition[]): DynamicValues {\n\t\tconst dynamicValues = new DynamicValues()\n\n\t\tfor (const entry of json) {\n\t\t\tdynamicValues.add(entry.scopeId, entry.variable.id, entry.variable)\n\t\t}\n\n\t\treturn dynamicValues\n\t}\n\n\treplaceNodeVariables(node: CanvasNode & WithVariables) {\n\t\tthis.removeAllFor(node.id)\n\t\tfor (const variable of node.variables) {\n\t\t\tthis.add(node.id, variable.id, variable)\n\t\t}\n\t}\n\n\tremove(id: VariableId) {\n\t\tconst resolvedId = this.variableIdByLlmId.get(id) ?? id\n\t\tconst definition = this.definitions.get(resolvedId)\n\t\tif (!definition) return\n\n\t\tthis.definitions.delete(resolvedId)\n\t\tthis.deleteAliasesForVariableId(resolvedId)\n\t}\n\n\tremoveAllFor(scopeId: NodeID) {\n\t\tfor (const [id, definition] of this.definitions) {\n\t\t\tif (definition.scopeId !== scopeId) continue\n\t\t\tthis.definitions.delete(id)\n\t\t\tthis.deleteAliasesForVariableId(id)\n\t\t}\n\t}\n\n\tresolveHandleFromAttribute(value: DSLAttributeValue, options: ResolveOptions): AttributeResolution {\n\t\tconst computedValue = dslComputedValueFromVariableSchema.safeParse(value)\n\n\t\tif (computedValue.success) {\n\t\t\tif (isVirtualRichTextNode(options.node)) {\n\t\t\t\treturn { type: \"invalid\", errorMessages: [\"`ComputedValues` are not supported in RichText nodes\"] }\n\t\t\t}\n\n\t\t\tif (computedValue.data.transforms.length === 0) {\n\t\t\t\treturn { type: \"invalid\", errorMessages: [\"`ComputedValue` must have at least one transform\"] }\n\t\t\t}\n\n\t\t\tconst startHandleResult = this.resolveHandleFromAttribute(computedValue.data.from, { node: options.node })\n\n\t\t\tif (startHandleResult.type === \"literal\") {\n\t\t\t\treturn { type: \"invalid\", errorMessages: [`Not a variable: ${computedValue.data.from}`] }\n\t\t\t}\n\n\t\t\tif (startHandleResult.type === \"invalid\") return startHandleResult\n\n\t\t\tif (isComputedValueHandle(startHandleResult.handle)) {\n\t\t\t\treturn { type: \"invalid\", errorMessages: [\"`ComputedValues` cannot be nested. `from` can only be a Variable.\"] }\n\t\t\t}\n\n\t\t\tconst parsedTransforms = parseValueTransforms(computedValue.data.transforms, options.node, this, llmId => {\n\t\t\t\tconst treeResolver = this.treeResolver\n\t\t\t\tassert(treeResolver, \"DynamicValues must be initialized with a TreeResolver\")\n\t\t\t\treturn treeResolver.get(llmId)?.id\n\t\t\t})\n\n\t\t\tif (!parsedTransforms.success) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"invalid\",\n\t\t\t\t\terrorMessages: parsedTransforms.warnings.map(warning => `${warning.key}: ${warning.message}`),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// We intentionally not check `expectedType` here. In the future, the linter will handle type mismatches.\n\t\t\t// TODO: implement computed value warnings in the linter\n\n\t\t\treturn {\n\t\t\t\ttype: \"resolved\",\n\t\t\t\thandle: toComputedValueHandle(startHandleResult.handle, parsedTransforms.data, this),\n\t\t\t}\n\t\t}\n\n\t\tif (!isString(value)) return { type: \"literal\" }\n\n\t\tconst referenceShaped = isVariableReferenceShape(value)\n\t\tconst handle =\n\t\t\tthis.getVariableReferenceHandleByVariableId(value) ?? this.getRepeaterVariableById(value, options.node)\n\n\t\tif (!handle) {\n\t\t\tif (referenceShaped) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"invalid\",\n\t\t\t\t\terrorMessages: [expectedAttributeMessage(value, unresolvedVariableMessage)],\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { type: \"literal\" }\n\t\t}\n\n\t\tconst normalizedType = variableTypeToControlType(handle.variable.type)\n\t\tif (!isUndefined(normalizedType) && options.expectedType && !options.expectedType.includes(normalizedType)) {\n\t\t\tif (referenceShaped) {\n\t\t\t\treturn {\n\t\t\t\t\ttype: \"invalid\",\n\t\t\t\t\terrorMessages: [\n\t\t\t\t\t\t`Variable \"${handle.variable.name}\" (${value}) is of type \"${normalizedType}\", expected one of: ${options.expectedType.join(\", \")}. You may need to wrap it in a transform using \\`ComputedValue\\`.`,\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn { type: \"literal\" }\n\t\t}\n\n\t\treturn { type: \"resolved\", handle }\n\t}\n\n\tresolveAttributeFromDynamicValue(\n\t\tvalue: VariableReference | undefined,\n\t\tnode: CanvasNode | VirtualRichTextNode,\n\t): string | undefined\n\tresolveAttributeFromDynamicValue(\n\t\tvalue: DynamicValue | undefined,\n\t\tnode: CanvasNode | VirtualRichTextNode,\n\t): string | DSLAttributes | undefined\n\tresolveAttributeFromDynamicValue(\n\t\tvalue: DynamicValue | undefined,\n\t\tnode: CanvasNode | VirtualRichTextNode,\n\t): string | DSLAttributes | undefined {\n\t\tif (isComputedValueFromVariableReference(value)) {\n\t\t\tconst startHandle = this.getVariableReferenceHandleByVariableReference(value.startValue)\n\t\t\tif (!startHandle) return\n\n\t\t\tconst transforms = value.transforms.filter(transform => isKnownValueTransformName(transform.name))\n\t\t\tif (transforms.length === 0) return\n\n\t\t\treturn toComputedValueHandle(startHandle, transforms, this).toAttributes(node)\n\t\t}\n\t\tif (isVariableReference(value)) {\n\t\t\treturn this.getVariableReferenceHandleByVariableReference(value)?.toAttributes(node)\n\t\t}\n\t}\n\n\t*variablesForScope(scopeId: ScopeId): IterableIterator<VariableOrDivider> {\n\t\tfor (const definition of this.definitions.values()) {\n\t\t\tif (definition.scopeId === scopeId) yield definition.variable\n\t\t}\n\t}\n\n\tgetVariableReferenceHandleByVariableReference(reference: VariableReference): VariableReferenceHandle | undefined {\n\t\tif (isVariableReferenceToCollectionItemId(reference)) {\n\t\t\treturn makeCollectionItemIdHandle(reference)\n\t\t}\n\n\t\tif (isVariableReferenceToRepeaterVariable(reference)) {\n\t\t\tconst variableDefinition = repeaterVariables.find(variable => variable.id === reference.id)\n\t\t\tassert(variableDefinition, `Unknown variable: ${reference.id}`)\n\t\t\treturn makeRepeaterVariableHandle(reference, variableDefinition)\n\t\t}\n\n\t\tconst definition = this.resolveVariablePath(reference.id)\n\t\tif (!definition) return\n\t\tassert(isVariableDefinition(definition.variable), \"Dividers cannot be resolved as variable references\")\n\n\t\treturn {\n\t\t\ttype: \"variableReference\",\n\t\t\toutputType: getOutputTypeOfVariable(definition.variable),\n\t\t\tscopeId: definition.scopeId,\n\t\t\tvariable: definition.variable,\n\t\t\treference: () => reference,\n\t\t\ttoAttributes: () => createCSSVariable(reference.id),\n\t\t}\n\t}\n\n\tgetVariableReferenceHandleByVariableId(id: string): VariableReferenceHandle | undefined {\n\t\tconst requestedId = getRequestedVariableId(id)\n\t\tconst definition = this.resolveVariablePath(requestedId)\n\t\tif (!definition) return\n\t\tassert(isVariableDefinition(definition.variable), \"Dividers cannot be resolved as variable references\")\n\n\t\treturn {\n\t\t\ttype: \"variableReference\",\n\t\t\toutputType: getOutputTypeOfVariable(definition.variable),\n\t\t\tscopeId: definition.scopeId,\n\t\t\tvariable: definition.variable,\n\t\t\treference: (node: CanvasNode) => {\n\t\t\t\tconst tree = node.tree()\n\n\t\t\t\tif (!tree) {\n\t\t\t\t\tthrow new DeferTraitError(\"Node not in tree, cannot resolve variable provider\")\n\t\t\t\t}\n\n\t\t\t\t// For collection variables, the provider id needs to be the node `WithCollectionDataSource`\n\t\t\t\t// that is referencing the collection, not the collection itself.\n\t\t\t\tconst collectionProviderId = findCollectionProviderId(definition.scopeId, node)\n\n\t\t\t\tif (!collectionProviderId && tree.getNodeWithTrait(definition.scopeId, isCollectionNode)) {\n\t\t\t\t\t// We've seen instances where, when creating a repeater, the Agent first \"defines the template\"\n\t\t\t\t\t// before the variable is in scope, and only \"connects the collection\" in the end.\n\t\t\t\t\tthrow new DeferTraitError(\n\t\t\t\t\t\t`Failed to assign CMS variable ${definition.variableId} to node ${node.id}. Deferred until an ancestor with a valid collectionList.collection is found`,\n\t\t\t\t\t)\n\t\t\t\t}\n\n\t\t\t\treturn createVariableReference(\n\t\t\t\t\tthis.getIdForVariableReference(definition),\n\t\t\t\t\tcollectionProviderId ?? definition.scopeId,\n\t\t\t\t)\n\t\t\t},\n\t\t\ttoAttributes: () => createCSSVariable(definition.variableId),\n\t\t}\n\t}\n\n\t/**\n\t * We track the `id` ({@link collectionIdKey}) variable internally as `<collection-id>-id` so that the agent can\n\t * specify which collection.\n\t *\n\t * When creating the actual {@link VariableReference} to be persisted in the tree, we have to map this back to `id`.\n\t */\n\tprivate getIdForVariableReference(definition: { scopeId: ScopeId; variableId: string }): string {\n\t\tif (definition.variableId === getCollectionItemIdVariableLlmId(definition.scopeId)) return collectionIdKey\n\t\treturn definition.variableId\n\t}\n\n\tprivate getRepeaterVariableById(\n\t\tvalue: string,\n\t\tnode: CanvasNode | VirtualRichTextNode,\n\t): VariableReferenceHandle | undefined {\n\t\tconst requestedId = getRequestedVariableId(value)\n\n\t\tconst parsed = parseRepeaterVariableLlmId(requestedId)\n\t\tif (!parsed) return undefined\n\n\t\tconst { repeaterId, variable } = parsed\n\n\t\tif (isVirtualRichTextNode(node)) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst treeResolver = this.treeResolver\n\t\tassert(treeResolver, \"DynamicValues must be initialized with a TreeResolver\")\n\n\t\tconst repeaterNode = treeResolver.get(repeaterId)\n\t\tif (!repeaterNode) {\n\t\t\tthrow new Error(`Cannot assign the ${variable.id} variable: unknown node ${repeaterId}.`)\n\t\t}\n\n\t\tconst resolvedRepeaterId = repeaterNode.id\n\n\t\tconst tree = node.tree()\n\t\tif (!tree) {\n\t\t\tthrow new DeferTraitError(\"Node not yet in tree, cannot resolve repeater variable\")\n\t\t}\n\n\t\tif (!isCollectionRepeater(repeaterNode)) {\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot assign the ${variable.id} variable: node ${resolvedRepeaterId} is not a CMS Collection List.`,\n\t\t\t)\n\t\t}\n\n\t\tif (isRepeaterVariableIdAvailableToNonRepeatedChildren(variable.id)) {\n\t\t\tif (!tree.isAncestorOfNode(node, resolvedRepeaterId)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Cannot assign the ${variable.id} variable: node ${node.id} is not inside CMS Collection List ${resolvedRepeaterId}.`,\n\t\t\t\t)\n\t\t\t}\n\t\t} else {\n\t\t\tconst repeatedItem = getRepeatedItemOfDataRepeater(tree, repeaterNode)\n\t\t\tif (!repeatedItem) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Cannot assign the ${variable.id} variable: CMS Collection List ${resolvedRepeaterId} has no repeated descendant.`,\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tif (node.id !== repeatedItem.id && !tree.isAncestorOfNode(node, repeatedItem.id)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Cannot assign the ${variable.id} variable: node ${node.id} is not inside the repeated descendant of CMS Collection List ${resolvedRepeaterId}.`,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\treturn makeRepeaterVariableHandle(\n\t\t\t{\n\t\t\t\t...createVariableReference(variable.id, resolvedRepeaterId),\n\t\t\t\tproviderId: resolvedRepeaterId,\n\t\t\t},\n\t\t\tvariable,\n\t\t)\n\t}\n\n\tprivate resolveVariablePath(\n\t\tvariablePath: string,\n\t): { scopeId: ScopeId; variable: VariableOrDivider; variableId: string } | undefined {\n\t\tconst parts = variablePath.split(\".\")\n\n\t\tconst variableIds: string[] = []\n\t\tlet firstScopeId: ScopeId | undefined\n\t\tlet lastDefinition: AgentVariableDefinition | undefined\n\n\t\tfor (const part of parts) {\n\t\t\tconst partId = this.variableIdByLlmId.get(part) ?? part\n\n\t\t\tconst definition = this.definitions.get(partId)\n\t\t\tif (!definition) return\n\n\t\t\tvariableIds.push(definition.variable.id)\n\t\t\tfirstScopeId ??= definition.scopeId\n\t\t\tlastDefinition = definition\n\t\t}\n\n\t\tif (!lastDefinition || !firstScopeId) return\n\n\t\treturn {\n\t\t\tscopeId: firstScopeId,\n\t\t\tvariable: lastDefinition.variable,\n\t\t\tvariableId: variableIds.join(\".\"),\n\t\t}\n\t}\n\n\tprivate deleteAliasesForVariableId(variableId: VariableId) {\n\t\tfor (const [llmId, resolvedId] of this.variableIdByLlmId) {\n\t\t\tif (resolvedId === variableId) {\n\t\t\t\tthis.variableIdByLlmId.delete(llmId)\n\t\t\t}\n\t\t}\n\t}\n}\n\nexport function variableTypeToControlType(type: VariableOrDivider[\"type\"]): ControlType | undefined {\n\tswitch (type) {\n\t\tcase \"slug\":\n\t\t\treturn ControlType.String\n\t\tcase \"divider\":\n\t\tcase \"controlReference\":\n\t\tcase \"nodePropertyControlReference\":\n\t\t\treturn undefined\n\t\tdefault:\n\t\t\treturn type\n\t}\n}\n\nfunction getOutputTypeOfVariable(variable: VariableDefinition): VariableType {\n\tswitch (variable.type) {\n\t\tcase \"slug\":\n\t\t\treturn ControlType.String\n\t\tcase \"controlReference\":\n\t\tcase \"nodePropertyControlReference\":\n\t\t\treturn variable.expectedType === ControlType.SegmentedEnum ? ControlType.Enum : variable.expectedType\n\t\tdefault:\n\t\t\treturn variable.type\n\t}\n}\n", "import { isPrefixedControlPropKey, removeControlPropKeyPrefix } from \"document/models/controlProps/controlPropKey.ts\"\n\nconst acronymBoundary = /([A-Z]+)([A-Z][a-z])/gu\nconst camelBoundary = /([a-z\\d])(?=[A-Z])/gu\n\nfunction getUnprefixedControlValue(value: string): string {\n\treturn isPrefixedControlPropKey(value) ? removeControlPropKeyPrefix(value) : value\n}\n\nfunction splitEventHandlerWords(value: string): string[] {\n\treturn getUnprefixedControlValue(value)\n\t\t.trim()\n\t\t.replace(acronymBoundary, \"$1 $2\")\n\t\t.replace(camelBoundary, \"$1 \")\n\t\t.split(/[^A-Za-z0-9]+/u)\n\t\t.filter(Boolean)\n\t\t.map(word => word.toLowerCase())\n}\n\nexport function toEventHandlerAttributeKey(value: string): string {\n\tconst words = splitEventHandlerWords(value)\n\tif (words.length === 0) return \"onEvent\"\n\n\tconst camel = words\n\t\t.map((word, index) => (index === 0 ? word : `${word[0]?.toUpperCase() ?? \"\"}${word.slice(1)}`))\n\t\t.join(\"\")\n\n\tif (!camel || camel === \"on\") return \"onEvent\"\n\treturn camel.startsWith(\"on\") ? camel : `on${camel[0]?.toUpperCase() ?? \"\"}${camel.slice(1)}`\n}\n\nexport function getUniqueEventHandlerAttributeKeys(values: readonly string[]): string[] {\n\tconst usedKeys = new Set<string>()\n\n\treturn values.map(value => {\n\t\tconst baseKey = toEventHandlerAttributeKey(value)\n\t\tlet key = baseKey\n\t\tlet count = 2\n\n\t\twhile (usedKeys.has(key)) {\n\t\t\tkey = `${baseKey}${count}`\n\t\t\tcount++\n\t\t}\n\n\t\tusedKeys.add(key)\n\t\treturn key\n\t})\n}\n", "import { ComponentNodeClass, FixedOverlayNodeClass } from \"./dsl.ts\"\nimport { escapeValue } from \"./prompt/utils.ts\"\n\nexport enum RejectedCommandKind {\n\tAddExistingNodeId = \"AddExistingNodeId\",\n\tParentNodeToItself = \"ParentNodeToItself\",\n\tScopeRequired = \"ScopeRequired\",\n\tScopeMustSupportVariables = \"ScopeMustSupportVariables\",\n\tLineBreakTargetRequired = \"LineBreakTargetRequired\",\n\tInvalidNodeClass = \"InvalidNodeClass\",\n\tUpdatedVariableRequired = \"UpdatedVariableRequired\",\n\tScopeMustBePresentInTree = \"ScopeMustBePresentInTree\",\n\tUnsupportedVirtualNodeNotEditable = \"UnsupportedVirtualNodeNotEditable\",\n\tUnsupportedVirtualNodeNotDuplicable = \"UnsupportedVirtualNodeNotDuplicable\",\n\tNodeMustBePresentInTree = \"NodeMustBePresentInTree\",\n\tReplicaChildMoveMustStayInParent = \"ReplicaChildMoveMustStayInParent\",\n\tReplicaChildMoveRequiresReorderableParent = \"ReplicaChildMoveRequiresReorderableParent\",\n\tMoveNodeNoLongerPresentInTree = \"MoveNodeNoLongerPresentInTree\",\n\tMoveParentNoLongerPresentInTree = \"MoveParentNoLongerPresentInTree\",\n\tParentMustBePresentInTree = \"ParentMustBePresentInTree\",\n\tReplicaMoveMustStayWithinDirectParent = \"ReplicaMoveMustStayWithinDirectParent\",\n\tMoveIntoReplicaRejected = \"MoveIntoReplicaRejected\",\n\tScopeNodeRequiredForVariantDuplicate = \"ScopeNodeRequiredForVariantDuplicate\",\n\tScopeNodeMustHaveBaseVariant = \"ScopeNodeMustHaveBaseVariant\",\n\tScopeNodeMustHaveReplicaVariants = \"ScopeNodeMustHaveReplicaVariants\",\n\tRichTextTargetNotFound = \"RichTextTargetNotFound\",\n\tParentAttributeMustBeString = \"ParentAttributeMustBeString\",\n\tUpdateParentNotInsertedYet = \"UpdateParentNotInsertedYet\",\n\tVirtualTextInvalidParent = \"VirtualTextInvalidParent\",\n\tVirtualTextCMSOnlyCapability = \"VirtualTextCMSOnlyCapability\",\n\tVirtualTextCrossDocumentUnsupportedDescendant = \"VirtualTextCrossDocumentUnsupportedDescendant\",\n\tRemoveCanvasRoot = \"RemoveCanvasRoot\",\n\tAddCanvasRoot = \"AddCanvasRoot\",\n\tMoveCanvasRoot = \"MoveCanvasRoot\",\n\tDuplicateCanvasRoot = \"DuplicateCanvasRoot\",\n\tRemovePrimaryVariant = \"RemovePrimaryVariant\",\n\tRemoveEditScope = \"RemoveEditScope\",\n\tRemoveUnknownNode = \"RemoveUnknownNode\",\n\tMoveUnknownNode = \"MoveUnknownNode\",\n\tMoveUnknownParent = \"MoveUnknownParent\",\n\tMoveToDescendant = \"MoveToDescendant\",\n\tMoveToRejectingParent = \"MoveToRejectingParent\",\n\tDuplicateUnknownNode = \"DuplicateUnknownNode\",\n\tDuplicateSameId = \"DuplicateSameId\",\n\tDuplicateExistingId = \"DuplicateExistingId\",\n\tDuplicateUnknownParent = \"DuplicateUnknownParent\",\n\tGestureVariant = \"DuplicateVariantGestureRequiresTopLevelVariant\",\n\tCreateVariantFromNonVariant = \"CreateVariantFromNonVariant\",\n\tCreateVariantFromUnknownNode = \"CreateVariantFromUnknownNode\",\n\tAddUnknownParent = \"AddUnknownParent\",\n\tFixedOverlayInSmartComponent = \"FixedOverlayInSmartComponent\",\n\tParentDoesNotAcceptChildren = \"ParentDoesNotAcceptChildren\",\n\tUpdateUnknownNode = \"UpdateUnknownNode\",\n\tInsertIntoLayoutlessBreakpoint = \"InsertIntoLayoutlessBreakpoint\",\n\tReservedVirtualTextNodeId = \"ReservedVirtualTextNodeId\",\n\tVirtualTextNodeVariableReferenceNotAllowed = \"VirtualTextNodeVariableReferenceNotAllowed\",\n\tCreateVariableFailed = \"CreateVariableFailed\",\n\tFromAttributesFailed = \"FromAttributesFailed\",\n\tCollectionItemIdReadOnly = \"CollectionItemIdReadOnly\",\n}\n\nconst rejectedCommandMessages: Record<RejectedCommandKind, string> = {\n\t[RejectedCommandKind.AddExistingNodeId]: \"Cannot add node with an existing id.\",\n\t[RejectedCommandKind.ParentNodeToItself]: \"Node cannot be parented to itself.\",\n\t[RejectedCommandKind.ScopeRequired]: \"Scope is required.\",\n\t[RejectedCommandKind.ScopeMustSupportVariables]: \"Scope must support variables.\",\n\t[RejectedCommandKind.LineBreakTargetRequired]: \"Line break must belong to a RichTextTarget.\",\n\t[RejectedCommandKind.InvalidNodeClass]: \"Invalid node class.\",\n\t[RejectedCommandKind.UpdatedVariableRequired]: \"Updated variable is required.\",\n\t[RejectedCommandKind.ScopeMustBePresentInTree]: \"Scope must be present in the tree.\",\n\t[RejectedCommandKind.UnsupportedVirtualNodeNotEditable]: \"Unsupported virtual text blocks are read-only.\",\n\t[RejectedCommandKind.UnsupportedVirtualNodeNotDuplicable]: \"Unsupported virtual text blocks cannot be duplicated.\",\n\t[RejectedCommandKind.NodeMustBePresentInTree]: \"Node must be present in the tree.\",\n\t[RejectedCommandKind.ReplicaChildMoveMustStayInParent]:\n\t\t\"Replica descendants can only be moved within their current parent.\",\n\t[RejectedCommandKind.ReplicaChildMoveRequiresReorderableParent]:\n\t\t\"Replica descendants can only be reordered in stack or grid parents.\",\n\t[RejectedCommandKind.MoveNodeNoLongerPresentInTree]: \"Node to move is no longer present in tree.\",\n\t[RejectedCommandKind.MoveParentNoLongerPresentInTree]: \"Parent is no longer present in tree.\",\n\t[RejectedCommandKind.ParentMustBePresentInTree]: \"Parent must be present in the tree.\",\n\t[RejectedCommandKind.ReplicaMoveMustStayWithinDirectParent]:\n\t\t\"Replica nodes can only be reordered within their direct parent.\",\n\t[RejectedCommandKind.MoveIntoReplicaRejected]:\n\t\t\"Nodes cannot be moved into Replica Variants or Replica Variant Descendants.\",\n\t[RejectedCommandKind.ScopeNodeRequiredForVariantDuplicate]: \"Scope node is required when duplicating a variant.\",\n\t[RejectedCommandKind.ScopeNodeMustHaveBaseVariant]: \"Scope node must have a base variant.\",\n\t[RejectedCommandKind.ScopeNodeMustHaveReplicaVariants]: \"Scope node must have replica variants.\",\n\t[RejectedCommandKind.RichTextTargetNotFound]: \"Rich text target was not found.\",\n\t[RejectedCommandKind.ParentAttributeMustBeString]: '\"parent\" attribute value must be a string.',\n\t[RejectedCommandKind.UpdateParentNotInsertedYet]:\n\t\t\"Cannot apply update before the parent node is inserted. Insert or update the parent first.\",\n\t[RejectedCommandKind.VirtualTextInvalidParent]: \"Virtual rich text parent is invalid.\",\n\t[RejectedCommandKind.VirtualTextCMSOnlyCapability]: \"This node type is only supported on CMS Rich Text Targets.\",\n\t[RejectedCommandKind.VirtualTextCrossDocumentUnsupportedDescendant]:\n\t\t\"Virtual rich text subtree contains a node type that the destination target does not support.\",\n\t[RejectedCommandKind.RemoveCanvasRoot]:\n\t\t\"Refusing to delete the canvas root. Remove or replace its top-level contents instead.\",\n\t[RejectedCommandKind.AddCanvasRoot]: \"Refusing to add or replace the canvas root.\",\n\t[RejectedCommandKind.MoveCanvasRoot]: \"Refusing to move the canvas root.\",\n\t[RejectedCommandKind.DuplicateCanvasRoot]: \"Refusing to duplicate the canvas root.\",\n\t[RejectedCommandKind.RemovePrimaryVariant]:\n\t\t\"Refusing to delete the primary breakpoint or component variant. Replace its contents instead.\",\n\t[RejectedCommandKind.RemoveEditScope]: \"Refusing to delete the current edit scope. Replace its contents instead.\",\n\t[RejectedCommandKind.RemoveUnknownNode]: \"Cannot remove an unknown node.\",\n\t[RejectedCommandKind.MoveUnknownNode]: \"Cannot move an unknown node.\",\n\t[RejectedCommandKind.MoveUnknownParent]: \"Cannot move a node to an unknown parent.\",\n\t[RejectedCommandKind.MoveToDescendant]: \"Node cannot be moved to one of its descendants.\",\n\t[RejectedCommandKind.MoveToRejectingParent]: \"Node cannot be moved to a parent that does not accept children.\",\n\t[RejectedCommandKind.DuplicateUnknownNode]: \"Cannot duplicate an unknown node.\",\n\t[RejectedCommandKind.CreateVariantFromUnknownNode]: \"Cannot create a variant from an unknown node.\",\n\t[RejectedCommandKind.DuplicateSameId]: \"Duplicate id must differ from source id.\",\n\t[RejectedCommandKind.DuplicateExistingId]: \"Cannot duplicate to an existing id.\",\n\t[RejectedCommandKind.DuplicateUnknownParent]: \"Cannot duplicate a node to an unknown parent.\",\n\t[RejectedCommandKind.GestureVariant]: `The \"gesture\" attribute can only be used when creating variants in ${escapeValue(ComponentNodeClass)} from other Variants.`,\n\t[RejectedCommandKind.CreateVariantFromNonVariant]: \"Cannot create a variant from a non-variant node.\",\n\t[RejectedCommandKind.AddUnknownParent]: \"Cannot add to an unknown parent.\",\n\t[RejectedCommandKind.FixedOverlayInSmartComponent]: `${escapeValue(FixedOverlayNodeClass)} is not supported inside ${escapeValue(ComponentNodeClass)}.`,\n\t[RejectedCommandKind.ParentDoesNotAcceptChildren]: \"Cannot add a node to a parent that does not accept children.\",\n\t[RejectedCommandKind.UpdateUnknownNode]: \"Cannot update an unknown node.\",\n\t[RejectedCommandKind.InsertIntoLayoutlessBreakpoint]:\n\t\t'Cannot insert a node into a page breakpoint with no layout. First SET the breakpoint layout=\"stack\" before inserting children.',\n\t[RejectedCommandKind.ReservedVirtualTextNodeId]:\n\t\t\"IDs in the v:... namespace are reserved for existing virtual text snapshot nodes.\",\n\t[RejectedCommandKind.VirtualTextNodeVariableReferenceNotAllowed]:\n\t\t'Variable references are not supported on TextRun/TextBlock text. SET the owning RichTextNode (or rich-text variable) with text=\"var(--variable-<id>)\" instead.',\n\t[RejectedCommandKind.CreateVariableFailed]: \"Failed to create variable.\",\n\t[RejectedCommandKind.FromAttributesFailed]: \"Failed to apply attributes to node.\",\n\t[RejectedCommandKind.CollectionItemIdReadOnly]:\n\t\t\"The collection item id variable is built-in and cannot be updated or removed.\",\n}\n\nexport class RejectedCommandError extends Error {\n\tconstructor(\n\t\treadonly kind: RejectedCommandKind,\n\t\tmessage?: string,\n\t\toptions?: ErrorOptions,\n\t) {\n\t\tsuper(message ?? rejectedCommandMessages[kind], options)\n\t\tthis.name = \"RejectedCommandError\"\n\t}\n}\n", "import type { ComponentLoader, VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport {\n\tassert,\n\tList,\n\tModuleType,\n\tassertNever,\n\thostInfo,\n\tisLocalModuleIdentifier,\n\tparseModuleIdentifier,\n\tunhandledError,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { getScopeTypeForScope } from \"document/base-engine/BaseScopeStore.ts\"\nimport {\n\teventKeyToDisplayName,\n\tgetMemoEventKeyToDisplayNameMap,\n} from \"document/components/chrome/properties/panels/utils/eventKeyToDisplayName.ts\"\nimport { isShowOverlayAction, isShowRelativeOverlayAction } from \"document/models/CanvasTree/actions/overlayActions.ts\"\nimport { isLoadMoreAction } from \"document/models/CanvasTree/actions/paginationActions.ts\"\nimport { isSetVariableValueAction } from \"document/models/CanvasTree/actions/setVariableValueActions.ts\"\nimport { createTriggerEventAction } from \"document/models/CanvasTree/actions/triggerEventActions.ts\"\nimport type { AnyNodeUpdate, FrameNode, NodeID, SVGNode, ShapeContainerNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tCanvasNode,\n\tCodeComponentNode,\n\tSmartComponentNode,\n\tisScopeNode,\n\tisVectorNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport type { DataRepeater } from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { TemplateHelper, generateReplicaChildId } from \"document/models/CanvasTree/nodes/TemplateHelper.ts\"\nimport type { FormBooleanInputNode } from \"document/models/CanvasTree/nodes/forms/FormBooleanInputNode.ts\"\nimport type { FormPlainTextInputNode } from \"document/models/CanvasTree/nodes/forms/FormPlainTextInputNode.ts\"\nimport type { FormSelectNode } from \"document/models/CanvasTree/nodes/forms/FormSelectNode.ts\"\nimport type { AnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport { isAnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport {\n\tisCodeComponentNode,\n\tisCollectionItemNode,\n\tisDataRepeater,\n\tisFormBooleanInputNode,\n\tisFormPlainTextInputNode,\n\tisFormSelectNode,\n\tisFrameNode,\n\tisOverlayNode,\n\tisRichTextNode,\n\tisSVGNode,\n\tisShapeContainerNode,\n\tisSmartComponentNode,\n\tisTextNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isFixedOrRelativeOverlay, nodeIsInOverlay } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport type {\n\tComputedValue,\n\tComputedValueFromVariable,\n\tComputedValueOutputType,\n} from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { isComputedValueFromVariableReference } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { ConvertFromEnumOutputType } from \"document/models/CanvasTree/traits/ValueTransform.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\tcreateVariableReference,\n\tisInlineTransformVariableReference,\n\tisVariableReference,\n} from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withAriaLabel } from \"document/models/CanvasTree/traits/WithAriaLabel.ts\"\nimport { withBackdrop } from \"document/models/CanvasTree/traits/WithBackdrop.ts\"\nimport { withBorder } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport { withBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport { withCodeComponent } from \"document/models/CanvasTree/traits/WithCodeComponent.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport { withCollectionOptions } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { withCornerShape } from \"document/models/CanvasTree/traits/WithCornerShape.ts\"\nimport {\n\tcustomCursorDefaults,\n\textractCustomCursorProperties,\n\twithCursor,\n} from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { withDraggable } from \"document/models/CanvasTree/traits/WithDraggable.ts\"\nimport { withFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { withFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport {\n\tfloatingPositionDefaults,\n\tgetFloatingPositionProps,\n\thasFloatingPosition,\n\twithFloatingPosition,\n} from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { WithFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport {\n\tappearKey,\n\tisFrameEvent,\n\tkeyDownKey,\n\twithFrameEvents,\n} from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport { gridItemLayoutDefaults, withGridItemLayout } from \"document/models/CanvasTree/traits/WithGridItemLayout.ts\"\nimport type { WithGridItemSize } from \"document/models/CanvasTree/traits/WithGridItemSize.ts\"\nimport { gridItemSizeDefaults, withGridItemSize } from \"document/models/CanvasTree/traits/WithGridItemSize.ts\"\nimport { hasItemsOrderOverride } from \"document/models/CanvasTree/traits/WithItemsOrder.ts\"\nimport { withLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { withLightboxEffect } from \"document/models/CanvasTree/traits/WithLightboxEffect.ts\"\nimport type { WithLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport { hasLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport type { WithLock } from \"document/models/CanvasTree/traits/WithLock.ts\"\nimport { withOpacity } from \"document/models/CanvasTree/traits/WithOpacity.ts\"\nimport { withPadding } from \"document/models/CanvasTree/traits/WithPadding.ts\"\nimport type { WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { withPositionType } from \"document/models/CanvasTree/traits/WithPositionType.ts\"\nimport { withRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport { hasRepeatArray } from \"document/models/CanvasTree/traits/WithRepeatArray.ts\"\nimport { withDataRepeaterArray } from \"document/models/CanvasTree/traits/WithRepeaterDataSource.ts\"\nimport { withRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { withScrollTarget } from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport { withScrollbars } from \"document/models/CanvasTree/traits/WithScrollbars.ts\"\nimport type { WithSizeConstraints } from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport {\n\tparseConstraintValue,\n\tsizeConstraintsDefaults,\n\tsupportsSizeConstraints,\n} from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { withStyleAppearPageEffect } from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport { withStyleTransformEffect } from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport { withTabIndex } from \"document/models/CanvasTree/traits/WithTabIndex.ts\"\nimport { withTapHighlight } from \"document/models/CanvasTree/traits/WithTapHighlight.ts\"\nimport type {\n\tIsReplica,\n\tReplicaNodeOverrides,\n\tReplicaOverrides,\n} from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport {\n\tisMaster,\n\tisReplica,\n\tisReplicaChild,\n\tisReplicaOrReplicaChild,\n} from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { withTextContent } from \"document/models/CanvasTree/traits/WithTextContent.ts\"\nimport { withTextEffect } from \"document/models/CanvasTree/traits/WithTextEffect.ts\"\nimport { withTextFit } from \"document/models/CanvasTree/traits/WithTextFit.ts\"\nimport { withTextTruncation } from \"document/models/CanvasTree/traits/WithTextTruncation.ts\"\nimport { withTickerEffect } from \"document/models/CanvasTree/traits/WithTickerEffect.ts\"\nimport { getTransforms, transformDefaults, withTransforms } from \"document/models/CanvasTree/traits/WithTransforms.ts\"\nimport type { WithTransition } from \"document/models/CanvasTree/traits/WithTransition.ts\"\nimport { withTransition } from \"document/models/CanvasTree/traits/WithTransition.ts\"\nimport { hasVariableBinding } from \"document/models/CanvasTree/traits/WithVariableBinding.ts\"\nimport { withVariableProvider } from \"document/models/CanvasTree/traits/WithVariableProvider.ts\"\nimport type {\n\tArrayVariableDefinition,\n\tVariableDefinition,\n\tVariableType,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tcontrolDescriptionFromVariable,\n\tgetDefaultNameForVariable,\n\tgetDefaultVariableValue,\n\tisArrayOfObjectControlDescription,\n\twithOptional,\n\twithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { IsPrimaryVariant, IsVariant, WithVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport {\n\tgetPrimaryVariantAncestor,\n\tisGestureVariant,\n\tisPrimaryVariant,\n\tisVariant,\n\twithVariant,\n} from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { withVariantAppearPageEffect } from \"document/models/CanvasTree/traits/WithVariantAppearEffect.ts\"\nimport type { WithVisibility } from \"document/models/CanvasTree/traits/WithVisibility.ts\"\nimport { withVisibility } from \"document/models/CanvasTree/traits/WithVisibility.ts\"\nimport { withZIndex } from \"document/models/CanvasTree/traits/WithZIndex.ts\"\nimport { withFormBooleanInputType } from \"document/models/CanvasTree/traits/forms/WithFormBooleanInputType.ts\"\nimport { withFormContainer } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport { withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport { withFormInputAutofillEnabled } from \"document/models/CanvasTree/traits/forms/WithFormInputAutofillEnabled.ts\"\nimport { withFormInputPlaceholder } from \"document/models/CanvasTree/traits/forms/WithFormInputPlaceholder.ts\"\nimport { withFormInputStep } from \"document/models/CanvasTree/traits/forms/WithFormInputStep.ts\"\nimport { withFormTextInputType } from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport { createCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport type { EffectScrollTarget } from \"document/models/CanvasTree/traits/utils/EffectScrollTarget.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport {\n\tisLink,\n\tisLinkToWebPage,\n\tlinkContainsPathOrHashVariable,\n} from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { computeValue } from \"document/models/CanvasTree/traits/utils/computeValue.ts\"\nimport { getSupportedEffects, liftEffectsOnComponentCreation } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { positionTypeUpdateForNewParent } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport { createArrayToArrayComputedValue } from \"document/models/CanvasTree/traits/utils/valueTransformUtils.ts\"\nimport type { EventAction } from \"document/models/EventAction.ts\"\nimport { defaultDurationBasedSpringTransition } from \"document/models/Transition.ts\"\nimport type {\n\tArrayValue,\n\tControlProp,\n\tEventHandlerControlProp,\n\tImageControlProp,\n\tObjectControlProp,\n\tStaticArrayControlPropValue,\n} from \"document/models/controlProps/ControlProp.ts\"\nimport { isStaticArrayControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport { isRawControlProp } from \"document/models/controlProps/RawControlProp.ts\"\nimport {\n\ttype PrefixedControlProps,\n\tremoveControlPropKeyPrefix,\n\tisPrefixedControlPropKey,\n\tprefixControlPropKey,\n\tprefixControlProps,\n} from \"document/models/controlProps/controlPropKey.ts\"\nimport { getControlProp, getEnumControlPropValue } from \"document/models/controlProps/getControlProps.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport {\n\tgetLayoutDirectionVariable,\n\tgetLocaleVariable,\n\tlayoutDirectionVariableId,\n\tlocaleProviderId,\n\tlocaleVariableId,\n} from \"document/utils/LocaleVariable.ts\"\nimport { isLayoutSection } from \"document/utils/layoutSectionHelpers.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\nimport type { Size } from \"library/render/types/Size.ts\"\nimport type { Mutable } from \"utils/Mutable.ts\"\nimport { deepClone } from \"utils/deepClone.ts\"\nimport { getFirstRepeaterItemId } from \"utils/getFirstRepeaterItemId.ts\"\nimport { getKeys } from \"utils/getKeys.ts\"\nimport { isKeySetAndNotInherited } from \"utils/isKeySetAndNotInherited.ts\"\nimport { restoreRepeatedItemsFromSnapshots, snapshotRepeatedItemsForNodes } from \"utils/repeaterUtils.ts\"\nimport { titleCase } from \"utils/titleCase.ts\"\nimport { isArray, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { GetUpdatedVariableReference } from \"utils/updateDynamicValues.ts\"\nimport {\n\tgenerateVariableReferenceUpdateForNode,\n\tgetUpdatedCollectionFiltersIfNeeded,\n} from \"utils/updateDynamicValues.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { isValidPropertyValueType } from \"../chrome/properties/codeComponentRows/utils/isValidPropertyValue.ts\"\nimport { createGalleryVariableDefaultValue, createVariable } from \"../chrome/properties/utils/createVariable.ts\"\nimport { getActionsForNode } from \"../chrome/properties/utils/eventActions.ts\"\nimport { RenamedIds, updateNodeConnections } from \"../tools/utils/updateNodeConnections.ts\"\nimport { ContextAction } from \"./contextActions.ts\"\n\nconst primaryVariantName = `${Dictionary.Variant} 1`\n\nconst defaultPrimaryVariantRect: Rect = { x: 0, y: 0, width: 200, height: 200 }\nexport const defaultPrimaryVariantAttributes: Partial<FrameNode> = {\n\tname: primaryVariantName,\n\twidth: defaultPrimaryVariantRect.width,\n\theight: defaultPrimaryVariantRect.height,\n\tfillColor: \"white\",\n\tisMaster: true,\n\treplicaInfo: null,\n\toriginalid: null,\n\tisVariant: true,\n\tvariantTransition: defaultDurationBasedSpringTransition,\n\tisBreakpoint: false,\n\tleft: 0,\n\ttop: 0,\n}\n\nfunction createSmartComponentWithEmptyPrimaryVariant(\n\tengine: VekterEngine,\n\tsmartComponentId: NodeID,\n\tname: string,\n\theadless = false,\n): CreateSmartComponentResult {\n\tconst baseVariantId = randomID()\n\n\tconst smartComponent = engine.createNode(\n\t\tSmartComponentNode,\n\t\t{\n\t\t\tid: smartComponentId,\n\t\t\tname,\n\t\t\tbaseVariantId,\n\t\t},\n\t\tengine.tree.root.id,\n\t)\n\n\tconst primaryVariant = engine.createFrame(smartComponent.id, {\n\t\t...defaultPrimaryVariantAttributes,\n\t\tid: baseVariantId,\n\t})\n\n\tassert(isPrimaryVariant(primaryVariant))\n\n\tif (!headless) {\n\t\tengine.stores.scopeStore.select(smartComponentId, { keepHistory: false })\n\t\tengine.stores.codeEditorStore.closeEditor()\n\t\tengine.stores.selectionStore.set(baseVariantId)\n\t}\n\n\tconst moduleCreation = engine.stores.codeGenerationStore.createModuleFromComponentSource(\n\t\tsmartComponent.draftOrCurrent(),\n\t)\n\tmoduleCreation.catch(unhandledError)\n\n\treturn { node: smartComponent.draftOrCurrent(), moduleCreation }\n}\n\nfunction getAllSubtreeIds(node: CanvasNode): ReadonlySet<NodeID> {\n\tconst result: Set<NodeID> = new Set()\n\tfor (const n of node.walk()) result.add(n.id)\n\treturn result\n}\n\ninterface CreateSmartComponentResult {\n\tnode: SmartComponentNode\n\tinstances?: CodeComponentNode[]\n\tmoduleCreation?: Promise<unknown>\n}\n\nfunction removeIncompatiblePropsInSubtree<T extends CanvasNode>(engine: VekterEngine, variantSource: T): T {\n\tfor (const node of variantSource.walk()) {\n\t\t// remove viewport height\n\t\tif (isPinnable(node) && node.heightType === DimensionType.Viewport) {\n\t\t\tconst { height } = engine.tree.getRect(node)\n\t\t\tnode.set({\n\t\t\t\theightType: DimensionType.FixedNumber,\n\t\t\t\theight,\n\t\t\t})\n\t\t}\n\n\t\t// remove position fixed\n\t\tif (withPositionType(node) && node.position === \"fixed\") {\n\t\t\tnode.set({ position: undefined })\n\t\t}\n\t}\n\n\treturn variantSource.draftOrCurrent()\n}\n\ntype PrimaryVariant = CanvasNode & IsPrimaryVariant\ntype ReplicaVariant = CanvasNode & IsReplica & IsVariant\n\nfunction getReplicaVariants(engine: VekterEngine, primary: PrimaryVariant): ReplicaVariant[] {\n\tconst replicaVariants: ReplicaVariant[] = []\n\n\tif (!primary.cache.replicaInstances) return replicaVariants\n\n\tfor (const replicaId of primary.cache.replicaInstances) {\n\t\tconst replica = engine.tree.getNode(replicaId)\n\t\tif (!replica) continue\n\t\tif (!isReplica(replica)) continue\n\t\tif (!isVariant(replica)) continue\n\t\tif (isGestureVariant(replica)) continue\n\t\treplicaVariants.push(replica)\n\t}\n\n\t// Sort by position\n\treplicaVariants.sort((replicaA, replicaB) => {\n\t\tconst positionA = engine.tree.getRect(replicaA)\n\t\tconst positionB = engine.tree.getRect(replicaB)\n\t\tif (positionA.x !== positionB.x) return positionA.x - positionB.x\n\t\treturn positionA.y - positionB.y\n\t})\n\n\treturn replicaVariants\n}\n\ntype InstancePropKey = keyof (WithPins & WithGridItemSize & WithVisibility & WithLock)\n\nconst allInstancePropKeys: Record<InstancePropKey, boolean> = {\n\twidth: true,\n\theight: true,\n\tconstraintsLocked: false,\n\tleft: true,\n\tright: true,\n\ttop: true,\n\tbottom: true,\n\tcenterAnchorX: true,\n\tcenterAnchorY: true,\n\twidthType: true,\n\theightType: true,\n\tgridItemHorizontalAlignment: true,\n\tgridItemVerticalAlignment: true,\n\tgridItemColumnSpan: true,\n\tgridItemRowSpan: true,\n\tgridItemFillCellHeight: true,\n\tgridItemFillCellWidth: true,\n\tvisible: true,\n\tlocked: true,\n}\n\nfunction isInstancePropKey(key: string): key is InstancePropKey {\n\treturn Object.hasOwn(allInstancePropKeys, key)\n}\n\nfunction splitInstancePropsFromOverrides(overrides: ReplicaNodeOverrides): {\n\tinstanceProps: AnyNodeUpdate\n\toverrides: ReplicaNodeOverrides\n} {\n\tconst overridesWithoutInstanceProps: ReplicaNodeOverrides = {}\n\tconst instanceProps: AnyNodeUpdate = {}\n\n\tfor (const key in overrides) {\n\t\tif (isInstancePropKey(key)) {\n\t\t\tconst shouldIgnore = allInstancePropKeys[key] === false\n\t\t\tif (shouldIgnore) continue\n\t\t\tinstanceProps[key] = overrides[key]\n\t\t} else {\n\t\t\toverridesWithoutInstanceProps[key] = overrides[key]\n\t\t}\n\t}\n\n\tconst deleted: string[] = []\n\toverridesWithoutInstanceProps._deleted = deleted\n\n\tif (overrides._deleted) {\n\t\tfor (const deletedKey in overrides._deleted) {\n\t\t\tif (isInstancePropKey(deletedKey)) {\n\t\t\t\tconst key = deletedKey\n\t\t\t\tconst shouldIgnore = allInstancePropKeys[key] === false\n\t\t\t\tif (shouldIgnore) continue\n\t\t\t\tinstanceProps[key] = undefined\n\t\t\t} else {\n\t\t\t\tdeleted.push(deletedKey)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { instanceProps, overrides: overridesWithoutInstanceProps }\n}\n\nfunction findAndReplaceSlots(\n\tcomponentLoader: ComponentLoader,\n\toriginalNode: CodeComponentNode,\n\treplace: (current: NodeID) => NodeID | null,\n) {\n\tassert(\n\t\t!isReplicaOrReplicaChild(originalNode),\n\t\t\"Replicas should not be passed to findAndReplaceSlots, because slots should never be overridden\",\n\t)\n\n\tconst component = componentLoader.componentForIdentifier(originalNode.codeComponentIdentifier)\n\tif (!component) return\n\n\tconst controlProps = originalNode.getControlProps(component.properties)\n\tfor (const key in controlProps) {\n\t\tconst controlProp = controlProps[key]\n\t\tif (controlProp?.type !== ControlType.Slot) continue\n\n\t\tlet didUpdate = false\n\n\t\tconst updatedItems = controlProp.value.map(item => {\n\t\t\tif (!isString(item.reference)) return item\n\t\t\tconst newId = replace(item.reference)\n\t\t\tif (!newId || newId === item.reference) return item\n\t\t\tdidUpdate = true\n\t\t\treturn { ...item, reference: newId }\n\t\t})\n\n\t\tif (!didUpdate) continue\n\n\t\toriginalNode.setControlProp(key, { type: ControlType.Slot, value: updatedItems })\n\t}\n}\n\nfunction getSlotIdsForSubTree(componentLoader: ComponentLoader, node: CanvasNode): Set<NodeID> {\n\tconst result: Set<NodeID> = new Set()\n\n\tfor (const descendant of node.walk()) {\n\t\tif (!isCodeComponentNode(descendant)) continue\n\t\tfindAndReplaceSlots(componentLoader, descendant, id => {\n\t\t\tresult.add(id)\n\t\t\t// Returning null because we don't want to update any nodes\n\t\t\treturn null\n\t\t})\n\t}\n\n\treturn result\n}\n\nfunction copySlotContentIntoComponent(\n\tengine: VekterEngine,\n\tprimaryVariant: CanvasNode,\n\tvariantsToCreate: VariantsToCreate,\n) {\n\tif (variantsToCreate.allSlotIds.size === 0) return\n\n\tconst { sourceScopeId } = variantsToCreate\n\tconst renamedSlotIds = new Map<NodeID, NodeID>()\n\tlet slotMaxX = -100\n\n\tconst seenSlotIds = new Set()\n\tfunction duplicateAndMoveSlotContentIntoComponent(slotId: NodeID) {\n\t\tif (seenSlotIds.has(slotId)) return\n\t\tseenSlotIds.add(slotId)\n\n\t\tconst slotNode = engine.tree.get(slotId)\n\t\tif (!slotNode) return\n\n\t\tif (!engine.tree.isGroundNode(slotNode)) return\n\n\t\tconst scope = engine.tree.getScopeNodeFor(slotNode)\n\t\tif (!scope || scope.id !== sourceScopeId) return\n\n\t\tconst slotRect = engine.tree.getRect(slotNode)\n\t\tconst clonedSlot = engine.cloneNode(slotNode, false, false)\n\t\trenamedSlotIds.set(slotId, clonedSlot.id)\n\n\t\tengine.stores.scopeStore.insertNode(clonedSlot, null)\n\t\tif (isPinnable(clonedSlot)) {\n\t\t\tconst slotX = slotMaxX - slotRect.width\n\t\t\tclonedSlot.set({ left: slotX, top: 0 })\n\t\t\tslotMaxX = slotX - 100\n\t\t}\n\n\t\t// Find nested slots and duplicate them\n\t\tconst subSlots = getSlotIdsForSubTree(engine.componentLoader, clonedSlot)\n\t\tfor (const subSlotId of subSlots) {\n\t\t\tduplicateAndMoveSlotContentIntoComponent(subSlotId)\n\t\t}\n\n\t\t// Replace renamed slot ids within the cloned slot\n\t\tfor (const slotChild of clonedSlot.walk()) {\n\t\t\tif (!isCodeComponentNode(slotChild)) continue\n\t\t\tfindAndReplaceSlots(engine.componentLoader, slotChild, id => {\n\t\t\t\tconst newId = renamedSlotIds.get(id)\n\t\t\t\treturn newId ?? null\n\t\t\t})\n\t\t}\n\t}\n\n\tfor (const slotId of variantsToCreate.allSlotIds) {\n\t\tduplicateAndMoveSlotContentIntoComponent(slotId)\n\t}\n\n\tfor (const primaryChild of primaryVariant.walk()) {\n\t\tif (!isCodeComponentNode(primaryChild)) continue\n\t\tfindAndReplaceSlots(engine.componentLoader, primaryChild, id => {\n\t\t\tconst newId = renamedSlotIds.get(id)\n\t\t\treturn newId ?? null\n\t\t})\n\t}\n}\n\nfunction getInstanceLayoutPropsFromResolvedNode(node: CanvasNode): AnyNodeUpdate {\n\tif (!isPinnable(node)) return {}\n\n\tconst { left, right, top, bottom, centerAnchorX, centerAnchorY, width, height, widthType, heightType } =\n\t\tnode.constraintValues()\n\n\treturn { left, right, top, bottom, centerAnchorX, centerAnchorY, width, height, widthType, heightType }\n}\n\ninterface VariantInfo extends Size {\n\tname: string | null\n\toverrides: ReplicaOverrides\n\tsourceReplicaId: NodeID\n\thidden: boolean\n\thiddenByParent: boolean\n\tinstanceProps: AnyNodeUpdate\n\titemOrderOverrideIndex: number\n}\n\ninterface VariantsToCreate {\n\tprimaryName: string | null\n\tsourceId: NodeID\n\tsourceScopeId: NodeID\n\tvariants: VariantInfo[]\n\tshouldCreateVariants: boolean\n\tallSlotIds: Set<NodeID>\n}\n\nfunction getVariantsToCreate(\n\tengine: VekterEngine,\n\tselectedNode: CanvasNode,\n\tprimaryVariantNode: CanvasNode,\n): VariantsToCreate | null {\n\tassert(!isReplicaOrReplicaChild(primaryVariantNode), \"Replicas should not be passed to getVariantsToCreate\")\n\n\tconst shouldCreateVariants = isReplicaChild(selectedNode) || isLayoutSection(engine.tree, selectedNode)\n\n\tconst primaryVariantAncestor = getPrimaryVariantAncestor(primaryVariantNode)\n\tif (!primaryVariantAncestor) return null\n\n\tconst variantInfo: VariantInfo[] = []\n\n\tconst replicas = getReplicaVariants(engine, primaryVariantAncestor)\n\n\tfor (const replica of replicas) {\n\t\tconst nodeWithinReplicaId = generateReplicaChildId(replica.id, primaryVariantNode.id)\n\t\tconst nodeWithinReplica = engine.tree.get(nodeWithinReplicaId)\n\t\tassert(nodeWithinReplica, \"nodeWithinReplica must exist\")\n\n\t\tconst { width, height } = engine.tree.getRect(nodeWithinReplica)\n\n\t\tconst overrides: ReplicaOverrides = {}\n\t\tconst instanceProps: AnyNodeUpdate = getInstanceLayoutPropsFromResolvedNode(nodeWithinReplica)\n\n\t\tfor (const node of primaryVariantNode.walk()) {\n\t\t\tconst replicaNodeOverrides = replica.replicaInfo.overrides[node.id]\n\t\t\tif (!replicaNodeOverrides) continue\n\n\t\t\tif (node.id === primaryVariantNode.id) {\n\t\t\t\tconst overridesAndInstanceProps = splitInstancePropsFromOverrides(replicaNodeOverrides)\n\t\t\t\tObject.assign(instanceProps, overridesAndInstanceProps.instanceProps)\n\t\t\t\toverrides[node.id] = overridesAndInstanceProps.overrides\n\t\t\t} else {\n\t\t\t\toverrides[node.id] = replicaNodeOverrides\n\t\t\t}\n\t\t}\n\n\t\tconst hidden = nodeWithinReplica.resolveValue(\"visible\") === false\n\t\tconst hiddenByParent = nodeWithinReplica.cache.visible === false && !hidden\n\n\t\tlet itemOrderOverrideIndex = -1\n\t\tconst parent = engine.tree.getParent(nodeWithinReplicaId)\n\t\tif (parent && hasItemsOrderOverride(parent) && isKeySetAndNotInherited(engine.tree, parent, \"itemsOrder\")) {\n\t\t\titemOrderOverrideIndex = parent.itemsOrder.indexOf(primaryVariantNode.id)\n\t\t}\n\n\t\tvariantInfo.push({\n\t\t\toverrides,\n\t\t\tname: replica.resolveValue(\"name\"),\n\t\t\twidth,\n\t\t\theight,\n\t\t\tsourceReplicaId: replica.id,\n\t\t\thidden,\n\t\t\thiddenByParent,\n\t\t\tinstanceProps,\n\t\t\titemOrderOverrideIndex,\n\t\t})\n\t}\n\n\treturn {\n\t\tprimaryName: primaryVariantAncestor.resolveValue(\"name\"),\n\t\tsourceScopeId: engine.stores.scopeStore.active.id,\n\t\tsourceId: primaryVariantNode.id,\n\t\tvariants: variantInfo,\n\t\tallSlotIds: getSlotIdsForSubTree(engine.componentLoader, primaryVariantNode),\n\t\tshouldCreateVariants,\n\t}\n}\n\ninterface CreateSmartComponentOptions {\n\tengine: VekterEngine\n\tname: string\n\tselectedNode: CanvasNode | null\n\t/** Reduce UI-only side effects (scope switch, zoom, editor/tool changes, analytics). Used by agent. */\n\theadless?: boolean\n}\n\nexport function createSmartComponent({\n\tengine,\n\tname,\n\tselectedNode,\n\theadless = false,\n}: CreateSmartComponentOptions): CreateSmartComponentResult {\n\tconst { codeEditorStore, treeStore, scopeStore } = engine.stores\n\tif (!headless && codeEditorStore.currentCodeFileId) {\n\t\tcodeEditorStore.closeEditor()\n\t}\n\n\tconst smartComponentId = randomID()\n\n\tif (!headless) {\n\t\trecord(\"component_canvas_create\", {\n\t\t\tcomponentId: smartComponentId,\n\t\t\tsource: \"new_component\",\n\t\t})\n\t}\n\n\tif (!selectedNode || !ContextAction.canConvertNodeToSmartComponentPrimaryVariant(engine.tree, selectedNode)) {\n\t\treturn createSmartComponentWithEmptyPrimaryVariant(engine, smartComponentId, name, headless)\n\t}\n\n\tlet primaryVariantNode: FrameNode | PrimaryVariantSourceNeedsWrappingFrame = selectedNode\n\n\t// Since we reuse the source node as the primary variant, we also reuse it's\n\t// cache until the next Engine frame. Some of this cache data may be\n\t// important, like measured size or parentDirectedLayout values, which could\n\t// be relied on by helpers used in the rest of this function. However, since\n\t// we are going to change the Engine's selection to this node, we don't want\n\t// to show an Overlay that this source node may have been a descendant of.\n\t// To ensure that doesn't happen, we cleanup just the overlay ancestor id.\n\tselectedNode.cache.overlayAncestorId = null\n\n\tif (!headless) {\n\t\t// Wrapping of nodes is only allowed when the highlight tool is active\n\t\tengine.setTool(Tools.Highlight)\n\t}\n\n\tlet selectedSourceReplicaParent: (CanvasNode & IsReplica) | null = null\n\n\tassert(!isReplica(primaryVariantNode), \"Replicas are not supported\")\n\tassert(!isMaster(primaryVariantNode), \"Master nodes are not supported\")\n\tif (isReplicaChild(primaryVariantNode)) {\n\t\tconst replica = TemplateHelper.getReplicaForTemplateNode(engine.tree, primaryVariantNode)\n\t\tassert(replica, \"replica must exist for replica child node\")\n\t\tselectedSourceReplicaParent = replica\n\n\t\tconst original = engine.tree.get<typeof primaryVariantNode>(primaryVariantNode.originalid)\n\t\tassert(original, \"original node must exist\")\n\t\tprimaryVariantNode = original\n\t}\n\n\tconst movedSourceRepeatArray = getMovedSourceRepeatArray(primaryVariantNode)\n\tconst variantsToCreate = getVariantsToCreate(engine, selectedNode, primaryVariantNode)\n\n\tconst allSourceNodeIds = getAllSubtreeIds(primaryVariantNode)\n\n\tconst selectedNodeRect = engine.tree.getRect(primaryVariantNode)\n\tconst originalParentId = primaryVariantNode.parentid\n\tconst parentOfOriginal = engine.tree.getParent(primaryVariantNode.id) || scopeStore.active\n\tconst indexOfOriginal = parentOfOriginal.children.indexOf(primaryVariantNode)\n\tconst needsWrappingFrame = requiresWrappingFrame(primaryVariantNode)\n\n\tprimaryVariantNode = stripKeyEventsFromSources(primaryVariantNode)\n\tprimaryVariantNode = engine.tree.current(primaryVariantNode) ?? primaryVariantNode\n\n\t// We are lifting incompatible properties before possibly wrapping the selected node, because\n\t// otherwise these incompatible properties are spread out between the selected and wrapping\n\t// nodes. Adding even more complexity.\n\tconst instanceUpdate = liftIncompatibleVariantPropsToInstance(engine, primaryVariantNode)\n\tprimaryVariantNode = engine.tree.current(primaryVariantNode) ?? primaryVariantNode\n\n\t// Check if the root node has effects. If it does, lift them to the instance.\n\tconst sourceEffects = liftEffectsOnComponentCreation(primaryVariantNode, treeStore.tree)\n\tprimaryVariantNode = engine.tree.current(primaryVariantNode) ?? primaryVariantNode\n\n\tlet baseVariantId = primaryVariantNode.id\n\tconst wrappingOptions = headless ? { bypassToolGuard: true, preserveSelection: true } : undefined\n\n\tconst primaryVariantWidthType =\n\t\tprimaryVariantNode.widthType === DimensionType.Auto && !needsWrappingFrame\n\t\t\t? DimensionType.Auto\n\t\t\t: DimensionType.FixedNumber\n\tlet primaryVariantHeightType =\n\t\tprimaryVariantNode.heightType === DimensionType.Auto && !needsWrappingFrame\n\t\t\t? DimensionType.Auto\n\t\t\t: DimensionType.FixedNumber\n\n\tif (needsWrappingFrame) {\n\t\tif (isDataRepeater(primaryVariantNode) && primaryVariantNode.heightType === DimensionType.Auto) {\n\t\t\t// It's best if the auto height repeater is neatly wrapped by the primary variant.\n\t\t\tprimaryVariantHeightType = DimensionType.Auto\n\n\t\t\tconst wrappedStackId = ContextAction.addStack(engine, [primaryVariantNode], wrappingOptions)\n\t\t\tassert(!isUndefined(wrappedStackId), \"wrapped frame must have an id\")\n\t\t\tbaseVariantId = wrappedStackId\n\n\t\t\tconst stack = engine.tree.get(wrappedStackId)\n\t\t\tif (isFrameNode(stack)) {\n\t\t\t\tstack.set({ heightType: DimensionType.Auto })\n\t\t\t}\n\t\t} else {\n\t\t\tconst wrappedFrameId = ContextAction.addFrame(engine, [primaryVariantNode], wrappingOptions)\n\t\t\tassert(!isUndefined(wrappedFrameId), \"wrapped frame must have an id\")\n\t\t\tbaseVariantId = wrappedFrameId\n\t\t}\n\t}\n\n\tconst outerFrame = engine.tree.get(baseVariantId)\n\tassert(outerFrame && isFrameNode(outerFrame), \"The root of the primary variant candidate must exist and be a Frame\")\n\tconst repeatedItemSnapshots = snapshotRepeatedItemsForNodes(engine.tree, [outerFrame])\n\n\t// We grab the original node's constraints here, before we move it and\n\t// change them, so we can reuse them later for the constraints of the\n\t// component node that's going to replace it\n\tconst wrapperConstraints = outerFrame.constraintValues()\n\n\tconst { innerConstraints, outerConstraints } = extractSizeConstraints(outerFrame)\n\n\tconst transforms = getTransforms(primaryVariantNode)\n\tif (withTransforms(primaryVariantNode)) primaryVariantNode = primaryVariantNode.set(transformDefaults)\n\n\t// You can't set viewport height on descendants when creating a smart component.\n\tprimaryVariantNode = removeIncompatiblePropsInSubtree(engine, primaryVariantNode)\n\n\tconst variables: VariableDefinition[] = []\n\n\tconst instanceCustomCursor = extractCustomCursorProperties(primaryVariantNode)\n\n\t// Collect all actions, turn them into variables, and assign original actions to the instance\n\tconst eventInfo = collectEvents(engine.componentLoader, outerFrame, variables)\n\tconst instanceActions = createComponentInstanceActions(eventInfo)\n\tconst {\n\t\tassignLiftedVariablesToNodes,\n\t\tassignExistingVariablesToInstance,\n\t\tgetUpdatedSetVariableActionVariableId,\n\t\tgetUpdatedVariableReference,\n\t} = collectVariablesToLift(engine, smartComponentId, outerFrame, allSourceNodeIds, variables, movedSourceRepeatArray)\n\n\tconst smartComponent = engine.createNode(\n\t\tSmartComponentNode,\n\t\t{\n\t\t\tid: smartComponentId,\n\t\t\tname,\n\t\t\tbaseVariantId,\n\t\t\tvariables,\n\t\t},\n\t\tengine.tree.root.id,\n\t)\n\n\tengine.moveNode(baseVariantId, smartComponent.id)\n\n\tif (movedSourceRepeatArray) {\n\t\tconst movedRepeatNode = engine.tree.get(movedSourceRepeatArray.sourceRepeatArrayProviderId)\n\t\tassert(hasRepeatArray(movedRepeatNode), \"moved repeat node must still have its repeat array before cleanup\")\n\t\tmovedRepeatNode.set({ repeatArray: undefined })\n\t}\n\n\tengine.tree.get<FrameNode>(baseVariantId)?.set({\n\t\tname: primaryVariantName,\n\t\ttop: 0,\n\t\tleft: 0,\n\t\tright: null,\n\t\tbottom: null,\n\t\twidth: selectedNodeRect.width,\n\t\theight: selectedNodeRect.height,\n\t\twidthType: primaryVariantWidthType,\n\t\theightType: primaryVariantHeightType,\n\t\tisMaster: true,\n\t\tisVariant: true,\n\t\tvariantTransition: defaultDurationBasedSpringTransition,\n\t\treplicaInfo: null,\n\t\toriginalid: null,\n\t\tisBreakpoint: false,\n\t\t...customCursorDefaults,\n\t\t...innerConstraints,\n\t})\n\n\t// Assign variable references\n\t// This has to happen after creating the smart component, else this results in a crasher when creating multiple variants\n\treplaceEventActionsWithTriggerEventAction(engine, eventInfo)\n\tupdateSetVariableActionVariableIds(engine, baseVariantId, getUpdatedSetVariableActionVariableId)\n\tassignLiftedVariablesToNodes()\n\n\t// Get the nodes future, which should be a Frame variant.\n\tconst primaryVariant = engine.tree.get(baseVariantId)\n\tconst smartComponentNode = smartComponent.draftOrCurrent()\n\tassert(primaryVariant && isFrameNode(primaryVariant), \"primary variant must be a frame\")\n\tassert(isPrimaryVariant(primaryVariant), \"primary variant must be a variant\")\n\tassert(isSmartComponentNode(smartComponentNode), \"parent must be a smart component node\")\n\n\tconst moduleCreation = engine.stores.codeGenerationStore.createModuleFromComponentSource(smartComponentNode)\n\tmoduleCreation.catch(unhandledError)\n\n\t// The new component is not available in the component loader\n\t// until the next engine update. However, since we know the\n\t// name, we can avoid having to wait for the component to become\n\t// available and eagerly add it to the canvas.\n\tconst instanceId = randomID()\n\n\tif (!headless) {\n\t\t// If we are going to create an instance, ensure it is set as the selected\n\t\t// node in the current scope before we switch to the newly created smart\n\t\t// component's scope.\n\t\tengine.stores.selectionStore.set(\n\t\t\tselectedSourceReplicaParent ? selectedSourceReplicaParent.id + instanceId : instanceId,\n\t\t)\n\n\t\t// By default, when Framer switches scopes, we try to instantly generate\n\t\t// code from any changes queued against that scope. This helps us guarantee\n\t\t// that if the scope you are navigating to contains an instance of the scope\n\t\t// you are leaving, you see changes reflected asap.\n\t\t//\n\t\t// However, in the case of creating a new component from inside a scope, we\n\t\t// want to ensure that the new component is generated before we attempt to\n\t\t// regenerate it's ancestor. To facilitate this behaviour without changing\n\t\t// the above assumption (changes to a scope are instantly generated when\n\t\t// leaving that scope), we switch to the scope of our newly created canvas\n\t\t// component *before* we insert an instance of it into its ancestor. This\n\t\t// ensures that this change is processed *after* the new component is\n\t\t// generated, when we next flush the queue.\n\t\tengine.stores.scopeStore.select(smartComponentId, { keepHistory: false })\n\t\tengine.stores.codeEditorStore.closeEditor()\n\t}\n\n\tconst componentInstance = new CodeComponentNode({\n\t\tid: instanceId,\n\t\tcodeComponentIdentifier: smartComponent.instanceIdentifier,\n\t\tslotsAreChildNodes: experiments.isOn(\"componentSlotsAreChildNodes\"),\n\t\t...wrapperConstraints,\n\t\tgridItemFillCellHeight: withGridItemSize(primaryVariantNode) ? primaryVariantNode.gridItemFillCellHeight : true,\n\t\tgridItemFillCellWidth: withGridItemSize(primaryVariantNode) ? primaryVariantNode.gridItemFillCellWidth : true,\n\t\taspectRatio: null,\n\t\t...outerConstraints,\n\t\t...instanceUpdate,\n\t\t...instanceActions,\n\t\t...instanceCustomCursor,\n\t\t...transforms,\n\t})\n\n\tcomponentInstance.set(getSupportedEffects(componentInstance, sourceEffects))\n\n\tif (isFrameNode(primaryVariantNode)) {\n\t\tconst update = positionTypeUpdateForNewParent(primaryVariantNode, parentOfOriginal)\n\t\tif (update) componentInstance.set(update)\n\t}\n\n\tif (movedSourceRepeatArray) {\n\t\tcomponentInstance.set({ repeatArray: movedSourceRepeatArray.repeatArrayReference })\n\t}\n\n\tassignExistingVariablesToInstance(componentInstance, movedSourceRepeatArray)\n\tengine.tree.insertNode(componentInstance, originalParentId, indexOfOriginal)\n\tconst instances = [componentInstance]\n\tmoveOverlays(engine, eventInfo, componentInstance, baseVariantId)\n\tconst renamedIds = new RenamedIds([[baseVariantId, componentInstance.id]])\n\trestoreRepeatedItemsFromSnapshots(engine.tree, repeatedItemSnapshots, renamedIds)\n\n\t// When a child node is componentized, update its connections with the\n\t// parent node.\n\t//\n\t// @TODO: for now we're updating the node connects only for floating\n\t// overlays to reduce the impact. But maybe we should consider updating it\n\t// regardless?\n\tconst originalParent = originalParentId ? engine.tree.getNode(originalParentId) : null\n\tif (originalParent && !isScopeNode(originalParent) && hasFloatingPosition(componentInstance)) {\n\t\tupdateNodeConnections(\n\t\t\tengine.tree,\n\t\t\tengine.componentLoader,\n\t\t\toriginalParent,\n\t\t\trenamedIds,\n\t\t\tisFixedOrRelativeOverlay(originalParent) || nodeIsInOverlay(originalParent),\n\t\t)\n\t}\n\n\tlet zoomRect = { ...selectedNodeRect, x: 0, y: 0 }\n\n\tif (variantsToCreate) {\n\t\tconst latestPrimaryVariant = primaryVariant.draftOrCurrent() as FrameNode & IsVariant\n\t\tassert(isMaster(latestPrimaryVariant), \"latest primary variant must be a master\")\n\t\tassert(latestPrimaryVariant.isVariant, \"latest primary variant must be a variant\")\n\n\t\tcopySlotContentIntoComponent(engine, latestPrimaryVariant, variantsToCreate)\n\n\t\tlet replicaVariantPositionX = selectedNodeRect.width + 100\n\n\t\tlet hasAddedVariants = false\n\n\t\tfor (const variantInfo of variantsToCreate.variants) {\n\t\t\tconst associatedSourceReplica = engine.tree.get(variantInfo.sourceReplicaId)\n\t\t\tassert(associatedSourceReplica, \"associatedSourceReplica must exist\")\n\t\t\tassert(isReplica(associatedSourceReplica), \"associatedSourceReplica must be a replica\")\n\t\t\t// Build the replica sub tree nodes, so we can apply changes to the nodes themselves.\n\t\t\tTemplateHelper.replicaWithChanges(engine.stores.treeStore.tree, associatedSourceReplica)\n\n\t\t\tconst replicaComponentInstanceVariantId = generateReplicaChildId(associatedSourceReplica.id, componentInstance.id)\n\t\t\tconst node = engine.tree.get(replicaComponentInstanceVariantId)\n\t\t\tassert(isCodeComponentNode(node), \"replica component instance must be a code component\")\n\t\t\tinstances.push(node)\n\n\t\t\tif (variantInfo.hidden) {\n\t\t\t\tnode.set({ visible: false })\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (variantInfo.hiddenByParent) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Make sure node stays in the same position within the itemsOrder\n\t\t\tconst parent = engine.tree.getParent(node.id)\n\t\t\tif (parent && hasItemsOrderOverride(parent) && variantInfo.itemOrderOverrideIndex !== -1) {\n\t\t\t\tconst currentIndex = parent.itemsOrder.indexOf(componentInstance.id)\n\t\t\t\tif (currentIndex !== -1) {\n\t\t\t\t\tconst updatedItemOverride = List.move(parent.itemsOrder, currentIndex, variantInfo.itemOrderOverrideIndex)\n\t\t\t\t\tparent.set({ itemsOrder: updatedItemOverride as NodeID[] })\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tnode.set(variantInfo.instanceProps)\n\n\t\t\tif (!variantsToCreate.shouldCreateVariants) continue\n\n\t\t\thasAddedVariants = true\n\n\t\t\tconst newVariantNode = TemplateHelper.create(engine.tree, latestPrimaryVariant, {\n\t\t\t\toverrides: variantInfo.overrides,\n\t\t\t})\n\t\t\tassert(isVariant(newVariantNode), \"newVariantNode must be a variant\")\n\t\t\tengine.tree.insertNode(newVariantNode, smartComponentId)\n\n\t\t\tassert(isFrameNode(newVariantNode), \"top level variant should have been created\")\n\t\t\tassert(isReplica(newVariantNode), \"top level variant should be a replica\")\n\t\t\tif (variantInfo.name) newVariantNode.set({ name: variantInfo.name })\n\n\t\t\tconst rect = { x: replicaVariantPositionX, y: 0, width: variantInfo.width, height: variantInfo.height }\n\t\t\treplicaVariantPositionX += variantInfo.width + 100\n\t\t\tzoomRect = Rect.merge(zoomRect, rect)\n\n\t\t\tnewVariantNode.set(\n\t\t\t\tnewVariantNode.updateForRect({\n\t\t\t\t\trect,\n\t\t\t\t\tparentSizeInfo: null,\n\t\t\t\t\tconstraintsLocked: true,\n\t\t\t\t\tshouldGuessPinToBottom: true,\n\t\t\t\t\tshouldGuessPinToRight: true,\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tnode.set(prefixControlProps({ variant: { type: ControlType.Enum, value: newVariantNode.id } }))\n\t\t}\n\n\t\tif (hasAddedVariants && variantsToCreate.primaryName) {\n\t\t\tlatestPrimaryVariant.set({ name: variantsToCreate.primaryName })\n\t\t}\n\t}\n\n\tif (!headless) {\n\t\tzoomRect = Rect.inflate(zoomRect, 100)\n\t\tengine.stores.canvasStore.zoomToCenter(zoomRect, { maxZoom: 1, animated: false })\n\n\t\tif (!variantsToCreate || variantsToCreate.variants.length === 0) {\n\t\t\tengine.stores.selectionStore.set(baseVariantId)\n\t\t}\n\t}\n\n\tfor (const variant of smartComponent.draftOrCurrent().getVariants()) {\n\t\tfor (const descendant of variant.walk()) {\n\t\t\tconst update = generateVariableReferenceUpdateForNode(engine.tree, descendant, getUpdatedVariableReference)\n\t\t\tif (!update) continue\n\n\t\t\tdescendant.set(update)\n\t\t}\n\t}\n\n\treturn { node: smartComponent.draftOrCurrent(), instances, moduleCreation }\n}\n\n/**\n * Smart Components do not support key events, so remove them\n * @see https://github.com/framer/company/issues/23172\n */\nfunction stripKeyEventsFromSources<N>(node: N): N {\n\tif (node instanceof CanvasNode && withFrameEvents(node) && node.onKeyDown) {\n\t\tconst update: Partial<WithFrameEvents> = { onKeyDown: undefined }\n\t\treturn node.set(update as any)\n\t}\n\treturn node\n}\n\nconst scopeType = \"canvas_component\"\n\n// Helpers for lifting all event actions to the instance\n\ninterface EventInfo {\n\tvariableID: string\n\tnodeID: NodeID\n\teventKey: string\n\tliftedActions: EventAction[]\n\tkeptActions: EventAction[]\n}\n\nfunction collectEvents(\n\tcomponentLoader: ComponentLoader,\n\tprimaryVariant: CanvasNode,\n\tvariables: VariableDefinition[],\n): EventInfo[] {\n\tconst result: EventInfo[] = []\n\n\tconst usedNames: Set<string> = new Set(variables.map(variable => variable.name))\n\n\tfor (const { node, skipChildren } of primaryVariant.walkWithSkipChildren()) {\n\t\t// We don't collect events for overlay nodes. Since later on we move the overlay in moveOverlays(), the interactions inside of the overlay don\u2019t need to be lifted.\n\t\tif (isOverlayNode(node)) {\n\t\t\tskipChildren()\n\t\t\tcontinue\n\t\t}\n\t\tconst isNodeWithFrameEvents = withFrameEvents(node)\n\t\tif (isNodeWithFrameEvents || isCodeComponentNode(node)) {\n\t\t\tconst actionMap = getActionsForNode(componentLoader, node)\n\t\t\tfor (const [eventKey, actions] of Object.entries(actionMap)) {\n\t\t\t\t// Don't convert Appear/Keydown event until we support them in isolation\n\t\t\t\t// @FIXME: remove this line when they are supported\n\t\t\t\tif (isNodeWithFrameEvents && (eventKey === keyDownKey || eventKey === appearKey)) continue\n\n\t\t\t\t// Don't lift pagination load more action, because when the repeater is moved into\n\t\t\t\t// the component the action handler is only available within the component.\n\t\t\t\tif (actions.some(isLoadMoreAction)) continue\n\n\t\t\t\tconst shouldKeepActionInComponent = (action: EventAction) =>\n\t\t\t\t\tisSetVariableValueAction(action) || (node.id !== primaryVariant.id && isShowRelativeOverlayAction(action))\n\t\t\t\tconst keptActions = actions.filter(shouldKeepActionInComponent)\n\t\t\t\tconst liftedActions = actions.filter(action => !shouldKeepActionInComponent(action))\n\t\t\t\tif (liftedActions.length === 0) continue\n\n\t\t\t\tconst displayNameMap = isCodeComponentNode(node) ? getMemoEventKeyToDisplayNameMap(componentLoader, node) : null\n\t\t\t\tconst displayEventKey = isPrefixedControlPropKey(eventKey) ? removeControlPropKeyPrefix(eventKey) : eventKey\n\t\t\t\tconst base = eventKeyToDisplayName(displayEventKey, displayNameMap, isNodeWithFrameEvents, true)\n\n\t\t\t\tconst name = uniqueName(base, usedNames)\n\t\t\t\tusedNames.add(name)\n\n\t\t\t\tconst variable = createVariable(\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: ControlType.EventHandler,\n\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t\tname,\n\t\t\t\t\t},\n\t\t\t\t\tscopeType,\n\t\t\t\t)\n\t\t\t\tvariables.push(variable)\n\n\t\t\t\tconst info: EventInfo = {\n\t\t\t\t\tvariableID: variable.id,\n\t\t\t\t\tnodeID: node.id,\n\t\t\t\t\teventKey,\n\t\t\t\t\tliftedActions,\n\t\t\t\t\tkeptActions,\n\t\t\t\t}\n\t\t\t\tresult.push(info)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn result\n}\n\nfunction replaceEventActionsWithTriggerEventAction(engine: VekterEngine, eventInfo: EventInfo[]) {\n\teventInfo.forEach(info => {\n\t\tconst { nodeID, eventKey, variableID } = info\n\t\tconst node = engine.tree.get<CodeComponentNode | (CanvasNode & WithFrameEvents)>(nodeID)\n\t\tif (!node) return\n\n\t\tconst triggerEventAction = createTriggerEventAction(variableID)\n\n\t\tconst actions = [...info.keptActions, triggerEventAction]\n\n\t\tif (isPrefixedControlPropKey(eventKey)) {\n\t\t\tassert(isCodeComponentNode(node))\n\t\t\tconst controlProp: EventHandlerControlProp = { type: ControlType.EventHandler, value: actions }\n\t\t\tconst update: PrefixedControlProps<EventHandlerControlProp> = { [eventKey]: controlProp }\n\t\t\tnode.set(update)\n\t\t} else if (isFrameEvent(eventKey)) {\n\t\t\tassert(!isCodeComponentNode(node))\n\t\t\tnode.set({\n\t\t\t\t[eventKey]: actions,\n\t\t\t} as Partial<WithFrameEvents>)\n\t\t}\n\t})\n}\n\nfunction createComponentInstanceActions(eventInfo: EventInfo[]): PrefixedControlProps {\n\tconst result: Mutable<PrefixedControlProps> = {}\n\n\teventInfo.forEach(({ variableID, liftedActions }) => {\n\t\tconst key = prefixControlPropKey(variableID)\n\t\tresult[key] = { type: ControlType.EventHandler, value: liftedActions }\n\t})\n\n\treturn result\n}\n\n// Helpers for turning text and images into variables\n\ntype LiftedVariableHash = string\n\nfunction getLiftedVariableHash(ref: VariableReference): LiftedVariableHash {\n\treturn `${ref.id}.${ref.providerId}`\n}\n\nfunction getSetVariableActionVariableIdUpdateKey(nodeId: NodeID, actionId: string, variableId: string): string {\n\treturn JSON.stringify([nodeId, actionId, variableId])\n}\n\nfunction getVariableFromAncestor(\n\tengine: VekterEngine,\n\tnode: CanvasNode,\n\treference: VariableReference,\n): VariableDefinition | null {\n\tif (reference.providerId === localeProviderId) {\n\t\tif (reference.id === localeVariableId) {\n\t\t\treturn getLocaleVariable(engine.tree)\n\t\t}\n\t\tif (reference.id === layoutDirectionVariableId) {\n\t\t\treturn getLayoutDirectionVariable(engine.tree)\n\t\t}\n\t\treturn null\n\t}\n\n\tlet provider: CanvasNode | null = null\n\n\tif (reference.providerId) {\n\t\tprovider = engine.tree.getNode(reference.providerId)\n\t} else {\n\t\tconst ancestors = Array.from(node.ancestors())\n\t\tprovider = ancestors.find(isSmartComponentNode) ?? null\n\t}\n\n\tif (!provider || !withVariableProvider(provider)) return null\n\n\tconst variableMap = provider.getProvidedVariableMap(\n\t\tengine.tree,\n\t\tundefined,\n\t\tengine.componentLoader,\n\t\tengine.componentLoader.activeBundleHash,\n\t)\n\n\treturn variableMap?.get(reference.id) ?? null\n}\n\n// TODO: support control reference variables\n// Slug never has to be lifted because only the CMS supports this type\ntype LiftableVariableType = Exclude<\n\tVariableType,\n\t| ControlType.EventHandler\n\t| ControlType.Array\n\t| \"divider\"\n\t| \"controlReference\"\n\t| \"nodePropertyControlReference\"\n\t| \"slug\"\n\t| ControlType.Enum\n>\n\n// Exported for tests\nexport const liftableVariableTypes: Record<LiftableVariableType, true> = {\n\t[ControlType.Boolean]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.Image]: true,\n\t[ControlType.Number]: true,\n\t[ControlType.String]: true,\n\t[ControlType.RichText]: true,\n\t[ControlType.Link]: true,\n\t[ControlType.LinkRelValues]: true,\n\t[ControlType.Date]: true,\n\t[ControlType.File]: true,\n\t[ControlType.ScrollSectionRef]: true,\n\t[ControlType.CustomCursor]: true,\n\t[ControlType.Cursor]: true,\n\t[ControlType.Transition]: true,\n\t[ControlType.Border]: true,\n\t[ControlType.BoxShadow]: true,\n\t[ControlType.Gap]: true,\n\t[ControlType.Padding]: true,\n\t[ControlType.BorderRadius]: true,\n\t[ControlType.CollectionReference]: true,\n\t[ControlType.MultiCollectionReference]: true,\n\t[ControlType.TrackingId]: true,\n\t[ControlType.VectorSetItem]: true,\n\t[ControlType.Location]: true,\n}\n\nfunction isLiftableVariableType(type: VariableType | ControlType): type is LiftableVariableType {\n\treturn Object.hasOwn(liftableVariableTypes, type)\n}\n\nfunction isLiftableVariable(\n\tvariable: VariableDefinition,\n): variable is VariableDefinition & { type: LiftableVariableType } {\n\treturn isLiftableVariableType(variable.type)\n}\n\nfunction createVariableDefinitionForType(\n\texistingVariable: VariableDefinition & { type: LiftableVariableType },\n\tname: string,\n\tnode: CanvasNode,\n\tpropKey: string | undefined,\n): VariableDefinition | null {\n\tconst { type, initialValue } = existingVariable\n\tswitch (type) {\n\t\tcase ControlType.Boolean:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t\toptions: { ...existingVariable.options },\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.Color:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.Image:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.Image,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.Number:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t\toptions: { ...existingVariable.options },\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.String:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t\toptions: { ...existingVariable.options },\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.RichText:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t\toptions: { ...existingVariable.options },\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.Link:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.Link,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.LinkRelValues:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.LinkRelValues,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.Date:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.Date,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue) ?? new Date(0).toJSON(),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.File: {\n\t\t\tif (!isCodeComponentNode(node)) return null\n\t\t\tassert(isString(propKey), \"File control requires propKey\")\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: \"controlReference\",\n\t\t\t\t\tentityIdentifier: node.codeComponentIdentifier,\n\t\t\t\t\tcontrolKey: propKey,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t\texpectedType: ControlType.File,\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.ScrollSectionRef: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.ScrollSectionRef,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.CustomCursor: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.CustomCursor,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.Cursor: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.Cursor,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.Transition: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.Transition,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.Border: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.Border,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.BoxShadow: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.BoxShadow,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.Gap: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.Gap,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.Padding: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.Padding,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.BorderRadius: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.BorderRadius,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.CollectionReference: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t\t\tdataIdentifier: existingVariable.dataIdentifier,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.MultiCollectionReference: {\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t\t\tdataIdentifier: existingVariable.dataIdentifier,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.TrackingId:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(type, initialValue),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.VectorSetItem:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype,\n\t\t\t\t\tinitialValue,\n\t\t\t\t\tsetModuleId: existingVariable.setModuleId,\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tcase ControlType.Location:\n\t\t\treturn createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.Location,\n\t\t\t\t\tinitialValue,\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\t\tdefault: {\n\t\t\tassertNever(type)\n\t\t}\n\t}\n}\n\nfunction createLiftedVariableForExistingVariable(\n\texistingVariable: VariableDefinition,\n\tname: string,\n\tnode: CanvasNode,\n\tpropKey: string | undefined,\n): VariableDefinition | null {\n\tif (!isLiftableVariable(existingVariable)) {\n\t\tif (hostInfo.isDevelopment) {\n\t\t\t// When variables aren't lifted they will be broken in the new component\n\t\t\t// biome-ignore lint/suspicious/noConsole: this only happens in development and should make us more aware about unsupported variables\n\t\t\tconsole.warn(`Did not automatically lift variable of type: ${existingVariable.type}`)\n\t\t}\n\t\treturn null\n\t}\n\n\tconst variableDefinition = createVariableDefinitionForType(existingVariable, name, node, propKey)\n\tif (!variableDefinition) return null\n\n\tconst scopeNode = node.tree()?.getScopeNodeFor(node)\n\n\tif (\n\t\tscopeNode &&\n\t\twithOptional(variableDefinition, ScopeType.SmartComponent) &&\n\t\twithOptional(existingVariable, getScopeTypeForScope(scopeNode))\n\t) {\n\t\tvariableDefinition.optional = existingVariable.optional\n\t}\n\n\treturn variableDefinition\n}\n\ninterface LiftVariableContext {\n\tengine: VekterEngine\n\tsmartComponentId: NodeID\n\tallSourceNodeIds: ReadonlySet<NodeID>\n\tusedNames: Set<string>\n\tvariableAssignments: VariableAssignment[]\n\tvariables: VariableDefinition[]\n\tliftedVariables: Map<LiftedVariableHash, VariableDefinition>\n\tliftedSetVariableActionVariableIds: Map<string, string>\n\tinstanceControlPropsUpdate: Mutable<PrefixedControlProps>\n\tmovedSourceRepeatArray?: MovedSourceRepeatArray\n}\n\ninterface LiftVariableOptions {\n\tnode: CanvasNode\n\ttype: LiftableVariableType\n\tvariableRef: VariableReference\n\tcontext: LiftVariableContext\n\tpropKey: string | undefined\n}\n\nfunction liftVariable({ node, type, variableRef, context, propKey }: LiftVariableOptions): VariableReference | null {\n\tconst { engine, smartComponentId, usedNames, variables, liftedVariables, instanceControlPropsUpdate } = context\n\n\tconst variableHash = getLiftedVariableHash(variableRef)\n\tconst liftedVariable = liftedVariables.get(variableHash)\n\tif (liftedVariable) {\n\t\treturn createVariableReference(liftedVariable.id, smartComponentId)\n\t}\n\n\tif (!canResolveOrIsMovedSourceRepeatArrayProvider(node, variableRef, context)) {\n\t\treturn null\n\t}\n\n\tconst existingVariable = getVariableFromAncestor(engine, node, variableRef)\n\tif (!existingVariable) {\n\t\treturn null\n\t}\n\n\tconst suggestedName = existingVariable.name || getDefaultNameForVariable(type)\n\tconst name = uniqueName(suggestedName, usedNames)\n\tusedNames.add(name)\n\n\tconst variable = createLiftedVariableForExistingVariable(existingVariable, name, node, propKey)\n\tif (!variable) {\n\t\treturn null\n\t}\n\n\tvariables.push(variable)\n\tliftedVariables.set(variableHash, variable)\n\n\t// Initial values of CMS variables are only known within the sandbox so we can't use them.\n\tconst existingVariableProvider = engine.tree.get(variableRef.providerId)\n\tconst existingVariableInitialValueKnown = withVariables(existingVariableProvider)\n\n\tif (variable.type === existingVariable.type && existingVariableInitialValueKnown) {\n\t\tvariable.initialValue = existingVariable.initialValue\n\t} else {\n\t\tconst variableValue = node.cache.getVariableReferenceValue(variableRef)\n\t\tif (isValidPropertyValueType(type, variableValue) && !isUndefined(variableValue)) {\n\t\t\tvariable.initialValue = variableValue\n\t\t}\n\t}\n\n\tinstanceControlPropsUpdate[prefixControlPropKey(variable.id)] = {\n\t\ttype,\n\t\tvalue: { ...variableRef },\n\t}\n\n\treturn createVariableReference(variable.id, smartComponentId)\n}\n\ninterface LiftEnumVariableOptions {\n\tnode: CanvasNode\n\tvariableRef: VariableReference\n\tcontext: LiftVariableContext\n}\n\nfunction liftEnumVariable({ node, variableRef, context }: LiftEnumVariableOptions): VariableReference | undefined {\n\tconst { engine, smartComponentId, usedNames, variables, liftedVariables, instanceControlPropsUpdate } = context\n\n\tconst variableHash = getLiftedVariableHash(variableRef)\n\tconst alreadyLiftedVariable = liftedVariables.get(variableHash)\n\tif (alreadyLiftedVariable) {\n\t\treturn createVariableReference(alreadyLiftedVariable.id, smartComponentId)\n\t}\n\n\tif (!canResolveOrIsMovedSourceRepeatArrayProvider(node, variableRef, context)) {\n\t\treturn undefined\n\t}\n\n\tconst existingVariable = getVariableFromAncestor(engine, node, variableRef)\n\tif (!existingVariable) {\n\t\treturn undefined\n\t}\n\n\tif (existingVariable.type !== \"controlReference\") return undefined\n\tif (existingVariable.expectedType !== ControlType.Enum) return undefined\n\n\tconst parsed = parseModuleIdentifier(existingVariable.entityIdentifier)\n\tif (!isLocalModuleIdentifier(parsed)) return undefined\n\n\t// Only allow lifting Enums defined in the CMS.\n\t// Allowing lifting Enums defined in other Smart Components could allow creating circular references.\n\tif (parsed.type !== ModuleType.Collection) return undefined\n\n\tconst suggestedName = existingVariable.name || Dictionary.Option\n\tconst name = uniqueName(suggestedName, usedNames)\n\tusedNames.add(name)\n\n\tconst variable = createVariable(\n\t\t{\n\t\t\tname,\n\t\t\ttype: \"controlReference\",\n\t\t\tentityIdentifier: existingVariable.entityIdentifier,\n\t\t\tcontrolKey: existingVariable.controlKey,\n\t\t\tinitialValue: existingVariable.initialValue,\n\t\t\texpectedType: ControlType.Enum,\n\t\t\toptional: existingVariable.optional,\n\t\t},\n\t\tscopeType,\n\t)\n\n\tvariables.push(variable)\n\tliftedVariables.set(variableHash, variable)\n\n\tinstanceControlPropsUpdate[prefixControlPropKey(variable.id)] = {\n\t\ttype: ControlType.Enum,\n\t\tvalue: { ...variableRef },\n\t}\n\n\treturn createVariableReference(variable.id, smartComponentId)\n}\n\ntype LiftedComputedValueOutputType = ConvertFromEnumOutputType | ControlType.Array\n\nconst liftableComputedValueTypes: Record<LiftedComputedValueOutputType, true> = {\n\t[ControlType.Boolean]: true,\n\t[ControlType.String]: true,\n\t[ControlType.Enum]: true,\n\t[ControlType.Number]: true,\n\t[ControlType.Color]: true,\n\t[ControlType.Link]: true,\n\t[ControlType.Array]: true,\n\t[ControlType.Gap]: true,\n\t[ControlType.Padding]: true,\n\t[ControlType.BorderRadius]: true,\n}\n\nfunction isLiftedComputedValueOutputType(\n\ttype: ComputedValueOutputType,\n): type is ComputedValueOutputType & LiftedComputedValueOutputType {\n\treturn Object.hasOwn(liftableComputedValueTypes, type)\n}\n\n/**\n * Certain variables within computed values can't be lifted themselves (e.g. enum coming from the\n * CMS). So we lift the computed value instead.\n */\nfunction shouldLiftComputedValue(computedValue: ComputedValue, startValueVariable: VariableDefinition): boolean {\n\t// Computed arrays need to be lifted because the mapping needs to happen for each assignment.\n\tif (computedValue.outputType === ControlType.Array) return true\n\t// Links can contain variables themselves, so best to lift the entire computed link so you only\n\t// have to create a single variable per computed link.\n\tif (computedValue.outputType === ControlType.Link) return true\n\t// Control reference variables are not yet compatible with the Is Set transform, so we make sure\n\t// that such a computed value is lifted in its entirety.\n\tif (startValueVariable.type !== ControlType.Enum && startValueVariable.type !== ControlType.File) return false\n\treturn isLiftedComputedValueOutputType(computedValue.outputType)\n}\n\ninterface LiftComputedValueOptions {\n\tnode: CanvasNode\n\tcomputedValue: ComputedValueFromVariable\n\toutputControl: VerifiedControlDescription | undefined\n\tinputVariable: VariableDefinition\n\tcontext: LiftVariableContext\n\tpropKey: string\n}\n\nfunction liftComputedValue({\n\tnode,\n\tcomputedValue,\n\toutputControl,\n\tinputVariable,\n\tcontext,\n\tpropKey,\n}: LiftComputedValueOptions): DynamicValue | null {\n\tconst { engine, smartComponentId, usedNames, variables, instanceControlPropsUpdate } = context\n\n\tconst outputType = computedValue.outputType\n\n\tconst suggestedName = titleCase(outputControl?.title ?? propKey)\n\tconst name = uniqueName(suggestedName, usedNames)\n\tusedNames.add(name)\n\n\tlet variable: VariableDefinition | undefined\n\n\tassert(isLiftedComputedValueOutputType(outputType))\n\n\tswitch (outputType) {\n\t\tcase ControlType.String:\n\t\t\tvariable = createVariable(\n\t\t\t\t{ type: ControlType.String, name: suggestedName, initialValue: Dictionary.Content },\n\t\t\t\t\"canvas_component\",\n\t\t\t)\n\t\t\tbreak\n\t\tcase ControlType.Color:\n\t\t\tvariable = createVariable(\n\t\t\t\t{ type: ControlType.Color, name: suggestedName, initialValue: \"#09F\" },\n\t\t\t\t\"canvas_component\",\n\t\t\t)\n\t\t\tbreak\n\t\tcase ControlType.Boolean:\n\t\t\tvariable = createVariable(\n\t\t\t\t{ type: ControlType.Boolean, name: suggestedName, initialValue: true },\n\t\t\t\t\"canvas_component\",\n\t\t\t)\n\t\t\tbreak\n\t\tcase ControlType.Number:\n\t\t\tvariable = createVariable({ type: ControlType.Number, name: suggestedName, initialValue: 0 }, \"canvas_component\")\n\t\t\tbreak\n\t\tcase ControlType.Link:\n\t\t\tvariable = createVariable(\n\t\t\t\t{ type: ControlType.Link, name: suggestedName, initialValue: undefined },\n\t\t\t\t\"canvas_component\",\n\t\t\t)\n\t\t\tbreak\n\t\tcase ControlType.Gap:\n\t\t\tvariable = createVariable({ type: ControlType.Gap, name: suggestedName, initialValue: \"0px\" }, \"canvas_component\")\n\t\t\tbreak\n\t\tcase ControlType.Padding:\n\t\t\tvariable = createVariable(\n\t\t\t\t{ type: ControlType.Padding, name: suggestedName, initialValue: \"0px\" },\n\t\t\t\t\"canvas_component\",\n\t\t\t)\n\t\t\tbreak\n\t\tcase ControlType.BorderRadius:\n\t\t\tvariable = createVariable(\n\t\t\t\t{ type: ControlType.BorderRadius, name: suggestedName, initialValue: \"0px\" },\n\t\t\t\t\"canvas_component\",\n\t\t\t)\n\t\t\tbreak\n\t\tcase ControlType.Enum: {\n\t\t\tif (!isCodeComponentNode(node) || !propKey) return null\n\t\t\tif (!outputControl) return null\n\t\t\tif (outputControl.type !== ControlType.Enum) return null\n\n\t\t\tvariable = createVariable(\n\t\t\t\t{\n\t\t\t\t\ttype: \"controlReference\",\n\t\t\t\t\tname: suggestedName,\n\t\t\t\t\tinitialValue: getEnumControlPropValue(outputControl, undefined),\n\t\t\t\t\toptional: outputControl.optional === true ? true : undefined,\n\t\t\t\t\tentityIdentifier: node.codeComponentIdentifier,\n\t\t\t\t\tcontrolKey: propKey,\n\t\t\t\t\texpectedType: ControlType.Enum,\n\t\t\t\t},\n\t\t\t\t\"canvas_component\",\n\t\t\t)\n\t\t\tbreak\n\t\t}\n\t\tcase ControlType.Array: {\n\t\t\tif (!isCodeComponentNode(node)) return null\n\t\t\tif (!outputControl) return null\n\t\t\tif (!isArrayOfObjectControlDescription(outputControl)) return null\n\t\t\tassert(inputVariable.type === ControlType.Array)\n\n\t\t\t// We only support Galleries for now.\n\t\t\tconst outputItemControlKeys = Object.keys(outputControl.control.controls)\n\t\t\tif (outputItemControlKeys.length !== 1) return null\n\t\t\tconst outputItemControlKey = outputItemControlKeys[0]\n\t\t\tif (!outputItemControlKey) return null\n\t\t\tconst outputItemControl = outputControl.control.controls[outputItemControlKey]\n\t\t\tassert(outputItemControl, \"outputItemControl should be defined\")\n\t\t\tif (outputItemControl.type !== ControlType.ResponsiveImage) return null\n\n\t\t\tassert(\n\t\t\t\tcomputedValue.transforms.length === 1,\n\t\t\t\t\"Only one transform is supported, if this crashes we need to make sure the other transforms are preserved\",\n\t\t\t)\n\n\t\t\tconst [firstTransform] = computedValue.transforms\n\t\t\tif (firstTransform?.name !== \"arrayToArray\") return null\n\n\t\t\tconst inputItemControlProp = firstTransform.mapping[outputItemControlKey]\n\t\t\tif (!isInlineTransformVariableReference(inputItemControlProp?.value)) return null\n\n\t\t\tconst newGalleryVariable = createGalleryVariable({\n\t\t\t\tengine,\n\t\t\t\texistingGalleryVariable: inputVariable,\n\t\t\t\texistingGalleryVariableReference: computedValue.startValue,\n\t\t\t\tsuggestedName,\n\t\t\t})\n\t\t\tif (!newGalleryVariable) return null\n\n\t\t\tconst { galleryVariable } = newGalleryVariable\n\n\t\t\tconst galleryControlDescription = controlDescriptionFromVariable(\n\t\t\t\tengine.tree,\n\t\t\t\tengine.componentLoader,\n\t\t\t\tgalleryVariable,\n\t\t\t\tScopeType.SmartComponent,\n\t\t\t)\n\t\t\tassert(\n\t\t\t\tisArrayOfObjectControlDescription(galleryControlDescription),\n\t\t\t\t\"galleryControlDescription should be defined\",\n\t\t\t)\n\n\t\t\tvariables.push(galleryVariable)\n\n\t\t\tconst instanceComputedValue = createArrayToArrayComputedValue({\n\t\t\t\tengine: context.engine,\n\t\t\t\tsourceArrayReference: computedValue.startValue,\n\t\t\t\ttargetArrayControl: galleryControlDescription,\n\t\t\t})\n\t\t\tassert(instanceComputedValue, \"instanceComputedValue should be defined\")\n\n\t\t\tinstanceControlPropsUpdate[prefixControlPropKey(galleryVariable.id)] = {\n\t\t\t\ttype: outputType,\n\t\t\t\tvalue: instanceComputedValue,\n\t\t\t}\n\n\t\t\tconst newGalleryVariableRef = createVariableReference(galleryVariable.id, smartComponentId)\n\t\t\tconst existingInstanceComputedValue = createArrayToArrayComputedValue({\n\t\t\t\tengine: context.engine,\n\t\t\t\tsourceArrayReference: newGalleryVariableRef,\n\t\t\t\ttargetArrayControl: outputControl,\n\t\t\t\tsourceArrayControl: galleryControlDescription,\n\t\t\t})\n\t\t\tassert(existingInstanceComputedValue, \"existingInstanceComputedValue should be defined\")\n\t\t\treturn existingInstanceComputedValue\n\t\t}\n\t\tdefault:\n\t\t\toutputType satisfies never\n\t\t\treturn null\n\t}\n\n\tvariables.push(variable)\n\n\tconst currentValue = computeValue(\n\t\tcomputedValue,\n\t\tnode.cache,\n\t\tundefined,\n\t\tnode.cache.getVariableControlByReference(computedValue.startValue),\n\t\toutputControl,\n\t\tundefined,\n\t)\n\tif (isValidPropertyValueType(outputType, currentValue) && !isUndefined(currentValue)) {\n\t\tvariable.initialValue = currentValue\n\t}\n\n\tinstanceControlPropsUpdate[prefixControlPropKey(variable.id)] = {\n\t\ttype: outputType,\n\t\tvalue: deepClone(computedValue),\n\t}\n\n\treturn createVariableReference(variable.id, smartComponentId)\n}\n\n/** If the variable provider is part of the selected nodes we don't have to lift the variable */\nfunction variableProviderIsPartOfSelection(ref: VariableReference, context: LiftVariableContext): boolean {\n\treturn Boolean(\n\t\tref.providerId &&\n\t\tcontext.allSourceNodeIds.has(ref.providerId) &&\n\t\t!isMovedSourceRepeatArrayProviderId(ref.providerId, context),\n\t)\n}\n\ninterface MovedSourceRepeatArray {\n\tsourceRepeatArrayProviderId: NodeID\n\trepeatArrayReference: VariableReference\n}\n\nfunction getMovedSourceRepeatArray(node: CanvasNode): MovedSourceRepeatArray | null {\n\tif (!hasRepeatArray(node)) return null\n\n\treturn {\n\t\tsourceRepeatArrayProviderId: node.id,\n\t\trepeatArrayReference: node.repeatArray,\n\t}\n}\n\nfunction isMovedSourceRepeatArrayProviderId(\n\tproviderId: NodeID | undefined,\n\tcontext: LiftVariableContext,\n): providerId is NodeID {\n\treturn Boolean(providerId && providerId === context.movedSourceRepeatArray?.sourceRepeatArrayProviderId)\n}\n\nfunction canResolveOrIsMovedSourceRepeatArrayProvider(\n\tnode: CanvasNode,\n\tvariableRef: VariableReference,\n\tcontext: LiftVariableContext,\n): boolean {\n\treturn (\n\t\tisMovedSourceRepeatArrayProviderId(variableRef.providerId, context) ||\n\t\tnode.cache.canResolveVariableReference(variableRef)\n\t)\n}\n\n/** Lifts the property if the current value is a variable reference */\nfunction liftPropertyVariableIfNeeded<N extends CanvasNode>(\n\tnode: N,\n\tkey: keyof N & string,\n\ttype: LiftableVariableType,\n\tcontext: LiftVariableContext,\n): boolean {\n\tif (!node.supportsDynamicValues()) return false\n\n\tconst value = node[key]\n\tif (isVariableReference(value)) {\n\t\tif (variableProviderIsPartOfSelection(value, context)) return false\n\n\t\tconst variableRef = liftVariable({\n\t\t\tnode,\n\t\t\ttype,\n\t\t\tvariableRef: value,\n\t\t\tcontext,\n\t\t\tpropKey: key,\n\t\t})\n\n\t\tif (!variableRef) {\n\t\t\treturn false\n\t\t}\n\n\t\tcontext.variableAssignments.push(() => {\n\t\t\tconst transitionKey = \"transition\" satisfies keyof WithTransition\n\t\t\tconst variantTransitionKey = \"variantTransition\" satisfies keyof WithVariant\n\t\t\tconst nodeKey = key === transitionKey && isVariant(node) ? variantTransitionKey : key\n\t\t\tcontext.engine.tree.current(node)?.set({ [nodeKey]: variableRef } as Partial<N>)\n\t\t})\n\t\treturn true\n\t}\n\tif (isComputedValueFromVariableReference(value)) {\n\t\tif (variableProviderIsPartOfSelection(value.startValue, context)) return false\n\n\t\tconst variable = getVariableFromAncestor(context.engine, node, value.startValue)\n\t\tif (!variable) return false\n\n\t\tif (shouldLiftComputedValue(value, variable)) {\n\t\t\tconst dynamicValue = liftComputedValue({\n\t\t\t\tnode,\n\t\t\t\tcomputedValue: value,\n\t\t\t\toutputControl: undefined,\n\t\t\t\tinputVariable: variable,\n\t\t\t\tcontext,\n\t\t\t\tpropKey: key,\n\t\t\t})\n\n\t\t\tif (!dynamicValue) return false\n\n\t\t\tcontext.variableAssignments.push(() => {\n\t\t\t\tcontext.engine.tree.current(node)?.set({ [key]: dynamicValue } as Partial<N>)\n\t\t\t})\n\n\t\t\treturn true\n\t\t}\n\n\t\tif (!isLiftableVariableType(variable.type)) return false\n\n\t\tconst variableRef = liftVariable({\n\t\t\tnode,\n\t\t\ttype: variable.type,\n\t\t\tvariableRef: value.startValue,\n\t\t\tcontext,\n\t\t\tpropKey: key,\n\t\t})\n\n\t\tif (!variableRef) {\n\t\t\treturn false\n\t\t}\n\n\t\tcontext.variableAssignments.push(() => {\n\t\t\tconst computedValue: ComputedValue = { ...value, startValue: variableRef }\n\t\t\tcontext.engine.tree.current(node)?.set({ [key]: computedValue } as Partial<N>)\n\t\t})\n\t\treturn true\n\t}\n\n\treturn false\n}\n\nfunction liftGalleryRepeaterArrayIfNeeded({\n\tnode,\n\tcontext,\n\tsourceArrayReference,\n\tassignLocalArrayReference,\n}: {\n\tnode: CanvasNode\n\tcontext: LiftVariableContext\n\tsourceArrayReference: VariableReference\n\tassignLocalArrayReference: (reference: VariableReference) => void\n}): GetUpdatedVariableReference | undefined {\n\tif (variableProviderIsPartOfSelection(sourceArrayReference, context)) return\n\tif (!node.cache.canResolveVariableReference(sourceArrayReference)) return\n\tconst { engine, usedNames, variables, instanceControlPropsUpdate, variableAssignments, smartComponentId } = context\n\n\tconst existingGalleryVariable = getVariableFromAncestor(engine, node, sourceArrayReference)\n\tif (!existingGalleryVariable || existingGalleryVariable.type !== ControlType.Array) return\n\n\tconst suggestedName = existingGalleryVariable.name || getDefaultNameForVariable(existingGalleryVariable.type)\n\tconst name = uniqueName(suggestedName, usedNames)\n\tusedNames.add(name)\n\n\tconst newGalleryVariable = createGalleryVariable({\n\t\tengine,\n\t\tsuggestedName: name,\n\t\texistingGalleryVariable: existingGalleryVariable,\n\t\texistingGalleryVariableReference: sourceArrayReference,\n\t})\n\n\tif (!newGalleryVariable) return\n\tconst { galleryVariable, galleryImageId, existingGalleryVariableImageId } = newGalleryVariable\n\n\tconst galleryControlDescription = controlDescriptionFromVariable(\n\t\tengine.tree,\n\t\tengine.componentLoader,\n\t\tgalleryVariable,\n\t\tScopeType.SmartComponent,\n\t)\n\tconst instanceComputedValue = createArrayToArrayComputedValue({\n\t\tengine,\n\t\tsourceArrayReference,\n\t\ttargetArrayControl: galleryControlDescription,\n\t})\n\n\tif (!instanceComputedValue) return\n\n\tvariables.push(galleryVariable)\n\n\tinstanceControlPropsUpdate[prefixControlPropKey(galleryVariable.id)] = {\n\t\ttype: ControlType.Array,\n\t\tvalue: instanceComputedValue,\n\t}\n\n\tvariableAssignments.push(() => {\n\t\tassignLocalArrayReference(createVariableReference(galleryVariable.id, smartComponentId))\n\t})\n\n\treturn (variableReference: VariableReference) => {\n\t\tif (variableReference.providerId !== node.id) return\n\t\tif (variableReference.id !== existingGalleryVariableImageId) return\n\t\treturn createVariableReference(galleryImageId, node.id)\n\t}\n}\n\nfunction liftDataRepeaterArrayIfNeeded(\n\tnode: CanvasNode,\n\tcontext: LiftVariableContext,\n): GetUpdatedVariableReference | undefined {\n\tif (!withDataRepeaterArray(node) || !node.dataRepeaterArray) return\n\n\treturn liftGalleryRepeaterArrayIfNeeded({\n\t\tnode,\n\t\tcontext,\n\t\tsourceArrayReference: node.dataRepeaterArray,\n\t\tassignLocalArrayReference: reference => {\n\t\t\tcontext.engine.tree.current(node)?.set({ dataRepeaterArray: reference })\n\t\t},\n\t})\n}\n\nfunction liftRepeatArrayIfNeeded(\n\tnode: CanvasNode,\n\tcontext: LiftVariableContext,\n): GetUpdatedVariableReference | undefined {\n\tif (isMovedSourceRepeatArrayProviderId(node.id, context)) return\n\tif (!hasRepeatArray(node)) return\n\n\treturn liftGalleryRepeaterArrayIfNeeded({\n\t\tnode,\n\t\tcontext,\n\t\tsourceArrayReference: node.repeatArray,\n\t\tassignLocalArrayReference: reference => {\n\t\t\tcontext.engine.tree.current(node)?.set({ repeatArray: reference })\n\t\t},\n\t})\n}\n\n/** Link should not be lifted when its provided by a data repeater that's part of the converted layers. */\nfunction linkContainsCollectionItemProvidedBySelectedRepeater(\n\tengine: VekterEngine,\n\tnode: CanvasNode & WithLink,\n\tallSourceNodeIds: ReadonlySet<NodeID>,\n): boolean {\n\tconst link = node.getLink()\n\tif (!isLinkToWebPage(link)) return false\n\tconst targetNode = engine.tree.getNode(link.webPageId)\n\tif (!isWebPageNode(targetNode)) return false\n\tif (!targetNode.dataIdentifier) return false\n\tconst dataRepeater = Array.from(node.ancestors()).find(\n\t\tancestor => isDataRepeater(ancestor) && ancestor.dataIdentifier === targetNode.dataIdentifier,\n\t)\n\tif (!dataRepeater) return false\n\treturn allSourceNodeIds.has(dataRepeater.id)\n}\n\nfunction liftOrCreateEffectScrollTargets<T extends EffectScrollTarget, N extends CanvasNode>(\n\tscrollTargets: T[] | undefined,\n\tnode: N,\n\tkey: keyof N & string,\n\tcontext: LiftVariableContext,\n): T[] | undefined {\n\tif (isUndefined(scrollTargets)) return undefined\n\n\tconst { smartComponentId, usedNames, variables, instanceControlPropsUpdate, variableAssignments } = context\n\n\tlet hasUpdate = false\n\t// Map the scroll targets, making sure that we don't drop any targets.\n\t// Invalid targets will be properly presented in the UI with an option to\n\t// fix, and won't be included in code-generation until valid. This ensures\n\t// we lose any transforms.\n\tconst update = scrollTargets.map(value => {\n\t\tconst target = value.target\n\n\t\t// Lift a variable that already exists.\n\t\tif (isVariableReference(target) && !variableProviderIsPartOfSelection(target, context)) {\n\t\t\tconst variableRef = liftVariable({\n\t\t\t\ttype: ControlType.ScrollSectionRef,\n\t\t\t\tvariableRef: target,\n\t\t\t\tcontext,\n\t\t\t\tnode,\n\t\t\t\tpropKey: key,\n\t\t\t})\n\n\t\t\tif (!variableRef) return value\n\n\t\t\t// Lifting a variable creates a new variable inside the new\n\t\t\t// component, and reuses the existing variable from the current\n\t\t\t// scope.\n\t\t\tinstanceControlPropsUpdate[prefixControlPropKey(variableRef.id)] = {\n\t\t\t\ttype: ControlType.ScrollSectionRef,\n\t\t\t\tvalue: target,\n\t\t\t}\n\n\t\t\thasUpdate = true\n\n\t\t\treturn {\n\t\t\t\t...value,\n\t\t\t\ttarget: variableRef,\n\t\t\t}\n\t\t}\n\n\t\t// Create a variable from a reference to a scroll section id.\n\t\tif (isString(target)) {\n\t\t\tconst name = uniqueName(Dictionary.ScrollSection, usedNames)\n\t\t\tusedNames.add(name)\n\n\t\t\tconst variable = createVariable(\n\t\t\t\t{\n\t\t\t\t\tname,\n\t\t\t\t\ttype: ControlType.ScrollSectionRef,\n\t\t\t\t\tinitialValue: getDefaultVariableValue(ControlType.ScrollSectionRef, undefined),\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t)\n\n\t\t\tinstanceControlPropsUpdate[prefixControlPropKey(variable.id)] = {\n\t\t\t\ttype: ControlType.ScrollSectionRef,\n\t\t\t\tvalue: { target, collectionItem: value.collectionItem },\n\t\t\t}\n\n\t\t\tvariables.push(variable)\n\n\t\t\thasUpdate = true\n\n\t\t\treturn {\n\t\t\t\t...value,\n\t\t\t\ttarget: createVariableReference(variable.id, smartComponentId),\n\t\t\t}\n\t\t}\n\n\t\treturn value\n\t})\n\n\tif (!hasUpdate) return\n\n\tvariableAssignments.push(() => context.engine.tree.current(node)?.set({ [key]: update } as any))\n}\n\ntype VariableAssignment = () => void\n\ninterface CollectVariablesToLift {\n\tassignLiftedVariablesToNodes: () => void\n\tassignExistingVariablesToInstance: (\n\t\tcomponentInstance: CodeComponentNode,\n\t\tmovedSourceRepeatArray: MovedSourceRepeatArray | null,\n\t) => void\n\tgetUpdatedSetVariableActionVariableId: (nodeId: NodeID, actionId: string, variableId: string) => string | undefined\n\t/**\n\t * Besides lifting variables, some variable references just need to be updated, for example to\n\t * update references to array repeaters, which are proxying lifted array variables.\n\t */\n\tgetUpdatedVariableReference: GetUpdatedVariableReference\n}\n\n// When we replace the content of Rich Text, with a variable, we can only have a\n// single text style for the whole range of text. That means that if we are\n// converting Rich Text with multiple styles (colors, sizes, etc), we would lose\n// some of those styles. With this function we make sure that when dealing with\n// RichTextNodes with more than one color property, we don't turn them into a\n// variable. We may want to include more properties in future. We also may want\n// to consider a Rich Text api that would let us check for multiple styles\n// without specifying specific ones.\nfunction canLiftRichTextContentVariable(node: CanvasNode) {\n\tif (withTextFit(node) && node.textFitViewBoxSize) return false\n\tif (isRichTextNode(node) && node.getTextColors(true).length > 1) return false\n\treturn true\n}\n\nfunction collectVariablesToLift(\n\tengine: VekterEngine,\n\tsmartComponentId: NodeID,\n\tprimaryVariant: CanvasNode,\n\tallSourceNodeIds: ReadonlySet<NodeID>,\n\tvariables: VariableDefinition[],\n\tmovedSourceRepeatArray: MovedSourceRepeatArray | null,\n): CollectVariablesToLift {\n\tconst usedNames = new Set(variables.map(variable => variable.name))\n\n\tconst variableAssignments: VariableAssignment[] = []\n\tconst instanceControlPropsUpdate: Mutable<PrefixedControlProps> = {}\n\n\tconst liftedVariables: Map<string, VariableDefinition> = new Map()\n\tconst liftedSetVariableActionVariableIds = new Map<string, string>()\n\n\tconst variableReferenceUpdateCallbacks: GetUpdatedVariableReference[] = []\n\n\tconst context: LiftVariableContext = {\n\t\tengine,\n\t\tsmartComponentId,\n\t\tallSourceNodeIds,\n\t\tusedNames,\n\t\tvariables,\n\t\tliftedVariables,\n\t\tliftedSetVariableActionVariableIds,\n\t\tvariableAssignments,\n\t\tinstanceControlPropsUpdate,\n\t\tmovedSourceRepeatArray: movedSourceRepeatArray ?? undefined,\n\t}\n\n\tfor (const { node, skipChildren } of primaryVariant.walkWithSkipChildren()) {\n\t\tliftSetVariableActionTargetVariables(node, context)\n\n\t\tif (!node.supportsDynamicValues()) {\n\t\t\tskipChildren()\n\t\t\tcontinue\n\t\t}\n\n\t\t// Vector nodes may support variables in a VectorSetNode, but not in Smart Components.\n\t\t// VECTOR @TODO: consider lifting only color variables when creating a VectorSetNode.\n\t\tif (isVectorNode(node)) {\n\t\t\tskipChildren()\n\t\t\tcontinue\n\t\t}\n\n\t\tif (withLightboxEffect(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"lightboxEffectBackdrop\", ControlType.Color, context)\n\t\t}\n\n\t\t// @FIXME - Currently link variables are not supported in text due to\n\t\t// issues with code generation. Do not try to create a variable.\n\t\tif (hasLink(node) && !isAnyTextNode(node)) {\n\t\t\tconst didLiftLink = liftPropertyVariableIfNeeded(node, \"link\", ControlType.Link, context)\n\t\t\tconst link = node.getLink()\n\n\t\t\tif (\n\t\t\t\t!didLiftLink &&\n\t\t\t\tisLink(link) &&\n\t\t\t\tlinkContainsPathOrHashVariable(link) &&\n\t\t\t\t!linkContainsCollectionItemProvidedBySelectedRepeater(engine, node, allSourceNodeIds)\n\t\t\t) {\n\t\t\t\tconst suggestedName = Dictionary.Link\n\t\t\t\tconst name = uniqueName(suggestedName, usedNames)\n\t\t\t\tusedNames.add(name)\n\n\t\t\t\tconst variable = createVariable(\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: ControlType.Link,\n\t\t\t\t\t\tname,\n\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t},\n\t\t\t\t\tscopeType,\n\t\t\t\t)\n\n\t\t\t\tvariables.push(variable)\n\n\t\t\t\tvariableAssignments.push(() => {\n\t\t\t\t\tengine.tree.current(node)?.set({\n\t\t\t\t\t\tlink: createVariableReference(variable.id, smartComponentId),\n\t\t\t\t\t})\n\t\t\t\t})\n\n\t\t\t\tinstanceControlPropsUpdate[prefixControlPropKey(variable.id)] = {\n\t\t\t\t\ttype: ControlType.Link,\n\t\t\t\t\tvalue: node.getLink(),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tliftPropertyVariableIfNeeded(node, \"linkOpenInNewTab\", ControlType.Boolean, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"linkSmoothScroll\", ControlType.Boolean, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"linkRelValues\", ControlType.LinkRelValues, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"linkPreserveParams\", ControlType.Boolean, context)\n\t\t}\n\n\t\tif (withFill(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"fillImage\", ControlType.Image, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"fillColor\", ControlType.Color, context)\n\t\t}\n\n\t\tif (withVisibility(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"visible\", ControlType.Boolean, context)\n\t\t}\n\n\t\tif (withOpacity(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"opacity\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withRotation(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"rotation\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withBorder(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"borderEnabled\", ControlType.Border, context)\n\t\t}\n\n\t\tif (withBoxShadow(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"boxShadows\", ControlType.BoxShadow, context)\n\t\t}\n\n\t\tif (withPadding(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"padding\", ControlType.Padding, context)\n\t\t}\n\n\t\tif (withScrollbars(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"hideScrollbars\", ControlType.Boolean, context)\n\t\t}\n\n\t\tif (withTapHighlight(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"tapHighlightColor\", ControlType.Color, context)\n\t\t}\n\n\t\tif (withTransforms(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"perspective\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withZIndex(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"zIndex\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withTransition(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"transition\", ControlType.Transition, context)\n\t\t}\n\n\t\tif (withLayout(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"gap\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withFilters(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"brightness\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"contrast\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"grayscale\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"hueRotate\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"invert\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"saturate\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"sepia\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"blur\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"backgroundBlur\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withCursor(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"cursor\", ControlType.Cursor, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"customCursorType\", ControlType.CustomCursor, context)\n\t\t}\n\n\t\tif (withDraggable(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"draggable\", ControlType.Boolean, context)\n\t\t}\n\n\t\tif (withRadius(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"radius\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withCornerShape(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"cornerShape\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withBackdrop(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"backdropFill\", ControlType.Color, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"backdropDismissible\", ControlType.Boolean, context)\n\t\t}\n\n\t\tif (withStyleAppearPageEffect(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"styleAppearEffectScrollTarget\", ControlType.ScrollSectionRef, context)\n\t\t}\n\n\t\tif (withStyleTransformEffect(node) && node.styleTransformEffectTrigger === EffectTrigger.OnScrollTarget) {\n\t\t\tliftOrCreateEffectScrollTargets(\n\t\t\t\tnode.styleTransformEffectScrollTargets,\n\t\t\t\tnode,\n\t\t\t\t\"styleTransformEffectScrollTargets\",\n\t\t\t\tcontext,\n\t\t\t)\n\t\t}\n\n\t\tif (withTextEffect(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"textEffectScrollTarget\", ControlType.ScrollSectionRef, context)\n\t\t}\n\n\t\tif (withTickerEffect(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"tickerEffectVelocity\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"tickerEffectHoverModifier\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"tickerEffectDraggable\", ControlType.Boolean, context)\n\t\t}\n\n\t\tif (withVariant(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"variantTransition\", ControlType.Transition, context)\n\t\t}\n\n\t\tif (withVariantAppearPageEffect(node) && node.appearEffectTrigger === EffectTrigger.OnScrollTarget) {\n\t\t\tliftOrCreateEffectScrollTargets(node.appearEffectScrollTargets, node, \"appearEffectScrollTargets\", context)\n\t\t}\n\n\t\tif (withFormInput(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"formInputName\", ControlType.String, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"formInputRequired\", ControlType.Boolean, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"formInputHidden\", ControlType.Boolean, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"formInputValue\", ControlType.String, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"formInputAutoFocus\", ControlType.Boolean, context)\n\t\t}\n\n\t\tif (withFormInputAutofillEnabled(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"formInputAutofillEnabled\", ControlType.Boolean, context)\n\t\t}\n\n\t\tif (withFormInputPlaceholder(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"formInputPlaceholder\", ControlType.String, context)\n\t\t}\n\n\t\tif (withFormInputStep(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"formInputStep\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withFormTextInputType(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"formTextInputType\", ControlType.String, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"formTextAreaResizable\", ControlType.Boolean, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"formTextInputMinNumber\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"formTextInputMaxNumber\", ControlType.Number, context)\n\t\t\tliftPropertyVariableIfNeeded(node, \"formInputMaxLength\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withFormBooleanInputType(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"formBooleanInputValue\", ControlType.Boolean, context)\n\t\t}\n\n\t\tif (hasVariableBinding(node)) {\n\t\t\tconst boundVariable = getVariableFromAncestor(context.engine, node, node.variableBinding)\n\n\t\t\tif (boundVariable) {\n\t\t\t\tif (\n\t\t\t\t\tboundVariable.type === \"controlReference\" &&\n\t\t\t\t\tboundVariable.expectedType === ControlType.Enum &&\n\t\t\t\t\t!variableProviderIsPartOfSelection(node.variableBinding, context)\n\t\t\t\t) {\n\t\t\t\t\tconst liftedRef = liftEnumVariable({ node, variableRef: node.variableBinding, context })\n\n\t\t\t\t\tif (liftedRef) {\n\t\t\t\t\t\tcontext.variableAssignments.push(() => {\n\t\t\t\t\t\t\tcontext.engine.tree.current(node)?.set({ variableBinding: liftedRef })\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t} else if (isLiftableVariableType(boundVariable.type)) {\n\t\t\t\t\tliftPropertyVariableIfNeeded(node, \"variableBinding\", boundVariable.type, context)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (withFormContainer(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"formOnSuccessRedirectUrl\", ControlType.Link, context)\n\t\t}\n\n\t\tif (withCodeComponent(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"dynamicVectorSetIdentifier\", ControlType.VectorSetItem, context)\n\t\t}\n\n\t\tif (withAriaLabel(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"ariaLabel\", ControlType.String, context)\n\t\t}\n\n\t\tif (withTabIndex(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"tabIndex\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withTextContent(node)) {\n\t\t\tconst containsInlineLinks = isTextNode(node) && node.getInlineLinks(false).some(isString)\n\n\t\t\tif (!containsInlineLinks && canLiftRichTextContentVariable(node)) {\n\t\t\t\tliftPropertyVariableIfNeeded(node, \"textContent\", ControlType.String, context)\n\n\t\t\t\tif (isRichTextNode(node)) {\n\t\t\t\t\tliftPropertyVariableIfNeeded(node, \"htmlContent\", ControlType.RichText, context)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (withTextTruncation(node)) {\n\t\t\tliftPropertyVariableIfNeeded(node, \"textTruncation\", ControlType.Number, context)\n\t\t}\n\n\t\tif (withCollectionOptions(node) && node.collectionFilters) {\n\t\t\tconst collectionFilters = getUpdatedCollectionFiltersIfNeeded(node.collectionFilters, variable => {\n\t\t\t\tif (variableProviderIsPartOfSelection(variable, context)) return\n\n\t\t\t\tconst control = node.cache.getVariableControlByReference(variable)\n\t\t\t\tif (isUndefined(control)) return\n\n\t\t\t\tif (control.type === ControlType.Enum) {\n\t\t\t\t\treturn liftEnumVariable({ node, variableRef: variable, context })\n\t\t\t\t}\n\n\t\t\t\tif (!isLiftableVariableType(control.type)) return\n\n\t\t\t\tconst liftedVariable = liftVariable({\n\t\t\t\t\tnode,\n\t\t\t\t\ttype: control.type,\n\t\t\t\t\tvariableRef: variable,\n\t\t\t\t\tcontext,\n\t\t\t\t\tpropKey: undefined,\n\t\t\t\t})\n\n\t\t\t\tif (liftedVariable) return liftedVariable\n\t\t\t})\n\n\t\t\tif (collectionFilters) {\n\t\t\t\tvariableAssignments.push(() => {\n\t\t\t\t\tengine.tree.current(node)?.set({\n\t\t\t\t\t\tcollectionFilters,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\tconst variableReferenceUpdateCallback = liftDataRepeaterArrayIfNeeded(node, context)\n\t\tif (variableReferenceUpdateCallback) variableReferenceUpdateCallbacks.push(variableReferenceUpdateCallback)\n\n\t\tconst repeatArrayVariableReferenceUpdateCallback = liftRepeatArrayIfNeeded(node, context)\n\t\tif (repeatArrayVariableReferenceUpdateCallback) {\n\t\t\tvariableReferenceUpdateCallbacks.push(repeatArrayVariableReferenceUpdateCallback)\n\t\t}\n\n\t\tif (isCodeComponentNode(node)) {\n\t\t\tconst component = engine.componentLoader.componentForIdentifier(node.codeComponentIdentifier)\n\n\t\t\tif (component) {\n\t\t\t\tObject.entries(component.properties).forEach(([controlKey, controlDefinition]) => {\n\t\t\t\t\tif (!controlDefinition) return\n\t\t\t\t\tconst type =\n\t\t\t\t\t\tcontrolDefinition.type === ControlType.ResponsiveImage ? ControlType.Image : controlDefinition.type\n\n\t\t\t\t\tconst rawControlProp = node.getRawControlProp(controlKey)\n\t\t\t\t\tconst controlProp = getControlProp(controlDefinition, rawControlProp)\n\t\t\t\t\tif (!controlProp) return\n\n\t\t\t\t\tif (isVariableReference(controlProp.value)) {\n\t\t\t\t\t\tif (!isLiftableVariableType(type)) return\n\n\t\t\t\t\t\tif (variableProviderIsPartOfSelection(controlProp.value, context)) return\n\n\t\t\t\t\t\tconst variableRef = liftVariable({\n\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\ttype,\n\t\t\t\t\t\t\tvariableRef: controlProp.value,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tpropKey: controlKey,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tif (!variableRef) return\n\n\t\t\t\t\t\tconst updatedControlProp = { ...controlProp, value: variableRef } as ControlProp\n\n\t\t\t\t\t\tvariableAssignments.push(() => {\n\t\t\t\t\t\t\tengine.tree.current(node)?.set(prefixControlProps({ [controlKey]: updatedControlProp }))\n\t\t\t\t\t\t})\n\t\t\t\t\t} else if (isComputedValueFromVariableReference(controlProp.value)) {\n\t\t\t\t\t\tconst computedValue = controlProp.value\n\t\t\t\t\t\tif (variableProviderIsPartOfSelection(computedValue.startValue, context)) return\n\n\t\t\t\t\t\tconst variable = getVariableFromAncestor(context.engine, node, computedValue.startValue)\n\t\t\t\t\t\tif (!variable) return\n\n\t\t\t\t\t\tif (shouldLiftComputedValue(controlProp.value, variable)) {\n\t\t\t\t\t\t\tconst dynamicValue = liftComputedValue({\n\t\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\t\tcomputedValue: controlProp.value,\n\t\t\t\t\t\t\t\toutputControl: controlDefinition,\n\t\t\t\t\t\t\t\tinputVariable: variable,\n\t\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\t\tpropKey: controlKey,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\tif (!dynamicValue) return\n\n\t\t\t\t\t\t\tconst updatedControlProp = { ...controlProp, value: dynamicValue } as ControlProp\n\n\t\t\t\t\t\t\tvariableAssignments.push(() => {\n\t\t\t\t\t\t\t\tengine.tree.current(node)?.set(prefixControlProps({ [controlKey]: updatedControlProp }))\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (!isLiftableVariableType(variable.type)) return\n\n\t\t\t\t\t\tconst variableRef = liftVariable({\n\t\t\t\t\t\t\tnode,\n\t\t\t\t\t\t\ttype: variable.type,\n\t\t\t\t\t\t\tvariableRef: computedValue.startValue,\n\t\t\t\t\t\t\tcontext,\n\t\t\t\t\t\t\tpropKey: controlKey,\n\t\t\t\t\t\t})\n\n\t\t\t\t\t\tif (!variableRef) return\n\n\t\t\t\t\t\tconst updatedComputedValue: ComputedValue = { ...computedValue, startValue: variableRef }\n\t\t\t\t\t\tconst updatedControlProp = {\n\t\t\t\t\t\t\t...controlProp,\n\t\t\t\t\t\t\tvalue: updatedComputedValue,\n\t\t\t\t\t\t} as ControlProp\n\n\t\t\t\t\t\tvariableAssignments.push(() => {\n\t\t\t\t\t\t\tengine.tree.current(node)?.set(prefixControlProps({ [controlKey]: updatedControlProp }))\n\t\t\t\t\t\t})\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\treturn {\n\t\tassignLiftedVariablesToNodes() {\n\t\t\tfor (const assign of variableAssignments) {\n\t\t\t\tassign()\n\t\t\t}\n\t\t},\n\t\tassignExistingVariablesToInstance(\n\t\t\tcomponentInstance: CodeComponentNode,\n\t\t\tmovedSourceRepeatArray: MovedSourceRepeatArray | null,\n\t\t) {\n\t\t\tcomponentInstance.set(instanceControlPropsUpdate)\n\n\t\t\tif (!movedSourceRepeatArray) return\n\n\t\t\tconst update = generateVariableReferenceUpdateForNode(engine.tree, componentInstance, ref => {\n\t\t\t\tif (ref.providerId !== movedSourceRepeatArray.sourceRepeatArrayProviderId) return\n\t\t\t\treturn { ...ref, providerId: componentInstance.id }\n\t\t\t})\n\t\t\tif (update) componentInstance.set(update)\n\t\t},\n\t\tgetUpdatedSetVariableActionVariableId(nodeId: NodeID, actionId: string, variableId: string) {\n\t\t\treturn liftedSetVariableActionVariableIds.get(\n\t\t\t\tgetSetVariableActionVariableIdUpdateKey(nodeId, actionId, variableId),\n\t\t\t)\n\t\t},\n\t\tgetUpdatedVariableReference(ref: VariableReference) {\n\t\t\tconst liftedVariable = liftedVariables.get(getLiftedVariableHash(ref))\n\t\t\tif (liftedVariable) {\n\t\t\t\treturn createVariableReference(liftedVariable.id, smartComponentId)\n\t\t\t}\n\n\t\t\tfor (const update of variableReferenceUpdateCallbacks) {\n\t\t\t\tconst updatedRef = update(ref)\n\t\t\t\tif (updatedRef) return updatedRef\n\t\t\t}\n\t\t},\n\t}\n}\n\nfunction liftSetVariableActionTargetVariables(node: CanvasNode, context: LiftVariableContext) {\n\tif (isOverlayNode(node)) return\n\n\tconst { engine, liftedSetVariableActionVariableIds } = context\n\n\tconst scope = engine.tree.getScopeNodeFor(node)\n\tif (!withVariables(scope)) return\n\n\tconst actionMap = getActionsForNode(engine.componentLoader, node)\n\tfor (const actions of Object.values(actionMap)) {\n\t\tfor (const action of actions) {\n\t\t\tif (!isSetVariableValueAction(action)) continue\n\n\t\t\tconst variableId = action.controls.variableId?.value\n\t\t\tif (!isString(variableId)) continue\n\n\t\t\tconst variable = scope.getVariable(variableId)\n\t\t\tif (!variable) continue\n\t\t\tif (!isLiftableVariableType(variable.type)) continue\n\n\t\t\tconst reference = createVariableReference(variable.id, scope.id)\n\t\t\tif (variableProviderIsPartOfSelection(reference, context)) continue\n\n\t\t\tconst liftedVariableReference = liftVariable({\n\t\t\t\tnode,\n\t\t\t\ttype: variable.type,\n\t\t\t\tvariableRef: reference,\n\t\t\t\tcontext,\n\t\t\t\tpropKey: undefined,\n\t\t\t})\n\n\t\t\tif (liftedVariableReference) {\n\t\t\t\tliftedSetVariableActionVariableIds.set(\n\t\t\t\t\tgetSetVariableActionVariableIdUpdateKey(node.id, action.identifier, variableId),\n\t\t\t\t\tliftedVariableReference.id,\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction updateSetVariableActionVariableIds(\n\tengine: VekterEngine,\n\tbaseVariantId: NodeID,\n\tgetUpdatedSetVariableActionVariableId: (nodeId: NodeID, actionId: string, variableId: string) => string | undefined,\n) {\n\tconst primaryVariant = engine.tree.get(baseVariantId)\n\tassert(primaryVariant, \"primary variant must exist\")\n\n\tfor (const { node, skipChildren } of primaryVariant.walkWithSkipChildren()) {\n\t\tif (isOverlayNode(node)) {\n\t\t\tskipChildren()\n\t\t\tcontinue\n\t\t}\n\n\t\tconst actionMap = getActionsForNode(engine.componentLoader, node)\n\t\tfor (const [eventKey, actions] of Object.entries(actionMap)) {\n\t\t\tlet hasUpdate = false\n\t\t\tconst updatedActions = actions.map(action => {\n\t\t\t\tif (!isSetVariableValueAction(action)) return action\n\n\t\t\t\tconst variableId = action.controls.variableId?.value\n\t\t\t\tif (!isString(variableId)) return action\n\n\t\t\t\tconst updatedVariableId = getUpdatedSetVariableActionVariableId(node.id, action.identifier, variableId)\n\t\t\t\tif (updatedVariableId && updatedVariableId !== variableId) {\n\t\t\t\t\thasUpdate = true\n\t\t\t\t\treturn {\n\t\t\t\t\t\t...action,\n\t\t\t\t\t\tcontrols: {\n\t\t\t\t\t\t\t...action.controls,\n\t\t\t\t\t\t\tvariableId: {\n\t\t\t\t\t\t\t\t...action.controls.variableId,\n\t\t\t\t\t\t\t\tvalue: updatedVariableId,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn action\n\t\t\t})\n\t\t\tif (!hasUpdate) continue\n\n\t\t\tif (isPrefixedControlPropKey(eventKey)) {\n\t\t\t\tassert(isCodeComponentNode(node))\n\t\t\t\tconst controlProp: EventHandlerControlProp = { type: ControlType.EventHandler, value: updatedActions }\n\t\t\t\tconst update: PrefixedControlProps<EventHandlerControlProp> = { [eventKey]: controlProp }\n\t\t\t\tnode.set(update)\n\t\t\t} else if (isFrameEvent(eventKey)) {\n\t\t\t\tassert(!isCodeComponentNode(node))\n\t\t\t\tassert(withFrameEvents(node), \"node must have frame events\")\n\t\t\t\tnode.set({ [eventKey]: updatedActions })\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction moveOverlays(engine: VekterEngine, eventInfo: EventInfo[], target: CanvasNode, baseVariantId: NodeID) {\n\teventInfo.forEach(event => {\n\t\tevent.liftedActions.forEach(action => {\n\t\t\tif (isShowOverlayAction(action) || (isShowRelativeOverlayAction(action) && event.nodeID === baseVariantId)) {\n\t\t\t\tconst id = action.controls.overlay.value\n\t\t\t\tconst node = engine.tree.get(id)\n\t\t\t\tif (!node) return\n\t\t\t\tengine.tree.moveNode(node, target.id)\n\t\t\t}\n\t\t})\n\t})\n}\n\nexport type PrimaryVariantSourceNeedsWrappingFrame =\n\t| AnyTextNode\n\t| DataRepeater\n\t| FormBooleanInputNode\n\t| FormPlainTextInputNode\n\t| FormSelectNode\n\t| ShapeContainerNode\n\t| SVGNode\n\nfunction requiresWrappingFrame(node: CanvasNode): node is PrimaryVariantSourceNeedsWrappingFrame {\n\treturn (\n\t\tisSVGNode(node) ||\n\t\tisShapeContainerNode(node) ||\n\t\tisAnyTextNode(node) ||\n\t\tisFormPlainTextInputNode(node) ||\n\t\tisFormBooleanInputNode(node) ||\n\t\tisFormSelectNode(node)\n\t)\n}\n\nfunction liftIncompatibleVariantPropsToInstance(engine: VekterEngine, variant: CanvasNode) {\n\tconst instanceUpdate: Partial<CodeComponentNode> = {}\n\tif (withOpacity(variant)) {\n\t\tinstanceUpdate.opacity = variant.opacity\n\t\tvariant.set({ opacity: 1 })\n\t}\n\tif (withVisibility(variant)) {\n\t\tinstanceUpdate.visible = variant.visible\n\t\tvariant.set({ visible: true })\n\t}\n\tif (withRotation(variant)) {\n\t\tinstanceUpdate.rotation = variant.rotation\n\t\tvariant.set({ rotation: undefined })\n\t}\n\n\tif (withZIndex(variant)) {\n\t\tinstanceUpdate.zIndex = variant.zIndex\n\t\tvariant.set({ zIndex: undefined })\n\t}\n\tif (withScrollTarget(variant)) {\n\t\tinstanceUpdate.elementId = variant.elementId\n\t\tinstanceUpdate.scrollTargetEnabled = variant.scrollTargetEnabled\n\t\tinstanceUpdate.scrollMarginTop = variant.scrollMarginTop\n\t\tvariant.set({ elementId: undefined, scrollTargetEnabled: undefined, scrollMarginTop: undefined })\n\t}\n\n\tif (withPositionType(variant)) {\n\t\tinstanceUpdate.position = variant.position\n\t\tinstanceUpdate.positionStickyTop = variant.positionStickyTop\n\t\tinstanceUpdate.positionStickyRight = variant.positionStickyRight\n\t\tinstanceUpdate.positionStickyBottom = variant.positionStickyBottom\n\t\tinstanceUpdate.positionStickyLeft = variant.positionStickyLeft\n\t\tvariant.set({\n\t\t\tposition: undefined,\n\t\t\tpositionStickyTop: undefined,\n\t\t\tpositionStickyRight: undefined,\n\t\t\tpositionStickyBottom: undefined,\n\t\t\tpositionStickyLeft: undefined,\n\t\t})\n\t}\n\n\tif (isPinnable(variant) && variant.heightType === DimensionType.Viewport) {\n\t\tinstanceUpdate.heightType = variant.heightType\n\t\tinstanceUpdate.height = variant.height\n\n\t\tconst { height } = engine.tree.getRect(variant)\n\t\tvariant.set({ heightType: DimensionType.FixedNumber, height })\n\t}\n\n\tif (withFloatingPosition(variant) && variant.floatingPositionEnabled) {\n\t\tconst floatingPositionProps = getFloatingPositionProps(variant)\n\t\tObject.assign(instanceUpdate, floatingPositionProps)\n\t\tvariant.set(floatingPositionDefaults)\n\t}\n\n\tif (withGridItemLayout(variant)) {\n\t\tinstanceUpdate.gridItemHorizontalAlignment = variant.gridItemHorizontalAlignment\n\t\tinstanceUpdate.gridItemVerticalAlignment = variant.gridItemVerticalAlignment\n\t\tinstanceUpdate.gridItemColumnSpan = variant.gridItemColumnSpan\n\t\tinstanceUpdate.gridItemRowSpan = variant.gridItemRowSpan\n\t\tvariant.set(gridItemLayoutDefaults)\n\t}\n\n\tif (withGridItemSize(variant)) {\n\t\tinstanceUpdate.gridItemFillCellWidth = variant.gridItemFillCellWidth\n\t\tinstanceUpdate.gridItemFillCellHeight = variant.gridItemFillCellHeight\n\t\tvariant.set(gridItemSizeDefaults)\n\t}\n\n\treturn instanceUpdate\n}\n\n/**\n * Relative size constraints are not supported on smart component ground nodes,\n * so we separate them out to allow lifting to the code component instance.\n */\nfunction extractSizeConstraints(node: CanvasNode) {\n\t// Assume that all constraints are invalid unless specifically lifted or\n\t// recorded, so use defaults.\n\tconst innerConstraints: Partial<WithSizeConstraints> = { ...sizeConstraintsDefaults }\n\tconst outerConstraints: Partial<WithSizeConstraints> = { ...sizeConstraintsDefaults }\n\tif (!supportsSizeConstraints(node)) return { innerConstraints, outerConstraints }\n\n\tfor (const constraintKey of getKeys(sizeConstraintsDefaults)) {\n\t\tconst value = node[constraintKey]\n\t\tif (isUndefined(value)) continue\n\n\t\tconst [numericValue, unit] = parseConstraintValue(value)\n\t\tif (unit === \"%\") {\n\t\t\touterConstraints[constraintKey] = createCSSDimension(numericValue, unit)\n\t\t} else if (unit === \"vh\") {\n\t\t\t// Width size constraints do not support vh units. This should not\n\t\t\t// be possible from the UI, but we return early to satisfy the\n\t\t\t// types.\n\t\t\tif (constraintKey === \"maxWidth\" || constraintKey === \"minWidth\") continue\n\t\t\tinnerConstraints[constraintKey] = createCSSDimension(numericValue, unit)\n\t\t} else {\n\t\t\tinnerConstraints[constraintKey] = createCSSDimension(numericValue, unit)\n\t\t}\n\t}\n\n\treturn { innerConstraints, outerConstraints }\n}\n\nfunction getNonEmptyGalleryControlPropValueFromCollectionItem(\n\tengine: VekterEngine,\n\texistingGalleryVariableReference: VariableReference,\n): StaticArrayControlPropValue | undefined {\n\tconst { id: variableId, providerId } = existingGalleryVariableReference\n\n\tconst galleryVariableProvider = engine.tree.get(providerId)\n\tif (!hasCollectionDataSource(galleryVariableProvider)) return\n\tif (!withVariableProvider(galleryVariableProvider)) return\n\n\tconst collectionItemId = getFirstRepeaterItemId(galleryVariableProvider, engine.stores.treeStore.sandboxRepeaterData)\n\tconst collectionItem = engine.tree.get(collectionItemId)\n\tif (!isCollectionItemNode(collectionItem)) return\n\n\tconst controlProp = collectionItem.getControlProp(variableId)\n\tif (!controlProp) return\n\tif (controlProp.type !== ControlType.Array) return\n\tif (!isStaticArrayControlPropValue(controlProp.value)) return\n\tif (controlProp.value.length === 0) return\n\n\treturn controlProp.value\n}\n\nfunction createGalleryVariable({\n\tengine,\n\tsuggestedName,\n\texistingGalleryVariable,\n\texistingGalleryVariableReference,\n}: {\n\tengine: VekterEngine\n\tsuggestedName: string\n\texistingGalleryVariable: ArrayVariableDefinition\n\texistingGalleryVariableReference: VariableReference\n}): {\n\tgalleryVariable: ArrayVariableDefinition\n\tgalleryImageId: string\n\texistingGalleryVariableImageId: string\n} | null {\n\tconst galleryImageId = randomID()\n\n\t// We only support Galleries for now.\n\tif (existingGalleryVariable.itemVariables.length !== 1) return null\n\tconst [arrayItemVariable] = existingGalleryVariable.itemVariables\n\tif (!arrayItemVariable || arrayItemVariable.type !== ControlType.Image) return null\n\n\tconst existingGalleryVariableImageId = arrayItemVariable.id\n\n\tlet initialValue: StaticArrayControlPropValue | undefined\n\n\tlet existingGalleryValue: StaticArrayControlPropValue | undefined\n\n\tif (isArray(existingGalleryVariable.initialValue) && existingGalleryVariable.initialValue.length > 0) {\n\t\texistingGalleryValue = existingGalleryVariable.initialValue\n\t} else {\n\t\t// Lookup the value from the CMS if we can, so we can render actual images instead of placeholders\n\t\texistingGalleryValue = getNonEmptyGalleryControlPropValueFromCollectionItem(\n\t\t\tengine,\n\t\t\texistingGalleryVariableReference,\n\t\t)\n\t}\n\n\tif (existingGalleryValue && existingGalleryValue.length > 0) {\n\t\tinitialValue = existingGalleryValue.map((existingItem): ArrayValue & ObjectControlProp => {\n\t\t\tconst imageControlProp: ImageControlProp = { type: ControlType.Image, value: undefined }\n\n\t\t\tconst arrayItemObjectControlProp: ArrayValue & ObjectControlProp = {\n\t\t\t\tid: randomID(),\n\t\t\t\ttype: ControlType.Object,\n\t\t\t\tvalue: { [galleryImageId]: imageControlProp },\n\t\t\t}\n\n\t\t\tif (!existingItem || !isObject(existingItem.value)) {\n\t\t\t\treturn arrayItemObjectControlProp\n\t\t\t}\n\n\t\t\tconst existingImageControlProp = existingItem.value[existingGalleryVariableImageId]\n\n\t\t\tif (!isRawControlProp(existingImageControlProp) || existingImageControlProp.type !== ControlType.Image) {\n\t\t\t\treturn arrayItemObjectControlProp\n\t\t\t}\n\n\t\t\tif (!isString(existingImageControlProp.value)) {\n\t\t\t\treturn arrayItemObjectControlProp\n\t\t\t}\n\n\t\t\timageControlProp.value = existingImageControlProp.value\n\n\t\t\tif (isString(existingImageControlProp.alt)) {\n\t\t\t\timageControlProp.alt = existingImageControlProp.alt\n\t\t\t}\n\n\t\t\tif (isString(existingImageControlProp.positionX)) {\n\t\t\t\timageControlProp.positionX = existingImageControlProp.positionX\n\t\t\t}\n\n\t\t\tif (isString(existingImageControlProp.positionY)) {\n\t\t\t\timageControlProp.positionY = existingImageControlProp.positionY\n\t\t\t}\n\n\t\t\treturn arrayItemObjectControlProp\n\t\t})\n\t} else {\n\t\tinitialValue = createGalleryVariableDefaultValue({ isSmartComponent: true, galleryImageId })\n\t}\n\n\tconst galleryVariable = createVariable(\n\t\t{\n\t\t\ttype: ControlType.Array,\n\t\t\tname: suggestedName,\n\t\t\tinitialValue,\n\t\t\titemVariables: [\n\t\t\t\t{\n\t\t\t\t\tid: galleryImageId,\n\t\t\t\t\ttype: ControlType.Image,\n\t\t\t\t\tname: Dictionary.Image,\n\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t\"canvas_component\",\n\t)\n\n\treturn { galleryVariable, galleryImageId, existingGalleryVariableImageId }\n}\n", "import { triggerColorTokenCreateEvent } from \"@framerjs/framer-events\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasTree, MaybeNodeID } from \"document/models/CanvasTree/index.ts\"\nimport { ColorStyleTokenListNode } from \"document/models/CanvasTree/nodes/ColorStyleTokenListNode.ts\"\nimport { ColorStyleTokenNode } from \"document/models/CanvasTree/nodes/ColorStyleTokenNode.ts\"\nimport {\n\tduplicateEntityReferenceNode,\n\tremoveReferenceForNode,\n} from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport { isColorStyleTokenNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { record } from \"web/lib/tracker.ts\"\n\n/**\n * Helpers for the color picker token row and shared color panel context menu\n */\n\nexport function duplicateToken(engine: VekterEngine, colorToken: ColorStyleTokenNode) {\n\tconst newToken = new ColorStyleTokenNode({\n\t\tlight: colorToken.light,\n\t\tdark: colorToken.dark,\n\t\tname: `${colorToken.name} Copy`,\n\t})\n\n\tengine.tree.insertNode(newToken, ColorStyleTokenListNode.ensure(engine.tree).id)\n\n\tduplicateEntityReferenceNode(engine, colorToken.id, newToken.id)\n\n\ttriggerColorTokenCreateEvent({\n\t\ttokenId: newToken.id,\n\t\ttotalTokenCount: ColorStyleTokenListNode.getTokenNodes(engine.tree).length,\n\t})\n}\n\nexport function deleteToken(engine: VekterEngine, colorTokenId: MaybeNodeID) {\n\tengine.scheduler.process(() => {\n\t\tconst tree = engine.stores.treeStore.getDataTreeOrPartialTree()\n\n\t\tconst latestNode = tree.get(colorTokenId)\n\t\tif (!isColorStyleTokenNode(latestNode)) return\n\t\tif (latestNode.installed) return\n\n\t\tsoftDeleteColorToken(tree, latestNode)\n\t\trecord(\"color_token_remove\", {})\n\t})\n}\n\nexport function resetTokenDarkValue(engine: VekterEngine, colorToken: ColorStyleTokenNode) {\n\tconst node = engine.tree.get(colorToken.id)\n\tif (!isColorStyleTokenNode(node)) return\n\tif (node.installed) return\n\n\tnode.set({ dark: undefined })\n\ttoast({\n\t\ttype: \"add\",\n\t\tvariant: \"success\",\n\t\tprimaryText: \"Dark color style\",\n\t\tsecondaryText: \"has been cleared.\",\n\t})\n\trecord(\"color_token_update\", { valueLight: colorToken.light, valueDark: undefined })\n}\n\nexport function softDeleteColorToken(tree: CanvasTree, node: ColorStyleTokenNode) {\n\tnode.set({ dark: node.light, softDeleted: true }, tree)\n\tremoveReferenceForNode(tree, node.id)\n}\n", "import type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { EntityTypeRootId } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { createFolderStructureForNode } from \"document/models/CanvasTree/nodes/utils/entityFolderNode.ts\"\nimport { buildReferenceNodeId } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\n\n/**\n * Sets up or updates the folder structure for entity nodes based on their name.\n *\n * This function organizes entities (like styles, colors, or text nodes) into a hierarchical\n * folder structure within the canvas tree. When an entity is created or renamed with a path-like\n * name (e.g., \"Colors/Primary/Blue\"), this function ensures all necessary folders exist and\n * places the entity in the correct location.\n *\n * Note: `/Folder/Subfolder/Node` and `Folder/Subfolder/Node` are treated the same,\n * with both creating the full folder hierarchy relative to the entity root.\n *\n * @param tree - The CanvasTree instance for tree operations\n * @param node - The entity node\n * @param newName - Name for the entity, can include path separators (/) to indicate folder structure\n * @param entityRootId - Root ID for the entity type (determines which root the folders will be created under)\n * @param isNewNode - Whether this is a newly created node (defaults to false)\n */\nexport function setupFolderStructureForNodeName(\n\ttree: CanvasTree,\n\tnode: CanvasNode,\n\tnewName: string | undefined,\n\tentityRootId: EntityTypeRootId,\n\tisNewNode = false,\n) {\n\tif (!newName) return\n\n\tconst parentId = createFolderStructureForNode(tree, node, newName, entityRootId)\n\n\t// For new nodes, reference is already in correct folder\n\tif (isNewNode) return\n\n\tconst referenceId = buildReferenceNodeId(entityRootId, node.id)\n\tconst entityReferenceNode = tree.get(referenceId)\n\n\t// For existing nodes with absolute paths, move the reference node\n\tif (entityReferenceNode && parentId) {\n\t\ttree.moveNode(entityReferenceNode, parentId)\n\t}\n}\n\n/**\n * Sets up or updates the folder structure for entity nodes based on their name,\n * looking up the node by ID.\n *\n * @see setupFolderStructureForNodeName for full documentation\n */\nexport function setupFolderStructureForNodeNameById(\n\ttree: CanvasTree,\n\tid: NodeID,\n\tnewName: string | undefined,\n\tentityRootId: EntityTypeRootId,\n\tisNewNode = false,\n) {\n\tconst node = tree.get(id)\n\tif (!node) return\n\n\treturn setupFolderStructureForNodeName(tree, node, newName, entityRootId, isNewNode)\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { BlockquoteStylePresetNode } from \"document/models/CanvasTree/nodes/BlockquoteStylePresetNode.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport type { ImageStylePresetNode } from \"document/models/CanvasTree/nodes/ImageStylePresetNode.ts\"\nimport type { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport type { LinkStylePresetNode } from \"document/models/CanvasTree/nodes/LinkStylePresetNode.ts\"\nimport type { TableStylePresetNode } from \"document/models/CanvasTree/nodes/TableStylePresetNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport {\n\tisBlockquoteStylePresetNode,\n\tisComponentPresetNode,\n\tisImageStylePresetNode,\n\tisInlineCodeStylePresetNode,\n\tisLinkStylePresetNode,\n\tisTableStylePresetNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\n\n/**\n * The types of style presets aggregated in stylePresets.ts.\n * Kept in a separate file to avoid circular dependencies.\n */\nexport enum StylePresetType {\n\tText = \"text\",\n\tLink = \"link\",\n\tInlineCode = \"inlineCode\",\n\tBlockquote = \"blockquote\",\n\tTable = \"table\",\n\tImage = \"image\",\n\tComponent = \"component\",\n}\n\nexport type AgentSupportedStylePresetNode =\n\t| TextStylePresetNode\n\t| LinkStylePresetNode\n\t| InlineCodeStylePresetNode\n\t| BlockquoteStylePresetNode\n\t| TableStylePresetNode\n\t| ImageStylePresetNode\n\t| ComponentPresetNode\n\nexport function isAgentSupportedStylePresetNode(node: CanvasNode): node is AgentSupportedStylePresetNode {\n\treturn (\n\t\tisTextStylePresetNode(node) ||\n\t\tisLinkStylePresetNode(node) ||\n\t\tisInlineCodeStylePresetNode(node) ||\n\t\tisBlockquoteStylePresetNode(node) ||\n\t\tisTableStylePresetNode(node) ||\n\t\tisImageStylePresetNode(node) ||\n\t\tisComponentPresetNode(node)\n\t)\n}\n\nexport function stylePresetTypeForNode(node: AgentSupportedStylePresetNode): StylePresetType {\n\tif (isTextStylePresetNode(node)) return StylePresetType.Text\n\tif (isLinkStylePresetNode(node)) return StylePresetType.Link\n\tif (isInlineCodeStylePresetNode(node)) return StylePresetType.InlineCode\n\tif (isBlockquoteStylePresetNode(node)) return StylePresetType.Blockquote\n\tif (isTableStylePresetNode(node)) return StylePresetType.Table\n\tif (isImageStylePresetNode(node)) return StylePresetType.Image\n\tif (isComponentPresetNode(node)) return StylePresetType.Component\n\tassertNever(node)\n}\n", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\n\nexport interface NodesMutatedByAgent {\n\tcanvas: Set<NodeID>\n\tcms: Map<NodeID, CmsNodeUpdates>\n}\n\nexport interface CmsNodeUpdates {\n\tchangedControlProps?: ReadonlySet<string>\n}\n\nexport function hasMutatingNodes(mutatingNodes: NodesMutatedByAgent): boolean {\n\tif (mutatingNodes.canvas.size > 0) return true\n\tfor (const cmsUpdates of mutatingNodes.cms.values()) {\n\t\tif (cmsUpdates.changedControlProps?.size) return true\n\t}\n\treturn false\n}\n\nexport function mergeCmsNodeUpdates(current: CmsNodeUpdates | undefined, incoming: CmsNodeUpdates): CmsNodeUpdates {\n\tconst currentControlProps = current?.changedControlProps ?? new Set()\n\tconst incomingControlProps = incoming.changedControlProps ?? new Set()\n\n\tconst changedControlProps = new Set([...currentControlProps, ...incomingControlProps])\n\n\treturn changedControlProps.size === 0 ? {} : { changedControlProps }\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport {\n\tModuleType,\n\tassert,\n\temptyMap,\n\tgetLogger,\n\tisSingleElementArray,\n\tlocalModuleIdentifierForStableName,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { createRouteSegment } from \"document/components/chrome/Pages/utils/createRouteSegment.ts\"\nimport { suggestedRect } from \"document/components/tools/utils/FramesHelper.ts\"\nimport { layoutTemplatePrimaryLayoutDefaults } from \"document/components/utils/contextActions.ts\"\nimport { defaultPrimaryVariantAttributes } from \"document/components/utils/createSmartComponent.ts\"\nimport { getPrimaryBreakpointProps } from \"document/components/utils/getPrimaryBreakpointProps.ts\"\nimport { getUniquePagePath } from \"document/components/utils/getUniquePagePath.ts\"\nimport { softDeleteColorToken } from \"document/components/utils/tokenContextActions.ts\"\nimport {\n\ttype CanvasNode,\n\ttype CanvasTree,\n\ttype NodeID,\n\ttype ScopeNode,\n\tisScopeNode,\n\ttype LoadedWebPageNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { ColorStyleTokenListNode } from \"document/models/CanvasTree/nodes/ColorStyleTokenListNode.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport {\n\tBLOCKQUOTE_ENTITY_ROOT_ID,\n\tCMS_ENTITY_ROOT_ID,\n\tCOLOR_ENTITY_ROOT_ID,\n\tCOMPONENTS_ENTITY_TYPE_ROOT_ID,\n\tINLINE_CODE_ENTITY_ROOT_ID,\n\tLAYOUT_TEMPLATE_ENTITY_ROOT_ID,\n\tLINK_ENTITY_ROOT_ID,\n\tTEXT_ENTITY_ROOT_ID,\n\tensureEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { RoutesNode } from \"document/models/CanvasTree/nodes/RoutesNode.ts\"\nimport { SlotNode } from \"document/models/CanvasTree/nodes/SlotNode.ts\"\nimport { TemplateHelper, generateReplicaChildId } from \"document/models/CanvasTree/nodes/TemplateHelper.ts\"\nimport { removeNodeWithReference } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport {\n\tisColorStyleTokenNode,\n\tisCodeComponentNode,\n\tisFrameNode,\n\tisOverlayNode,\n\tisRedirectRouteNode,\n\tisRichTextNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n\tisLayoutTemplateNode,\n\tisCollectionItemNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { updateReplicaNodeOverrides } from \"document/models/CanvasTree/nodes/utils/updateReplicaOverrides.ts\"\nimport { getGeneratedValue } from \"document/models/CanvasTree/traits/Generated.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { withReplicaVariants } from \"document/models/CanvasTree/traits/WithReplicaVariants.ts\"\nimport type { Loaded } from \"document/models/CanvasTree/traits/WithScopeLoader.ts\"\nimport { withSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { isPrimaryVariant, isReplicaVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { getWebPageNodesWithCollection } from \"document/stores/ScopeStore.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { isUndefined } from \"library/utils/utils.ts\"\nimport { setupFolderStructureForNodeName } from \"plugins/entityReference.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { RejectedCommandError, RejectedCommandKind } from \"./RejectedCommandError.ts\"\nimport type { Collections } from \"./context/collections.ts\"\nimport {\n\tcreateVirtualNodeId,\n\tisVirtualNodeId,\n\tparseVirtualNodeId,\n\ttype RichTextTarget,\n} from \"./context/richtext/document.ts\"\nimport type { VirtualText } from \"./context/richtext/virtualText.ts\"\nimport { isAgentSupportedStylePresetNode } from \"./context/stylePresetType.ts\"\nimport { rootNodeId, type AddCommandAttributes } from \"./dsl.ts\"\nimport { mergeCmsNodeUpdates, type NodesMutatedByAgent, type CmsNodeUpdates } from \"./nodesMutatedByAgent.ts\"\n\nconst log = getLogger(\"ai:agents\")\n\ninterface NodeInsertionInfo {\n\tnode: CanvasNode\n\tattributes?: AddCommandAttributes\n\tinserted?: boolean\n}\n\ninterface PendingInsertionInfo {\n\tnode: CanvasNode\n\tattributes?: AddCommandAttributes\n}\n\nexport interface UninsertedNode {\n\tllmId: string\n\tattributes: AddCommandAttributes\n}\n\nexport class CircularParentResolutionError extends Error {\n\tconstructor(\n\t\treadonly nodeId: NodeID,\n\t\treadonly parentId: NodeID,\n\t) {\n\t\tsuper(\"Circular parent relationship detected while resolving ground node\")\n\t\tthis.name = \"CircularParentResolutionError\"\n\t}\n}\n\ntype NodeOperation = \"insert\" | \"insertAndUpdate\" | \"update\" | \"remove\"\n\n/**\n * A wrapper around common CanvasTree APIs that handles:\n * - Transforming references to LLM ids into real tree ids, including ReplicaChild ids.\n * - Returning references to common nodes like Parent and Scope even if they are not yet inserted.\n * - Preparing a node for insertion on the subsequent SET command.\n * - Extracting a dictionary that maps the LLM ids to the Canvas Ids for followups.\n */\nexport class TreeResolver {\n\tprivate readonly llmIdByCanvasId = new Map<NodeID, string>()\n\tprivate readonly canvasIdByLLMId = new Map<string, NodeID>()\n\tprivate readonly llmReplicaIds = new Set<string>()\n\tprivate readonly sentCanvasIds = new Set<NodeID>()\n\tprivate readonly pendingNodesByCanvasId = new Map<NodeID, NodeInsertionInfo>()\n\tprivate readonly originalNodeReplicaIds = new Map<string, NodeID>()\n\t/** Nodes changes happened in the current turn. Drain-on-read by the review loop. */\n\tprivate readonly changedNodeIds = new Map<NodeID, NodeOperation>()\n\t/** Canvas nodes being mutated in the last command, used for determining what to highlight. */\n\tprivate mutatingCanvasNodeIds = new Set<NodeID>()\n\t/*\n\t * CMS nodes being mutated in the last command, used for determining which cells to highlight.\n\t * CMS UI requires more info about changes than just node ids, so keeping canvas and cms updates buckets separate\n\t */\n\tprivate mutatingCmsNodeUpdates = new Map<NodeID, CmsNodeUpdates>()\n\tprivate readonly processChangeCaptureStack: Set<NodeID>[] = []\n\tprivate pendingResolutionError: CircularParentResolutionError | undefined\n\n\tconstructor(\n\t\tprivate readonly treeStore: TreeStore,\n\t\tprivate insertionScopeNode: Loaded<ScopeNode>,\n\t\tprivate readonly componentLoader: AnyComponentLoader,\n\t\tprivate readonly collections: Collections,\n\t\tprivate readonly virtualText: VirtualText,\n\t) {\n\t\tthis.recordRenamedId(rootNodeId, this.treeStore.tree.root.id)\n\t}\n\n\tupdateInsertionScope(scopeNode: Loaded<ScopeNode>): void {\n\t\tthis.insertionScopeNode = scopeNode\n\t}\n\n\textractRenamedIds(): Map<string, NodeID> {\n\t\tconst result = new Map<string, NodeID>()\n\t\tfor (const [llmId, canvasId] of this.canvasIdByLLMId) {\n\t\t\tif (llmId === rootNodeId) continue\n\t\t\tif (this.sentCanvasIds.has(canvasId)) continue\n\t\t\tresult.set(llmId, canvasId)\n\t\t\tthis.sentCanvasIds.add(canvasId)\n\t\t}\n\t\treturn result\n\t}\n\n\tget(id: string | NodeID): MaybeCanvasNode {\n\t\tconst resolvedId = this.resolve(id)\n\t\tconst node = this.getLookupTree().get(resolvedId)\n\t\tif (node) return node\n\n\t\t// If the resolved node doesn't exist in the tree, fall back to the in-memory node.\n\t\tconst insertionInfo = this.pendingNodesByCanvasId.get(resolvedId)\n\t\tif (insertionInfo) return insertionInfo.node\n\n\t\treturn null\n\t}\n\n\t/**\n\t * Returns the node as it currently exists in the lookup tree, preserving the type.\n\t */\n\tcurrent<T extends CanvasNode>(node: T | null | undefined): T | null {\n\t\tif (!node) return null\n\t\treturn this.getLookupTree().get<T>(node.id)\n\t}\n\n\t/**\n\t * Get the parent of a node (including a scope node), whether or not it is already inserted.\n\t */\n\tgetParentNode(node: CanvasNode | null | undefined): MaybeCanvasNode {\n\t\tif (!node) return null\n\n\t\tconst insertionInfo = this.pendingNodesByCanvasId.get(node.id)\n\t\tconst isPendingInsertion = !isUndefined(insertionInfo) && !insertionInfo.inserted\n\n\t\tconst scheduledParentId = isPendingInsertion ? insertionInfo?.attributes?.parent : undefined\n\t\tconst liveParentId = this.current(node)?.parentid ?? node.parentid\n\n\t\tconst parentId = scheduledParentId ?? liveParentId\n\t\tif (!parentId) return null\n\n\t\treturn this.get(parentId)\n\t}\n\n\tgetAncestorsFor(id: string | NodeID): CanvasNode[] {\n\t\tconst node = this.get(id)\n\t\tif (!node) return []\n\n\t\tconst ancestors: CanvasNode[] = []\n\t\tconst visited = new Set<NodeID>([node.id])\n\t\tlet current = node\n\t\twhile (true) {\n\t\t\tconst parent = this.getParentNode(current)\n\t\t\tif (!parent) return ancestors\n\t\t\tif (visited.has(parent.id)) return ancestors\n\t\t\tvisited.add(parent.id)\n\t\t\tancestors.push(parent)\n\t\t\tcurrent = parent\n\t\t}\n\t}\n\n\tgetPendingInsertionInfo(id: string | NodeID): PendingInsertionInfo | undefined {\n\t\tconst resolvedId = this.resolve(id)\n\t\tconst info = this.pendingNodesByCanvasId.get(resolvedId)\n\t\tif (!info || info.inserted) return\n\t\treturn {\n\t\t\tnode: info.node,\n\t\t\tattributes: info.attributes,\n\t\t}\n\t}\n\n\tconsumeResolutionError(): CircularParentResolutionError | undefined {\n\t\tconst error = this.pendingResolutionError\n\t\tthis.pendingResolutionError = undefined\n\t\treturn error\n\t}\n\n\tgetGroundNodeFor(id: string | NodeID): MaybeCanvasNode {\n\t\tconst real = this.get(id)\n\t\tif (!real) return null\n\n\t\tconst lookupTree = this.getLookupTree()\n\n\t\t// If the node is already in the tree, we can find its scope node directly.\n\t\tif (lookupTree.has(real.id)) {\n\t\t\treturn lookupTree.getGroundNodeFor(real)\n\t\t}\n\n\t\t// Given that the node is not yet in the tree, we cannot find its scope node. Instead, walk it's\n\t\t// ancestors until we find a scope node, or a node in the tree we can check.\n\t\tlet parent = real\n\t\tconst visited = new Set<NodeID>()\n\t\twhile (parent) {\n\t\t\tif (visited.has(parent.id)) {\n\t\t\t\tconst error = new CircularParentResolutionError(real.id, parent.id)\n\t\t\t\tthis.pendingResolutionError = error\n\t\t\t\tlog.warn(error.message, { nodeId: error.nodeId, parentId: error.parentId })\n\t\t\t\treturn null\n\t\t\t}\n\t\t\tvisited.add(parent.id)\n\n\t\t\tconst parentNode = this.getParentNode(parent)\n\t\t\tif (!parentNode) return null\n\n\t\t\t// If the parent is a scope node, return the last node we saw that was not a scope node.\n\t\t\tif (isScopeNode(parentNode)) return parent\n\n\t\t\tif (!lookupTree.has(parentNode.id)) {\n\t\t\t\tparent = parentNode\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\treturn lookupTree.getGroundNodeFor(parentNode)\n\t\t}\n\n\t\treturn null\n\t}\n\n\t/**\n\t * Get the scope node for a LLM or Canvas Tree id even if none of the nodes are in the tree yet.\n\t */\n\tgetScopeNodeFor(id: string | NodeID): Loaded<ScopeNode> | null {\n\t\tconst groundNode = this.getGroundNodeFor(id)\n\t\tif (!groundNode) return null\n\n\t\tconst lookupTree = this.getLookupTree()\n\t\tif (lookupTree.has(groundNode.id)) {\n\t\t\treturn lookupTree.getScopeNodeFor(groundNode)\n\t\t}\n\n\t\tconst parent = this.getParentNode(groundNode)\n\t\tif (!parent) return null\n\n\t\tassert(isScopeNode(parent), \"Parent is a scope node\")\n\t\tassert(parent.isLoaded(), \"Scope node is not loaded\")\n\t\treturn parent\n\t}\n\n\tgetLastChanges(): ReadonlyMap<NodeID, NodeOperation> {\n\t\tif (this.changedNodeIds.size === 0) return emptyMap()\n\t\tconst changedNodeIds = new Map(this.changedNodeIds)\n\t\tthis.changedNodeIds.clear()\n\t\treturn changedNodeIds\n\t}\n\n\t/**\n\t * Executes a closure and returns node ids changed during this execution.\n\t * Unlike `getLastChanges`, this does not drain global change state.\n\t *\n\t * Ensure `run` enforces serial execution of changes to avoid race conditions (mutex/LockQueue).\n\t */\n\tasync process<T>(run: () => Promise<T> | T): Promise<{ result: T; changedNodeIds: NodeID[] }> {\n\t\tconst processChangedNodeIds = new Set<NodeID>()\n\t\tthis.processChangeCaptureStack.push(processChangedNodeIds)\n\t\ttry {\n\t\t\tconst result = await run()\n\t\t\treturn { result, changedNodeIds: Array.from(processChangedNodeIds) }\n\t\t} finally {\n\t\t\tthis.processChangeCaptureStack.pop()\n\t\t}\n\t}\n\n\trecordChangedNode(id: NodeID, operation: Exclude<NodeOperation, \"insertAndUpdate\">): void {\n\t\tconst node = this.get(id)\n\t\tif (!node) return\n\n\t\tif (isCollectionItemNode(node)) {\n\t\t\tif (!this.mutatingCmsNodeUpdates.has(node.id)) {\n\t\t\t\tthis.mutatingCmsNodeUpdates.set(node.id, {})\n\t\t\t}\n\t\t} else {\n\t\t\tthis.mutatingCanvasNodeIds.add(node.id)\n\t\t}\n\n\t\tconst previousOperation = this.changedNodeIds.get(node.id)\n\t\tconst isFirstOperation = !previousOperation\n\t\tconst isRemoving = operation === \"remove\"\n\t\tconst isUpdatingInsertedNode = previousOperation === \"insert\" && operation === \"update\"\n\n\t\tif (isFirstOperation || isRemoving) {\n\t\t\tthis.changedNodeIds.set(node.id, operation)\n\t\t}\n\t\tif (isUpdatingInsertedNode) {\n\t\t\tthis.changedNodeIds.set(node.id, \"insertAndUpdate\")\n\t\t}\n\n\t\tfor (const processChangedNodeIds of this.processChangeCaptureStack) {\n\t\t\tprocessChangedNodeIds.add(node.id)\n\t\t}\n\t}\n\n\tgetUninsertedNodes(): UninsertedNode[] {\n\t\tconst result: UninsertedNode[] = []\n\t\tfor (const [canvasId, info] of this.pendingNodesByCanvasId) {\n\t\t\tif (info.inserted) continue\n\t\t\t// Fixed overlays stay deferred until a SHOW_OVERLAY action references them, so they\n\t\t\t// should not be reported as orphaned \"forgot to insert\" nodes in the meantime.\n\t\t\tif (isOverlayNode(info.node)) continue\n\t\t\tconst llmId = this.llmIdByCanvasId.get(canvasId)\n\t\t\tif (llmId && info.attributes) {\n\t\t\t\tresult.push({ llmId, attributes: info.attributes })\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n\n\trecordMutatingNodeUpdates(id: NodeID, updates: CmsNodeUpdates): void {\n\t\tconst node = this.get(id)\n\t\tif (!node) return\n\n\t\t// non-CMS nodes don't animate individual control prop changes\n\t\tif (!isCollectionItemNode(node)) return\n\n\t\tconst nextUpdates = mergeCmsNodeUpdates(this.mutatingCmsNodeUpdates.get(node.id), updates)\n\n\t\tif (nextUpdates.changedControlProps?.size) {\n\t\t\tthis.mutatingCmsNodeUpdates.set(node.id, nextUpdates)\n\t\t}\n\t}\n\n\tdrainMutatingNodes(): Readonly<NodesMutatedByAgent> {\n\t\tconst mutatingNodes = {\n\t\t\tcanvas: this.mutatingCanvasNodeIds,\n\t\t\tcms: this.mutatingCmsNodeUpdates,\n\t\t}\n\t\tthis.mutatingCanvasNodeIds = new Set()\n\t\tthis.mutatingCmsNodeUpdates = new Map()\n\t\treturn mutatingNodes\n\t}\n\n\tremove(scheduleUpdate: (fn: VoidFunction) => Promise<void>, id: NodeID): Promise<void> | undefined {\n\t\tconst info = this.pendingNodesByCanvasId.get(id)\n\t\tconst lookupTree = this.getLookupTree()\n\t\tif (!info && !lookupTree.has(id)) return\n\n\t\tthis.recordChangedNode(id, \"remove\")\n\t\tthis.pendingNodesByCanvasId.delete(id)\n\n\t\t// TODO: Removed nodes need to trigger a special heuristic to ensure that the parent is included\n\t\t// in the change log to show that the node has been deleted.\n\t\treturn scheduleUpdate(() => {\n\t\t\tconst tree = this.getLookupTree()\n\n\t\t\tconst node = tree.get(id)\n\t\t\tif (!node) return\n\n\t\t\tif (isColorStyleTokenNode(node)) {\n\t\t\t\tsoftDeleteColorToken(tree, node)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tremoveNodeWithReference(tree, id)\n\t\t})\n\t}\n\n\t/** Push updates through the Resolver to track their ids and record changes. */\n\tupdate(scheduleUpdate: (fn: VoidFunction) => Promise<void>, id: NodeID, cb: () => void) {\n\t\tthis.recordChangedNode(id, \"update\")\n\t\treturn scheduleUpdate(() => cb())\n\t}\n\n\t/**\n\t * Schedule a node to be inserted with the next SET command.\n\t */\n\tscheduleInsertion(llmId: string, node: CanvasNode, attributes?: AddCommandAttributes): void {\n\t\tlog.trace(\"scheduleInsertion\", llmId, node.id, attributes)\n\t\tthis.record(llmId, node, false, attributes)\n\t}\n\n\t/**\n\t * Insert a node that was previously created with ADD. Optionally modifying the node before\n\t * insertion.\n\t */\n\tinsertScheduledNode(\n\t\tscheduleUpdate: (fn: VoidFunction) => Promise<void>,\n\t\tid: NodeID,\n\t\tupdate?: (node: CanvasNode) => void,\n\t) {\n\t\tconst info = this.pendingNodesByCanvasId.get(id)\n\t\tlog.trace(\"insertScheduledNode\", id, info?.node?.id, info?.inserted)\n\t\tif (!info || info.inserted) return\n\n\t\treturn scheduleUpdate(() => {\n\t\t\tconst name = getGeneratedValue(info.node.name)\n\t\t\tif (isString(name)) {\n\t\t\t\tcreateEntityFolderParentNodeIfNeeded(info.node, name, this.treeStore)\n\t\t\t}\n\n\t\t\tupdate?.(info.node)\n\n\t\t\tassert(\n\t\t\t\t!isCodeComponentNode(info.node) || Boolean(info.node.codeComponentIdentifier),\n\t\t\t\t`Cannot insert \"${id}\" before its codeComponentIdentifier is resolved`,\n\t\t\t)\n\n\t\t\tconst parent = this.get(\n\t\t\t\tgetDefaultParent(info.node, this.getLookupTree())?.id ?? info.attributes?.parent ?? this.insertionScopeNode.id,\n\t\t\t)\n\n\t\t\tassert(parent, `Cannot insert \"${id}\" into non-existent parent \"${info.attributes?.parent}\"`)\n\n\t\t\tapplyGroundNodePositionIfNeeded(this.treeStore.tree, parent, info.node)\n\n\t\t\tconst parentId = isReplicaOrReplicaChild(parent) ? parent.originalid : parent.id\n\t\t\tconst node = this.treeStore.getDataTreeOrPartialTree().insertNode(info.node, parentId, info.attributes?.position)\n\n\t\t\tif (isReplicaOrReplicaChild(parent)) {\n\t\t\t\tnode.set({ visible: false })\n\t\t\t\tconst replica = TemplateHelper.getReplicaForTemplateNode(this.treeStore.tree, parent)\n\t\t\t\tassert(replica, \"Replica is required\")\n\t\t\t\tupdateReplicaNodeOverrides(this.treeStore.tree, replica, node.id, { visible: true })\n\n\t\t\t\tconst llmId = this.llmIdByCanvasId.get(id)\n\t\t\t\tassert(llmId, \"LLM id is required\")\n\n\t\t\t\tconst replicaChildId = generateReplicaChildId(replica.id, node.id)\n\t\t\t\tthis.recordRenamedId(llmId, replicaChildId)\n\t\t\t}\n\n\t\t\tthis.recordChangedNode(node.id, \"insert\")\n\t\t\tthis.markInserted(id)\n\t\t})\n\t}\n\n\tasync insertOnFirstUpdate(\n\t\tscheduleUpdate: (fn: VoidFunction) => Promise<void>,\n\t\tllmId: string,\n\t\tapplyAttributes: (node: CanvasNode) => void,\n\t) {\n\t\tconst node = this.get(llmId)\n\t\tassert(node, `Cannot insert unknown node \"${llmId}\"`)\n\n\t\tconst parent = this.getParentNode(node)\n\t\tconst loadedScope = isScopeNode(parent) ? (parent.isLoaded() ? parent : await parent.load()) : undefined\n\t\tif (isFrameNode(node) && isSmartComponentNode(loadedScope) && !loadedScope.baseVariantId) {\n\t\t\treturn this.insertWithCallback(scheduleUpdate, llmId, () => {\n\t\t\t\tnode.set(defaultPrimaryVariantAttributes)\n\t\t\t\tloadedScope.set({ baseVariantId: node.id })\n\n\t\t\t\tconst insertedParent = this.getLookupTree().insertNode(loadedScope)\n\t\t\t\tconst insertedNode = this.getLookupTree().insertNode(node, insertedParent.id)\n\n\t\t\t\tsetupFolderStructureForNodeName(\n\t\t\t\t\tthis.getLookupTree(),\n\t\t\t\t\tinsertedParent,\n\t\t\t\t\tgetGeneratedValue(insertedParent.name) ?? Dictionary.Component,\n\t\t\t\t\tCOMPONENTS_ENTITY_TYPE_ROOT_ID,\n\t\t\t\t\ttrue,\n\t\t\t\t)\n\n\t\t\t\tthis.markInserted(insertedNode.id)\n\t\t\t\tthis.markInserted(insertedParent.id)\n\n\t\t\t\tthis.recordChangedNode(insertedNode.id, \"insert\")\n\t\t\t\tthis.recordChangedNode(insertedParent.id, \"insert\")\n\n\t\t\t\tconst current = this.getLookupTree().current(insertedNode)\n\t\t\t\tassert(current, \"Node must be present in the tree\")\n\t\t\t\tapplyAttributes(current)\n\n\t\t\t\treturn current\n\t\t\t})\n\t\t}\n\n\t\tif (isFrameNode(node) && isWebPageNode(loadedScope) && !loadedScope.baseVariantId) {\n\t\t\treturn this.insertWithCallback(scheduleUpdate, llmId, () => {\n\t\t\t\tconst webPage = loadedScope\n\t\t\t\tnode.set(getPrimaryBreakpointProps())\n\t\t\t\twebPage.set({ baseVariantId: node.id })\n\t\t\t\twebPage.addChild(node)\n\n\t\t\t\tconst webPageInsertionInfo = this.pendingNodesByCanvasId.get(webPage.id)\n\t\t\t\tassert(\n\t\t\t\t\twebPageInsertionInfo?.attributes?.node === ClassDiscriminator.WebPageNode,\n\t\t\t\t\t\"Web page insertion info must be a WebPageNode\",\n\t\t\t\t)\n\t\t\t\tconst pagePath = webPageInsertionInfo?.attributes?.path ?? getGeneratedValue(webPage.name) ?? Dictionary.Page\n\t\t\t\tassert(isString(pagePath), \"Path is required\")\n\n\t\t\t\tconst collectionId = applyCollectionFromPath(this.treeStore.tree, webPage, pagePath)\n\t\t\t\tif (collectionId) {\n\t\t\t\t\tthis.collections.registerVariables(collectionId)\n\t\t\t\t}\n\n\t\t\t\tconst uniquePagePath = getUniquePagePath(pagePath, this.treeStore.tree, this.componentLoader, webPage).path\n\t\t\t\tassert(uniquePagePath !== \"/\", \"Cannot create a home page\")\n\n\t\t\t\tcreateRouteSegment(this.treeStore.tree, this.componentLoader, webPage, webPage.dataIdentifier, uniquePagePath)\n\n\t\t\t\tthis.getLookupTree().insertNode(webPage)\n\n\t\t\t\tthis.markInserted(node.id)\n\t\t\t\tthis.markInserted(webPage.id)\n\t\t\t\tthis.recordChangedNode(node.id, \"insert\")\n\t\t\t\tthis.recordChangedNode(webPage.id, \"insert\")\n\n\t\t\t\tconst current = this.treeStore.tree.current(node)\n\t\t\t\tassert(current, \"Node must be present in the tree\")\n\t\t\t\tapplyAttributes(current)\n\n\t\t\t\treturn current\n\t\t\t})\n\t\t}\n\n\t\tif (isFrameNode(node) && isLayoutTemplateNode(loadedScope) && !loadedScope.baseVariantId) {\n\t\t\treturn this.insertWithCallback(scheduleUpdate, llmId, () => {\n\t\t\t\tnode.set({\n\t\t\t\t\t...getPrimaryBreakpointProps(),\n\t\t\t\t\t...layoutTemplatePrimaryLayoutDefaults,\n\t\t\t\t})\n\t\t\t\tloadedScope.set({ baseVariantId: node.id })\n\n\t\t\t\tconst tree = this.getLookupTree()\n\t\t\t\ttree.insertNode(loadedScope)\n\t\t\t\ttree.insertNode(node, loadedScope.id)\n\t\t\t\tconst slot = new SlotNode()\n\t\t\t\ttree.insertNode(slot, node.id)\n\n\t\t\t\tsetupFolderStructureForNodeName(\n\t\t\t\t\tthis.getLookupTree(),\n\t\t\t\t\tloadedScope,\n\t\t\t\t\tgetGeneratedValue(loadedScope.name) ?? Dictionary.Template,\n\t\t\t\t\tLAYOUT_TEMPLATE_ENTITY_ROOT_ID,\n\t\t\t\t\ttrue,\n\t\t\t\t)\n\n\t\t\t\tthis.markInserted(node.id)\n\t\t\t\tthis.markInserted(loadedScope.id)\n\t\t\t\tthis.recordChangedNode(node.id, \"insert\")\n\t\t\t\tthis.recordChangedNode(loadedScope.id, \"insert\")\n\n\t\t\t\tconst current = this.getLookupTree().current(node)\n\t\t\t\tassert(current, \"Node must be present in the tree\")\n\t\t\t\tapplyAttributes(current)\n\n\t\t\t\treturn current\n\t\t\t})\n\t\t}\n\n\t\tif (withReplicaVariants(loadedScope) && !loadedScope.baseVariantId) {\n\t\t\tthrow new RejectedCommandError(RejectedCommandKind.ScopeNodeMustHaveBaseVariant)\n\t\t}\n\n\t\treturn this.insertScheduledNode(scheduleUpdate, node.id, applyAttributes)\n\t}\n\n\t/**\n\t * Manually handle insertion of a node while recording the mapping of LLM to Canvas Tree id for\n\t * future lookups.\n\t */\n\tinsertWithCallback(\n\t\tscheduleUpdate: (fn: VoidFunction) => Promise<void>,\n\t\tllmId: string,\n\t\tcallback: () => MaybeCanvasNode,\n\t): Promise<void> {\n\t\treturn scheduleUpdate(() => {\n\t\t\tconst node = callback()\n\t\t\tif (!node) return\n\t\t\tthis.record(llmId, node, true)\n\t\t\tfor (const changedNode of node.walk()) {\n\t\t\t\tthis.recordChangedNode(changedNode.id, \"insert\")\n\t\t\t}\n\t\t})\n\t}\n\n\tinsert(\n\t\tscheduleUpdate: (fn: VoidFunction) => Promise<void>,\n\t\tllmId: string,\n\t\tnode: CanvasNode,\n\t\tattributes?: AddCommandAttributes,\n\t): Promise<void> | undefined {\n\t\tthis.scheduleInsertion(llmId, node, attributes)\n\t\treturn this.insertScheduledNode(scheduleUpdate, node.id)\n\t}\n\n\tduplicate(\n\t\tscheduleUpdate: (fn: VoidFunction) => Promise<void>,\n\t\tid: string,\n\t\tnewId: string,\n\t\tparentId: string,\n\t\tposition?: number,\n\t): Promise<void> {\n\t\treturn this.insertWithCallback(scheduleUpdate, newId, () => {\n\t\t\tconst source = this.get(id)\n\t\t\tassert(source, `Cannot duplicate unknown node \"${id}\"`)\n\t\t\tconst parent = this.get(parentId)\n\t\t\tassert(parent, `Cannot duplicate node \"${id}\" into unknown parent \"${parentId}\"`)\n\t\t\tconst sourceLlmId = this.llmIdByCanvasId.get(source.id) ?? id\n\n\t\t\tconst renamedIds = new Map<NodeID, NodeID>()\n\t\t\tconst clone = source.cloneWithRenamedIds(renamedIds)\n\t\t\tconst inserted = this.treeStore\n\t\t\t\t.getDataTreeOrLoadedTree()\n\t\t\t\t.insertNode(clone, parent.id, position === -1 ? undefined : position)\n\n\t\t\tthis.recordDuplicateDescendantAliases(source, newId, renamedIds, sourceLlmId)\n\n\t\t\t// If the duplicated root itself is rich text, hydrate it too.\n\t\t\tif (isRichTextNode(inserted)) this.virtualText.hydrate(inserted)\n\n\t\t\treturn inserted\n\t\t})\n\t}\n\n\trecordDuplicateDescendantAliases(\n\t\tsource: CanvasNode,\n\t\tnewId: string,\n\t\trenamedIds: ReadonlyMap<NodeID, NodeID>,\n\t\tsourceLlmId = this.llmIdByCanvasId.get(source.id) ?? source.id,\n\t): void {\n\t\t// Precompute compound ids to unlock single-turn duplication + modification.\n\t\tfor (const [oldCanvasId, newCanvasId] of renamedIds) {\n\t\t\t// 1) Skip the duplicated root; it is tracked directly via `newId`.\n\t\t\tif (oldCanvasId === source.id) continue\n\n\t\t\t// 2) Resolve the most specific known identifier for the source descendant.\n\t\t\tconst oldLlmId = this.llmIdByCanvasId.get(oldCanvasId) ?? oldCanvasId\n\n\t\t\t// 3) Register the canonical compound alias: `${newId}${oldLlmId}`.\n\t\t\tthis.recordRenamedId(`${newId}${oldLlmId}`, newCanvasId)\n\n\t\t\t// 4) Also register a fallback that preserves raw canvas-id suffixes.\n\t\t\tif (oldLlmId !== oldCanvasId) {\n\t\t\t\tthis.recordRenamedId(`${newId}${oldCanvasId}`, newCanvasId)\n\t\t\t}\n\n\t\t\t// 5) Rewrite source-prefixed aliases, e.g. `frame-child` -> `frame2-child`.\n\t\t\tif (oldLlmId.startsWith(sourceLlmId)) {\n\t\t\t\tconst rewrittenAlias = `${newId}${oldLlmId.slice(sourceLlmId.length)}`\n\t\t\t\tthis.recordRenamedId(rewrittenAlias, newCanvasId)\n\t\t\t}\n\n\t\t\t// 6) Hydrate duplicated rich text immediately so virtual ids resolve in-turn.\n\t\t\tconst duplicatedNode = this.treeStore.tree.get(newCanvasId)\n\t\t\tif (!duplicatedNode || !isRichTextNode(duplicatedNode)) continue\n\n\t\t\tthis.virtualText.hydrate(duplicatedNode)\n\t\t}\n\t}\n\n\tprivate recordReplicaRenamedIds(llmId: string, node: CanvasNode): void {\n\t\t// When adding an original node in a scope with replica variants, pre-record the id that we\n\t\t// expect the LLM to use to update this newly created original node in each replica. This avoids\n\t\t// costly lookups, and guarantees that we don't limit ourselves to checking the replicas of the\n\t\t// insertion scope node.\n\t\tconst groundNode = this.getGroundNodeFor(node.id)\n\t\tif (!groundNode) return\n\n\t\tif (!isPrimaryVariant(groundNode)) return\n\n\t\tconst scopeNode = this.getScopeNodeFor(groundNode.id)\n\t\tif (!scopeNode || !withReplicaVariants(scopeNode)) return\n\n\t\tconst replicaVariants = scopeNode.getReplicaVariants()\n\t\tfor (const replicaVariant of replicaVariants) {\n\t\t\tconst compoundLlmId = generateReplicaChildId(replicaVariant.id, llmId)\n\t\t\t// Skip replicas that are already tracked. They are easily identifiable.\n\t\t\tif (this.llmIdByCanvasId.has(replicaVariant.id)) continue\n\n\t\t\t// For each replica, generate the id we expect to replace it with.\n\t\t\tthis.originalNodeReplicaIds.set(compoundLlmId, generateReplicaChildId(replicaVariant.id, node.id))\n\t\t}\n\t}\n\n\tprivate record(llmId: string, node: CanvasNode, inserted: boolean = false, attributes?: AddCommandAttributes) {\n\t\tthis.recordRenamedId(llmId, node.id)\n\t\tthis.pendingNodesByCanvasId.set(node.id, { node, attributes, inserted })\n\n\t\tthis.recordReplicaRenamedIds(llmId, node)\n\t\tif (isReplicaVariant(node)) this.llmReplicaIds.add(llmId)\n\t}\n\n\tprivate recordRenamedId(llmId: string, canvasId: NodeID): void {\n\t\tthis.llmIdByCanvasId.set(canvasId, llmId)\n\t\tthis.canvasIdByLLMId.set(llmId, canvasId)\n\n\t\tconst node = this.treeStore.tree.get(canvasId)\n\t\tif (node && isReplicaVariant(node)) this.llmReplicaIds.add(llmId)\n\t}\n\n\tprivate markInserted(id: NodeID): void {\n\t\tconst insertionInfo = this.pendingNodesByCanvasId.get(id)\n\t\tif (!insertionInfo) return\n\n\t\tinsertionInfo.inserted = true\n\t}\n\n\t/**\n\t * Get the LLM id for a canvas id.\n\t */\n\tgetLlmId(canvasId: NodeID): string | undefined {\n\t\treturn this.llmIdByCanvasId.get(canvasId)\n\t}\n\n\t/**\n\t * Register a new mapping from an LLM id to a canvas node that was created\n\t * outside the normal ADD flow (e.g. by engine-level conversion).\n\t */\n\tregisterExternalNode(llmId: string, node: CanvasNode): void {\n\t\tthis.recordRenamedId(llmId, node.id)\n\t\tthis.pendingNodesByCanvasId.set(node.id, { node, inserted: true })\n\t}\n\n\t/**\n\t * Rebuild LLM<->Canvas mappings from historical state without emitting\n\t * renamed-id hooks. Clears all other in-turn maps and states.\n\t *\n\t * We reset the mapping tables on each hydration pass so stale aliases from\n\t * previous turns cannot leak into the next turn's resolver state.\n\t */\n\tinit(mappings: ReadonlyMap<string, NodeID>): void {\n\t\tconst restoredPendingNodesByCanvasId = new Map<NodeID, NodeInsertionInfo>()\n\n\t\tthis.llmIdByCanvasId.clear()\n\t\tthis.canvasIdByLLMId.clear()\n\t\tthis.originalNodeReplicaIds.clear()\n\t\tthis.llmReplicaIds.clear()\n\n\t\tconst rootCanvasId = this.treeStore.tree.root.id\n\t\tthis.llmIdByCanvasId.set(rootCanvasId, rootNodeId)\n\t\tthis.canvasIdByLLMId.set(rootNodeId, rootCanvasId)\n\n\t\tfor (const [llmId, canvasId] of mappings) {\n\t\t\tconst node = this.getLookupTree().get(canvasId)\n\t\t\t// Ignore nodes that are not in the tree, unless it's in pendingNodesByCanvasId.\n\t\t\tif (node) {\n\t\t\t\tthis.llmIdByCanvasId.set(canvasId, llmId)\n\t\t\t\tthis.canvasIdByLLMId.set(llmId, canvasId)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst pendingInsertionInfo = this.pendingNodesByCanvasId.get(canvasId)\n\t\t\tif (!pendingInsertionInfo) continue\n\n\t\t\tthis.llmIdByCanvasId.set(canvasId, llmId)\n\t\t\tthis.canvasIdByLLMId.set(llmId, canvasId)\n\t\t\trestoredPendingNodesByCanvasId.set(canvasId, pendingInsertionInfo)\n\t\t}\n\n\t\t// After we track the nodes, precompute any replica compound IDs.\n\t\tfor (const [llmId, canvasId] of this.canvasIdByLLMId) {\n\t\t\tconst node = this.getLookupTree().get(canvasId)\n\t\t\tif (!node) continue\n\n\t\t\tthis.recordReplicaRenamedIds(llmId, node)\n\t\t\tif (isReplicaVariant(node)) this.llmReplicaIds.add(llmId)\n\t\t}\n\n\t\tthis.pendingNodesByCanvasId.clear()\n\t\tfor (const [canvasId, insertionInfo] of restoredPendingNodesByCanvasId) {\n\t\t\tthis.pendingNodesByCanvasId.set(canvasId, insertionInfo)\n\t\t}\n\n\t\t// In-turn states.\n\t\tthis.sentCanvasIds.clear()\n\t\tthis.changedNodeIds.clear()\n\t\tthis.mutatingCanvasNodeIds.clear()\n\t\tthis.mutatingCmsNodeUpdates.clear()\n\t\tthis.processChangeCaptureStack.length = 0\n\t\tthis.pendingResolutionError = undefined\n\t}\n\n\tresolveVirtualId(id: string): string {\n\t\treturn this.tryResolveVirtualId(id) ?? id\n\t}\n\n\tprivate tryResolveVirtualId(id: string | NodeID): NodeID | undefined {\n\t\tif (!isVirtualNodeId(id)) return\n\t\tconst virtualId = parseVirtualNodeId(id)\n\t\tconst resolvedTarget = this.resolveRichTextTarget(virtualId.richTextTarget)\n\t\tif (resolvedTarget === virtualId.richTextTarget) return id\n\t\treturn createVirtualNodeId(resolvedTarget, virtualId.localId)\n\t}\n\n\tprivate resolveRichTextTarget(target: RichTextTarget): RichTextTarget {\n\t\tconst separatorIndex = target.indexOf(\"/\")\n\t\tif (separatorIndex === -1) return this.resolve(target)\n\t\tconst targetNodeId = target.slice(0, separatorIndex)\n\t\tconst targetKey = target.slice(separatorIndex + 1)\n\t\treturn `${this.resolve(targetNodeId)}/${targetKey}`\n\t}\n\n\tprivate resolve(id: string | NodeID): NodeID {\n\t\t// 1. Compound replica-child ids must resolve before any other aliasing.\n\t\tconst replicaChildId = this.tryResolveReplicaChild(id)\n\t\tif (replicaChildId) return replicaChildId\n\n\t\t// 2. If an exact tree node still exists, it wins over any alias lookup.\n\t\tif (this.getLookupTree().has(id)) return id\n\n\t\t// 3. If an exact pending node exists, it also wins over any alias lookup.\n\t\tif (this.pendingNodesByCanvasId.has(id)) return id\n\n\t\t// 4. Finally, resolve normal llm-id aliases to their canvas ids.\n\t\treturn this.canvasIdByLLMId.get(id) ?? id\n\t}\n\n\t/**\n\t * Do all reads against the data tree if it is available. This avoids inaccurate fails due to\n\t * shallow loading.\n\t */\n\tgetLookupTree(): CanvasTree {\n\t\treturn this.treeStore.getDataTreeOrPartialTree()\n\t}\n\n\tprivate tryResolveReplicaChild(llmId: string) {\n\t\t// If we inserted an original node in a scope with existing replica variants, we created a\n\t\t// fast-path for resolving to the replica id.\n\t\tconst match = this.originalNodeReplicaIds.get(llmId)\n\t\tif (match) return match\n\n\t\t// Short-circuit if the id is a replica id.\n\t\tif (this.llmReplicaIds.has(llmId)) return\n\n\t\t// It's unlikely that an agent will create more than a few replicas in a single session,\n\t\t// meaning this iteration is unlikely to be a bottleneck.\n\t\tfor (const replicaId of this.llmReplicaIds) {\n\t\t\tif (!llmId.startsWith(replicaId)) continue\n\n\t\t\tconst base = this.canvasIdByLLMId.get(replicaId)\n\t\t\tassert(base, \"Base ID is required: \" + replicaId + \" / \" + llmId)\n\n\t\t\t// The Replica must exist in the tree.\n\t\t\tif (!this.treeStore.tree.getNodeWithTrait(base, isReplicaVariant)) return llmId\n\n\t\t\tconst rest = llmId.slice(replicaId.length)\n\n\t\t\t// When we haven't inserted the original node in this session, \"rest\" is a real id.\n\t\t\tconst original = this.canvasIdByLLMId.get(rest) ?? rest\n\n\t\t\t// The original node must exist in the tree and not be a replica or replica child. If it\n\t\t\t// isn't, we must check the next replica id.\n\t\t\tconst originalNode = this.treeStore.tree.get(original)\n\t\t\tif (!originalNode || isReplicaOrReplicaChild(originalNode)) continue\n\n\t\t\treturn generateReplicaChildId(base, original)\n\t\t}\n\t}\n}\n\nfunction getDefaultParent(node: CanvasNode, tree: CanvasTree): MaybeCanvasNode {\n\tif (isColorStyleTokenNode(node)) return ColorStyleTokenListNode.ensure(tree)\n\tif (isRedirectRouteNode(node)) {\n\t\treturn RoutesNode.ensure(tree).loaded\n\t}\n\tif (isAgentSupportedStylePresetNode(node)) {\n\t\treturn PresetsListNode.ensure(tree)\n\t}\n\n\tif (isScopeNode(node)) {\n\t\treturn tree.root\n\t}\n\n\treturn null\n}\n\nexport function getEntityTypeRootIdForNode(node: CanvasNode) {\n\tswitch (node.__class) {\n\t\tcase ClassDiscriminator.ColorStyleTokenNode:\n\t\t\treturn COLOR_ENTITY_ROOT_ID\n\t\tcase ClassDiscriminator.TextStylePresetNode:\n\t\t\treturn TEXT_ENTITY_ROOT_ID\n\t\tcase ClassDiscriminator.LinkStylePresetNode:\n\t\t\treturn LINK_ENTITY_ROOT_ID\n\t\tcase ClassDiscriminator.InlineCodeStylePresetNode:\n\t\t\treturn INLINE_CODE_ENTITY_ROOT_ID\n\t\tcase ClassDiscriminator.BlockquoteStylePresetNode:\n\t\t\treturn BLOCKQUOTE_ENTITY_ROOT_ID\n\t\tcase ClassDiscriminator.ImageStylePresetNode:\n\t\tcase ClassDiscriminator.TableStylePresetNode:\n\t\tcase ClassDiscriminator.ComponentPresetNode:\n\t\t\treturn CMS_ENTITY_ROOT_ID\n\t\tcase ClassDiscriminator.SmartComponentNode:\n\t\t\treturn COMPONENTS_ENTITY_TYPE_ROOT_ID\n\t\tcase ClassDiscriminator.LayoutTemplateNode:\n\t\t\treturn LAYOUT_TEMPLATE_ENTITY_ROOT_ID\n\t\tdefault:\n\t\t\treturn null\n\t}\n}\n\nexport function createEntityFolderParentNodeIfNeeded(node: CanvasNode, name: string, treeStore: TreeStore): boolean {\n\tconst entityTypeRootId = getEntityTypeRootIdForNode(node)\n\tif (!entityTypeRootId) return false\n\n\tswitch (entityTypeRootId) {\n\t\tcase COLOR_ENTITY_ROOT_ID:\n\t\t\tColorStyleTokenListNode.ensure(treeStore.tree)\n\t\t\tbreak\n\t\tcase COMPONENTS_ENTITY_TYPE_ROOT_ID:\n\t\tcase LAYOUT_TEMPLATE_ENTITY_ROOT_ID:\n\t\t\tensureEntityTypeRootNode(treeStore.tree, entityTypeRootId)\n\t\t\tbreak\n\t\tcase TEXT_ENTITY_ROOT_ID:\n\t\tcase LINK_ENTITY_ROOT_ID:\n\t\tcase INLINE_CODE_ENTITY_ROOT_ID:\n\t\tcase BLOCKQUOTE_ENTITY_ROOT_ID:\n\t\tcase CMS_ENTITY_ROOT_ID:\n\t\t\tPresetsListNode.ensure(treeStore.tree)\n\t\t\tbreak\n\t\tdefault:\n\t\t\tassertNever(entityTypeRootId)\n\t}\n\n\tsetupFolderStructureForNodeName(treeStore.tree, node, name, entityTypeRootId, !treeStore.tree.has(node.id))\n\n\treturn true\n}\n\n// Allows spaces in collection names (e.g. `:Blog Posts`) unlike the shared router regex which\n// restricts to word characters to keep URL variable names URL-safe.\nconst collectionPathVariableRegExp = /:([a-z][^/]*)/giu\n\nfunction applyCollectionFromPath(tree: CanvasTree, webPage: LoadedWebPageNode, pagePath: string): NodeID | undefined {\n\tconst matches = Array.from(\n\t\t// Note: this is a global regex but `matchAll` ignores `lastIndex`\n\t\tpagePath.matchAll(collectionPathVariableRegExp),\n\t)\n\tif (matches.length === 0) return\n\tassert(\n\t\tisSingleElementArray(matches),\n\t\t\"Creating a CMS detail page nested inside another CMS detail page is not supported\",\n\t)\n\tconst collectionName = matches[0][1]\n\n\tconst contentManagementNode = getContentManagementNode(tree)?.loaded\n\tconst collection = contentManagementNode?.children.find(\n\t\tc => c.resolveValue(\"name\")?.toLowerCase() === collectionName?.toLowerCase(),\n\t)\n\tassert(collection, `Collection \"${collectionName}\" not found`)\n\n\tconst identifier = localModuleIdentifierForStableName(ModuleType.Collection, collection.id, \"default\").value\n\n\tconst existingDetailPage = getWebPageNodesWithCollection(tree).find(page => page.dataIdentifier === identifier)\n\tassert(!existingDetailPage, `A detail page for collection \"${collectionName}\" already exists`)\n\n\twebPage.set({ dataIdentifier: identifier })\n\n\treturn collection.id\n}\n\nfunction applyGroundNodePositionIfNeeded(tree: CanvasTree, parent: MaybeCanvasNode, node: CanvasNode) {\n\tif (!isScopeNode(parent) || !parent.isLoaded()) return\n\tif (!isPinnable(node) || !withSize(node)) return\n\n\t// If the agent explicitly set both left and top, respect those values.\n\tif (node.left !== null && node.top !== null) return\n\n\t// Fill in any null pin with a non-overlapping position.\n\tconst rect = suggestedRect(tree, parent, { width: node.width, height: node.height })\n\tif (node.left === null) node.set({ left: rect.x })\n\tif (node.top === null) node.set({ top: rect.y })\n}\n", "import { delay, emptyArray, getLogger } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { RejectedCommandError } from \"../RejectedCommandError.ts\"\nimport { CircularParentResolutionError, type UninsertedNode } from \"../TreeResolver.ts\"\nimport { CommandType } from \"../dsl.ts\"\nimport type { LintProblem } from \"../linting/lib/TreeLinter.ts\"\nimport { commandReference } from \"../prompt/utils.ts\"\n\nconst log = getLogger(\"ai:agents:issues\")\nconst TEXT_WORD_BREAK_TIMEOUT_MS = 5_000\n\ninterface IssueMetadata {\n\tnodeIds?: readonly NodeID[]\n}\n\ninterface ErrorIssue {\n\terror: Error\n\tnodeIds: Set<NodeID>\n}\n\ninterface WarningIssue {\n\twarnings: Record<string, string>\n\tnodeIds: Set<NodeID>\n}\n\nexport class AgentIssues {\n\tprivate errorsByRawCommand = new Map<string, ErrorIssue>()\n\tprivate warningsByRawCommand = new Map<string, WarningIssue>()\n\tprivate finalizedErrors: ErrorResult[] = []\n\n\terrorCount = 0\n\tparseErrorCount = 0\n\trejectedCommandCount = 0\n\twarningCount = 0\n\n\t/** Do not manually call this from traits; instead `throw`. */\n\terror(raw: string, error: Error, metadata?: IssueMetadata) {\n\t\tconst nodeIds = new Set<NodeID>(metadata?.nodeIds ? metadata?.nodeIds : undefined)\n\t\tthis.errorsByRawCommand.set(raw, { error, nodeIds })\n\t\tthis.errorCount++\n\n\t\tif (isParserError(error)) this.parseErrorCount++\n\t\tif (isRejectedCommandError(error)) this.rejectedCommandCount++\n\t}\n\n\t/** Do not manually call this from traits; instead `return warning(...)`. @see {@link traits/invalidValues.ts#warning} */\n\twarning(raw: string, warning: Record<string, string>, metadata?: IssueMetadata) {\n\t\tconst issue = this.warningsByRawCommand.get(raw) ?? { warnings: {}, nodeIds: new Set<NodeID>() }\n\n\t\tObject.assign(issue.warnings, warning)\n\t\tfor (const nodeId of metadata?.nodeIds ?? emptyArray()) {\n\t\t\tissue.nodeIds.add(nodeId)\n\t\t}\n\n\t\tthis.warningsByRawCommand.set(raw, issue)\n\t\tthis.warningCount += Object.keys(warning).length\n\t}\n\n\tpeekByRawCommand(raw: string): CommandDiagnostics {\n\t\tconst error = this.errorsByRawCommand.get(raw)?.error\n\t\tconst warnings = this.warningsByRawCommand.get(raw)?.warnings\n\t\treturn {\n\t\t\tstatement: normalizeCommandStatement(raw),\n\t\t\terror: error?.message,\n\t\t\twarnings,\n\t\t}\n\t}\n\n\t/** Materialize derived diagnostics (e.g. uninserted nodes) so they are included in the next consume call. Safe to call multiple times \u2014 replaces rather than appends. */\n\tfinalizeStep(uninsertedNodes: readonly UninsertedNode[]) {\n\t\tthis.finalizedErrors = createUninsertedNodeErrors(uninsertedNodes)\n\t}\n\n\tconsumeErrors(): ConsumedErrors {\n\t\tconst consumed = serializeErrors(this.errorsByRawCommand, this.finalizedErrors)\n\t\tthis.errorsByRawCommand.clear()\n\t\tthis.finalizedErrors = []\n\t\treturn consumed\n\t}\n\n\tconsumeWarnings(): ConsumedWarnings {\n\t\tconst consumed = serializeWarnings(this.warningsByRawCommand)\n\t\tthis.warningsByRawCommand.clear()\n\t\treturn consumed\n\t}\n\n\tasync consumeUncategorizedWarnings(\n\t\tchangedNodes: readonly CanvasNode[],\n\t\tengine: VekterEngine,\n\t): Promise<UncategorizedWarning[] | undefined> {\n\t\tconst richTextNodeIds = getRichTextNodeIdsFromChangedNodes(changedNodes)\n\t\tif (richTextNodeIds.length === 0) return\n\n\t\tconst renderer = engine.canvasSandbox?.sandbox.renderer\n\t\tif (!renderer) return\n\n\t\ttry {\n\t\t\tconst brokenNodeIds = await Promise.race([\n\t\t\t\trenderer.checkTextWordBreak(richTextNodeIds, engine.scheduler.update),\n\t\t\t\tdelay(TEXT_WORD_BREAK_TIMEOUT_MS).then(() => {\n\t\t\t\t\tthrow new Error(\"Timed out checking rich text word breaks during agent review_changes\")\n\t\t\t\t}),\n\t\t\t])\n\t\t\treturn brokenNodeIds?.map(nodeId => {\n\t\t\t\treturn {\n\t\t\t\t\tlevel: \"warning\",\n\t\t\t\t\tnodeIds: [nodeId],\n\t\t\t\t\tmessage: `${ClassDiscriminator.RichTextNode} with id \"${nodeId}\" has mid-word wrapping`,\n\t\t\t\t}\n\t\t\t})\n\t\t} catch (error) {\n\t\t\tif (error instanceof Error) {\n\t\t\t\tlog.warn(error.message)\n\t\t\t} else {\n\t\t\t\tlog.warn(\"Unknown error checking rich text word breaks during agent review_changes\")\n\t\t\t}\n\t\t}\n\t}\n\n\tcompleteTurn() {\n\t\tthis.errorsByRawCommand.clear()\n\t\tthis.warningsByRawCommand.clear()\n\t\tthis.finalizedErrors = []\n\t\tthis.errorCount = 0\n\t\tthis.parseErrorCount = 0\n\t\tthis.rejectedCommandCount = 0\n\t\tthis.warningCount = 0\n\t}\n}\n\nfunction getRichTextNodeIdsFromChangedNodes(changedNodes: readonly CanvasNode[]): NodeID[] {\n\tconst richTextNodeIds = new Set<NodeID>()\n\tfor (const changedNode of changedNodes) {\n\t\tfor (const node of changedNode.walk()) {\n\t\t\tif (isRichTextNode(node)) richTextNodeIds.add(node.id)\n\t\t}\n\t}\n\treturn [...richTextNodeIds]\n}\n\nexport interface CommandDiagnostics {\n\tstatement: string\n\terror?: string\n\twarnings?: Record<string, string>\n}\n\nexport interface ErrorResult {\n\tstatement: string\n\terror: string\n}\ninterface ConsumedErrors {\n\terrors: ErrorResult[]\n\taffectedNodeIds: Set<NodeID>\n}\nexport type ProjectUpdateErrorResult = ErrorResult | LintProblem\n\ntype WarningResult = Record<string, Record<string, string>>\n\ninterface ConsumedWarnings {\n\twarnings: WarningResult\n\taffectedNodeIds: Set<NodeID>\n}\n\nexport type UncategorizedWarning = LintProblem\nexport type ProjectUpdateWarningResult = {\n\tuncategorized?: readonly UncategorizedWarning[]\n} & Partial<Record<`${string};`, Record<string, string>>>\n\nexport class DSLParserError extends Error {\n\tconstructor(\n\t\treadonly raw: string,\n\t\tcause: Error,\n\t) {\n\t\tsuper(cause.message, { cause })\n\t\tthis.name = \"DSLParserError\"\n\t}\n}\n\nfunction createUninsertedNodeErrors(uninsertedNodes: readonly UninsertedNode[]): ErrorResult[] {\n\tconst errors: ErrorResult[] = []\n\tconst uninsertedLlmIds = new Set(uninsertedNodes.map(node => node.llmId))\n\n\tfor (const { llmId, attributes } of uninsertedNodes) {\n\t\tconst statement = `${CommandType.Add}${attributes.node} ${llmId};`\n\t\tif (\n\t\t\tattributes.node === ClassDiscriminator.WebPageNode ||\n\t\t\tattributes.node === ClassDiscriminator.LayoutTemplateNode\n\t\t) {\n\t\t\tconst primaryBreakpoint = uninsertedNodes.find(\n\t\t\t\tother => other.attributes.parent === llmId && other.attributes.node === ClassDiscriminator.FrameNode,\n\t\t\t)\n\t\t\tconst scopeDescription = attributes.node === ClassDiscriminator.WebPageNode ? \"Web page\" : \"Layout template\"\n\t\t\tconst missingBreakpointError = `${scopeDescription} was added but never received its primary breakpoint. Add a ${commandReference(CommandType.Add, ClassDiscriminator.FrameNode)} child under \"${llmId}\".`\n\t\t\terrors.push({\n\t\t\t\tstatement,\n\t\t\t\terror: primaryBreakpoint\n\t\t\t\t\t? `${scopeDescription} has a primary breakpoint node, but it was never inserted. Emit ${commandReference(CommandType.Update)} for \"${primaryBreakpoint.llmId}\" after the ADD command.`\n\t\t\t\t\t: missingBreakpointError,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!isUndefined(attributes.parent) && uninsertedLlmIds.has(attributes.parent)) {\n\t\t\tcontinue\n\t\t}\n\n\t\terrors.push({\n\t\t\tstatement,\n\t\t\terror: `Node was added but never inserted. Emit ${commandReference(CommandType.Update)} for \"${llmId}\" after the ADD command.`,\n\t\t})\n\t}\n\n\treturn errors\n}\n\nfunction serializeErrors(errorsByRawCommand: Map<string, ErrorIssue>, finalizedErrors: ErrorResult[]): ConsumedErrors {\n\tconst errors: ErrorResult[] = []\n\tconst affectedNodeIds = new Set<NodeID>()\n\tfor (const [key, issue] of errorsByRawCommand) {\n\t\terrors.push({\n\t\t\tstatement: key,\n\t\t\terror: issue.error.message,\n\t\t})\n\n\t\tfor (const nodeId of issue.nodeIds) {\n\t\t\taffectedNodeIds.add(nodeId)\n\t\t}\n\t}\n\terrors.push(...finalizedErrors)\n\n\treturn { errors, affectedNodeIds }\n}\n\nexport function normalizeCommandStatement(raw: string): string {\n\treturn raw.endsWith(\";\") ? raw : `${raw};`\n}\n\nfunction serializeWarnings(warningsByRawCommand: Map<string, WarningIssue>): ConsumedWarnings {\n\tconst warnings: WarningResult = {}\n\tconst affectedNodeIds = new Set<NodeID>()\n\tfor (const [raw, issue] of warningsByRawCommand) {\n\t\twarnings[normalizeCommandStatement(raw)] = issue.warnings\n\t\tfor (const nodeId of issue.nodeIds) {\n\t\t\taffectedNodeIds.add(nodeId)\n\t\t}\n\t}\n\n\treturn { warnings, affectedNodeIds }\n}\n\nexport function isRejectedCommandError(error: unknown): boolean {\n\treturn error instanceof RejectedCommandError || error instanceof CircularParentResolutionError\n}\n\nfunction isParserError(error: Error): boolean {\n\treturn error instanceof DSLParserError\n}\n", "import { assert, invertMap } from \"@framerjs/shared\"\nimport { createUnique } from \"code-generation/utils/BindingCollector.ts\"\nimport type { PrefixedControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { removeControlPropKeyPrefix, prefixControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport type { ControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { safeProperty } from \"utils/names.ts\"\nimport type { VectorSetDefinition } from \"./vectors.ts\"\n\ntype ControlName = string\ntype ControlKey = string\n\ninterface ControlDefinitionMappings {\n\tcontrolPropKeysByControlName: Map<ControlName, ControlKey>\n\tcontrolPropNamesByKeys: Map<ControlKey, ControlName>\n}\n\nexport interface BaseControlsDefinition<T> extends ControlDefinitionMappings {\n\tcontrols: Record<ControlName, T | undefined>\n}\n\ntype BaseProperties = Record<ControlKey, ControlDescription | undefined> | undefined\nexport interface ControlsHandle<TProperties extends BaseProperties = BaseProperties> {\n\tgetControlTitle: (unPrefixedControlKey: ControlKey) => ControlName | undefined\n\tgetControlKey: (controlTitle: PrefixedControlPropKey<ControlName>) => ControlKey | undefined\n\tproperties: () => TProperties\n}\n\nexport function getControlsHandle<TProperties extends BaseProperties = BaseProperties>(\n\tdefinition: ControlDefinitionMappings,\n\tproperties: TProperties,\n): ControlsHandle<TProperties> {\n\treturn {\n\t\tgetControlTitle: (unprefixedControlKey: ControlKey) => {\n\t\t\treturn definition.controlPropNamesByKeys.get(unprefixedControlKey)\n\t\t},\n\t\tgetControlKey: (controlTitle: PrefixedControlPropKey<ControlName>) => {\n\t\t\tconst title = removeControlPropKeyPrefix(controlTitle)\n\t\t\t// First try to look up by name\n\t\t\tconst keyFromName = definition.controlPropKeysByControlName.get(title)\n\t\t\tif (keyFromName) return keyFromName\n\t\t\t// If not found, check if it's already a valid key (e.g., a variableId)\n\t\t\tif (definition.controlPropNamesByKeys.has(title)) return title\n\t\t\treturn undefined\n\t\t},\n\t\tproperties: () => properties,\n\t}\n}\n\nexport function getVectorControlsHandle(definition: VectorSetDefinition): ControlsHandle {\n\treturn getControlsHandle(definition, definition.properties)\n}\n\n/**\n * Builds control definitions from a record of controls, normalizing names and creating\n * bidirectional mappings between control names and prop keys.\n */\nexport async function buildControlDefinitions<T, C extends Pick<ControlDescription<unknown>, \"title\">>(\n\tproperties: Record<string, C | undefined>,\n\tcreateControl: (\n\t\tprefixedTitle: PrefixedControlPropKey<ControlName>,\n\t\tcontrol: C,\n\t\tcontrolKey: string,\n\t) => Promise<T | undefined>,\n): Promise<BaseControlsDefinition<T> & { properties: Record<string, C | undefined> }> {\n\tconst controls: Record<PrefixedControlPropKey<ControlName>, T | undefined> = {}\n\tconst { controlPropKeysByControlName, controlPropNamesByKeys } = buildControlDefinitionMappings(properties)\n\n\tfor (const [controlTitle, controlKey] of controlPropKeysByControlName) {\n\t\tconst control = properties[controlKey]\n\t\tif (!control) continue\n\t\tconst prefixedTitle = prefixControlPropKey(controlTitle)\n\t\tcontrols[prefixedTitle] = await createControl(prefixedTitle, control, controlKey)\n\t}\n\n\treturn {\n\t\tcontrolPropKeysByControlName,\n\t\tcontrolPropNamesByKeys,\n\t\tcontrols,\n\t\tproperties,\n\t}\n}\n\nexport function buildControlDefinitionMappings<C extends Pick<ControlDescription<unknown>, \"title\">>(\n\tproperties: Record<string, C | undefined>,\n) {\n\tconst controlTitles = new Set<string>()\n\tconst controlPropKeysByControlName = new Map<ControlName, ControlKey>()\n\tfor (const controlKey in properties) {\n\t\tconst control = properties[controlKey]\n\t\tif (!control) continue\n\n\t\t// If the control has no title, use the control key as the title. We have seen it happen for instance in the\n\t\t// code block component. Not having a title is valid, but we need to handle it gracefully.\n\t\tconst controlTitle = createUniqueControlName(control.title, controlKey, controlTitles)\n\t\tcontrolPropKeysByControlName.set(controlTitle, controlKey)\n\t}\n\treturn {\n\t\tcontrolPropKeysByControlName,\n\t\tcontrolPropNamesByKeys: invertMap(controlPropKeysByControlName),\n\t}\n}\n\nexport function createUniqueControlName(\n\ttitle: string | undefined,\n\tfallbackName: string,\n\tusedControlNames: Set<string>,\n): ControlName {\n\tconst fallbackControlName = safeProperty(fallbackName)\n\tassert(fallbackControlName, \"Default control name must normalize to a valid property\")\n\n\treturn createUnique(safeProperty(title?.trim()) ?? fallbackControlName, usedControlNames)\n}\n", "import type { ControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { filterComponentPresetControls } from \"document/models/controlProps/filterComponentPresetControls.ts\"\nimport { getControlProps as getControlPropsFromRaw } from \"document/models/controlProps/getControlProps.ts\"\nimport type { ControlDescription } from \"library/index.ts\"\nimport { verifyPropertyControls } from \"../../../../../../../runtime/src/sandbox/componentLoader/verifyPropertyControls.ts\"\nimport type { AgentContext } from \"../AgentContext.ts\"\nimport { buildControlDefinitionMappings, getControlsHandle, type ControlsHandle } from \"../controlDefinitions.ts\"\nimport type { VirtualRichTextTextComponentInstance } from \"./document.ts\"\n\ninterface TextComponentControlContext {\n\tcomponents: AgentContext[\"components\"]\n\tcomponentLoader: AgentContext[\"componentLoader\"]\n}\n\ninterface TextComponentInstanceControlResolver {\n\tcontrols: ControlsHandle\n\tpropertyControls: Record<string, ControlDescription | undefined>\n\tgetControlProps: () => Readonly<Record<string, ControlProp>> | undefined\n\tsetControlProp: (key: string, controlProp: ControlProp) => void\n}\n\nexport function getTextComponentInstanceControlResolver(\n\tnode: VirtualRichTextTextComponentInstance,\n\tctx: TextComponentControlContext,\n): TextComponentInstanceControlResolver | undefined {\n\tconst controls = ctx.components.forIdentifier(node.identifier, { deferUntilLoaded: true })?.controls\n\tif (!controls) return\n\n\tconst component = ctx.components.getReactComponentForIdentifier(node.identifier, ctx.componentLoader)\n\n\t// TextComponentInstance controls should only include non-preset controls. Preset controls are applied via ComponentPresetNode.\n\tconst propertyControls = component\n\t\t? filterComponentPresetControls(component, \"onlyNonPresets\")\n\t\t: controls.properties()\n\tif (!propertyControls) return\n\n\tconst nonPresetControls = getControlsHandle(buildControlDefinitionMappings(propertyControls), propertyControls)\n\n\tconst verifiedPropertyControls = verifyPropertyControls(propertyControls)\n\n\treturn {\n\t\tcontrols: nonPresetControls,\n\t\tpropertyControls,\n\t\tgetControlProps: () => getControlPropsFromRaw(verifiedPropertyControls, node.props),\n\t\tsetControlProp: (key, value) => {\n\t\t\tnode.props = { ...node.props, [key]: value }\n\t\t},\n\t}\n}\n", "import type { VerifiedPropertyControls } from \"@framerjs/framer-runtime\"\nimport { assert, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport type {\n\tAnySmartComponentNode,\n\tCanvasNode,\n\tCodeComponentNode,\n\tCollectionItemNode,\n\tCollectionNode,\n\tNodeID,\n\tRichTextNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisCodeComponentNode,\n\tisRichTextNode,\n\tisSmartComponentNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tisRichTextVariableDefinition,\n\ttype VariableDefinition,\n\ttype VariableOrDivider,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { CollectionControlProp } from \"document/models/controlProps/CollectionControlProp.ts\"\nimport {\n\tremoveControlPropKeyPrefix,\n\tisPrefixedControlPropKey,\n\tprefixControlPropKey,\n} from \"document/models/controlProps/controlPropKey.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { cmsSchemaParams, makeSchema, smartComponentVariableSchemaParams } from \"prosemirror/schema/index.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { ComponentNodeClass, TextComponentInstanceClass } from \"../../dsl.ts\"\nimport type { AgentContext } from \"../AgentContext.ts\"\nimport { isVariableReferenceHandle } from \"../dynamicValues.ts\"\nimport {\n\tcreateVirtualTextCapabilities,\n\tisVirtualRichTextTextComponentInstance,\n\tisVirtualNodeId,\n\ttype RichTextTargetHandle,\n\ttype RichTextTarget,\n\ttype VirtualRichTextTextComponentInstance,\n} from \"./document.ts\"\nimport { getTextComponentInstanceControlResolver } from \"./textComponentControls.ts\"\n\nconst targetSeparator = \"/\"\n\ntype RichTextHandleResolverContext = Pick<AgentContext, \"collections\" | \"components\" | \"componentLoader\">\n\nexport function createRichTextTarget(nodeId: NodeID, controlKey?: string): RichTextTarget {\n\tif (controlKey) return `${nodeId}${targetSeparator}${controlKey}` as const\n\n\treturn nodeId\n}\n\nexport function parseRichTextTarget(target: RichTextTarget): { nodeId: NodeID; targetKey?: string } {\n\tconst separatorIndex = target.indexOf(\"/\")\n\tif (separatorIndex === -1) return { nodeId: target }\n\n\treturn { nodeId: target.slice(0, separatorIndex), targetKey: target.slice(separatorIndex + 1) }\n}\n\nexport function isCompositeRichTextTarget(target: string): boolean {\n\treturn target.includes(targetSeparator)\n}\n\nexport function createRichTextNodeTargetHandle(node: RichTextNode): RichTextTargetHandle {\n\tconst schema = node.getProseMirrorSchema()\n\n\treturn {\n\t\tnodeId: node.id,\n\t\ttarget: node.id,\n\t\tcapabilities: createVirtualTextCapabilities(schema),\n\t\tinlineCodeStylePreset: node.stylePresetInlineCode,\n\t\tschema,\n\t\treadHTML: () => {\n\t\t\t// When a node is bound to a RichText variable we return undefined.\n\t\t\t// Undefined values means the RichTextDocument won't be hydrated.\n\t\t\t// Making this distinction is important: a CMS RichText bound document is controlled\n\t\t\t// fully from the outside. It should never result in a document that can be edited.\n\t\t\tif (node.htmlContent) return\n\n\t\t\treturn node.getHTMLContent()\n\t\t},\n\t\twriteHTML: (html: string) => {\n\t\t\tnode.set({ html })\n\t\t},\n\t}\n}\n\nfunction assertIsRichTextControlType<T extends VariableDefinition | CollectionControlProp>(\n\tcontrol: T | undefined,\n): asserts control is Extract<T, { type: ControlType.RichText }> {\n\tassert(control?.type === ControlType.RichText, `Control type ${control?.type} is not a RichText control`)\n}\n\nexport function createCollectionItemControlPropHandle(\n\tnode: CollectionItemNode,\n\tcontrolKey: string,\n): RichTextTargetHandle {\n\tconst assertCanWriteRichText = () => {\n\t\tconst currentNode = node.draftOrCurrent()\n\t\tconst controlProp = currentNode.getControlProps()?.[controlKey]\n\n\t\tif (controlProp) {\n\t\t\tassertIsRichTextControlType(controlProp)\n\t\t\treturn\n\t\t}\n\n\t\tconst collectionNode = getParentCollectionNode(currentNode)\n\t\tassert(\n\t\t\tcollectionNode,\n\t\t\t`${ClassDiscriminator.CollectionItemNode} ${node.id} must belong to a ${ClassDiscriminator.CollectionNode}`,\n\t\t)\n\n\t\tconst variable = collectionNode.draftOrCurrent().getVariable(controlKey)\n\t\tassertIsRichTextControlType(variable)\n\t}\n\n\tconst schema = makeSchema(cmsSchemaParams)\n\n\treturn {\n\t\tnodeId: node.id,\n\t\ttarget: createRichTextTarget(node.id, controlKey),\n\t\tcapabilities: createVirtualTextCapabilities(schema),\n\t\tschema,\n\t\treadHTML: () => {\n\t\t\tconst currentNode = node.draftOrCurrent()\n\t\t\tconst controlProp = currentNode.getControlProps()?.[controlKey]\n\t\t\tif (!controlProp) return\n\n\t\t\tassertIsRichTextControlType(controlProp)\n\t\t\treturn isString(controlProp?.value) ? controlProp.value : undefined\n\t\t},\n\t\twriteHTML: (html: string) => {\n\t\t\tassertCanWriteRichText()\n\t\t\tnode.setControlProp(controlKey, { type: ControlType.RichText, value: html })\n\t\t},\n\t}\n}\n\nexport function createComponentControlPropHandle(\n\tnode: CodeComponentNode,\n\tcontrolKey: string,\n\tproperties: VerifiedPropertyControls,\n): RichTextTargetHandle {\n\tconst schema = makeSchema(smartComponentVariableSchemaParams)\n\n\tconst controlProp = node.getControlProps(properties)?.[controlKey]\n\tassert(\n\t\tcontrolProp && controlProp.type === ControlType.RichText,\n\t\t`RichText control prop with key ${controlKey} does not exist on ${ComponentNodeClass} ${node.id}`,\n\t)\n\n\treturn {\n\t\tnodeId: node.id,\n\t\ttarget: createRichTextTarget(node.id, controlKey),\n\t\tcapabilities: createVirtualTextCapabilities(schema),\n\t\tschema,\n\t\treadHTML: () => (isString(controlProp?.value) ? controlProp.value : undefined),\n\t\twriteHTML: (html: string) => {\n\t\t\tnode.setControlProp(controlKey, { type: ControlType.RichText, value: html })\n\t\t},\n\t}\n}\n\nexport function createTextComponentInstanceControlPropHandle(\n\tnode: VirtualRichTextTextComponentInstance,\n\tcontrolKey: string,\n\ttarget: RichTextTarget,\n\tctx: AgentContext,\n): RichTextTargetHandle {\n\tconst schema = makeSchema(smartComponentVariableSchemaParams)\n\tconst resolver = getTextComponentInstanceControlResolver(node, ctx)\n\tassert(resolver, `Missing property controls for ${node.identifier}`)\n\n\tconst controlDefinition = resolver.propertyControls[controlKey]\n\tassert(\n\t\tcontrolDefinition?.type === ControlType.RichText,\n\t\t`RichText control prop with key ${controlKey} does not exist on ${TextComponentInstanceClass} ${node.id}`,\n\t)\n\n\tconst ownerTarget = ctx.virtualText.getTarget(node)\n\tconst ownerHandle = resolveRichTextTargetHandle(ownerTarget, ctx)\n\n\treturn {\n\t\tnodeId: ownerHandle?.nodeId ?? ctx.virtualText.getTargetNodeId(node),\n\t\townerTarget,\n\t\ttarget,\n\t\tcapabilities: createVirtualTextCapabilities(schema),\n\t\tschema,\n\t\treadHTML: () => {\n\t\t\tconst controlProp = resolver.getControlProps()?.[controlKey]\n\t\t\tif (!controlProp) return\n\n\t\t\tassert(\n\t\t\t\tcontrolProp.type === ControlType.RichText,\n\t\t\t\t`Control prop with key ${controlKey} is not a RichText control on ${TextComponentInstanceClass} ${node.id}`,\n\t\t\t)\n\t\t\treturn isString(controlProp.value) ? controlProp.value : undefined\n\t\t},\n\t\twriteHTML: (html: string) => {\n\t\t\tresolver.setControlProp(controlKey, { type: ControlType.RichText, value: html })\n\t\t},\n\t}\n}\n\nfunction updateRichTextVariableInitialValue<T extends VariableOrDivider>(\n\tvariables: readonly T[],\n\tvariableId: string,\n\tinitialValue: string,\n): readonly T[] {\n\treturn variables.map(v => {\n\t\tif (v.id !== variableId) return v\n\t\tif (!isRichTextVariableDefinition(v)) return v\n\n\t\treturn { ...v, initialValue }\n\t})\n}\n\nexport function createSmartComponentVariableHandle(\n\tnode: AnySmartComponentNode,\n\tvariableId: string,\n): RichTextTargetHandle {\n\tconst schema = makeSchema(smartComponentVariableSchemaParams)\n\tconst variable = node.variables.find(v => v.id === variableId)\n\tassert(variable && variable.type === ControlType.RichText, `Variable ${variableId} is not a RichText variable`)\n\n\treturn {\n\t\tnodeId: node.id,\n\t\ttarget: createRichTextTarget(node.id, variableId),\n\t\tcapabilities: createVirtualTextCapabilities(schema),\n\t\tschema,\n\t\treadHTML: () => variable.initialValue,\n\t\twriteHTML: (html: string) => {\n\t\t\tnode.set({ variables: updateRichTextVariableInitialValue(node.variables, variableId, html) })\n\t\t},\n\t}\n}\n\nexport function createCollectionNodeVariableHandle(node: CollectionNode, variableId: string): RichTextTargetHandle {\n\tconst schema = makeSchema(cmsSchemaParams)\n\tconst variable = node.variables.find(v => v.id === variableId)\n\tassert(variable && variable.type === ControlType.RichText, `Variable ${variableId} is not a RichText variable`)\n\n\treturn {\n\t\tnodeId: node.id,\n\t\ttarget: createRichTextTarget(node.id, variableId),\n\t\tcapabilities: createVirtualTextCapabilities(schema),\n\t\tschema,\n\t\treadHTML: () => variable.initialValue,\n\t\twriteHTML: (html: string) => {\n\t\t\tnode.set({ variables: updateRichTextVariableInitialValue(node.variables, variableId, html) })\n\t\t},\n\t}\n}\n\nfunction normalizeRequestedTargetKey(targetKey: string): string {\n\treturn isPrefixedControlPropKey(targetKey) ? removeControlPropKeyPrefix(targetKey) : targetKey\n}\n\nfunction resolveCodeComponentTargetKey(\n\tnode: CodeComponentNode,\n\ttargetKey: string,\n\tctx: RichTextHandleResolverContext,\n): string | undefined {\n\tconst requestedKey = normalizeRequestedTargetKey(targetKey)\n\tif (!isModuleExportIdentifier(node.codeComponentIdentifier)) return\n\tconst controlTitle = prefixControlPropKey(requestedKey)\n\n\tconst resolvedKey = ctx.components.forIdentifier(node.codeComponentIdentifier)?.controls.getControlKey(controlTitle)\n\tif (resolvedKey) return resolvedKey\n\n\tconst properties = ctx.components.getReactComponentForIdentifier(\n\t\tnode.codeComponentIdentifier,\n\t\tctx.componentLoader,\n\t)?.properties\n\tif (properties?.[requestedKey]?.type === ControlType.RichText) return requestedKey\n}\n\nfunction resolveSmartComponentVariableKey(\n\tnode: AnySmartComponentNode,\n\ttargetKey: string,\n\tctx: RichTextHandleResolverContext,\n): string | undefined {\n\tconst requestedKey = normalizeRequestedTargetKey(targetKey)\n\tif (node.draftOrCurrent().hasVariable(requestedKey)) return requestedKey\n\tconst controlTitle = prefixControlPropKey(requestedKey)\n\n\treturn ctx.components.forIdentifier(node.instanceIdentifier)?.controls.getControlKey(controlTitle)\n}\n\nfunction getParentCollectionNode(node: CollectionItemNode): CollectionNode | undefined {\n\tconst parent = node.tree()?.getParent(node.id)\n\tif (!parent || !isCollectionNode(parent)) return\n\n\treturn parent\n}\n\nfunction resolveCollectionItemTargetKey(\n\tnode: CollectionItemNode,\n\ttargetKey: string,\n\tctx: RichTextHandleResolverContext,\n): string | undefined {\n\tconst requestedKey = normalizeRequestedTargetKey(targetKey)\n\tif (node.draftOrCurrent().getControlProp(requestedKey)?.type === ControlType.RichText) return requestedKey\n\tconst collectionNode = getParentCollectionNode(node)\n\tif (!collectionNode) return\n\n\tconst collectionVariable = collectionNode.draftOrCurrent().getVariable(requestedKey)\n\tif (collectionVariable?.type === ControlType.RichText) return requestedKey\n\n\tconst controlTitle = prefixControlPropKey(requestedKey)\n\tconst resolvedKey = ctx.collections.forId(collectionNode.id)?.controls.getControlKey(controlTitle)\n\tif (!resolvedKey) return\n\n\tconst resolvedVariable = collectionNode.draftOrCurrent().getVariable(resolvedKey)\n\tif (resolvedVariable?.type === ControlType.RichText) return resolvedKey\n}\n\nfunction resolveCompositeTargetHandle(\n\tnode: CanvasNode,\n\ttargetKey: string,\n\tctx: RichTextHandleResolverContext,\n): RichTextTargetHandle | undefined {\n\tif (isCollectionItemNode(node)) {\n\t\tconst resolvedKey = resolveCollectionItemTargetKey(node, targetKey, ctx)\n\t\tif (!resolvedKey) return\n\t\treturn createCollectionItemControlPropHandle(node, resolvedKey)\n\t}\n\n\tif (isCodeComponentNode(node)) {\n\t\tconst resolvedKey = resolveCodeComponentTargetKey(node, targetKey, ctx)\n\t\tif (!resolvedKey) return\n\t\tif (!isModuleExportIdentifier(node.codeComponentIdentifier)) return\n\n\t\tconst properties = ctx.components.getReactComponentForIdentifier(\n\t\t\tnode.codeComponentIdentifier,\n\t\t\tctx.componentLoader,\n\t\t)?.properties\n\t\tif (!properties) return\n\t\treturn createComponentControlPropHandle(node, resolvedKey, properties)\n\t}\n\n\tif (isSmartComponentNode(node)) {\n\t\tconst resolvedKey = resolveSmartComponentVariableKey(node, targetKey, ctx)\n\t\tif (!resolvedKey) return\n\n\t\treturn createSmartComponentVariableHandle(node, resolvedKey)\n\t}\n}\n\nfunction resolveTextComponentInstanceTargetKey(\n\tnode: VirtualRichTextTextComponentInstance,\n\ttargetKey: string,\n\tctx: AgentContext,\n): string | undefined {\n\tconst resolver = getTextComponentInstanceControlResolver(node, ctx)\n\tif (!resolver) return\n\n\tconst requestedKey = normalizeRequestedTargetKey(targetKey)\n\tconst controlTitle = prefixControlPropKey(requestedKey)\n\tconst resolvedKey = resolver.controls.getControlKey(controlTitle)\n\tif (resolvedKey) return resolvedKey\n\n\tconst propertyControl = resolver.propertyControls[requestedKey]\n\tif (propertyControl?.type === ControlType.RichText) return requestedKey\n}\n\nfunction resolveTextComponentInstanceTargetHandle(\n\ttarget: RichTextTarget,\n\tctx: AgentContext,\n): RichTextTargetHandle | undefined {\n\tif (isVirtualNodeId(target)) return\n\n\tconst { nodeId, targetKey } = parseRichTextTarget(target)\n\tif (!targetKey) return\n\n\tconst node = ctx.virtualText.resolve(nodeId)\n\tif (!isVirtualRichTextTextComponentInstance(node)) return\n\n\tconst resolvedKey = resolveTextComponentInstanceTargetKey(node, targetKey, ctx)\n\tif (!resolvedKey) return\n\n\treturn createTextComponentInstanceControlPropHandle(node, resolvedKey, target, ctx)\n}\n\n/**\n * Resolves a RichTextTargetHandle from a RichTextTarget string.\n * For plain NodeIDs, the node must be a RichTextNode.\n * For composite targets (nodeId/controlKey), the node must be a CodeComponentNode, CollectionItemNode,\n * SmartComponentNode (variable)\n */\nexport function resolveRichTextTargetHandle(\n\ttarget: RichTextTarget,\n\tctx: AgentContext,\n): RichTextTargetHandle | undefined {\n\tconst textComponentInstanceHandle = resolveTextComponentInstanceTargetHandle(target, ctx)\n\tif (textComponentInstanceHandle) return textComponentInstanceHandle\n\n\tconst { nodeId, targetKey } = parseRichTextTarget(target)\n\n\tconst node = ctx.treeResolver.get(nodeId) ?? ctx.treeStore.tree.get(nodeId)\n\n\tif (!node) {\n\t\tif (targetKey) return\n\n\t\t// The agent may output a plain variable ID as the parent (e.g. parent=\"myVar\" instead of\n\t\t// parent=\"scopeId/myVar\"). Fall back to resolving via the variables context which knows the\n\t\t// scope for each variable. For variables this works - because they have unique IDs, as\n\t\t// opposed to control keys which need the parent ID to be unique\n\t\tconst resolved = ctx.dynamicValues.getVariableReferenceHandleByVariableId(target)\n\t\tif (isVariableReferenceHandle(resolved)) {\n\t\t\tconst scopeNode = ctx.treeResolver.get(resolved.scopeId) ?? ctx.treeStore.tree.get(resolved.scopeId)\n\t\t\tif (!scopeNode) return\n\t\t\tif (isSmartComponentNode(scopeNode)) return createSmartComponentVariableHandle(scopeNode, resolved.variable.id)\n\t\t}\n\n\t\treturn\n\t}\n\n\tif (targetKey) {\n\t\treturn resolveCompositeTargetHandle(node, targetKey, ctx)\n\t}\n\n\tif (!isRichTextNode(node)) return\n\treturn createRichTextNodeTargetHandle(node)\n}\n\n/**\n * Resolves a RichTextTargetHandle from a known node and a RichTextTarget.\n * Used when the node has already been resolved (e.g. after tree.current()).\n */\nexport function resolveRichTextTargetHandleFromNode(\n\tnode: CanvasNode,\n\ttarget: RichTextTarget,\n\tctx: RichTextHandleResolverContext,\n): RichTextTargetHandle | undefined {\n\tif (!isCompositeRichTextTarget(target)) {\n\t\tif (!isRichTextNode(node)) return\n\t\treturn createRichTextNodeTargetHandle(node)\n\t}\n\n\tconst { targetKey } = parseRichTextTarget(target)\n\tif (!targetKey) return\n\n\treturn resolveCompositeTargetHandle(node, targetKey, ctx)\n}\n", "import { assertNever, getLogger } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasTextFit } from \"document/models/CanvasTree/traits/WithTextFit.ts\"\nimport {\n\tgetRichTextNodesRequiringTextFitUpdates,\n\tupdateTextFitViewBox,\n} from \"document/models/CanvasTree/traits/utils/textFitHelpers.ts\"\nimport type { CodeGenerationStore } from \"document/stores/CodeGenerationStore.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { isVirtualRichTextNode, type VirtualRichTextNode } from \"../context/richtext/document.ts\"\nimport { CommandType, type Command, isAddVariableCommandAttributes } from \"../dsl.ts\"\nimport type {\n\tDSLAttributes,\n\tTraitDefinition,\n\tTraitFromAttributesResult,\n\tVirtualNodeTraitDefinition,\n} from \"../traits/types.ts\"\nimport type { AgentContext } from \"./AgentContext.ts\"\nimport { DeferTraitError } from \"./DeferTraitError.ts\"\nimport { isVariableReferenceHandle, type DynamicValues } from \"./dynamicValues.ts\"\nimport { normalizeCommandStatement } from \"./issues.ts\"\nimport { resolveRichTextTargetHandle } from \"./richtext/targets.ts\"\n\ninterface DeferredTraitUpdate {\n\tnode: CanvasNode | VirtualRichTextNode\n\ttrait: TraitDefinition<object, [], CanvasNode | VirtualRichTextNode>\n\tattributes: DSLAttributes\n\trawDsl: string\n\tcause: string\n\t/** Whether this deferral has been reported to the model via `getPendingDeferredTraits`. */\n\tseen: boolean\n}\n\nexport interface DeferredTraitReport {\n\tcommand: string\n\tcause: string\n\tnodeId?: NodeID\n}\n\nconst log = getLogger(\"ai:agents:deferred\")\n\n/**\n * Manages deferred operations during command processing.\n *\n * Handles three types of deferred operations:\n *\n * 1. **Trait updates** - Some traits can't be applied immediately because they depend on state that\n *    doesn't exist yet (e.g., setting auto-size before children are added). These are collected and\n *    retried before each command until successful.\n *\n * 2. **Code generation** - When creating/modifying components, code gen needs to run. Code gen is\n *    debounced while a scope is being modified: when a command targets a different scope, pending\n *    code gen for the previous scope is flushed. Any remaining pending code gen is flushed at end\n *    of stream.\n *\n * 3. **Text fit re-measurement** - Rich text nodes with text fit enabled need their view box\n *    re-measured after any property change that could affect text layout. Node IDs are collected\n *    during trait application and flushed in a batch at the end of each step and at end of stream.\n */\nexport class DeferredOps {\n\t// Trait updates that need retry\n\tprivate traitUpdates: DeferredTraitUpdate[] = []\n\n\tprivate blockingPromises = new Set<Promise<unknown>>()\n\n\tprivate previousScopeIds: Set<NodeID> = new Set()\n\n\tprivate textFitNodeIds: Set<NodeID> = new Set()\n\n\tconstructor(\n\t\tprivate readonly codeGenerationStore?: CodeGenerationStore,\n\t\tprivate readonly schedule: (fn: VoidFunction) => Promise<void> = async fn => {\n\t\t\tfn()\n\t\t},\n\t) {}\n\n\t/** Queue a trait update to be retried later. */\n\tdeferTrait(\n\t\tnode: CanvasNode | VirtualRichTextNode,\n\t\ttrait: TraitDefinition<object, [], CanvasNode | VirtualRichTextNode>,\n\t\tattributes: DSLAttributes,\n\t\trawDsl: string,\n\t\tcause: string,\n\t): void {\n\t\tthis.traitUpdates.push({ node, trait, attributes, rawDsl, cause, seen: false })\n\t}\n\n\t/** Check if there are pending trait updates. */\n\thasPendingTraits(): boolean {\n\t\treturn this.traitUpdates.length > 0\n\t}\n\n\t/** Track async work that must complete before deferred traits can be retried. */\n\ttrackBlockingPromise<T>(promise: Promise<T>): Promise<T> {\n\t\tthis.blockingPromises.add(promise)\n\t\tvoid promise.finally(() => {\n\t\t\tthis.blockingPromises.delete(promise)\n\t\t})\n\t\treturn promise\n\t}\n\n\t/**\n\t * Defer a trait until an async resource becomes available. Starts the load (tracked as a\n\t * blocking promise so the retry waits for it) and throws `DeferTraitError` so the trait is\n\t * retried once loading completes.\n\t *\n\t * Use this for any \"resource not loaded yet\" case (icon sets, components, shaders, etc.) so\n\t * all deferred loads share the same blocking-promise + retry semantics.\n\t */\n\tdeferUntil(load: () => Promise<unknown>, message: string): never {\n\t\tvoid this.trackBlockingPromise(load())\n\t\tthrow new DeferTraitError(message)\n\t}\n\n\t/** Await any trait-blocking async work that is currently in flight. */\n\tasync flushBlockingPromises(): Promise<void> {\n\t\tif (this.blockingPromises.size === 0) return\n\t\tawait Promise.all(this.blockingPromises)\n\t}\n\n\t/** Flush blocking async work, then retry any deferred traits that are still pending. */\n\tasync flush(ctx: AgentContext): Promise<void> {\n\t\tawait this.flushBlockingPromises()\n\t\tif (!this.hasPendingTraits()) return\n\t\tawait this.schedule(() => this.applyTraits(ctx))\n\t}\n\n\t/** Mark a text fit node as needing view box re-measurement. */\n\tmarkTextFitDirty(nodeId: NodeID): void {\n\t\tthis.textFitNodeIds.add(nodeId)\n\t}\n\n\t/**\n\t * Re-measure all dirty text fit nodes. Captures the current set of dirty IDs and enqueues an\n\t * async update.\n\t */\n\tasync flushTextFitUpdates(engine: VekterEngine, schedule: (fn: VoidFunction) => Promise<void>): Promise<void> {\n\t\tif (this.textFitNodeIds.size === 0) return\n\n\t\tconst idsToUpdate = Array.from(this.textFitNodeIds)\n\t\tconst ids = getRichTextNodesRequiringTextFitUpdates(engine, idsToUpdate, false)\n\t\tthis.textFitNodeIds.clear()\n\n\t\tawait updateTextFitViewBox(engine, ids, undefined, schedule)\n\t}\n\n\t/**\n\t * Try to apply all deferred trait updates. Updates that still can't be applied will remain in\n\t * the queue for the next call. Called before each command so updates get retried as the\n\t * document state evolves.\n\t *\n\t * Non-deferral errors thrown by an individual trait retry are caught and attributed to the\n\t * originating DSL command (`update.rawDsl`), not to whatever command triggered the retry.\n\t * Without this, a trait deferred from command A that later throws while command B is being\n\t * applied would propagate out of `applyTraits`, reject the scheduler frame, and make B look\n\t * like the failing command even though its own `fn()` succeeded.\n\t */\n\tapplyTraits(ctx: AgentContext): void {\n\t\tconst currentUpdates = this.traitUpdates\n\t\tthis.traitUpdates = []\n\n\t\tfor (const update of currentUpdates) {\n\t\t\ttry {\n\t\t\t\tif (isVirtualRichTextNode(update.node)) {\n\t\t\t\t\tconst currentVirtualNode = ctx.virtualText.get(update.node.id)\n\t\t\t\t\tif (!currentVirtualNode) continue\n\n\t\t\t\t\tif (applyTrait(currentVirtualNode, update.trait, update.attributes, ctx, update.rawDsl)) {\n\t\t\t\t\t\tconst target = ctx.virtualText.getTarget(currentVirtualNode)\n\t\t\t\t\t\tconst handle = resolveRichTextTargetHandle(target, ctx)\n\t\t\t\t\t\tif (handle) ctx.virtualText.apply(handle)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst currentNode = ctx.treeStore.tree.current(update.node)\n\t\t\t\t\tif (!currentNode) continue\n\t\t\t\t\tif (applyTrait(currentNode, update.trait, update.attributes, ctx, update.rawDsl)) {\n\t\t\t\t\t\tconst updatedNode = ctx.treeStore.tree.current(currentNode)\n\t\t\t\t\t\tif (isRichTextNode(updatedNode)) ctx.virtualText.apply(updatedNode)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (!(error instanceof Error)) throw error\n\t\t\t\tconst nodeId = isVirtualRichTextNode(update.node)\n\t\t\t\t\t? ctx.virtualText.safeGetTargetNodeId(update.node)\n\t\t\t\t\t: update.node.id\n\n\t\t\t\tctx.issues.error(update.rawDsl, error, nodeId ? { nodeIds: [nodeId] } : undefined)\n\t\t\t\tlog.reportError(error, { rawCommand: update.rawDsl, deferredTraitRetry: true })\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Return pending trait updates so the caller can include them in tool responses. Marks\n\t * each reported update as seen so `clearSeenTraits` can remove them at turn boundaries.\n\t */\n\tgetPendingDeferredTraits(ctx: AgentContext): DeferredTraitReport[] {\n\t\treturn this.traitUpdates.map(update => {\n\t\t\tupdate.seen = true\n\n\t\t\tconst nodeId = isVirtualRichTextNode(update.node)\n\t\t\t\t? ctx.virtualText.safeGetTargetNodeId(update.node)\n\t\t\t\t: update.node.id\n\n\t\t\treturn {\n\t\t\t\tcommand: normalizeCommandStatement(update.rawDsl),\n\t\t\t\tcause: update.cause,\n\t\t\t\tnodeId: nodeId,\n\t\t\t}\n\t\t})\n\t}\n\n\t/** Remove deferred traits that have been reported to the model via `getPendingDeferredTraits`. */\n\tclearSeenTraits(): void {\n\t\tthis.traitUpdates = this.traitUpdates.filter(update => !update.seen)\n\t}\n\n\t/**\n\t * Run `updateComponent` for each tracked scope other than `scopeId`, then track `scopeId` as\n\t * the current scope. Called per-command via `processPendingCodeGenerations` (to flush any\n\t * previous scope when the command switches scope) and at end of stream (with no `scopeId`) to\n\t * flush whatever remains.\n\t */\n\tasync flushAllPendingCodeGenerations(scopeId?: NodeID): Promise<void> {\n\t\tif (!this.codeGenerationStore) return\n\n\t\tconst scopesToUpdate: NodeID[] = []\n\t\tfor (const previousScopeId of this.previousScopeIds) {\n\t\t\tif (previousScopeId === scopeId) continue\n\t\t\tscopesToUpdate.push(previousScopeId)\n\t\t}\n\n\t\tif (scopesToUpdate.length > 0) {\n\t\t\t// Persist dependency modules first, otherwise `updateComponent` can ship `!missing/...`\n\t\t\t// imports. Gated on `scopesToUpdate` because this walks every revision node.\n\t\t\tawait this.codeGenerationStore.ensureDependencyModulesExist()\n\t\t}\n\n\t\tfor (const previousScopeId of scopesToUpdate) {\n\t\t\ttry {\n\t\t\t\tawait this.codeGenerationStore.updateComponent(previousScopeId)\n\t\t\t} catch (error) {\n\t\t\t\tlog.reportErrorOncePerMinute(error, { previousScopeId, context: \"Failed to flush code generation for scope\" })\n\t\t\t}\n\t\t}\n\n\t\tthis.previousScopeIds.clear()\n\n\t\tif (scopeId) {\n\t\t\tthis.previousScopeIds.add(scopeId)\n\t\t}\n\t}\n\n\t/**\n\t * Process pending code generations before executing a command. Resolves the command's scope\n\t * and delegates to `flushAllPendingCodeGenerations`, which flushes any *other* tracked scope\n\t * and tracks this one. Same-scope commands are effectively a no-op (debounced inside the\n\t * flush).\n\t */\n\tasync processPendingCodeGenerations(\n\t\tcommand: Command,\n\t\tgetScopeId: (id: string) => NodeID | undefined,\n\t\tdynamicValues: DynamicValues,\n\t): Promise<void> {\n\t\t// Skip if codeGenerationStore is not available (e.g., in tests)\n\t\tif (!this.codeGenerationStore) {\n\t\t\treturn\n\t\t}\n\n\t\tconst scopeId = this.getScopeIdFromCommand(command, getScopeId, dynamicValues)\n\n\t\t// If scopeId is undefined, we still need to flush any tracked scopes since the command\n\t\t// doesn't target a specific scope\n\t\tawait this.flushAllPendingCodeGenerations(scopeId)\n\t}\n\n\tprivate getScopeIdFromCommand(\n\t\tcommand: Command,\n\t\tgetScopeId: (id: string) => NodeID | undefined,\n\t\tdynamicValues: DynamicValues,\n\t): NodeID | undefined {\n\t\tswitch (command.type) {\n\t\t\tcase CommandType.Add: {\n\t\t\t\tif (isAddVariableCommandAttributes(command.attributes)) {\n\t\t\t\t\t// Variable targets its scope directly\n\t\t\t\t\treturn getScopeId(command.attributes.scope)\n\t\t\t\t}\n\n\t\t\t\tif (isString(command.attributes.parent)) {\n\t\t\t\t\t// Node targets the scope containing its parent\n\t\t\t\t\treturn getScopeId(command.attributes.parent)\n\t\t\t\t}\n\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tcase CommandType.Update: {\n\t\t\t\t// Check if it's a variable\n\t\t\t\tconst variableDefinition = dynamicValues.getVariableReferenceHandleByVariableId(command.attributes.id)\n\t\t\t\tif (isVariableReferenceHandle(variableDefinition)) {\n\t\t\t\t\treturn variableDefinition.scopeId\n\t\t\t\t}\n\t\t\t\t// It's a node update\n\t\t\t\treturn getScopeId(command.attributes.id)\n\t\t\t}\n\t\t\tcase CommandType.Remove:\n\t\t\tcase CommandType.Move:\n\t\t\tcase CommandType.Duplicate: {\n\t\t\t\treturn getScopeId(command.attributes.id)\n\t\t\t}\n\t\t\tcase CommandType.CreateVariant: {\n\t\t\t\treturn getScopeId(command.attributes.from)\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(command, \"Invalid command type\")\n\t\t}\n\t}\n}\n\n/** Report trait issues to the agent issues system. */\nfunction reportTraitWarnings(\n\tctx: AgentContext,\n\trawDsl: string,\n\tresult: TraitFromAttributesResult,\n\tnode: CanvasNode | VirtualRichTextNode,\n): void {\n\tif (!result) return\n\tconst nodeId = isVirtualRichTextNode(node) ? ctx.virtualText.safeGetTargetNodeId(node) : node.id\n\n\tconst isWarningsOnly = Array.isArray(result)\n\n\tif (!isWarningsOnly) {\n\t\tfor (const error of result.errors ?? []) {\n\t\t\tctx.issues.error(rawDsl, error, nodeId ? { nodeIds: [nodeId] } : undefined)\n\t\t}\n\t}\n\n\tconst warnings = isWarningsOnly ? result : result.warnings\n\tif (!warnings) return\n\n\tfor (const warning of warnings) {\n\t\tconst status = warning.applied ? \"applied\" : \"rejected\"\n\t\tif (nodeId) {\n\t\t\tctx.issues.warning(rawDsl, { [warning.key]: `[${status}] ${warning.message}` }, { nodeIds: [nodeId] })\n\t\t} else {\n\t\t\tctx.issues.warning(rawDsl, { [warning.key]: `[${status}] ${warning.message}` })\n\t\t}\n\t}\n}\n\nexport function applyTrait(\n\tnode: CanvasNode,\n\ttrait: TraitDefinition<object>,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\trawDsl: string,\n): boolean\nexport function applyTrait(\n\tnode: VirtualRichTextNode,\n\ttrait: VirtualNodeTraitDefinition<object>,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\trawDsl: string,\n): boolean\nexport function applyTrait(\n\tnode: CanvasNode | VirtualRichTextNode,\n\ttrait: TraitDefinition<object, [], CanvasNode | VirtualRichTextNode>,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\trawDsl: string,\n): boolean\nexport function applyTrait(\n\tnode: CanvasNode | VirtualRichTextNode,\n\ttrait: TraitDefinition<object, [], CanvasNode | VirtualRichTextNode>,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\trawDsl: string,\n): boolean {\n\ttry {\n\t\tconst result = trait.fromAttributes(node, attributes, ctx)\n\t\tconst updatedNode: MaybeCanvasNode = isVirtualRichTextNode(node)\n\t\t\t? ctx.treeResolver.get(ctx.virtualText.getTargetNodeId(node))\n\t\t\t: node.draftOrCurrent()\n\n\t\tif (isRichTextNode(updatedNode) && hasTextFit(updatedNode)) {\n\t\t\tctx.deferred.markTextFitDirty(updatedNode.id)\n\t\t}\n\n\t\treportTraitWarnings(ctx, rawDsl, result, node)\n\t\treturn true\n\t} catch (error) {\n\t\tif (error instanceof DeferTraitError) {\n\t\t\tctx.deferred.deferTrait(node, trait, attributes, rawDsl, error.message)\n\t\t\treturn false\n\t\t}\n\n\t\tthrow error\n\t}\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { CanvasNode, CanvasTree, LoadedScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCodeComponentNode,\n\tisFrameNode,\n\tisShapeContainerNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { findComponentIn } from \"document/models/CanvasTree/traits/utils/findComponentIn.ts\"\nimport { isDeviceNode } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifierChecks.ts\"\n\nexport namespace Slot {\n\texport function isValidSlotTarget(tree: CanvasTree, node: CanvasNode): boolean {\n\t\tif (!tree.isGroundNode(node)) return false\n\t\tif (!isFrameNode(node) && !isCodeComponentNode(node) && !isShapeContainerNode(node)) return false\n\t\tif (isVariant(node)) return false\n\t\tif (isDeviceNode(node)) return false\n\t\treturn true\n\t}\n\n\texport function optionsForNode(\n\t\ttree: CanvasTree,\n\t\tcomponentLoader: ComponentLoader,\n\t\tactiveScope: LoadedScopeNode,\n\t\tnode: CanvasNode,\n\t): CanvasNode[] {\n\t\treturn activeScope\n\t\t\t.getGroundNodes()\n\t\t\t.filter(optionalNode => {\n\t\t\t\tif (!isValidSlotTarget(tree, optionalNode)) return false\n\t\t\t\tif (optionalNode.id === node.id) return false\n\t\t\t\tif (findComponentIn(tree, node, optionalNode, componentLoader)) return false\n\t\t\t\treturn true\n\t\t\t})\n\t\t\t.reverse()\n\t}\n}\n", "import { isValidURL } from \"document/utils/domainValidation.ts\"\n\nexport function removeImagesWithInvalidSrc(container: HTMLElement): void {\n\tconst imageElements = container.querySelectorAll(\"img\")\n\tfor (const imageElement of imageElements) {\n\t\tconst src = imageElement.getAttribute(\"src\")\n\t\tif (!src || !isValidURL(src, true)) {\n\t\t\timageElement.remove()\n\t\t}\n\t}\n}\n", "import { isAssetReference } from \"@framerjs/assets\"\nimport { createAssetReferenceForUploadImageResult } from \"document/utils/createAssetReferenceFromImageUpload.ts\"\nimport { Transform } from \"prosemirror-transform\"\nimport { createEditorState } from \"prosemirror/editorState.ts\"\nimport { isImageNode } from \"prosemirror/schema/image.ts\"\nimport { canvasSchemaParams, cmsSchemaParams, makeSchema } from \"prosemirror/schema/index.ts\"\nimport { serializeRichText } from \"prosemirror/serialization/dom.ts\"\nimport { parseHTML } from \"utils/parseHTML.ts\"\nimport { removeImagesWithInvalidSrc } from \"utils/removeImagesWithInvalidSrc.ts\"\nimport type { BatchAssetUploader, Task } from \"web/lib/BatchAssetUploader.ts\"\nimport { createBatchProgressToast } from \"web/lib/batchUploaderUtils.tsx\"\nimport { imageSizeToNonZero } from \"web/lib/images/image.ts\"\nimport type { AssetUploadResult } from \"web/pages/project/lib/UploadService.ts\"\n\nexport interface ConvertToRichTextOptions {\n\tsupportsStyles: boolean\n}\n\nconst defaultOptions: ConvertToRichTextOptions = { supportsStyles: false }\n\nfunction isBlobURL(url: string): boolean {\n\ttry {\n\t\tconst urlObject = new URL(url)\n\t\treturn urlObject.protocol === \"blob:\"\n\t} catch {\n\t\treturn false\n\t}\n}\n\nexport async function convertHTMLToCollectionRichText(\n\tvalue: string,\n\tassetUploader: BatchAssetUploader,\n\toptions?: { showImageUploadProgress?: boolean },\n) {\n\tconst sanitizedHTML = sanitizeHTML(value)\n\n\tconst schema = makeSchema(cmsSchemaParams)\n\n\t// Pull HTML through ProseMirror\n\tconst editorState = createEditorState(sanitizedHTML, schema)\n\n\t// Find images, upload as assets and build up a mapping\n\tconst uploads: Task<AssetUploadResult>[] = []\n\tconst assetUploadResults: Record<string, AssetUploadResult> = {}\n\teditorState.doc.descendants(node => {\n\t\tif (!isImageNode(node)) return\n\t\tconst { src } = node.attrs\n\t\t// TODO: Duplicate if from other project?\n\t\tif (isAssetReference(src)) return\n\t\tif (isBlobURL(src)) return\n\n\t\tuploads.push(\n\t\t\tassetUploader.createTask(src, assetUploadResult => {\n\t\t\t\tassetUploadResults[src] = assetUploadResult\n\t\t\t\treturn assetUploadResult\n\t\t\t}),\n\t\t)\n\t})\n\n\t// Serialize for immediate return or rewriting again later. (Don\u2019t hold on to editor state)\n\tconst html = serializeRichText(editorState.doc, schema)\n\n\t// Don\u2019t bother with uploads / rewrites if not necessary\n\tif (uploads.length === 0) {\n\t\treturn html\n\t}\n\n\tconst runningUploads = uploads.map(start => start())\n\tif (options?.showImageUploadProgress) {\n\t\tvoid createBatchProgressToast(assetUploader, runningUploads).catch(() => {})\n\t}\n\tawait Promise.all(runningUploads)\n\n\t// Re-parse the document, so we don\u2019t hold editor state in memory\n\tconst preUploadEditorState = createEditorState(html, schema)\n\tconst transform = new Transform(preUploadEditorState.doc)\n\ttransform.doc.descendants((node, position) => {\n\t\tif (!isImageNode(node)) return\n\t\tconst assetUploadResult = assetUploadResults[node.attrs.src]\n\t\tif (assetUploadResult?.type !== \"image\") return\n\n\t\tconst { imageSize } = assetUploadResult\n\n\t\t// Non-zero as to have something visible\n\t\tconst { nonZeroNaturalWidth, nonZeroNaturalHeight } = imageSizeToNonZero(imageSize)\n\n\t\ttransform.setNodeMarkup(position, schema.nodes.image, {\n\t\t\t...node.attrs,\n\t\t\tpixelWidth: nonZeroNaturalWidth,\n\t\t\tpixelHeight: nonZeroNaturalHeight,\n\t\t\tsrc: createAssetReferenceForUploadImageResult(assetUploadResult),\n\t\t})\n\t})\n\n\treturn serializeRichText(transform.doc, schema)\n}\n\n/**\n * This exists because images aren't supported in canvas rich text, and the\n * asynchronicity introduced by image handling makes certain tasks much more\n * difficult with `convertHTMLToCollectionRichText`. For example, see\n * `ActivePlugin#createNode` and `insertNodeOnCanvas`, it would need dozens of\n * `processWhenReadyAsync` all over the place, rather than just one at the top.\n */\nexport function convertHTMLToCanvasRichText(value: string, options: ConvertToRichTextOptions = defaultOptions): string {\n\tconst sanitizedHTML = sanitizeHTML(value)\n\tconst schema = makeSchema({ ...canvasSchemaParams, supportsStyles: options.supportsStyles })\n\tconst editorState = createEditorState(sanitizedHTML, schema)\n\treturn serializeRichText(editorState.doc, schema)\n}\n\nconst FIGURE_WITH_IMG_REGEX = /<figure\\b[^>]*>(?:(?!<\\/figure>).)*?(<img\\b[^>]*>)(?:(?!<\\/figure>).)*?<\\/figure>/giu\n\n// Unwrap all divs (replace them with their children)\nfunction unwrapDivs(element: HTMLElement) {\n\tconst divs = element.querySelectorAll(\"div\")\n\tfor (let i = divs.length - 1; i >= 0; i--) {\n\t\tconst div = divs[i] as HTMLElement\n\t\tconst parent = div.parentNode\n\n\t\tif (parent) {\n\t\t\tconst hasContent = div.textContent?.trim() || div.querySelector(\"*\")\n\n\t\t\tif (hasContent) {\n\t\t\t\twhile (div.firstChild) {\n\t\t\t\t\tparent.insertBefore(div.firstChild, div)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tparent.removeChild(div)\n\t\t}\n\t}\n}\n\nfunction sanitizeHTML(value: string): string {\n\t// Parse the HTML using DOM parser to handle unwrapping divs properly\n\tconst wrapper = parseHTML(value)\n\tunwrapDivs(wrapper)\n\tvalue = wrapper.innerHTML\n\n\t// Check for tags, if it\u2019s not HTML, convert each line into a paragraph\n\tvalue = value\n\t\t.split(\"\\n\")\n\t\t.filter(section => section.trim().length > 0)\n\t\t.map(section => {\n\t\t\tif (/<\\/?[a-z][^>]*>/i.test(section)) {\n\t\t\t\t// Webflow supports images with captions (figure, figcaption) but Framer does not\n\t\t\t\t// Adding more elements to our schema creates complications when wanting to add new styles\n\t\t\t\t// so for now, extract the image from the surrounding html and import it as such\n\t\t\t\t// TODO: Remove this as soon as we add support for figure and figcaption\n\t\t\t\tfor (const [result, plainImage] of section.matchAll(FIGURE_WITH_IMG_REGEX)) {\n\t\t\t\t\tif (!plainImage) continue\n\t\t\t\t\tsection = section.replace(result, plainImage)\n\t\t\t\t}\n\n\t\t\t\t// TODO: Add tests and add as much of this parsing logic to prosemirror as possible.\n\t\t\t\t// Handle the rest by pre-parsing the HTML, instead of using regex.\n\t\t\t\treturn section\n\t\t\t}\n\t\t\treturn `<p>${section}</p>`\n\t\t})\n\t\t.join(\"\\n\") // Preserve, important for pre-formatted text\n\n\t// Strip invalid image nodes before ProseMirror parses the rich text so they\n\t// never get persisted into the document.\n\tconst sanitizedWrapper = parseHTML(value)\n\tremoveImagesWithInvalidSrc(sanitizedWrapper)\n\n\treturn sanitizedWrapper.innerHTML\n}\n", "import { lookup as lookupMediaType } from \"mrmime\"\n\nexport function safeURL(url: string): URL | undefined {\n\ttry {\n\t\treturn new URL(url)\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\n/**\n * Attempts to extract a MIME type from a URL or data URI. This is based entirely on the url itself\n * so a file claiming to be a pdf will get `application/pdf` even if it is really a jpg.\n */\nexport function getMediaTypeFromURL(value: string): string | undefined {\n\tif (value.startsWith(\"data:\")) {\n\t\tconst mediaTypeMatch = /^data:(?<mediaType>[^;,]+)/u.exec(value)\n\t\treturn mediaTypeMatch?.groups?.mediaType\n\t}\n\n\tconst parsed = safeURL(value)\n\tif (!parsed) return\n\n\tconst filename = parsed.pathname.split(\"/\").at(-1)\n\tif (!filename) return\n\n\tconst extensionStart = filename.lastIndexOf(\".\")\n\tif (extensionStart === -1) return\n\treturn lookupMediaType(filename.slice(extensionStart))\n}\n", "export const metadataTags = {\n\tadditionalContext: \"additional-context\",\n\tavailableFonts: \"available-fonts\",\n\tavailableComponents: \"available-components\",\n\tcomponentDefinition: \"component-definition\",\n\tavailableIconSets: \"available-icon-sets\",\n\tcollectionItem: \"collection-item\",\n\tcollections: \"collections\",\n\ticonSetDefinition: \"icon-set-definition\",\n\timageAttachments: \"image-attachments\",\n\teditorTheme: \"editor-theme\",\n\tselectedNodes: \"user-selection\",\n\tselectedNodeIds: \"user-selection-ids\",\n\tsiteMap: \"site-map\",\n\tstylePresets: \"style-presets\",\n\tsystemState: \"system-state\",\n\ttokens: \"tokens\",\n\tavailableShaders: \"available-shaders\",\n\tshaderDefinition: \"shader-definition\",\n\tdefaultLayoutTemplate: \"default-layout-template\",\n} as const\n", "/** Type-safe wrapper around {@link Object.hasOwn} that constrains `key` to known keys of `obj`. */\nexport function hasOwn<T extends object>(obj: T, key: keyof T): boolean {\n\treturn Object.hasOwn(obj, key as PropertyKey)\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { RichTextDocument, VirtualRichTextNode, VirtualRichTextRoot } from \"./document.ts\"\n\nexport function* walkVirtualRichText(\n\ttarget: RichTextDocument | readonly VirtualRichTextRoot[],\n): IterableIterator<VirtualRichTextNode> {\n\tconst roots = isVirtualRichTextRootArray(target) ? target : target.children\n\tfor (const root of roots) {\n\t\tyield* walkVirtualRichTextNode(root)\n\t}\n}\n\nfunction isVirtualRichTextRootArray(\n\ttarget: RichTextDocument | readonly VirtualRichTextRoot[],\n): target is readonly VirtualRichTextRoot[] {\n\treturn Array.isArray(target)\n}\n\nexport function getVirtualRichTextChildren(node: VirtualRichTextNode): VirtualRichTextNode[] | undefined {\n\tswitch (node.type) {\n\t\tcase \"textBlock\":\n\t\tcase \"blockquote\":\n\t\tcase \"table\":\n\t\tcase \"tableRow\":\n\t\tcase \"tableCell\":\n\t\tcase \"bulletList\":\n\t\tcase \"numberedList\":\n\t\tcase \"listItem\":\n\t\t\treturn node.children\n\t\tcase \"lineBreak\":\n\t\tcase \"textRun\":\n\t\tcase \"mediaBlock\":\n\t\tcase \"componentInstance\":\n\t\tcase \"unsupported\":\n\t\t\treturn\n\t\tdefault:\n\t\t\tassertNever(node)\n\t}\n}\n\nexport function* walkVirtualRichTextNode(node: VirtualRichTextNode): IterableIterator<VirtualRichTextNode> {\n\tyield node\n\tfor (const child of getVirtualRichTextChildren(node) ?? []) {\n\t\tyield* walkVirtualRichTextNode(child)\n\t}\n}\n", "import { emptyArray } from \"@framerjs/shared\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport type { LinkAttrs } from \"prosemirror/schema/link.ts\"\nimport { BackgroundStyles, BlockStyles, InlineStyles } from \"prosemirror/styles.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport {\n\ttype RichTextDocument,\n\ttype VirtualRichTextNode,\n\ttype VirtualRichTextTextRun,\n\tisRichTextDocument,\n\tisVirtualRichTextTextBlock,\n\tisVirtualRichTextTextRun,\n\ttype WithVirtualTextBlockStyles,\n\ttype WithVirtualTextStyles,\n\twithVirtualTextBlockStyles,\n\twithVirtualTextStyles,\n\twithVirtualTextLinkAttrs,\n} from \"./document.ts\"\nimport { getVirtualRichTextChildren, walkVirtualRichText } from \"./traversal.ts\"\n\ntype StyleNode = RichTextDocument | VirtualRichTextNode\ntype InlineStyleKey = keyof WithVirtualTextStyles[\"inlineStyles\"]\ntype BackgroundStyleKey = keyof WithVirtualTextStyles[\"backgroundStyles\"]\ntype BlockStyleKey = keyof WithVirtualTextBlockStyles[\"blockStyles\"]\n\nconst inlineStyleKeys = objectKeys(InlineStyles.defaults) as readonly InlineStyleKey[]\nconst backgroundStyleKeys = objectKeys(BackgroundStyles.defaults) as readonly BackgroundStyleKey[]\nconst blockStyleKeys = objectKeys(BlockStyles.defaults) as readonly BlockStyleKey[]\n\ninterface StyleAccessor<V> {\n\thas(node: StyleNode): boolean\n\tget(node: StyleNode): V | undefined\n\tset(node: StyleNode, value: V | undefined): void\n}\n\n// Builds an accessor from a type guard. The guard's narrowed node type flows into get/set,\n// so concrete accessor definitions need no `as` casts.\nfunction createStyleAccessor<T extends StyleNode, V>(\n\thas: (node: StyleNode) => node is T,\n\tget: (node: T) => V | undefined,\n\tset: (node: T, value: V | undefined) => void,\n): StyleAccessor<V> {\n\treturn {\n\t\thas,\n\t\tget: node => (has(node) ? get(node) : undefined),\n\t\tset: (node, value) => {\n\t\t\tif (has(node)) set(node, value)\n\t\t},\n\t}\n}\n\nconst inline = <K extends InlineStyleKey>(key: K) =>\n\tcreateStyleAccessor(\n\t\twithVirtualTextStyles,\n\t\tnode => node.inlineStyles[key],\n\t\t(node, value) => setOrDelete(node.inlineStyles, key, value),\n\t)\n\nconst background = <K extends BackgroundStyleKey>(key: K) =>\n\tcreateStyleAccessor(\n\t\twithVirtualTextStyles,\n\t\tnode => node.backgroundStyles[key],\n\t\t(node, value) => setOrDelete(node.backgroundStyles, key, value),\n\t)\n\nconst block = <K extends BlockStyleKey>(key: K) =>\n\tcreateStyleAccessor(\n\t\twithVirtualTextBlockStyles,\n\t\tnode => node.blockStyles[key],\n\t\t(node, value) => setOrDelete(node.blockStyles, key, value),\n\t)\n\nconst fontScalar = <K extends \"fontName\" | \"fontWeight\" | \"fontStyle\">(key: K) =>\n\tcreateStyleAccessor(\n\t\twithVirtualTextStyles,\n\t\tnode => node[key],\n\t\t(node, value) => {\n\t\t\tnode[key] = value\n\t\t},\n\t)\n\nconst textStylePreset = createStyleAccessor(\n\twithVirtualTextBlockStyles,\n\tnode => node.textStylePreset,\n\t(node, value) => {\n\t\tnode.textStylePreset = value\n\t},\n)\n\nconst linkAttrsAccessor = createStyleAccessor(\n\twithVirtualTextLinkAttrs,\n\tnode => node.linkAttrs,\n\t(node, value) => {\n\t\tnode.linkAttrs = value\n\t},\n)\n\nexport function applyInlineStyle<K extends InlineStyleKey>(scope: StyleNode, key: K, value: InlineStyles[K]): void {\n\tapplyStyle(scope, inline(key), value)\n}\n\nexport function applyBackgroundStyle<K extends BackgroundStyleKey>(\n\tscope: StyleNode,\n\tkey: K,\n\tvalue: BackgroundStyles[K],\n): void {\n\tapplyStyle(scope, background(key), value)\n}\n\nexport function applyBlockStyle<K extends BlockStyleKey>(scope: StyleNode, key: K, value: BlockStyles[K]): void {\n\tapplyStyle(scope, block(key), value)\n}\n\ninterface FontStyleValues {\n\tname: string | undefined\n\tweight: number | undefined\n\tstyle: \"normal\" | \"italic\" | undefined\n}\n\nexport function applyFont(scope: StyleNode, font: FontStyleValues): void {\n\tapplyStyle(scope, fontScalar(\"fontName\"), font.name)\n\tapplyStyle(scope, fontScalar(\"fontWeight\"), font.weight)\n\tapplyStyle(scope, fontScalar(\"fontStyle\"), font.style)\n}\n\nexport function applyTextStylePreset(\n\tdocument: RichTextDocument | undefined,\n\tpreset: { id: string; tag: NonNullable<RichTextDocument[\"tag\"]> } | undefined,\n): void {\n\tif (!document) return\n\n\tapplyStyle(document, textStylePreset, preset?.id)\n\tif (!preset) return\n\n\tdocument.tag = preset.tag\n\tclearTextStylePresetStyles(document, preset.tag)\n}\n\nfunction applyStyle<V>(scope: StyleNode, accessor: StyleAccessor<V>, value: V | undefined): void {\n\tif (!accessor.has(scope)) return\n\taccessor.set(scope, value)\n\tfor (const child of getScopeChildren(scope) ?? emptyArray()) {\n\t\tclearInDescendants(child, accessor)\n\t}\n}\n\nfunction clearTextStylePresetStyles(scope: StyleNode, tag: NonNullable<RichTextDocument[\"tag\"]>): void {\n\tif (withVirtualTextStyles(scope)) {\n\t\tscope.inlineStyles = {}\n\t\tscope.backgroundStyles = {}\n\t\tscope.fontName = undefined\n\t\tscope.fontWeight = undefined\n\t\tscope.fontStyle = undefined\n\t}\n\tif (withVirtualTextBlockStyles(scope)) {\n\t\tconst textAlignment = scope.blockStyles.textAlignment\n\t\tscope.blockStyles = {}\n\t\tif (!isUndefined(textAlignment)) scope.blockStyles.textAlignment = textAlignment\n\t}\n\tif (isVirtualRichTextTextBlock(scope)) scope.tag = tag\n\tfor (const child of getScopeChildren(scope) ?? emptyArray()) clearTextStylePresetStyles(child, tag)\n}\n\nfunction clearInDescendants<V>(node: VirtualRichTextNode, accessor: StyleAccessor<V>): void {\n\taccessor.set(node, undefined)\n\tfor (const child of getVirtualRichTextChildren(node) ?? emptyArray()) clearInDescendants(child, accessor)\n}\n\ninterface ResolvedScopeAttrs {\n\tinlineStyles: WithVirtualTextStyles[\"inlineStyles\"]\n\tblockStyles: WithVirtualTextBlockStyles[\"blockStyles\"]\n\ttextStylePreset: string | undefined\n}\n\ninterface ResolvedRunMarks {\n\tbackgroundStyles: WithVirtualTextStyles[\"backgroundStyles\"]\n\tlinkAttrs: LinkAttrs | undefined\n}\n\nexport function resolveScopeAttrs(ancestors: readonly StyleNode[], scope: StyleNode): ResolvedScopeAttrs {\n\tconst chain = [...ancestors, scope]\n\treturn {\n\t\tinlineStyles: mergeStyles(chain, n => (withVirtualTextStyles(n) ? n.inlineStyles : undefined)),\n\t\tblockStyles: mergeStyles(chain, n => (withVirtualTextBlockStyles(n) ? n.blockStyles : undefined)),\n\t\ttextStylePreset: closestDefinedValue(chain, textStylePreset),\n\t}\n}\n\nexport function resolveRunMarks(ancestors: readonly StyleNode[], run: StyleNode): ResolvedRunMarks {\n\tconst chain = [...ancestors, run]\n\treturn {\n\t\tbackgroundStyles: mergeStyles(chain, n => (withVirtualTextStyles(n) ? n.backgroundStyles : undefined)),\n\t\tlinkAttrs: closestDefinedValue(chain, linkAttrsAccessor),\n\t}\n}\n\nfunction mergeStyles<T extends object>(\n\tchain: readonly StyleNode[],\n\tread: (node: StyleNode) => Partial<T> | undefined,\n): Partial<T> {\n\tconst merged: Partial<T> = {}\n\tfor (const node of chain) {\n\t\tconst slice = read(node)\n\t\tif (slice) Object.assign(merged, slice)\n\t}\n\treturn merged\n}\n\n// Walks the chain from innermost (self) outward and returns the first value the accessor sees \u2014\n// i.e. the closest scope that defines this style wins, mirroring normal inheritance semantics.\nfunction closestDefinedValue<V>(chain: readonly StyleNode[], accessor: StyleAccessor<V>): V | undefined {\n\tfor (let i = chain.length - 1; i >= 0; i--) {\n\t\tconst value = accessor.get(chain[i]!)\n\t\tif (!isUndefined(value)) return value\n\t}\n\n\treturn\n}\n\nexport function normalizeRichTextDocumentStyles(document: RichTextDocument): void {\n\tnormalizeStyleScope(document)\n\tnormalizeDocumentLinks(document)\n}\n\nfunction normalizeStyleScope(scope: StyleNode): void {\n\tconst children = getScopeChildren(scope)\n\tif (!children) return\n\tfor (const child of children) normalizeStyleScope(child)\n\n\tfor (const key of inlineStyleKeys) hoistStyle(scope, children, inline(key))\n\tfor (const key of backgroundStyleKeys) hoistStyle(scope, children, background(key))\n\tfor (const key of blockStyleKeys) hoistStyle(scope, children, block(key))\n\thoistStyle(scope, children, fontScalar(\"fontName\"))\n\thoistStyle(scope, children, fontScalar(\"fontWeight\"))\n\thoistStyle(scope, children, fontScalar(\"fontStyle\"))\n\thoistStyle(scope, children, textStylePreset)\n}\n\nfunction hoistStyle<V>(scope: StyleNode, children: readonly VirtualRichTextNode[], accessor: StyleAccessor<V>): void {\n\tif (!accessor.has(scope)) return\n\t// Non-stylable containers (blockquote, table, table row/cell) cannot carry this style\n\t// themselves, but their stylable descendants inherit through them transparently during\n\t// serialization. Treat those descendants as if they were direct children of the scope\n\t// so hoisting and lowering decisions account for them.\n\tconst inheritanceTargets = collectInheritanceTargets(children, accessor)\n\tconst inherited = accessor.get(scope)\n\tconst uniform = getUniformDefinedValue(inheritanceTargets.map(c => hoistableValue(c, accessor, inherited)))\n\tif (!isUndefined(uniform)) accessor.set(scope, uniform)\n\n\tconst scopeValue = accessor.get(scope)\n\tif (isUndefined(scopeValue)) return\n\n\tconst scopeAppliesToEveryChild = inheritanceTargets.every(child =>\n\t\tisEqual(hoistableValue(child, accessor, scopeValue), scopeValue),\n\t)\n\tif (!scopeAppliesToEveryChild) {\n\t\tfor (const child of inheritanceTargets) materializeInheritedStyle(child, accessor, scopeValue)\n\t\taccessor.set(scope, undefined)\n\t\treturn\n\t}\n\n\tfor (const child of inheritanceTargets) {\n\t\tif (isEqual(accessor.get(child), scopeValue)) accessor.set(child, undefined)\n\t}\n}\n\nfunction collectInheritanceTargets<V>(\n\tnodes: readonly VirtualRichTextNode[],\n\taccessor: StyleAccessor<V>,\n): VirtualRichTextNode[] {\n\tconst out: VirtualRichTextNode[] = []\n\tfor (const node of nodes) {\n\t\tif (accessor.has(node)) {\n\t\t\tout.push(node)\n\t\t\tcontinue\n\t\t}\n\t\tconst grandchildren = getVirtualRichTextChildren(node)\n\t\tif (grandchildren) out.push(...collectInheritanceTargets(grandchildren, accessor))\n\t}\n\treturn out\n}\n\nfunction hoistableValue<V>(\n\tnode: VirtualRichTextNode,\n\taccessor: StyleAccessor<V>,\n\tinherited: V | undefined,\n): V | undefined {\n\tconst ownValue = accessor.get(node)\n\tconst value = isUndefined(ownValue) ? inherited : ownValue\n\tif (isUndefined(value)) return\n\tif (hasConflictingDescendant(node, accessor, value)) return\n\treturn value\n}\n\nfunction materializeInheritedStyle<V>(node: VirtualRichTextNode, accessor: StyleAccessor<V>, value: V): void {\n\tif (!isUndefined(accessor.get(node))) return\n\n\tif (!hasConflictingDescendant(node, accessor, value)) {\n\t\taccessor.set(node, value)\n\t\treturn\n\t}\n\n\tconst children = getVirtualRichTextChildren(node)\n\tif (!children) {\n\t\taccessor.set(node, value)\n\t\treturn\n\t}\n\n\tfor (const child of collectInheritanceTargets(children, accessor)) {\n\t\tmaterializeInheritedStyle(child, accessor, value)\n\t}\n}\n\nfunction hasConflictingDescendant<V>(node: VirtualRichTextNode, accessor: StyleAccessor<V>, value: V): boolean {\n\tfor (const child of getVirtualRichTextChildren(node) ?? []) {\n\t\tconst childValue = accessor.get(child)\n\t\tif (!isUndefined(childValue) && !isEqual(childValue, value)) return true\n\t\tif (hasConflictingDescendant(child, accessor, value)) return true\n\t}\n\treturn false\n}\n\nexport function clearScopedLinks(document: RichTextDocument | undefined): void {\n\tif (!document) return\n\n\tdocument.linkAttrs = undefined\n\tfor (const run of getTextRuns(document)) run.linkAttrs = undefined\n}\n\nexport function setScopedLinks(document: RichTextDocument | undefined, linkAttrs: LinkAttrs): void {\n\tif (!document) return\n\n\tdocument.linkAttrs = linkAttrs\n\tfor (const run of getTextRuns(document)) run.linkAttrs = undefined\n}\n\nexport function setLinkStylePresetForScopedLinks(\n\tdocument: RichTextDocument | undefined,\n\tlinkStylePreset: string | undefined,\n): void {\n\tif (!document) return\n\tif (document.linkAttrs) document.linkAttrs = { ...document.linkAttrs, linkStylePreset }\n\tfor (const run of getTextRuns(document)) {\n\t\tif (run.linkAttrs) run.linkAttrs = { ...run.linkAttrs, linkStylePreset }\n\t}\n}\n\nexport function clearInlineCodeStylePresetOverrides(document: RichTextDocument | undefined): void {\n\tif (!document) return\n\tfor (const run of getTextRuns(document)) run.inlineCodeStylePreset = undefined\n}\n\nfunction normalizeDocumentLinks(document: RichTextDocument): void {\n\tconst runs = getTextRuns(document)\n\tconst uniform = getUniformDefinedValue(runs.map(run => run.linkAttrs))\n\tif (!isUndefined(uniform)) {\n\t\tdocument.linkAttrs = uniform\n\t\tfor (const run of runs) run.linkAttrs = undefined\n\t\treturn\n\t}\n\tif (!document.linkAttrs) return\n\tfor (const run of runs) {\n\t\tif (isEqual(run.linkAttrs, document.linkAttrs)) run.linkAttrs = undefined\n\t}\n}\n\nfunction setOrDelete<T, K extends keyof T>(target: T, key: K, value: T[K] | undefined): void {\n\tif (isUndefined(value)) delete target[key]\n\telse target[key] = value\n}\n\nfunction getScopeChildren(scope: StyleNode): readonly VirtualRichTextNode[] | undefined {\n\tif (isRichTextDocument(scope)) return scope.children\n\treturn getVirtualRichTextChildren(scope)\n}\n\nfunction getUniformDefinedValue<T>(values: readonly T[]): T | undefined {\n\tconst [first] = values\n\tif (isUndefined(first)) return\n\tif (!values.every(value => isEqual(value, first))) return\n\treturn first\n}\n\nfunction getTextRuns(document: RichTextDocument): VirtualRichTextTextRun[] {\n\tconst result: VirtualRichTextTextRun[] = []\n\tfor (const node of walkVirtualRichText(document)) {\n\t\tif (!isVirtualRichTextTextRun(node)) continue\n\t\tresult.push(node)\n\t}\n\treturn result\n}\n", "import { withOptionalPrefix } from \"./helpers.ts\"\nimport type { AttributeDefinition, PrefixObjectKeys } from \"./types.ts\"\n\nexport const colorDescriptionWithoutToken = \"rgba(r, g, b, a) | color(display-p3 r g b / a) | #rrggbb\"\nconst tokenDescription = \"var(--token-${id})\"\nexport const variableDescription = \"var(--variable-${id})\"\nexport const computedValueAlias = \"ComputedValue\"\nexport const computedValueDescription = '{ from: \"var(--variable-${id})\", transforms: [{ name: \"...\", ... }] }'\nexport function dynamicValueDescription(type: string): string {\n\treturn `${variableDescription} | ${computedValueAlias}<${type}>`\n}\nexport const colorDescription = `${colorDescriptionWithoutToken} | ${tokenDescription}`\nexport const arrayItemDescription = \"{validArrayItemValue}\"\nexport const gradientDescription =\n\t\"linear-gradient(angle, color stop%, ...) | radial-gradient(...) | conic-gradient(...)\"\nexport const imageDescription = \"https://...\"\nexport const boxShadowDescription = `{\"inset\" | \"\"} {offsetX}px {offsetY}px {blur}px {spread}px {${colorDescription}}`\nexport const pixelShorthandDescription =\n\t\"${number}px | ${number}px ${number}px | ${number}px ${number}px ${number}px ${number}px\"\nexport const percentageDescription = \"${number}%\"\n\nexport function attributeHasGradient(attribute: string): boolean {\n\treturn attribute.includes(\"-gradient(\")\n}\n\nconst borderDescriptionShape = {\n\tborderColor: {\n\t\tdescription: colorDescription,\n\t\toptional: true,\n\t},\n\tborderEnabled: {\n\t\tdescription: \"boolean\",\n\t\toptional: true,\n\t},\n\tborderWidth: {\n\t\tdescription: \"number | ${number}px\",\n\t\toptional: true,\n\t},\n\tborderStyle: {\n\t\tdescription: \"solid | dashed | dotted | double\",\n\t\toptional: true,\n\t},\n\tborder: {\n\t\tdescription: `\\${number} \\${solid | dashed | dotted | double} \\${${colorDescription}}`,\n\t\texamples: [\"10px solid red\", \"20px dashed blue\", \"30px dotted green\"],\n\t\toptional: true,\n\t},\n\tborderPerSide: {\n\t\tdescription: \"boolean\",\n\t\toptional: true,\n\t},\n\tborderTop: {\n\t\tdescription: \"number | ${number}px\",\n\t\toptional: true,\n\t},\n\tborderRight: {\n\t\tdescription: \"number | ${number}px\",\n\t\toptional: true,\n\t},\n\tborderBottom: {\n\t\tdescription: \"number | ${number}px\",\n\t\toptional: true,\n\t},\n\tborderLeft: {\n\t\tdescription: \"number | ${number}px\",\n\t\toptional: true,\n\t},\n} as const satisfies Record<string, AttributeDefinition>\n\ntype BorderDescriptionShape = typeof borderDescriptionShape\ntype BorderDescription<TPrefix extends string | undefined> = PrefixObjectKeys<BorderDescriptionShape, TPrefix>\n\nexport function borderDescription<TPrefix extends string | undefined = undefined>(\n\tprefix?: TPrefix,\n): BorderDescription<TPrefix> {\n\treturn {\n\t\t[withOptionalPrefix(prefix, \"borderColor\")]: borderDescriptionShape.borderColor,\n\t\t[withOptionalPrefix(prefix, \"borderEnabled\")]: borderDescriptionShape.borderEnabled,\n\t\t[withOptionalPrefix(prefix, \"borderWidth\")]: borderDescriptionShape.borderWidth,\n\t\t[withOptionalPrefix(prefix, \"borderStyle\")]: borderDescriptionShape.borderStyle,\n\t\t[withOptionalPrefix(prefix, \"border\")]: borderDescriptionShape.border,\n\t\t[withOptionalPrefix(prefix, \"borderPerSide\")]: borderDescriptionShape.borderPerSide,\n\t\t[withOptionalPrefix(prefix, \"borderTop\")]: borderDescriptionShape.borderTop,\n\t\t[withOptionalPrefix(prefix, \"borderRight\")]: borderDescriptionShape.borderRight,\n\t\t[withOptionalPrefix(prefix, \"borderBottom\")]: borderDescriptionShape.borderBottom,\n\t\t[withOptionalPrefix(prefix, \"borderLeft\")]: borderDescriptionShape.borderLeft,\n\t} as BorderDescription<TPrefix>\n}\n", "import { assert, isEmptyObject } from \"@framerjs/shared\"\nimport { isVariableReferenceHandle, looksLikeVariableReference } from \"app/ai/agents/context/dynamicValues.ts\"\nimport { escapeValue, keyValueReference, traitReference, traitValueReference } from \"app/ai/agents/prompt/utils.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { RichTextNode } from \"document/models/CanvasTree/nodes/RichTextNode.ts\"\nimport { isRichTextNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasCollectionDataSourceAncestor } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport {\n\thasLink,\n\tlinkDefaults,\n\twithLink,\n\ttype WithLink,\n\ttype WithLinkUpdate,\n} from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport type { Link, LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { createLink, isLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport {\n\tisSupportedLinkRelValue,\n\ttype SupportedLinkRelValue,\n\tsupportedLinkRelValues,\n} from \"document/models/SupportedRelValue.ts\"\nimport { isInternalURL } from \"library/modules/Link/urlChecks.tsx\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport type { LinkAttrs } from \"prosemirror/schema/link.ts\"\nimport { getLinkToWebPageFromPath } from \"utils/getLinkToWebPageFromPath.ts\"\nimport { hasOwn } from \"utils/objectHasOwn.ts\"\nimport { hasSegmentWithPathVariableShape } from \"utils/pathVariables.ts\"\nimport { findScrollTargetIdForHash, resolveLinkToURL } from \"utils/resolveLink.ts\"\nimport { isArray, isBooleanString, isNull, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport {\n\tgetVirtualRichTextDSLNodeClass,\n\ttype VirtualRichTextNode,\n\ttype VirtualRichTextTextRun,\n\tisVirtualRichTextNode,\n\tisVirtualRichTextTextRun,\n\twithVirtualTextLinkAttrs,\n} from \"../context/richtext/document.ts\"\nimport { clearScopedLinks, setScopedLinks } from \"../context/richtext/styleInheritance.ts\"\nimport { resolveRichTextTargetHandle } from \"../context/richtext/targets.ts\"\nimport { TextRunClass } from \"../dsl.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\texpectedBooleanValue,\n\texpectedIdentifierWithoutSpaces,\n\texpectedAttributeMessage,\n\ttraitNotAppliedWarning,\n\tunresolvedVariableMessage,\n\tunsupportedAttributeMessage,\n\tinvalidAttributeMessage,\n} from \"./invalidValues.ts\"\nimport { variableDescription } from \"./traitDescriptions.ts\"\nimport {\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n\ttype VirtualNodeTraitDefinition,\n\tnodeToDSLType,\n} from \"./types.ts\"\n\ninterface DSLLinkAttributes {\n\tlink: {\n\t\thref: string | undefined\n\t\topenInNewTab: boolean | string | undefined\n\t\tsmoothScroll: boolean | string | undefined\n\t\ttrackingId: string | undefined\n\t\trel: string | undefined\n\t\tpreserveParams: boolean | string | undefined\n\t}\n}\n\ntype DSLLink = DSLLinkAttributes[\"link\"]\n\n// TODO: support Computed Values and switch to variableDescription -> dynamicValueDescription\nexport const linkHrefDescription = `External URL | internal page path (optional #elementId hash for scroll targets) | CMS detail page path with a dynamic path variable like \":slug\" (only inside a CMS Collection List) | ${variableDescription} | null`\nconst definition = {\n\tlink: {\n\t\thref: {\n\t\t\tdescription: linkHrefDescription,\n\t\t\texamples: [\"https://example.com/about/\", \"/pricing\", \"/about#team\", \"/blog/:slug\"],\n\t\t\toptional: true,\n\t\t},\n\t\topenInNewTab: {\n\t\t\tdescription: `true | ${variableDescription} | null`,\n\t\t\toptional: true,\n\t\t},\n\t\tsmoothScroll: {\n\t\t\tdescription: `true | ${variableDescription} | null`,\n\t\t\toptional: true,\n\t\t},\n\t\ttrackingId: {\n\t\t\tdescription: `string | ${variableDescription} | null`,\n\t\t\texamples: [\"click-subscribe\", \"click-login\", \"click-pricing-cta\"],\n\t\t\toptional: true,\n\t\t},\n\t\trel: {\n\t\t\tdescription: `HTML rel attribute supporting ONLY: ${supportedLinkRelValues.join(\", \")} | ${variableDescription} | null`,\n\t\t\texamples: [`${supportedLinkRelValues[4]}`, `${supportedLinkRelValues[0]} ${supportedLinkRelValues[1]}`],\n\t\t\toptional: true,\n\t\t},\n\t\tpreserveParams: {\n\t\t\tdescription: `true (keep existing URL query parameters when navigating) | ${variableDescription} | null`,\n\t\t\toptional: true,\n\t\t},\n\t},\n} satisfies TraitAttributeDefinition<DSLLinkAttributes>\n\nconst linkSubPropertiesDescription = \"link sub-properties (e.g. link.href, link.rel, link.<etc>)\"\n\n/**\n * Parsed sub-property values from DSL input. `undefined` means the property was not provided\n * in the DSL. `null` means it was explicitly set to \"null\" (clear to default).\n */\ninterface ParsedLinkSubProperties {\n\topenInNewTab?: boolean | VariableReference | null\n\tsmoothScroll?: boolean | VariableReference | null\n\tclickTrackingId?: string | VariableReference | null\n\trelValues?: readonly SupportedLinkRelValue[] | VariableReference | null\n\tpreserveParams?: boolean | VariableReference | null\n}\n\ninterface ResolveHrefResult {\n\tnewLink: Link | VariableReference\n\thashUnresolvedReason?: string\n}\n\n// --------------------------------\n// From Attributes\n// --------------------------------\n\nfunction fromAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): TraitWarning[] {\n\tif (isVirtualRichTextTextRun(node)) return fromAttributesToTextRun(node, attributes, ctx)\n\tif (isVirtualRichTextNode(node)) return warnUnsupportedVirtualTextNodes(node, attributes.link)\n\tif (isRichTextNode(node)) return fromAttributesToRichTextNode(node, attributes, ctx)\n\treturn fromAttributesToCanvasNode(node, attributes, ctx)\n}\n\nfunction warnUnsupportedVirtualTextNodes(node: VirtualRichTextNode, link: unknown): TraitWarning[] {\n\tif (isUndefined(link)) return []\n\tif (node.type === \"unsupported\") return []\n\n\tconst message = unsupportedAttributeMessage(getVirtualRichTextDSLNodeClass(node.type), {\n\t\tdidYouMean: `to set it on a ${escapeValue(TextRunClass)} or ${escapeValue(ClassDiscriminator.RichTextNode)} instead`,\n\t})\n\treturn [{ applied: false, key: \"link\", message }]\n}\n\nfunction fromAttributesToTextRun(\n\tnode: VirtualRichTextTextRun,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\tconst { link } = attributes\n\tif (isUndefined(link)) return warnings\n\n\tif (isNullString(link)) {\n\t\tnode.linkAttrs = undefined\n\t\treturn warnings\n\t}\n\n\tif (!isObject(link)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"link\",\n\t\t\tmessage: expectedAttributeMessage(link, linkSubPropertiesDescription),\n\t\t})\n\t\treturn warnings\n\t}\n\n\tconst target = ctx.virtualText.getTarget(node)\n\tconst handle = resolveRichTextTargetHandle(target, ctx)\n\tif (!handle?.capabilities.links) {\n\t\tfor (const key of objectKeys(definition.link)) {\n\t\t\tif (!hasOwn(link, key)) continue\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: `link.${key}`,\n\t\t\t\tmessage: \"Links are not supported on this node.\",\n\t\t\t})\n\t\t}\n\t\treturn warnings\n\t}\n\n\tconst backingNode = ctx.treeResolver.get(handle.nodeId)\n\tassert(backingNode, `Could not resolve the backing canvas node for rich text target \"${target}\".`)\n\n\tif (isNullString(link.href)) {\n\t\tnode.linkAttrs = undefined\n\t\treturn warnings\n\t}\n\n\tconst resolvedHref = resolveHref(link.href, backingNode, ctx, warnings)\n\n\t// Normalization hoists a uniform link to document.linkAttrs and clears each run's local\n\t// linkAttrs. Walk the ancestor chain so sub-property updates (e.g. just link.openInNewTab)\n\t// pick up the inherited link instead of warning about a missing href.\n\tconst inheritedLinkAttrs = node.linkAttrs ?? findAncestorLinkAttrs(node, ctx)\n\n\tconst newLink = resolvedHref?.newLink\n\tconst inheritedLinkStylePreset =\n\t\tnewLink && isRichTextNode(backingNode)\n\t\t\t? (inheritedLinkAttrs?.linkStylePreset ?? backingNode.stylePresetLink)\n\t\t\t: undefined\n\n\tconst effectiveLink = newLink ?? inheritedLinkAttrs?.link\n\tif (!isLink(effectiveLink) && !isVariableReference(effectiveLink)) {\n\t\tconst reason = `this ${escapeValue(TextRunClass)} doesn't have a valid ${traitReference(\"link.href\")}. Set ${traitReference(\"link.href\")} first`\n\t\twarnMissingHrefForSubProperties(link, reason, warnings)\n\t\treturn warnings\n\t}\n\n\tconst parsed = parseLinkSubProperties(link, backingNode, ctx, warnings)\n\tnode.linkAttrs = mergeLinkAttrs(effectiveLink, parsed, inheritedLinkAttrs, inheritedLinkStylePreset)\n\n\tif (resolvedHref?.hashUnresolvedReason) {\n\t\tthrow new DeferTraitError(resolvedHref.hashUnresolvedReason)\n\t}\n\n\treturn warnings\n}\n\nfunction findAncestorLinkAttrs(node: VirtualRichTextTextRun, ctx: AgentContext): LinkAttrs | undefined {\n\treturn ctx.virtualText.findInheritedValue(node, scope =>\n\t\twithVirtualTextLinkAttrs(scope) ? scope.linkAttrs : undefined,\n\t)\n}\n\nfunction fromAttributesToRichTextNode(\n\tnode: RichTextNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\tconst { link } = attributes\n\tif (isUndefined(link)) return warnings\n\tconst document = ctx.virtualText.maybeHydrateDocument(node)\n\n\tif (isNullString(link)) {\n\t\tclearScopedLinks(document)\n\t\treturn warnings\n\t}\n\n\tif (!isObject(link)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"link\",\n\t\t\tmessage: expectedAttributeMessage(link, linkSubPropertiesDescription),\n\t\t})\n\t\treturn warnings\n\t}\n\n\tif (isNullString(link.href)) {\n\t\tclearScopedLinks(document)\n\t\treturn warnings\n\t}\n\n\tconst resolved = resolveHref(link.href, node, ctx, warnings)\n\tconst newLink = resolved?.newLink\n\tconst existing = document?.linkAttrs\n\n\tconst effectiveLink = newLink ?? existing?.link\n\tif (!isLink(effectiveLink) && !isVariableReference(effectiveLink)) {\n\t\tconst reason = `the ${escapeValue(nodeToDSLType(node, ctx))} does not have a valid ${escapeValue(\"link.href\")} or contains multiple different links inside. Set ${escapeValue(\"link.href\")} to set a uniform link for the node`\n\t\twarnMissingHrefForSubProperties(link, reason, warnings)\n\t\treturn warnings\n\t}\n\tconst parsed = parseLinkSubProperties(link, node, ctx, warnings)\n\tconst linkAttrs = mergeLinkAttrs(effectiveLink, parsed, existing, newLink ? node.stylePresetLink : undefined)\n\tsetScopedLinks(document, linkAttrs)\n\n\tif (resolved?.hashUnresolvedReason) {\n\t\tthrow new DeferTraitError(resolved.hashUnresolvedReason)\n\t}\n\n\treturn warnings\n}\n\nfunction fromAttributesToCanvasNode(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\tconst { link } = attributes\n\tif (isUndefined(link)) return warnings\n\n\tif (isNullString(link)) {\n\t\tif (withLink(node)) {\n\t\t\tnode.set(linkDefaults)\n\t\t} else {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"link\",\n\t\t\t\tmessage: invalidAttributeMessage(\n\t\t\t\t\tlink,\n\t\t\t\t\t`${nodeToDSLType(node, ctx)} doesn't support clearing ${traitReference(\"link\")} sub-attributes with ${traitValueReference(\"link\", nullString)}`,\n\t\t\t\t),\n\t\t\t})\n\t\t}\n\t\treturn warnings\n\t}\n\n\tif (!isObject(link)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"link\",\n\t\t\tmessage: expectedAttributeMessage(link, linkSubPropertiesDescription),\n\t\t})\n\t\treturn warnings\n\t}\n\n\tif (!withLink(node)) {\n\t\tconst dslType = nodeToDSLType(node, ctx)\n\t\tfor (const key of objectKeys(definition.link)) {\n\t\t\tif (!hasOwn(link, key)) continue\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: `link.${key}`,\n\t\t\t\tmessage: unsupportedAttributeMessage(dslType),\n\t\t\t})\n\t\t}\n\t\treturn warnings\n\t}\n\n\tif (isNullString(link.href)) {\n\t\tnode.set(linkDefaults)\n\t\treturn warnings\n\t}\n\n\tconst resolved = resolveHref(link.href, node, ctx, warnings)\n\tconst newLink = resolved?.newLink\n\n\tif (!newLink && !isLink(node.getLink()) && !isDynamicValue(node.getLink())) {\n\t\tconst reason = `the node doesn't have a valid ${escapeValue(\"link.href\")}. A valid ${escapeValue(\"link.href\")} is required for the link to work`\n\t\twarnMissingHrefForSubProperties(link, reason, warnings)\n\t\treturn warnings\n\t}\n\n\tconst parsed = parseLinkSubProperties(link, node, ctx, warnings)\n\tconst update: Partial<WithLink> = parsedToWithLinkUpdate(parsed)\n\tif (newLink) update.link = newLink\n\tif (!isEmptyObject(update)) node.set(update)\n\n\tif (resolved?.hashUnresolvedReason) {\n\t\tthrow new DeferTraitError(resolved.hashUnresolvedReason)\n\t}\n\n\treturn warnings\n}\n\nfunction parseLinkSubProperties(\n\tlink: Record<string, unknown>,\n\tresolveNode: CanvasNode,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n): ParsedLinkSubProperties {\n\tconst result: ParsedLinkSubProperties = {}\n\tconst resolveVariableRef = (value: unknown, key: string) => {\n\t\tif (!isString(value)) return\n\t\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, { node: resolveNode })\n\n\t\tif (resolveHandleResult.type === \"resolved\" && isVariableReferenceHandle(resolveHandleResult.handle)) {\n\t\t\treturn resolveHandleResult.handle.reference(resolveNode)\n\t\t}\n\n\t\tif (resolveHandleResult.type === \"invalid\") {\n\t\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(key, message)))\n\t\t\treturn\n\t\t}\n\n\t\twarnings.push({ applied: false, key, message: expectedAttributeMessage(value, unresolvedVariableMessage) })\n\t}\n\n\tif (isNullString(link.openInNewTab)) {\n\t\tresult.openInNewTab = null\n\t} else if (looksLikeVariableReference(link.openInNewTab)) {\n\t\tconst varReference = resolveVariableRef(link.openInNewTab, \"link.openInNewTab\")\n\t\tif (varReference) result.openInNewTab = varReference\n\t} else if (isBooleanString(link.openInNewTab)) {\n\t\tresult.openInNewTab = link.openInNewTab === \"true\"\n\t} else if (isString(link.openInNewTab)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"link.openInNewTab\",\n\t\t\tmessage: expectedAttributeMessage(link.openInNewTab, expectedBooleanValue),\n\t\t})\n\t}\n\n\tif (isNullString(link.trackingId)) {\n\t\tresult.clickTrackingId = null\n\t} else if (looksLikeVariableReference(link.trackingId)) {\n\t\tconst varReference = resolveVariableRef(link.trackingId, \"link.trackingId\")\n\t\tif (varReference) result.clickTrackingId = varReference\n\t} else if (isString(link.trackingId)) {\n\t\tconst trimmed = link.trackingId.trim()\n\t\tif (trimmed.includes(\" \")) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"link.trackingId\",\n\t\t\t\tmessage: expectedAttributeMessage(link.trackingId, expectedIdentifierWithoutSpaces),\n\t\t\t})\n\t\t} else {\n\t\t\tresult.clickTrackingId = trimmed\n\t\t}\n\t}\n\n\tif (isNullString(link.smoothScroll)) {\n\t\tresult.smoothScroll = null\n\t} else if (looksLikeVariableReference(link.smoothScroll)) {\n\t\tconst varReference = resolveVariableRef(link.smoothScroll, \"link.smoothScroll\")\n\t\tif (varReference) result.smoothScroll = varReference\n\t} else if (isBooleanString(link.smoothScroll)) {\n\t\tresult.smoothScroll = link.smoothScroll === \"true\"\n\t} else if (isString(link.smoothScroll)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"link.smoothScroll\",\n\t\t\tmessage: expectedAttributeMessage(link.smoothScroll, expectedBooleanValue),\n\t\t})\n\t}\n\n\tif (isNullString(link.rel)) {\n\t\tresult.relValues = null\n\t} else if (looksLikeVariableReference(link.rel)) {\n\t\tconst varReference = resolveVariableRef(link.rel, \"link.rel\")\n\t\tif (varReference) result.relValues = varReference\n\t} else if (isString(link.rel)) {\n\t\tconst allValues = link.rel.split(\" \")\n\t\tconst validRelValues = allValues.filter(isSupportedLinkRelValue)\n\t\tconst invalidRelValues = allValues.filter(v => v && !isSupportedLinkRelValue(v))\n\t\tif (validRelValues.length > 0) {\n\t\t\tresult.relValues = validRelValues\n\t\t}\n\t\tif (invalidRelValues.length > 0) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: validRelValues.length > 0,\n\t\t\t\tkey: \"link.rel\",\n\t\t\t\tmessage: expectedAttributeMessage(\n\t\t\t\t\tinvalidRelValues.join(\" \"),\n\t\t\t\t\t`only supported values: ${supportedLinkRelValues.join(\", \")}`,\n\t\t\t\t),\n\t\t\t})\n\t\t}\n\t}\n\n\tif (isNullString(link.preserveParams)) {\n\t\tresult.preserveParams = null\n\t} else if (looksLikeVariableReference(link.preserveParams)) {\n\t\tconst varReference = resolveVariableRef(link.preserveParams, \"link.preserveParams\")\n\t\tif (varReference) result.preserveParams = varReference\n\t} else if (isBooleanString(link.preserveParams)) {\n\t\tresult.preserveParams = link.preserveParams === \"true\"\n\t} else if (isString(link.preserveParams)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"link.preserveParams\",\n\t\t\tmessage: expectedAttributeMessage(link.preserveParams, expectedBooleanValue),\n\t\t})\n\t}\n\n\treturn result\n}\n\n/** Picks `update` if provided, clears to `fallback` if explicitly nulled, otherwise keeps `existing`. */\nfunction pickOrClear<T>(update: T | null | undefined, existing: T | undefined, fallback: T): T {\n\tif (isNull(update)) return fallback\n\treturn update ?? existing ?? fallback\n}\n\n/**\n * Merges parsed sub-properties with existing LinkAttrs, using the effective link.\n * Properties not provided in `parsed` (undefined) fall back to `existing`.\n * Properties explicitly cleared in `parsed` (null) reset to defaults.\n */\nfunction mergeLinkAttrs(\n\teffectiveLink: Link | VariableReference,\n\tparsed: ParsedLinkSubProperties,\n\texisting: LinkAttrs | undefined,\n\tinheritedLinkStylePreset?: string,\n): LinkAttrs {\n\treturn {\n\t\tlink: effectiveLink,\n\t\tlinkStylePreset: existing?.linkStylePreset ?? inheritedLinkStylePreset,\n\t\topenInNewTab: pickOrClear(parsed.openInNewTab, existing?.openInNewTab, false), // ProseMirror schema requires boolean\n\t\tsmoothScroll: pickOrClear(parsed.smoothScroll, existing?.smoothScroll, false), // ProseMirror schema requires boolean\n\t\tclickTrackingId: pickOrClear(parsed.clickTrackingId, existing?.clickTrackingId, undefined),\n\t\trelValues: pickOrClear(parsed.relValues, existing?.relValues, undefined),\n\t\tpreserveParams: pickOrClear(parsed.preserveParams, existing?.preserveParams, undefined),\n\t}\n}\n\nfunction parsedToWithLinkUpdate(parsed: ParsedLinkSubProperties): WithLinkUpdate {\n\tconst result: WithLinkUpdate = {}\n\n\tif (!isUndefined(parsed.openInNewTab)) result.linkOpenInNewTab = parsed.openInNewTab ?? undefined\n\tif (!isUndefined(parsed.smoothScroll)) result.linkSmoothScroll = parsed.smoothScroll ?? undefined\n\tif (!isUndefined(parsed.clickTrackingId)) result.linkClickTrackingId = parsed.clickTrackingId ?? undefined\n\tif (!isUndefined(parsed.relValues)) result.linkRelValues = parsed.relValues ?? undefined\n\tif (!isUndefined(parsed.preserveParams)) result.linkPreserveParams = parsed.preserveParams ?? undefined\n\n\treturn result\n}\n\nfunction resolveHref(\n\thref: unknown,\n\tresolveNode: CanvasNode,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n): ResolveHrefResult | undefined {\n\tconst engine = ctx.hooks.getEngine()\n\tassert(engine, \"Engine is required to resolve href values\")\n\treturn resolveLinkHref(\n\t\thref,\n\t\tresolveNode,\n\t\t{ engine, dynamicValues: ctx.dynamicValues, treeResolver: ctx.treeResolver },\n\t\twarning => {\n\t\t\twarnings.push(warning)\n\t\t},\n\t)\n}\n\ninterface ResolveHrefContext {\n\tengine: VekterEngine\n\tdynamicValues: AgentContext[\"dynamicValues\"]\n\ttreeResolver: AgentContext[\"treeResolver\"]\n}\nexport function resolveLinkHref(\n\thref: unknown,\n\tresolveNode: CanvasNode,\n\tresolveHrefContext: ResolveHrefContext,\n\tonWarning: (warning: TraitWarning) => void,\n): ResolveHrefResult | undefined {\n\tif (isUndefined(href)) return undefined\n\n\tif (!isString(href)) {\n\t\tonWarning({\n\t\t\tapplied: false,\n\t\t\tkey: \"link.href\",\n\t\t\tmessage: expectedAttributeMessage(href, definition.link.href.description),\n\t\t})\n\t\treturn undefined\n\t}\n\n\tif (looksLikeVariableReference(href)) {\n\t\tconst handle = resolveHrefContext.dynamicValues.getVariableReferenceHandleByVariableId(href)\n\t\tconst varReference = handle?.reference(resolveNode)\n\t\tif (varReference) return { newLink: varReference }\n\t\tonWarning({\n\t\t\tapplied: false,\n\t\t\tkey: \"link.href\",\n\t\t\tmessage: expectedAttributeMessage(href, unresolvedVariableMessage),\n\t\t})\n\t\treturn undefined\n\t}\n\n\treturn resolveLinkHrefString(href, resolveNode, resolveHrefContext, onWarning) ?? undefined\n}\n\nfunction resolveLinkHrefString(\n\tvalue: string,\n\tnode: CanvasNode,\n\tresolveHrefContext: ResolveHrefContext,\n\tonWarning: (warning: TraitWarning) => void,\n): ResolveHrefResult | null {\n\tconst { engine, treeResolver } = resolveHrefContext\n\n\t// If it is an external URL, we can return a link with the URL directly without further processing.\n\tif (!isInternalURL(value)) return { newLink: createLink({ url: value }) }\n\n\tconst hashIndex = value.indexOf(\"#\")\n\tconst path = hashIndex >= 0 ? value.slice(0, hashIndex) : value\n\tconst hash = hashIndex >= 0 ? value.slice(hashIndex + 1) : undefined\n\n\t// No hash or path were provided.\n\tif (!hash && !path) {\n\t\tonWarning({\n\t\t\tapplied: false,\n\t\t\tkey: \"link.href\",\n\t\t\tmessage: expectedAttributeMessage(value, \"a page path and/or a valid hash (e.g. /about#team)\"),\n\t\t})\n\t\treturn null\n\t}\n\n\t// When a node hasn't been inserted into the tree yet (deferred insertion), it has no\n\t// ancestors. Use the TreeResolver to find the intended parent so ancestor walks inside\n\t// getLinkToWebPageFromPath (for CMS path variables) still work. The parent itself may be\n\t// the collection data source, so include it in the search.\n\tconst nodeForAncestorLookup = engine.tree.has(node.id) ? node : (treeResolver.getParentNode(node) ?? null)\n\n\tlet pageLink: LinkToWebPage | undefined\n\tif (path) {\n\t\tpageLink = getLinkToWebPageFromPath(path, engine, nodeForAncestorLookup, { includeSelf: true })\n\t} else if (hash) {\n\t\t// If a hash is provided without a path, we assume it's a link to a scroll target on the current\n\t\t// page. Try to resolve the page, otherwise bail.\n\t\tconst scope = engine.tree.getCanvasScopeNodeFor(node)\n\t\tif (!scope || !isWebPageNode(scope)) {\n\t\t\tonWarning({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"link.href\",\n\t\t\t\tmessage: invalidAttributeMessage(\n\t\t\t\t\tvalue,\n\t\t\t\t\t\"Hash links without a path are only supported for nodes inside web pages\",\n\t\t\t\t),\n\t\t\t})\n\t\t\treturn null\n\t\t}\n\t\tpageLink = createLink({ webPageId: scope.id })\n\t}\n\n\t// If we can't resolve the link to an internal page, return\n\tif (!pageLink) {\n\t\tif (\n\t\t\thasSegmentWithPathVariableShape(path) &&\n\t\t\t!(nodeForAncestorLookup && hasCollectionDataSourceAncestor(nodeForAncestorLookup, { includeSelf: true }))\n\t\t) {\n\t\t\tonWarning({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"link.href\",\n\t\t\t\tmessage: invalidAttributeMessage(\n\t\t\t\t\tvalue,\n\t\t\t\t\t`Dynamic path variables like \":slug\" only work for nodes inside a CMS Collection List`,\n\t\t\t\t),\n\t\t\t})\n\t\t\treturn null\n\t\t}\n\n\t\tthrow new DeferTraitError(\n\t\t\texpectedAttributeMessage(value, \"a path to an existing page in the project, but one could not be found\"),\n\t\t)\n\t}\n\n\t// If we resolved a page but there is no hash, return the page link.\n\tif (!hash) return { newLink: pageLink }\n\n\t// Try to resolve the hash into a scroll target on the page.\n\tconst targetNodeId = findScrollTargetIdForHash(pageLink.webPageId, `#${hash}`, engine)\n\n\t// If we can't find a matching scroll target, return the page link without a hash and signal for deferral.\n\tif (!targetNodeId) {\n\t\treturn {\n\t\t\tnewLink: pageLink,\n\t\t\thashUnresolvedReason: invalidAttributeMessage(\n\t\t\t\tvalue,\n\t\t\t\t`Path is valid, but hash discarded because a scroll target with ${keyValueReference(\"elementId\", hash)} could not be found on the page \"${resolveLinkToURL(engine.tree, pageLink) ?? path}\"`,\n\t\t\t),\n\t\t}\n\t}\n\t// Create link with scroll target.\n\treturn { newLink: createLink({ ...pageLink, hash: targetNodeId }) }\n}\n\nfunction warnMissingHrefForSubProperties(\n\tlink: Record<string, unknown>,\n\treason: string,\n\twarnings: TraitWarning[],\n): void {\n\tconst otherProvidedKeys = objectKeys(definition.link).filter(key => key !== \"href\" && hasOwn(link, key))\n\tif (otherProvidedKeys.length === 0) return\n\tfor (const key of otherProvidedKeys) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: `link.${key}`,\n\t\t\tmessage: `${escapeValue(`link.${key}`)} ignored because ${reason}.`,\n\t\t})\n\t}\n}\n\n// --------------------------------\n// To Attributes\n// --------------------------------\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: CanvasNode | null | undefined,\n\tctx: AgentContext,\n): DSLAttributes | undefined {\n\tif (isVirtualRichTextTextRun(node)) return virtualRunToAttributes(node, ctx)\n\tif (isVirtualRichTextNode(node)) return\n\tif (isRichTextNode(node)) return richTextNodeToAttributes(node, ctx)\n\tif (withLink(node)) return normalNodeToAttributes(node, ctx)\n}\n\nfunction virtualRunToAttributes(node: VirtualRichTextTextRun, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!node.linkAttrs) return\n\tconst result = linkAttrsToDSLAttributes(node.linkAttrs, node, ctx)\n\tif (isEmptyObject(result)) return\n\treturn { link: result }\n}\n\nfunction richTextNodeToAttributes(node: RichTextNode, ctx: AgentContext): DSLAttributes | undefined {\n\tconst uniformLinkAttrs = ctx.virtualText.getDocument(node.id)?.linkAttrs\n\tif (!uniformLinkAttrs) return\n\n\tconst result = linkAttrsToDSLAttributes(uniformLinkAttrs, node, ctx)\n\tif (isEmptyObject(result)) return\n\n\treturn { link: result }\n}\n\nfunction normalNodeToAttributes(node: CanvasNode & WithLink, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!hasLink(node)) return\n\n\tconst result = linkAttrsToDSLAttributes(\n\t\t{\n\t\t\tlink: node.getLink(),\n\t\t\topenInNewTab: node.linkOpenInNewTab,\n\t\t\tsmoothScroll: node.linkSmoothScroll,\n\t\t\tclickTrackingId: node.linkClickTrackingId,\n\t\t\trelValues: node.linkRelValues,\n\t\t\tpreserveParams: node.linkPreserveParams,\n\t\t},\n\t\tnode,\n\t\tctx,\n\t)\n\n\tif (isEmptyObject(result)) return\n\n\treturn { link: result }\n}\n\nfunction linkAttrsToDSLAttributes(\n\tlinkAttrs: Partial<Record<keyof LinkAttrs, unknown>>,\n\tnode: CanvasNode | VirtualRichTextTextRun,\n\tctx: AgentContext,\n): Partial<DSLLink> {\n\tconst result: Partial<DSLLink> = {}\n\n\tif (isVariableReference(linkAttrs.link)) {\n\t\tresult.href = ctx.dynamicValues.resolveAttributeFromDynamicValue(linkAttrs.link, node)\n\t} else if (isLink(linkAttrs.link)) {\n\t\tconst href = resolveLinkToURL(ctx.treeStore.tree, linkAttrs.link)\n\t\tif (href) result.href = href\n\t}\n\n\tif (isVariableReference(linkAttrs.openInNewTab)) {\n\t\tresult.openInNewTab = ctx.dynamicValues.resolveAttributeFromDynamicValue(linkAttrs.openInNewTab, node)\n\t} else if (linkAttrs.openInNewTab === true) {\n\t\tresult.openInNewTab = true\n\t}\n\n\tif (isVariableReference(linkAttrs.smoothScroll)) {\n\t\tresult.smoothScroll = ctx.dynamicValues.resolveAttributeFromDynamicValue(linkAttrs.smoothScroll, node)\n\t} else if (linkAttrs.smoothScroll === true) {\n\t\tresult.smoothScroll = true\n\t}\n\n\tif (isVariableReference(linkAttrs.clickTrackingId)) {\n\t\tresult.trackingId = ctx.dynamicValues.resolveAttributeFromDynamicValue(linkAttrs.clickTrackingId, node)\n\t} else if (isString(linkAttrs.clickTrackingId) && linkAttrs.clickTrackingId) {\n\t\tresult.trackingId = linkAttrs.clickTrackingId\n\t}\n\n\tif (isVariableReference(linkAttrs.relValues)) {\n\t\tresult.rel = ctx.dynamicValues.resolveAttributeFromDynamicValue(linkAttrs.relValues, node)\n\t} else if (isArray(linkAttrs.relValues) && linkAttrs.relValues.length > 0) {\n\t\tresult.rel = linkAttrs.relValues.join(\" \")\n\t}\n\n\tif (isVariableReference(linkAttrs.preserveParams)) {\n\t\tresult.preserveParams = ctx.dynamicValues.resolveAttributeFromDynamicValue(linkAttrs.preserveParams, node)\n\t} else if (linkAttrs.preserveParams === true) {\n\t\tresult.preserveParams = true\n\t}\n\n\treturn result\n}\n\nexport const link = {\n\tfor: node => withLink(node) || isRichTextNode(node),\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<DSLLinkAttributes>\n\nexport const virtualLink = {\n\tfor: isVirtualRichTextTextRun,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies VirtualNodeTraitDefinition<DSLLinkAttributes>\n", "import { type FontSourceName, FontSourceNames, type ReadonlyFontFamily } from \"library/render/fonts/types.ts\"\n\n/** Fonts that are deprecated and should not be visible in the UI unless they are currently selected. */\nconst deprecatedGoogleFonts = [\n\t\"Inter\",\n\t\"Inter Tight\",\n\t// As of July 2024, we prioritized Fontshare over Google Fonts to support OpenType features.\n\t\"Anton\",\n\t\"Archivo\",\n\t\"Asap\",\n\t\"Azeret Mono\",\n\t\"Ballet\",\n\t\"Be Vietnam Pro\",\n\t\"Bebas Neue\",\n\t\"Crimson Pro\",\n\t\"Dancing Script\",\n\t\"Epilogue\",\n\t\"Familjen Grotesk\",\n\t\"Fira Sans\",\n\t\"Halant\",\n\t\"Hind\",\n\t\"JetBrains Mono\",\n\t\"Kalam\",\n\t\"Karla\",\n\t\"Karma\",\n\t\"Khand\",\n\t\"Laila\",\n\t\"Literata\",\n\t\"Lobster\",\n\t\"Lora\",\n\t\"Manrope\",\n\t\"Merriweather Sans\",\n\t\"Montserrat\",\n\t\"Nunito\",\n\t\"Oswald\",\n\t\"Outfit\",\n\t\"Plus Jakarta Sans\",\n\t\"Poppins\",\n\t\"Public Sans\",\n\t\"Quicksand\",\n\t\"Rajdhani\",\n\t\"Raleway\",\n\t\"Red Hat Display\",\n\t\"Rozha One\",\n\t\"Sora\",\n\t\"Space Grotesk\",\n\t\"Spline Sans\",\n\t\"Stick No Bills\",\n\t\"Syne\",\n\t\"Teko\",\n\t\"Tillana\",\n\t\"Urbanist\",\n\t\"Work Sans\",\n]\n\nconst deprecatedBuiltInFonts = [\"DESTRA:v0\", \"Destra:v0\", \"bianzhidai:v0\"]\n\nconst deprecatedLocalFonts = [\n\t\"Avenir\",\n\t\"Avenir Next\",\n\t\"Avenir Next Condensed\",\n\t\"Baskerville\",\n\t\"Bodoni 72\",\n\t\"Courier\",\n\t\"Futura\",\n\t\"Gill Sans\",\n\t\"Helvetica\",\n\t\"Helvetica Neue\",\n\t\"Hoefler Text\",\n\t\"Impact\",\n\t\"Lucida Grande\",\n\t\"Menlo\",\n\t\"Monaco\",\n\t\"Optima\",\n\t\"Palatino\",\n\t\"SF Pro Display\",\n\t\"SF Pro Display Condensed\",\n\t\"SF Pro Text\",\n\t\"SF Pro Text Condensed\",\n\t\"SF Pro Icons\",\n\t\"SF Pro Rounded\",\n\t\"Times\",\n]\n\n// For the moment, we only have deprecated Google Fonts, but we could extend this to other sources using their respective selector prefixes.\nconst deprecatedFontIds = new Set([\n\t...deprecatedGoogleFonts.map(font => getDeprecatedFontFamilyId(FontSourceNames.Google, font)),\n\t...deprecatedBuiltInFonts.map(font => getDeprecatedFontFamilyId(FontSourceNames.BuiltIn, font)),\n\t...deprecatedLocalFonts.map(font => getDeprecatedFontFamilyId(FontSourceNames.Local, font)),\n])\n\n/**\n * Filters out the deprecated font families from the given font families. Font families\n * that are deprecated that are currently selected will still be included.\n * @param fontFamilies - The font families to filter.\n * @param selectedFonts - The font selector to check.\n * @returns The filtered font families.\n */\nexport function filterDeprecatedFonts(\n\tfontFamilies: ReadonlyFontFamily[],\n\tselectedFonts: Set<string | undefined>,\n): ReadonlyFontFamily[] {\n\treturn fontFamilies.filter(fontFamily => {\n\t\tconst { source, fonts } = fontFamily\n\n\t\t// Special handling for Custom fonts\n\t\tif (source === FontSourceNames.Custom) return true\n\n\t\tconst isDeprecated = isDeprecatedFontFamily(fontFamily)\n\n\t\t// Check if any of the font's selectors are selected before filtering out\n\t\treturn !isDeprecated || fonts.some(font => selectedFonts.has(font.selector))\n\t})\n}\n\nexport function isDeprecatedFontFamily(fontFamily: ReadonlyFontFamily): boolean {\n\tconst fontId = getDeprecatedFontFamilyId(fontFamily.source, fontFamily.name, fontFamily.version)\n\treturn deprecatedFontIds.has(fontId)\n}\n\nexport function getDeprecatedFontFamilyDisplayName(fontFamily: ReadonlyFontFamily): string {\n\treturn `${fontFamily.name} (Deprecated)`\n}\n\ntype DeprecatedFontFamilyId =\n\t| `deprecated-font:${FontSourceNames}:${string}`\n\t| `deprecated-font:${FontSourceNames}:${string}:${string}`\n\nfunction getDeprecatedFontFamilyId(source: FontSourceName, name: string, version?: string): DeprecatedFontFamilyId {\n\treturn `deprecated-font:${source}:${name}${version ? `:${version}` : \"\"}` as const\n}\n", "import { REGULAR_FONT_WEIGHT } from \"@framerjs/app-shared\"\nimport { isDeprecatedFontFamily } from \"document/components/chrome/shared/FontPopout/utils/deprecatedFonts.ts\"\nimport { getClosestToRegularFont } from \"document/components/utils/getClosestToRegularFont.ts\"\nimport { fontStore } from \"library/index.ts\"\nimport type { Font, FontSourceName, ReadonlyFontFamily } from \"library/render/fonts/types.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\n\nconst fontSources: FontSourceName[] = [\"framer\", \"google\", \"fontshare\", \"custom\", \"builtIn\", \"local\"]\n\nexport function findFontFamilyByName(familyName: string): ReadonlyFontFamily | null {\n\tfor (const source of fontSources) {\n\t\tconst family = fontStore.getFontFamily({\n\t\t\tsource,\n\t\t\tname: familyName,\n\t\t})\n\t\tif (family && !isDeprecatedFontFamily(family)) return family\n\t}\n\treturn null\n}\n\n/**\n * Finds the best matching font selector from a family. Prefers the closest weight with matching\n * style, then closest weight with any style.\n */\nexport function getBestMatchFontSelector(\n\tfontName: string,\n\tfontWeight: number | undefined,\n\tfontStyle: Font[\"style\"],\n): string | undefined {\n\tconst fontFamily = findFontFamilyByName(fontName)\n\tif (!fontFamily) return undefined\n\n\tconst isSingleVariantFamily = fontFamily.fonts.length === 1\n\tconst regularFont = isSingleVariantFamily ? getClosestToRegularFont(fontFamily) : undefined\n\tconst targetWeight = fontWeight ?? REGULAR_FONT_WEIGHT\n\tlet bestMatch: (typeof fontFamily.fonts)[number] | undefined\n\tlet bestDelta = Infinity\n\tlet fallbackMatch: (typeof fontFamily.fonts)[number] | undefined\n\tlet fallbackDelta = Infinity\n\n\tfor (const font of fontFamily.fonts) {\n\t\tconst effectiveWeight = font.weight ?? (font === regularFont ? REGULAR_FONT_WEIGHT : undefined)\n\t\tif (isUndefined(effectiveWeight)) continue\n\n\t\tconst effectiveStyle = font.style ?? (font === regularFont ? \"normal\" : undefined)\n\n\t\tconst delta = Math.abs(effectiveWeight - targetWeight)\n\t\tif (effectiveStyle === fontStyle) {\n\t\t\tif (delta < bestDelta) {\n\t\t\t\tbestDelta = delta\n\t\t\t\tbestMatch = font\n\t\t\t}\n\t\t} else if (delta < fallbackDelta) {\n\t\t\tfallbackDelta = delta\n\t\t\tfallbackMatch = font\n\t\t}\n\t}\n\n\treturn bestMatch?.selector ?? fallbackMatch?.selector\n}\n\ntype StaticFontWeight = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900\nconst staticFontWeights: Set<number> = new Set([100, 200, 300, 400, 500, 600, 700, 800, 900])\n\nfunction isStaticFontWeight(weight: unknown): weight is StaticFontWeight {\n\treturn isNumber(weight) && staticFontWeights.has(weight)\n}\n\ninterface FontSelectorAttributes {\n\tfontName: string\n\tfontWeight: Font[\"weight\"]\n\tfontStyle: Font[\"style\"]\n}\n\nexport function getFontSelector(fontAttributes: FontSelectorAttributes): string | undefined {\n\tconst { fontName, fontWeight, fontStyle } = fontAttributes\n\tif (!fontName) return undefined\n\n\tconst fontFamily = findFontFamilyByName(fontName)\n\tif (!fontFamily) return undefined\n\tif (!isStaticFontWeight(fontWeight)) return undefined\n\n\tconst isSingleVariantFamily = fontFamily.fonts.length === 1\n\tconst regularFont = isSingleVariantFamily ? getClosestToRegularFont(fontFamily) : undefined\n\tconst font = fontFamily.fonts.find(f => {\n\t\tconst effectiveWeight = f.weight ?? (f === regularFont ? REGULAR_FONT_WEIGHT : undefined)\n\t\tconst effectiveStyle = f.style ?? (f === regularFont ? \"normal\" : undefined)\n\t\treturn effectiveWeight === fontWeight && effectiveStyle === fontStyle\n\t})\n\treturn font?.selector\n}\n\nexport function resolveFontSelectorFromFamilyName(\n\tfontName: string,\n\tfontWeight: number | undefined = 400,\n\tfontStyle: Font[\"style\"] = \"normal\",\n): string | undefined {\n\tconst exactSelector = getFontSelector({ fontName, fontWeight, fontStyle })\n\treturn exactSelector ?? getBestMatchFontSelector(fontName, fontWeight, fontStyle)\n}\n", "import { isAssetReference } from \"@framerjs/assets\"\nimport {\n\tasGlobalId,\n\tassert,\n\tassertNever,\n\tisLocalModuleIdentifier,\n\tisModuleExportIdentifier,\n\ttype ModuleExportIdentifierString,\n\tModuleType,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport {\n\tcreateGalleryItem,\n\tgetGalleryImages,\n\tgetImageControlKeyAndDescription,\n\tisGalleryControl,\n} from \"document/components/chrome/contentManagement/utils/arrayGalleryUtils.ts\"\nimport {\n\tcollectionHasItemWithId,\n\tgetReferencedCollectionIdentifierFromControl,\n} from \"document/components/chrome/contentManagement/utils/validateControlPropReference.ts\"\nimport { Slot } from \"document/components/chrome/properties/codeComponentRows/utils/Slot.ts\"\nimport { isCompatibleFileType } from \"document/components/chrome/properties/utils/allowedFileTypes.ts\"\nimport { convertHTMLToCanvasRichText } from \"document/components/chrome/shared/utils/convertHTMLToRichText.ts\"\nimport {\n\tcreateTriggerEventAction,\n\tisTriggerEventAction,\n} from \"document/models/CanvasTree/actions/triggerEventActions.ts\"\nimport type {\n\tCanvasNode,\n\tCanvasTree,\n\tCodeComponentNode,\n\tCollectionItemNode,\n\tNodeID,\n} from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type ShaderNode from \"document/models/CanvasTree/nodes/ShaderNode.ts\"\nimport {\n\tisCodeComponentNode,\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisComponentPresetNode,\n\tisShaderNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isComputedValue } from \"document/models/CanvasTree/traits/ComputedValue.ts\"\nimport { type DynamicValue, isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\tgetFourPixelNumberFromShorthand,\n\tgetFourPixelNumberShorthand,\n\tisPixelNumberShorthand,\n\tisTwoPixelNumberShorthand,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport { isVariableReference, type VariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { BorderValues } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport { type WithControlProps, withControlProps } from \"document/models/CanvasTree/traits/WithControlProps.ts\"\nimport { isCSSCursor } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { type HasLayoutTemplate, hasLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { isArrayControlDescription, isVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { getLink, isLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { parseBoxShadows } from \"document/models/CanvasTree/traits/utils/parseBoxShadowFromStyle.ts\"\nimport { type BoxShadow, isBoxShadowList } from \"document/models/Shadow.ts\"\nimport { fromBorderReactCSSProperties, isBorderValues } from \"document/models/controlProps/BorderControlPropValue.ts\"\nimport { isCollectionControlProp } from \"document/models/controlProps/CollectionControlProp.ts\"\nimport {\n\ttype ArrayValue,\n\ttype ControlProp,\n\ttype FileControlProp,\n\ttype ImageControlProp,\n\tisArrayValue,\n\tisImageControlProp,\n\tisObjectControlProp,\n\tisPercentageValue,\n\tisStaticArrayControlPropValue,\n\ttype SlotControlItem,\n} from \"document/models/controlProps/ControlProp.ts\"\nimport { defaultFontValuesForOptionalKeys, isRawFontValue } from \"document/models/controlProps/FontControlPropValue.ts\"\nimport {\n\tcontainsPrefixedControlProp,\n\tisPrefixedControlPropKey,\n\tprefixControlPropKey,\n} from \"document/models/controlProps/controlPropKey.ts\"\nimport { filterComponentPresetControls } from \"document/models/controlProps/filterComponentPresetControls.ts\"\nimport { getControlProps } from \"document/models/controlProps/getControlProps.ts\"\nimport { isValidURL } from \"document/utils/domainValidation.ts\"\nimport { type ArrayControlDescription, type ControlDescription, ControlType, fontStore } from \"library/index.ts\"\nimport type { AllowedFileTypes, Border } from \"library/render/types/PropertyControls.ts\"\nimport { singleBoxShadowToCSS } from \"utils/boxShadowToCSS.ts\"\nimport { resolveLinkToURL } from \"utils/resolveLink.ts\"\nimport { tryParseJSON } from \"utils/tryParseJSON.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isArray, isBooleanString, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { getMediaTypeFromURL } from \"utils/url.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { extensions as imageAllowedFileTypes } from \"web/lib/images/supportedFormats.ts\"\nimport { verifyPropertyControls } from \"../../../../../../runtime/src/sandbox/componentLoader/verifyPropertyControls.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport {\n\tbuildControlDefinitionMappings,\n\ttype ControlsHandle,\n\tgetControlsHandle,\n} from \"../context/controlDefinitions.ts\"\nimport { createCSSVariable, type DynamicValueHandle, isVariableReferenceHandle } from \"../context/dynamicValues.ts\"\nimport { metadataTags } from \"../context/metadataTags.ts\"\nimport {\n\tisVirtualRichTextTextComponentInstance,\n\tvirtualRichTextComponentInstanceAliasPrefix,\n\ttype VirtualRichTextNode,\n\ttype VirtualRichTextTextComponentInstance,\n} from \"../context/richtext/document.ts\"\nimport {\n\tcreateCollectionItemControlPropHandle,\n\tcreateComponentControlPropHandle,\n\tcreateRichTextTarget,\n\tcreateTextComponentInstanceControlPropHandle,\n} from \"../context/richtext/targets.ts\"\nimport { getTextComponentInstanceControlResolver } from \"../context/richtext/textComponentControls.ts\"\nimport { ComponentNodeClass, TextComponentInstanceClass } from \"../dsl.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { COMPONENT_DEFINITION_QUERY, SHADER_DEFINITION_QUERY } from \"../tools/readProjectQueryTypes.ts\"\nimport {\n\tapplyArrayAttributePatch,\n\ttype ArrayParsePatchItemCallback,\n\tassetReferenceToURL,\n\tisNullString,\n\tnullString,\n\tparseBorderShorthand,\n} from \"./helpers.ts\"\nimport {\n\tdisallowedFileTypeMessage,\n\tunavailableEnumOptionMessage,\n\tunsupportedValueForColorControl,\n\tuntrustedUrlMessage,\n} from \"./invalidValues.ts\"\nimport { resolveLinkHref } from \"./link.ts\"\nimport { resolveFontSelectorFromFamilyName } from \"./textStyle/fontSelector.ts\"\nimport { arrayItemDescription, attributeHasGradient, imageDescription } from \"./traitDescriptions.ts\"\nimport {\n\ttype DSLAttributes,\n\ttype DSLAttributeValue,\n\tgetDSLClassesForNode,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitSerializers,\n\ttype TraitWarning,\n\ttype VirtualNodeTraitDefinition,\n} from \"./types.ts\"\n\n/** A control attribute value that is either a plain string or serialized rich text blocks for the AI context. */\ntype ControlAttributeValue = DSLAttributeValue\ntype RawFontValue = Parameters<typeof defaultFontValuesForOptionalKeys>[1]\n\ninterface StructuredImageControlAttributeValue extends DSLAttributes {\n\tsrc?: DSLAttributeValue\n\talt?: DSLAttributeValue\n}\n\ninterface ArrayControlPathSegment {\n\ttype: \"array\"\n\titemId: string\n}\n\ninterface ObjectControlPathSegment {\n\ttype: \"object\"\n\tkey: string\n}\n\ntype UploadControlPathSegment = ArrayControlPathSegment | ObjectControlPathSegment\n\ninterface ControlUpload {\n\tvalue: string\n\tpath: readonly UploadControlPathSegment[]\n\tallowedFileTypes: AllowedFileTypes\n}\n\nfunction isLocalSmartComponentIdentifier(identifier: ModuleExportIdentifierString): boolean {\n\tif (!isLocalModuleIdentifier(identifier)) return false\n\tconst parsed = parseModuleIdentifier(identifier)\n\treturn parsed.type === ModuleType.Canvas\n}\n\nfunction isImageControlType(type: ControlType): type is ControlType.Image | ControlType.ResponsiveImage {\n\treturn type === ControlType.Image || type === ControlType.ResponsiveImage\n}\n\nfunction isStructuredImageControlAttributeValue(value: unknown): value is StructuredImageControlAttributeValue {\n\treturn isObject(value) && (!isUndefined(value.src) || !isUndefined(value.alt))\n}\n\nfunction isValidSlotReferenceForAgent(scopeNodeId: NodeID, referencedNode: CanvasNode, ctx: AgentContext): boolean {\n\tconst parent = ctx.treeResolver.getParentNode(referencedNode)\n\tif (parent?.id !== scopeNodeId) return false\n\treturn Slot.isValidSlotTarget(ctx.treeResolver.getLookupTree(), referencedNode)\n}\n\nexport interface ControlValueContext {\n\tvectorSets: AgentContext[\"vectorSets\"]\n\tdynamicValues: AgentContext[\"dynamicValues\"]\n\tfiles: AgentContext[\"files\"]\n\ttokens: AgentContext[\"tokens\"]\n\ttree: CanvasTree\n\tnode: CanvasNode | VirtualRichTextNode\n}\n\nfunction getControlValueContext(ctx: AgentContext, node: CanvasNode | VirtualRichTextNode): ControlValueContext {\n\treturn {\n\t\tvectorSets: ctx.vectorSets,\n\t\tdynamicValues: ctx.dynamicValues,\n\t\tfiles: ctx.files,\n\t\ttokens: ctx.tokens,\n\t\ttree: ctx.treeResolver.getLookupTree(),\n\t\tnode,\n\t}\n}\n\nexport function getValueForControl(\n\tidentifier: ModuleExportIdentifierString,\n\tcontrolKey: string,\n\tcontrol: ControlDescription,\n\tcontrolProp: ControlProp,\n\tcontext: ControlValueContext,\n): ControlAttributeValue | undefined {\n\tconst { vectorSets, dynamicValues, files, tokens, tree, node } = context\n\tconst { value } = controlProp\n\n\tif (control.type === ControlType.VectorSetItem) {\n\t\tif (isVariableReference(value)) return dynamicValues.resolveAttributeFromDynamicValue(value, node)\n\t\tif (!isString(value) || !isModuleExportIdentifier(value)) return\n\t\treturn vectorSets.forInstanceIdentifier(value)?.getName()\n\t}\n\n\tif (control.type === ControlType.EventHandler && isArray(value)) {\n\t\tconst [action] = value\n\t\tif (value.length === 1 && isTriggerEventAction(action) && isString(action.controls.id?.value)) {\n\t\t\treturn createCSSVariable(action.controls.id.value)\n\t\t}\n\t}\n\n\t// When we are resolving a local Smart Component's Variant control, we need to resolve the variant\n\t// id to a Name. We don't use the tree to avoid loading the scope.\n\tif (\n\t\tisString(value) &&\n\t\tcontrol.type === ControlType.Enum &&\n\t\tcontrolKey === \"variant\" &&\n\t\tisLocalSmartComponentIdentifier(identifier)\n\t) {\n\t\tassert(control.optionTitles, \"Variant control must have option titles\")\n\n\t\tconst index = control.options.indexOf(value)\n\t\tif (index === -1) return\n\t\treturn control.optionTitles[index]\n\t}\n\n\tif (isString(value) && control.type === ControlType.Enum && controlKey !== \"variant\") {\n\t\tconst index = control.options.indexOf(value)\n\t\tif (index === -1) return\n\t\treturn control.optionTitles?.[index] ?? value\n\t}\n\n\tif (isImageControlType(control.type) && isImageControlProp(controlProp)) {\n\t\treturn serializeImageControlPropValue(controlProp, context)\n\t}\n\n\tif (isDynamicValue(value)) return dynamicValues.resolveAttributeFromDynamicValue(value, node)\n\tif (control.type === ControlType.Link) {\n\t\tconst link = getLink(value)\n\t\tif (!isLink(link)) return\n\t\treturn resolveLinkToURL(tree, link)\n\t}\n\tif (control.type === ControlType.FusedNumber && controlProp.type === ControlType.FusedNumber) {\n\t\tconst [top, right, bottom, left] = controlProp.value.fused\n\t\treturn controlProp.isFused\n\t\t\t? getFourPixelNumberShorthand({ perSide: true, top, right, bottom, left })\n\t\t\t: `${controlProp.value.single}px`\n\t}\n\tif (control.type === ControlType.Border) {\n\t\treturn serializeBorderControlValue(value, tokens)\n\t}\n\tif (control.type === ControlType.BoxShadow && isBoxShadowList(value)) {\n\t\treturn value.map(shadow => singleBoxShadowToCSS(shadow, color => tokens.resolve(color)?.toCSS()))\n\t}\n\tif (control.type === ControlType.File && isString(value) && isAssetReference(value)) {\n\t\tconst url = assetReferenceToURL(value)\n\t\tfiles?.registerTrustedUrl(url, value)\n\t\treturn url\n\t}\n\tconst galleryImageControlKey = getGalleryImageControlKey(control)\n\tif (galleryImageControlKey && isArray(value) && value.every(isArrayValue)) {\n\t\treturn serializeGalleryImages(value, galleryImageControlKey, files)\n\t}\n\n\tif (control.type === ControlType.Color && isString(value)) {\n\t\treturn tokens.resolve(value)?.toCSS() ?? value\n\t}\n\n\treturn serializeControlValue(value)\n}\n\nfunction serializeBorderControlValue(value: unknown, tokens: AgentContext[\"tokens\"]): string | undefined {\n\tif (value === null) return nullString\n\tif (!isBorderValues(value)) return\n\n\tconst borderColor = tokens.resolve(value.borderColor)?.toCSS() ?? value.borderColor\n\treturn `${value.borderWidth}px ${value.borderStyle} ${borderColor}`\n}\n\nfunction parseBorderControlValue(value: string, ctx: AgentContext): BorderValues | undefined {\n\tconst parsed = parseBorderShorthand(value, ctx)\n\tif (!parsed || isUndefined(parsed.width) || !parsed.style || !parsed.color) return\n\n\tconst border: Border = {\n\t\tborderWidth: parsed.width,\n\t\tborderStyle: parsed.style,\n\t\tborderColor: parsed.color,\n\t}\n\n\treturn fromBorderReactCSSProperties(border)\n}\n\nfunction serializeControlValue(value: unknown): string | undefined {\n\tif (isUndefined(value)) return undefined\n\treturn isString(value) ? value : JSON.stringify(value)\n}\n\nfunction serializeImageControlSourceValue(value: string | undefined, context: ControlValueContext): string | undefined {\n\tif (!isString(value)) return undefined\n\tif (!isAssetReference(value)) return value\n\n\tconst url = assetReferenceToURL(value)\n\tcontext.files?.registerTrustedUrl(url, value)\n\treturn url\n}\n\nfunction serializeImageControlPropValue(\n\tcontrolProp: ImageControlProp,\n\tcontext: ControlValueContext,\n): ControlAttributeValue | undefined {\n\tif (isDynamicValue(controlProp.value)) {\n\t\treturn context.dynamicValues.resolveAttributeFromDynamicValue(controlProp.value, context.node)\n\t}\n\n\tconst src = serializeImageControlSourceValue(controlProp.value, context)\n\tif (isUndefined(controlProp.alt)) return src\n\n\tconst result: DSLAttributes = {}\n\tif (!isUndefined(src)) result.src = src\n\tresult.alt = controlProp.alt\n\treturn result\n}\n\nfunction decodeEscapedNewlines(value: string): string {\n\treturn value.replace(/\\\\r\\\\n|\\\\n|\\\\r/gu, \"\\n\")\n}\n\nfunction serializeGalleryImages(\n\tvalue: ArrayValue[],\n\timageKey: string,\n\tfiles: AgentContext[\"files\"],\n): string | undefined {\n\tconst galleryImages = getGalleryImages(value, imageKey).map(image => {\n\t\tif (!isString(image) || !isAssetReference(image)) return image\n\t\tconst url = assetReferenceToURL(image)\n\t\tfiles?.registerTrustedUrl(url)\n\t\treturn url\n\t})\n\tconst serializedValue = serializeControlValue(galleryImages)\n\tif (!serializedValue) return undefined\n\treturn serializedValue\n}\n\nfunction resolveFontSelectorForControlValue(fontSelector: string): string {\n\tif (fontStore.getFontBySelector(fontSelector)) return fontSelector\n\treturn resolveFontSelectorFromFamilyName(fontSelector) ?? fontSelector\n}\n\nfunction resolveFontControlValue(value: RawFontValue): RawFontValue {\n\treturn {\n\t\t...value,\n\t\tfontSelector: resolveFontSelectorForControlValue(value.fontSelector),\n\t}\n}\n\nfunction getColorControlWarning(\n\tattributeKey: string,\n\trawValue: unknown,\n\tidentifier: ModuleExportIdentifierString | undefined,\n\tvariableHandle: DynamicValueHandle | undefined,\n) {\n\tif (!identifier) return\n\n\tif (isString(rawValue) && attributeHasGradient(rawValue)) {\n\t\treturn unsupportedValueForColorControl(attributeKey, rawValue)\n\t}\n\n\tconst variableValue =\n\t\tisVariableReferenceHandle(variableHandle) && isVariableDefinition(variableHandle.variable)\n\t\t\t? variableHandle.variable.initialValue\n\t\t\t: undefined\n\tif (isString(variableValue) && attributeHasGradient(variableValue)) {\n\t\treturn unsupportedValueForColorControl(attributeKey, rawValue)\n\t}\n}\n\ninterface ResolvedControlOptions {\n\tcodeComponentIdentifier?: ModuleExportIdentifierString\n\tvectorSetModuleId?: string\n}\n\ninterface AttributeResolver {\n\tcontrols: ControlsHandle\n\tresolveOptions?: (controlKey: string, control: ControlDescription) => ResolvedControlOptions | undefined\n\tgetControlProps: () => Readonly<Record<string, ControlProp>> | undefined\n\tsetControlProp: (key: string, controlProp: ControlProp) => void\n\ttoAttributeEntry: (\n\t\tcontrolKey: string,\n\t\tcontrolProp: ControlProp,\n\t\tserializers: TraitSerializers,\n\t) => Promise<[key: string, value: ControlAttributeValue] | undefined>\n\tvalidateControlPropValue: (controlKey: string, controlProp: ControlProp, onError: (error: Error) => void) => boolean\n}\n\ntype ComponentType = \"component\" | \"componentPreset\" | \"icon\" | \"textComponentInstance\" | \"unknown\"\n\ninterface ControlResolutionTarget {\n\tid: string\n\treferenceNode: CanvasNode\n\tdslTypes: readonly string[]\n\tcomponentType: ComponentType\n}\n\ninterface ResolveControlPropsOptions {\n\tdecodeStringControlEscapedNewlines?: boolean\n}\n\ninterface AttributeResolverOptions {\n\tdeferUntilLoaded?: boolean\n}\n\nfunction getAttributeResolver(\n\tnode: CanvasNode,\n\tctx: AgentContext,\n\toptions: AttributeResolverOptions = { deferUntilLoaded: true },\n): AttributeResolver | undefined {\n\tif (isCollectionItemNode(node)) return getCollectionItemNodeAttributeResolver(node, ctx)\n\tif (isShaderNode(node)) return getShaderNodeAttributeResolver(node, ctx)\n\tif (isCodeComponentNode(node)) return getCodeComponentAttributeResolver(node, ctx, options)\n\tif (isComponentPresetNode(node)) return getComponentPresetAttributeResolver(node, ctx, options)\n\tif (isWebPageNode(node) && hasLayoutTemplate(node)) return getWebPageNodeAttributeResolver(node, ctx)\n}\n\nfunction getComponentPresetAttributeResolver(\n\tnode: ComponentPresetNode,\n\tctx: AgentContext,\n\toptions: AttributeResolverOptions,\n): AttributeResolver | undefined {\n\tif (!isModuleExportIdentifier(node.componentIdentifier)) return\n\n\tconst controls = ctx.components.forIdentifier(node.componentIdentifier, options)?.controls\n\tif (isUndefined(controls)) return\n\n\tconst component = ctx.components.getReactComponentForIdentifier(node.componentIdentifier, ctx.componentLoader)\n\n\tconst propertyControls = filterComponentPresetControls(component ?? null, \"onlyPresets\")\n\t// Don't use the full controls handle here, we only want the preset controls.\n\tconst presetControls = getControlsHandle(buildControlDefinitionMappings(propertyControls), propertyControls)\n\n\treturn {\n\t\tcontrols: presetControls,\n\t\tresolveOptions: () => ({ codeComponentIdentifier: node.componentIdentifier }),\n\t\tgetControlProps: () => getControlProps(propertyControls, node.getRawControlProps()),\n\t\tsetControlProp: (key, value) => {\n\t\t\tnode.setControlProp(key, value)\n\t\t},\n\t\ttoAttributeEntry: async (controlKey, controlProp) => {\n\t\t\tconst controlTitle = presetControls.getControlTitle(controlKey)\n\t\t\tif (!controlTitle) return\n\n\t\t\tconst controlDefinition = propertyControls[controlKey]\n\t\t\tif (isUndefined(controlDefinition)) return\n\n\t\t\tconst controlValue = getValueForControl(\n\t\t\t\tnode.componentIdentifier,\n\t\t\t\tcontrolKey,\n\t\t\t\tcontrolDefinition,\n\t\t\t\tcontrolProp,\n\t\t\t\tgetControlValueContext(ctx, node),\n\t\t\t)\n\t\t\tif (isUndefined(controlValue)) return\n\n\t\t\treturn [controlTitle, controlValue]\n\t\t},\n\t\tvalidateControlPropValue: () => true,\n\t}\n}\n\nfunction getCodeComponentAttributeResolver(\n\tnode: CodeComponentNode,\n\tctx: AgentContext,\n\toptions: AttributeResolverOptions,\n): AttributeResolver | undefined {\n\tif (!isModuleExportIdentifier(node.codeComponentIdentifier)) return undefined\n\n\tconst identifier = node.codeComponentIdentifier\n\tconst controls = ctx.components.forIdentifier(node.codeComponentIdentifier, options)?.controls\n\tif (!controls) return undefined\n\n\tconst component = ctx.components.getReactComponentForIdentifier(identifier, ctx.componentLoader)\n\tconst componentProperties = component?.properties\n\t// Newly inserted external vectors have not been evaluated yet, but they share the control\n\t// definitions of the first vector in the set which is guaranteed to be available.\n\tconst propertyControls = controls.properties() ?? componentProperties\n\tif (!propertyControls) return undefined\n\n\treturn {\n\t\t// TODO: move the vector fix to ctx.components and simplify this?\n\t\tcontrols: { ...controls, properties: () => propertyControls },\n\t\tresolveOptions: (_controlKey, control) => ({\n\t\t\tcodeComponentIdentifier: identifier,\n\t\t\tvectorSetModuleId: control.type === ControlType.VectorSetItem ? control.setModuleId : undefined,\n\t\t}),\n\t\tgetControlProps: () => {\n\t\t\tconst properties = ctx.components.getReactComponentForIdentifier(identifier, ctx.componentLoader)?.properties\n\t\t\tif (!properties) return undefined\n\t\t\treturn node.getControlProps(properties)\n\t\t},\n\t\tsetControlProp: (key, value) => {\n\t\t\tnode.setControlProp(key, value)\n\t\t},\n\t\ttoAttributeEntry: async (controlKey, controlProp, serializers) => {\n\t\t\tconst controlTitle = controls.getControlTitle(controlKey)\n\t\t\tif (!controlTitle) return undefined\n\n\t\t\tconst controlDefinition = componentProperties?.[controlKey]\n\t\t\tif (!controlDefinition) return undefined\n\t\t\tif (controlDefinition.type === ControlType.EventHandler) return undefined\n\n\t\t\t// For RichText controls, hydrate and serialize virtual blocks to the AI context format\n\t\t\tif (controlDefinition.type === ControlType.RichText && isString(controlProp.value)) {\n\t\t\t\tif (!componentProperties) return undefined\n\t\t\t\tconst handle = createComponentControlPropHandle(node, controlKey, componentProperties)\n\t\t\t\tconst serialized = await serializers.richText(handle, ctx)\n\t\t\t\tif (serialized) return [controlTitle, serialized]\n\t\t\t}\n\n\t\t\tif (controlDefinition.type === ControlType.Slot && controlProp.type === ControlType.Slot) {\n\t\t\t\t// When slots are materialized as child nodes, the agent already sees them via the\n\t\t\t\t// tree structure, so omit the control attribute to avoid duplication.\n\t\t\t\tif (node.slotsAreChildNodes) return undefined\n\n\t\t\t\tconst scopeNode = ctx.treeResolver.getScopeNodeFor(node.id)\n\t\t\t\tif (!scopeNode) return undefined\n\n\t\t\t\tconst refs: string[] = []\n\t\t\t\tfor (const item of controlProp.value) {\n\t\t\t\t\tif (!isString(item.reference)) continue\n\t\t\t\t\tconst referencedNode = ctx.treeResolver.get(item.reference)\n\t\t\t\t\tif (!referencedNode) continue\n\t\t\t\t\tif (!isValidSlotReferenceForAgent(scopeNode.id, referencedNode, ctx)) continue\n\t\t\t\t\trefs.push(item.reference)\n\t\t\t\t}\n\n\t\t\t\treturn [controlTitle, refs]\n\t\t\t}\n\n\t\t\tconst controlValue = getValueForControl(\n\t\t\t\tidentifier,\n\t\t\t\tcontrolKey,\n\t\t\t\tcontrolDefinition,\n\t\t\t\tcontrolProp,\n\t\t\t\tgetControlValueContext(ctx, node),\n\t\t\t)\n\t\t\tif (isUndefined(controlValue)) return undefined\n\n\t\t\treturn [controlTitle, controlValue]\n\t\t},\n\t\tvalidateControlPropValue: () => true,\n\t}\n}\n\nfunction getWebPageNodeAttributeResolver(\n\tnode: CanvasNode & HasLayoutTemplate & WithControlProps,\n\tctx: AgentContext,\n): AttributeResolver | undefined {\n\tconst identifier = node.layoutTemplateIdentifier\n\tif (!isModuleExportIdentifier(identifier)) return undefined\n\n\tconst controls = ctx.layoutTemplates.forIdentifier(identifier, { deferUntilLoaded: true })?.controls\n\tif (!controls) return undefined\n\n\tconst propertyControls =\n\t\tcontrols.properties() ?? ctx.componentLoader.reactComponentForIdentifier(identifier)?.properties\n\tif (!propertyControls) return undefined\n\n\treturn {\n\t\tcontrols: { ...controls, properties: () => propertyControls },\n\t\tgetControlProps: () => node.getControlProps(propertyControls),\n\t\tsetControlProp: (key, value) => {\n\t\t\tnode.setControlProp(key, value)\n\t\t},\n\t\ttoAttributeEntry: async (controlKey, controlProp) => {\n\t\t\tconst controlTitle = controls.getControlTitle(controlKey)\n\t\t\tif (!controlTitle) return undefined\n\n\t\t\tconst controlDefinition = propertyControls[controlKey]\n\t\t\tif (!controlDefinition) return undefined\n\t\t\tif (controlDefinition.type === ControlType.EventHandler) return undefined\n\t\t\t// @TODO: What about RichText controls?\n\n\t\t\tconst controlValue = getValueForControl(\n\t\t\t\tidentifier,\n\t\t\t\tcontrolKey,\n\t\t\t\tcontrolDefinition,\n\t\t\t\tcontrolProp,\n\t\t\t\tgetControlValueContext(ctx, node),\n\t\t\t)\n\t\t\tif (isUndefined(controlValue)) return undefined\n\n\t\t\treturn [controlTitle, controlValue]\n\t\t},\n\t\tvalidateControlPropValue: () => true,\n\t}\n}\n\nfunction getShaderNodeAttributeResolver(node: ShaderNode, ctx: AgentContext): AttributeResolver | undefined {\n\tconst shader = ctx.shaders.forIdentifier(node.shaderModuleIdentifier)\n\tif (!shader) {\n\t\tctx.deferred.deferUntil(\n\t\t\t() => ctx.shaders.async.forIdentifier(node.shaderModuleIdentifier),\n\t\t\t`Shader definition for \"${node.shaderModuleIdentifier}\" is not loaded`,\n\t\t)\n\t}\n\n\treturn {\n\t\tcontrols: shader.controls,\n\t\tresolveOptions: () => {\n\t\t\treturn {}\n\t\t},\n\t\tgetControlProps: () => {\n\t\t\treturn node.getControlProps(shader.controls.properties())\n\t\t},\n\t\tsetControlProp: (key, value) => {\n\t\t\tnode.setControlProp(key, value)\n\t\t},\n\t\ttoAttributeEntry: async (controlKey, controlProp) => {\n\t\t\tconst controlDefinition = shader.controls.properties()[controlKey]\n\t\t\tif (!controlDefinition) return undefined\n\n\t\t\tif (controlDefinition.type === ControlType.Array && isStaticArrayControlPropValue(controlProp.value)) {\n\t\t\t\tconst controlValues = controlProp.value.flatMap(item => (isString(item.value) ? [item.value] : []))\n\t\t\t\treturn [controlKey, controlValues]\n\t\t\t}\n\n\t\t\tconst controlValue = serializeControlValue(controlProp.value)\n\t\t\tif (isUndefined(controlValue)) return undefined\n\n\t\t\treturn [controlKey, controlValue]\n\t\t},\n\t\tvalidateControlPropValue: () => true,\n\t}\n}\n\nfunction getCollectionItemNodeAttributeResolver(\n\tnode: CollectionItemNode,\n\tctx: AgentContext,\n): AttributeResolver | undefined {\n\tconst parentId = ctx.treeResolver.getParentNode(node)?.id\n\tif (!parentId) return undefined\n\n\tconst collection = ctx.collections.forId(parentId)\n\tif (!collection) return undefined\n\n\tconst { controls } = collection\n\n\treturn {\n\t\tcontrols,\n\t\tresolveOptions: (_controlKey, control) => ({\n\t\t\tvectorSetModuleId: control.type === ControlType.VectorSetItem ? control.setModuleId : undefined,\n\t\t}),\n\t\tgetControlProps: () => node.getControlProps(),\n\t\tsetControlProp: (key, controlProp) => {\n\t\t\tassert(isCollectionControlProp(controlProp), `Type ${controlProp.type} is unsupported in CollectionItemNode`)\n\t\t\tnode.setControlProp(key, controlProp)\n\t\t},\n\t\ttoAttributeEntry: async (controlKey, controlProp, serializers) => {\n\t\t\tconst controlTitle = controls.getControlTitle(controlKey)\n\t\t\tif (!controlTitle) return undefined\n\n\t\t\tconst controlDefinition = controls.properties()?.[controlKey]\n\n\t\t\t// For RichText controls, hydrate and serialize virtual blocks to the AI context format\n\t\t\tif (controlProp.type === ControlType.RichText && isString(controlProp.value)) {\n\t\t\t\tconst handle = createCollectionItemControlPropHandle(node, controlKey)\n\t\t\t\tconst serialized = await serializers.richText(handle, ctx)\n\t\t\t\tif (serialized) return [controlTitle, serialized]\n\t\t\t}\n\n\t\t\tif (controlDefinition && isImageControlType(controlDefinition.type) && isImageControlProp(controlProp)) {\n\t\t\t\tconst controlValue = serializeImageControlPropValue(controlProp, getControlValueContext(ctx, node))\n\t\t\t\tif (isUndefined(controlValue)) return undefined\n\n\t\t\t\treturn [controlTitle, controlValue]\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tcontrolDefinition &&\n\t\t\t\tcontrolDefinition.type === ControlType.File &&\n\t\t\t\tisString(controlProp.value) &&\n\t\t\t\tisAssetReference(controlProp.value)\n\t\t\t) {\n\t\t\t\tconst url = assetReferenceToURL(controlProp.value)\n\t\t\t\tctx.files.registerTrustedUrl(url, controlProp.value)\n\t\t\t\treturn [controlTitle, url]\n\t\t\t}\n\n\t\t\tif (controlDefinition?.type === ControlType.Link) {\n\t\t\t\tconst link = getLink(controlProp.value)\n\t\t\t\tif (isLink(link)) {\n\t\t\t\t\tconst href = resolveLinkToURL(ctx.treeResolver.getLookupTree(), link)\n\t\t\t\t\tif (href) return [controlTitle, href]\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst galleryImageControlKey = controlDefinition ? getGalleryImageControlKey(controlDefinition) : undefined\n\t\t\tif (galleryImageControlKey && isArray(controlProp.value) && controlProp.value.every(isArrayValue)) {\n\t\t\t\tconst serializedValue = serializeGalleryImages(controlProp.value, galleryImageControlKey, ctx.files)\n\t\t\t\tif (!serializedValue) return undefined\n\t\t\t\treturn [controlTitle, serializedValue]\n\t\t\t}\n\n\t\t\tif (controlDefinition?.type === ControlType.Enum) {\n\t\t\t\tif (!isString(controlProp.value)) return undefined\n\t\t\t\tconst index = controlDefinition.options.indexOf(controlProp.value)\n\t\t\t\tconst name = controlDefinition.optionTitles?.[index]\n\t\t\t\tif (!name) return undefined\n\t\t\t\treturn [controlTitle, name]\n\t\t\t}\n\n\t\t\tconst value = serializeControlValue(controlProp.value)\n\t\t\tif (!value) return undefined\n\n\t\t\treturn [controlTitle, value]\n\t\t},\n\t\tvalidateControlPropValue: (controlKey, controlProp, onError) => {\n\t\t\tif (\n\t\t\t\tcontrolProp.type !== ControlType.CollectionReference &&\n\t\t\t\tcontrolProp.type !== ControlType.MultiCollectionReference\n\t\t\t) {\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tif (!isCollectionItemNode(node)) return false\n\n\t\t\tconst parent = ctx.treeResolver.getParentNode(node)\n\t\t\tif (!isCollectionNode(parent)) return false\n\n\t\t\tconst parentControls = parent.getPropertyControls(ctx.treeStore.tree, ctx.componentLoader)\n\t\t\tconst control = parentControls[controlKey]\n\t\t\tif (!control) return false\n\t\t\tconst collectionIdentifier = getReferencedCollectionIdentifierFromControl(control)\n\t\t\tif (!collectionIdentifier) return false\n\n\t\t\tconst values = isArray(controlProp.value) ? controlProp.value : [controlProp.value]\n\t\t\tfor (const value of values) {\n\t\t\t\tif (isString(value) && !collectionHasItemWithId(ctx.treeStore.tree, collectionIdentifier, value)) {\n\t\t\t\t\tonError(new Error(`Referenced collection item \"${value}\" does not exist`))\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true\n\t\t},\n\t}\n}\n\nexport function resolveControlProps(\n\tnode: CanvasNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\tonError: (error: Error) => void,\n\tonWarning: (key: string, message: string) => void = () => {},\n\tresolver = getAttributeResolver(node, ctx),\n): ReadonlyMap<string, ControlProp> {\n\tlet componentType: ComponentType = \"unknown\"\n\tif (isCodeComponentNode(node) && isModuleExportIdentifier(node.codeComponentIdentifier)) {\n\t\tif (ctx.vectorSets.forInstanceIdentifier(node.codeComponentIdentifier)) {\n\t\t\tcomponentType = \"icon\"\n\t\t} else if (ctx.components.forIdentifier(node.codeComponentIdentifier)) {\n\t\t\tcomponentType = \"component\"\n\t\t}\n\t} else if (isComponentPresetNode(node) && isModuleExportIdentifier(node.componentIdentifier)) {\n\t\tif (ctx.components.forIdentifier(node.componentIdentifier)) {\n\t\t\tcomponentType = \"componentPreset\"\n\t\t}\n\t}\n\n\treturn resolveControlPropsForTarget(\n\t\t{\n\t\t\tid: node.id,\n\t\t\treferenceNode: node,\n\t\t\tdslTypes: getDSLClassesForNode(node),\n\t\t\tcomponentType,\n\t\t},\n\t\tattributes,\n\t\tctx,\n\t\tonError,\n\t\tonWarning,\n\t\tresolver,\n\t)\n}\n\nfunction resolveControlPropsForTarget(\n\ttarget: ControlResolutionTarget,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\tonError: (error: Error) => void,\n\tonWarning: (key: string, message: string) => void = () => {},\n\tresolver?: AttributeResolver,\n\tresolutionOptions: ResolveControlPropsOptions = {},\n): ReadonlyMap<string, ControlProp> {\n\tconst resolved = new Map<string, ControlProp>()\n\tif (!resolver) return resolved\n\tconst node = target.referenceNode\n\n\tfor (const controlTitle in attributes) {\n\t\tconst value = attributes[controlTitle]\n\t\tif (!value || !isPrefixedControlPropKey(controlTitle)) continue\n\t\tif (target.componentType === \"icon\" && controlTitle === prefixControlPropKey(\"icon\")) continue\n\n\t\tconst key = resolver.controls.getControlKey(controlTitle)\n\t\tif (!key) {\n\t\t\tonError(getUnknownControlError(target, controlTitle))\n\t\t\tcontinue\n\t\t}\n\n\t\tconst controlDefinition = resolver.controls.properties()?.[key]\n\t\tif (!controlDefinition) {\n\t\t\tonError(getUnknownControlError(target, controlTitle))\n\t\t\tcontinue\n\t\t}\n\n\t\tconst type = controlDefinition.type\n\t\tconst options = resolver.resolveOptions?.(key, controlDefinition)\n\t\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, { node })\n\n\t\tif (resolveHandleResult.type === \"invalid\") {\n\t\t\tonError(new Error(resolveHandleResult.errorMessages.join(\"\\n\")))\n\t\t\tcontinue\n\t\t}\n\n\t\tconst variableHandle = resolveHandleResult.type === \"resolved\" ? resolveHandleResult.handle : undefined\n\t\tconst resolvedValue = variableHandle?.reference(node) ?? value\n\t\tconst resolveControlValueOptions: ResolveControlValueOptions = {\n\t\t\tcontrolTitle,\n\t\t\trawValue: value,\n\t\t\tresolvedValue,\n\t\t\tvariableHandle,\n\t\t\tresolvedOptions: options,\n\t\t\tctx,\n\t\t\tonWarning,\n\t\t\tonError,\n\t\t}\n\n\t\tconst setControlPropValue = (controlKey: string, controlProp: ControlProp) => {\n\t\t\tif (resolver.validateControlPropValue(controlKey, controlProp, onError)) {\n\t\t\t\tresolved.set(controlKey, controlProp)\n\t\t\t}\n\t\t}\n\n\t\tswitch (type) {\n\t\t\tcase ControlType.Enum: {\n\t\t\t\tif (!isString(resolvedValue) && !isDynamicValue(resolvedValue)) break\n\n\t\t\t\tif (isDynamicValue(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tconst enumValue = resolveEnumControlValue(key, resolvedValue, controlDefinition, options, ctx)\n\t\t\t\tif (isUndefined(enumValue) && !isNullString(resolvedValue)) {\n\t\t\t\t\tonWarning(\n\t\t\t\t\t\tcontrolTitle,\n\t\t\t\t\t\tunavailableEnumOptionMessage(\n\t\t\t\t\t\t\tresolvedValue,\n\t\t\t\t\t\t\tcontrolDefinition.optionTitles ?? controlDefinition.options.filter(isString),\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tsetControlPropValue(key, { type, value: enumValue })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Date: {\n\t\t\t\tif (!isString(resolvedValue) && !isDynamicValue(resolvedValue)) break\n\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.TrackingId: {\n\t\t\t\tif (!isString(resolvedValue) && !isVariableReference(resolvedValue)) break\n\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.String: {\n\t\t\t\tif (!isString(resolvedValue) && !isDynamicValue(resolvedValue)) break\n\t\t\t\tsetControlPropValue(key, {\n\t\t\t\t\ttype,\n\t\t\t\t\tvalue:\n\t\t\t\t\t\tisString(resolvedValue) && resolutionOptions.decodeStringControlEscapedNewlines\n\t\t\t\t\t\t\t? decodeEscapedNewlines(resolvedValue)\n\t\t\t\t\t\t\t: resolvedValue,\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.RichText: {\n\t\t\t\tif (isDynamicValue(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (!isString(resolvedValue)) break\n\t\t\t\tsetControlPropValue(key, { type, value: convertHTMLToCanvasRichText(resolvedValue) })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Color: {\n\t\t\t\tconst colorValue = resolveColorControlValue(resolveControlValueOptions)\n\t\t\t\tif (colorValue === Unresolvable) break\n\t\t\t\tif (colorValue === undefined) continue\n\n\t\t\t\tsetControlPropValue(key, { type, value: colorValue })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Cursor: {\n\t\t\t\tif (!isCSSCursor(resolvedValue) && !isVariableReference(resolvedValue)) break\n\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Number: {\n\t\t\t\tif (isDynamicValue(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (!isString(resolvedValue)) break\n\n\t\t\t\tconst parsed = tryParseNumber(resolvedValue)\n\t\t\t\tif (!isNumber(parsed)) break\n\n\t\t\t\tsetControlPropValue(key, { type, value: parsed })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Boolean: {\n\t\t\t\tif (isDynamicValue(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (!isBooleanString(resolvedValue)) break\n\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue === \"true\" })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Gap: {\n\t\t\t\tif (!isTwoPixelNumberShorthand(resolvedValue) && !isDynamicValue(resolvedValue)) break\n\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Padding: {\n\t\t\t\tif (isDynamicValue(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (isPixelNumberShorthand(resolvedValue)) {\n\t\t\t\t\t// Normalize 2-value shorthand to the 1- or 4-value form expected by code components.\n\t\t\t\t\tconst normalized = getFourPixelNumberShorthand(getFourPixelNumberFromShorthand(resolvedValue))\n\t\t\t\t\tsetControlPropValue(key, { type, value: normalized })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ControlType.BorderRadius: {\n\t\t\t\tif (isDynamicValue(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (isPixelNumberShorthand(resolvedValue)) {\n\t\t\t\t\t// Normalize 2-value shorthand to the 1- or 4-value form expected by code components.\n\t\t\t\t\tconst normalized = getFourPixelNumberShorthand(getFourPixelNumberFromShorthand(resolvedValue))\n\t\t\t\t\tsetControlPropValue(key, { type, value: normalized })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (isPercentageValue(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase ControlType.CollectionReference: {\n\t\t\t\tif (isVariableReference(resolvedValue)) break\n\t\t\t\tif (!isString(resolvedValue)) break\n\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.MultiCollectionReference: {\n\t\t\t\tif (isVariableReference(resolvedValue)) break\n\t\t\t\tif (!isArray(resolvedValue) || !resolvedValue.every(isString)) break\n\n\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.VectorSetItem: {\n\t\t\t\tif (isVariableReference(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (!isString(resolvedValue) || !options?.vectorSetModuleId) break\n\t\t\t\tconst setModuleId = asGlobalId(options.vectorSetModuleId)\n\t\t\t\tconst set = ctx.vectorSets.forModuleId(setModuleId)\n\t\t\t\tif (!set) {\n\t\t\t\t\tctx.deferred.deferUntil(\n\t\t\t\t\t\t() => ctx.vectorSets.async.forModuleId(setModuleId),\n\t\t\t\t\t\t`Icon set for \"${controlTitle}\" is not loaded`,\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tconst vectorIdentifier = set.getIdentifierByName(resolvedValue)\n\t\t\t\tif (!vectorIdentifier) break\n\n\t\t\t\tsetControlPropValue(key, { type, value: vectorIdentifier })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Array: {\n\t\t\t\tconst parsePatchItem = getArrayItemParsePatchItem(controlDefinition, node, resolveControlValueOptions)\n\n\t\t\t\tif (!parsePatchItem || !isArray(resolvedValue)) break\n\n\t\t\t\tconst currentControlProp = resolver.getControlProps()?.[key]\n\t\t\t\tconst items = applyArrayAttributePatch({\n\t\t\t\t\tcurrentItems:\n\t\t\t\t\t\tcurrentControlProp?.type === ControlType.Array && isStaticArrayControlPropValue(currentControlProp.value)\n\t\t\t\t\t\t\t? currentControlProp.value\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\tpatch: resolvedValue,\n\t\t\t\t\tparsePatchItem,\n\t\t\t\t})\n\n\t\t\t\tsetControlPropValue(key, { type: ControlType.Array, value: items ?? [] })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Image:\n\t\t\tcase ControlType.ResponsiveImage: {\n\t\t\t\tconst currentControlProp = resolver.getControlProps()?.[key]\n\t\t\t\tconst imageControlProp: ImageControlProp = isImageControlProp(currentControlProp)\n\t\t\t\t\t? currentControlProp\n\t\t\t\t\t: { type: ControlType.Image, value: undefined }\n\n\t\t\t\tif (isStructuredImageControlAttributeValue(value)) {\n\t\t\t\t\tlet nextControlProp = imageControlProp\n\n\t\t\t\t\tconst srcValue = value.src\n\t\t\t\t\tif (!isUndefined(srcValue)) {\n\t\t\t\t\t\tif (isNullString(srcValue)) {\n\t\t\t\t\t\t\tnextControlProp = { type: ControlType.Image, value: undefined }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst srcResolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(srcValue, { node })\n\n\t\t\t\t\t\t\tif (srcResolveHandleResult.type === \"invalid\") {\n\t\t\t\t\t\t\t\tonError(new Error(srcResolveHandleResult.errorMessages.join(\"\\n\")))\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif (srcResolveHandleResult.type === \"resolved\") {\n\t\t\t\t\t\t\t\tconst serializedValue = serializeControlValue(srcValue)\n\t\t\t\t\t\t\t\tonError(\n\t\t\t\t\t\t\t\t\tnew Error(`Value ${serializedValue} is not valid for control \"${controlTitle}.src\" (type: ${type}).`),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tconst imageValue = resolveImageControlValue({\n\t\t\t\t\t\t\t\t...resolveControlValueOptions,\n\t\t\t\t\t\t\t\tcontrolTitle: `${controlTitle}.src`,\n\t\t\t\t\t\t\t\trawValue: srcValue,\n\t\t\t\t\t\t\t\tresolvedValue: srcValue,\n\t\t\t\t\t\t\t\tvariableHandle: undefined,\n\t\t\t\t\t\t\t})\n\n\t\t\t\t\t\t\tif (imageValue === Unresolvable) {\n\t\t\t\t\t\t\t\tconst serializedValue = serializeControlValue(srcValue)\n\t\t\t\t\t\t\t\tonError(\n\t\t\t\t\t\t\t\t\tnew Error(`Value ${serializedValue} is not valid for control \"${controlTitle}.src\" (type: ${type}).`),\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (imageValue === undefined) continue\n\n\t\t\t\t\t\t\tnextControlProp = { ...nextControlProp, value: imageValue }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tconst altValue = value.alt\n\t\t\t\t\tif (!isUndefined(altValue)) {\n\t\t\t\t\t\tif (isNullString(altValue)) {\n\t\t\t\t\t\t\tnextControlProp = { ...nextControlProp, alt: undefined, altLocalized: undefined }\n\t\t\t\t\t\t} else if (isString(altValue)) {\n\t\t\t\t\t\t\tnextControlProp = { ...nextControlProp, alt: altValue }\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tconst serializedValue = serializeControlValue(altValue)\n\t\t\t\t\t\t\tonError(\n\t\t\t\t\t\t\t\tnew Error(`Value ${serializedValue} is not valid for control \"${controlTitle}.alt\" (type: ${type}).`),\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tsetControlPropValue(key, nextControlProp)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (isNullString(value)) {\n\t\t\t\t\tsetControlPropValue(key, { type: ControlType.Image, value: undefined })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tconst imageValue = resolveImageControlValue(resolveControlValueOptions)\n\t\t\t\tif (imageValue === Unresolvable) break\n\t\t\t\tif (imageValue === undefined) continue\n\n\t\t\t\tsetControlPropValue(key, { type: ControlType.Image, value: imageValue })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.File: {\n\t\t\t\tif (isNullString(value)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: undefined })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tconst fileValue = resolveAssetReferenceSupportingControlValue(\n\t\t\t\t\tresolveControlValueOptions,\n\t\t\t\t\tcontrolDefinition.allowedFileTypes,\n\t\t\t\t)\n\t\t\t\tif (fileValue === Unresolvable) break\n\t\t\t\tif (fileValue === undefined) continue\n\n\t\t\t\tsetControlPropValue(key, { type, value: fileValue })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Link: {\n\t\t\t\tif (isDynamicValue(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: resolvedValue })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (isNullString(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: undefined })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (!isString(resolvedValue)) break\n\n\t\t\t\tconst engine = ctx.hooks.getEngine()\n\t\t\t\tassert(engine, `Cannot set Link control \"${controlTitle}\": engine is not available.`)\n\n\t\t\t\tconst resolvedLink = resolveLinkHref(\n\t\t\t\t\tresolvedValue,\n\t\t\t\t\tnode,\n\t\t\t\t\t{ engine, dynamicValues: ctx.dynamicValues, treeResolver: ctx.treeResolver },\n\t\t\t\t\twarning => {\n\t\t\t\t\t\tonWarning(warning.key, warning.message)\n\t\t\t\t\t},\n\t\t\t\t)\n\n\t\t\t\tif (resolvedLink?.newLink) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: resolvedLink?.newLink })\n\t\t\t\t}\n\n\t\t\t\tif (resolvedLink?.hashUnresolvedReason) {\n\t\t\t\t\tthrow new DeferTraitError(resolvedLink.hashUnresolvedReason)\n\t\t\t\t}\n\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// This is deprecated but components like Youtube, Vimeo, and Code Block use it still.\n\t\t\tcase ControlType.FusedNumber: {\n\t\t\t\tif (!isString(resolvedValue) || !isPixelNumberShorthand(resolvedValue)) break\n\n\t\t\t\tconst fused = getFourPixelNumberFromShorthand(resolvedValue)\n\t\t\t\tconst single = fused.all ?? fused.top\n\t\t\t\tconst top = fused.all ?? fused.top\n\t\t\t\tconst right = fused.all ?? fused.right\n\t\t\t\tconst bottom = fused.all ?? fused.bottom\n\t\t\t\tconst left = fused.all ?? fused.left\n\t\t\t\tif (!isNumber(single) || !isNumber(top) || !isNumber(right) || !isNumber(bottom) || !isNumber(left)) {\n\t\t\t\t\tonWarning(controlTitle, `Invalid fused number shorthand \"${resolvedValue}\".`)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tconst isFused = resolvedValue.trim().split(/\\s+/u).length > 1\n\n\t\t\t\tsetControlPropValue(key, {\n\t\t\t\t\ttype,\n\t\t\t\t\tisFused,\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\tsingle,\n\t\t\t\t\t\tfused: [top, right, bottom, left],\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Border: {\n\t\t\t\tif (isNullString(resolvedValue)) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: null })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (!isString(resolvedValue)) break\n\t\t\t\tconst parsed = parseBorderControlValue(resolvedValue, ctx)\n\t\t\t\tif (!parsed) break\n\n\t\t\t\tsetControlPropValue(key, { type, value: parsed })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.BoxShadow: {\n\t\t\t\t// Kept this aligned with the existing boxShadows trait semantics, which are best-effort rather\n\t\t\t\t// than all-or-nothing (ignores invalid values if there are valid ones).\n\t\t\t\tif (!isArray(resolvedValue)) break\n\t\t\t\tif (resolvedValue.length === 0) {\n\t\t\t\t\tsetControlPropValue(key, { type, value: [] })\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tconst parsed: BoxShadow[] = []\n\t\t\t\tfor (const item of resolvedValue) {\n\t\t\t\t\tif (!isString(item)) break\n\t\t\t\t\tconst shadows = parseBoxShadows(item)\n\t\t\t\t\tif (shadows.length === 0) break\n\t\t\t\t\tparsed.push(...shadows)\n\t\t\t\t}\n\n\t\t\t\tif (parsed.length === 0) break\n\t\t\t\tsetControlPropValue(key, { type, value: parsed })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Font: {\n\t\t\t\tconst parsed = isString(value) ? tryParseJSON(value) : resolvedValue\n\t\t\t\tif (isRawFontValue(parsed)) {\n\t\t\t\t\tsetControlPropValue(key, {\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tvalue: defaultFontValuesForOptionalKeys(controlDefinition, resolveFontControlValue(parsed)),\n\t\t\t\t\t})\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (!isString(resolvedValue)) break\n\t\t\t\tsetControlPropValue(key, {\n\t\t\t\t\ttype,\n\t\t\t\t\tvalue: defaultFontValuesForOptionalKeys(controlDefinition, {\n\t\t\t\t\t\tfontSelector: resolveFontSelectorForControlValue(resolvedValue),\n\t\t\t\t\t}),\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.EventHandler: {\n\t\t\t\tconst result = ctx.dynamicValues.resolveHandleFromAttribute(value, {\n\t\t\t\t\texpectedType: [ControlType.EventHandler],\n\t\t\t\t\tnode,\n\t\t\t\t})\n\n\t\t\t\tif (result.type === \"literal\") break\n\n\t\t\t\tif (result.type === \"invalid\") {\n\t\t\t\t\tonError(new Error(result.errorMessages.join(\"\\n\")))\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (!isVariableReferenceHandle(result.handle)) break\n\n\t\t\t\tconst scopeNode = ctx.treeResolver.getScopeNodeFor(node.id)\n\t\t\t\tif (!scopeNode || !isSmartComponentNode(scopeNode)) {\n\t\t\t\t\tonError(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`Cannot bind EventHandler control \"${controlTitle}\": \"${target.id}\" is not inside a ${ComponentNodeClass}.`,\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif (result.handle.scopeId !== scopeNode.id) {\n\t\t\t\t\tonError(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`Cannot bind EventHandler control \"${controlTitle}\": variable \"${result.handle.variable.name}\" is not an EventHandler variable in ${ComponentNodeClass} \"${scopeNode.id}\".`,\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tsetControlPropValue(key, {\n\t\t\t\t\ttype,\n\t\t\t\t\tvalue: [createTriggerEventAction(result.handle.variable.id)],\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.Slot: {\n\t\t\t\tif (isCodeComponentNode(node) && node.slotsAreChildNodes) {\n\t\t\t\t\tonError(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\t`Slot \"${controlTitle}\" is managed via child nodes. Add, move, or remove children directly instead of setting the slot control.`,\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tif (!isArray(resolvedValue)) break\n\n\t\t\t\tconst scopeNode = ctx.treeResolver.getScopeNodeFor(node.id)\n\t\t\t\tif (!scopeNode) break\n\n\t\t\t\tconst currentControlProp = resolver.getControlProps()?.[key]\n\t\t\t\tconst currentItems = currentControlProp?.type === ControlType.Slot ? currentControlProp.value : undefined\n\n\t\t\t\tconst patched = applyArrayAttributePatch({\n\t\t\t\t\tcurrentItems,\n\t\t\t\t\tpatch: resolvedValue,\n\t\t\t\t\tparsePatchItem: (referenceId, index) => {\n\t\t\t\t\t\tif (!isString(referenceId)) return\n\t\t\t\t\t\tconst referencedNode = ctx.treeResolver.get(referenceId)\n\t\t\t\t\t\tif (!referencedNode) {\n\t\t\t\t\t\t\tonWarning(\n\t\t\t\t\t\t\t\t`${controlTitle}.${index}`,\n\t\t\t\t\t\t\t\t`Slot reference ${escapeValue(referenceId)} for control ${escapeValue(controlTitle)} does not exist.`,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (referencedNode.id === node.id) {\n\t\t\t\t\t\t\tonWarning(\n\t\t\t\t\t\t\t\t`${controlTitle}.${index}`,\n\t\t\t\t\t\t\t\t`Slot reference ${escapeValue(referenceId)} cannot reference itself.`,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!isValidSlotReferenceForAgent(scopeNode.id, referencedNode, ctx)) {\n\t\t\t\t\t\t\tonWarning(\n\t\t\t\t\t\t\t\t`${controlTitle}.${index}`,\n\t\t\t\t\t\t\t\t`Slot reference ${escapeValue(referenceId)} for control ${escapeValue(controlTitle)} must be a direct child of the scope node.`,\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst item: SlotControlItem = { id: randomID(), reference: referencedNode.id }\n\t\t\t\t\t\treturn [item]\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tconst items = patched ?? []\n\t\t\t\tconst maxCount = controlDefinition.maxCount ?? Infinity\n\t\t\t\tconst trimmed = items.length > maxCount ? items.slice(0, maxCount) : items\n\t\t\t\tsetControlPropValue(key, { type, value: trimmed })\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcase ControlType.ChangeHandler:\n\t\t\tcase ControlType.LinkRelValues:\n\t\t\tcase ControlType.PageScope:\n\t\t\tcase ControlType.Object:\n\t\t\tcase ControlType.CustomCursor:\n\t\t\tcase ControlType.Transition:\n\t\t\tcase ControlType.ScrollSectionRef:\n\t\t\tcase ControlType.SegmentedEnum:\n\t\t\tcase ControlType.ComponentInstance:\n\t\t\tcase ControlType.Location: {\n\t\t\t\tonError(new Error(`Control \"${controlTitle}\" has unsupported type \"${type}\".`))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(type)\n\t\t}\n\n\t\tconst serializedValue = serializeControlValue(value)\n\t\tonError(new Error(`Value ${serializedValue} is not valid for control \"${controlTitle}\" (type: ${type}).`))\n\t}\n\n\treturn resolved\n}\n\nfunction getUnknownControlError(target: ControlResolutionTarget, controlTitle: string) {\n\tswitch (target.componentType) {\n\t\tcase \"icon\":\n\t\t\treturn new Error(\n\t\t\t\t`Unknown icon control \"${controlTitle}\". Check the <${metadataTags.iconSetDefinition}> metadata tag for a list of available controls.`,\n\t\t\t)\n\t\tcase \"component\":\n\t\t\treturn new Error(\n\t\t\t\t`Unknown component control \"${controlTitle}\". Check the <${metadataTags.componentDefinition}> metadata tag or the \"${COMPONENT_DEFINITION_QUERY}\" response for the component's available controls.`,\n\t\t\t)\n\t\tcase \"componentPreset\":\n\t\t\treturn new Error(\n\t\t\t\t`Unknown component preset control \"${controlTitle}\". Check the <${metadataTags.componentDefinition}> metadata tag or the \"${COMPONENT_DEFINITION_QUERY}\" response for components with controls marked \"onlyPresets\".`,\n\t\t\t)\n\t\tcase \"textComponentInstance\":\n\t\t\treturn new Error(\n\t\t\t\t`Unknown ${TextComponentInstanceClass} control \"${controlTitle}\". Check the <${metadataTags.componentDefinition}> metadata tag or the \"${COMPONENT_DEFINITION_QUERY}\" response for direct controls and exclude controls marked \"onlyPresets\".`,\n\t\t\t)\n\t\tcase \"unknown\":\n\t\t\treturn new Error(\n\t\t\t\t`Unknown control \"${controlTitle}\" for (${target.dslTypes.join(\", \")}) with ID \\`${target.id}\\`.`,\n\t\t\t)\n\t\tdefault:\n\t\t\tassertNever(target.componentType)\n\t}\n}\n\nfunction collectControlUploads(\n\tcontrolDefinition: ControlDescription,\n\tcontrolProp: ControlProp | undefined,\n\tpath: readonly UploadControlPathSegment[],\n\tuploads: ControlUpload[],\n) {\n\tif (!controlProp) return\n\n\tswitch (controlDefinition.type) {\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage:\n\t\tcase ControlType.File: {\n\t\t\tif (!isAssetReferenceSupportingControl(controlProp)) return\n\t\t\tif (!isString(controlProp.value) || isAssetReference(controlProp.value) || !isValidURL(controlProp.value)) return\n\n\t\t\tuploads.push({\n\t\t\t\tvalue: controlProp.value,\n\t\t\t\tpath,\n\t\t\t\tallowedFileTypes:\n\t\t\t\t\tcontrolDefinition.type === ControlType.File ? controlDefinition.allowedFileTypes : imageAllowedFileTypes,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\tcase ControlType.Array: {\n\t\t\tif (controlProp.type !== ControlType.Array || !isStaticArrayControlPropValue(controlProp.value)) return\n\n\t\t\tfor (const item of controlProp.value) {\n\t\t\t\tcollectControlUploads(controlDefinition.control, item, [...path, { type: \"array\", itemId: item.id }], uploads)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\tcase ControlType.Object: {\n\t\t\tif (!isObjectControlProp(controlProp) || !controlProp.value) return\n\n\t\t\tfor (const key in controlDefinition.controls) {\n\t\t\t\tconst nestedControlDefinition = controlDefinition.controls[key]\n\t\t\t\tif (!nestedControlDefinition) continue\n\n\t\t\t\tcollectControlUploads(\n\t\t\t\t\tnestedControlDefinition,\n\t\t\t\t\tcontrolProp.value[key],\n\t\t\t\t\t[...path, { type: \"object\", key }],\n\t\t\t\t\tuploads,\n\t\t\t\t)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t}\n}\n\nfunction getControlUploads(controlDefinition: ControlDescription, controlProp: ControlProp): ControlUpload[] {\n\tconst uploads: ControlUpload[] = []\n\tcollectControlUploads(controlDefinition, controlProp, [], uploads)\n\treturn uploads\n}\n\nfunction isAssetReferenceSupportingControlType(\n\tcontrolType: ControlType,\n): controlType is ControlType.Image | ControlType.File | ControlType.ResponsiveImage {\n\treturn (\n\t\tcontrolType === ControlType.Image || controlType === ControlType.ResponsiveImage || controlType === ControlType.File\n\t)\n}\n\nfunction isAssetReferenceSupportingControl(\n\tcontrolProp: ControlProp | undefined,\n): controlProp is ImageControlProp | FileControlProp {\n\treturn isObject(controlProp) && isAssetReferenceSupportingControlType(controlProp.type)\n}\n\nfunction replaceAssetReferenceSupportingControlPropValue(\n\tcontrolDefinition: ControlDescription,\n\tcontrolProp: ControlProp | undefined,\n\tpath: readonly UploadControlPathSegment[],\n\toriginalValue: string,\n\treference: string,\n): ControlProp | undefined {\n\tif (!controlProp) return\n\n\tconst [segment, ...rest] = path\n\tif (!segment) {\n\t\tif (!isAssetReferenceSupportingControl(controlProp)) return\n\t\tif (controlProp.value !== originalValue) return\n\n\t\treturn { ...controlProp, value: reference }\n\t}\n\n\tswitch (segment.type) {\n\t\tcase \"array\": {\n\t\t\tif (controlDefinition.type !== ControlType.Array) return\n\t\t\tif (controlProp.type !== ControlType.Array || !isStaticArrayControlPropValue(controlProp.value)) return\n\n\t\t\tconst itemIndex = controlProp.value.findIndex(item => item.id === segment.itemId)\n\t\t\tif (itemIndex === -1) return\n\n\t\t\tconst item = controlProp.value[itemIndex]\n\t\t\tconst updatedItem = replaceAssetReferenceSupportingControlPropValue(\n\t\t\t\tcontrolDefinition.control,\n\t\t\t\titem,\n\t\t\t\trest,\n\t\t\t\toriginalValue,\n\t\t\t\treference,\n\t\t\t)\n\t\t\tif (!isArrayValue(updatedItem)) return\n\n\t\t\tconst value: ArrayValue[] = [...controlProp.value]\n\t\t\tvalue[itemIndex] = updatedItem\n\t\t\treturn { ...controlProp, value }\n\t\t}\n\t\tcase \"object\": {\n\t\t\tif (controlDefinition.type !== ControlType.Object) return\n\t\t\tif (!isObjectControlProp(controlProp) || !controlProp.value) return\n\n\t\t\tconst nestedControlDefinition = controlDefinition.controls[segment.key]\n\t\t\tif (!nestedControlDefinition) return\n\n\t\t\tconst updatedValue = replaceAssetReferenceSupportingControlPropValue(\n\t\t\t\tnestedControlDefinition,\n\t\t\t\tcontrolProp.value[segment.key],\n\t\t\t\trest,\n\t\t\t\toriginalValue,\n\t\t\t\treference,\n\t\t\t)\n\t\t\tif (!updatedValue) return\n\n\t\t\treturn {\n\t\t\t\t...controlProp,\n\t\t\t\tvalue: { ...controlProp.value, [segment.key]: updatedValue },\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(segment)\n\t}\n}\n\nfunction queueControlUpload(\n\tnode: CanvasNode,\n\tcontrolKey: string,\n\tcontrolDefinition: ControlDescription,\n\tcontrolProp: ControlProp,\n\tctx: AgentContext,\n) {\n\tfor (const upload of getControlUploads(controlDefinition, controlProp)) {\n\t\tctx.files.updateNodeWithAsset(node, upload.value, (reference, latestNode) => {\n\t\t\tconst latestResolver = getAttributeResolver(latestNode, ctx)\n\t\t\tconst latestControlProp = latestResolver?.getControlProps()?.[controlKey]\n\t\t\tif (!latestResolver || !latestControlProp) return false\n\n\t\t\tconst updatedControlProp = replaceAssetReferenceSupportingControlPropValue(\n\t\t\t\tcontrolDefinition,\n\t\t\t\tlatestControlProp,\n\t\t\t\tupload.path,\n\t\t\t\tupload.value,\n\t\t\t\treference,\n\t\t\t)\n\t\t\tif (!updatedControlProp) return false\n\n\t\t\tlatestResolver.setControlProp(controlKey, updatedControlProp)\n\t\t\treturn true\n\t\t})\n\t}\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!containsPrefixedControlProp(attributes)) return\n\n\tconst resolver = getAttributeResolver(node, ctx)\n\tif (!resolver) return\n\n\tconst warnings: TraitWarning[] = []\n\tconst errors: Error[] = []\n\tconst changedControlProps = new Set<string>()\n\n\tfor (const [key, controlProp] of resolveControlProps(\n\t\tnode,\n\t\tattributes,\n\t\tctx,\n\t\terror => {\n\t\t\terrors.push(error)\n\t\t},\n\t\t(attributeKey, message) => {\n\t\t\twarnings.push({ applied: false, key: attributeKey, message })\n\t\t},\n\t\tresolver,\n\t)) {\n\t\tresolver.setControlProp(key, controlProp)\n\t\tchangedControlProps.add(key)\n\t\tconst controlDefinition = resolver.controls.properties()?.[key]\n\t\tif (controlDefinition) {\n\t\t\tqueueControlUpload(node, key, controlDefinition, controlProp, ctx)\n\t\t}\n\t}\n\n\tif (changedControlProps.size > 0) {\n\t\tctx.treeResolver.recordMutatingNodeUpdates(node.id, { changedControlProps })\n\t}\n\n\tif (warnings.length > 0 || errors.length > 0) {\n\t\treturn { warnings, errors }\n\t}\n}\n\nfunction resolveEnumControlValue(\n\tkey: string,\n\tvalue: string,\n\tcontrolDefinition: Extract<ControlDescription, { type: ControlType.Enum }>,\n\toptions: ResolvedControlOptions | undefined,\n\tctx: AgentContext,\n): string | VariableReference | undefined {\n\tif (key === \"variant\") {\n\t\treturn options?.codeComponentIdentifier\n\t\t\t? resolveVariantName(key, value, options?.codeComponentIdentifier, ctx)\n\t\t\t: value\n\t}\n\n\tif (!isString(value)) return\n\n\tconst matchingTitleValue = resolveEnumOptionTitle(value, controlDefinition)\n\tconst resolvedValue = matchingTitleValue ?? value\n\treturn controlDefinition.options.includes(resolvedValue) ? resolvedValue : undefined\n}\n\nfunction resolveEnumOptionTitle(\n\tvalue: string,\n\tcontrolDefinition: Extract<ControlDescription, { type: ControlType.Enum }>,\n): string | undefined {\n\tif (controlDefinition.options.includes(value)) return value\n\n\tconst index = controlDefinition.optionTitles?.indexOf(value) ?? -1\n\tif (index === -1) return\n\n\tconst option = controlDefinition.options[index]\n\treturn isString(option) ? option : undefined\n}\n\n/**\n * When the key is \"variant\", resolve a Variant Name to an ID.\n */\nfunction resolveVariantName(\n\tkey: string,\n\tvalue: string | VariableReference,\n\tidentifier: ModuleExportIdentifierString,\n\tctx: AgentContext,\n): NodeID | VariableReference | string | undefined {\n\tif (!isString(value) || key !== \"variant\") return value\n\n\tconst parsed = parseModuleIdentifier(identifier)\n\tif (!isLocalModuleIdentifier(parsed)) return value\n\tconst smartComponent = ctx.treeResolver.get(parsed.localIdName)\n\tif (!isSmartComponentNode(smartComponent) || !smartComponent.isLoaded()) return value\n\n\tconst variants = smartComponent.getTopLevelVariants()\n\tif (!variants) return\n\n\tconst resolvedId = ctx.treeResolver.get(value)?.id\n\tfor (const variant of variants) {\n\t\tif (resolvedId === variant.id) return variant.id\n\t\tif (variant.resolveValue(\"name\") === value) return variant.id\n\t\tif (variant.id === value) return variant.id\n\t}\n\n\treturn\n}\n\nconst Unresolvable = Symbol(\"Unresolvable\")\ntype Unresolvable = typeof Unresolvable\n\ninterface ResolveControlValueOptions {\n\tcontrolTitle: string\n\trawValue: unknown\n\tresolvedValue: unknown\n\tvariableHandle: DynamicValueHandle | undefined\n\tresolvedOptions: ResolvedControlOptions | undefined\n\tctx: AgentContext\n\tonWarning: (key: string, message: string) => void\n\tonError: (error: Error) => void\n}\n\n/**\n * Resolves a value for a control prop, returning undefined if the value can be skipped, or Unresolvable to surface an error.\n */\ntype ResolveControlValueCallback<TValue extends ControlProp[\"value\"]> = (\n\toptions: ResolveControlValueOptions,\n) => TValue | Unresolvable | undefined\n\nconst resolveColorControlValue: ResolveControlValueCallback<string | DynamicValue> = ({\n\tcontrolTitle,\n\trawValue,\n\tresolvedValue,\n\tvariableHandle,\n\tresolvedOptions,\n\tctx,\n\tonWarning,\n}) => {\n\tconst gradientWarning = getColorControlWarning(\n\t\tcontrolTitle,\n\t\trawValue,\n\t\tresolvedOptions?.codeComponentIdentifier,\n\t\tvariableHandle,\n\t)\n\tif (gradientWarning) {\n\t\tonWarning(gradientWarning.key, gradientWarning.message)\n\t\treturn\n\t}\n\n\tif (isDynamicValue(resolvedValue)) return resolvedValue\n\tif (!isString(resolvedValue)) return Unresolvable\n\n\treturn ctx.tokens.resolve(resolvedValue)?.toCSS() ?? resolvedValue\n}\n\nconst resolveImageControlValue: ResolveControlValueCallback<string | DynamicValue> = options =>\n\tresolveAssetReferenceSupportingControlValue(options, imageAllowedFileTypes)\n\nfunction resolveAssetReferenceSupportingControlValue(\n\t{ controlTitle, resolvedValue, ctx, onWarning }: ResolveControlValueOptions,\n\tallowedFileTypes: AllowedFileTypes,\n) {\n\tif (isDynamicValue(resolvedValue)) {\n\t\tif (\n\t\t\tisComputedValue(resolvedValue) &&\n\t\t\t[ControlType.Image, ControlType.ResponsiveImage, ControlType.File].includes(resolvedValue.outputType)\n\t\t) {\n\t\t\t/**\n\t\t\t * This is supported in the types (e.g. see {@link FileControlPropValue}) but unsupported in the UI.\n\t\t\t * If we ever added UI support for Image/File transforms, we'd need to validate URL trust of literals in them.\n\t\t\t */\n\t\t\tonWarning(controlTitle, `Computed Values are not supported for ${resolvedValue.type} controls.`)\n\t\t\treturn\n\t\t}\n\n\t\treturn resolvedValue\n\t}\n\n\t// DSL only accepts image URLs; we normalize those to asset references later.\n\tif (!isString(resolvedValue) || !isValidURL(resolvedValue)) return Unresolvable\n\n\tconst mediaType = getMediaTypeFromURL(resolvedValue)\n\tif (mediaType && !isCompatibleFileType(mediaType, allowedFileTypes)) {\n\t\tonWarning(controlTitle, disallowedFileTypeMessage(resolvedValue, allowedFileTypes, mediaType))\n\t\treturn\n\t}\n\n\tif (!ctx.files.isTrustedUrl(resolvedValue)) {\n\t\tonWarning(controlTitle, untrustedUrlMessage(resolvedValue))\n\t\treturn\n\t}\n\n\treturn resolvedValue\n}\n\nfunction getGalleryImageControlKey(controlDefinition: ControlDescription) {\n\tif (controlDefinition.type !== ControlType.Array) return undefined\n\tconst verified = verifyPropertyControls({ maybeGallery: controlDefinition })\n\tif (!verified.maybeGallery) return undefined\n\tif (!isArrayControlDescription(verified.maybeGallery)) return undefined\n\tif (!isGalleryControl(verified.maybeGallery)) return undefined\n\treturn getImageControlKeyAndDescription(verified.maybeGallery)[0]\n}\n\nfunction isColorArrayControlDescription(controlDefinition: ArrayControlDescription) {\n\treturn controlDefinition.control.type === ControlType.Color\n}\n\nfunction getArrayItemParsePatchItem(\n\tcontrolDefinition: ArrayControlDescription,\n\tnode: CanvasNode,\n\tresolveControlValueOptions: ResolveControlValueOptions,\n) {\n\tconst galleryImageControlKey = getGalleryImageControlKey(controlDefinition)\n\tif (galleryImageControlKey) {\n\t\treturn patchGalleryItem(galleryImageControlKey, node, resolveControlValueOptions)\n\t}\n\tif (isColorArrayControlDescription(controlDefinition)) {\n\t\treturn patchColorArrayItem(node, resolveControlValueOptions)\n\t}\n\n\tconst { onError, controlTitle } = resolveControlValueOptions\n\n\tonError(new Error(`Control \"${controlTitle}\" has unsupported array item type \"${controlDefinition.control.type}\".`))\n}\n\nfunction patchGalleryItem(\n\timageKey: string,\n\tnode: CanvasNode,\n\tresolveControlValueOptions: ResolveControlValueOptions,\n): ArrayParsePatchItemCallback<DSLAttributeValue, ArrayValue> {\n\treturn (value, index) => {\n\t\tconst itemControlTitle = `${resolveControlValueOptions.controlTitle}.${index}`\n\t\tconst resolveHandleResult = resolveControlValueOptions.ctx.dynamicValues.resolveHandleFromAttribute(value, {\n\t\t\tnode,\n\t\t})\n\n\t\tif (resolveHandleResult.type === \"invalid\") {\n\t\t\tresolveControlValueOptions.onError(new Error(resolveHandleResult.errorMessages.join(\"\\n\")))\n\t\t\treturn\n\t\t}\n\n\t\tconst variableHandle = resolveHandleResult.type === \"resolved\" ? resolveHandleResult.handle : undefined\n\t\tconst resolvedValue = variableHandle?.reference(node) ?? value\n\t\tconst imageValue = resolveImageControlValue({\n\t\t\t...resolveControlValueOptions,\n\t\t\tcontrolTitle: itemControlTitle,\n\t\t\trawValue: value,\n\t\t\tresolvedValue,\n\t\t\tvariableHandle,\n\t\t})\n\t\t// We let undefined become a placeholder image so that the agent doesn't get confused with the warning indices and\n\t\t// try to \"fix\" by overwriting the next successful image.\n\t\t// e.g. 2nd image is untrusted so becomes placeholder, agent fixes warning gallery.1 and targets correct index\n\t\tif (imageValue === Unresolvable) return\n\n\t\treturn [\n\t\t\tcreateGalleryItem({\n\t\t\t\titemId: randomID(),\n\t\t\t\timageKey,\n\t\t\t\timageControlProp: { type: ControlType.Image, value: imageValue },\n\t\t\t}),\n\t\t]\n\t}\n}\n\nfunction patchColorArrayItem(\n\tnode: CanvasNode,\n\tresolveControlValueOptions: ResolveControlValueOptions,\n): ArrayParsePatchItemCallback<DSLAttributeValue, ArrayValue> {\n\treturn (value, index) => {\n\t\tconst itemControlTitle = `${resolveControlValueOptions.controlTitle}.${index}`\n\t\tconst resolveHandleResult = resolveControlValueOptions.ctx.dynamicValues.resolveHandleFromAttribute(value, {\n\t\t\tnode,\n\t\t})\n\n\t\tif (resolveHandleResult.type === \"invalid\") {\n\t\t\tresolveControlValueOptions.onError(new Error(resolveHandleResult.errorMessages.join(\"\\n\")))\n\t\t\treturn\n\t\t}\n\n\t\tconst variableHandle: DynamicValueHandle | undefined =\n\t\t\tresolveHandleResult.type === \"resolved\" ? resolveHandleResult.handle : undefined\n\t\tconst resolvedValue = variableHandle?.reference(node) ?? value\n\t\tconst colorValue = resolveColorControlValue({\n\t\t\t...resolveControlValueOptions,\n\t\t\tcontrolTitle: itemControlTitle,\n\t\t\trawValue: value,\n\t\t\tresolvedValue,\n\t\t\tvariableHandle,\n\t\t})\n\t\tif (colorValue === Unresolvable || colorValue === undefined) return\n\n\t\treturn [{ id: randomID(), type: ControlType.Color, value: colorValue }]\n\t}\n}\n\nasync function toAttributesForResolver(\n\tresolver: AttributeResolver | undefined,\n\tserializers: TraitSerializers,\n): Promise<Record<string, ControlAttributeValue>> {\n\tconst result: Record<string, ControlAttributeValue> = {}\n\tif (!resolver) return result\n\n\tconst controlProps = resolver.getControlProps()\n\tif (!controlProps) return result\n\n\tfor (const controlKey in controlProps) {\n\t\tconst controlProp = controlProps[controlKey]\n\t\tif (!controlProp) continue\n\n\t\tconst entry = await resolver.toAttributeEntry(controlKey, controlProp, serializers)\n\t\tif (!entry) continue\n\n\t\tconst [unprefixedKey, value] = entry\n\t\tresult[prefixControlPropKey(unprefixedKey)] = value\n\t}\n\n\treturn result\n}\n\nasync function toAttributes(\n\tnode: CanvasNode,\n\t_: MaybeCanvasNode,\n\tctx: AgentContext,\n\tserializers: TraitSerializers,\n): Promise<Record<string, ControlAttributeValue>> {\n\tif (isCodeComponentNode(node) && isModuleExportIdentifier(node.codeComponentIdentifier) && !node.isVectorInstance) {\n\t\tawait ctx.components.async.forIdentifier(node.codeComponentIdentifier)\n\t}\n\tif (isComponentPresetNode(node) && isModuleExportIdentifier(node.componentIdentifier)) {\n\t\tawait ctx.components.async.forIdentifier(node.componentIdentifier)\n\t}\n\tif (isShaderNode(node)) {\n\t\tawait ctx.shaders.async.forIdentifier(node.shaderModuleIdentifier)\n\t}\n\tif (isWebPageNode(node) && hasLayoutTemplate(node) && isModuleExportIdentifier(node.layoutTemplateIdentifier)) {\n\t\tawait ctx.layoutTemplates.async.forIdentifier(node.layoutTemplateIdentifier)\n\t}\n\n\treturn toAttributesForResolver(getAttributeResolver(node, ctx, { deferUntilLoaded: false }), serializers)\n}\n\nfunction getTextComponentInstanceAttributeResolver(\n\tnode: VirtualRichTextTextComponentInstance,\n\tctx: AgentContext,\n): AttributeResolver | undefined {\n\tconst textComponentResolver = getTextComponentInstanceControlResolver(node, ctx)\n\tif (!textComponentResolver) return\n\n\treturn {\n\t\tcontrols: textComponentResolver.controls,\n\t\tresolveOptions: (_controlKey, control) => ({\n\t\t\tcodeComponentIdentifier: node.identifier,\n\t\t\tvectorSetModuleId: control.type === ControlType.VectorSetItem ? control.setModuleId : undefined,\n\t\t}),\n\t\tgetControlProps: textComponentResolver.getControlProps,\n\t\tsetControlProp: textComponentResolver.setControlProp,\n\t\ttoAttributeEntry: async (controlKey, controlProp, serializers) => {\n\t\t\tconst controlTitle = textComponentResolver.controls.getControlTitle(controlKey)\n\t\t\tif (!controlTitle) return\n\n\t\t\tconst controlDefinition = textComponentResolver.propertyControls[controlKey]\n\t\t\tif (!controlDefinition) return\n\n\t\t\t// This is not supported on RichText component embeds.\n\t\t\tif (controlDefinition.type === ControlType.EventHandler) return\n\n\t\t\tif (controlDefinition.type === ControlType.RichText && isString(controlProp.value)) {\n\t\t\t\tconst targetNodeId = ctx.virtualText.getOrCreateNodeAlias(node, virtualRichTextComponentInstanceAliasPrefix)\n\t\t\t\tconst target = createRichTextTarget(targetNodeId, prefixControlPropKey(controlTitle))\n\t\t\t\tconst handle = createTextComponentInstanceControlPropHandle(node, controlKey, target, ctx)\n\t\t\t\tconst serialized = await serializers.richText(handle, ctx)\n\t\t\t\tif (serialized) return [controlTitle, serialized]\n\t\t\t}\n\n\t\t\tconst controlValue = getValueForControl(\n\t\t\t\tnode.identifier,\n\t\t\t\tcontrolKey,\n\t\t\t\tcontrolDefinition,\n\t\t\t\tcontrolProp,\n\t\t\t\tgetControlValueContext(ctx, node),\n\t\t\t)\n\n\t\t\tif (isUndefined(controlValue)) return\n\n\t\t\treturn [controlTitle, controlValue]\n\t\t},\n\t\tvalidateControlPropValue: () => true,\n\t}\n}\n\nfunction queueVirtualImageControlUpload(\n\tnode: VirtualRichTextTextComponentInstance,\n\tcontrolKey: string,\n\tcontrolDefinition: ControlDescription,\n\tcontrolProp: ControlProp,\n\tctx: AgentContext,\n) {\n\tif (!isImageControlType(controlDefinition.type)) return\n\tif (!isString(controlProp.value) || !isValidURL(controlProp.value)) return\n\n\tconst originalValue = controlProp.value\n\tctx.files.updateVirtualTextNodeWithAsset(ctx, node, originalValue, (reference, latestNode) => {\n\t\tconst latestResolver = getTextComponentInstanceAttributeResolver(latestNode, ctx)\n\t\tconst latestControlProp = latestResolver?.getControlProps()?.[controlKey]\n\t\tif (!latestResolver || !latestControlProp || !isImageControlProp(latestControlProp)) return false\n\t\tif (latestControlProp.value !== originalValue) return false\n\n\t\tlatestResolver.setControlProp(controlKey, { ...latestControlProp, value: reference })\n\t\treturn true\n\t})\n}\n\nfunction fromVirtualTextComponentControlAttributes(\n\tnode: VirtualRichTextTextComponentInstance,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n) {\n\tif (!isVirtualRichTextTextComponentInstance(node)) return\n\n\tconst ownerNode = ctx.treeResolver.get(ctx.virtualText.getTargetNodeId(node))\n\tassert(ownerNode, `Owner node for ${TextComponentInstanceClass} \"${node.id}\" is required`)\n\n\tconst warnings: TraitWarning[] = []\n\tconst errors: Error[] = []\n\n\tconst resolver = getTextComponentInstanceAttributeResolver(node, ctx)\n\tif (!resolver) {\n\t\terrors.push(new Error(`Could not resolve attribute resolver for ${TextComponentInstanceClass} \"${node.id}\".`))\n\t\treturn { warnings, errors }\n\t}\n\n\tfor (const [key, controlProp] of resolveControlPropsForTarget(\n\t\t{\n\t\t\tid: node.id,\n\t\t\treferenceNode: ownerNode,\n\t\t\tdslTypes: [TextComponentInstanceClass],\n\t\t\tcomponentType: \"textComponentInstance\",\n\t\t},\n\t\tattributes,\n\t\tctx,\n\t\terror => {\n\t\t\terrors.push(error)\n\t\t},\n\t\t(attributeKey, message) => {\n\t\t\twarnings.push({ applied: false, key: attributeKey, message })\n\t\t},\n\t\tresolver,\n\t\t{ decodeStringControlEscapedNewlines: true },\n\t)) {\n\t\tresolver.setControlProp(key, controlProp)\n\t\tconst controlDefinition = resolver.controls.properties()?.[key]\n\t\tif (controlDefinition) {\n\t\t\tqueueVirtualImageControlUpload(node, key, controlDefinition, controlProp, ctx)\n\t\t}\n\t}\n\n\treturn { warnings, errors }\n}\n\nasync function toVirtualTextComponentControlAttributes(\n\tnode: VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n\toptions: TraitSerializers,\n): Promise<Record<string, ControlAttributeValue>> {\n\tif (!isVirtualRichTextTextComponentInstance(node)) return {}\n\tawait ctx.components.async.forIdentifier(node.identifier)\n\treturn toAttributesForResolver(getTextComponentInstanceAttributeResolver(node, ctx), options)\n}\n\nconst definition = {\n\t[prefixControlPropKey(\"<control_name>\")]: {\n\t\tdescription: `Corresponding supported control value from ${escapeValue(COMPONENT_DEFINITION_QUERY)}, ${escapeValue(SHADER_DEFINITION_QUERY)}, or variable reference`,\n\t},\n\t[prefixControlPropKey(\"<image_control_name>\")]: {\n\t\tsrc: {\n\t\t\tdescription: `${imageDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t\talt: {\n\t\t\tdescription: `string | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t},\n\t[prefixControlPropKey(\"<array_control_name>\")]: [\n\t\t{\n\t\t\tdescription: `${arrayItemDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t],\n\t[prefixControlPropKey(\"<slot_control_name>\")]: [\n\t\t{\n\t\t\tdescription: `<unique identifier of a direct child of the scope node> | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t],\n} satisfies Partial<TraitAttributeDefinition<object>>\n\nexport const controls = {\n\tfor: { guard: withControlProps, nodes: [ClassDiscriminator.CollectionItemNode] },\n\tdefinition: definition,\n\tfromAttributes,\n\ttoAttributes: toAttributes,\n} satisfies TraitDefinition<object>\n\nexport const virtualControls = {\n\tfor: isVirtualRichTextTextComponentInstance,\n\tdefinition,\n\tfromAttributes: fromVirtualTextComponentControlAttributes,\n\ttoAttributes: toVirtualTextComponentControlAttributes,\n} satisfies VirtualNodeTraitDefinition<object>\n", "import { isBooleanString } from \"utils/typeChecks.ts\"\nimport type { VirtualRichTextNode } from \"../context/richtext/document.ts\"\nimport { getVirtualRichTextDSLNodeClass, isVirtualRichTextTextRun } from \"../context/richtext/document.ts\"\nimport { TextRunClass } from \"../dsl.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport { expectedAttributeMessage, unsupportedAttributeMessage } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitWarning, VirtualNodeTraitDefinition } from \"./types.ts\"\n\ninterface InlineCodeAttributes {\n\tinlineCode: boolean | string\n}\n\nconst expectedInlineCodeValue = `true | false | ${nullString}`\n\nconst definition: TraitAttributeDefinition<InlineCodeAttributes> = {\n\tinlineCode: {\n\t\tdescription: expectedInlineCodeValue,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: VirtualRichTextNode, attributes: DSLAttributes): TraitWarning[] | undefined {\n\tconst inlineCode = attributes.inlineCode\n\tif (inlineCode === undefined) return\n\n\tif (!isVirtualRichTextTextRun(node)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"inlineCode\",\n\t\t\t\tmessage: unsupportedAttributeMessage(getVirtualRichTextDSLNodeClass(node.type), {\n\t\t\t\t\tdidYouMean: `to set it on a ${escapeValue(TextRunClass)}`,\n\t\t\t\t}),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (!isBooleanString(inlineCode) && !isNullString(inlineCode)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"inlineCode\",\n\t\t\t\tmessage: expectedAttributeMessage(inlineCode, expectedInlineCodeValue),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (inlineCode === \"true\") {\n\t\tnode.inlineCode = true\n\t\treturn\n\t}\n\n\tif (inlineCode === \"false\" || isNullString(inlineCode)) {\n\t\tnode.inlineCode = undefined\n\t\tnode.inlineCodeStylePreset = undefined\n\t\treturn\n\t}\n\n\treturn [\n\t\t{\n\t\t\tapplied: false,\n\t\t\tkey: \"inlineCode\",\n\t\t\tmessage: expectedAttributeMessage(inlineCode, expectedInlineCodeValue),\n\t\t},\n\t]\n}\n\nfunction toAttributes(node: VirtualRichTextNode): DSLAttributes | undefined {\n\tif (!isVirtualRichTextTextRun(node) || !node.inlineCode) return\n\n\treturn { inlineCode: true }\n}\n\nexport const inlineCode = {\n\tfor: isVirtualRichTextTextRun,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies VirtualNodeTraitDefinition<InlineCodeAttributes>\n", "import type { CanvasNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport { isInlineCodeStylePresetNode, isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport {\n\ttype VirtualRichTextNode,\n\ttype VirtualRichTextTextRun,\n\tgetVirtualRichTextDSLNodeClass,\n\tisVirtualRichTextNode,\n\tisVirtualRichTextTextRun,\n} from \"../context/richtext/document.ts\"\nimport { clearInlineCodeStylePresetOverrides } from \"../context/richtext/styleInheritance.ts\"\nimport { resolveRichTextTargetHandle } from \"../context/richtext/targets.ts\"\nimport { StylePresetType } from \"../context/stylePresetType.ts\"\nimport { TextRunClass } from \"../dsl.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\texpectedStylePresetReference,\n\texpectedStylePresetTypeMessage,\n\tinvalidAttributeMessage,\n\tsingleWarning,\n\ttextRunRequiresInlineCodeForPreset,\n\tunsupportedAttributeMessage,\n\twarning,\n} from \"./invalidValues.ts\"\nimport type {\n\tDSLAttributes,\n\tTraitAttributeDefinition,\n\tTraitDefinition,\n\tTraitWarning,\n\tVirtualNodeTraitDefinition,\n} from \"./types.ts\"\nimport { nodeToDSLType } from \"./types.ts\"\n\ninterface InlineCodeStylePresetAttributes {\n\tinlineCodeStylePreset: string\n}\n\nconst definition: TraitAttributeDefinition<InlineCodeStylePresetAttributes> = {\n\tinlineCodeStylePreset: {\n\t\tdescription: `The name or id of an ${ClassDiscriminator.InlineCodeStylePresetNode} | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nconst dslAttributeKey = \"inlineCodeStylePreset\" satisfies keyof InlineCodeStylePresetAttributes\n\nfunction fromAttributes(node: CanvasNode | VirtualRichTextNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tconst presetNameOrId = attributes.inlineCodeStylePreset\n\tif (isUndefined(presetNameOrId)) return\n\n\tif (!isString(presetNameOrId)) {\n\t\treturn warning(dslAttributeKey, presetNameOrId, expectedStylePresetReference)\n\t}\n\n\tif (isVirtualRichTextTextRun(node)) return fromAttributesToTextRun(node, presetNameOrId, ctx)\n\tif (isVirtualRichTextNode(node)) return warnUnsupportedVirtualTextNodes(node)\n\tif (isRichTextNode(node)) return fromAttributesToRichTextNode(node, presetNameOrId, ctx)\n\n\treturn [\n\t\t{\n\t\t\tkey: dslAttributeKey,\n\t\t\tapplied: false,\n\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t},\n\t]\n}\n\nfunction fromAttributesToRichTextNode(node: RichTextNode, presetNameOrId: string, ctx: AgentContext): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\tconst document = ctx.virtualText.maybeHydrateDocument(node)\n\n\tif (isNullString(presetNameOrId)) {\n\t\tnode.set({ stylePresetInlineCode: undefined })\n\t\tclearInlineCodeStylePresetOverrides(document)\n\t\treturn warnings\n\t}\n\n\tconst presetNode = resolveInlineCodeStylePreset(presetNameOrId, ctx, warnings)\n\tif (!presetNode) return warnings\n\n\tnode.setNodeInlineCodeStylePreset(presetNode)\n\tclearInlineCodeStylePresetOverrides(document)\n\treturn warnings\n}\n\nfunction fromAttributesToTextRun(\n\tnode: VirtualRichTextTextRun,\n\tpresetNameOrId: string,\n\tctx: AgentContext,\n): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\tconst handle = resolveRichTextTargetHandle(ctx.virtualText.getTarget(node), ctx)\n\tif (!handle?.capabilities.inlineStyles) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: dslAttributeKey,\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: unsupportedAttributeMessage(TextRunClass),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (isNullString(presetNameOrId)) {\n\t\tnode.inlineCodeStylePreset = undefined\n\t\treturn warnings\n\t}\n\n\tif (!node.inlineCode) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: dslAttributeKey,\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: textRunRequiresInlineCodeForPreset,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst presetNode = resolveInlineCodeStylePreset(presetNameOrId, ctx, warnings)\n\tif (!presetNode) return warnings\n\n\tnode.inlineCodeStylePreset = presetNode.id\n\treturn warnings\n}\n\nfunction resolveInlineCodeStylePreset(\n\tpresetNameOrId: string,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n): InlineCodeStylePresetNode | undefined {\n\tconst preset = ctx.stylePresets.forNameOrId(presetNameOrId, StylePresetType.InlineCode)\n\tif (!preset) {\n\t\tthrow new DeferTraitError(\n\t\t\t`${escapeValue(ClassDiscriminator.InlineCodeStylePresetNode)} with name or id \"${presetNameOrId}\" not found`,\n\t\t)\n\t}\n\n\tif (preset.type !== StylePresetType.InlineCode) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\n\t\t\t\tdslAttributeKey,\n\t\t\t\tpresetNameOrId,\n\t\t\t\texpectedStylePresetTypeMessage(preset.type, StylePresetType.InlineCode),\n\t\t\t),\n\t\t)\n\t\treturn\n\t}\n\n\tconst presetNode = ctx.treeStore.tree.getNodeWithTrait(preset.id, isInlineCodeStylePresetNode)\n\tif (!presetNode) {\n\t\twarnings.push({\n\t\t\tkey: dslAttributeKey,\n\t\t\tapplied: false,\n\t\t\tmessage: invalidAttributeMessage(presetNameOrId, \"Inline code style preset node not found in document\"),\n\t\t})\n\t\treturn\n\t}\n\n\treturn presetNode\n}\n\nfunction warnUnsupportedVirtualTextNodes(node: VirtualRichTextNode): TraitWarning[] {\n\tconst message = unsupportedAttributeMessage(getVirtualRichTextDSLNodeClass(node.type), {\n\t\tdidYouMean: `to set it on a ${escapeValue(TextRunClass)} or ${escapeValue(ClassDiscriminator.RichTextNode)}`,\n\t})\n\treturn [{ applied: false, key: dslAttributeKey, message }]\n}\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): DSLAttributes | undefined {\n\tif (isVirtualRichTextTextRun(node)) {\n\t\tif (!node.inlineCode) return\n\t\treturn presetIdToAttributes(node.inlineCodeStylePreset, ctx)\n\t}\n\tif (isVirtualRichTextNode(node)) return\n\tif (!isRichTextNode(node)) return\n\tif (isUndefined(node.stylePresetInlineCode)) return\n\n\tconst presetNode = node.getNodeInlineCodeStylePreset(ctx.treeStore.tree)\n\tif (!presetNode) return\n\n\treturn presetIdToAttributes(node.stylePresetInlineCode, ctx)\n}\n\nfunction presetIdToAttributes(presetId: string | undefined, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!presetId) return\n\tconst presetName = ctx.stylePresets.forId(presetId)?.name\n\tif (!presetName) return\n\n\treturn { inlineCodeStylePreset: presetName }\n}\n\nexport const inlineCodeStylePreset = {\n\tfor: isRichTextNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<InlineCodeStylePresetAttributes>\n\nexport const virtualInlineCodeStylePreset = {\n\tfor: isVirtualRichTextTextRun,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies VirtualNodeTraitDefinition<InlineCodeStylePresetAttributes>\n", "import { escapeValue } from \"app/ai/agents/prompt/utils.ts\"\nimport type { CanvasNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { LinkStylePresetNode } from \"document/models/CanvasTree/nodes/LinkStylePresetNode.ts\"\nimport { isLinkStylePresetNode, isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isLink } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport {\n\ttype VirtualRichTextNode,\n\ttype VirtualRichTextTextRun,\n\tgetVirtualRichTextDSLNodeClass,\n\tisVirtualRichTextNode,\n\tisVirtualRichTextTextRun,\n} from \"../context/richtext/document.ts\"\nimport { setLinkStylePresetForScopedLinks } from \"../context/richtext/styleInheritance.ts\"\nimport { resolveRichTextTargetHandle } from \"../context/richtext/targets.ts\"\nimport { StylePresetType } from \"../context/stylePresetType.ts\"\nimport { TextRunClass } from \"../dsl.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\texpectedStylePresetTypeMessage,\n\tinvalidAttributeMessage,\n\tsingleWarning,\n\tunsupportedAttributeMessage,\n} from \"./invalidValues.ts\"\nimport type {\n\tDSLAttributes,\n\tTraitAttributeDefinition,\n\tTraitDefinition,\n\tTraitWarning,\n\tVirtualNodeTraitDefinition,\n} from \"./types.ts\"\nimport { nodeToDSLType } from \"./types.ts\"\n\ninterface LinkStylePresetAttributes {\n\tlinkStylePreset: string\n}\n\nconst definition: TraitAttributeDefinition<LinkStylePresetAttributes> = {\n\tlinkStylePreset: {\n\t\tdescription: `The name or id of a ${ClassDiscriminator.LinkStylePresetNode} | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\tconst presetNameOrId = attributes.linkStylePreset\n\tif (!isString(presetNameOrId)) return warnings\n\tif (isVirtualRichTextTextRun(node)) return fromAttributesToTextRun(node, presetNameOrId, ctx)\n\tif (isVirtualRichTextNode(node)) return warnUnsupportedVirtualTextNodes(node)\n\tif (isRichTextNode(node)) return fromAttributesToRichTextNode(node, presetNameOrId, ctx)\n\treturn [\n\t\t{\n\t\t\tapplied: false,\n\t\t\tkey: \"linkStylePreset\",\n\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t},\n\t]\n}\n\nfunction fromAttributesToRichTextNode(node: RichTextNode, presetNameOrId: string, ctx: AgentContext): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\tconst document = ctx.virtualText.maybeHydrateDocument(node)\n\n\tif (isNullString(presetNameOrId)) {\n\t\tnode.set({ stylePresetLink: undefined })\n\t\tsetLinkStylePresetForScopedLinks(document, undefined)\n\t\treturn warnings\n\t}\n\n\tconst presetNode = resolveLinkStylePreset(presetNameOrId, ctx, warnings)\n\tif (!presetNode) return warnings\n\n\tnode.setNodeLinkStylePreset(presetNode)\n\tsetLinkStylePresetForScopedLinks(document, presetNode.id)\n\n\treturn warnings\n}\n\nfunction fromAttributesToTextRun(\n\tnode: VirtualRichTextTextRun,\n\tpresetNameOrId: string,\n\tctx: AgentContext,\n): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\n\tconst handle = resolveRichTextTargetHandle(ctx.virtualText.getTarget(node), ctx)\n\tif (!handle?.capabilities.links) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"linkStylePreset\",\n\t\t\tmessage: unsupportedAttributeMessage(TextRunClass),\n\t\t})\n\t\treturn warnings\n\t}\n\n\tif (isNullString(presetNameOrId)) {\n\t\tif (node.linkAttrs) {\n\t\t\tnode.linkAttrs = { ...node.linkAttrs, linkStylePreset: undefined }\n\t\t}\n\t\treturn warnings\n\t}\n\n\tconst presetNode = resolveLinkStylePreset(presetNameOrId, ctx, warnings)\n\tif (!presetNode) return warnings\n\n\tconst existing = node.linkAttrs\n\tif (!isLink(existing?.link) && !isVariableReference(existing?.link)) {\n\t\tthrow new DeferTraitError(`linkStylePreset deferred: the ${TextRunClass} must have a valid link.href`)\n\t}\n\n\tnode.linkAttrs = { ...existing, linkStylePreset: presetNode.id }\n\n\treturn warnings\n}\n\nfunction resolveLinkStylePreset(\n\tpresetNameOrId: string,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n): LinkStylePresetNode | undefined {\n\tconst preset = ctx.stylePresets.forNameOrId(presetNameOrId, StylePresetType.Link)\n\tif (!preset) {\n\t\t// Defer: the preset may be mid-registration from a just-issued `+LinkStylePresetNode`\n\t\tthrow new DeferTraitError(\n\t\t\t`${escapeValue(ClassDiscriminator.LinkStylePresetNode)} with name or id \"${presetNameOrId}\" not found`,\n\t\t)\n\t}\n\n\tif (preset.type !== StylePresetType.Link) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\n\t\t\t\t\"linkStylePreset\",\n\t\t\t\tpresetNameOrId,\n\t\t\t\texpectedStylePresetTypeMessage(preset.type, StylePresetType.Link),\n\t\t\t),\n\t\t)\n\t\treturn\n\t}\n\n\tconst presetNode = ctx.treeStore.tree.getNodeWithTrait(preset.id, isLinkStylePresetNode)\n\tif (!presetNode) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"linkStylePreset\",\n\t\t\tmessage: invalidAttributeMessage(presetNameOrId, \"Link style preset not found in document\"),\n\t\t})\n\t\treturn\n\t}\n\n\treturn presetNode\n}\n\nfunction warnUnsupportedVirtualTextNodes(node: VirtualRichTextNode): TraitWarning[] {\n\tif (node.type === \"unsupported\") return []\n\n\tconst message = unsupportedAttributeMessage(getVirtualRichTextDSLNodeClass(node.type), {\n\t\tdidYouMean: `to set it on a ${escapeValue(TextRunClass)} or ${escapeValue(ClassDiscriminator.RichTextNode)}`,\n\t})\n\treturn [{ applied: false, key: \"linkStylePreset\", message }]\n}\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): DSLAttributes | undefined {\n\tif (isVirtualRichTextTextRun(node)) return presetIdToAttributes(node.linkAttrs?.linkStylePreset, ctx)\n\tif (isVirtualRichTextNode(node)) return\n\tif (!isRichTextNode(node)) return\n\tconst documentLinkStylePreset = ctx.virtualText.getDocument(node.id)?.linkAttrs?.linkStylePreset\n\treturn presetIdToAttributes(documentLinkStylePreset ?? node.getNodeLinkStylePreset(ctx.treeStore.tree)?.id, ctx)\n}\n\nfunction presetIdToAttributes(presetId: string | undefined, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!presetId) return\n\tconst presetName = ctx.stylePresets.forId(presetId)?.name\n\tif (!presetName) return\n\treturn { linkStylePreset: presetName }\n}\n\nexport const linkStylePreset = {\n\tfor: isRichTextNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<LinkStylePresetAttributes>\n\nexport const virtualLinkStylePreset = {\n\tfor: isVirtualRichTextTextRun,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies VirtualNodeTraitDefinition<LinkStylePresetAttributes>\n", "import { parseAssetReference } from \"@framerjs/assets\"\nimport { isCompatibleFileType } from \"document/components/chrome/properties/utils/allowedFileTypes.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { getMediaTypeFromURL } from \"utils/url.ts\"\nimport { extensions as imageAllowedFileTypes } from \"web/lib/images/supportedFormats.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\tgetVirtualRichTextDSLNodeClass,\n\tisVirtualRichTextMediaBlock,\n\ttype VirtualRichTextMediaBlock,\n\ttype VirtualRichTextNode,\n} from \"../context/richtext/document.ts\"\nimport { assetReferenceToURL, nullString } from \"./helpers.ts\"\nimport {\n\tdisallowedFileTypeMessage,\n\texpectedAttributeMessage,\n\tunsupportedAttributeFormatMessage,\n\tuntrustedUrlMessage,\n} from \"./invalidValues.ts\"\nimport { imageDescription } from \"./traitDescriptions.ts\"\nimport type {\n\tDSLAttributes,\n\tDSLAttributeValue,\n\tTraitAttributeDefinition,\n\tTraitFromAttributesResult,\n\tTraitWarning,\n\tVirtualNodeTraitDefinition,\n} from \"./types.ts\"\n\ninterface MediaValue {\n\tsrc: string\n\talt: string | undefined\n}\n\ninterface MediaAttributes {\n\tmedia: MediaValue\n}\n\nconst definition: TraitAttributeDefinition<MediaAttributes> = {\n\tmedia: {\n\t\tsrc: {\n\t\t\tdescription: imageDescription,\n\t\t\texamples: [\"https://example.com/hero.png\", \"http://example.com/cover.jpg\"],\n\t\t},\n\t\talt: {\n\t\t\tdescription: \"string\",\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nfunction fromAttributes(\n\tnode: VirtualRichTextNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): TraitFromAttributesResult {\n\tconst media = attributes.media\n\tif (isUndefined(media)) return\n\n\tif (!isVirtualRichTextMediaBlock(node)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: \"media\",\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: unsupportedAttributeFormatMessage(getVirtualRichTextDSLNodeClass(node.type), \"media.*\"),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (!isObject(media)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: \"media\",\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: expectedAttributeMessage(media, \"media sub-properties (e.g. media.src, media.alt, media.<etc>)\"),\n\t\t\t},\n\t\t]\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\n\tif (!isUndefined(media.alt)) {\n\t\tif (!isString(media.alt)) {\n\t\t\twarnings.push({\n\t\t\t\tkey: \"media.alt\",\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: expectedAttributeMessage(media.alt, \"a string\"),\n\t\t\t})\n\t\t} else {\n\t\t\tnode.alt = media.alt === nullString ? undefined : media.alt\n\t\t}\n\t}\n\n\tif (!isUndefined(media.src)) {\n\t\tupdateImageSrcOrWarn(node, media.src, warnings, ctx)\n\t}\n\n\treturn warnings\n}\n\nfunction updateImageSrcOrWarn(\n\tnode: VirtualRichTextMediaBlock,\n\tsrc: DSLAttributeValue,\n\twarnings: TraitWarning[],\n\tctx: AgentContext,\n) {\n\tif (!isString(src)) {\n\t\twarnings.push({\n\t\t\tkey: \"media.src\",\n\t\t\tapplied: false,\n\t\t\tmessage: expectedAttributeMessage(src, \"a string\"),\n\t\t})\n\t\treturn\n\t}\n\n\tif (!ctx.files.isTrustedUrl(src)) {\n\t\twarnings.push({\n\t\t\tkey: \"media.src\",\n\t\t\tapplied: false,\n\t\t\tmessage: untrustedUrlMessage(src),\n\t\t})\n\t\treturn\n\t}\n\n\tconst mediaType = getMediaTypeFromURL(src)\n\tif (mediaType && !isCompatibleFileType(mediaType, imageAllowedFileTypes)) {\n\t\twarnings.push({\n\t\t\tkey: \"media.src\",\n\t\t\tapplied: false,\n\t\t\tmessage: disallowedFileTypeMessage(src, imageAllowedFileTypes, mediaType),\n\t\t})\n\t\treturn\n\t}\n\n\tctx.files.updateVirtualTextNodeWithAsset(ctx, node, src, (reference, latestNode) => {\n\t\tlatestNode.src = reference\n\t\tconst intrinsicSize = parseAssetReference(reference)?.intrinsicSize\n\t\tlatestNode.pixelWidth = intrinsicSize?.width\n\t\tlatestNode.pixelHeight = intrinsicSize?.height\n\t\treturn true\n\t})\n}\n\nfunction toAttributes(\n\tnode: VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): DSLAttributes | undefined {\n\tif (!isVirtualRichTextMediaBlock(node)) return\n\tif (node.mediaType !== \"image\") return\n\n\tconst src = parseAssetReference(node.src) ? assetReferenceToURL(node.src) : node.src\n\tctx.files.registerTrustedUrl(src)\n\n\tconst media: Partial<MediaValue> = { src }\n\tif (!isUndefined(node.alt)) media.alt = node.alt\n\treturn { media }\n}\n\nexport const media = {\n\tfor: isVirtualRichTextMediaBlock,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies VirtualNodeTraitDefinition<MediaAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCodeComponentNode,\n\tisFormPlainTextInputNode,\n\tisFormSelectNode,\n\tisGridComponent,\n\tisRichTextNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasImageFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { isGridChildFillingCellHeight } from \"document/models/CanvasTree/traits/WithGridItemSize.ts\"\nimport type { GridRowHeightType } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { withSizeDimensionType } from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport { autoAxisForAspectRatio } from \"document/models/CanvasTree/traits/collectStyles/collectAspectRatio.ts\"\nimport { hasLockedAspectRatio } from \"document/models/CanvasTree/traits/utils/layoutSupportsAspectRatio.ts\"\nimport { isPositionAbsolute, isPositionFixed } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport { DimensionType, isAutoDimensionType } from \"library/render/types/Constraints.ts\"\n\n/**\n * Estimates if a node could collapse to zero height after optional layout overrides are applied by\n * considering its height type, context and content.\n *\n * Meant to be used when setting the heightType of grids to \"auto\".\n */\nexport function couldCollapse(\n\tnode: CanvasNode,\n\twithValues: {\n\t\theightType?: DimensionType\n\t\tgridRowHeightType?: GridRowHeightType\n\t} = {},\n): boolean {\n\t// If a node doesn't have a heightType, it can't collapse, e.g.:\n\t// - ShapeNodes: OvalShapeNode, RectangleShapeNode, PolygonShapeNode, StarShapeNode, BooleanShapeNode\n\t// - PathNode\n\tif (!withSizeDimensionType(node)) return false\n\n\tconst heightType = withValues.heightType ?? node.heightType\n\tconst gridRowHeightType = withValues.gridRowHeightType ?? (isGridComponent(node) ? node.gridRowHeightType : undefined)\n\n\t// Inside a vertical stack, a node with height: fill, would collapse because of height: 1px + flex,\n\t// even for nodes with content that can hold their height. In a horizontal stack, fill height\n\t// becomes a percentage, so it doesn't get the 1px treatment. See collectStackItemLayout.ts.\n\tif (\n\t\tnode.cache.parentDirected === \"stack\" &&\n\t\tnode.cache.parentDirection === \"vertical\" &&\n\t\theightType === DimensionType.FractionOfFreeSpace\n\t) {\n\t\treturn true\n\t}\n\n\t// RichText won't collapse due to their text content.\n\tif (isRichTextNode(node)) return false\n\n\t// Form inputs with text don't collapse due to their content\n\tif (isFormPlainTextInputNode(node)) return false\n\tif (isFormSelectNode(node)) return false\n\n\t// Grid items filling their cell get CSS height: 100%, so the height type is irrelevant.\n\tif (!isGridChildFillingCellHeight(node)) {\n\t\t// Nodes with height types independent of content (fixed number, viewport) won't collapse\n\t\tif (heightType === DimensionType.FixedNumber || heightType === DimensionType.Viewport) return false\n\t\t// CodeComponents with auto height (Fit) would already have collapsed if they couldn't hold\n\t\t// height, so we assume they won't collapse further.\n\t\tif (isCodeComponentNode(node) && heightType === DimensionType.Auto) return false\n\t\t// Images with height that fits the image won't collapse\n\t\tif (hasImageFill(node) && heightType === DimensionType.FitImage) return false\n\t}\n\n\tif (\n\t\t// Auto sizing disables locked aspect ratio, so ignore the current node state when the override\n\t\t// would make the node auto-sized on height.\n\t\t!isAutoDimensionType(heightType) &&\n\t\thasLockedAspectRatio(node) &&\n\t\tisPinnable(node) &&\n\t\tautoAxisForAspectRatio(node) === \"height\"\n\t) {\n\t\treturn false\n\t}\n\n\t// Grids with a fixed gridRowHeightType never collapse\n\tif (gridRowHeightType === \"fixed\") return false\n\n\t// Otherwise, if a node has visible children that are not positioned absolute/fixed and that can't\n\t// collapse, then it can't collapse either.\n\tconst hasChildThatHoldsHeight = node.children?.some(child => {\n\t\tconst latest = child.draftOrCurrent()\n\t\t// Invisible children are not rendered\n\t\tif (!latest.isVisible()) return false\n\t\t// Children positioned absolute or fixed are taken out of the document flow, so they don't\n\t\t// affect the height of their parent.\n\t\tif (isPositionAbsolute(latest) || isPositionFixed(latest)) return false\n\t\treturn !couldCollapse(latest)\n\t})\n\n\t// If it doesn't have such children, then we assume it\n\t// can collapse.\n\treturn !hasChildThatHoldsHeight\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { hasGridLayout, isGridRowHeightType, isLayoutType } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport type { GridRowHeightType } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { isNullString } from \"./helpers.ts\"\nimport type { DSLAttributes } from \"./types.ts\"\n\nexport function getHasGridLayoutAfterApply(node: CanvasNode, attributes: DSLAttributes): boolean {\n\tif (isNullString(attributes.layout)) return false\n\tif (isLayoutType(attributes.layout)) return attributes.layout === \"grid\"\n\n\treturn hasGridLayout(node)\n}\n\nexport function getGridRowHeightTypeAfterApply(attributes: DSLAttributes): GridRowHeightType | undefined {\n\tif (!isGridRowHeightType(attributes.gridRowHeightType)) return\n\treturn attributes.gridRowHeightType\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\n\nexport function updateWithFallback<Trait extends object>(\n\tupdate: Partial<Trait>,\n\tnode: CanvasNode & Trait,\n\tdefaults: Trait,\n) {\n\tconst nodeUpdate: Trait = getUpdateWithFallback(update, node, defaults)\n\tnode.set(nodeUpdate)\n}\n\nexport function getUpdateWithFallback<Props extends object>(\n\tupdate: Partial<Props>,\n\tfallback: Partial<Props>,\n\tdefaults: Props,\n): Readonly<Props> {\n\tconst result: Props = { ...defaults }\n\n\tfor (const key in defaults) {\n\t\tresult[key] = update[key] ?? fallback[key] ?? defaults[key]\n\t}\n\n\treturn result\n}\n", "import type { HasGridLayout, HasStackLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport type { WithPadding } from \"document/models/CanvasTree/traits/WithPadding.ts\"\nimport { layoutDefaults } from \"document/utils/LayoutDefaults.ts\"\n\nexport const stackLayoutDefaults: HasStackLayout & WithPadding = {\n\tlayout: \"stack\",\n\tstackDirection: \"horizontal\",\n\tstackDistribution: \"start\",\n\tstackAlignment: \"start\",\n\tgap: 0,\n\tstackWrapEnabled: false,\n\tpaddingPerSide: false,\n\tpadding: 0,\n\tpaddingTop: 0,\n\tpaddingBottom: 0,\n\tpaddingLeft: 0,\n\tpaddingRight: 0,\n}\n\nexport const gridLayoutDefaults: HasGridLayout & WithPadding = {\n\tlayout: \"grid\",\n\tgridColumnCount: layoutDefaults.gridColumnCount,\n\tgridAlignment: \"center\",\n\tgridColumnWidthType: \"minmax\",\n\tgridColumnWidth: layoutDefaults.gridColumnWidth,\n\tgridColumnMinWidth: layoutDefaults.gridColumnMinWidth,\n\tgridRowHeightType: \"auto\",\n\tgridRowCount: layoutDefaults.gridRowCount,\n\tgridRowHeight: layoutDefaults.gridRowHeight,\n\tgridType: undefined,\n\tgap: 0,\n\tpaddingPerSide: false,\n\tpadding: 0,\n\tpaddingTop: 0,\n\tpaddingBottom: 0,\n\tpaddingLeft: 0,\n\tpaddingRight: 0,\n}\n", "import { assert, assertNever } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { couldCollapse } from \"document/models/CanvasTree/nodes/utils/couldCollapse.ts\"\nimport {\n\ttype TwoPixelNumberShorthand,\n\tgetNumericRowGapFromShorthand,\n\tisTwoPixelNumberShorthand,\n\tparsePixelNumber,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport {\n\ttype HasGridLayout,\n\ttype LayoutType,\n\ttype WithLayout,\n\thasAnyLayout,\n\thasGridLayout,\n\thasStackLayout,\n\tisGridContentAlignment,\n\tisGridRowHeightType,\n\tisLayoutType,\n\tisStackAlignment,\n\tlayoutTypes,\n\tstackAlignments,\n\tstackDirections,\n\tstackDistributions,\n\tsupportGap,\n\ttoStackDirection,\n\ttoStackDistribution,\n\twithLayout,\n} from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { isBreakpointWithLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { withPadding, type WithPadding } from \"document/models/CanvasTree/traits/WithPadding.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isGridRowCountNonDeterministic } from \"document/models/CanvasTree/traits/utils/isGridRowCountNonDeterministic.ts\"\nimport { layoutDefaults } from \"document/utils/LayoutDefaults.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isBooleanString, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { hasAnyAttribute, isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { layoutTemplateBreakpointWarnings, singleWarning } from \"./invalidValues.ts\"\nimport { gridLayoutDefaults, stackLayoutDefaults } from \"./layoutDefaults.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\nconst maxRecommendedGridColumnMinWidth = 50\nconst getExpectedLayoutValues = () => [...layoutTypes, \"null\"].map(value => `\"${value}\"`).join(\", \")\nconst getExpectedStackDirectionValues = () => stackDirections.map(value => `\"${value}\"`).join(\" or \")\nconst getExpectedStackDistributionValues = () => stackDistributions.map(value => `\"${value}\"`).join(\", \")\nfunction getExpectedStackAlignmentValues() {\n\tconst values = stackAlignments.map(value => `\"${value}\"`)\n\tconst lastValue = values[values.length - 1]\n\tassert(!isUndefined(lastValue), \"Expected stack alignments\")\n\treturn `${values.slice(0, -1).join(\", \")} or ${lastValue}`\n}\ninterface LayoutTraitAttributes extends Omit<WithLayout, \"gridType\" | \"gridColumnWidthType\"> {\n\tgridMasonry?: \"true\" | typeof nullString\n}\n\nconst agentGridLayoutDefaults: HasGridLayout & WithPadding = {\n\t...gridLayoutDefaults,\n\tgridRowCount: 1,\n}\n\n/**\n * Enables a layout type with sensible defaults if the node doesn't already have a layout. This is\n * used by the size trait to auto-enable layout when setting auto width/height, safeguarding against\n * partial LLM responses that set auto without enabling layout.\n *\n * AGENT @TODO: consider adding the defaults to the DSL definitions so it would match the LLM's\n * intention.\n */\nexport function enableDefaultLayout(node: CanvasNode, type: LayoutType = \"stack\") {\n\tif (!withLayout(node) || !withPadding(node)) return\n\tswitch (type) {\n\t\tcase \"stack\": {\n\t\t\tnode.set({ layout: \"stack\" })\n\t\t\tconst draft = node.draftOrCurrent()\n\t\t\tassert(hasStackLayout(draft), \"Node must have stack layout\")\n\t\t\tupdateWithFallback({}, draft, stackLayoutDefaults)\n\t\t\tbreak\n\t\t}\n\t\tcase \"grid\": {\n\t\t\tnode.set({ layout: \"grid\" })\n\t\t\tconst draft = node.draftOrCurrent()\n\t\t\tassert(hasGridLayout(draft), \"Node must have grid layout\")\n\t\t\tupdateWithFallback({}, draft, agentGridLayoutDefaults)\n\t\t\tbreak\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nconst definition: TraitAttributeDefinition<LayoutTraitAttributes> = {\n\tlayout: {\n\t\tdescription: \"stack | grid\",\n\t\toptional: true,\n\t},\n\tgap: {\n\t\tdescription: \"number | ${number}px | ${number}px ${number}px\",\n\t\toptional: true,\n\t},\n\tstackDirection: {\n\t\tdescription: \"horizontal | vertical\",\n\t\toptional: true,\n\t},\n\tstackDistribution: {\n\t\tdescription: \"start | center | end | space-between | space-around | space-evenly\",\n\t\toptional: true,\n\t},\n\tstackAlignment: {\n\t\tdescription: \"start | center | end\",\n\t\toptional: true,\n\t},\n\tstackWrapEnabled: {\n\t\tdescription: \"boolean\",\n\t\toptional: true,\n\t},\n\tgridColumnCount: {\n\t\tdescription: \"number | auto-fill\",\n\t\toptional: true,\n\t},\n\tgridRowCount: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n\tgridAlignment: {\n\t\tdescription: \"start | center | end\",\n\t\toptional: true,\n\t},\n\tgridColumnWidth: {\n\t\tdescription: \"number | ${number}px\",\n\t\toptional: true,\n\t},\n\tgridColumnMinWidth: {\n\t\tdescription: \"number | ${number}px\",\n\t\toptional: true,\n\t},\n\tgridRowHeightType: {\n\t\tdescription: \"fixed | auto | fit\",\n\t\toptional: true,\n\t},\n\tgridRowHeight: {\n\t\tdescription: \"number | ${number}px\",\n\t\toptional: true,\n\t},\n\tgridMasonry: {\n\t\tdescription: \"true | null\",\n\t\toptional: true,\n\t},\n}\n\nfunction collectGap(node: CanvasNode, attributes: DSLAttributes, warnings: TraitWarning[]) {\n\tassert(withLayout(node), \"Node must have layout\")\n\n\tconst gap = parseGap(attributes.gap)\n\tif (isUndefined(gap)) return\n\tconst draft = node.draftOrCurrent()\n\n\tif (!hasAnyLayout(draft)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"gap\",\n\t\t\tmessage: '\"gap\" is only supported on stack and grid layouts.',\n\t\t})\n\t\treturn\n\t}\n\n\tif (hasStackLayout(draft) && !supportGap(draft)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"gap\",\n\t\t\tmessage:\n\t\t\t\t'\"gap\" values are ignored when \"stackDistribution\" is one of \"space-between\", \"space-around\", \"space-evenly\".',\n\t\t})\n\t\treturn\n\t}\n\n\tnode.set({ gap })\n}\n\nfunction parseGap(gapInput: unknown): TwoPixelNumberShorthand | undefined {\n\tif (!isString(gapInput)) return\n\tif (isTwoPixelNumberShorthand(gapInput)) return gapInput\n\n\tconst value = tryParseNumber(gapInput)\n\tif (!isNumber(value)) return\n\treturn createCSSDimension(value, \"px\")\n}\n\nfunction collectStackDirection(node: CanvasNode, attributes: DSLAttributes, warnings: TraitWarning[]) {\n\tassert(withLayout(node), \"Node must have layout\")\n\tif (!isString(attributes.stackDirection)) return\n\n\tconst stackDirection = toStackDirection(attributes.stackDirection)\n\tif (isUndefined(stackDirection)) {\n\t\twarnings.push(singleWarning(\"stackDirection\", attributes.stackDirection, getExpectedStackDirectionValues()))\n\t\treturn\n\t}\n\n\tnode.set({ stackDirection })\n}\n\nfunction collectStackDistribution(node: CanvasNode, attributes: DSLAttributes, warnings: TraitWarning[]) {\n\tassert(withLayout(node), \"Node must have layout\")\n\tif (!isString(attributes.stackDistribution)) return\n\n\tconst stackDistribution = toStackDistribution(attributes.stackDistribution)\n\tif (isUndefined(stackDistribution)) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\"stackDistribution\", attributes.stackDistribution, getExpectedStackDistributionValues()),\n\t\t)\n\t\treturn\n\t}\n\n\tnode.set({ stackDistribution })\n\n\tif (!supportGap(node.draftOrCurrent())) node.set({ gap: undefined })\n}\n\nfunction collectStackAlignment(node: CanvasNode, attributes: DSLAttributes, warnings: TraitWarning[]) {\n\tassert(withLayout(node), \"Node must have layout\")\n\n\tif (isString(attributes.stackAlignment)) {\n\t\tif (isStackAlignment(attributes.stackAlignment)) {\n\t\t\tnode.set({ stackAlignment: attributes.stackAlignment })\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"stackAlignment\", attributes.stackAlignment, getExpectedStackAlignmentValues()))\n\t\t}\n\t}\n\n\tconst draft = node.draftOrCurrent()\n\tif (!hasStackLayout(draft)) return\n\tif (!isUndefined(draft.stackAlignment)) return\n\n\tnode.set({ stackAlignment: stackLayoutDefaults.stackAlignment })\n}\n\nfunction shouldCheckGridCollapse(attributes: DSLAttributes) {\n\treturn (\n\t\tisString(attributes.gridRowCount) || isString(attributes.gridRowHeightType) || isString(attributes.gridRowHeight)\n\t)\n}\n\nfunction getGridOverflowRisk(node: CanvasNode & HasGridLayout) {\n\tif (!isPinnable(node)) return\n\tif (node.widthType !== DimensionType.FixedNumber || !isNumber(node.width)) return\n\tif (!isNumber(node.gridColumnCount) || node.gridColumnCount <= 1) return\n\tif (!isNumber(node.gridColumnMinWidth)) return\n\n\tconst columnGap = isString(node.gap)\n\t\t? getNumericRowGapFromShorthand(node.gap)\n\t\t: isNumber(node.gap)\n\t\t\t? Math.max(0, node.gap)\n\t\t\t: 0\n\tconst requiredWidth = node.gridColumnCount * node.gridColumnMinWidth + (node.gridColumnCount - 1) * columnGap\n\tif (requiredWidth <= node.width) return\n\n\treturn { availableWidth: node.width, requiredWidth }\n}\n\n/**\n * Breakpoint frames with a vertical stack layout must use auto height \u2014 otherwise their fixed\n * height clips the stacked children. When the agent introduces or reveals that state via a\n * layout/stackDirection change, auto-fix the height (unless the agent explicitly set height in\n * the same command, in which case we respect that intent).\n */\nfunction collectBreakpointStackAutoHeight(node: CanvasNode, attributes: DSLAttributes, warnings: TraitWarning[]) {\n\tconst touchesStackLayout = isString(attributes.layout) || isString(attributes.stackDirection)\n\tif (!touchesStackLayout) return\n\tif (isString(attributes.height)) return\n\tif (!isBreakpointVariant(node) || !isPinnable(node)) return\n\n\tconst draft = node.draftOrCurrent()\n\tif (!hasStackLayout(draft) || draft.stackDirection !== \"vertical\") return\n\tif (node.heightType === DimensionType.Auto) return\n\n\tnode.set({ height: node.rect().height, heightType: DimensionType.Auto })\n\twarnings.push({\n\t\tapplied: true,\n\t\tkey: \"height\",\n\t\tmessage:\n\t\t\t'Breakpoint was automatically set to height=\"auto\" because vertical stack layout was used. Breakpoints using vertical stack layout should use auto height to avoid clipping content.',\n\t})\n}\n\nfunction collectGridWarnings(node: CanvasNode, attributes: DSLAttributes, warnings: TraitWarning[]) {\n\tconst draft = node.draftOrCurrent()\n\tif (!hasGridLayout(draft)) return\n\n\tif (\n\t\tisString(attributes.gridColumnMinWidth) &&\n\t\tdraft.gridColumnWidthType === \"minmax\" &&\n\t\tisNumber(draft.gridColumnMinWidth) &&\n\t\tdraft.gridColumnMinWidth > maxRecommendedGridColumnMinWidth\n\t) {\n\t\tconst overflowRisk = getGridOverflowRisk(draft)\n\t\tif (overflowRisk) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: true,\n\t\t\t\tkey: \"gridColumnMinWidth\",\n\t\t\t\tmessage: `Grid min width forces at least ${overflowRisk.requiredWidth}px for the current columns, which exceeds the current width of ${overflowRisk.availableWidth}px and can overflow.`,\n\t\t\t})\n\t\t}\n\t}\n\n\tif (shouldCheckGridCollapse(attributes) && couldCollapse(draft)) {\n\t\twarnings.push({\n\t\t\tapplied: true,\n\t\t\tkey: \"gridRowHeightType\",\n\t\t\tmessage:\n\t\t\t\t\"This grid can collapse with its current height, row sizing, and children. Prefer a child that holds height or avoid fill/auto-only combinations.\",\n\t\t})\n\t}\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!hasAnyAttribute(attributes, definition)) return\n\tif (!withLayout(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst layoutTemplateWarnings = layoutTemplateBreakpointWarnings(node, \"layout\")\n\tif (layoutTemplateWarnings) return layoutTemplateWarnings\n\n\tconst warnings: TraitWarning[] = []\n\tconst layout = attributes.layout\n\tif (isString(layout)) {\n\t\tif (isNullString(layout)) {\n\t\t\tnode.set({ layout: undefined })\n\t\t} else if (isLayoutType(layout)) {\n\t\t\tenableDefaultLayout(node, layout)\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"layout\", layout, getExpectedLayoutValues()))\n\t\t}\n\t}\n\n\tcollectStackDirection(node, attributes, warnings)\n\tcollectStackDistribution(node, attributes, warnings)\n\tcollectGap(node, attributes, warnings)\n\tcollectBreakpointStackAutoHeight(node, attributes, warnings)\n\tcollectStackAlignment(node, attributes, warnings)\n\n\tif (isBooleanString(attributes.stackWrapEnabled)) {\n\t\tnode.set({ stackWrapEnabled: attributes.stackWrapEnabled === \"true\" })\n\t}\n\n\tif (isString(attributes.gridColumnCount)) {\n\t\tconst value = parseInt(attributes.gridColumnCount)\n\t\tnode.set({ gridColumnCount: !Number.isNaN(value) ? value : undefined })\n\t}\n\n\tif (isString(attributes.gridRowCount)) {\n\t\tconst value = parseInt(attributes.gridRowCount)\n\t\tnode.set({ gridRowCount: !Number.isNaN(value) ? value : undefined })\n\t}\n\n\tif (isString(attributes.gridAlignment)) {\n\t\tnode.set({\n\t\t\tgridAlignment: isGridContentAlignment(attributes.gridAlignment) ? attributes.gridAlignment : undefined,\n\t\t})\n\t}\n\n\tif (isString(attributes.gridColumnWidth)) {\n\t\tconst gridColumnWidthValue = parsePixelNumber(attributes.gridColumnWidth)\n\t\tif (isNumber(gridColumnWidthValue)) {\n\t\t\tnode.set({ gridColumnWidth: gridColumnWidthValue, gridColumnWidthType: \"fixed\" })\n\t\t}\n\t}\n\n\tif (isString(attributes.gridColumnMinWidth)) {\n\t\tconst gridColumnMinWidthValue = parsePixelNumber(attributes.gridColumnMinWidth)\n\t\tif (isNumber(gridColumnMinWidthValue)) {\n\t\t\tnode.set({ gridColumnMinWidth: gridColumnMinWidthValue, gridColumnWidthType: \"minmax\" })\n\t\t}\n\n\t\tif (isString(attributes.gridColumnWidth)) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"gridColumnWidth\",\n\t\t\t\tmessage: `\"gridColumnWidth\" and \"gridColumnMinWidth\" are mutually exclusive - \"gridColumnMinWidth\" overrides \"gridColumnWidth\".`,\n\t\t\t})\n\t\t}\n\t}\n\n\tif (isString(attributes.gridRowHeightType)) {\n\t\tnode.set({\n\t\t\tgridRowHeightType: isGridRowHeightType(attributes.gridRowHeightType) ? attributes.gridRowHeightType : undefined,\n\t\t})\n\t}\n\n\tif (isString(attributes.gridRowHeight)) {\n\t\tconst gridRowHeightValue = parsePixelNumber(attributes.gridRowHeight)\n\t\tif (isNumber(gridRowHeightValue)) node.set({ gridRowHeight: gridRowHeightValue })\n\t}\n\n\tif (isString(attributes.gridMasonry)) {\n\t\tif (attributes.gridMasonry === \"true\") {\n\t\t\tnode.set({ gridType: \"columnMasonry\" })\n\t\t} else if (attributes.gridMasonry === nullString || attributes.gridMasonry === \"false\") {\n\t\t\tnode.set({ gridType: undefined })\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"gridMasonry\", attributes.gridMasonry, \"true or null\"))\n\t\t}\n\t}\n\n\tcollectGridWarnings(node, attributes, warnings)\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!withLayout(node)) return\n\tif (isBreakpointWithLayoutTemplate(node)) return\n\n\tif (!node.layout) return { layout: \"null\" }\n\n\tif (node.layout === \"stack\") {\n\t\tconst gap = node.resolveValue(\"gap\")\n\t\treturn {\n\t\t\tlayout: node.layout,\n\t\t\tstackDirection: node.resolveValue(\"stackDirection\"),\n\t\t\tstackDistribution: node.resolveValue(\"stackDistribution\"),\n\t\t\tstackAlignment: node.resolveValue(\"stackAlignment\"),\n\t\t\tstackWrapEnabled: node.resolveValue(\"stackWrapEnabled\"),\n\t\t\tgap: isNumber(gap) ? toRoundedNumber(gap) : gap,\n\t\t}\n\t}\n\n\tassert(node.layout === \"grid\")\n\n\tconst hasGridRows = isNumber(node.gridRowCount) && !isGridRowCountNonDeterministic(node)\n\n\tconst columnSize =\n\t\tnode.gridColumnWidthType === \"fixed\"\n\t\t\t? {\n\t\t\t\t\tgridColumnWidth: createCSSDimension(\n\t\t\t\t\t\ttoRoundedNumber(node.gridColumnWidth ?? layoutDefaults.gridColumnWidth),\n\t\t\t\t\t\t\"px\",\n\t\t\t\t\t),\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tgridColumnMinWidth: createCSSDimension(\n\t\t\t\t\t\ttoRoundedNumber(node.gridColumnMinWidth ?? layoutDefaults.gridColumnMinWidth),\n\t\t\t\t\t\t\"px\",\n\t\t\t\t\t),\n\t\t\t\t}\n\n\tconst gridAlignment = node.resolveValue(\"gridAlignment\")\n\tconst gridColumnCount = node.resolveValue(\"gridColumnCount\")\n\tconst gap = node.resolveValue(\"gap\")\n\treturn {\n\t\tlayout: node.layout,\n\t\tgridMasonry: node.gridType === \"columnMasonry\" ? \"true\" : undefined,\n\t\tgridAlignment: isNumber(gridAlignment) ? toRoundedNumber(gridAlignment) : gridAlignment,\n\t\tgridColumnCount: isNumber(gridColumnCount) ? toRoundedNumber(gridColumnCount) : gridColumnCount,\n\t\t...columnSize,\n\t\tgridRowCount: hasGridRows && isNumber(node.gridRowCount) ? toRoundedNumber(node.gridRowCount) : undefined,\n\t\tgridRowHeightType: hasGridRows ? node.gridRowHeightType : undefined,\n\t\tgridRowHeight:\n\t\t\thasGridRows && isNumber(node.gridRowHeight)\n\t\t\t\t? createCSSDimension(toRoundedNumber(node.gridRowHeight), \"px\")\n\t\t\t\t: undefined,\n\t\tgap: isNumber(gap) ? toRoundedNumber(gap) : gap,\n\t}\n}\n\nexport const layout = {\n\tfor: withLayout,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<LayoutTraitAttributes>\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { couldCollapse } from \"document/models/CanvasTree/nodes/utils/couldCollapse.ts\"\nimport { isLayoutTemplateNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withChildren } from \"document/models/CanvasTree/traits/WithChildren.ts\"\nimport { hasImageFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { withLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { WithSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport { viewportUnitForDimension } from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport { isBreakpointVariant, isVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { checkDimensionEnabled } from \"document/utils/layoutHelpers.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport {\n\tisVirtualRichTextTextComponentInstance,\n\ttype VirtualRichTextTextComponentInstance,\n} from \"../context/richtext/document.ts\"\nimport { getGridRowHeightTypeAfterApply, getHasGridLayoutAfterApply } from \"./gridWarningAnalyzers.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { singleWarning } from \"./invalidValues.ts\"\nimport { enableDefaultLayout } from \"./layout.ts\"\nimport type {\n\tDSLAttributes,\n\tTraitAttributeDefinition,\n\tTraitDefinition,\n\tTraitWarning,\n\tVirtualNodeTraitDefinition,\n} from \"./types.ts\"\n\ntype SizeAxis = \"width\" | \"height\"\n\nconst layoutTemplateBreakpointHeightTypeMessage =\n\t\"Layout template breakpoints must use a fixed height. Auto, percentage, fraction, and viewport height types are not supported.\"\n\nfunction unsupportedFractionDimensionMessage(axis: SizeAxis): string {\n\treturn `Fraction ${axis} is only supported for relative children inside stack or grid layouts. Use a fixed pixel ${axis} for fixed or absolute layers.`\n}\n\nfunction isLayoutTemplateBreakpoint(node: CanvasNode, ctx: AgentContext): boolean {\n\tif (!isBreakpointVariant(node)) return false\n\tconst scope = ctx.treeResolver.getScopeNodeFor(node.id)\n\treturn isLayoutTemplateNode(scope)\n}\n\nconst expectedSizeValue = 'a size value like \"200px\", \"50%\", \"1fr\", \"100vh\", \"auto\", or \"fit-image\"'\ntype ParsedDimension = NonNullable<ReturnType<typeof valueToDimensionType>>\n\nconst dimensionTypesNotAllowedOnVariant = new Set([DimensionType.Percentage, DimensionType.FractionOfFreeSpace])\n\nconst definition: TraitAttributeDefinition<WithSize> = {\n\twidth: {\n\t\tdescription: \"number | ${number}px | ${number}fr | ${number}% | auto | fit-image\",\n\t\toptional: true,\n\t},\n\theight: {\n\t\tdescription: \"number | ${number}px | ${number}vh | ${number}% | ${number}fr | auto | fit-image\",\n\t\toptional: true,\n\t},\n}\n\nfunction valueToDimensionType(valueString: unknown):\n\t| {\n\t\t\tvalue?: number\n\t\t\tdimensionType: DimensionType\n\t  }\n\t| undefined {\n\tif (!isString(valueString) || !valueString) return\n\n\tconst trimmedValue = valueString.trim().toLowerCase()\n\t// In Framer, we do not allow `fit-content` as a size value. But because in the web standards,\n\t// `fit-content` is a valid size value, we map it to `auto` for compatibility.\n\tif (trimmedValue === \"auto\" || trimmedValue === \"fit-content\") {\n\t\treturn { value: undefined, dimensionType: DimensionType.Auto }\n\t}\n\tif (trimmedValue === \"fit-image\") return { value: undefined, dimensionType: DimensionType.FitImage }\n\n\tconst [value, unit] = parseCSSDimension(valueString)\n\tif (Number.isNaN(value)) return\n\tif (unit === \"fr\") return { value, dimensionType: DimensionType.FractionOfFreeSpace }\n\tif (unit === \"%\") return { value: value / 100, dimensionType: DimensionType.Percentage }\n\tif (unit === \"vw\" || unit === \"vh\") return { value: value / 100, dimensionType: DimensionType.Viewport }\n\treturn { value, dimensionType: DimensionType.FixedNumber }\n}\n\ntype IllegalAutoSizeReason = \"no-visible-children\"\n\nfunction getIllegalAutoSizeReason(node: CanvasNode): IllegalAutoSizeReason | null {\n\tif (!withLayout(node)) return null\n\tif (!withChildren(node)) return null\n\n\tif (node.children.every(child => !child.isVisible())) return \"no-visible-children\"\n\n\treturn null\n}\n\nfunction setSizeDimension(node: CanvasNode, axis: SizeAxis, dimension: ParsedDimension, canApplyFitImage: boolean) {\n\tassert(isPinnable(node), \"Node must be pinnable\")\n\tconst { dimensionType, value } = dimension\n\tif (dimensionType !== DimensionType.FitImage || canApplyFitImage) {\n\t\t// Avoid setting width/height to undefined. Attempt to use the node's current\n\t\t// width/height if available.\n\t\tconst dimensionValue =\n\t\t\tdimensionType === DimensionType.Auto || dimensionType === DimensionType.FitImage ? node.rect()[axis] : value\n\n\t\tswitch (axis) {\n\t\t\tcase \"width\":\n\t\t\t\tnode.set({ width: dimensionValue, widthType: dimensionType })\n\t\t\t\tbreak\n\t\t\tcase \"height\":\n\t\t\t\tnode.set({ height: dimensionValue, heightType: dimensionType })\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(axis)\n\t\t}\n\t}\n}\nfunction applySizeDimension(\n\tnode: CanvasNode,\n\taxis: SizeAxis,\n\tdimension: ParsedDimension,\n\tcanApplyFitImage: boolean,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n): boolean {\n\tassert(isPinnable(node), \"Node must be pinnable\")\n\n\tif (isVariant(node) && dimensionTypesNotAllowedOnVariant.has(dimension.dimensionType)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: axis,\n\t\t\tmessage: `Ground nodes should not use percentage or fraction ${axis}.`,\n\t\t})\n\t\treturn false\n\t}\n\n\tif (dimension.dimensionType === DimensionType.FractionOfFreeSpace) {\n\t\tconst dimensionEnabled = checkDimensionEnabled(\n\t\t\tctx.treeStore.tree,\n\t\t\tctx.componentLoader,\n\t\t\tnode,\n\t\t\tctx.treeResolver.getParentNode(node),\n\t\t)\n\t\tif (!dimensionEnabled[axis][DimensionType.FractionOfFreeSpace]) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: axis,\n\t\t\t\tmessage: unsupportedFractionDimensionMessage(axis),\n\t\t\t})\n\t\t\treturn false\n\t\t}\n\t}\n\n\tsetSizeDimension(node, axis, dimension, canApplyFitImage)\n\treturn true\n}\n\nfunction collectGridSizeWarnings(\n\tnode: CanvasNode,\n\taxis: SizeAxis,\n\tdimension: ParsedDimension,\n\tattributes: DSLAttributes,\n\twarnings: TraitWarning[],\n) {\n\tconst draft = node.draftOrCurrent()\n\tconst hasGridLayout = getHasGridLayoutAfterApply(node, attributes)\n\tconst overrideGridRowHeightType = getGridRowHeightTypeAfterApply(attributes)\n\n\tif (\n\t\taxis === \"height\" &&\n\t\tdraft.cache.parentDirected === \"grid\" &&\n\t\tdimension.dimensionType === DimensionType.FractionOfFreeSpace &&\n\t\tdraft.cache.parentDirectedRowHeightType !== \"fixed\" &&\n\t\tcouldCollapse(draft, { heightType: dimension.dimensionType })\n\t) {\n\t\twarnings.push({\n\t\t\tapplied: true,\n\t\t\tkey: \"height\",\n\t\t\tmessage:\n\t\t\t\t'Grid items should prefer fit content (\"auto\") over fill (\"fr\") on height. Fill often breaks spacing in generated grids.',\n\t\t})\n\t}\n\n\tif (\n\t\taxis === \"height\" &&\n\t\tdimension.dimensionType === DimensionType.Auto &&\n\t\thasGridLayout &&\n\t\tcouldCollapse(draft, {\n\t\t\theightType: dimension.dimensionType,\n\t\t\tgridRowHeightType: overrideGridRowHeightType,\n\t\t})\n\t) {\n\t\twarnings.push({\n\t\t\tapplied: true,\n\t\t\tkey: \"height\",\n\t\t\tmessage:\n\t\t\t\t\"This grid can collapse when height is fit content with its current row sizing and children. Prefer a child that holds height or avoid fill/auto-only combinations.\",\n\t\t})\n\t}\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!isPinnable(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst warnings: TraitWarning[] = []\n\n\tconst width = valueToDimensionType(attributes.width)\n\tlet height = valueToDimensionType(attributes.height)\n\n\tif (isString(attributes.width) && attributes.width && !width) {\n\t\twarnings.push(singleWarning(\"width\", attributes.width, expectedSizeValue))\n\t}\n\tif (isString(attributes.height) && attributes.height && !height) {\n\t\twarnings.push(singleWarning(\"height\", attributes.height, expectedSizeValue))\n\t}\n\n\tif (height && height.dimensionType !== DimensionType.FixedNumber && isLayoutTemplateBreakpoint(node, ctx)) {\n\t\twarnings.push({ applied: false, key: \"height\", message: layoutTemplateBreakpointHeightTypeMessage })\n\t\theight = undefined\n\t}\n\n\tconst canApplyFitImage = hasImageFill(node)\n\n\t// If setting auto size on a frame without layout, enable stack layout. This safeguards against\n\t// partial LLM responses that set auto without enabling layout.\n\tconst isSettingAuto = width?.dimensionType === DimensionType.Auto || height?.dimensionType === DimensionType.Auto\n\tif (isSettingAuto && withLayout(node) && !node.layout) {\n\t\tenableDefaultLayout(node, \"stack\")\n\t}\n\n\tconst illegalReason = getIllegalAutoSizeReason(node)\n\tconst widthNeedsDefer = width?.dimensionType === DimensionType.Auto && illegalReason\n\tconst heightNeedsDefer = height?.dimensionType === DimensionType.Auto && illegalReason\n\n\tif (width && !widthNeedsDefer) {\n\t\tapplySizeDimension(node, \"width\", width, canApplyFitImage, ctx, warnings)\n\t}\n\n\tif (height && !heightNeedsDefer) {\n\t\tconst heightApplied = applySizeDimension(node, \"height\", height, canApplyFitImage, ctx, warnings)\n\t\tif (heightApplied) collectGridSizeWarnings(node, \"height\", height, attributes, warnings)\n\t}\n\n\tif (widthNeedsDefer || heightNeedsDefer) {\n\t\tconst deferredDimensions: (\"width\" | \"height\")[] = []\n\t\tif (widthNeedsDefer) deferredDimensions.push(\"width\")\n\t\tif (heightNeedsDefer) deferredDimensions.push(\"height\")\n\t\tthrow new DeferTraitError(`Cannot set ${deferredDimensions.join(\" and \")}: ${illegalReason}`)\n\t}\n\n\treturn warnings\n}\n\nfunction sizeFromNode(value: number | undefined, type: DimensionType, axis: keyof WithSize): string | undefined {\n\tif (isUndefined(value)) return\n\tswitch (type) {\n\t\tcase DimensionType.FixedNumber:\n\t\t\treturn createCSSDimension(value, \"px\")\n\t\tcase DimensionType.Percentage:\n\t\t\treturn createCSSDimension(value * 100, \"%\")\n\t\tcase DimensionType.FractionOfFreeSpace:\n\t\t\treturn createCSSDimension(value, \"fr\")\n\t\tcase DimensionType.Viewport:\n\t\t\treturn createCSSDimension(value * 100, viewportUnitForDimension(axis))\n\t\tcase DimensionType.Auto:\n\t\t\treturn \"auto\"\n\t\tcase DimensionType.FitImage:\n\t\t\treturn \"fit-image\"\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nexport const size = {\n\tfor: isPinnable,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes: node => {\n\t\tif (!isPinnable(node)) return\n\n\t\treturn {\n\t\t\twidth: sizeFromNode(node.width, node.widthType, \"width\"),\n\t\t\theight: sizeFromNode(node.height, node.heightType, \"height\"),\n\t\t}\n\t},\n} satisfies TraitDefinition<WithSize>\n\nconst virtualTextComponentFitValues = [\"fit\", \"fill\"] as const\ntype VirtualTextComponentFitValue = (typeof virtualTextComponentFitValues)[number]\ninterface VirtualTextComponentSizeAttributes {\n\twidth: VirtualTextComponentFitValue\n}\n\nfunction isValidComponentFitValue(value: unknown): value is VirtualTextComponentFitValue {\n\treturn virtualTextComponentFitValues.includes(value as VirtualTextComponentFitValue)\n}\n\nconst virtualTextComponentSizeDefinition: TraitAttributeDefinition<VirtualTextComponentSizeAttributes> = {\n\twidth: {\n\t\tdescription: virtualTextComponentFitValues.join(\" | \"),\n\t\toptional: true,\n\t},\n}\n\nfunction fromVirtualAttributes(\n\tnode: VirtualRichTextTextComponentInstance,\n\tattributes: DSLAttributes,\n): TraitWarning[] | undefined {\n\tif (!isVirtualRichTextTextComponentInstance(node)) return\n\n\tconst warnings: TraitWarning[] = []\n\n\tif (!isUndefined(attributes.width)) {\n\t\tif (isValidComponentFitValue(attributes.width)) {\n\t\t\tnode.width = attributes.width\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"width\", attributes.width, virtualTextComponentFitValues.join(\",\")))\n\t\t}\n\t}\n\n\treturn warnings\n}\n\nfunction toVirtualAttributes(node: VirtualRichTextTextComponentInstance): DSLAttributes | undefined {\n\tif (!isVirtualRichTextTextComponentInstance(node)) return\n\n\treturn { width: node.width }\n}\n\nexport const virtualTextComponentSize = {\n\tfor: isVirtualRichTextTextComponentInstance,\n\tdefinition: virtualTextComponentSizeDefinition,\n\tfromAttributes: fromVirtualAttributes,\n\ttoAttributes: toVirtualAttributes,\n} satisfies VirtualNodeTraitDefinition<VirtualTextComponentSizeAttributes>\n", "import type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport {\n\tisRichTextTableCellType,\n\trichTextTableCellTypes,\n\ttype RichTextTableCellType,\n} from \"document/models/richText/RichTextDocument.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\tgetVirtualRichTextDSLNodeClass,\n\tisVirtualRichTextTableCell,\n\ttype VirtualRichTextNode,\n} from \"../context/richtext/document.ts\"\nimport { expectedAttributeMessage, unsupportedAttributeFormatMessage } from \"./invalidValues.ts\"\nimport type {\n\tDSLAttributes,\n\tTraitAttributeDefinition,\n\tTraitFromAttributesResult,\n\tVirtualNodeTraitDefinition,\n} from \"./types.ts\"\n\ninterface TableCellAttributes {\n\tcellType: RichTextTableCellType\n}\n\nconst definition: TraitAttributeDefinition<TableCellAttributes> = {\n\tcellType: {\n\t\tdescription: richTextTableCellTypes.join(\" | \"),\n\t\toptional: true,\n\t},\n}\n\nconst cellTypeKey = \"cellType\" satisfies keyof TableCellAttributes\n\nfunction fromAttributes(node: VirtualRichTextNode, attributes: DSLAttributes): TraitFromAttributesResult {\n\tconst value = attributes.cellType\n\tif (isUndefined(value)) return\n\n\tif (!isVirtualRichTextTableCell(node)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: cellTypeKey,\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: unsupportedAttributeFormatMessage(getVirtualRichTextDSLNodeClass(node.type), cellTypeKey),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (!isRichTextTableCellType(value)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: cellTypeKey,\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: expectedAttributeMessage(value, richTextTableCellTypes.join(\" or \")),\n\t\t\t},\n\t\t]\n\t}\n\n\tnode.cellType = value\n}\n\nfunction toAttributes(\n\tnode: VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\t_ctx: AgentContext,\n): DSLAttributes | undefined {\n\tif (!isVirtualRichTextTableCell(node)) return\n\treturn { cellType: node.cellType }\n}\n\nexport const tableCell = {\n\tfor: isVirtualRichTextTableCell,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies VirtualNodeTraitDefinition<TableCellAttributes>\n", "const protectedTypographyPattern = /```[\\s\\S]*?(?:```|$)|`[^`]*(?:`|$)|<\\/?[a-z][^>]*(?:>|$)/gi\n\n/**\n * Applies typographic improvements to a string:\n * - Replaces straight double quotes with curly double quotes (\" \u2192 \" \")\n * - Replaces straight single quotes with curly single quotes (' \u2192 ' ')\n * - Handles apostrophes (treating them as closing single quotes)\n * - Replaces three consecutive dots with the ellipsis character (... \u2192 \u2026)\n * - Preserves already smart quotes and existing ellipsis characters\n * - Preserves markdown code spans/blocks and HTML tag syntax\n */\nexport function applyTypography(text: string): string {\n\tif (!text) return text\n\n\tlet lastIndex = 0\n\tlet result = \"\"\n\n\tfor (const match of text.matchAll(protectedTypographyPattern)) {\n\t\tconst index = match.index ?? 0\n\t\tresult += applyTypographyToPlainText(text.slice(lastIndex, index))\n\t\tresult += match[0]\n\t\tlastIndex = index + match[0].length\n\t}\n\n\treturn result + applyTypographyToPlainText(text.slice(lastIndex))\n}\n\nfunction applyTypographyToPlainText(text: string): string {\n\treturn text\n\t\t.replace(/(^|[-\\u2014/([{\"\\s])'/gu, \"$1\\u2018\") // Opening singles\n\t\t.replace(/'/gu, \"\\u2019\") // Closing singles & apostrophes\n\t\t.replace(/(^|[-\\u2014/([{\\u2018\\s])\"/gu, \"$1\\u201c\") // Opening doubles\n\t\t.replace(/\"/gu, \"\\u201d\") // Closing doubles\n\t\t.replace(/\\.{3}/gu, \"\\u2026\") // Ellipsis\n}\n", "import { assert, assertNever } from \"@framerjs/shared\"\nimport { type DynamicValueHandle, isVariableReferenceHandle } from \"app/ai/agents/context/dynamicValues.ts\"\nimport { applyTypography } from \"app/ai/utils/typography.ts\"\nimport type { CanvasNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { updateHTMLText } from \"document/models/CanvasTree/nodes/utils/updateHTMLText.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isFetchDataValue } from \"document/models/CanvasTree/traits/FetchDataValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withTextContent } from \"document/models/CanvasTree/traits/WithTextContent.ts\"\nimport { isRichTextVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { type VirtualRichTextNode, isVirtualRichTextTextRun } from \"../context/richtext/document.ts\"\nimport { CommandType, TextBlockClass } from \"../dsl.ts\"\nimport { commandReference } from \"../prompt/utils.ts\"\nimport { nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { dynamicValueDescription } from \"./traitDescriptions.ts\"\nimport type {\n\tDSLAttributes,\n\tTraitAttributeDefinition,\n\tTraitDefinition,\n\tTraitWarning,\n\tVirtualNodeTraitDefinition,\n} from \"./types.ts\"\n\ninterface TextAttributes {\n\ttext: string\n}\n\nconst textRunNewlineRegex = /\\n|\\\\n/u\n\nconst definition: TraitAttributeDefinition<TextAttributes> = {\n\ttext: {\n\t\tdescription: `Inner text of the element | ${dynamicValueDescription(\"string\")}`,\n\t\toptional: true,\n\t},\n}\n\nconst virtualDefinition: TraitAttributeDefinition<TextAttributes> = {\n\ttext: {\n\t\tdescription: `Literal text only. Do not include raw newlines or line-break escape sequences such as \\\\n. Use ${commandReference(CommandType.Add, \"TextLineBreak\")} nodes to add line breaks.`,\n\t\toptional: true,\n\t},\n}\n\nfunction collectText(node: RichTextNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tconst textValue = attributes.text\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(textValue, {\n\t\texpectedType: [ControlType.String, ControlType.RichText],\n\t\tnode,\n\t})\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\tthrow new Error(resolveHandleResult.errorMessages.join(\"\\n\"))\n\t}\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tif (\n\t\t\tisVariableReferenceHandle(resolveHandleResult.handle) &&\n\t\t\tisRichTextVariableDefinition(resolveHandleResult.handle.variable)\n\t\t) {\n\t\t\tnode.set({\n\t\t\t\thtml: updateHTMLText(node.html, resolveHandleResult.handle.variable.initialValue),\n\t\t\t\thtmlContent: resolveHandleResult.handle.reference(node),\n\t\t\t\ttextContent: undefined,\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\t// We must set a fallback text for non-rich-text variable bindings to work.\n\t\tctx.virtualText.replaceDocumentText(node.id, getVariableFallbackNameOrThrow(resolveHandleResult.handle, node, ctx))\n\n\t\tnode.set({\n\t\t\ttextContent: resolveHandleResult.handle.reference(node),\n\t\t\thtmlContent: undefined,\n\t\t})\n\t\treturn\n\t}\n\n\tif (!isString(textValue)) return\n\tif (node.getTextContent() === textValue) return\n\tctx.virtualText.replaceDocumentText(node.id, textValue)\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!isRichTextNode(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst warnings: TraitWarning[] = []\n\tconst textValue = attributes.text\n\n\tcollectText(node, attributes, ctx)\n\n\tif (!isString(textValue)) return\n\n\tif (textValue === nullString) {\n\t\twarnings.push({\n\t\t\tapplied: true,\n\t\t\tkey: \"text\",\n\t\t\tmessage: `text=\"${nullString}\" applies the literal word \"${nullString}\". To clear text, use text=\"\".`,\n\t\t})\n\t}\n\n\tif (textValue.includes(\"\\\\n\")) {\n\t\twarnings.push({\n\t\t\tapplied: true,\n\t\t\tkey: \"text\",\n\t\t\tmessage: `Escaped newlines in text were auto-fixed (split into TextRun + ${commandReference(CommandType.Add, \"TextLineBreak\")} nodes).`,\n\t\t})\n\t}\n\n\tif (applyTypography(textValue) !== textValue) {\n\t\twarnings.push({\n\t\t\tapplied: true,\n\t\t\tkey: \"text\",\n\t\t\tmessage: `We applied a few typographic tweaks: straight quotes are now curly \u201Csmart\u201D quotes, and ... was replaced with the ellipsis character (\u2026).`,\n\t\t})\n\t}\n\n\treturn warnings\n}\n\nfunction resolveVariableAttributes(value: unknown, node: CanvasNode, ctx: AgentContext) {\n\tif (!isDynamicValue(value)) return\n\treturn ctx.dynamicValues.resolveAttributeFromDynamicValue(value, node)\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isRichTextNode(node)) return\n\tconst text =\n\t\tresolveVariableAttributes(node.htmlContent, node, ctx) ?? resolveVariableAttributes(node.textContent, node, ctx)\n\tif (isUndefined(text)) return\n\treturn { text }\n}\n\nfunction fromVirtualAttributes(node: VirtualRichTextNode, attributes: DSLAttributes) {\n\tif (!isVirtualRichTextTextRun(node)) return\n\tconst textValue = attributes.text\n\tif (!isString(textValue)) return\n\n\tnode.text = textValue\n\tif (textRunNewlineRegex.test(textValue)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: true,\n\t\t\t\tkey: \"text\",\n\t\t\t\tmessage: `Applied the TextRun text as written. Any real newlines or literal \\\\n in this value will display literally. Use ${commandReference(CommandType.Add, \"TextLineBreak\")} nodes for line breaks, or split multi-paragraph content into separate ${TextBlockClass} nodes.`,\n\t\t\t},\n\t\t]\n\t}\n}\n\nfunction toVirtualAttributes(node: VirtualRichTextNode): DSLAttributes | undefined {\n\tif (!isVirtualRichTextTextRun(node)) return\n\treturn { text: node.text }\n}\n\nfunction getVariableFallbackNameOrThrow(handle: DynamicValueHandle, node: RichTextNode, ctx: AgentContext): string {\n\tif (isVariableReferenceHandle(handle)) return handle.variable.name\n\n\tconst startValue = handle.reference(node).startValue\n\tassert(!isFetchDataValue(startValue), \"Fetch is not supported\")\n\tif (!isVariableReference(startValue)) assertNever(startValue)\n\n\tconst startVariableHandle = ctx.dynamicValues.getVariableReferenceHandleByVariableReference(startValue)\n\tassert(\n\t\tisVariableReferenceHandle(startVariableHandle),\n\t\t\"VariableReference didn't resolve to a VariableReferenceHandle\",\n\t)\n\n\treturn startVariableHandle.variable.name\n}\n\nexport const text = {\n\tfor: withTextContent,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<TextAttributes>\n\nexport const virtualText = {\n\tfor: isVirtualRichTextTextRun,\n\tdefinition: virtualDefinition,\n\tfromAttributes: fromVirtualAttributes,\n\ttoAttributes: toVirtualAttributes,\n} satisfies VirtualNodeTraitDefinition<TextAttributes>\n", "import type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\tisVirtualRichTextTextComponentInstance,\n\ttype VirtualRichTextTextComponentInstance,\n} from \"../context/richtext/document.ts\"\nimport { singleWarning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, VirtualNodeTraitDefinition } from \"./types.ts\"\n\nconst expectedAlignmentValues = [\"left\", \"center\", \"right\"] as const\ntype TextComponentAlignmentValue = (typeof expectedAlignmentValues)[number]\n\nfunction isValidTextComponentAlignmentValue(value: unknown): value is TextComponentAlignmentValue {\n\treturn expectedAlignmentValues.includes(value as TextComponentAlignmentValue)\n}\n\ninterface TextComponentAlignmentAttributes {\n\talignment: TextComponentAlignmentValue\n}\n\nconst definition: TraitAttributeDefinition<TextComponentAlignmentAttributes> = {\n\talignment: {\n\t\tdescription: expectedAlignmentValues.join(\" | \"),\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: VirtualRichTextTextComponentInstance, attributes: DSLAttributes) {\n\tif (!isVirtualRichTextTextComponentInstance(node)) return\n\tif (isUndefined(attributes.alignment)) return\n\n\tif (isValidTextComponentAlignmentValue(attributes.alignment)) {\n\t\tnode.alignment = attributes.alignment\n\t\treturn\n\t}\n\n\treturn [singleWarning(\"alignment\", attributes.alignment, expectedAlignmentValues.join(\",\"))]\n}\n\nfunction toAttributes(\n\tnode: VirtualRichTextTextComponentInstance,\n\t_parent: MaybeCanvasNode,\n\t_ctx: AgentContext,\n): DSLAttributes {\n\tif (!isVirtualRichTextTextComponentInstance(node)) return {}\n\treturn { alignment: node.alignment }\n}\n\nexport const textComponentAlignment = {\n\tfor: isVirtualRichTextTextComponentInstance,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies VirtualNodeTraitDefinition<TextComponentAlignmentAttributes>\n", "import { isUndefined } from \"utils/typeChecks.ts\"\nimport type { VirtualRichTextNode, VirtualRichTextTextRun } from \"../context/richtext/document.ts\"\nimport { getVirtualRichTextDSLNodeClass, isVirtualRichTextTextRun } from \"../context/richtext/document.ts\"\nimport { TextRunClass } from \"../dsl.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport { expectedAttributeMessage, unsupportedAttributeMessage } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitWarning, VirtualNodeTraitDefinition } from \"./types.ts\"\n\ninterface TextRunMarkAttributes {\n\tbold: boolean | string\n\titalic: boolean | string\n}\n\nconst expectedMarkValue = `true | false | ${nullString}`\nconst markKeys = [\"bold\", \"italic\"] as const satisfies readonly (keyof TextRunMarkAttributes)[]\n\nconst definition = {\n\tbold: {\n\t\tdescription: expectedMarkValue,\n\t\toptional: true,\n\t},\n\titalic: {\n\t\tdescription: expectedMarkValue,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<TextRunMarkAttributes>\n\nfunction markKeysIn(attributes: DSLAttributes): readonly (keyof TextRunMarkAttributes)[] {\n\treturn markKeys.filter(key => !isUndefined(attributes[key]))\n}\n\nfunction warnUnsupportedNode(\n\tnode: VirtualRichTextNode,\n\tkeys: readonly (keyof TextRunMarkAttributes)[],\n): TraitWarning[] {\n\treturn keys.map(key => ({\n\t\tapplied: false,\n\t\tkey,\n\t\tmessage: unsupportedAttributeMessage(getVirtualRichTextDSLNodeClass(node.type), {\n\t\t\tdidYouMean: `to set it on a ${escapeValue(TextRunClass)}`,\n\t\t}),\n\t}))\n}\n\nfunction applyMark(\n\tnode: VirtualRichTextTextRun,\n\tkey: keyof TextRunMarkAttributes,\n\tvalue: DSLAttributes[string],\n): TraitWarning | undefined {\n\tif (value === \"true\") {\n\t\tnode[key] = true\n\t\treturn\n\t}\n\n\tif (value === \"false\" || isNullString(value)) {\n\t\tnode[key] = undefined\n\t\treturn\n\t}\n\n\treturn {\n\t\tapplied: false,\n\t\tkey,\n\t\tmessage: expectedAttributeMessage(value, expectedMarkValue),\n\t}\n}\n\nfunction fromAttributes(node: VirtualRichTextNode, attributes: DSLAttributes): TraitWarning[] | undefined {\n\tconst keys = markKeysIn(attributes)\n\tif (keys.length === 0) return\n\n\tif (!isVirtualRichTextTextRun(node)) return warnUnsupportedNode(node, keys)\n\n\tconst warnings: TraitWarning[] = []\n\tfor (const key of keys) {\n\t\tconst warning = applyMark(node, key, attributes[key])\n\t\tif (warning) warnings.push(warning)\n\t}\n\n\treturn warnings\n}\n\nfunction toAttributes(node: VirtualRichTextNode): DSLAttributes | undefined {\n\tif (!isVirtualRichTextTextRun(node)) return\n\n\tconst attributes: DSLAttributes = {}\n\tif (node.bold) attributes.bold = true\n\tif (node.italic) attributes.italic = true\n\n\tif (Object.keys(attributes).length === 0) return\n\treturn attributes\n}\n\nexport const textRunMarks = {\n\tfor: isVirtualRichTextTextRun,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies VirtualNodeTraitDefinition<TextRunMarkAttributes>\n", "import type { WithFontVariants } from \"document/models/CanvasTree/traits/WithFontVariants.ts\"\nimport type { WithTextStyle } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { isFontVariable } from \"document/models/CanvasTree/utils/variableFont.ts\"\nimport { fontStore } from \"library/index.ts\"\nimport type { ReadonlyFont } from \"library/render/fonts/types.ts\"\n\nexport function getFontVariantSelectors(font: ReadonlyFont | undefined): WithFontVariants {\n\tconst isVariableFont = isFontVariable(font)\n\n\treturn {\n\t\tfontBold: isVariableFont ? font?.selectorVariable : font?.selectorBold,\n\t\tfontBoldItalic: isVariableFont ? font?.selectorVariableItalic : font?.selectorBoldItalic,\n\t\tfontItalic: isVariableFont ? font?.selectorVariableItalic : font?.selectorItalic,\n\t}\n}\n\nexport function getFontUpdateValues(\n\tpreset: WithTextStyle & WithFontVariants,\n\tnewFontSelector: string | undefined,\n): Partial<WithFontVariants> {\n\tconst currentFont = fontStore.getFontBySelector(preset.font)\n\tconst newFont = newFontSelector ? fontStore.getFontBySelector(newFontSelector) : undefined\n\tconst isVariableFont = isFontVariable(newFont)\n\tconst newFontVariants = getFontVariantSelectors(newFont)\n\n\tconst result: Partial<WithFontVariants> = {}\n\n\t// Only update these values if the user hasn't overridden the defaults in the preset.\n\tconst shouldUpdateFontBold =\n\t\t!preset.fontBold || isVariableFont\n\t\t\t? preset.fontBold === currentFont?.selectorVariable\n\t\t\t: preset.fontBold === currentFont?.selectorBold\n\tif (shouldUpdateFontBold) {\n\t\tresult.fontBold = newFontVariants.fontBold\n\t}\n\n\tconst shouldUpdateFontBoldItalic =\n\t\t!preset.fontBoldItalic || isVariableFont\n\t\t\t? preset.fontBoldItalic === currentFont?.selectorVariableItalic\n\t\t\t: preset.fontBoldItalic === currentFont?.selectorBoldItalic\n\tif (shouldUpdateFontBoldItalic) {\n\t\tresult.fontBoldItalic = newFontVariants.fontBoldItalic\n\t}\n\n\tconst shouldUpdateFontItalic =\n\t\t!preset.fontItalic || isVariableFont\n\t\t\t? preset.fontItalic === currentFont?.selectorVariableItalic\n\t\t\t: preset.fontItalic === currentFont?.selectorItalic\n\tif (shouldUpdateFontItalic) {\n\t\tresult.fontItalic = newFontVariants.fontItalic\n\t}\n\n\treturn result\n}\n", "import { getLogger } from \"@framerjs/shared\"\nimport { escapeValue } from \"app/ai/agents/prompt/utils.ts\"\nimport { CanvasNode, type RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport type { LinkStylePresetNode } from \"document/models/CanvasTree/nodes/LinkStylePresetNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport type { FormPlainTextInputNode } from \"document/models/CanvasTree/nodes/forms/FormPlainTextInputNode.ts\"\nimport {\n\tisFormPlainTextInputNode,\n\tisInlineCodeStylePresetNode,\n\tisLinkStylePresetNode,\n\tisRichTextNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\ttype LinkStyleKeyPrefix,\n\ttype SupportedLinkStyleSuffix,\n\tgetLinkStyleKey,\n} from \"document/models/CanvasTree/traits/WithLinkStyle.ts\"\nimport { assert, assertNever } from \"library/utils/assert.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport {\n\ttype RichTextDocument,\n\ttype WithVirtualTextStyles,\n\ttype VirtualRichTextNode,\n\tgetVirtualRichTextDSLNodeClass,\n\tisVirtualRichTextNode,\n\tisVirtualRichTextTextRun,\n\twithVirtualTextBlockStyles,\n\twithVirtualTextStyles,\n} from \"../../context/richtext/document.ts\"\nimport { resolveRichTextTargetHandle } from \"../../context/richtext/targets.ts\"\nimport { isNullString } from \"../helpers.ts\"\nimport {\n\tinlineStylesNotSupportedForAttribute,\n\tinlineStyleIgnoredWhenPresetSet,\n\trichTextVariableDoesNotSupportInlineTextStyles,\n\tunsupportedAttributeFormatMessage,\n\tunsupportedAttributeMessage,\n} from \"../invalidValues.ts\"\nimport { nodeToDSLType, type DSLAttributes, type TraitWarning } from \"../types.ts\"\n\n// A node that supports one more textStyle attributes. For future traits, target nodes by property instead.\nexport type SupportedCanvasNode =\n\t| FormPlainTextInputNode\n\t| LinkStylePresetNode\n\t| RichTextNode\n\t| TextStylePresetNode\n\t| InlineCodeStylePresetNode\nexport type SupportedVirtualTextStyleNode = Extract<VirtualRichTextNode, WithVirtualTextStyles>\nexport type SupportedTextStyleNode = SupportedCanvasNode | SupportedVirtualTextStyleNode\n\ntype VirtualStyles = RichTextDocument | SupportedVirtualTextStyleNode\ntype TextStyleApplyFunction<T extends SupportedCanvasNode> = (\n\tnode: T | SupportedVirtualTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) => void\n\ninterface CreateTextStyleFromAttributesOptions<T extends SupportedCanvasNode> {\n\tkeys: readonly string[]\n\tsupportsCanvasNode: (node: CanvasNode) => node is T\n\tsuggestLinkStyleAlternative?: boolean\n\trejectWhenNodeHasPreset?: boolean\n\tapply: TextStyleApplyFunction<T>\n}\n\nconst log = getLogger(\"ai:agents:textStyle:utils\")\n\nexport function withStyleTarget(\n\tnode: SupportedTextStyleNode,\n\tctx: AgentContext,\n\thandlers: Partial<{\n\t\tTextStylePresetNode: (target: TextStylePresetNode) => void\n\t\tFormPlainTextInputNode: (target: FormPlainTextInputNode) => void\n\t\tInlineCodeStylePresetNode: (target: InlineCodeStylePresetNode) => void\n\t\tVirtualStyles: (target: VirtualStyles, parent: RichTextNode) => void\n\t\tLinkStylePresetNode: (target: LinkStylePresetNode) => void\n\t}>,\n): void {\n\tif (isVirtualRichTextNode(node) && withVirtualTextStyles(node)) {\n\t\tconst richTextTarget = ctx.virtualText.getTarget(node)\n\t\tconst targetNode = ctx.treeResolver.get(richTextTarget)\n\t\tassert(isRichTextNode(targetNode), \"Target is not a supported node\")\n\t\thandlers.VirtualStyles?.(node, targetNode)\n\t\treturn\n\t}\n\n\tif (isRichTextNode(node)) {\n\t\tconst document = ctx.virtualText.maybeHydrateDocument(node)\n\t\tif (!document) {\n\t\t\t// Reached withStyleTarget on a variable-bound RichTextNode. Trait code should have\n\t\t\t// rejected with a DSL warning earlier (see rejectTextStyleAttributesForRichTextVariableBinding).\n\t\t\t// Log so we get telemetry on the missing guard, but no-op to keep the agent loop sane.\n\t\t\tlog.reportError(\n\t\t\t\tnew Error(\n\t\t\t\t\t\"withStyleTarget reached for variable-bound RichTextNode without trait-level guard. The trait should have rejected this DSL command earlier.\",\n\t\t\t\t),\n\t\t\t\t{\n\t\t\t\t\tnodeId: node.id,\n\t\t\t\t},\n\t\t\t)\n\t\t\treturn\n\t\t}\n\n\t\thandlers.VirtualStyles?.(document, node)\n\t\treturn\n\t}\n\n\tif (isTextStylePresetNode(node)) {\n\t\thandlers.TextStylePresetNode?.(node)\n\t\treturn\n\t}\n\n\tif (isFormPlainTextInputNode(node)) {\n\t\thandlers.FormPlainTextInputNode?.(node)\n\t\treturn\n\t}\n\n\tif (isInlineCodeStylePresetNode(node)) {\n\t\thandlers.InlineCodeStylePresetNode?.(node)\n\t\treturn\n\t}\n\n\tif (isLinkStylePresetNode(node)) {\n\t\thandlers.LinkStylePresetNode?.(node)\n\t\treturn\n\t}\n\n\tassertNever(node)\n}\n\nexport function applyLinkStyle(\n\tlinkStylePrefix: LinkStyleKeyPrefix | undefined,\n\tsuffix: SupportedLinkStyleSuffix,\n\tvalue: unknown,\n\twarnings: TraitWarning[],\n\tdslKey: string,\n): (target: LinkStylePresetNode) => void {\n\treturn function (target) {\n\t\tif (!linkStylePrefix) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: dslKey,\n\t\t\t\tmessage: unsupportedAttributeMessage(ClassDiscriminator.LinkStylePresetNode, {\n\t\t\t\t\tdidYouMean: escapeValue(`link.${dslKey}`),\n\t\t\t\t}),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\ttarget.set({ [getLinkStyleKey(linkStylePrefix, suffix)]: value })\n\t}\n}\n\nfunction nodeHasPreset(node: SupportedTextStyleNode, attributes: DSLAttributes): boolean {\n\tif (isVirtualRichTextTextRun(node)) return false\n\tif (withVirtualTextBlockStyles(node)) return !isUndefined(node.textStylePreset)\n\tif (isRichTextNode(node)) {\n\t\tconst isBecomingPreset = isString(attributes.textStylePreset) && !isNullString(attributes.textStylePreset)\n\t\tif (isBecomingPreset) return true\n\n\t\tconst isClearingPreset = isNullString(attributes.textStylePreset)\n\t\tconst hasPreset = node.hasTextStylePresets(false)\n\n\t\tif (hasPreset && !isClearingPreset) return true\n\t}\n\n\treturn false\n}\n\nexport function createTextStyleFromAttributes<T extends SupportedCanvasNode>({\n\tkeys,\n\tsupportsCanvasNode,\n\tsuggestLinkStyleAlternative,\n\trejectWhenNodeHasPreset,\n\tapply,\n}: CreateTextStyleFromAttributesOptions<T>) {\n\treturn function fromAttributes(\n\t\tnode: CanvasNode | VirtualRichTextNode,\n\t\tattributes: DSLAttributes,\n\t\tctx: AgentContext,\n\t): TraitWarning[] | undefined {\n\t\tif (!isSupportedTextStyleNode(node, supportsCanvasNode)) {\n\t\t\treturn warnUnsupportedTextStyleKeys(\n\t\t\t\tnode,\n\t\t\t\tkeys,\n\t\t\t\tattributes,\n\t\t\t\tctx,\n\t\t\t\tsuggestLinkStyleAlternative ? { suggestLinkStyleAlternative } : undefined,\n\t\t\t)\n\t\t}\n\n\t\tconst warnings: TraitWarning[] = []\n\t\tif (rejectTextStyleAttributesForRichTextVariableBinding(node, attributes, warnings, keys)) {\n\t\t\treturn warnings\n\t\t}\n\n\t\tif (rejectTextStyleAttributesForUnsupportedInlineStyles(node, attributes, ctx, warnings, keys)) {\n\t\t\treturn warnings\n\t\t}\n\n\t\tif (rejectWhenNodeHasPreset && rejectTextStyleAttributesForPreset(node, attributes, warnings, keys)) {\n\t\t\treturn warnings\n\t\t}\n\n\t\tapply(node, attributes, ctx, warnings)\n\n\t\treturn warnings\n\t}\n}\n\nexport function hasRichTextVariableBinding(node: CanvasNode | VirtualRichTextNode): node is RichTextNode {\n\treturn node instanceof CanvasNode && isRichTextNode(node) && isVariableReference(node.htmlContent)\n}\n\nexport function rejectTextStyleAttributesForRichTextVariableBinding(\n\tnode: CanvasNode | VirtualRichTextNode,\n\tattributes: DSLAttributes,\n\twarnings: TraitWarning[],\n\tkeys: readonly string[],\n): boolean {\n\tif (!hasRichTextVariableBinding(node)) return false\n\n\tfor (const key of keys) {\n\t\tif (isUndefined(attributes[key])) continue\n\t\twarnings.push({\n\t\t\tkey,\n\t\t\tapplied: false,\n\t\t\tmessage: richTextVariableDoesNotSupportInlineTextStyles,\n\t\t})\n\t}\n\n\treturn true\n}\n\nfunction rejectTextStyleAttributesForUnsupportedInlineStyles(\n\tnode: CanvasNode | VirtualRichTextNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tkeys: readonly string[],\n): boolean {\n\tif (!isVirtualRichTextNode(node)) return false\n\n\tconst handle = resolveRichTextTargetHandle(ctx.virtualText.getTarget(node), ctx)\n\tif (handle?.capabilities.inlineStyles) return false\n\n\tfor (const key of keys) {\n\t\tif (isUndefined(attributes[key])) continue\n\t\twarnings.push({ key, applied: false, message: inlineStylesNotSupportedForAttribute(node, key, attributes[key]) })\n\t}\n\n\treturn true\n}\n\nfunction rejectTextStyleAttributesForPreset(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\twarnings: TraitWarning[],\n\tkeys: readonly string[],\n): boolean {\n\tif (!nodeHasPreset(node, attributes)) return false\n\n\tfor (const key of keys) {\n\t\tif (isUndefined(attributes[key])) continue\n\t\twarnings.push({ key, applied: false, message: inlineStyleIgnoredWhenPresetSet })\n\t}\n\n\treturn true\n}\n\nexport function isSupportedTextStyleNode<T extends SupportedCanvasNode>(\n\tnode: CanvasNode | VirtualRichTextNode,\n\tisSupportedCanvasNode: (node: CanvasNode) => node is T,\n): node is T | SupportedVirtualTextStyleNode {\n\tif (isVirtualRichTextNode(node) && withVirtualTextStyles(node)) return true\n\treturn node instanceof CanvasNode && isSupportedCanvasNode(node)\n}\n\nexport function warnUnsupportedTextStyleKeys(\n\tnode: CanvasNode | VirtualRichTextNode,\n\tkeys: readonly string[],\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\toptions?: { suggestLinkStyleAlternative?: boolean },\n) {\n\tconst warnings: TraitWarning[] = []\n\tconst nodeType = node instanceof CanvasNode ? nodeToDSLType(node, ctx) : getVirtualRichTextDSLNodeClass(node.type)\n\tconst suggestLinkAlternative =\n\t\toptions?.suggestLinkStyleAlternative === true && node instanceof CanvasNode && isLinkStylePresetNode(node)\n\n\tfor (const key of keys) {\n\t\tif (isUndefined(attributes[key])) continue\n\t\tconst message = suggestLinkAlternative\n\t\t\t? unsupportedAttributeMessage(nodeType, { didYouMean: escapeValue(`link.${key}`) })\n\t\t\t: unsupportedAttributeMessage(nodeType)\n\t\twarnings.push({ applied: false, key, message })\n\t}\n\n\treturn warnings\n}\n\nexport function notSupported(\n\twarnings: TraitWarning[],\n\tnodeType: ClassDiscriminator,\n\tkey: string,\n\tunsupportedFormat?: string,\n) {\n\treturn () => {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: key,\n\t\t\tmessage: unsupportedFormat\n\t\t\t\t? unsupportedAttributeFormatMessage(nodeType, unsupportedFormat)\n\t\t\t\t: unsupportedAttributeMessage(nodeType),\n\t\t})\n\t}\n}\n", "import { getFontUpdateValues } from \"document/components/utils/getFontUpdateValues.ts\"\nimport { CanvasNode, type RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport type { FormPlainTextInputNode } from \"document/models/CanvasTree/nodes/forms/FormPlainTextInputNode.ts\"\nimport {\n\tisFormPlainTextInputNode,\n\tisInlineCodeStylePresetNode,\n\tisLinkStylePresetNode,\n\tisRichTextNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getTextStylePresetKey } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport { textStyleDefaults, type WithTextStyle } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport {\n\tcssToVariationAxes,\n\tgetFontVariableSelectorFromFont,\n\tisFontVariable,\n\tparseAxesFromFontSelector,\n\tremoveEncodedAxesFromSelector,\n\treplaceEncodedAxesInSelector,\n} from \"document/models/CanvasTree/utils/variableFont.ts\"\nimport { fontStore, type FontFamily } from \"library/index.ts\"\nimport type { Font, ReadonlyFont } from \"library/render/fonts/types.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isNull, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport {\n\ttype WithVirtualTextStyles,\n\ttype VirtualRichTextNode,\n\tisVirtualRichTextTextBlock,\n\tisVirtualRichTextTextRun,\n\twithVirtualTextStyles,\n} from \"../../context/richtext/document.ts\"\nimport { applyFont as applyVirtualFont, applyInlineStyle } from \"../../context/richtext/styleInheritance.ts\"\nimport { isNullString } from \"../helpers.ts\"\nimport type { DSLAttributes, RoundedNumber, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"../types.ts\"\nimport { toRoundedNumber } from \"../types.ts\"\nimport { getBestMatchFontSelector, getFontSelector } from \"./fontSelector.ts\"\nimport {\n\tcreateTextStyleFromAttributes,\n\thasRichTextVariableBinding,\n\tisSupportedTextStyleNode,\n\ttype SupportedTextStyleNode,\n\twithStyleTarget,\n} from \"./utils.ts\"\n\ninterface FontAttributes {\n\tfontName: FontFamily[\"name\"]\n\tfontWeight: Font[\"weight\"]\n\tfontStyle: Font[\"style\"]\n\tfontVariationAxes: Record<string, number>\n}\n\nconst fontDefinition = {\n\tfontName: {\n\t\tdescription: \"string\",\n\t\toptional: true,\n\t},\n\tfontWeight: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n\tfontStyle: {\n\t\tdescription: \"normal | italic\",\n\t\toptional: true,\n\t},\n\tfontVariationAxes: {\n\t\t\"<tag>\": {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\n\t\t\t\t'fontVariationAxes.wght=\"500\"',\n\t\t\t\t'fontVariationAxes.opsz=\"12\"',\n\t\t\t\t'fontVariationAxes.wdth=\"125\"',\n\t\t\t\t'fontVariationAxes.slnt=\"-5\"',\n\t\t\t],\n\t\t\toptional: true,\n\t\t},\n\t},\n} satisfies TraitAttributeDefinition<FontAttributes>\n\ninterface SerializedFontAttributes {\n\tfontName?: string\n\tfontStyle?: string\n\tfontWeight?: RoundedNumber\n\tfontVariationAxes?: Record<string, RoundedNumber>\n}\n\ninterface CollectedFontAttributes {\n\tfont: WithTextStyle[\"font\"] | undefined\n\tfontStyle?: Font[\"style\"]\n\tfontWeight?: Font[\"weight\"]\n}\n\nconst fontAttributeKeys = objectKeys(fontDefinition)\n\ntype FontCanvasNode = RichTextNode | TextStylePresetNode | FormPlainTextInputNode | InlineCodeStylePresetNode\nfunction supportsFontCanvasNode(node: CanvasNode): node is FontCanvasNode {\n\treturn (\n\t\tisRichTextNode(node) ||\n\t\tisTextStylePresetNode(node) ||\n\t\tisFormPlainTextInputNode(node) ||\n\t\tisInlineCodeStylePresetNode(node)\n\t)\n}\n\nfunction collectCanvasFontAttributes(node: CanvasNode, ctx: AgentContext): CollectedFontAttributes | undefined {\n\tif (isInlineCodeStylePresetNode(node)) return { font: node.inlineCodeFont }\n\n\tif (isRichTextNode(node)) {\n\t\tif (node.hasTextStylePresets(false)) return\n\n\t\tconst document = ctx.virtualText.getDocument(node.id)\n\t\tif (!document) return\n\t\treturn {\n\t\t\tfont: document.inlineStyles.font,\n\t\t\tfontStyle: document.fontStyle,\n\t\t\tfontWeight: document.fontWeight,\n\t\t}\n\t}\n\n\tif (isTextStylePresetNode(node)) return { font: node.font }\n\tif (isFormPlainTextInputNode(node)) return { font: node.formInputFontSelector }\n}\n\nfunction collectFontAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\tctx: AgentContext,\n): CollectedFontAttributes | undefined {\n\tif (withVirtualTextStyles(node)) {\n\t\tif (isVirtualRichTextTextBlock(node) && !isUndefined(node.textStylePreset)) return\n\t\treturn { font: node.inlineStyles.font, fontStyle: node.fontStyle, fontWeight: node.fontWeight }\n\t}\n\n\tif (!(node instanceof CanvasNode)) return\n\treturn collectCanvasFontAttributes(node, ctx)\n}\n\n/**\n * Parses variation axes from object format (e.g., { wght: \"500\", opsz: \"12\" }). Returns `null` when\n * fontVariationAxes=\"null\" to indicate clearing all axes.\n */\nfunction parseVariationAxes(fontVariationAxes: unknown): Record<string, number> | null | undefined {\n\tif (isNullString(fontVariationAxes)) return null\n\tif (!isObject(fontVariationAxes)) return undefined\n\n\tconst axes: Record<string, number> = {}\n\tfor (const [tag, valueStr] of Object.entries(fontVariationAxes)) {\n\t\tconst value = tryParseNumber(valueStr)\n\t\tif (isUndefined(value)) continue\n\t\taxes[tag] = value\n\t}\n\n\treturn Object.keys(axes).length > 0 ? axes : undefined\n}\n\nfunction findAncestorInlineFontSelector(node: VirtualRichTextNode, ctx: AgentContext): string | undefined {\n\treturn ctx.virtualText.findInheritedValue(node, scope =>\n\t\twithVirtualTextStyles(scope) ? scope.inlineStyles.font : undefined,\n\t)\n}\n\nfunction getInheritedTextStylePresetFontSelector(\n\tnode: Extract<VirtualRichTextNode, WithVirtualTextStyles>,\n\tctx: AgentContext,\n): string | undefined {\n\tconst parentBlock = isVirtualRichTextTextRun(node) ? ctx.virtualText.getParentBlock(node) : node\n\tif (!parentBlock) return undefined\n\n\tconst explicitPresetId = parentBlock.textStylePreset\n\tif (explicitPresetId) {\n\t\tconst presetNode = ctx.treeResolver.get(explicitPresetId)\n\t\treturn isTextStylePresetNode(presetNode) ? presetNode.font : undefined\n\t}\n\n\tif (!isVirtualRichTextTextBlock(parentBlock)) return undefined\n\n\tconst richTextTarget = ctx.virtualText.getTarget(node)\n\tif (!richTextTarget) return undefined\n\n\tconst parentNode = ctx.treeResolver.get(richTextTarget)\n\tif (!parentNode || !isRichTextNode(parentNode)) return undefined\n\n\tconst presetId = parentNode[getTextStylePresetKey(parentBlock.tag)]\n\tif (!presetId) return undefined\n\n\tconst presetNode = ctx.treeResolver.get(presetId)\n\treturn isTextStylePresetNode(presetNode) ? presetNode.font : undefined\n}\n\ninterface ResolvedFont {\n\tfamily: { name: string }\n\tweight: number | undefined\n\tstyle: Font[\"style\"]\n\t/** Inherited weight from parent block or grandparent RichTextNode (virtual nodes only). */\n\tinheritedWeight?: number\n\t/** Inherited family name from parent block or grandparent RichTextNode (virtual nodes only). */\n\tinheritedFamilyName?: string\n\t/** Inherited style from parent block or grandparent RichTextNode (virtual nodes only). */\n\tinheritedStyle?: Font[\"style\"]\n}\n\ninterface ResolvedCurrentFont {\n\tcurrentSelector: string | undefined\n\texistingVariationAxes: Record<string, number> | undefined\n\tcurrentFont: ResolvedFont | undefined\n}\n\n/**\n * Resolves the current font selector and variation axes for a node. For virtual nodes (TextBlock /\n * TextRun), this also resolves inherited font properties from the parent block and grandparent\n * RichTextNode so that runs can fall back to their block's or the canvas node's font.\n */\nfunction resolveCurrentFont(node: SupportedTextStyleNode, ctx: AgentContext): ResolvedCurrentFont {\n\tlet currentSelector: string | undefined\n\tlet existingVariationAxes: Record<string, number> | undefined\n\n\tif (withVirtualTextStyles(node)) {\n\t\tconst stored = node.inlineStyles.font\n\t\tif (stored) {\n\t\t\tconst parsed = parseAxesFromFontSelector(stored)\n\t\t\tcurrentSelector = parsed.selector\n\t\t\texistingVariationAxes = parsed.axesCSS ? cssToVariationAxes(parsed.axesCSS) : undefined\n\t\t}\n\t} else if (isRichTextNode(node)) {\n\t\t// Fall back to the default font when no inline font is set, so partial font updates like\n\t\t// SET fontWeight=\"600\" on a fresh RichTextNode resolve instead of warning. Without this\n\t\t// the runtime renders Inter anyway, silently dropping the requested weight.\n\t\tconst stored = ctx.virtualText.getDocument(node.id)?.inlineStyles.font ?? textStyleDefaults.font\n\t\tconst parsed = parseAxesFromFontSelector(stored)\n\t\tcurrentSelector = parsed.selector\n\t\texistingVariationAxes = parsed.axesCSS ? cssToVariationAxes(parsed.axesCSS) : undefined\n\t} else if (isTextStylePresetNode(node)) {\n\t\tcurrentSelector = node.font\n\t\tif (currentSelector) {\n\t\t\tconst { selector, axesCSS } = parseAxesFromFontSelector(currentSelector)\n\t\t\texistingVariationAxes = axesCSS ? cssToVariationAxes(axesCSS) : undefined\n\t\t\tcurrentSelector = selector\n\t\t}\n\t} else if (isFormPlainTextInputNode(node)) {\n\t\tcurrentSelector = node.formInputFontSelector\n\t\tif (currentSelector) {\n\t\t\tconst { selector, axesCSS } = parseAxesFromFontSelector(currentSelector)\n\t\t\texistingVariationAxes = axesCSS ? cssToVariationAxes(axesCSS) : undefined\n\t\t\tcurrentSelector = selector\n\t\t}\n\t} else if (isInlineCodeStylePresetNode(node)) {\n\t\tcurrentSelector = node.inlineCodeFont\n\t\tif (currentSelector) {\n\t\t\tconst { selector, axesCSS } = parseAxesFromFontSelector(currentSelector)\n\t\t\texistingVariationAxes = axesCSS ? cssToVariationAxes(axesCSS) : undefined\n\t\t\tcurrentSelector = selector\n\t\t}\n\t} else if (isLinkStylePresetNode(node)) {\n\t\t// Link style nodes don't have direct font properties\n\t} else {\n\t\tassertNever(node)\n\t}\n\n\tconst baseFont = currentSelector ? fontStore.getFontBySelector(currentSelector) : undefined\n\tif (!withVirtualTextStyles(node)) {\n\t\treturn {\n\t\t\tcurrentSelector,\n\t\t\texistingVariationAxes,\n\t\t\tcurrentFont: baseFont ? { family: baseFont.family, weight: baseFont.weight, style: baseFont.style } : undefined,\n\t\t}\n\t}\n\n\t// For virtual nodes, resolve inherited font from parent block and grandparent RichTextNode\n\tconst parentBlock = isVirtualRichTextTextRun(node) ? ctx.virtualText.getParentBlock(node) : undefined\n\tlet parentNodeFont: ReadonlyFont | undefined\n\tconst inheritedPresetFontSelector = getInheritedTextStylePresetFontSelector(node, ctx)\n\tif (inheritedPresetFontSelector) {\n\t\tconst { selector } = parseAxesFromFontSelector(inheritedPresetFontSelector)\n\t\tparentNodeFont = fontStore.getFontBySelector(selector)\n\t}\n\t// Walk the ancestor chain (block \u2192 list item \u2192 list \u2192 ... \u2192 document root) and use the nearest\n\t// non-empty inlineStyles.font. Required when the document has mixed fonts and hoisting can only\n\t// lift the family onto a sub-tree (or not at all), leaving the run's hydrated ancestors with\n\t// just a selector in inlineStyles.font and their fontName/fontWeight scalars undefined.\n\tif (!parentNodeFont) {\n\t\tconst ancestorFontSelector = findAncestorInlineFontSelector(node, ctx)\n\t\tif (ancestorFontSelector) {\n\t\t\tconst { selector } = parseAxesFromFontSelector(ancestorFontSelector)\n\t\t\tparentNodeFont = fontStore.getFontBySelector(selector)\n\t\t}\n\t}\n\n\tconst resolvedFont: ResolvedFont | undefined = baseFont\n\t\t? { family: baseFont.family, weight: baseFont.weight, style: baseFont.style }\n\t\t: undefined\n\n\t// Attach inherited properties for virtual node fallback chain: run -> block -> RichTextNode\n\tconst inheritedWeight = parentBlock?.fontWeight ?? parentNodeFont?.weight\n\tconst inheritedFamilyName = parentBlock?.fontName ?? parentNodeFont?.family.name\n\tconst inheritedStyle = parentBlock?.fontStyle ?? parentNodeFont?.style\n\n\t// Run-level fontStyle/fontWeight override base and inherited for VirtualRun\n\tconst effectiveWeight =\n\t\tisVirtualRichTextTextRun(node) && !isUndefined(node.fontWeight)\n\t\t\t? node.fontWeight\n\t\t\t: (resolvedFont?.weight ?? inheritedWeight)\n\tconst effectiveStyle =\n\t\tisVirtualRichTextTextRun(node) && !isUndefined(node.fontStyle)\n\t\t\t? node.fontStyle\n\t\t\t: (resolvedFont?.style ?? inheritedStyle ?? \"normal\")\n\n\tif (resolvedFont) {\n\t\treturn {\n\t\t\tcurrentSelector,\n\t\t\texistingVariationAxes,\n\t\t\tcurrentFont: {\n\t\t\t\t...resolvedFont,\n\t\t\t\tweight: effectiveWeight,\n\t\t\t\tstyle: effectiveStyle,\n\t\t\t\tinheritedWeight,\n\t\t\t\tinheritedFamilyName,\n\t\t\t\tinheritedStyle,\n\t\t\t},\n\t\t}\n\t}\n\n\tif (!inheritedWeight && !inheritedFamilyName) {\n\t\treturn { currentSelector, existingVariationAxes, currentFont: undefined }\n\t}\n\n\treturn {\n\t\tcurrentSelector,\n\t\texistingVariationAxes,\n\t\tcurrentFont: {\n\t\t\tfamily: { name: inheritedFamilyName ?? \"\" },\n\t\t\tweight: effectiveWeight,\n\t\t\tstyle: effectiveStyle,\n\t\t\tinheritedWeight,\n\t\t\tinheritedFamilyName,\n\t\t\tinheritedStyle,\n\t\t},\n\t}\n}\n\nfunction applyFont(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n): string | undefined {\n\tconst attributeFontName = isString(attributes.fontName) ? attributes.fontName : undefined\n\tconst attributeFontWeight = isString(attributes.fontWeight) ? attributes.fontWeight : undefined\n\tconst attributeFontStyle = isString(attributes.fontStyle) ? attributes.fontStyle : undefined\n\tconst newVariationAxes = parseVariationAxes(attributes.fontVariationAxes)\n\tconst axesProvided = !isUndefined(newVariationAxes)\n\n\tconst hasFontProps = attributeFontName || attributeFontWeight || attributeFontStyle\n\tif (!hasFontProps && !axesProvided) return undefined\n\n\tconst { currentSelector, existingVariationAxes, currentFont } = resolveCurrentFont(node, ctx)\n\n\tlet fontSelector: string | undefined = currentSelector\n\n\tconst fontWeight = attributeFontWeight\n\t\t? tryParseNumber(attributeFontWeight, true)\n\t\t: (currentFont?.weight ?? currentFont?.inheritedWeight)\n\tif (hasFontProps) {\n\t\tconst fontName = attributeFontName ?? currentFont?.family.name ?? currentFont?.inheritedFamilyName\n\t\tif (!fontName) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"fontName\",\n\t\t\t\tmessage: \"Could not resolve a font family name. Provide a fontName.\",\n\t\t\t})\n\t\t\treturn undefined\n\t\t}\n\n\t\tlet fontStyle: Font[\"style\"] = currentFont?.style ?? currentFont?.inheritedStyle ?? \"normal\"\n\t\tif (isFontStyle(attributeFontStyle)) fontStyle = attributeFontStyle\n\n\t\tif (fontWeight && fontStyle) fontSelector = getFontSelector({ fontName, fontWeight, fontStyle })\n\n\t\t// If exact combo not found, try the closest match within the family. This prevents falling\n\t\t// through with no selector (and inheriting the wrong family) when e.g. the requested style\n\t\t// or weight doesn't exist as a static font in the family.\n\t\tif (!fontSelector) {\n\t\t\tfontSelector = getBestMatchFontSelector(fontName, fontWeight, fontStyle)\n\t\t}\n\t}\n\n\tif (!fontSelector) {\n\t\tif (hasFontProps) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"fontName\",\n\t\t\t\tmessage: `Could not find a font matching the provided attributes. Verify the fontName is available.`,\n\t\t\t})\n\t\t}\n\t\treturn undefined\n\t}\n\n\t// If variation axes are provided, switch to variable font if needed and encode axes.\n\tif (axesProvided) {\n\t\tif (isNull(newVariationAxes)) {\n\t\t\tfontSelector = removeEncodedAxesFromSelector(fontSelector)\n\t\t} else {\n\t\t\tconst font = fontStore.getFontBySelector(fontSelector)\n\t\t\tif (font && !isFontVariable(font)) {\n\t\t\t\t// Switch to the variable font version\n\t\t\t\tconst variableSelector = getFontVariableSelectorFromFont(font)\n\t\t\t\tif (!variableSelector) {\n\t\t\t\t\twarnings.push({\n\t\t\t\t\t\tapplied: false,\n\t\t\t\t\t\tkey: \"fontVariationAxes\",\n\t\t\t\t\t\tmessage: \"This font does not have a variable font variant. Variation axes cannot be applied.\",\n\t\t\t\t\t})\n\t\t\t\t\treturn undefined\n\t\t\t\t}\n\t\t\t\tfontSelector = variableSelector\n\t\t\t}\n\n\t\t\t// Merge new axes with existing axes (new axes take precedence). This ensures that\n\t\t\t// applying only one axis (e.g., opsz) doesn't nuke other existing axes (e.g., wght).\n\t\t\tconst mergedAxes: Record<string, number> = { ...existingVariationAxes, ...newVariationAxes }\n\n\t\t\t// If fontWeight is specified but wght is not in the axes, preserve it. This prevents\n\t\t\t// losing the font weight when switching to a variable font.\n\t\t\tif (fontWeight && isUndefined(mergedAxes.wght)) mergedAxes.wght = fontWeight\n\n\t\t\t// Encode axes into the selector\n\t\t\tfontSelector = replaceEncodedAxesInSelector(fontSelector, mergedAxes)\n\t\t}\n\t}\n\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => {\n\t\t\ttarget.set({ font: fontSelector, ...getFontUpdateValues(target, fontSelector) })\n\t\t},\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: target => {\n\t\t\tconst { selector, axesCSS } = parseAxesFromFontSelector(fontSelector)\n\t\t\tconst font = fontStore.getFontBySelector(selector)\n\t\t\ttarget.set({\n\t\t\t\tformInputFontSelector: fontSelector,\n\t\t\t\tformInputFontFamily: font?.family.name,\n\t\t\t\tformInputFontWeight: axesCSS ? cssToVariationAxes(axesCSS)?.wght : font?.weight,\n\t\t\t\tformInputFontStyle: font?.style ?? \"normal\",\n\t\t\t})\n\t\t},\n\t\t[ClassDiscriminator.InlineCodeStylePresetNode]: target => target.set({ inlineCodeFont: fontSelector }),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"font\", fontSelector)\n\t\t\tif (fontSelector) {\n\t\t\t\tconst { selector, axesCSS } = parseAxesFromFontSelector(fontSelector)\n\t\t\t\tconst font = fontStore.getFontBySelector(selector)\n\t\t\t\tapplyVirtualFont(target, {\n\t\t\t\t\tname: font?.family.name,\n\t\t\t\t\tweight: axesCSS ? cssToVariationAxes(axesCSS)?.wght : font?.weight,\n\t\t\t\t\tstyle: font?.style ?? \"normal\",\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t})\n\n\treturn fontSelector\n}\n\nfunction applyCollectedFontOverrides(\n\tattributes: SerializedFontAttributes,\n\tcollectedAttributes: CollectedFontAttributes,\n): void {\n\tif (!isUndefined(collectedAttributes.fontStyle)) {\n\t\tattributes.fontStyle = collectedAttributes.fontStyle\n\t}\n\tif (!isUndefined(collectedAttributes.fontWeight)) {\n\t\tattributes.fontWeight = toRoundedNumber(collectedAttributes.fontWeight)\n\t}\n}\n\nfunction serializeFontAttributes(\n\tcollectedAttributes: CollectedFontAttributes,\n\tnode: CanvasNode | VirtualRichTextNode,\n\tctx: AgentContext,\n): SerializedFontAttributes {\n\tconst attributes: SerializedFontAttributes = {}\n\tconst value = collectedAttributes.font\n\n\tif (isUndefined(value)) {\n\t\tapplyCollectedFontOverrides(attributes, collectedAttributes)\n\t\treturn attributes\n\t}\n\n\t// Parse font selector to check for encoded variation axes\n\tconst { selector, axesCSS } = parseAxesFromFontSelector(value)\n\tconst font = fontStore.getFontBySelector(selector)\n\n\tattributes.fontName = font?.family.name\n\n\t// Use resolveCurrentFont for virtual rich text so run-level fontStyle/fontWeight\n\t// overrides are applied in one place.\n\tlet fontStyle: Font[\"style\"] | undefined\n\tlet fontWeight: number | undefined\n\tif (withVirtualTextStyles(node)) {\n\t\tconst { currentFont } = resolveCurrentFont(node, ctx)\n\t\tfontStyle = currentFont?.style\n\t\tfontWeight = currentFont?.weight\n\t} else {\n\t\tfontStyle = font?.style\n\t\tfontWeight = font?.weight\n\t}\n\tattributes.fontStyle = fontStyle\n\n\t// Extract variation axes and font weight for the LLM context. We always want to\n\t// report fontWeight (for both variable and static fonts), preferring the wght axis\n\t// value when available for variable fonts.\n\tif (axesCSS) {\n\t\tconst axes = cssToVariationAxes(axesCSS)\n\t\tif (axes) {\n\t\t\tattributes.fontVariationAxes = Object.fromEntries(\n\t\t\t\tObject.entries(axes).map(([axis, axisValue]) => [axis, toRoundedNumber(axisValue)]),\n\t\t\t)\n\t\t\t// If wght axis is present, use it as the weight (variable font)\n\t\t\tif (!isUndefined(axes.wght)) {\n\t\t\t\tattributes.fontWeight = toRoundedNumber(axes.wght)\n\t\t\t} else {\n\t\t\t\t// Variable font without wght axis - fall back to font's base weight\n\t\t\t\tattributes.fontWeight = isNumber(fontWeight) ? toRoundedNumber(fontWeight) : undefined\n\t\t\t}\n\t\t} else {\n\t\t\tattributes.fontWeight = isNumber(fontWeight) ? toRoundedNumber(fontWeight) : undefined\n\t\t}\n\t} else {\n\t\t// No variation axes - use the static font's weight\n\t\tattributes.fontWeight = isNumber(fontWeight) ? toRoundedNumber(fontWeight) : undefined\n\t}\n\n\tapplyCollectedFontOverrides(attributes, collectedAttributes)\n\treturn attributes\n}\n\nfunction isFontStyle(style: unknown): style is Font[\"style\"] {\n\treturn style === \"normal\" || style === \"italic\"\n}\n\nconst fromAttributes = createTextStyleFromAttributes({\n\tkeys: fontAttributeKeys,\n\tsupportsCanvasNode: supportsFontCanvasNode,\n\trejectWhenNodeHasPreset: true,\n\tapply: (node, attributes, ctx, warnings) => {\n\t\tapplyFont(node, attributes, ctx, warnings)\n\t},\n})\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): SerializedFontAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, supportsFontCanvasNode)) return\n\tif (hasRichTextVariableBinding(node)) return\n\n\tconst collectedAttributes = collectFontAttributes(node, ctx)\n\tif (!collectedAttributes) return\n\n\treturn serializeFontAttributes(collectedAttributes, node, ctx)\n}\n\nexport const font = {\n\tfor: supportsFontCanvasNode,\n\tdefinition: fontDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedFontAttributes>\n", "import { CanvasNode, type RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport type { FormPlainTextInputNode } from \"document/models/CanvasTree/nodes/forms/FormPlainTextInputNode.ts\"\nimport {\n\tisFormPlainTextInputNode,\n\tisRichTextNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getTextStylePresetDefault } from \"document/models/CanvasTree/records/TextStylePresetRecord.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasTextFit, textFitDefaults } from \"document/models/CanvasTree/traits/WithTextFit.ts\"\nimport { isValidFontSizeUnit, type WithTextStyle } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport {\n\tcreateCSSDimension,\n\tisCSSDimension,\n\tparseCSSDimension,\n} from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isArray, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport {\n\tisVirtualRichTextNode,\n\tisVirtualRichTextTextBlock,\n\ttype VirtualRichTextNode,\n\twithVirtualTextStyles,\n} from \"../../context/richtext/document.ts\"\nimport { applyInlineStyle } from \"../../context/richtext/styleInheritance.ts\"\nimport { isNullString, nullString } from \"../helpers.ts\"\nimport {\n\texpectedAttributeMessage,\n\tinlineFontSizeNotSupportedWithAutoFit,\n\tsetToDefaultValueMessage,\n\ttraitNotAppliedWarning,\n} from \"../invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"../types.ts\"\nimport { toRoundedNumber } from \"../types.ts\"\nimport {\n\tcreateTextStyleFromAttributes,\n\thasRichTextVariableBinding,\n\tisSupportedTextStyleNode,\n\tnotSupported,\n\ttype SupportedTextStyleNode,\n\twithStyleTarget,\n} from \"./utils.ts\"\n\nexport interface SerializedFontSizeAttributes {\n\tfontSize?: string\n}\n\nconst fontSizeDefinition = {\n\tfontSize: {\n\t\tdescription: `number | \\${number}px | \\${number}rem | auto-fit(\\${number}%) | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<Pick<WithTextStyle, \"fontSize\">>\n\nconst fontSizeAttributeKeys = Object.keys(fontSizeDefinition)\n\ntype FontSizeCanvasNode = RichTextNode | TextStylePresetNode | FormPlainTextInputNode\n\nfunction supportsFontSizeCanvasNode(node: CanvasNode): node is FontSizeCanvasNode {\n\treturn isRichTextNode(node) || isTextStylePresetNode(node) || isFormPlainTextInputNode(node)\n}\n\nconst autoFitDimensionRegExp = /^auto-fit\\(\\s*(?<percentage>[+-]?\\d+(?:\\.\\d+)?%)\\s*\\)$/iu\n\nfunction parseAutoFitDimension(value: string): number | undefined {\n\tconst match = autoFitDimensionRegExp.exec(value.trim())\n\tconst percentage = match?.groups?.percentage\n\tif (!percentage) return\n\tconst [scale, unit] = parseCSSDimension(percentage, \"%\")\n\tif (!isNumber(scale) || unit !== \"%\") return\n\treturn scale\n}\n\nfunction applyFontSize(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) {\n\tconst value = attributes.fontSize\n\tif (!isString(value)) return\n\n\tif (isNullString(value)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => {\n\t\t\t\tconst defaultValue = getTextStylePresetDefault(target, \"fontSize\")\n\t\t\t\ttarget.set({ fontSize: defaultValue })\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: true,\n\t\t\t\t\tkey: \"fontSize\",\n\t\t\t\t\tmessage: setToDefaultValueMessage(\"fontSize\", ClassDiscriminator.TextStylePresetNode, defaultValue),\n\t\t\t\t})\n\t\t\t},\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: target => target.set({ formInputFontSize: undefined }),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"fontSize\", undefined)\n\t\t\t\tif (!withVirtualTextStyles(node) && isRichTextNode(node) && hasTextFit(node)) {\n\t\t\t\t\tnode.set(textFitDefaults)\n\t\t\t\t}\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\t\"fontSize\",\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\n\tconst autoFitScale = parseAutoFitDimension(value)\n\tif (isNumber(autoFitScale)) {\n\t\tif (isVirtualRichTextNode(node) || !isRichTextNode(node)) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"fontSize\",\n\t\t\t\tmessage: 'Invalid value \"auto-fit(...)\" - auto-fit font sizing is only supported on top-level RichTextNode.',\n\t\t\t})\n\t\t\treturn warnings\n\t\t}\n\t\tnode.set({ textFitScale: autoFitScale / 100 })\n\t\tctx.deferred.markTextFitDirty(node.id)\n\t\treturn warnings\n\t}\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, { node })\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"fontSize\", message)))\n\t\treturn warnings\n\t}\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.TextStylePresetNode,\n\t\t\t\t\"fontSize\",\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\t\"fontSize\",\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t\tVirtualStyles: (target, parent) => {\n\t\t\t\tif (resolveHandleResult.handle.type !== \"variableReference\") return\n\t\t\t\tif (isVirtualRichTextNode(node) && hasTextFit(parent)) {\n\t\t\t\t\twarnings.push({\n\t\t\t\t\t\tapplied: false,\n\t\t\t\t\t\tkey: \"fontSize\",\n\t\t\t\t\t\tmessage: inlineFontSizeNotSupportedWithAutoFit,\n\t\t\t\t\t})\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tconst fontSize = resolveHandleResult.handle.reference(parent)\n\t\t\t\tapplyInlineStyle(target, \"fontSize\", fontSize)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\t\"fontSize\",\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t})\n\n\t\treturn warnings\n\t}\n\n\tif (!isString(value)) return\n\tconst [parsedValue, unit] = parseCSSDimension(value)\n\tif (Number.isNaN(parsedValue) || !isValidFontSizeUnit(unit)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"fontSize\",\n\t\t\tmessage: expectedAttributeMessage(value, fontSizeDefinition.fontSize.description),\n\t\t})\n\t\treturn\n\t}\n\n\tconst fontSizeStr = createCSSDimension(parsedValue, unit)\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ fontSize: fontSizeStr }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: target => target.set({ formInputFontSize: fontSizeStr }),\n\t\tVirtualStyles: (target, parent) => {\n\t\t\tif (isVirtualRichTextNode(node) && hasTextFit(parent)) {\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: \"fontSize\",\n\t\t\t\t\tmessage: inlineFontSizeNotSupportedWithAutoFit,\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tapplyInlineStyle(target, \"fontSize\", [parsedValue, unit])\n\t\t\tif (!isVirtualRichTextNode(node) && isRichTextNode(node) && hasTextFit(node)) {\n\t\t\t\tnode.set(textFitDefaults)\n\t\t\t}\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\"fontSize\",\n\t\t),\n\t})\n\n\treturn warnings\n}\n\nconst fromAttributes = createTextStyleFromAttributes({\n\tkeys: fontSizeAttributeKeys,\n\tsupportsCanvasNode: supportsFontSizeCanvasNode,\n\trejectWhenNodeHasPreset: true,\n\tapply: applyFontSize,\n})\n\nfunction collectFontSize(node: CanvasNode | VirtualRichTextNode, ctx: AgentContext): unknown {\n\tif (withVirtualTextStyles(node)) {\n\t\tif (isVirtualRichTextTextBlock(node) && !isUndefined(node.textStylePreset)) return\n\t\tconst rawFontSize = node.inlineStyles.fontSize\n\t\treturn isArray(rawFontSize) ? rawFontSize : undefined\n\t}\n\n\tif (!(node instanceof CanvasNode)) return\n\n\tif (isRichTextNode(node)) {\n\t\tif (node.hasTextStylePresets(false)) return\n\t\tif (hasTextFit(node)) return getAutoFitSize(node)\n\t\tconst rawFontSize = ctx.virtualText.getDocument(node.id)?.inlineStyles.fontSize\n\t\treturn isArray(rawFontSize) ? rawFontSize : undefined\n\t}\n\n\tif (isTextStylePresetNode(node)) return\n\n\tif (isFormPlainTextInputNode(node)) {\n\t\treturn isCSSDimension(node.formInputFontSize)\n\t\t\t? parseCSSDimension(node.formInputFontSize)\n\t\t\t: parseCSSDimension(`${node.formInputFontSize ?? 12}px`)\n\t}\n}\n\nfunction getAutoFitSize(node: RichTextNode): unknown {\n\treturn `auto-fit(${toRoundedNumber((node.textFitScale ?? 1) * 100)}%)`\n}\n\nfunction serializeFontSize(\n\tvalue: unknown,\n\tctx: AgentContext,\n\tnode: CanvasNode | VirtualRichTextNode,\n): SerializedFontSizeAttributes | undefined {\n\tif (isUndefined(value)) return\n\tif (isVariableReference(value)) {\n\t\tconst resolved = ctx.dynamicValues.resolveAttributeFromDynamicValue(value, node)\n\t\treturn isUndefined(resolved) ? undefined : { fontSize: resolved }\n\t}\n\tif (isNumber(value)) return { fontSize: createCSSDimension(value, \"px\") }\n\tif (isString(value)) return { fontSize: value }\n\tif (!isArray(value)) return\n\n\tconst [size, unit] = value\n\tif (!isNumber(size) || !isString(unit)) return\n\n\treturn { fontSize: `${size}${unit}` }\n}\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): SerializedFontSizeAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, supportsFontSizeCanvasNode)) return\n\tif (hasRichTextVariableBinding(node)) return\n\n\treturn serializeFontSize(collectFontSize(node, ctx), ctx, node)\n}\n\nexport const fontSize = {\n\tfor: supportsFontSizeCanvasNode,\n\tdefinition: fontSizeDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedFontSizeAttributes>\n", "import { CanvasNode, type RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport type { FormPlainTextInputNode } from \"document/models/CanvasTree/nodes/forms/FormPlainTextInputNode.ts\"\nimport {\n\tisFormPlainTextInputNode,\n\tisRichTextNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getTextStylePresetDefault } from \"document/models/CanvasTree/records/TextStylePresetRecord.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isLetterSpacingUnit, type WithTextStyle } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isArray, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport {\n\ttype VirtualRichTextNode,\n\tisVirtualRichTextTextBlock,\n\twithVirtualTextStyles,\n} from \"../../context/richtext/document.ts\"\nimport { applyInlineStyle } from \"../../context/richtext/styleInheritance.ts\"\nimport { isNullString, nullString } from \"../helpers.ts\"\nimport { expectedAttributeMessage, setToDefaultValueMessage } from \"../invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"../types.ts\"\nimport {\n\tcreateTextStyleFromAttributes,\n\thasRichTextVariableBinding,\n\tisSupportedTextStyleNode,\n\tnotSupported,\n\twithStyleTarget,\n\ttype SupportedTextStyleNode,\n} from \"./utils.ts\"\n\nexport interface SerializedLetterSpacingAttributes {\n\tletterSpacing?: string\n}\n\nconst letterSpacingDefinition = {\n\tletterSpacing: {\n\t\tdescription: `number | \\${number}px | \\${number}rem | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<Pick<WithTextStyle, \"letterSpacing\">>\n\nconst letterSpacingAttributeKeys = Object.keys(letterSpacingDefinition)\n\ntype LetterSpacingCanvasNode = RichTextNode | TextStylePresetNode | FormPlainTextInputNode\n\nfunction supportsLetterSpacingCanvasNode(node: CanvasNode): node is LetterSpacingCanvasNode {\n\treturn isRichTextNode(node) || isTextStylePresetNode(node) || isFormPlainTextInputNode(node)\n}\n\nfunction applyLetterSpacing(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) {\n\tif (!isString(attributes.letterSpacing)) return\n\n\tif (isNullString(attributes.letterSpacing)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => {\n\t\t\t\tconst defaultValue = getTextStylePresetDefault(target, \"letterSpacing\")\n\t\t\t\ttarget.set({ letterSpacing: defaultValue })\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: true,\n\t\t\t\t\tkey: \"letterSpacing\",\n\t\t\t\t\tmessage: setToDefaultValueMessage(\"letterSpacing\", ClassDiscriminator.TextStylePresetNode, defaultValue),\n\t\t\t\t})\n\t\t\t},\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: target =>\n\t\t\t\ttarget.set({ formInputFontLetterSpacing: undefined, formInputFontLetterSpacingUnit: undefined }),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"letterSpacing\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\t\"letterSpacing\",\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\n\tconst [value, unit] = parseCSSDimension(attributes.letterSpacing)\n\tif (Number.isNaN(value) || !isLetterSpacingUnit(unit)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"letterSpacing\",\n\t\t\tmessage: expectedAttributeMessage(attributes.letterSpacing, letterSpacingDefinition.letterSpacing.description),\n\t\t})\n\t\treturn\n\t}\n\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => {\n\t\t\ttarget.set({ letterSpacing: [value, unit] })\n\t\t},\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: target =>\n\t\t\ttarget.set({ formInputFontLetterSpacing: value, formInputFontLetterSpacingUnit: unit }),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"letterSpacing\", [value, unit])\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\"letterSpacing\",\n\t\t),\n\t})\n}\n\nconst fromAttributes = createTextStyleFromAttributes({\n\tkeys: letterSpacingAttributeKeys,\n\tsupportsCanvasNode: supportsLetterSpacingCanvasNode,\n\trejectWhenNodeHasPreset: true,\n\tapply: applyLetterSpacing,\n})\n\nfunction collectLetterSpacing(node: CanvasNode | VirtualRichTextNode, ctx: AgentContext): unknown {\n\tif (withVirtualTextStyles(node)) {\n\t\tif (isVirtualRichTextTextBlock(node) && !isUndefined(node.textStylePreset)) return\n\t\treturn node.inlineStyles.letterSpacing\n\t}\n\n\tif (!(node instanceof CanvasNode)) return\n\n\tif (isRichTextNode(node)) {\n\t\tif (node.hasTextStylePresets(false)) return\n\t\treturn ctx.virtualText.getDocument(node.id)?.inlineStyles.letterSpacing\n\t}\n\n\tif (isTextStylePresetNode(node)) return\n\n\tif (isFormPlainTextInputNode(node)) {\n\t\treturn node.formInputFontLetterSpacing !== undefined\n\t\t\t? [node.formInputFontLetterSpacing, node.formInputFontLetterSpacingUnit ?? \"px\"]\n\t\t\t: undefined\n\t}\n}\n\nfunction serializeLetterSpacing(\n\tvalue: unknown,\n\tctx: AgentContext,\n\tnode: CanvasNode | VirtualRichTextNode,\n): SerializedLetterSpacingAttributes | undefined {\n\tif (isUndefined(value)) return\n\tif (isVariableReference(value)) {\n\t\tconst resolved = ctx.dynamicValues.resolveAttributeFromDynamicValue(value, node)\n\t\treturn isUndefined(resolved) ? undefined : { letterSpacing: resolved }\n\t}\n\tif (isNumber(value)) return { letterSpacing: createCSSDimension(value, \"px\") }\n\tif (isString(value)) return { letterSpacing: value }\n\tif (!isArray(value)) return\n\n\tconst [size, unit] = value\n\tif (!isNumber(size) || !isString(unit)) return\n\n\treturn { letterSpacing: `${size}${unit}` }\n}\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): SerializedLetterSpacingAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, supportsLetterSpacingCanvasNode)) return\n\tif (hasRichTextVariableBinding(node)) return\n\n\treturn serializeLetterSpacing(collectLetterSpacing(node, ctx), ctx, node)\n}\n\nexport const letterSpacing = {\n\tfor: supportsLetterSpacingCanvasNode,\n\tdefinition: letterSpacingDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedLetterSpacingAttributes>\n", "import { CanvasNode, type RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport type { FormPlainTextInputNode } from \"document/models/CanvasTree/nodes/forms/FormPlainTextInputNode.ts\"\nimport {\n\tisFormPlainTextInputNode,\n\tisRichTextNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getTextStylePresetDefault } from \"document/models/CanvasTree/records/TextStylePresetRecord.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isLineHeightUnit, type WithTextStyle } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isArray, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport { type VirtualRichTextNode, withVirtualTextBlockStyles } from \"../../context/richtext/document.ts\"\nimport { applyBlockStyle } from \"../../context/richtext/styleInheritance.ts\"\nimport { isNullString, nullString } from \"../helpers.ts\"\nimport { expectedAttributeMessage, setToDefaultValueMessage } from \"../invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"../types.ts\"\nimport {\n\tcreateTextStyleFromAttributes,\n\thasRichTextVariableBinding,\n\tisSupportedTextStyleNode,\n\tnotSupported,\n\twithStyleTarget,\n\ttype SupportedTextStyleNode,\n} from \"./utils.ts\"\n\nexport interface SerializedLineHeightAttributes {\n\tlineHeight?: string\n}\n\nconst lineHeightDefinition = {\n\tlineHeight: {\n\t\tdescription: `number | \\${number}px | \\${number}em | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<Pick<WithTextStyle, \"lineHeight\">>\n\nconst lineHeightAttributeKeys = Object.keys(lineHeightDefinition)\n\ntype LineHeightCanvasNode = RichTextNode | TextStylePresetNode | FormPlainTextInputNode\n\nfunction supportsLineHeightCanvasNode(node: CanvasNode): node is LineHeightCanvasNode {\n\treturn isRichTextNode(node) || isTextStylePresetNode(node) || isFormPlainTextInputNode(node)\n}\n\nfunction applyLineHeight(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) {\n\tif (!isString(attributes.lineHeight)) return\n\n\tif (isNullString(attributes.lineHeight)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => {\n\t\t\t\tconst defaultValue = getTextStylePresetDefault(target, \"lineHeight\")\n\t\t\t\ttarget.set({ lineHeight: defaultValue })\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: true,\n\t\t\t\t\tkey: \"lineHeight\",\n\t\t\t\t\tmessage: setToDefaultValueMessage(\"lineHeight\", ClassDiscriminator.TextStylePresetNode, defaultValue),\n\t\t\t\t})\n\t\t\t},\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: target =>\n\t\t\t\ttarget.set({ formInputFontLineHeight: undefined, formInputFontLineHeightUnit: undefined }),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tif (!withVirtualTextBlockStyles(target)) return\n\t\t\t\tapplyBlockStyle(target, \"lineHeight\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\t\"lineHeight\",\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\n\tconst [value, unit] = parseCSSDimension(attributes.lineHeight, \"em\")\n\tif (Number.isNaN(value) || !isLineHeightUnit(unit)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"lineHeight\",\n\t\t\tmessage: expectedAttributeMessage(attributes.lineHeight, lineHeightDefinition.lineHeight.description),\n\t\t})\n\t\treturn\n\t}\n\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ lineHeight: [value, unit] }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: target =>\n\t\t\ttarget.set({ formInputFontLineHeight: value, formInputFontLineHeightUnit: unit }),\n\t\tVirtualStyles: target => {\n\t\t\t// Line height is block-level only (BlockStyles).\n\t\t\tif (!withVirtualTextBlockStyles(target)) return\n\t\t\tapplyBlockStyle(target, \"lineHeight\", [value, unit])\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\"lineHeight\",\n\t\t),\n\t})\n}\n\nconst fromAttributes = createTextStyleFromAttributes({\n\tkeys: lineHeightAttributeKeys,\n\tsupportsCanvasNode: supportsLineHeightCanvasNode,\n\trejectWhenNodeHasPreset: true,\n\tapply: applyLineHeight,\n})\n\nfunction collectLineHeight(node: CanvasNode | VirtualRichTextNode, ctx: AgentContext): unknown {\n\tif (withVirtualTextBlockStyles(node)) {\n\t\tif (!isUndefined(node.textStylePreset)) return\n\t\treturn node.blockStyles.lineHeight\n\t}\n\n\tif (!(node instanceof CanvasNode)) return\n\n\tif (isRichTextNode(node)) {\n\t\tif (node.hasTextStylePresets(false)) return\n\t\treturn ctx.virtualText.getDocument(node.id)?.blockStyles.lineHeight\n\t}\n\n\tif (isTextStylePresetNode(node)) return\n\n\tif (isFormPlainTextInputNode(node)) {\n\t\treturn node.formInputFontLineHeight !== undefined\n\t\t\t? [node.formInputFontLineHeight, node.formInputFontLineHeightUnit ?? \"px\"]\n\t\t\t: undefined\n\t}\n}\n\nfunction serializeLineHeight(\n\tvalue: unknown,\n\tctx: AgentContext,\n\tnode: CanvasNode | VirtualRichTextNode,\n): SerializedLineHeightAttributes | undefined {\n\tif (isUndefined(value)) return\n\tif (isVariableReference(value)) {\n\t\tconst resolved = ctx.dynamicValues.resolveAttributeFromDynamicValue(value, node)\n\t\treturn isUndefined(resolved) ? undefined : { lineHeight: resolved }\n\t}\n\tif (isNumber(value)) return { lineHeight: createCSSDimension(value, \"px\") }\n\tif (isString(value)) return { lineHeight: value }\n\tif (!isArray(value)) return\n\n\tconst [size, unit] = value\n\tif (!isNumber(size) || !isString(unit)) return\n\n\treturn { lineHeight: `${size}${unit}` }\n}\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): SerializedLineHeightAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, supportsLineHeightCanvasNode)) return\n\tif (hasRichTextVariableBinding(node)) return\n\n\treturn serializeLineHeight(collectLineHeight(node, ctx), ctx, node)\n}\n\nexport const lineHeight = {\n\tfor: supportsLineHeightCanvasNode,\n\tdefinition: lineHeightDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedLineHeightAttributes>\n", "import { assertNever } from \"@framerjs/shared\"\nimport { CanvasNode, type RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport type { FormPlainTextInputNode } from \"document/models/CanvasTree/nodes/forms/FormPlainTextInputNode.ts\"\nimport {\n\tisFormPlainTextInputNode,\n\tisLinkStylePresetNode,\n\tisRichTextNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tisFeatureAppliedByDefault,\n\tisOpenTypeFeatureTag,\n\ttype OpenTypeFeatureTag,\n} from \"document/models/CanvasTree/utils/openType.ts\"\nimport { isArray, isObject, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport {\n\ttype VirtualRichTextNode,\n\tisVirtualRichTextTextBlock,\n\twithVirtualTextStyles,\n} from \"../../context/richtext/document.ts\"\nimport { applyInlineStyle } from \"../../context/richtext/styleInheritance.ts\"\nimport { isNullString } from \"../helpers.ts\"\nimport { expectedAttributeMessage, unsupportedAttributeMessage } from \"../invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"../types.ts\"\nimport {\n\tcreateTextStyleFromAttributes,\n\thasRichTextVariableBinding,\n\tisSupportedTextStyleNode,\n\tnotSupported,\n\twithStyleTarget,\n\ttype SupportedVirtualTextStyleNode,\n} from \"./utils.ts\"\n\nexport interface SerializedOpenTypeFontFeaturesAttributes {\n\topenTypeFontFeatures?: Record<string, \"on\" | \"off\">\n}\n\ninterface OpenTypeFontFeaturesAttributes {\n\topenTypeFontFeatures: Record<string, string>\n}\n\nconst openTypeFontFeaturesDefinition = {\n\topenTypeFontFeatures: {\n\t\t\"<tag>\": {\n\t\t\tdescription: \"on | off\",\n\t\t\texamples: [\n\t\t\t\t'openTypeFontFeatures.liga=\"on\"',\n\t\t\t\t'openTypeFontFeatures.dlig=\"on\"',\n\t\t\t\t'openTypeFontFeatures.smcp=\"on\"',\n\t\t\t\t'openTypeFontFeatures.ss01=\"on\"',\n\t\t\t\t'openTypeFontFeatures.liga=\"off\"',\n\t\t\t],\n\t\t\toptional: true,\n\t\t},\n\t},\n} satisfies TraitAttributeDefinition<OpenTypeFontFeaturesAttributes>\n\nconst openTypeFontFeaturesAttributeKeys = Object.keys(openTypeFontFeaturesDefinition)\n\ntype OpenTypeFontFeaturesCanvasNode = RichTextNode | TextStylePresetNode | FormPlainTextInputNode\n\nfunction supportsOpenTypeFontFeaturesCanvasNode(node: CanvasNode): node is OpenTypeFontFeaturesCanvasNode {\n\treturn isRichTextNode(node) || isTextStylePresetNode(node) || isFormPlainTextInputNode(node)\n}\n\nfunction applyOpenTypeFontFeatures(\n\tnode: OpenTypeFontFeaturesCanvasNode | SupportedVirtualTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) {\n\tconst input = attributes.openTypeFontFeatures\n\tif (isUndefined(input)) return\n\n\tif (isNullString(input)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ openTypeFontFeatures: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: target => target.set({ formInputOpenTypeFontFeatures: undefined }),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"openTypeFontFeatures\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\t\"openTypeFontFeatures\",\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tif (!isObject(input)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"openTypeFontFeatures\",\n\t\t\tmessage: expectedAttributeMessage(input, \"an object of OpenType feature tags\"),\n\t\t})\n\t\treturn\n\t}\n\n\tlet existingTags: OpenTypeFeatureTag[] = []\n\tif (withVirtualTextStyles(node)) {\n\t\texistingTags = node.inlineStyles.openTypeFontFeatures ?? []\n\t} else if (isTextStylePresetNode(node)) {\n\t\texistingTags = node.openTypeFontFeatures ?? []\n\t} else if (isRichTextNode(node)) {\n\t\texistingTags = ctx.virtualText.maybeHydrateDocument(node)?.inlineStyles.openTypeFontFeatures ?? []\n\t} else if (isFormPlainTextInputNode(node)) {\n\t\texistingTags = node.formInputOpenTypeFontFeatures ?? []\n\t} else if (isLinkStylePresetNode(node)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"openTypeFontFeatures\",\n\t\t\tmessage: unsupportedAttributeMessage(ClassDiscriminator.LinkStylePresetNode),\n\t\t})\n\t\treturn\n\t} else {\n\t\tassertNever(node)\n\t}\n\n\tconst tagsToAdd: OpenTypeFeatureTag[] = []\n\tconst tagsToRemove = new Set<OpenTypeFeatureTag>()\n\n\tfor (const [tag, value] of Object.entries(input as Record<string, string>)) {\n\t\tif (!isOpenTypeFeatureTag(tag)) {\n\t\t\twarnings.push({ applied: false, key: \"openTypeFontFeatures\", message: `Unknown OpenType feature tag \"${tag}\".` })\n\t\t\tcontinue\n\t\t}\n\t\t// A tag's presence in the features list means it's flipped from its default state. For\n\t\t// default-on features (kern, liga, etc.), \"off\" means add to list. For default-off\n\t\t// features, \"on\" means add to list.\n\t\tconst isDefaultOn = isFeatureAppliedByDefault(tag)\n\t\tconst shouldBeInList = isDefaultOn ? value === \"off\" : value === \"on\"\n\t\tif (shouldBeInList) tagsToAdd.push(tag)\n\t\telse tagsToRemove.add(tag)\n\t}\n\n\tconst merged = [\n\t\t...existingTags.filter(t => !tagsToRemove.has(t)),\n\t\t...tagsToAdd.filter(t => !existingTags.includes(t)),\n\t]\n\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ openTypeFontFeatures: merged }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: target => target.set({ formInputOpenTypeFontFeatures: merged }),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"openTypeFontFeatures\", merged)\n\t\t},\n\t})\n}\n\nconst fromAttributes = createTextStyleFromAttributes({\n\tkeys: openTypeFontFeaturesAttributeKeys,\n\tsupportsCanvasNode: supportsOpenTypeFontFeaturesCanvasNode,\n\trejectWhenNodeHasPreset: true,\n\tapply: applyOpenTypeFontFeatures,\n})\n\nfunction collectOpenTypeFontFeatures(node: CanvasNode | VirtualRichTextNode, ctx: AgentContext): unknown {\n\tif (withVirtualTextStyles(node)) {\n\t\tif (isVirtualRichTextTextBlock(node) && !isUndefined(node.textStylePreset)) return\n\t\treturn node.inlineStyles.openTypeFontFeatures\n\t}\n\n\tif (!(node instanceof CanvasNode)) return\n\n\tif (isRichTextNode(node)) {\n\t\tif (node.hasTextStylePresets(false)) return\n\t\treturn ctx.virtualText.getDocument(node.id)?.inlineStyles.openTypeFontFeatures\n\t}\n\n\tif (isTextStylePresetNode(node)) return node.openTypeFontFeatures\n\tif (isFormPlainTextInputNode(node)) return node.formInputOpenTypeFontFeatures\n}\n\nfunction serializeOpenTypeFontFeatures(value: unknown): SerializedOpenTypeFontFeaturesAttributes | undefined {\n\tif (!isArray(value) || value.length === 0) return\n\n\tconst features: Record<string, \"on\" | \"off\"> = {}\n\tfor (const tag of value) {\n\t\tif (!isOpenTypeFeatureTag(tag)) continue\n\t\tfeatures[tag] = isFeatureAppliedByDefault(tag) ? \"off\" : \"on\"\n\t}\n\n\treturn Object.keys(features).length > 0 ? { openTypeFontFeatures: features } : undefined\n}\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: unknown,\n\tctx: AgentContext,\n): SerializedOpenTypeFontFeaturesAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, supportsOpenTypeFontFeaturesCanvasNode)) return\n\tif (hasRichTextVariableBinding(node)) return\n\n\treturn serializeOpenTypeFontFeatures(collectOpenTypeFontFeatures(node, ctx))\n}\n\nexport const openTypeFontFeatures = {\n\tfor: supportsOpenTypeFontFeaturesCanvasNode,\n\tdefinition: openTypeFontFeaturesDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedOpenTypeFontFeaturesAttributes>\n", "import { CanvasNode, type RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport type { FormPlainTextInputNode } from \"document/models/CanvasTree/nodes/forms/FormPlainTextInputNode.ts\"\nimport {\n\tisFormPlainTextInputNode,\n\tisRichTextNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isTextAlignment, type WithTextStyle } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport { type VirtualRichTextNode, withVirtualTextBlockStyles } from \"../../context/richtext/document.ts\"\nimport { applyBlockStyle } from \"../../context/richtext/styleInheritance.ts\"\nimport { isNullString, nullString } from \"../helpers.ts\"\nimport { expectedAttributeMessage } from \"../invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"../types.ts\"\nimport {\n\tcreateTextStyleFromAttributes,\n\thasRichTextVariableBinding,\n\tisSupportedTextStyleNode,\n\tnotSupported,\n\twithStyleTarget,\n\ttype SupportedTextStyleNode,\n} from \"./utils.ts\"\n\nexport interface SerializedTextAlignmentAttributes {\n\ttextAlignment?: string\n}\n\ninterface TextAlignmentAttributes {\n\ttextAlignment: WithTextStyle[\"textAlignment\"] | undefined\n}\n\ntype TextAlignmentCanvasNode = RichTextNode | TextStylePresetNode | FormPlainTextInputNode\n\nconst textAlignmentDefinition = {\n\ttextAlignment: {\n\t\tdescription: `start | left | center | right | justify | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<Pick<TextAlignmentAttributes, \"textAlignment\">>\n\nconst textAlignmentAttributeKeys = Object.keys(textAlignmentDefinition)\n\nfunction supportsTextAlignmentCanvasNode(node: CanvasNode): node is TextAlignmentCanvasNode {\n\treturn isRichTextNode(node) || isTextStylePresetNode(node) || isFormPlainTextInputNode(node)\n}\n\nfunction applyTextAlignment(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) {\n\tconst value = attributes.textAlignment\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textAlignment: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: target => target.set({ formInputFontTextAlignment: undefined }),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tif (!withVirtualTextBlockStyles(target)) return\n\t\t\t\tapplyBlockStyle(target, \"textAlignment\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\t\"textAlignment\",\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tif (!isTextAlignment(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"textAlignment\",\n\t\t\tmessage: expectedAttributeMessage(value, textAlignmentDefinition.textAlignment.description),\n\t\t})\n\t\treturn\n\t}\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textAlignment: value }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: target => target.set({ formInputFontTextAlignment: value }),\n\t\tVirtualStyles: target => {\n\t\t\t// Text alignment is block-level only (BlockStyles).\n\t\t\tif (!withVirtualTextBlockStyles(target)) return\n\t\t\tapplyBlockStyle(target, \"textAlignment\", value)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\"textAlignment\",\n\t\t),\n\t})\n}\n\nconst fromAttributes = createTextStyleFromAttributes({\n\tkeys: textAlignmentAttributeKeys,\n\tsupportsCanvasNode: supportsTextAlignmentCanvasNode,\n\tapply: applyTextAlignment,\n})\n\nfunction collectTextAlignment(node: CanvasNode | VirtualRichTextNode, ctx: AgentContext): unknown {\n\tif (withVirtualTextBlockStyles(node)) {\n\t\treturn node.blockStyles.textAlignment\n\t}\n\n\tif (!(node instanceof CanvasNode)) return\n\n\tif (isRichTextNode(node)) {\n\t\treturn ctx.virtualText.getDocument(node.id)?.blockStyles.textAlignment\n\t}\n\tif (isTextStylePresetNode(node)) return node.textAlignment\n\tif (isFormPlainTextInputNode(node)) return node.formInputFontTextAlignment\n}\n\nfunction isDefaultTextAlignmentValue(value: string): boolean {\n\treturn value === \"inherit\" || value === \"initial\" || value === \"auto\" || value === \"currentColor\" || value === \"none\"\n}\n\nfunction serializeTextAlignment(value: unknown): SerializedTextAlignmentAttributes | undefined {\n\tif (!isString(value) || isDefaultTextAlignmentValue(value)) return\n\treturn { textAlignment: value }\n}\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): SerializedTextAlignmentAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, supportsTextAlignmentCanvasNode)) return\n\tif (hasRichTextVariableBinding(node)) return\n\n\treturn serializeTextAlignment(collectTextAlignment(node, ctx))\n}\n\nexport const textAlignment = {\n\tfor: supportsTextAlignmentCanvasNode,\n\tdefinition: textAlignmentDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedTextAlignmentAttributes>\n", "export function identity<T>(value: T): T {\n\treturn value\n}\n", "import { identity } from \"@framerjs/shared/src/identity.ts\"\nimport type { CanvasNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { LinkStylePresetNode } from \"document/models/CanvasTree/nodes/LinkStylePresetNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport {\n\tisLinkStylePresetNode,\n\tisRichTextNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getTextStylePresetDefault } from \"document/models/CanvasTree/records/TextStylePresetRecord.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { LinkStyleKeyPrefix } from \"document/models/CanvasTree/traits/WithLinkStyle.ts\"\nimport {\n\ttype WithTextStyle,\n\tisTextDecoration,\n\tisTextDecorationOffset,\n\tisTextDecorationSkipInk,\n\tisTextDecorationStyle,\n\tisTextDecorationThickness,\n\tisTextTransform,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { entriesIterator } from \"utils/entries.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport {\n\ttype VirtualRichTextNode,\n\twithVirtualTextStyles,\n\tisVirtualRichTextTextBlock,\n} from \"../../context/richtext/document.ts\"\nimport { applyInlineStyle } from \"../../context/richtext/styleInheritance.ts\"\nimport type { Tokens } from \"../../context/tokens.ts\"\nimport { isNullString, nullString } from \"../helpers.ts\"\nimport { setToDefaultValueMessage, expectedAttributeMessage, gradientNotSupportedMessage } from \"../invalidValues.ts\"\nimport { attributeHasGradient, colorDescription } from \"../traitDescriptions.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype RoundedNumber,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"../types.ts\"\nimport {\n\tapplyLinkStyle,\n\tcreateTextStyleFromAttributes,\n\thasRichTextVariableBinding,\n\tisSupportedTextStyleNode,\n\tnotSupported,\n\ttype SupportedTextStyleNode,\n\ttype SupportedVirtualTextStyleNode,\n\twithStyleTarget,\n} from \"./utils.ts\"\n\nexport interface TextAppearanceAttributes {\n\ttextStrokeWidth: WithTextStyle[\"textStrokeWidth\"] | undefined\n\ttextStrokeColor: WithTextStyle[\"textStrokeColor\"] | undefined\n\ttextTransform: WithTextStyle[\"textTransform\"] | undefined\n\ttextDecoration: WithTextStyle[\"textDecoration\"] | undefined\n\ttextDecorationColor: WithTextStyle[\"textDecorationColor\"] | undefined\n\ttextDecorationThickness: WithTextStyle[\"textDecorationThickness\"] | undefined\n\ttextDecorationStyle: WithTextStyle[\"textDecorationStyle\"] | undefined\n\ttextDecorationSkipInk: WithTextStyle[\"textDecorationSkipInk\"] | undefined\n\ttextDecorationOffset: WithTextStyle[\"textDecorationOffset\"] | undefined\n}\n\ntype TextStyleSerializationAttributes = TextAppearanceAttributes\n\nexport const textAppearanceDefinition = {\n\ttextTransform: {\n\t\tdescription: `capitalize | uppercase | lowercase | none | inherit | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttextDecoration: {\n\t\tdescription: `underline | line-through | none | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttextDecorationColor: {\n\t\tdescription: `${colorDescription} | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttextDecorationThickness: {\n\t\tdescription: `auto | \\${number}px | \\${number}em | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttextDecorationStyle: {\n\t\tdescription: `solid | double | dotted | dashed | wavy | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttextDecorationSkipInk: {\n\t\tdescription: `auto | none | all | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttextDecorationOffset: {\n\t\tdescription: `auto | \\${number}px | \\${number}em | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttextStrokeWidth: {\n\t\tdescription: `number | initial | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttextStrokeColor: {\n\t\tdescription: `${colorDescription} | initial | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<TextAppearanceAttributes>\n\nconst textStyleAttributeKeys = Object.keys(textAppearanceDefinition)\n\nfunction applyTextTransform(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) {\n\tconst value = attributes.textTransform\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textTransform: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\t\"textTransform\",\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"textTransform\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\t\"textTransform\",\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tif (!isTextTransform(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"textTransform\",\n\t\t\tmessage: expectedAttributeMessage(value, textAppearanceDefinition.textTransform.description),\n\t\t})\n\t\treturn\n\t}\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textTransform: value }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\"textTransform\",\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"textTransform\", value)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\"textTransform\",\n\t\t),\n\t})\n}\n\nexport function applyTextDecoration(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tconst value = attributes.textDecoration\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecoration: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tgetFullDSLKey(\"textDecoration\"),\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"textDecoration\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextDecoration\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textDecoration\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst dslKey = getFullDSLKey(\"textDecoration\")\n\tif (!isTextDecoration(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: expectedAttributeMessage(value, textAppearanceDefinition.textDecoration.description),\n\t\t})\n\t\treturn\n\t}\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecoration: value }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\tdslKey,\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"textDecoration\", value)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\tlinkStylePrefix,\n\t\t\t\"TextDecoration\",\n\t\t\tvalue,\n\t\t\twarnings,\n\t\t\tdslKey,\n\t\t),\n\t})\n}\n\nexport function applyTextDecorationColor(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tconst rawDecorationColor = attributes.textDecorationColor\n\tif (isUndefined(rawDecorationColor)) return\n\n\tif (isNullString(rawDecorationColor)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecorationColor: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tgetFullDSLKey(\"textDecorationColor\"),\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"textDecorationColor\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextDecorationColor\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textDecorationColor\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst dslKey = getFullDSLKey(\"textDecorationColor\")\n\tif (!isString(rawDecorationColor)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: expectedAttributeMessage(rawDecorationColor, textAppearanceDefinition.textDecorationColor.description),\n\t\t})\n\t\treturn\n\t}\n\n\tif (attributeHasGradient(rawDecorationColor)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: gradientNotSupportedMessage(dslKey, rawDecorationColor),\n\t\t})\n\t\treturn\n\t}\n\n\tconst textDecorationColor = ctx.tokens.resolve(rawDecorationColor)?.toCSS() ?? rawDecorationColor\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecorationColor }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\tdslKey,\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"textDecorationColor\", textDecorationColor)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\tlinkStylePrefix,\n\t\t\t\"TextDecorationColor\",\n\t\t\ttextDecorationColor,\n\t\t\twarnings,\n\t\t\tdslKey,\n\t\t),\n\t})\n}\n\nexport function applyTextDecorationThickness(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tif (!isString(attributes.textDecorationThickness)) return\n\n\tif (isNullString(attributes.textDecorationThickness)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecorationThickness: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tgetFullDSLKey(\"textDecorationThickness\"),\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"textDecorationThickness\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextDecorationThickness\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textDecorationThickness\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\n\tconst value = attributes.textDecorationThickness\n\tconst dslKey = getFullDSLKey(\"textDecorationThickness\")\n\tif (!isTextDecorationThickness(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: expectedAttributeMessage(value, textAppearanceDefinition.textDecorationThickness.description),\n\t\t})\n\t\treturn\n\t}\n\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecorationThickness: value }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\tdslKey,\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"textDecorationThickness\", value)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\tlinkStylePrefix,\n\t\t\t\"TextDecorationThickness\",\n\t\t\tvalue,\n\t\t\twarnings,\n\t\t\tdslKey,\n\t\t),\n\t})\n}\n\nexport function applyTextDecorationStyle(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tconst value = attributes.textDecorationStyle\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecorationStyle: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tgetFullDSLKey(\"textDecorationStyle\"),\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"textDecorationStyle\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextDecorationStyle\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textDecorationStyle\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst dslKey = getFullDSLKey(\"textDecorationStyle\")\n\tif (!isTextDecorationStyle(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: expectedAttributeMessage(value, textAppearanceDefinition.textDecorationStyle.description),\n\t\t})\n\t\treturn\n\t}\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecorationStyle: value }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\tdslKey,\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"textDecorationStyle\", value)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\tlinkStylePrefix,\n\t\t\t\"TextDecorationStyle\",\n\t\t\tvalue,\n\t\t\twarnings,\n\t\t\tdslKey,\n\t\t),\n\t})\n}\n\nexport function applyTextDecorationSkipInk(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tconst value = attributes.textDecorationSkipInk\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecorationSkipInk: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tgetFullDSLKey(\"textDecorationSkipInk\"),\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"textDecorationSkipInk\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextDecorationSkipInk\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textDecorationSkipInk\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst dslKey = getFullDSLKey(\"textDecorationSkipInk\")\n\tif (!isTextDecorationSkipInk(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: expectedAttributeMessage(value, textAppearanceDefinition.textDecorationSkipInk.description),\n\t\t})\n\t\treturn\n\t}\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecorationSkipInk: value }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\tdslKey,\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"textDecorationSkipInk\", value)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\tlinkStylePrefix,\n\t\t\t\"TextDecorationSkipInk\",\n\t\t\tvalue,\n\t\t\twarnings,\n\t\t\tdslKey,\n\t\t),\n\t})\n}\n\nexport function applyTextDecorationOffset(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tif (!isString(attributes.textDecorationOffset)) return\n\n\tif (isNullString(attributes.textDecorationOffset)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecorationOffset: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tgetFullDSLKey(\"textDecorationOffset\"),\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"textDecorationOffset\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextDecorationOffset\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textDecorationOffset\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\n\tconst value = attributes.textDecorationOffset\n\tconst dslKey = getFullDSLKey(\"textDecorationOffset\")\n\tif (!isTextDecorationOffset(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: expectedAttributeMessage(value, textAppearanceDefinition.textDecorationOffset.description),\n\t\t})\n\t\treturn\n\t}\n\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textDecorationOffset: value }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\tdslKey,\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"textDecorationOffset\", value)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\tlinkStylePrefix,\n\t\t\t\"TextDecorationOffset\",\n\t\t\tvalue,\n\t\t\twarnings,\n\t\t\tdslKey,\n\t\t),\n\t})\n}\n\nfunction applyTextStrokeWidth(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) {\n\tif (!isString(attributes.textStrokeWidth)) return\n\n\tif (isNullString(attributes.textStrokeWidth)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => {\n\t\t\t\tconst defaultValue = getTextStylePresetDefault(target, \"textStrokeWidth\")\n\t\t\t\ttarget.set({ textStrokeWidth: defaultValue })\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: true,\n\t\t\t\t\tkey: \"textStrokeWidth\",\n\t\t\t\t\tmessage: setToDefaultValueMessage(\"textStrokeWidth\", ClassDiscriminator.TextStylePresetNode, defaultValue),\n\t\t\t\t})\n\t\t\t},\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\t\"textStrokeWidth\",\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"textStrokeWidth\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\t\"textStrokeWidth\",\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\n\tconst value = attributes.textStrokeWidth === \"initial\" ? \"initial\" : tryParseNumber(attributes.textStrokeWidth)\n\tif (isUndefined(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"textStrokeWidth\",\n\t\t\tmessage: expectedAttributeMessage(\n\t\t\t\tattributes.textStrokeWidth,\n\t\t\t\ttextAppearanceDefinition.textStrokeWidth.description,\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textStrokeWidth: value }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\"textStrokeWidth\",\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"textStrokeWidth\", value)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\"textStrokeWidth\",\n\t\t),\n\t})\n}\n\nfunction applyTextStrokeColor(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) {\n\tconst rawStrokeColor = attributes.textStrokeColor\n\tif (isUndefined(rawStrokeColor)) return\n\n\tif (isNullString(rawStrokeColor)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => {\n\t\t\t\tconst defaultValue = getTextStylePresetDefault(target, \"textStrokeColor\")\n\t\t\t\ttarget.set({ textStrokeColor: defaultValue })\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: true,\n\t\t\t\t\tkey: \"textStrokeColor\",\n\t\t\t\t\tmessage: setToDefaultValueMessage(\"textStrokeColor\", ClassDiscriminator.TextStylePresetNode, defaultValue),\n\t\t\t\t})\n\t\t\t},\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\t\"textStrokeColor\",\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyInlineStyle(target, \"textStrokeColor\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\t\"textStrokeColor\",\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tif (!isString(rawStrokeColor)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"textStrokeColor\",\n\t\t\tmessage: expectedAttributeMessage(rawStrokeColor, textAppearanceDefinition.textStrokeColor.description),\n\t\t})\n\t\treturn\n\t}\n\n\tif (attributeHasGradient(rawStrokeColor)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"textStrokeColor\",\n\t\t\tmessage: gradientNotSupportedMessage(\"textStrokeColor\", rawStrokeColor),\n\t\t})\n\t\treturn\n\t}\n\n\tconst textStrokeColor =\n\t\trawStrokeColor === \"initial\" ? \"initial\" : (ctx.tokens.resolve(rawStrokeColor)?.toCSS() ?? rawStrokeColor)\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textStrokeColor }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\"textStrokeColor\",\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyInlineStyle(target, \"textStrokeColor\", textStrokeColor)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\"textStrokeColor\",\n\t\t),\n\t})\n}\n\nfunction isSupportedCanvasNode(node: CanvasNode): node is RichTextNode | LinkStylePresetNode | TextStylePresetNode {\n\treturn isRichTextNode(node) || isTextStylePresetNode(node) || isLinkStylePresetNode(node)\n}\n\nconst fromAttributes = createTextStyleFromAttributes({\n\tkeys: textStyleAttributeKeys,\n\tsupportsCanvasNode: isSupportedCanvasNode,\n\tsuggestLinkStyleAlternative: true,\n\trejectWhenNodeHasPreset: true,\n\tapply: (node, attributes, ctx, warnings) => {\n\t\tapplyTextTransform(node, attributes, ctx, warnings)\n\t\tapplyTextDecoration(node, attributes, ctx, warnings)\n\t\tapplyTextDecorationColor(node, attributes, ctx, warnings)\n\t\tapplyTextDecorationThickness(node, attributes, ctx, warnings)\n\t\tapplyTextDecorationStyle(node, attributes, ctx, warnings)\n\t\tapplyTextDecorationSkipInk(node, attributes, ctx, warnings)\n\t\tapplyTextDecorationOffset(node, attributes, ctx, warnings)\n\t\tapplyTextStrokeWidth(node, attributes, ctx, warnings)\n\t\tapplyTextStrokeColor(node, attributes, ctx, warnings)\n\t},\n})\n\nfunction collectRichTextNodeAttributes(\n\ttarget: RichTextNode,\n\tctx: AgentContext,\n): TextStyleSerializationAttributes | undefined {\n\t// When a preset is active, skip properties the UI hides (matching fromAttributes).\n\tconst hasPreset = target.hasTextStylePresets(false)\n\n\tif (hasPreset) {\n\t\treturn {\n\t\t\ttextTransform: undefined,\n\t\t\ttextDecoration: undefined,\n\t\t\ttextDecorationColor: undefined,\n\t\t\ttextDecorationThickness: undefined,\n\t\t\ttextDecorationStyle: undefined,\n\t\t\ttextDecorationSkipInk: undefined,\n\t\t\ttextDecorationOffset: undefined,\n\t\t\ttextStrokeWidth: undefined,\n\t\t\ttextStrokeColor: undefined,\n\t\t}\n\t}\n\n\tconst document = ctx.virtualText.getDocument(target.id)\n\tconst inlineStyles = document?.inlineStyles\n\treturn {\n\t\ttextTransform: inlineStyles?.textTransform,\n\t\ttextDecoration: inlineStyles?.textDecoration,\n\t\ttextDecorationColor: inlineStyles?.textDecorationColor,\n\t\ttextDecorationThickness: inlineStyles?.textDecorationThickness,\n\t\ttextDecorationStyle: inlineStyles?.textDecorationStyle,\n\t\ttextDecorationSkipInk: inlineStyles?.textDecorationSkipInk,\n\t\ttextDecorationOffset: inlineStyles?.textDecorationOffset,\n\t\ttextStrokeWidth: inlineStyles?.textStrokeWidth,\n\t\ttextStrokeColor: inlineStyles?.textStrokeColor,\n\t}\n}\n\nfunction collectTextStylePresetAttributes(target: TextStylePresetNode): TextStyleSerializationAttributes {\n\treturn {\n\t\ttextTransform: target.textTransform,\n\t\ttextStrokeColor: target.textStrokeColor,\n\t\ttextStrokeWidth: target.textStrokeWidth,\n\t\ttextDecoration: target.textDecoration,\n\t\ttextDecorationColor: target.textDecorationColor,\n\t\ttextDecorationThickness: target.textDecorationThickness,\n\t\ttextDecorationStyle: target.textDecorationStyle,\n\t\ttextDecorationSkipInk: target.textDecorationSkipInk,\n\t\ttextDecorationOffset: target.textDecorationOffset,\n\t}\n}\n\nfunction collectVirtualTextAttributes(target: SupportedVirtualTextStyleNode): TextStyleSerializationAttributes {\n\tconst { inlineStyles } = target\n\tconst hasPreset = isVirtualRichTextTextBlock(target) && !isUndefined(target.textStylePreset)\n\n\tif (hasPreset) {\n\t\treturn {\n\t\t\ttextTransform: undefined,\n\t\t\ttextDecoration: undefined,\n\t\t\ttextDecorationColor: undefined,\n\t\t\ttextDecorationThickness: undefined,\n\t\t\ttextDecorationStyle: undefined,\n\t\t\ttextDecorationSkipInk: undefined,\n\t\t\ttextDecorationOffset: undefined,\n\t\t\ttextStrokeWidth: undefined,\n\t\t\ttextStrokeColor: undefined,\n\t\t}\n\t}\n\n\treturn {\n\t\ttextTransform: inlineStyles.textTransform,\n\t\ttextDecoration: inlineStyles.textDecoration,\n\t\ttextDecorationColor: inlineStyles.textDecorationColor,\n\t\ttextDecorationThickness: inlineStyles.textDecorationThickness,\n\t\ttextDecorationStyle: inlineStyles.textDecorationStyle,\n\t\ttextDecorationSkipInk: inlineStyles.textDecorationSkipInk,\n\t\ttextDecorationOffset: inlineStyles.textDecorationOffset,\n\t\ttextStrokeWidth: inlineStyles.textStrokeWidth,\n\t\ttextStrokeColor: inlineStyles.textStrokeColor,\n\t}\n}\n\nfunction isAnyDefaultValue(key: keyof TextAppearanceAttributes, value: unknown): boolean {\n\tswitch (value) {\n\t\tcase 0:\n\t\tcase \"inherit\":\n\t\tcase \"initial\":\n\t\tcase \"auto\":\n\t\tcase \"currentColor\":\n\t\t\treturn true\n\t\tcase \"none\":\n\t\t\treturn key !== \"textDecorationSkipInk\"\n\t\tdefault:\n\t\t\treturn false\n\t}\n}\n\nexport interface SerializedTextAppearanceAttributes {\n\ttextDecorationSkipInk?: string\n\ttextDecorationThickness?: string | RoundedNumber\n\ttextDecorationOffset?: string | RoundedNumber\n\ttextTransform?: string\n\ttextDecorationStyle?: string\n\ttextDecoration?: string\n\ttextDecorationColor?: string\n\ttextStrokeColor?: string\n\ttextStrokeWidth?: string | RoundedNumber\n}\n\nexport function serializeTextAppearanceAttributes(\n\tcollectedAttributes: Partial<TextAppearanceAttributes>,\n\ttokens: Tokens,\n\tnode: CanvasNode | VirtualRichTextNode,\n\tctx?: AgentContext,\n): SerializedTextAppearanceAttributes {\n\tconst attributes: SerializedTextAppearanceAttributes = {}\n\n\tfor (const [key, value] of entriesIterator(collectedAttributes)) {\n\t\tif (isUndefined(value)) continue\n\n\t\tswitch (key) {\n\t\t\tcase \"textDecorationColor\":\n\t\t\tcase \"textStrokeColor\":\n\t\t\t\tif (isAnyDefaultValue(key, value)) break\n\t\t\t\tif (isVariableReference(value) && ctx) {\n\t\t\t\t\tattributes[key] = ctx.dynamicValues.resolveAttributeFromDynamicValue(value, node)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif (!isString(value)) break\n\t\t\t\tattributes[key] = tokens.resolve(value)?.toCSS() ?? value\n\t\t\t\tbreak\n\t\t\tcase \"textDecorationSkipInk\":\n\t\t\tcase \"textDecorationThickness\":\n\t\t\tcase \"textDecorationOffset\":\n\t\t\tcase \"textTransform\":\n\t\t\tcase \"textDecorationStyle\":\n\t\t\tcase \"textDecoration\":\n\t\t\t\tif (isAnyDefaultValue(key, value)) break\n\t\t\t\tattributes[key] = value\n\t\t\t\tbreak\n\t\t\tcase \"textStrokeWidth\":\n\t\t\t\tif (isAnyDefaultValue(key, value)) break\n\t\t\t\tattributes[key] = isNumber(value) ? toRoundedNumber(value) : value\n\t\t\t\tbreak\n\n\t\t\tdefault:\n\t\t\t\tassertNever(key)\n\t\t}\n\t}\n\n\treturn attributes\n}\n\nfunction collectInlineTextStyleAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_ctx: AgentContext,\n): TextStyleSerializationAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, isSupportedCanvasNode)) return\n\n\tif (withVirtualTextStyles(node)) {\n\t\treturn collectVirtualTextAttributes(node)\n\t} else if (isRichTextNode(node)) {\n\t\treturn collectRichTextNodeAttributes(node, _ctx)\n\t} else if (isTextStylePresetNode(node)) {\n\t\treturn collectTextStylePresetAttributes(node)\n\t} else if (isLinkStylePresetNode(node)) {\n\t\treturn // collected in linkStyles.ts\n\t} else {\n\t\tassertNever(node)\n\t}\n}\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): SerializedTextAppearanceAttributes | undefined {\n\tif (hasRichTextVariableBinding(node)) return\n\n\tconst collectedAttributes = collectInlineTextStyleAttributes(node, ctx)\n\tif (!collectedAttributes) return\n\n\tconst attributes = serializeTextAppearanceAttributes(collectedAttributes, ctx.tokens, node, ctx)\n\n\treturn Object.keys(attributes).length > 0 ? attributes : undefined\n}\n\nexport const textAppearance = {\n\tfor: node => isTextStylePresetNode(node) || isRichTextNode(node),\n\tdefinition: textAppearanceDefinition,\n\tfromAttributes: fromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedTextAppearanceAttributes>\n", "import { identity } from \"@framerjs/shared/src/identity.ts\"\nimport type { CanvasNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport { isRichTextNode, isTextStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\ttype FourPixelNumberShorthandValue,\n\tgetFourPixelNumberFromShorthand,\n\tgetFourPixelNumberShorthand,\n\tisDefaultFourPixelNumberShorthand,\n\tisPixelNumberShorthand,\n\tnormalizeFourPixelNumberShorthand,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport type { LinkStyleKeyPrefix } from \"document/models/CanvasTree/traits/WithLinkStyle.ts\"\nimport type {\n\tTextBackgroundPadding,\n\tTextBackgroundRadius,\n\tWithTextStyle,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { entriesIterator } from \"utils/entries.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport { type VirtualRichTextNode, withVirtualTextStyles } from \"../../context/richtext/document.ts\"\nimport { applyBackgroundStyle } from \"../../context/richtext/styleInheritance.ts\"\nimport { isNullString, nullString } from \"../helpers.ts\"\nimport { expectedAttributeMessage } from \"../invalidValues.ts\"\nimport { pixelShorthandDescription } from \"../traitDescriptions.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype RoundedNumber,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"../types.ts\"\nimport {\n\tapplyLinkStyle,\n\tcreateTextStyleFromAttributes,\n\thasRichTextVariableBinding,\n\tisSupportedTextStyleNode,\n\tnotSupported,\n\ttype SupportedTextStyleNode,\n\ttype SupportedVirtualTextStyleNode,\n\twithStyleTarget,\n} from \"./utils.ts\"\n\nexport interface TextBackgroundAttributes {\n\ttextBackgroundRadius: WithTextStyle[\"textBackgroundRadius\"] | undefined\n\ttextBackgroundPadding: WithTextStyle[\"textBackgroundPadding\"] | undefined\n\ttextBackgroundCornerShape: WithTextStyle[\"textBackgroundCornerShape\"] | undefined\n}\n\nexport const textBackgroundDefinition = {\n\ttextBackgroundRadius: {\n\t\tdescription: `${pixelShorthandDescription} | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttextBackgroundCornerShape: {\n\t\tdescription: `number | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttextBackgroundPadding: {\n\t\tdescription: `${pixelShorthandDescription} | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<TextBackgroundAttributes>\n\nconst textBackgroundAttributeKeys = Object.keys(textBackgroundDefinition)\n\nexport interface SerializedTextBackgroundAttributes {\n\ttextBackgroundRadius?: string\n\ttextBackgroundPadding?: string\n\ttextBackgroundCornerShape?: RoundedNumber\n}\n\ntype TextBackgroundCanvasNode = RichTextNode | TextStylePresetNode\n\nfunction supportsTextBackgroundCanvasNode(node: CanvasNode): node is TextBackgroundCanvasNode {\n\treturn isRichTextNode(node) || isTextStylePresetNode(node)\n}\n\nexport function applyTextBackgroundRadius(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tconst textBackgroundRadiusValue = attributes.textBackgroundRadius\n\tif (isUndefined(textBackgroundRadiusValue)) return\n\n\tif (isNullString(textBackgroundRadiusValue)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textBackgroundRadius: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tgetFullDSLKey(\"textBackgroundRadius\"),\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyBackgroundStyle(target, \"textBackgroundRadius\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextBackgroundRadius\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textBackgroundRadius\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst dslKey = getFullDSLKey(\"textBackgroundRadius\")\n\tif (!isPixelNumberShorthand(textBackgroundRadiusValue)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: expectedAttributeMessage(\n\t\t\t\ttextBackgroundRadiusValue,\n\t\t\t\ttextBackgroundDefinition.textBackgroundRadius.description,\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst normalized = normalizeFourPixelNumberShorthand(getFourPixelNumberFromShorthand(textBackgroundRadiusValue))\n\tconst textBackgroundRadius: TextBackgroundRadius = {\n\t\tradius: normalized.all,\n\t\tradiusPerCorner: normalized.perSide,\n\t\tradiusTopLeft: normalized.top,\n\t\tradiusTopRight: normalized.right,\n\t\tradiusBottomRight: normalized.bottom,\n\t\tradiusBottomLeft: normalized.left,\n\t}\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textBackgroundRadius }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\tdslKey,\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyBackgroundStyle(target, \"textBackgroundRadius\", textBackgroundRadius)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\tlinkStylePrefix,\n\t\t\t\"TextBackgroundRadius\",\n\t\t\ttextBackgroundRadius,\n\t\t\twarnings,\n\t\t\tdslKey,\n\t\t),\n\t})\n}\n\nexport function applyTextBackgroundCornerShape(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tconst rawCornerShape = attributes.textBackgroundCornerShape\n\tif (isUndefined(rawCornerShape)) return\n\n\tif (isNullString(rawCornerShape)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textBackgroundCornerShape: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tgetFullDSLKey(\"textBackgroundCornerShape\"),\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyBackgroundStyle(target, \"textBackgroundCornerShape\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextBackgroundCornerShape\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textBackgroundCornerShape\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst dslKey = getFullDSLKey(\"textBackgroundCornerShape\")\n\tconst cornerShape = tryParseNumber(rawCornerShape)\n\tif (isUndefined(cornerShape)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: expectedAttributeMessage(rawCornerShape, textBackgroundDefinition.textBackgroundCornerShape.description),\n\t\t})\n\t\treturn\n\t}\n\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textBackgroundCornerShape: { cornerShape } }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\tdslKey,\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyBackgroundStyle(target, \"textBackgroundCornerShape\", { cornerShape })\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\tlinkStylePrefix,\n\t\t\t\"TextBackgroundCornerShape\",\n\t\t\t{ cornerShape },\n\t\t\twarnings,\n\t\t\tdslKey,\n\t\t),\n\t})\n}\n\nexport function applyTextBackgroundPadding(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tconst textBackgroundPaddingValue = attributes.textBackgroundPadding\n\tif (isUndefined(textBackgroundPaddingValue)) return\n\n\tif (isNullString(textBackgroundPaddingValue)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textBackgroundPadding: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tgetFullDSLKey(\"textBackgroundPadding\"),\n\t\t\t),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyBackgroundStyle(target, \"textBackgroundPadding\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextBackgroundPadding\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textBackgroundPadding\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst dslKey = getFullDSLKey(\"textBackgroundPadding\")\n\tif (!isPixelNumberShorthand(textBackgroundPaddingValue)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: expectedAttributeMessage(\n\t\t\t\ttextBackgroundPaddingValue,\n\t\t\t\ttextBackgroundDefinition.textBackgroundPadding.description,\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst normalized = normalizeFourPixelNumberShorthand(getFourPixelNumberFromShorthand(textBackgroundPaddingValue))\n\tconst textBackgroundPadding: TextBackgroundPadding = {\n\t\tpadding: normalized.all,\n\t\tpaddingPerSide: normalized.perSide,\n\t\tpaddingTop: normalized.top,\n\t\tpaddingRight: normalized.right,\n\t\tpaddingBottom: normalized.bottom,\n\t\tpaddingLeft: normalized.left,\n\t}\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textBackgroundPadding }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\tdslKey,\n\t\t),\n\t\tVirtualStyles: target => {\n\t\t\tapplyBackgroundStyle(target, \"textBackgroundPadding\", textBackgroundPadding)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\tlinkStylePrefix,\n\t\t\t\"TextBackgroundPadding\",\n\t\t\ttextBackgroundPadding,\n\t\t\twarnings,\n\t\t\tdslKey,\n\t\t),\n\t})\n}\n\nfunction collectRichTextNodeAttributes(target: RichTextNode, ctx: AgentContext): TextBackgroundAttributes | undefined {\n\tconst document = ctx.virtualText.getDocument(target.id)\n\tif (!document) return\n\tconst { backgroundStyles } = document\n\n\treturn {\n\t\ttextBackgroundRadius: backgroundStyles.textBackgroundRadius,\n\t\ttextBackgroundCornerShape: backgroundStyles.textBackgroundCornerShape,\n\t\ttextBackgroundPadding: backgroundStyles.textBackgroundPadding,\n\t}\n}\n\nfunction collectTextStylePresetAttributes(target: TextStylePresetNode): TextBackgroundAttributes {\n\treturn {\n\t\ttextBackgroundPadding: target.textBackgroundPadding,\n\t\ttextBackgroundRadius: target.textBackgroundRadius,\n\t\ttextBackgroundCornerShape: target.textBackgroundCornerShape,\n\t}\n}\n\nfunction collectVirtualTextAttributes(target: SupportedVirtualTextStyleNode): TextBackgroundAttributes {\n\treturn {\n\t\ttextBackgroundRadius: target.backgroundStyles.textBackgroundRadius,\n\t\ttextBackgroundCornerShape: target.backgroundStyles.textBackgroundCornerShape,\n\t\ttextBackgroundPadding: target.backgroundStyles.textBackgroundPadding,\n\t}\n}\n\nfunction collectTextBackgroundAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\tctx: AgentContext,\n): TextBackgroundAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, supportsTextBackgroundCanvasNode)) return\n\n\tif (withVirtualTextStyles(node)) {\n\t\treturn collectVirtualTextAttributes(node)\n\t} else if (isRichTextNode(node)) {\n\t\treturn collectRichTextNodeAttributes(node, ctx)\n\t} else if (isTextStylePresetNode(node)) {\n\t\treturn collectTextStylePresetAttributes(node)\n\t} else {\n\t\tassertNever(node)\n\t}\n}\n\nexport function serializeTextBackgroundAttributes(\n\tcollectedAttributes: Partial<TextBackgroundAttributes>,\n): SerializedTextBackgroundAttributes {\n\tconst attributes: SerializedTextBackgroundAttributes = {}\n\n\tfor (const [key, value] of entriesIterator(collectedAttributes)) {\n\t\tif (isUndefined(value)) continue\n\n\t\tswitch (key) {\n\t\t\tcase \"textBackgroundRadius\": {\n\t\t\t\tconst fourPixelNumberShorthandValue: FourPixelNumberShorthandValue = {\n\t\t\t\t\tall: value?.radius,\n\t\t\t\t\tperSide: value?.radiusPerCorner === true,\n\t\t\t\t\ttop: value?.radiusTopLeft,\n\t\t\t\t\tright: value?.radiusTopRight,\n\t\t\t\t\tbottom: value?.radiusBottomRight,\n\t\t\t\t\tleft: value?.radiusBottomLeft,\n\t\t\t\t}\n\t\t\t\tif (isDefaultFourPixelNumberShorthand(fourPixelNumberShorthandValue)) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tattributes[key] = getFourPixelNumberShorthand(fourPixelNumberShorthandValue)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"textBackgroundPadding\": {\n\t\t\t\tconst fourPixelNumberShorthandValue: FourPixelNumberShorthandValue = {\n\t\t\t\t\tall: value?.padding,\n\t\t\t\t\tperSide: value?.paddingPerSide === true,\n\t\t\t\t\ttop: value?.paddingTop,\n\t\t\t\t\tright: value?.paddingRight,\n\t\t\t\t\tbottom: value?.paddingBottom,\n\t\t\t\t\tleft: value?.paddingLeft,\n\t\t\t\t}\n\t\t\t\tif (isDefaultFourPixelNumberShorthand(fourPixelNumberShorthandValue)) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tattributes[key] = getFourPixelNumberShorthand(fourPixelNumberShorthandValue)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"textBackgroundCornerShape\": {\n\t\t\t\tconst cornerShape = value.cornerShape\n\n\t\t\t\tif (!isNumber(cornerShape) || cornerShape === 0) break\n\t\t\t\tattributes[key] = toRoundedNumber(cornerShape)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(key)\n\t\t}\n\t}\n\n\treturn attributes\n}\n\nconst fromAttributes = createTextStyleFromAttributes({\n\tkeys: textBackgroundAttributeKeys,\n\tsupportsCanvasNode: supportsTextBackgroundCanvasNode,\n\tsuggestLinkStyleAlternative: true,\n\tapply: (node, attributes, ctx, warnings) => {\n\t\tapplyTextBackgroundRadius(node, attributes, ctx, warnings)\n\t\tapplyTextBackgroundCornerShape(node, attributes, ctx, warnings)\n\t\tapplyTextBackgroundPadding(node, attributes, ctx, warnings)\n\t},\n})\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): SerializedTextBackgroundAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, supportsTextBackgroundCanvasNode)) return\n\tif (hasRichTextVariableBinding(node)) return\n\n\tconst collectedAttributes = collectTextBackgroundAttributes(node, ctx)\n\tif (!collectedAttributes) return\n\n\tconst attributes = serializeTextBackgroundAttributes(collectedAttributes)\n\n\treturn Object.keys(attributes).length > 0 ? attributes : undefined\n}\n\nexport const textBackground = {\n\tfor: supportsTextBackgroundCanvasNode,\n\tdefinition: textBackgroundDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedTextBackgroundAttributes>\n", "import { identity } from \"@framerjs/shared/src/identity.ts\"\nimport { CanvasNode, type RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport {\n\tisInlineCodeStylePresetNode,\n\tisRichTextNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { LinkStyleKeyPrefix } from \"document/models/CanvasTree/traits/WithLinkStyle.ts\"\nimport type { WithTextStyle } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport { type VirtualRichTextNode, withVirtualTextStyles } from \"../../context/richtext/document.ts\"\nimport { applyBackgroundStyle } from \"../../context/richtext/styleInheritance.ts\"\nimport type { Tokens } from \"../../context/tokens.ts\"\nimport { isNullString, nullString } from \"../helpers.ts\"\nimport { gradientNotSupportedMessage, traitNotAppliedWarning } from \"../invalidValues.ts\"\nimport { attributeHasGradient, colorDescription } from \"../traitDescriptions.ts\"\nimport type { TraitAttributeDefinition, TraitDefinition, DSLAttributes, TraitWarning } from \"../types.ts\"\nimport {\n\tapplyLinkStyle,\n\tcreateTextStyleFromAttributes,\n\thasRichTextVariableBinding,\n\tisSupportedTextStyleNode,\n\tnotSupported,\n\ttype SupportedTextStyleNode,\n\twithStyleTarget,\n} from \"./utils.ts\"\n\ninterface TextBackgroundColorAttributes {\n\ttextBackgroundColor: WithTextStyle[\"textBackgroundColor\"] | undefined\n}\n\nexport const textBackgroundColorDefinition = {\n\ttextBackgroundColor: {\n\t\tdescription: `${colorDescription} | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<TextBackgroundColorAttributes>\n\nconst textBackgroundColorAttributeKeys = Object.keys(textBackgroundColorDefinition)\n\nexport interface SerializedTextBackgroundColorAttributes {\n\ttextBackgroundColor?: string\n}\n\ntype TextBackgroundColorCanvasNode = RichTextNode | TextStylePresetNode | InlineCodeStylePresetNode\n\nfunction supportsTextBackgroundColorCanvasNode(node: CanvasNode): node is TextBackgroundColorCanvasNode {\n\treturn isRichTextNode(node) || isTextStylePresetNode(node) || isInlineCodeStylePresetNode(node)\n}\n\nfunction collectTextBackgroundColorAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\tctx: AgentContext,\n): TextBackgroundColorAttributes | undefined {\n\tif (withVirtualTextStyles(node)) {\n\t\treturn { textBackgroundColor: node.backgroundStyles.textBackgroundColor }\n\t}\n\n\tif (!(node instanceof CanvasNode)) return\n\tif (isInlineCodeStylePresetNode(node)) return { textBackgroundColor: node.inlineCodeFillColor }\n\tif (isRichTextNode(node)) {\n\t\tconst document = ctx.virtualText.getDocument(node.id)\n\t\tif (!document) return\n\t\treturn { textBackgroundColor: document.backgroundStyles.textBackgroundColor }\n\t}\n\tif (isTextStylePresetNode(node)) return { textBackgroundColor: node.textBackgroundColor }\n}\n\nexport function applyTextBackgroundColor(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tconst value = attributes.textBackgroundColor\n\tif (!isString(value)) return\n\n\tif (isNullString(value)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textBackgroundColor: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tgetFullDSLKey(\"textBackgroundColor\"),\n\t\t\t),\n\t\t\t[ClassDiscriminator.InlineCodeStylePresetNode]: target => target.set({ inlineCodeFillColor: undefined }),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tapplyBackgroundStyle(target, \"textBackgroundColor\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextBackgroundColor\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textBackgroundColor\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst dslKey = getFullDSLKey(\"textBackgroundColor\")\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, { node })\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(dslKey, message)))\n\t\treturn\n\t}\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.TextStylePresetNode,\n\t\t\t\tdslKey,\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tdslKey,\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t\t[ClassDiscriminator.InlineCodeStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.InlineCodeStylePresetNode,\n\t\t\t\tdslKey,\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t\tVirtualStyles: (target, node) => {\n\t\t\t\tif (resolveHandleResult.handle.type !== \"variableReference\") return\n\t\t\t\tconst textBackgroundColor = resolveHandleResult.handle.reference(node)\n\t\t\t\tapplyBackgroundStyle(target, \"textBackgroundColor\", textBackgroundColor)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\tdslKey,\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\n\tif (attributeHasGradient(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: gradientNotSupportedMessage(dslKey, value),\n\t\t})\n\t\treturn\n\t}\n\n\tconst textBackgroundColor = ctx.tokens.resolve(value)?.toCSS() ?? value\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textBackgroundColor }),\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\twarnings,\n\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\tdslKey,\n\t\t),\n\t\t[ClassDiscriminator.InlineCodeStylePresetNode]: target => target.set({ inlineCodeFillColor: textBackgroundColor }),\n\t\tVirtualStyles: target => {\n\t\t\tapplyBackgroundStyle(target, \"textBackgroundColor\", textBackgroundColor)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\tlinkStylePrefix,\n\t\t\t\"TextBackgroundColor\",\n\t\t\ttextBackgroundColor,\n\t\t\twarnings,\n\t\t\tdslKey,\n\t\t),\n\t})\n}\n\nexport function serializeTextBackgroundColorAttributes(\n\tcollectedAttributes: TextBackgroundColorAttributes,\n\ttokens: Tokens,\n\tctx: AgentContext,\n\tnode: CanvasNode | VirtualRichTextNode,\n): SerializedTextBackgroundColorAttributes {\n\tconst attributes: SerializedTextBackgroundColorAttributes = {}\n\tconst { textBackgroundColor } = collectedAttributes\n\tif (isUndefined(textBackgroundColor)) return attributes\n\n\tif (isVariableReference(textBackgroundColor)) {\n\t\tattributes.textBackgroundColor = ctx.dynamicValues.resolveAttributeFromDynamicValue(textBackgroundColor, node)\n\t} else if (isString(textBackgroundColor)) {\n\t\tattributes.textBackgroundColor = tokens.resolve(textBackgroundColor)?.toCSS() ?? textBackgroundColor\n\t}\n\n\treturn attributes\n}\n\nconst fromAttributes = createTextStyleFromAttributes({\n\tkeys: textBackgroundColorAttributeKeys,\n\tsupportsCanvasNode: supportsTextBackgroundColorCanvasNode,\n\tsuggestLinkStyleAlternative: true,\n\tapply: applyTextBackgroundColor,\n})\n\nfunction toAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): SerializedTextBackgroundColorAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, supportsTextBackgroundColorCanvasNode)) return\n\tif (hasRichTextVariableBinding(node)) return\n\n\tconst collectedAttributes = collectTextBackgroundColorAttributes(node, ctx)\n\tif (!collectedAttributes) return\n\n\tconst { textBackgroundColor } = serializeTextBackgroundColorAttributes(collectedAttributes, ctx.tokens, ctx, node)\n\treturn isUndefined(textBackgroundColor) ? undefined : { textBackgroundColor }\n}\n\nexport const textBackgroundColor = {\n\tfor: supportsTextBackgroundColorCanvasNode,\n\tdefinition: textBackgroundColorDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedTextBackgroundColorAttributes>\n", "import { identity } from \"@framerjs/shared/src/identity.ts\"\nimport { CanvasNode, type RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { InlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/InlineCodeStylePresetNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport type { FormPlainTextInputNode } from \"document/models/CanvasTree/nodes/forms/FormPlainTextInputNode.ts\"\nimport {\n\tisFormPlainTextInputNode,\n\tisInlineCodeStylePresetNode,\n\tisLinkStylePresetNode,\n\tisRichTextNode,\n\tisTextStylePresetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport type { LinkStyleKeyPrefix } from \"document/models/CanvasTree/traits/WithLinkStyle.ts\"\nimport type { WithTextStyle } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { isGradient } from \"document/models/Gradient.ts\"\nimport { parseGradient } from \"document/utils/parseGradient.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../../context/AgentContext.ts\"\nimport {\n\ttype VirtualRichTextNode,\n\tisVirtualRichTextNode,\n\twithVirtualTextBackgroundMask,\n\twithVirtualTextStyles,\n} from \"../../context/richtext/document.ts\"\nimport { applyInlineStyle } from \"../../context/richtext/styleInheritance.ts\"\nimport type { Tokens } from \"../../context/tokens.ts\"\nimport { isNullString, nullString } from \"../helpers.ts\"\nimport {\n\tgradientNotSupportedOnInlineText,\n\tinvalidAttributeMessage,\n\ttraitNotAppliedWarning,\n\tunsupportedAttributeFormatMessage,\n} from \"../invalidValues.ts\"\nimport { attributeHasGradient, colorDescription, gradientDescription } from \"../traitDescriptions.ts\"\nimport type { TraitAttributeDefinition, TraitDefinition, DSLAttributes, TraitWarning } from \"../types.ts\"\nimport {\n\tapplyLinkStyle,\n\tcreateTextStyleFromAttributes,\n\thasRichTextVariableBinding,\n\tisSupportedTextStyleNode,\n\tnotSupported,\n\ttype SupportedTextStyleNode,\n\twithStyleTarget,\n} from \"./utils.ts\"\n\ninterface TextColorAttributes {\n\ttextColor: WithTextStyle[\"textColor\"] | undefined\n}\n\nconst textColorDefinition = {\n\ttextColor: {\n\t\tdescription: `${colorDescription} | ${gradientDescription} | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<TextColorAttributes>\n\nconst textColorAttributeKeys = Object.keys(textColorDefinition)\n\nexport interface SerializedTextColorAttributes {\n\ttextColor?: string\n}\n\ntype TextColorCanvasNode = RichTextNode | TextStylePresetNode | FormPlainTextInputNode | InlineCodeStylePresetNode\n\nfunction supportsTextColorCanvasNode(node: CanvasNode): node is TextColorCanvasNode {\n\treturn (\n\t\tisRichTextNode(node) ||\n\t\tisTextStylePresetNode(node) ||\n\t\tisFormPlainTextInputNode(node) ||\n\t\tisInlineCodeStylePresetNode(node)\n\t)\n}\n\nfunction collectTextColorAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\tctx: AgentContext,\n): TextColorAttributes | undefined {\n\tif (withVirtualTextStyles(node)) {\n\t\tconst richTextTarget = ctx.virtualText.getTarget(node)\n\t\tconst targetDocument = richTextTarget ? ctx.virtualText.getDocument(richTextTarget) : undefined\n\t\tconst hasRootBackgroundMask = isGradient(targetDocument?.backgroundMask)\n\t\treturn { textColor: hasRootBackgroundMask ? undefined : node.inlineStyles.textColor }\n\t}\n\n\tif (!(node instanceof CanvasNode)) return\n\tif (isInlineCodeStylePresetNode(node)) return { textColor: node.inlineCodeTextColor }\n\tif (isRichTextNode(node)) {\n\t\tconst document = ctx.virtualText.getDocument(node.id)\n\t\tif (isGradient(document?.backgroundMask)) return { textColor: document.backgroundMask.toCSS() }\n\t\treturn { textColor: document?.inlineStyles.textColor }\n\t}\n\tif (isTextStylePresetNode(node)) return { textColor: node.textColor }\n\tif (isFormPlainTextInputNode(node)) return { textColor: node.formInputFontColor }\n\tif (isLinkStylePresetNode(node)) return\n}\n\nexport function applyTextColor(\n\tnode: SupportedTextStyleNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tgetFullDSLKey: (key: string) => string = identity,\n\tlinkStylePrefix?: LinkStyleKeyPrefix,\n) {\n\tconst value = attributes.textColor\n\tif (!isString(value)) return\n\n\tif (isNullString(value)) {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: target => target.set({ textColor: undefined }),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: target => target.set({ formInputFontColor: undefined }),\n\t\t\t[ClassDiscriminator.InlineCodeStylePresetNode]: target => target.set({ inlineCodeTextColor: undefined }),\n\t\t\tVirtualStyles: target => {\n\t\t\t\tif (withVirtualTextBackgroundMask(target)) target.backgroundMask = null\n\t\t\t\tapplyInlineStyle(target, \"textColor\", undefined)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: applyLinkStyle(\n\t\t\t\tlinkStylePrefix,\n\t\t\t\t\"TextColor\",\n\t\t\t\tundefined,\n\t\t\t\twarnings,\n\t\t\t\tgetFullDSLKey(\"textColor\"),\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\tconst dslKey = getFullDSLKey(\"textColor\")\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, { node })\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(dslKey, message)))\n\t\treturn\n\t}\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\twithStyleTarget(node, ctx, {\n\t\t\t[ClassDiscriminator.TextStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.TextStylePresetNode,\n\t\t\t\tdslKey,\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t\t[ClassDiscriminator.FormPlainTextInputNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.FormPlainTextInputNode,\n\t\t\t\tdslKey,\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t\t[ClassDiscriminator.InlineCodeStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.InlineCodeStylePresetNode,\n\t\t\t\tdslKey,\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t\tVirtualStyles: (target, node) => {\n\t\t\t\tif (resolveHandleResult.handle.type !== \"variableReference\") return\n\t\t\t\tconst textColor = resolveHandleResult.handle.reference(node)\n\t\t\t\tif (withVirtualTextBackgroundMask(target)) {\n\t\t\t\t\tif (attributeHasGradient(value)) {\n\t\t\t\t\t\tconst gradient = parseGradient(value)\n\t\t\t\t\t\tif (gradient) target.backgroundMask = gradient\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\ttarget.backgroundMask = null\n\t\t\t\t}\n\t\t\t\tapplyInlineStyle(target, \"textColor\", textColor)\n\t\t\t},\n\t\t\t[ClassDiscriminator.LinkStylePresetNode]: notSupported(\n\t\t\t\twarnings,\n\t\t\t\tClassDiscriminator.LinkStylePresetNode,\n\t\t\t\tdslKey,\n\t\t\t\t\"variables\",\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\n\tif (!isString(value)) return\n\tconst textColor = ctx.tokens.resolve(value)?.toCSS() ?? value\n\n\twithStyleTarget(node, ctx, {\n\t\t[ClassDiscriminator.TextStylePresetNode]: target => {\n\t\t\tif (attributeHasGradient(value)) {\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: dslKey,\n\t\t\t\t\tmessage: unsupportedAttributeFormatMessage(ClassDiscriminator.TextStylePresetNode, \"gradients\"),\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttarget.set({ textColor })\n\t\t},\n\t\t[ClassDiscriminator.FormPlainTextInputNode]: target => {\n\t\t\tif (attributeHasGradient(value)) {\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: dslKey,\n\t\t\t\t\tmessage: unsupportedAttributeFormatMessage(ClassDiscriminator.FormPlainTextInputNode, \"gradients\"),\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttarget.set({ formInputFontColor: textColor })\n\t\t},\n\t\t[ClassDiscriminator.InlineCodeStylePresetNode]: target => {\n\t\t\tif (attributeHasGradient(value)) {\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: dslKey,\n\t\t\t\t\tmessage: unsupportedAttributeFormatMessage(ClassDiscriminator.InlineCodeStylePresetNode, \"gradients\"),\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\t\t\ttarget.set({ inlineCodeTextColor: textColor })\n\t\t},\n\t\tVirtualStyles: target => {\n\t\t\tif (isVirtualRichTextNode(target) && attributeHasGradient(value)) {\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: dslKey,\n\t\t\t\t\tmessage: invalidAttributeMessage(value, gradientNotSupportedOnInlineText),\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (withVirtualTextBackgroundMask(target)) {\n\t\t\t\tif (attributeHasGradient(value)) {\n\t\t\t\t\tconst gradient = parseGradient(value)\n\t\t\t\t\tif (gradient) target.backgroundMask = gradient\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\ttarget.backgroundMask = null\n\t\t\t}\n\n\t\t\tapplyInlineStyle(target, \"textColor\", textColor)\n\t\t},\n\t\t[ClassDiscriminator.LinkStylePresetNode]: target => {\n\t\t\tif (attributeHasGradient(value)) {\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: dslKey,\n\t\t\t\t\tmessage: unsupportedAttributeFormatMessage(ClassDiscriminator.LinkStylePresetNode, \"gradients\"),\n\t\t\t\t})\n\t\t\t\treturn\n\t\t\t}\n\t\t\tapplyLinkStyle(linkStylePrefix, \"TextColor\", textColor, warnings, dslKey)(target)\n\t\t},\n\t})\n}\n\nexport function serializeTextColorAttributes(\n\tcollectedAttributes: TextColorAttributes,\n\ttokens: Tokens,\n\tctx: AgentContext,\n\tnode: CanvasNode | VirtualRichTextNode,\n): SerializedTextColorAttributes {\n\tconst attributes: SerializedTextColorAttributes = {}\n\tconst { textColor } = collectedAttributes\n\tif (isUndefined(textColor)) return attributes\n\n\tif (isVariableReference(textColor)) {\n\t\tattributes.textColor = ctx.dynamicValues.resolveAttributeFromDynamicValue(textColor, node)\n\t} else if (isString(textColor)) {\n\t\tattributes.textColor = tokens.resolve(textColor)?.toCSS() ?? textColor\n\t}\n\n\treturn attributes\n}\n\nconst fromTextColorAttributes = createTextStyleFromAttributes({\n\tkeys: textColorAttributeKeys,\n\tsupportsCanvasNode: supportsTextColorCanvasNode,\n\tsuggestLinkStyleAlternative: true,\n\tapply: applyTextColor,\n})\n\nfunction toTextColorAttributes(\n\tnode: CanvasNode | VirtualRichTextNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): SerializedTextColorAttributes | undefined {\n\tif (!isSupportedTextStyleNode(node, supportsTextColorCanvasNode)) return\n\tif (hasRichTextVariableBinding(node)) return\n\n\tconst collectedAttributes = collectTextColorAttributes(node, ctx)\n\tif (!collectedAttributes) return\n\n\tconst { textColor } = serializeTextColorAttributes(collectedAttributes, ctx.tokens, ctx, node)\n\treturn isUndefined(textColor) ? undefined : { textColor }\n}\n\nexport const textColor = {\n\tfor: supportsTextColorCanvasNode,\n\tdefinition: textColorDefinition,\n\tfromAttributes: fromTextColorAttributes,\n\ttoAttributes: toTextColorAttributes,\n} satisfies TraitDefinition<SerializedTextColorAttributes>\n", "import { once } from \"@framerjs/shared/src/once.ts\"\nimport {\n\ttype VirtualRichTextNode,\n\twithVirtualTextBlockStyles,\n\twithVirtualTextStyles,\n} from \"../../context/richtext/document.ts\"\nimport type { TraitDefinition, VirtualNodeTraitDefinition } from \"../types.ts\"\nimport { font } from \"./font.ts\"\nimport { fontSize } from \"./fontSize.ts\"\nimport { letterSpacing } from \"./letterSpacing.ts\"\nimport { lineHeight } from \"./lineHeight.ts\"\nimport { openTypeFontFeatures } from \"./openType.ts\"\nimport { textAlignment } from \"./textAlignment.ts\"\nimport { textAppearance } from \"./textAppearance.ts\"\nimport { textBackground } from \"./textBackground.ts\"\nimport { textBackgroundColor } from \"./textBackgroundColor.ts\"\nimport { textColor } from \"./textColor.ts\"\n\nexport const textStyleTraitDefinitionsByName = {\n\tfont,\n\tfontSize,\n\tletterSpacing,\n\tlineHeight,\n\topenTypeFontFeatures,\n\ttextAlignment,\n\ttextAppearance,\n\ttextBackground,\n\ttextBackgroundColor,\n\ttextColor,\n} satisfies Record<string, TraitDefinition<object>>\n\ntype TextStyleTraitForVirtualNode<T extends object> = Pick<\n\tTraitDefinition<T, [], VirtualRichTextNode>,\n\t\"definition\" | \"fromAttributes\" | \"toAttributes\"\n>\n\nfunction createVirtualTextStyleTrait<T extends object>(\n\ttrait: TextStyleTraitForVirtualNode<T>,\n\tguard: VirtualNodeTraitDefinition<T>[\"for\"],\n): VirtualNodeTraitDefinition<T> {\n\treturn {\n\t\tfor: guard,\n\t\tdefinition: trait.definition,\n\t\tfromAttributes: trait.fromAttributes,\n\t\ttoAttributes: trait.toAttributes,\n\t}\n}\n\nexport const virtualTextStyleTraitDefinitionsByName = {\n\tfont: createVirtualTextStyleTrait(font, withVirtualTextStyles),\n\tfontSize: createVirtualTextStyleTrait(fontSize, withVirtualTextStyles),\n\tletterSpacing: createVirtualTextStyleTrait(letterSpacing, withVirtualTextStyles),\n\tlineHeight: createVirtualTextStyleTrait(lineHeight, withVirtualTextBlockStyles),\n\topenTypeFontFeatures: createVirtualTextStyleTrait(openTypeFontFeatures, withVirtualTextStyles),\n\ttextAlignment: createVirtualTextStyleTrait(textAlignment, withVirtualTextBlockStyles),\n\ttextAppearance: createVirtualTextStyleTrait(textAppearance, withVirtualTextStyles),\n\ttextBackground: createVirtualTextStyleTrait(textBackground, withVirtualTextStyles),\n\ttextBackgroundColor: createVirtualTextStyleTrait(textBackgroundColor, withVirtualTextStyles),\n\ttextColor: createVirtualTextStyleTrait(textColor, withVirtualTextStyles),\n} satisfies Record<string, VirtualNodeTraitDefinition<object>>\n\nexport const getTextStyleAttributeKeySet = once((): ReadonlySet<string> => {\n\tconst keys = new Set<string>()\n\tfor (const trait of Object.values(textStyleTraitDefinitionsByName)) {\n\t\tfor (const key of Object.keys(trait.definition)) {\n\t\t\tkeys.add(key)\n\t\t}\n\t}\n\treturn keys\n})\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\ttype WithRichTextTag,\n\tisRichTextTag,\n\trichTextTagDefaults,\n\trichTextTags,\n\twithRichTextTag,\n} from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { type VirtualRichTextNode, isVirtualRichTextTextBlock } from \"../context/richtext/document.ts\"\nimport { walkVirtualRichText } from \"../context/richtext/traversal.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, VirtualNodeTraitDefinition } from \"./types.ts\"\n\nexport type RichTextTagAttributes = Pick<WithRichTextTag, \"tag\">\n\nconst definition: TraitAttributeDefinition<RichTextTagAttributes> = {\n\ttag: {\n\t\tdescription: richTextTags.join(\" | \"),\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tconst tagValue = attributes.tag\n\tif (!isRichTextTag(tagValue)) return\n\tif (isRichTextNode(node)) {\n\t\tconst document = ctx.virtualText.maybeHydrateDocument(node)\n\t\tif (!document) return\n\t\tdocument.tag = tagValue\n\t\tfor (const child of walkVirtualRichText(document)) {\n\t\t\tif (isVirtualRichTextTextBlock(child)) child.tag = tagValue\n\t\t}\n\t\treturn\n\t}\n\tif (!withRichTextTag(node)) return\n\tnode.set({ tag: tagValue })\n}\n\nfunction toAttributes(node: CanvasNode, _parent: unknown, ctx: AgentContext): DSLAttributes | undefined {\n\tif (isRichTextNode(node)) {\n\t\tif (isVariableReference(node.htmlContent)) return\n\t\tconst tag = ctx.virtualText.getDocument(node.id)?.tag\n\t\tif (!tag || tag === richTextTagDefaults.tag) return\n\t\treturn { tag }\n\t}\n\tif (!withRichTextTag(node)) return\n\tif (node.tag === richTextTagDefaults.tag) return\n\treturn { tag: node.tag }\n}\n\nfunction fromVirtualAttributes(node: VirtualRichTextNode, attributes: DSLAttributes) {\n\tif (!isVirtualRichTextTextBlock(node)) return\n\tif (!isRichTextTag(attributes.tag)) return\n\tnode.tag = attributes.tag\n}\n\nfunction toVirtualAttributes(node: VirtualRichTextNode): DSLAttributes | undefined {\n\tif (!isVirtualRichTextTextBlock(node)) return\n\treturn { tag: node.tag }\n}\n\nexport const textTag = {\n\tfor: node => withRichTextTag(node) || isRichTextNode(node),\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<RichTextTagAttributes>\n\nexport const virtualTextTag = {\n\tfor: isVirtualRichTextTextBlock,\n\tdefinition,\n\tfromAttributes: fromVirtualAttributes,\n\ttoAttributes: toVirtualAttributes,\n} satisfies VirtualNodeTraitDefinition<RichTextTagAttributes>\n", "import { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport { isNull, isObject, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport type { VirtualRichTextNode } from \"../context/richtext/document.ts\"\nimport { nullString } from \"./helpers.ts\"\nimport {\n\ttype DSLAttributes,\n\ttoRoundedNumber,\n\ttype RoundedNumber,\n\ttype TraitDefinition,\n\ttype TraitSerializers,\n} from \"./types.ts\"\n\nexport async function traitsToAttributes<Node extends CanvasNode | VirtualRichTextNode>(\n\ttraits: readonly TraitDefinition<object, [], Node>[],\n\tnode: Node,\n\tparent: MaybeCanvasNode,\n\tctx: AgentContext,\n\tserializers: TraitSerializers,\n): Promise<DSLAttributes> {\n\tconst result: DSLAttributes = {}\n\tfor (const trait of traits) {\n\t\tif (trait.toAttributes) {\n\t\t\tconst values = await trait.toAttributes(node, parent, ctx, serializers)\n\t\t\tif (!isObject(values)) continue\n\t\t\tdeepMergeAttributes(result, values)\n\t\t} else {\n\t\t\tfor (const key of objectKeys(trait.definition)) {\n\t\t\t\tconst value = node instanceof CanvasNode ? node.resolveValue(key) : node[key]\n\n\t\t\t\tconst normalized = normalizeGetterAttributeValue(key, value)\n\t\t\t\tif (isUndefined(normalized)) continue\n\t\t\t\tresult[key] = normalized.toString()\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}\n\n/**\n * Recursively merges `source` into `target`. Plain objects are merged key-by-key;\n * all other values (primitives, arrays, null) are set directly. Throws if two\n * traits write conflicting leaf values or mismatched types for the same key.\n */\nfunction isUnsafeMergeKey(key: string): boolean {\n\treturn key === \"__proto__\" || key === \"constructor\" || key === \"prototype\"\n}\n\nexport function deepMergeAttributes(target: Record<string, unknown>, source: Record<string, unknown>): void {\n\tfor (const key of Object.keys(source)) {\n\t\tif (isUnsafeMergeKey(key)) continue\n\n\t\tconst sourceVal = source[key]\n\t\tconst targetVal = target[key]\n\n\t\tif (isUndefined(targetVal)) {\n\t\t\ttarget[key] = sourceVal\n\t\t\tcontinue\n\t\t}\n\n\t\tif (Object.prototype.hasOwnProperty.call(target, key) && isObject(sourceVal) && isObject(targetVal)) {\n\t\t\tdeepMergeAttributes(targetVal, sourceVal)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (targetVal !== sourceVal) {\n\t\t\tthrow new Error(\n\t\t\t\t`Trait attribute conflict: key \"${key}\" already has value ${JSON.stringify(targetVal)}, cannot overwrite with ${JSON.stringify(sourceVal)}`,\n\t\t\t)\n\t\t}\n\t}\n}\n\nconst undefinedStringLiteral = \"undefined\"\nconst getterRoundDecimals = 2\nconst literalStringAttributeKeys = new Set([\"text\", \"html\"])\n\n/**\n * Normalizes getter output before adding it to DSL attributes.\n *\n * - Drops undefined values\n * - Converts null to the DSL null sentinel\n * - Drops non-finite numbers\n * - Drops accidental \"undefined\" string values except for literal text/html payloads\n */\nexport function normalizeGetterAttributeValue(\n\tkey: string,\n\tvalue: unknown,\n): string | RoundedNumber | boolean | undefined {\n\tif (isUndefined(value)) return\n\tif (isNull(value)) return nullString\n\tif (typeof value === \"number\" && !Number.isFinite(value)) return\n\tif (typeof value === \"number\") return toRoundedNumber(value, getterRoundDecimals)\n\tif (typeof value === \"string\" && value === undefinedStringLiteral && !literalStringAttributeKeys.has(key)) return\n\tif (typeof value === \"string\" || typeof value === \"boolean\") return value\n\treturn\n}\n", "import { unflatten } from \"app/ai/utils/flatten.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { applyTrait } from \"../context/deferred.ts\"\nimport type { VirtualRichTextNode } from \"../context/richtext/document.ts\"\nimport { virtualControls } from \"./controls.ts\"\nimport { inlineCode } from \"./inlineCode.ts\"\nimport { virtualInlineCodeStylePreset } from \"./inlineCodeStylePreset.ts\"\nimport { virtualLink } from \"./link.ts\"\nimport { virtualLinkStylePreset } from \"./linkStylePreset.ts\"\nimport { media } from \"./media.ts\"\nimport { virtualTextComponentSize } from \"./size.ts\"\nimport { tableCell } from \"./tableCell.ts\"\nimport { virtualText } from \"./text.ts\"\nimport { textComponentAlignment } from \"./textComponentAlignment.ts\"\nimport { textRunMarks } from \"./textRunMarks.ts\"\nimport { virtualTextStyleTraitDefinitionsByName } from \"./textStyle/textStyle.ts\"\nimport { virtualTextTag } from \"./textTag.ts\"\nimport { traitsToAttributes } from \"./traitsToAttributes.ts\"\nimport type { DSLAttributes, TraitSerializers, VirtualNodeTraitDefinition } from \"./types.ts\"\n\nconst supportedVirtualTraitsByName = {\n\tvirtualText,\n\tvirtualTextTag,\n\tinlineCode,\n\tinlineCodeStylePreset: virtualInlineCodeStylePreset,\n\ttextRunMarks,\n\t...virtualTextStyleTraitDefinitionsByName,\n\tlink: virtualLink,\n\tlinkStylePreset: virtualLinkStylePreset,\n\tmedia,\n\ttableCell,\n\tvirtualControls,\n\tvirtualTextComponentSize,\n\ttextComponentAlignment,\n} as const satisfies Record<string, VirtualNodeTraitDefinition<object>>\n\nexport type SupportedVirtualTraits = readonly VirtualNodeTraitDefinition<object>[]\n\ntype SupportedTraitsByName = typeof supportedVirtualTraitsByName\ntype TraitDefinitions = SupportedTraitsByName[keyof SupportedTraitsByName][\"definition\"]\n\ntype KeysOf<T> = T extends object ? keyof T : never\nexport type VirtualTraitKey = KeysOf<TraitDefinitions>\n\nexport const supportedVirtualTraits: readonly VirtualNodeTraitDefinition<object>[] =\n\tObject.values(supportedVirtualTraitsByName)\n\nexport function toVirtualNodeAttributes(\n\tnode: VirtualRichTextNode,\n\tctx: AgentContext,\n\tserializers: TraitSerializers,\n): Promise<DSLAttributes> {\n\treturn traitsToAttributes(supportedVirtualTraits, node, undefined, ctx, serializers)\n}\n\nexport function fromVirtualNodeAttributes(\n\tnode: VirtualRichTextNode,\n\tattributes: Record<string, string | undefined>,\n\tctx: AgentContext,\n\trawDsl: string,\n) {\n\tconst unflattened = unflatten(attributes)\n\tfor (const trait of supportedVirtualTraits) applyTrait(node, trait, unflattened, ctx, rawDsl)\n}\n\nconst cachedSupportedAttributesByNodeType = new Map<VirtualRichTextNode[\"type\"], Set<string>>()\nexport function getSupportedAttributesForNode(virtualNode: VirtualRichTextNode) {\n\tconst cached = cachedSupportedAttributesByNodeType.get(virtualNode.type)\n\tif (cached) {\n\t\treturn cached\n\t}\n\n\tconst attributes = new Set<string>()\n\tfor (const trait of supportedVirtualTraits) {\n\t\tif (trait.for(virtualNode)) {\n\t\t\tfor (const key in trait.definition) {\n\t\t\t\tattributes.add(key)\n\t\t\t}\n\t\t}\n\t}\n\tcachedSupportedAttributesByNodeType.set(virtualNode.type, attributes)\n\treturn attributes\n}\n", "import { deepClone } from \"utils/deepClone.ts\"\nimport { isArray, isObject, isUndefined } from \"utils/typeChecks.ts\"\n\nfunction isArrayIndex(segment: string): boolean {\n\treturn /^\\d+$/u.test(segment)\n}\n\nfunction getNestedValue(source: Record<string, unknown>, path: readonly string[]): unknown {\n\tlet current: unknown = source\n\tfor (const segment of path) {\n\t\tif (isArray(current)) {\n\t\t\tconst idx = parseInt(segment, 10)\n\t\t\tif (Number.isNaN(idx)) return\n\t\t\tcurrent = current[idx]\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!isObject(current) || !(segment in current)) return\n\t\tcurrent = current[segment]\n\t}\n\treturn current\n}\n\nfunction fillArrayHoles(array: unknown[], index: number): void {\n\twhile (array.length < index) {\n\t\tarray.push(null)\n\t}\n}\n\nfunction setNestedValue(target: Record<string, unknown> | unknown[], path: readonly string[], value: unknown): void {\n\tconst [head, ...tail] = path\n\tif (!head) return\n\tif (tail.length === 0) {\n\t\tif (isArray(target)) {\n\t\t\tconst idx = parseInt(head, 10)\n\t\t\tif (!Number.isNaN(idx)) {\n\t\t\t\tfillArrayHoles(target, idx)\n\t\t\t\ttarget[idx] = value\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\ttarget[head] = value\n\t\treturn\n\t}\n\n\tif (isArray(target)) {\n\t\tconst idx = parseInt(head, 10)\n\t\tif (Number.isNaN(idx)) {\n\t\t\treturn\n\t\t}\n\t}\n\n\tconst existing = isArray(target) ? target[Number(head)] : target[head]\n\tconst next = isObject(existing) || isArray(existing) ? existing : isArrayIndex(tail[0] ?? \"\") ? [] : {}\n\tif (isArray(target)) {\n\t\tconst idx = Number(head)\n\t\tfillArrayHoles(target, idx)\n\t\ttarget[idx] = next\n\t} else {\n\t\ttarget[head] = next\n\t}\n\tsetNestedValue(next, tail, value)\n}\n\nexport function filterSerializedKeyValues<T extends object>(\n\tattributes: Partial<T>,\n\tattributeFilter?: ReadonlySet<string>,\n\toptions: { filter?: (key: [string, ...string[]]) => boolean; markNullOnUndefined?: boolean } = {},\n): Partial<T> | undefined {\n\t// No filter returns original attributes\n\tif (!attributeFilter) return attributes\n\t// Empty filter returns nothing, avoid instantiating empty object.\n\tif (attributeFilter.size === 0) return\n\n\tconst filtered: Partial<T> = {}\n\tfor (const attribute of attributeFilter) {\n\t\tconst path = attribute.split(\".\").filter(Boolean)\n\t\tif (!hasAnyElement(path)) continue\n\n\t\tif (options.filter && !options.filter(path)) continue\n\n\t\tconst value = getNestedValue(attributes, path)\n\t\tif (options.markNullOnUndefined) {\n\t\t\tsetNestedValue(filtered, path, isUndefined(value) ? null : deepClone(value))\n\t\t} else if (!isUndefined(value)) {\n\t\t\tsetNestedValue(filtered, path, deepClone(value))\n\t\t}\n\t}\n\n\tif (Object.keys(filtered).length === 0) return\n\n\treturn filtered\n}\n\nfunction hasAnyElement<T>(value: T[]): value is [T, ...T[]] {\n\treturn value.length > 0\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport type { TaskScheduler } from \"document/loader/TaskScheduler.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport {\n\tTextBlockClass,\n\tTextBlockquoteClass,\n\tTextBulletListClass,\n\tTextComponentInstanceClass,\n\tTextListItemClass,\n\tTextMediaBlockClass,\n\tTextNumberedListClass,\n\tTextTableCellClass,\n\tTextTableClass,\n\tTextTableRowClass,\n\tTextUnsupportedBlockClass,\n\ttype TextLineBreakClass,\n\ttype TextRunClass,\n\ttype VirtualNodeClass,\n} from \"../../dsl.ts\"\nimport type { DSLAttributes, TraitSerializers } from \"../../traits/types.ts\"\nimport { toVirtualNodeAttributes } from \"../../traits/virtualAttributes.ts\"\nimport type { AgentContext } from \"../AgentContext.ts\"\nimport { filterSerializedKeyValues } from \"../serializeAttributes.ts\"\nimport {\n\ttype RichTextReaderHandle,\n\ttype VirtualRichTextInline,\n\ttype VirtualRichTextNode,\n\ttype VirtualRichTextListItem,\n\ttype VirtualRichTextRoot,\n\ttype VirtualRichTextTableRow,\n\ttype VirtualRichTextTableCell,\n\ttype VirtualRichTextUnsupported,\n\tisVirtualRichTextTextComponentInstance,\n\tvirtualRichTextComponentInstanceAliasPrefix,\n} from \"./document.ts\"\n\ntype VirtualAttributeFilterNodeId = string & Record<never, never>\ntype VirtualAttribute = string & Record<never, never>\nexport type VirtualAttributeFilter = ReadonlyMap<VirtualAttributeFilterNodeId, ReadonlySet<VirtualAttribute>>\n\ninterface SerializeVirtualTextOptions {\n\tmarkNullOnUndefined?: boolean\n}\n\ninterface TextNode extends DSLAttributes {\n\ttype: VirtualNodeClass\n\tid: string\n\tattributes?: DSLAttributes\n}\n\nexport interface TextRunNode extends TextNode {\n\ttype: typeof TextRunClass\n}\n\nexport interface TextLineBreakNode extends TextNode {\n\ttype: typeof TextLineBreakClass\n}\n\nexport interface TextBlockNode extends TextNode {\n\ttype: typeof TextBlockClass\n\tchildren: readonly (TextRunNode | TextLineBreakNode)[]\n}\n\nexport interface TextBlockquoteNode extends TextNode {\n\ttype: typeof TextBlockquoteClass\n\tchildren: readonly SerializedVirtualTextBlockNode[]\n}\n\nexport interface TextTableNode extends TextNode {\n\ttype: typeof TextTableClass\n\tchildren: readonly TextTableRowNode[]\n}\n\nexport interface TextTableRowNode extends TextNode {\n\ttype: typeof TextTableRowClass\n\tchildren: readonly TextTableCellNode[]\n}\n\nexport interface TextTableCellNode extends TextNode {\n\ttype: typeof TextTableCellClass\n\tchildren: readonly SerializedVirtualTextBlockNode[]\n}\n\nexport interface TextBulletListNode extends TextNode {\n\ttype: typeof TextBulletListClass\n\tchildren: readonly TextListItemNode[]\n}\n\nexport interface TextNumberedListNode extends TextNode {\n\ttype: typeof TextNumberedListClass\n\tchildren: readonly TextListItemNode[]\n}\n\nexport interface TextListItemNode extends TextNode {\n\ttype: typeof TextListItemClass\n\tchildren: readonly SerializedVirtualTextBlockNode[]\n}\n\nexport interface TextMediaBlockNode extends TextNode {\n\ttype: typeof TextMediaBlockClass\n}\n\nexport interface TextComponentInstanceNode extends TextNode {\n\ttype: typeof TextComponentInstanceClass\n}\n\nexport interface UnsupportedBlockNode extends TextNode {\n\ttype: typeof TextUnsupportedBlockClass\n}\n\nexport type SerializedVirtualTextBlockNode =\n\t| TextBlockNode\n\t| TextBlockquoteNode\n\t| TextTableNode\n\t| TextBulletListNode\n\t| TextNumberedListNode\n\t| TextMediaBlockNode\n\t| TextComponentInstanceNode\n\t| UnsupportedBlockNode\n\nexport type SerializedVirtualTextRootNode = SerializedVirtualTextBlockNode\nexport type SerializedVirtualTextNode =\n\t| SerializedVirtualTextBlockNode\n\t| TextTableRowNode\n\t| TextTableCellNode\n\t| TextListItemNode\n\ntype SerializedVirtualTextInlineNode = TextRunNode | TextLineBreakNode\ntype AnySerializedVirtualTextNode = SerializedVirtualTextNode | SerializedVirtualTextInlineNode\n\nconst typeKey = \"type\" as const satisfies keyof SerializedVirtualTextRootNode\n\nconst serializedVirtualTextRootNodeTypes: Record<SerializedVirtualTextRootNode[\"type\"], true> = {\n\tTextBlockquote: true,\n\tTextTable: true,\n\tTextBulletList: true,\n\tTextComponentInstance: true,\n\tTextMediaBlock: true,\n\tTextNumberedList: true,\n\tTextBlock: true,\n\tTextUnsupportedBlock: true,\n}\n\nfunction isSerializedVirtualTextRootNode(node: unknown): node is SerializedVirtualTextRootNode {\n\tif (!isObject(node)) return false\n\tconst type = node[typeKey]\n\treturn isString(type) && Object.hasOwn(serializedVirtualTextRootNodeTypes, type)\n}\n\nexport function isSerializedVirtualText(value: unknown): value is SerializedVirtualTextRootNode[] {\n\tif (!Array.isArray(value)) return false\n\tif (value.length === 0) return false\n\n\treturn value.every(isSerializedVirtualTextRootNode)\n}\n\nfunction serializeUnsupportedBlock(id: string, nodeType: string, reason?: string): UnsupportedBlockNode {\n\tconst attributes: DSLAttributes = { nodeType }\n\tif (reason) attributes.reason = reason\n\n\treturn {\n\t\ttype: TextUnsupportedBlockClass,\n\t\tid,\n\t\tattributes,\n\t}\n}\n\nfunction serializeVirtualUnsupportedBlock(block: VirtualRichTextUnsupported): UnsupportedBlockNode {\n\treturn serializeUnsupportedBlock(block.id, block.nodeType, block.reason)\n}\n\nfunction applyNodeAttributesOptimization(\n\tattributes: DSLAttributes,\n\tnodeAttributeFilter?: ReadonlySet<VirtualAttribute>,\n\toptions: SerializeVirtualTextOptions = {},\n): DSLAttributes | undefined {\n\tif (nodeAttributeFilter) {\n\t\treturn filterSerializedKeyValues(attributes, nodeAttributeFilter, {\n\t\t\tmarkNullOnUndefined: options.markNullOnUndefined,\n\t\t})\n\t}\n\treturn attributes\n}\n\nexport function hydrateAndSerializeRichText(\n\thandle: RichTextReaderHandle,\n\tctx: AgentContext,\n): Promise<SerializedVirtualTextBlockNode[]> {\n\tconst document = ctx.virtualText.hydrate(handle)\n\treturn serializeVirtualText(document?.children ?? [], ctx)\n}\n\nconst traitSerializers: TraitSerializers = {\n\trichText: hydrateAndSerializeRichText,\n}\n\n/** Serializes hydrated virtual roots into the AI context format. */\nexport async function serializeVirtualText(\n\troots: readonly VirtualRichTextRoot[],\n\tctx: AgentContext,\n\tattributeFilters?: VirtualAttributeFilter,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: SerializeVirtualTextOptions,\n): Promise<SerializedVirtualTextBlockNode[]> {\n\treturn serializeVirtualTextRoots(roots, ctx, attributeFilters, taskScheduler, options)\n}\n\nfunction serializeVirtualTextNode(\n\tnode: VirtualRichTextRoot,\n\tctx: AgentContext,\n\tattributeFilters?: VirtualAttributeFilter,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: SerializeVirtualTextOptions,\n): Promise<SerializedVirtualTextBlockNode>\nfunction serializeVirtualTextNode(\n\tnode: VirtualRichTextListItem,\n\tctx: AgentContext,\n\tattributeFilters?: VirtualAttributeFilter,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: SerializeVirtualTextOptions,\n): Promise<TextListItemNode>\nfunction serializeVirtualTextNode(\n\tnode: VirtualRichTextTableRow,\n\tctx: AgentContext,\n\tattributeFilters?: VirtualAttributeFilter,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: SerializeVirtualTextOptions,\n): Promise<TextTableRowNode>\nfunction serializeVirtualTextNode(\n\tnode: VirtualRichTextTableCell,\n\tctx: AgentContext,\n\tattributeFilters?: VirtualAttributeFilter,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: SerializeVirtualTextOptions,\n): Promise<TextTableCellNode>\nfunction serializeVirtualTextNode(\n\tnode: VirtualRichTextInline,\n\tctx: AgentContext,\n\tattributeFilters?: VirtualAttributeFilter,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: SerializeVirtualTextOptions,\n): Promise<TextRunNode | TextLineBreakNode>\nasync function serializeVirtualTextNode(\n\tnode: VirtualRichTextNode,\n\tctx: AgentContext,\n\tattributeFilters?: VirtualAttributeFilter,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: SerializeVirtualTextOptions,\n): Promise<AnySerializedVirtualTextNode> {\n\tconst nodeAttributeFilter = attributeFilters?.get(node.id)\n\n\tswitch (node.type) {\n\t\tcase \"lineBreak\":\n\t\t\treturn { type: \"TextLineBreak\" as const, id: node.id }\n\t\tcase \"textRun\": {\n\t\t\tconst attributes = await toVirtualNodeAttributes(node, ctx, traitSerializers)\n\t\t\treturn {\n\t\t\t\ttype: \"TextRun\" as const,\n\t\t\t\tid: node.id,\n\t\t\t\tattributes: applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t}\n\t\t}\n\t}\n\n\tconst id = isVirtualRichTextTextComponentInstance(node)\n\t\t? ctx.virtualText.getOrCreateNodeAlias(node, virtualRichTextComponentInstanceAliasPrefix)\n\t\t: node.id\n\n\tconst attributes = await toVirtualNodeAttributes(node, ctx, traitSerializers)\n\n\tswitch (node.type) {\n\t\tcase \"listItem\": {\n\t\t\treturn {\n\t\t\t\ttype: TextListItemClass,\n\t\t\t\tid: node.id,\n\t\t\t\tattributes: applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t\tchildren: await serializeVirtualTextRoots(node.children, ctx, attributeFilters, taskScheduler, options),\n\t\t\t}\n\t\t}\n\t\tcase \"unsupported\":\n\t\t\treturn serializeVirtualUnsupportedBlock(node)\n\t\tcase \"table\": {\n\t\t\treturn {\n\t\t\t\ttype: TextTableClass,\n\t\t\t\tid: node.id,\n\t\t\t\tattributes: applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t\tchildren: await Promise.all(\n\t\t\t\t\tnode.children.map(child => serializeVirtualTextNode(child, ctx, attributeFilters, undefined, options)),\n\t\t\t\t),\n\t\t\t}\n\t\t}\n\t\tcase \"tableRow\": {\n\t\t\treturn {\n\t\t\t\ttype: TextTableRowClass,\n\t\t\t\tid: node.id,\n\t\t\t\tattributes: applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t\tchildren: await Promise.all(\n\t\t\t\t\tnode.children.map(child => serializeVirtualTextNode(child, ctx, attributeFilters, undefined, options)),\n\t\t\t\t),\n\t\t\t}\n\t\t}\n\t\tcase \"tableCell\": {\n\t\t\treturn {\n\t\t\t\ttype: TextTableCellClass,\n\t\t\t\tid: node.id,\n\t\t\t\tattributes: applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t\tchildren: await serializeVirtualTextRoots(node.children, ctx, attributeFilters, taskScheduler, options),\n\t\t\t}\n\t\t}\n\t\tcase \"blockquote\": {\n\t\t\treturn {\n\t\t\t\ttype: TextBlockquoteClass,\n\t\t\t\tid: node.id,\n\t\t\t\tattributes: applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t\tchildren: await serializeVirtualTextRoots(node.children, ctx, attributeFilters, taskScheduler, options),\n\t\t\t}\n\t\t}\n\t\tcase \"componentInstance\":\n\t\t\treturn {\n\t\t\t\ttype: TextComponentInstanceClass,\n\t\t\t\tid,\n\t\t\t\tattributes: {\n\t\t\t\t\t...applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t\t\tcomponent: ctx.components.getIdForModuleIdentifier(node.identifier) ?? node.identifier,\n\t\t\t\t},\n\t\t\t}\n\t\tcase \"mediaBlock\": {\n\t\t\tif (node.mediaType !== \"image\") {\n\t\t\t\treturn serializeUnsupportedBlock(\n\t\t\t\t\tnode.id,\n\t\t\t\t\tTextMediaBlockClass,\n\t\t\t\t\t\"This TextMediaBlock is preserved but cannot be edited yet because it contains video media.\",\n\t\t\t\t)\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\ttype: TextMediaBlockClass,\n\t\t\t\tid: node.id,\n\t\t\t\tattributes: applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t}\n\t\t}\n\t\tcase \"textBlock\": {\n\t\t\treturn {\n\t\t\t\ttype: TextBlockClass,\n\t\t\t\tid: node.id,\n\t\t\t\tattributes: applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t\tchildren: await serializeVirtualTextInlines(node.children, ctx, attributeFilters, taskScheduler, options),\n\t\t\t}\n\t\t}\n\t\tcase \"bulletList\": {\n\t\t\treturn {\n\t\t\t\ttype: TextBulletListClass,\n\t\t\t\tid: node.id,\n\t\t\t\tattributes: applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t\tchildren: await serializeVirtualTextListItems(node.children, ctx, attributeFilters, taskScheduler, options),\n\t\t\t}\n\t\t}\n\t\tcase \"numberedList\": {\n\t\t\treturn {\n\t\t\t\ttype: TextNumberedListClass,\n\t\t\t\tid: node.id,\n\t\t\t\tattributes: applyNodeAttributesOptimization(attributes, nodeAttributeFilter, options),\n\t\t\t\tchildren: await serializeVirtualTextListItems(node.children, ctx, attributeFilters, taskScheduler, options),\n\t\t\t}\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(node)\n\t}\n}\n\nasync function serializeVirtualTextRoots(\n\tnodes: readonly VirtualRichTextRoot[],\n\tctx: AgentContext,\n\tattributeFilters?: VirtualAttributeFilter,\n\ttaskScheduler?: TaskScheduler,\n\toptions: SerializeVirtualTextOptions = {},\n): Promise<SerializedVirtualTextBlockNode[]> {\n\tconst result: SerializedVirtualTextBlockNode[] = []\n\n\tfor (const node of nodes) {\n\t\tconst serializedNode = await serializeVirtualTextNode(node, ctx, attributeFilters, taskScheduler, options)\n\t\tresult.push(serializedNode)\n\t}\n\n\treturn result\n}\n\nasync function serializeVirtualTextListItems(\n\tnodes: readonly VirtualRichTextListItem[],\n\tctx: AgentContext,\n\tattributeFilters?: VirtualAttributeFilter,\n\ttaskScheduler?: TaskScheduler,\n\toptions: SerializeVirtualTextOptions = {},\n): Promise<TextListItemNode[]> {\n\tconst result: TextListItemNode[] = []\n\n\tfor (const node of nodes) {\n\t\tconst serializedNode = await serializeVirtualTextNode(node, ctx, attributeFilters, taskScheduler, options)\n\t\tresult.push(serializedNode)\n\t}\n\n\treturn result\n}\n\nasync function serializeVirtualTextInlines(\n\tnodes: readonly VirtualRichTextInline[],\n\tctx: AgentContext,\n\tattributeFilters?: VirtualAttributeFilter,\n\ttaskScheduler?: TaskScheduler,\n\toptions: SerializeVirtualTextOptions = {},\n): Promise<SerializedVirtualTextInlineNode[]> {\n\tconst result: SerializedVirtualTextInlineNode[] = []\n\n\tfor (const node of nodes) {\n\t\tconst serializedNode = await serializeVirtualTextNode(node, ctx, attributeFilters, taskScheduler, options)\n\t\tresult.push(serializedNode)\n\t}\n\n\treturn result\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { getScopeTypeForScope } from \"document/base-engine/BaseScopeStore.ts\"\nimport { type CanvasNode, isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCollectionNode,\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\ttype VariableDefinition,\n\ttype VariableOrDivider,\n\ttype VectorSetItemVariableDefinition,\n\ttype WithVariables,\n\tisArrayGalleryVariable,\n\tisOptionalVariable,\n\tisRichTextVariableDefinition,\n\tisVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { prefixControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { safeProperty } from \"utils/names.ts\"\nimport { slugifyPathVariable } from \"utils/pathVariables.ts\"\nimport {\n\tCollectionReferenceVariableAliasNodeClass,\n\tDateVariableAliasNodeClass,\n\tOptionVariableAliasNodeClass,\n\tEventHandlerVariableAliasNodeClass,\n\tFileVariableAliasNodeClass,\n\tIconVariableType,\n\tIconVariableAliasNodeClass,\n\tLinkVariableAliasNodeClass,\n\tVariableNodeClass,\n\tserializeVariableType,\n\tGalleryVariableAliasNodeClass,\n\tGalleryVariableType,\n} from \"../dsl.ts\"\nimport { toEventHandlerAttributeKey } from \"../eventHandlerKeys.ts\"\nimport type { AgentContext } from \"./AgentContext.ts\"\nimport { variableTypeToControlType } from \"./dynamicValues.ts\"\nimport { hydrateAndSerializeRichText } from \"./richtext/serialize.ts\"\nimport { createRichTextTarget, resolveRichTextTargetHandleFromNode } from \"./richtext/targets.ts\"\n\nexport interface SerializedVariable {\n\tkey: string\n\tid: string\n\tname: string\n\ttype: string\n\tinitialValue?: unknown\n\tset?: string\n\t/** For references, the name of the referenced collection. */\n\tcollection?: string\n\t/** See {@link WithQueryParam} */\n\tqueryParam?: string\n\tdisplayTime?: boolean\n\t/** Multi-line text input for string variables. See {@link StringVariableOptions.displayTextArea}. */\n\tdisplayTextArea?: boolean\n\t/** Array min count */\n\tminCount?: number\n\t/** Array max count */\n\tmaxCount?: number\n\t/** Enum cases */\n\tcases?: string[]\n\t/** File variable allowed file extensions. */\n\tallowedFileTypes?: string[]\n\t/** Omitted only for collections' virtual `id` variable that can't be created or edited. */\n\tnode?:\n\t\t| typeof VariableNodeClass\n\t\t| typeof CollectionReferenceVariableAliasNodeClass\n\t\t| typeof DateVariableAliasNodeClass\n\t\t| typeof OptionVariableAliasNodeClass\n\t\t| typeof EventHandlerVariableAliasNodeClass\n\t\t| typeof FileVariableAliasNodeClass\n\t\t| typeof IconVariableAliasNodeClass\n\t\t| typeof GalleryVariableAliasNodeClass\n\t\t| typeof LinkVariableAliasNodeClass\n}\n\ninterface SerializedIconVariableAttributes {\n\tinitialValue: string\n\tset: string\n}\n\nexport async function getSerializedIconVariableAttributes(\n\tvariable: VectorSetItemVariableDefinition,\n\tctx: AgentContext,\n): Promise<SerializedIconVariableAttributes> {\n\tconst handle =\n\t\t(await ctx.vectorSets.async.forInstanceIdentifier(variable.initialValue.identifier)) ??\n\t\t(await ctx.vectorSets.async.forModuleId(variable.setModuleId))\n\tassert(handle, `Could not resolve the icon set for variable \"${variable.name}\".`)\n\n\treturn {\n\t\tset: handle.name,\n\t\tinitialValue: handle.getName(variable.initialValue.identifier) ?? Dictionary.Icon,\n\t}\n}\n\n/**\n * Serializes a single variable for the AI agent context.\n * For RichText variables, hydrates the initialValue HTML into TextBlockNode[].\n * Returns undefined for dividers and unsupported types.\n */\nexport async function serializeVariable(\n\tnode: CanvasNode & WithVariables,\n\tvariable: VariableOrDivider,\n\tctx: AgentContext,\n): Promise<SerializedVariable | undefined> {\n\tconst serialized = await createSerializedVariable(node, variable, ctx)\n\tif (!serialized) return undefined\n\tif (serialized.node === IconVariableAliasNodeClass) return serialized\n\tif (serialized.node === GalleryVariableAliasNodeClass) return serialized\n\tif (serialized.node === FileVariableAliasNodeClass) return serialized\n\n\tif (hasNonEmptyInitialValue(variable, node)) {\n\t\tif (isRichTextVariableDefinition(variable)) {\n\t\t\tconst handle = resolveRichTextTargetHandleFromNode(node, createRichTextTarget(node.id, variable.id), ctx)\n\t\t\tif (handle) {\n\t\t\t\tserialized.initialValue = await hydrateAndSerializeRichText(handle, ctx)\n\t\t\t}\n\t\t} else if (variable.type === ControlType.Enum) {\n\t\t\tserialized.initialValue = variable.cases.find(enumCase => enumCase.id === variable.initialValue)?.name\n\t\t} else {\n\t\t\tserialized.initialValue = variable.initialValue\n\t\t}\n\t}\n\n\treturn serialized\n}\n\nasync function createSerializedVariable(\n\tnode: CanvasNode & WithVariables,\n\tvariable: VariableOrDivider,\n\tctx: AgentContext,\n): Promise<SerializedVariable | undefined> {\n\tconst controlType = serializeVariableType(variable.type) ?? variableTypeToControlType(variable.type)\n\tif (!controlType) return undefined\n\tif (!isVariableDefinition(variable)) return undefined\n\n\tconst controlTitle = getVariableControlTitle(node, variable, ctx)\n\tconst key = getAttributeKey(controlType, controlTitle)\n\n\tif (controlType === ControlType.CollectionReference || controlType === ControlType.MultiCollectionReference) {\n\t\treturn {\n\t\t\tkey,\n\t\t\tid: variable.id,\n\t\t\tname: variable.name,\n\t\t\tnode: CollectionReferenceVariableAliasNodeClass,\n\t\t\ttype: controlType === ControlType.MultiCollectionReference ? \"multi\" : \"single\",\n\t\t}\n\t}\n\n\tif (controlType === ControlType.Date) {\n\t\tassert(variable.type === ControlType.Date, `Expected date variable type for \"${variable.name}\".`)\n\t\treturn {\n\t\t\tkey,\n\t\t\tid: variable.id,\n\t\t\tname: variable.name,\n\t\t\tnode: DateVariableAliasNodeClass,\n\t\t\ttype: controlType,\n\t\t\tdisplayTime: variable.options?.displayTime === true,\n\t\t}\n\t}\n\n\tif (controlType === ControlType.EventHandler) {\n\t\tassert(variable.type === ControlType.EventHandler, `Expected event handler variable type for \"${variable.name}\".`)\n\t\treturn {\n\t\t\tkey,\n\t\t\tid: variable.id,\n\t\t\tname: variable.name,\n\t\t\tnode: EventHandlerVariableAliasNodeClass,\n\t\t\ttype: controlType,\n\t\t}\n\t}\n\n\tif (controlType === ControlType.Link) {\n\t\treturn {\n\t\t\tkey,\n\t\t\tid: variable.id,\n\t\t\tname: variable.name,\n\t\t\tnode: LinkVariableAliasNodeClass,\n\t\t\ttype: controlType,\n\t\t}\n\t}\n\n\tif (controlType === IconVariableType) {\n\t\tassert(variable.type === ControlType.VectorSetItem, `Expected icon variable type for \"${variable.name}\".`)\n\t\tconst iconAttributes = await getSerializedIconVariableAttributes(variable, ctx)\n\t\treturn {\n\t\t\t...iconAttributes,\n\t\t\tkey,\n\t\t\tid: variable.id,\n\t\t\tname: variable.name,\n\t\t\tnode: IconVariableAliasNodeClass,\n\t\t\ttype: controlType,\n\t\t}\n\t}\n\n\tif (isArrayGalleryVariable(variable)) {\n\t\tassert(controlType === ControlType.Array, `Expected array control type for gallery variable \"${variable.name}\".`)\n\t\treturn {\n\t\t\tkey,\n\t\t\tid: variable.id,\n\t\t\tname: variable.name,\n\t\t\tnode: GalleryVariableAliasNodeClass,\n\t\t\ttype: GalleryVariableType,\n\t\t\tminCount: variable.minCount,\n\t\t\tmaxCount: variable.maxCount,\n\t\t}\n\t}\n\n\tif (controlType === ControlType.Enum) {\n\t\tassert(variable.type === ControlType.Enum, `Expected enum variable type for \"${variable.name}\".`)\n\t\treturn {\n\t\t\tkey,\n\t\t\tid: variable.id,\n\t\t\tname: variable.name,\n\t\t\tnode: OptionVariableAliasNodeClass,\n\t\t\ttype: controlType,\n\t\t\tcases: variable.cases.map(enumCase => enumCase.name),\n\t\t}\n\t}\n\n\tif (controlType === ControlType.File) {\n\t\tassert(variable.type === ControlType.File, `Expected file variable type for \"${variable.name}\".`)\n\t\treturn {\n\t\t\tkey,\n\t\t\tid: variable.id,\n\t\t\tname: variable.name,\n\t\t\tnode: FileVariableAliasNodeClass,\n\t\t\ttype: controlType,\n\t\t\tallowedFileTypes: variable.allowedFileTypes.map(fileType => fileType.extension),\n\t\t}\n\t}\n\n\tconst serialized: SerializedVariable = {\n\t\tkey,\n\t\tid: variable.id,\n\t\tname: variable.name,\n\t\tnode: VariableNodeClass,\n\t\ttype: controlType,\n\t}\n\tif (variable.type === ControlType.String && variable.options?.displayTextArea === true) {\n\t\tserialized.displayTextArea = true\n\t}\n\treturn serialized\n}\n\nfunction getAttributeKey(controlType: ControlType | \"icon\" | undefined, controlTitle: string) {\n\tif (controlType === ControlType.EventHandler) return toEventHandlerAttributeKey(controlTitle)\n\treturn prefixControlPropKey(controlTitle)\n}\n\nfunction getVariableControlTitle(\n\tnode: CanvasNode & WithVariables,\n\tvariable: VariableDefinition,\n\tctx: AgentContext,\n): string {\n\tif (isCollectionNode(node)) {\n\t\treturn ctx.collections.forId(node.id)?.controls.getControlTitle(variable.id) ?? slugifyPathVariable(variable.name)\n\t}\n\n\tlet title: string | undefined = undefined\n\tif (isSmartComponentNode(node)) {\n\t\ttitle = ctx.components.forIdentifier(node.instanceIdentifier)?.controls.getControlTitle(variable.id)\n\t}\n\n\tif (isLayoutTemplateNode(node)) {\n\t\ttitle = ctx.layoutTemplates.forIdentifier(node.instanceIdentifier)?.controls.getControlTitle(variable.id)\n\t}\n\n\tif (title) return title\n\t// FIXME: This is an approximation of what would be returned by `getControlTitle` if the definition was loaded, but it skips\n\t// the deduplication of safe names, so we can get collisions with `text-color`, `textColor`, `TextColor` and `text_color` etc.\n\t// Ideally we would defer until loaded with deferUntilLoaded but the agent doesn't handle it well yet.\n\tconst name = safeProperty(variable.name)\n\tassert(name, `Expected a valid safe name for the variable \"${variable.name}\".`)\n\treturn name\n}\n\nfunction hasNonEmptyInitialValue(\n\tvariable: VariableOrDivider,\n\tnode: CanvasNode & WithVariables,\n): variable is VariableDefinition {\n\tif (variable.type === \"divider\") return false\n\n\tconst scopeType = isScopeNode(node, true) ? getScopeTypeForScope(node) : undefined\n\tif (scopeType && isOptionalVariable(variable, scopeType)) {\n\t\t// Optional variables have a stale initialValue that is not effective at runtime.\n\t\t// Hide it so the agent understands the variable is optional by not having an initialValue.\n\t\treturn false\n\t}\n\n\tif (variable.type === ControlType.EventHandler) return false\n\tif (variable.type === ControlType.Link) return false\n\n\tconst value = variable.initialValue\n\tif (value === undefined || value === \"\") return false\n\treturn !Array.isArray(value) || value.length !== 0\n}\n", "import { isLocalModuleIdentifier, isModuleExportIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport { collectionIdKey } from \"code-generation/components/cms/dataIdKeys.ts\"\nimport { getQueryParamNameOfVariable } from \"document/components/chrome/properties/utils/getQueryParamNameOfVariable.ts\"\nimport { getRawWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport type { CanvasNode, CanvasTree, CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ReadonlyChildList } from \"document/models/CanvasTree/nodes/ChildList.ts\"\nimport { isCollectionNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tisAnyCollectionReferencingVariableDefinition,\n\ttype VariableOrDivider,\n\ttype WithVariables,\n\twithQueryParam,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { prefixControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { getWebPageNodesWithCollection } from \"document/stores/ScopeStore.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { getCollectionIdForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { getCollectionNameForPage, normalizeRouteForLLM } from \"../../utils/siteMap.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { getCollectionItemIdVariableLlmId } from \"../context/dynamicValues.ts\"\nimport { type SerializedVariable, serializeVariable } from \"../context/serializeVariable.ts\"\nimport { getUniqueEventHandlerAttributeKeys } from \"../eventHandlerKeys.ts\"\n\nexport interface SerializedCollection {\n\tid: string\n\tname: string\n\tvariables: SerializedVariable[]\n\titemCount: number\n\tdetailPage: string | null\n}\n\nexport function serializeCollectionsForAgent(\n\ttree: CanvasTree,\n\tcollections: readonly CollectionNode[] | ReadonlyChildList<CollectionNode>,\n\tctx: AgentContext,\n): Promise<SerializedCollection[]> {\n\tconst collectionIdToDetailPageRoute = buildCollectionIdToDetailPageRouteMap(tree)\n\n\treturn Promise.all(\n\t\tcollections.map(async collection => ({\n\t\t\tid: collection.id,\n\t\t\tname: collection.resolveValue(\"name\") ?? collection.id,\n\t\t\titemCount: collection.getItemCount(),\n\t\t\tvariables: await serializeVariablesForAgent(tree, collection, ctx),\n\t\t\tdetailPage: collectionIdToDetailPageRoute.get(collection.id) ?? null,\n\t\t})),\n\t)\n}\n\nexport async function serializeVariablesForAgent(\n\ttree: CanvasTree,\n\tnode: CanvasNode & WithVariables,\n\tctx: AgentContext,\n): Promise<SerializedVariable[]> {\n\tconst result: SerializedVariable[] = []\n\tconst isWebPage = isWebPageNode(node, true)\n\n\tfor (const variable of node.variables) {\n\t\tconst serialized = await serializeVariable(node, variable, ctx)\n\t\tif (!serialized) continue\n\n\t\tconst collectionName = getNameOfReferencedCollection(tree, variable)\n\t\tif (collectionName) {\n\t\t\tserialized.collection = collectionName\n\t\t}\n\n\t\tif (isWebPage && withQueryParam(variable)) {\n\t\t\tserialized.queryParam = getQueryParamNameOfVariable(variable)\n\t\t}\n\n\t\tresult.push(serialized)\n\t}\n\n\tif (isCollectionNode(node)) {\n\t\tresult.push({\n\t\t\tkey: prefixControlPropKey(collectionIdKey),\n\t\t\tid: getCollectionItemIdVariableLlmId(node.id),\n\t\t\tname: collectionIdKey,\n\t\t\ttype: ControlType.String,\n\t\t})\n\t}\n\n\tconst uniqueKeys = getUniqueEventHandlerAttributeKeys(\n\t\tresult.filter(entry => entry.type === ControlType.EventHandler).map(entry => entry.key),\n\t)\n\n\tlet eventHandlerCursor = 0\n\n\treturn result.map(entry => {\n\t\tif (entry.type !== ControlType.EventHandler) return entry\n\t\tconst replacement = uniqueKeys[eventHandlerCursor]\n\t\teventHandlerCursor += 1\n\t\treturn replacement ? { ...entry, key: replacement } : entry\n\t})\n}\n\nexport function getNameOfReferencedCollection(tree: CanvasTree, variable: VariableOrDivider) {\n\tif (!isAnyCollectionReferencingVariableDefinition(variable)) return\n\n\tconst parsedIdentifier = parseModuleIdentifier(variable.dataIdentifier)\n\tif (!isLocalModuleIdentifier(parsedIdentifier) || !isModuleExportIdentifier(parsedIdentifier)) return\n\tif (parsedIdentifier.type !== \"collection\") return\n\n\tconst referencedCollection = tree.getNodeWithTrait(parsedIdentifier.localIdName, isCollectionNode)\n\tif (!referencedCollection) return\n\n\tconst name = referencedCollection.resolveValue(\"name\")\n\treturn isString(name) ? name : referencedCollection.id\n}\n\nfunction buildCollectionIdToDetailPageRouteMap(tree: CanvasTree): Map<NodeID, string> {\n\tconst map = new Map<NodeID, string>()\n\n\tfor (const page of getWebPageNodesWithCollection(tree)) {\n\t\tconst route = getRawWebPagePath(tree, page)\n\t\tif (!route) continue\n\n\t\tconst collectionId = getCollectionIdForIdentifier(page.dataIdentifier)\n\t\tif (!collectionId) continue\n\n\t\tconst collectionName = getCollectionNameForPage(tree, page)\n\t\tif (!collectionName) continue\n\n\t\tmap.set(collectionId, normalizeRouteForLLM(route, collectionName))\n\t}\n\n\treturn map\n}\n", "export const truncatedPlaceholderType = \"__truncated__\"\n", "/**\n * A convenience alternative to the following:\n *\n * ```ts\n * const values = Object.values(foo) as (typeof foo)[keyof typeof foo][]\n * ```\n *\n * **Use with caution!** [There's a reason why TypeScript doesn't do this out of the\n * box](https://stackoverflow.com/a/55012175/242684).\n */\nexport const objectValues = Object.values as <T extends object>(obj: T) => T[keyof T][]\n", "import { assert, assertNever } from \"@framerjs/shared\"\nimport { getUpdateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { DynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { hasTransition, withTransition } from \"document/models/CanvasTree/traits/WithTransition.ts\"\nimport { hasVariantTransition, withVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport {\n\ttype Transition,\n\tdefaultDurationBasedSpringTransition,\n\tisTransition,\n\ttransitionBounceKey,\n\ttransitionDelayKey,\n\ttransitionDampingKey,\n\ttransitionDurationKey,\n\ttransitionEaseKey,\n\ttransitionMassKey,\n\ttransitionStiffnessKey,\n\ttoVekterTransition,\n} from \"document/models/Transition.ts\"\nimport { isFiniteNumber } from \"library/index.ts\"\nimport { objectValues } from \"library/utils/objectValues.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { singleWarning } from \"./invalidValues.ts\"\nimport { toRoundedNumber, type AttributeDefinition, type DSLAttributes, type TraitDefinition } from \"./types.ts\"\n\n// --- Attribute definitions ---\n\nexport const DSLTransitionType = {\n\tspringPhysics: \"spring-physics\",\n\tspringDuration: \"spring-duration\",\n\ttween: \"tween\",\n\tinertia: \"inertia\",\n\tinstant: \"instant\",\n} as const\n\ntype SupportedDSLTransitionType = (typeof DSLTransitionType)[keyof typeof DSLTransitionType]\nconst supportedDSLTransitionTypes = objectValues(DSLTransitionType)\n\nconst variantTransitionSupportedTypes = supportedDSLTransitionTypes.filter(t => t !== DSLTransitionType.inertia)\nconst variantTransitionDefinition: AttributeDefinition = {\n\tdescription: [...variantTransitionSupportedTypes, nullString].join(\" | \"),\n\toptional: true,\n}\n\nexport const springDSLTransitionTypes = [\"spring-physics\", \"spring-duration\"] as const\n\nexport const effectTransitionSupportedTypes = supportedDSLTransitionTypes.filter(\n\tt => t !== DSLTransitionType.instant && t !== DSLTransitionType.inertia,\n)\nexport const effectTransitionDefinition: AttributeDefinition = {\n\tdescription: effectTransitionSupportedTypes.join(\" | \"),\n\toptional: true,\n}\n\nexport const tweenTransitionSupportedTypes = [DSLTransitionType.tween] as const satisfies SupportedDSLTransitionType[]\nexport const tweenTransitionDefinition: AttributeDefinition = {\n\tdescription: tweenTransitionSupportedTypes.join(\" | \"),\n\toptional: true,\n}\n\nexport const inertiaTransitionSupportedTypes = [\n\tDSLTransitionType.inertia,\n] as const satisfies SupportedDSLTransitionType[]\nexport const inertiaTransitionDefinition: AttributeDefinition = {\n\tdescription: inertiaTransitionSupportedTypes.join(\" | \"),\n\toptional: true,\n}\n\n// --- Parsing ---\n\nconst whitespaceRegex = /\\s+/u\nconst unwrapCubicBezierRegex = /(?:cubic-bezier\\()?(?<ease>[\\d\\\\.,\\s]*)\\)?/u\n\ntype Ease = Transition[\"ease\"]\n\nfunction parseEase(value: string | undefined): Ease | undefined {\n\tif (!value) return\n\tconst match = unwrapCubicBezierRegex.exec(value)\n\tconst easeString = match?.groups?.ease ?? value\n\tconst parts = easeString.split(\",\")\n\tif (parts.length !== 4) return\n\tconst numbers = parts.map(p => tryParseNumber(p.trim()))\n\tif (!numbers.every(n => isNumber(n))) return\n\treturn numbers as Ease\n}\n\nfunction parseTime(value: unknown): number | undefined {\n\tif (isNumber(value)) return value\n\tif (!isString(value)) return\n\n\tconst [numberValue, unit] = parseCSSDimension(value, \"s\")\n\tif (Number.isNaN(numberValue)) return\n\n\tswitch (unit) {\n\t\tcase \"s\":\n\t\t\treturn numberValue\n\t\tcase \"ms\":\n\t\t\treturn numberValue / 1000\n\t\tdefault:\n\t\t\treturn\n\t}\n}\n\nexport function parseDSLTransitionString(\n\tvalue: unknown,\n\tsupportedTypes: readonly SupportedDSLTransitionType[] = supportedDSLTransitionTypes,\n\tonError?: (error: Error) => void,\n): Partial<Transition> | undefined {\n\tif (isUndefined(value)) return\n\tif (!isString(value)) {\n\t\tonError?.(new Error(`Expected a string, got ${typeof value}`))\n\t\treturn\n\t}\n\tif (isNullString(value)) return\n\n\tconst parts = value.trim().split(whitespaceRegex)\n\tconst kind = parts[0] as SupportedDSLTransitionType\n\n\ttry {\n\t\tassert(supportedTypes.includes(kind), `Unsupported transition type: ${kind}`)\n\n\t\tswitch (kind) {\n\t\t\tcase DSLTransitionType.springPhysics: {\n\t\t\t\tconst stiffness = tryParseNumber(parts[1])\n\t\t\t\tassert(isFiniteNumber(stiffness), `<${transitionStiffnessKey}> ${parts[1]} could not be parsed`)\n\t\t\t\tconst damping = tryParseNumber(parts[2])\n\t\t\t\tassert(isFiniteNumber(damping), `<${transitionDampingKey}> ${parts[2]} could not be parsed`)\n\t\t\t\tconst mass = tryParseNumber(parts[3])\n\t\t\t\tassert(isFiniteNumber(mass), `<${transitionMassKey}> ${parts[3]} could not be parsed`)\n\t\t\t\tconst delay = parseTime(parts[4])\n\t\t\t\tassert(isFiniteNumber(delay), `<${transitionDelayKey}> ${parts[4]} could not be parsed`)\n\n\t\t\t\treturn { type: \"spring\", stiffness, damping, mass, delay }\n\t\t\t}\n\t\t\tcase DSLTransitionType.springDuration: {\n\t\t\t\tconst duration = parseTime(parts[1])\n\t\t\t\tassert(isFiniteNumber(duration), `<${transitionDurationKey}> ${parts[1]} could not be parsed`)\n\t\t\t\tconst bounce = tryParseNumber(parts[2])\n\t\t\t\tassert(isFiniteNumber(bounce), `<${transitionBounceKey}> ${parts[2]} could not be parsed`)\n\t\t\t\tconst delay = parseTime(parts[3])\n\t\t\t\tassert(isFiniteNumber(delay), `<${transitionDelayKey}> ${parts[3]} could not be parsed`)\n\t\t\t\treturn { type: \"spring\", duration, bounce, delay, durationBasedSpring: true }\n\t\t\t}\n\t\t\tcase DSLTransitionType.tween: {\n\t\t\t\tconst ease = parseEase(parts[1])\n\t\t\t\tassert(ease, `<${transitionEaseKey}> ${parts[1]} could not be parsed`)\n\t\t\t\tconst duration = parseTime(parts[2])\n\t\t\t\tassert(isFiniteNumber(duration), `<${transitionDurationKey}> ${parts[2]} could not be parsed`)\n\t\t\t\tconst delay = parseTime(parts[3])\n\t\t\t\tassert(isFiniteNumber(delay), `<${transitionDelayKey}> ${parts[3]} could not be parsed`)\n\t\t\t\treturn { type: \"tween\", ease, duration, delay }\n\t\t\t}\n\t\t\tcase DSLTransitionType.inertia: {\n\t\t\t\tconst stiffness = tryParseNumber(parts[1])\n\t\t\t\tassert(isFiniteNumber(stiffness), `<${transitionStiffnessKey}> ${parts[1]} could not be parsed`)\n\t\t\t\tconst damping = tryParseNumber(parts[2])\n\t\t\t\tassert(isFiniteNumber(damping), `<${transitionDampingKey}> ${parts[2]} could not be parsed`)\n\t\t\t\treturn { type: \"inertia\", stiffness, damping }\n\t\t\t}\n\t\t\tcase DSLTransitionType.instant:\n\t\t\t\treturn { type: false }\n\t\t\tdefault:\n\t\t\t\tassertNever(kind, `Invalid transition type: ${String(kind)}`)\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof Error) {\n\t\t\tonError?.(error)\n\t\t\treturn\n\t\t}\n\t\tthrow error\n\t}\n}\n\n// --- Serialization ---\n\nfunction formatTime(seconds: number): string {\n\treturn createCSSDimension(toRoundedNumber(seconds), \"s\")\n}\n\nexport function vekterTransitionToDslTransitionString(transition: Transition | undefined): string | undefined {\n\tif (!transition) return undefined\n\n\tswitch (transition.type) {\n\t\tcase \"spring\":\n\t\t\tif (transition.durationBasedSpring) {\n\t\t\t\treturn `${DSLTransitionType.springDuration} ${formatTime(transition.duration)} ${toRoundedNumber(transition.bounce ?? 0)} ${formatTime(transition.delay)}`\n\t\t\t}\n\t\t\treturn `${DSLTransitionType.springPhysics} ${toRoundedNumber(transition.stiffness)} ${toRoundedNumber(transition.damping)} ${toRoundedNumber(transition.mass)} ${formatTime(transition.delay)}`\n\t\tcase \"tween\":\n\t\t\treturn `${DSLTransitionType.tween} ${transition.ease.map(value => toRoundedNumber(value)).join(\",\")} ${formatTime(transition.duration)} ${formatTime(transition.delay)}`\n\t\tcase \"inertia\":\n\t\t\treturn `${DSLTransitionType.inertia} ${toRoundedNumber(transition.stiffness)} ${toRoundedNumber(transition.damping)}`\n\t\tcase false:\n\t\t\treturn DSLTransitionType.instant\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\n// --- Shared helpers ---\n\nexport function transitionWithDefault(\n\tvalue: Partial<Transition>,\n\tfallback: Partial<Transition> | DynamicValue | undefined,\n\tdefaults?: Transition,\n) {\n\treturn toVekterTransition(\n\t\tgetUpdateWithFallback(\n\t\t\tvalue,\n\t\t\tisTransition(fallback) ? fallback : {},\n\t\t\tdefaults ?? defaultDurationBasedSpringTransition,\n\t\t),\n\t)\n}\n\n// --- Trait implementation ---\n\nfunction setNodeTransition(node: CanvasNode, value: Partial<Transition> | undefined) {\n\tif (withVariant(node) && node.isVariant) {\n\t\tnode.set({\n\t\t\tvariantTransition: transitionWithDefault(isUndefined(value) ? { type: false } : value, node.variantTransition),\n\t\t})\n\t\treturn\n\t}\n\tif (!withTransition(node)) return\n\tnode.set({ transition: isUndefined(value) ? undefined : transitionWithDefault(value, node.transition) })\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withTransition(node) && !withVariant(node)) {\n\t\treturn unsupportedAttributesWarnings(node, attributes, transitionDefinition, ctx)\n\t}\n\tconst { transition } = attributes\n\tif (!transition) return\n\n\tif (isNullString(transition)) {\n\t\tsetNodeTransition(node, undefined)\n\t\treturn\n\t}\n\n\tconst warnings: ReturnType<typeof singleWarning>[] = []\n\tconst update = parseDSLTransitionString(transition, variantTransitionSupportedTypes, error => {\n\t\twarnings.push(singleWarning(\"transition\", transition, error.message))\n\t})\n\tif (!update) return warnings.length > 0 ? warnings : undefined\n\n\tsetNodeTransition(node, update)\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tconst value = hasVariantTransition(node) ? node.variantTransition : hasTransition(node) ? node.transition : undefined\n\n\tif (!isTransition(value)) return\n\n\tassert(value.type !== \"inertia\", \"Inertia transitions are not supported on nodes - only in effects.\")\n\n\treturn { transition: vekterTransitionToDslTransitionString(value) }\n}\n\nconst transitionDefinition = { transition: variantTransitionDefinition }\n\nexport const transition = {\n\tfor: withTransition,\n\tdefinition: transitionDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ transition: string }>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithStyleAppearEffect,\n\thasStyleAppearEffect,\n\tisSupportedTrigger,\n\tstyleAppearEffectEnabledDefaults,\n\twithStyleAppearPageEffect,\n} from \"document/models/CanvasTree/traits/WithStyleAppearEffect.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport { EffectType, effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isBoolean, isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { booleanString } from \"../schemaUtils.ts\"\nimport { isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { breakpointUnsupportedMessage, singleWarning } from \"./invalidValues.ts\"\nimport {\n\teffectTransitionDefinition,\n\teffectTransitionSupportedTypes,\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitToAttributesOutput,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\nfunction parseStagger(value: string): number | undefined {\n\tconst [numberValue, unit] = parseCSSDimension(value, \"s\")\n\tif (Number.isNaN(numberValue)) return\n\tif (unit === \"s\") return numberValue\n\tif (unit === \"ms\") return numberValue / 1000\n}\n\nconst dslEnterExitEffectSchema = z.object({\n\topacity: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\tx: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\ty: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\tscale: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\trotate: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\trotateX: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\trotateY: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\tskewX: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\tskewY: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\ttransition: z.string().optional().catch(undefined),\n\tstagger: z.string().optional().catch(undefined),\n})\n\ntype ParsedDSLEnterExitEffect = z.output<typeof dslEnterExitEffectSchema>\ntype DSLEnterExitEffect = TraitToAttributesOutput<ParsedDSLEnterExitEffect>\n\nconst enterExitEffectDefinition: TraitAttributeDefinition<DSLEnterExitEffect> = {\n\topacity: {\n\t\tdescription: \"number\",\n\t\texamples: [\"0.0\", \"0.5\", \"1.0\"],\n\t\toptional: true,\n\t},\n\tx: {\n\t\tdescription: \"number\",\n\t\texamples: [\"-10\", \"10\", \"25\"],\n\t\toptional: true,\n\t},\n\ty: {\n\t\tdescription: \"number\",\n\t\texamples: [\"-10\", \"10\", \"25\"],\n\t\toptional: true,\n\t},\n\tscale: {\n\t\tdescription: \"number\",\n\t\texamples: [\"0.5\", \"1.2\", \"2.0\"],\n\t\toptional: true,\n\t},\n\trotate: {\n\t\tdescription: \"number\",\n\t\texamples: [\"-90\", \"30\", \"90\", \"360\"],\n\t\toptional: true,\n\t},\n\trotateX: {\n\t\tdescription: \"number\",\n\t\texamples: [\"-90\", \"30\", \"90\", \"360\"],\n\t\toptional: true,\n\t},\n\trotateY: {\n\t\tdescription: \"number\",\n\t\texamples: [\"-90\", \"30\", \"90\", \"360\"],\n\t\toptional: true,\n\t},\n\tskewX: {\n\t\tdescription: \"number\",\n\t\texamples: [\"-10\", \"5\", \"25\"],\n\t\toptional: true,\n\t},\n\tskewY: {\n\t\tdescription: \"number\",\n\t\texamples: [\"-10\", \"5\", \"25\"],\n\t\toptional: true,\n\t},\n\ttransition: effectTransitionDefinition,\n\tstagger: {\n\t\tdescription: \"${number}s\",\n\t\toptional: true,\n\t},\n}\n\n// AGENT @TODO: support more props\nconst triggers: EffectTrigger[] = [\n\tEffectTrigger.OnInView,\n\tEffectTrigger.OnMount,\n\tEffectTrigger.OnScrollTarget,\n\tEffectTrigger.OnScrollDirection,\n]\nconst dslAppearEffectSchema = z.object({\n\ttrigger: z.enum(triggers).optional().catch(undefined),\n\tthreshold: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tenter: dslEnterExitEffectSchema.optional().catch(undefined),\n\treplay: booleanString.optional().catch(undefined),\n})\n\ntype ParsedDSLAppearEffect = z.output<typeof dslAppearEffectSchema>\ntype RoundedParsedDSLAppearEffect = TraitToAttributesOutput<ParsedDSLAppearEffect>\ntype DSLAppearEffect = Omit<RoundedParsedDSLAppearEffect, \"enter\"> & {\n\tenter?: DSLEnterExitEffect\n}\n\nconst definition: TraitAttributeDefinition<{ appearEffect: DSLAppearEffect }> = {\n\tappearEffect: {\n\t\ttrigger: {\n\t\t\tdescription: triggers.join(\" | \"),\n\t\t\toptional: true,\n\t\t},\n\t\tthreshold: {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\"0.0\", \"0.5\", \"1.0\"],\n\t\t\toptional: true,\n\t\t},\n\t\tenter: enterExitEffectDefinition,\n\t\treplay: {\n\t\t\tdescription: \"boolean\",\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withStyleAppearPageEffect(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst { appearEffect } = attributes\n\n\tif (isBreakpointVariant(node) && !isUndefined(appearEffect)) {\n\t\treturn [{ applied: false, key: \"appearEffect\", message: breakpointUnsupportedMessage(\"appear effects\") }]\n\t}\n\n\tif (isNullString(appearEffect)) {\n\t\tnode.set({ styleAppearEffectEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslAppearEffectSchema.safeParse(appearEffect)\n\tif (!parsed.success) return\n\n\tconst { trigger, threshold, enter, replay } = parsed.data\n\tconst update: Partial<WithStyleAppearEffect> = {}\n\tconst warnings: TraitWarning[] = []\n\n\tif (isSupportedTrigger(trigger)) {\n\t\tupdate.styleAppearEffectTrigger = trigger\n\t}\n\n\tif (isNumber(threshold)) {\n\t\tupdate.styleAppearEffectThreshold = threshold\n\t}\n\n\t// AGENT @TODO: support disabling enter effect\n\tif (enter) {\n\t\tif (isNumber(enter.opacity)) {\n\t\t\tupdate.enterEffectOpacity = enter.opacity\n\t\t}\n\n\t\tif (isNumber(enter.x)) {\n\t\t\tupdate.enterEffectX = enter.x\n\t\t}\n\n\t\tif (isNumber(enter.y)) {\n\t\t\tupdate.enterEffectY = enter.y\n\t\t}\n\n\t\tif (isNumber(enter.scale)) {\n\t\t\tupdate.enterEffectScale = enter.scale\n\t\t}\n\n\t\tif (isNumber(enter.rotate)) {\n\t\t\tupdate.enterEffectRotate = enter.rotate\n\t\t}\n\n\t\t// AGENT @TODO: consider introducing a rotate3d boolean, otherwise it's hard to determine if\n\t\t// we need to switch it on/off base on the rotate values in the DSL commands.\n\t\tif (isNumber(enter.rotateX) && enter.rotateX) {\n\t\t\tupdate.enterEffectRotate3d = true\n\t\t\tupdate.enterEffectRotateX = enter.rotateX\n\t\t}\n\n\t\tif (isNumber(enter.rotateY) && enter.rotateY) {\n\t\t\tupdate.enterEffectRotate3d = true\n\t\t\tupdate.enterEffectRotateY = enter.rotateY\n\t\t}\n\n\t\tif (isNumber(enter.skewX)) {\n\t\t\tupdate.enterEffectSkewX = enter.skewX\n\t\t}\n\n\t\tif (isNumber(enter.skewY)) {\n\t\t\tupdate.enterEffectSkewY = enter.skewY\n\t\t}\n\n\t\tconst stagger = enter.stagger ? parseStagger(enter.stagger) : undefined\n\t\tconst parsedTransition = parseDSLTransitionString(enter.transition, effectTransitionSupportedTypes, error => {\n\t\t\twarnings.push(singleWarning(\"appearEffect.enter.transition\", enter.transition, error.message))\n\t\t})\n\n\t\tif (parsedTransition) {\n\t\t\tif (isNumber(stagger)) {\n\t\t\t\tparsedTransition.stagger = stagger\n\t\t\t}\n\t\t\tupdate.enterEffectTransition = transitionWithDefault(\n\t\t\t\tparsedTransition,\n\t\t\t\tnode.enterEffectTransition,\n\t\t\t\teffectConfig[EffectType.Appear].enabledDefaults.enterEffectTransition,\n\t\t\t)\n\t\t} else if (isNumber(stagger)) {\n\t\t\tupdate.enterEffectTransition = transitionWithDefault(\n\t\t\t\t{ stagger },\n\t\t\t\tnode.enterEffectTransition,\n\t\t\t\teffectConfig[EffectType.Appear].enabledDefaults.enterEffectTransition,\n\t\t\t)\n\t\t}\n\t}\n\n\t// Handle replay last so the effective trigger is known.\n\t// The value is always applied, but replay only has an observable effect when the\n\t// trigger replays the animation (e.g. OnInView, OnScrollTarget, OnScrollDirection).\n\t// On OnMount the animation runs once on mount regardless, so we warn that the\n\t// applied value has no effect.\n\tif (isBoolean(replay)) {\n\t\tupdate.styleAppearEffectAnimateOnce = !replay\n\t\tconst effectiveTrigger =\n\t\t\tupdate.styleAppearEffectTrigger ??\n\t\t\tnode.styleAppearEffectTrigger ??\n\t\t\tstyleAppearEffectEnabledDefaults.styleAppearEffectTrigger\n\t\tif (effectiveTrigger === EffectTrigger.OnMount) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: true,\n\t\t\t\tkey: \"appearEffect.replay\",\n\t\t\t\tmessage: `replay has no effect when trigger is \"${EffectTrigger.OnMount}\" (the animation only runs once on mount).`,\n\t\t\t})\n\t\t}\n\t}\n\n\tif (isEmptyObject(update)) return warnings.length > 0 ? warnings : undefined\n\n\tupdateWithFallback(update, node, styleAppearEffectEnabledDefaults)\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!hasStyleAppearEffect(node)) return undefined\n\n\t// Replay is only meaningful when the trigger replays the animation; the UI hides\n\t// the Replay row when the trigger is OnMount, so omit it here for consistency.\n\tconst effectiveTrigger = node.styleAppearEffectTrigger ?? styleAppearEffectEnabledDefaults.styleAppearEffectTrigger\n\tconst replay =\n\t\tisBoolean(node.styleAppearEffectAnimateOnce) && effectiveTrigger !== EffectTrigger.OnMount\n\t\t\t? !node.styleAppearEffectAnimateOnce\n\t\t\t: undefined\n\tconst nodeAppearEffect: Partial<DSLAppearEffect> = {\n\t\tthreshold: isNumber(node.styleAppearEffectThreshold) ? toRoundedNumber(node.styleAppearEffectThreshold) : undefined,\n\t\ttrigger: node.styleAppearEffectTrigger,\n\t\treplay,\n\t}\n\n\tif (node.enterEffectEnabled) {\n\t\tconst enterEffect: Partial<DSLEnterExitEffect> = {\n\t\t\topacity: isNumber(node.enterEffectOpacity) ? toRoundedNumber(node.enterEffectOpacity) : undefined,\n\t\t\tx: isNumber(node.enterEffectX) ? toRoundedNumber(node.enterEffectX) : undefined,\n\t\t\ty: isNumber(node.enterEffectY) ? toRoundedNumber(node.enterEffectY) : undefined,\n\t\t\tscale: isNumber(node.enterEffectScale) ? toRoundedNumber(node.enterEffectScale) : undefined,\n\t\t\trotate: isNumber(node.enterEffectRotate) ? toRoundedNumber(node.enterEffectRotate) : undefined,\n\t\t\trotateX: isNumber(node.enterEffectRotateX) ? toRoundedNumber(node.enterEffectRotateX) : undefined,\n\t\t\trotateY: isNumber(node.enterEffectRotateY) ? toRoundedNumber(node.enterEffectRotateY) : undefined,\n\t\t\tskewX: isNumber(node.enterEffectSkewX) ? toRoundedNumber(node.enterEffectSkewX) : undefined,\n\t\t\tskewY: isNumber(node.enterEffectSkewY) ? toRoundedNumber(node.enterEffectSkewY) : undefined,\n\t\t\ttransition: vekterTransitionToDslTransitionString(node.enterEffectTransition),\n\t\t\tstagger: isNumber(node.enterEffectTransition?.stagger)\n\t\t\t\t? createCSSDimension(node.enterEffectTransition.stagger, \"s\")\n\t\t\t\t: undefined,\n\t\t}\n\n\t\tnodeAppearEffect.enter = enterEffect\n\t}\n\n\treturn { appearEffect: nodeAppearEffect }\n}\n\nexport const appearEffect = {\n\tfor: withStyleAppearPageEffect,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ appearEffect: DSLAppearEffect }>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { WithAspectRatio } from \"document/models/CanvasTree/traits/WithAspectRatio.ts\"\nimport { withAspectRatio } from \"document/models/CanvasTree/traits/WithAspectRatio.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { toRoundedNumber, type DSLAttributes, type TraitAttributeDefinition, type TraitDefinition } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithAspectRatio> = {\n\taspectRatio: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withAspectRatio(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tif (isString(attributes.aspectRatio)) {\n\t\tnode.set({ aspectRatio: tryParseNumber(attributes.aspectRatio) })\n\t}\n}\n\nexport const aspectRatio = {\n\tfor: withAspectRatio,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes: node => {\n\t\tif (!withAspectRatio(node)) return\n\t\t// Aspect Ratio is `null` when unset but that is not relevant to the LLM context.\n\t\treturn { aspectRatio: isNumber(node.aspectRatio) ? toRoundedNumber(node.aspectRatio) : undefined }\n\t},\n} satisfies TraitDefinition<WithAspectRatio>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { type WithBackdrop, withBackdrop } from \"document/models/CanvasTree/traits/WithBackdrop.ts\"\nimport { isBoolean, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { booleanString } from \"../schemaUtils.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { expectedBooleanValue, singleWarning, warning } from \"./invalidValues.ts\"\nimport { colorDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst backdropFillSchema = z.string().optional()\n\nconst backdropBooleanSchema = booleanString.optional()\n\nconst dslBackdropSchema = z.object({\n\tfill: backdropFillSchema,\n\tdismissible: backdropBooleanSchema,\n\tblockScroll: backdropBooleanSchema,\n})\n\ntype DSLBackdrop = z.output<typeof dslBackdropSchema>\n\nconst definition: TraitAttributeDefinition<{ backdrop: DSLBackdrop }> = {\n\tbackdrop: {\n\t\tfill: {\n\t\t\tdescription: `${colorDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t\tdismissible: {\n\t\t\tdescription: \"boolean\",\n\t\t\toptional: true,\n\t\t},\n\t\tblockScroll: {\n\t\t\tdescription: \"boolean\",\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withBackdrop(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tif (isUndefined(attributes.backdrop)) return\n\tif (!isObject(attributes.backdrop)) {\n\t\treturn warning(\"backdrop\", attributes.backdrop, \"valid backdrop attributes\")\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\tconst updates: Partial<WithBackdrop> = {}\n\tconst { fill, dismissible, blockScroll } = attributes.backdrop\n\n\tconst parsedFill = backdropFillSchema.safeParse(fill)\n\n\tif (parsedFill.success && isString(parsedFill.data)) {\n\t\tif (isNullString(parsedFill.data)) {\n\t\t\tupdates.backdropFillEnabled = false\n\t\t} else {\n\t\t\tupdates.backdropFill = ctx.tokens.resolve(parsedFill.data)?.toCSS() ?? parsedFill.data\n\t\t\tupdates.backdropFillEnabled = true\n\t\t}\n\t} else if (!isUndefined(fill)) {\n\t\twarnings.push(singleWarning(\"backdrop.fill\", fill, \"a color value\"))\n\t}\n\n\tconst parsedDismissible = backdropBooleanSchema.safeParse(dismissible)\n\tif (parsedDismissible.success && isBoolean(parsedDismissible.data)) {\n\t\tupdates.backdropDismissible = parsedDismissible.data\n\t} else if (!isUndefined(dismissible)) {\n\t\twarnings.push(singleWarning(\"backdrop.dismissible\", dismissible, expectedBooleanValue))\n\t}\n\n\tconst parsedBlockScroll = backdropBooleanSchema.safeParse(blockScroll)\n\tif (parsedBlockScroll.success && isBoolean(parsedBlockScroll.data)) {\n\t\tupdates.blockDocumentScrolling = parsedBlockScroll.data\n\t} else if (!isUndefined(blockScroll)) {\n\t\twarnings.push(singleWarning(\"backdrop.blockScroll\", blockScroll, expectedBooleanValue))\n\t}\n\n\tif (Object.keys(updates).length > 0) {\n\t\tnode.set(updates)\n\t}\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withBackdrop(node)) return\n\n\tconst backdrop: DSLAttributes = {}\n\n\tif (node.backdropFillEnabled) {\n\t\tif (isString(node.backdropFill)) {\n\t\t\tbackdrop.fill = ctx.tokens.resolve(node.backdropFill)?.toCSS() ?? node.backdropFill\n\t\t} else {\n\t\t\tconst backdropFill = ctx.dynamicValues.resolveAttributeFromDynamicValue(node.backdropFill, node)\n\n\t\t\tif (backdropFill) {\n\t\t\t\tbackdrop.fill = backdropFill\n\t\t\t}\n\t\t}\n\t}\n\n\tif (isBoolean(node.backdropDismissible)) {\n\t\tbackdrop.dismissible = node.backdropDismissible\n\t} else {\n\t\tconst dismissible = ctx.dynamicValues.resolveAttributeFromDynamicValue(node.backdropDismissible, node)\n\t\tif (dismissible) {\n\t\t\tbackdrop.dismissible = dismissible\n\t\t}\n\t}\n\n\tif (!isUndefined(node.blockDocumentScrolling) && node.blockDocumentScrolling) {\n\t\tbackdrop.blockScroll = node.blockDocumentScrolling\n\t}\n\n\tif (Object.keys(backdrop).length === 0) return\n\n\treturn { backdrop }\n}\n\nexport const backdrop = {\n\tfor: withBackdrop,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ backdrop: DSLBackdrop }>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\ttype WithBlending,\n\tblendingModeValues,\n\tisBlendingModeValue,\n\twithBlending,\n} from \"document/models/CanvasTree/traits/WithBlending.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { traitNotAppliedWarning, warning } from \"./invalidValues.ts\"\nimport { variableDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithBlending> = {\n\tblendingMode: {\n\t\tdescription: `${blendingModeValues.join(\" | \")} | ${nullString} | ${variableDescription}`,\n\t\toptional: true,\n\t},\n}\n\nconst expectedBlendingModeValues = [...blendingModeValues.map(value => `\"${value}\"`), `\"${nullString}\"`].join(\", \")\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withBlending(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst { blendingMode } = attributes\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(blendingMode, { node })\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tnode.set({ blendingMode: resolveHandleResult.handle.reference(node) })\n\t\treturn\n\t}\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\treturn resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"blendingMode\", message))\n\t}\n\n\tif (isNullString(blendingMode)) {\n\t\tnode.set({ blendingMode: undefined })\n\t\treturn\n\t}\n\n\tif (isBlendingModeValue(blendingMode)) {\n\t\tnode.set({ blendingMode })\n\t\treturn\n\t}\n\n\tif (!isUndefined(blendingMode)) {\n\t\treturn warning(\"blendingMode\", blendingMode, expectedBlendingModeValues)\n\t}\n}\n\nfunction toAttributes(node: CanvasNode, _parent: unknown, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withBlending(node)) return\n\n\tif (isDynamicValue(node.blendingMode)) {\n\t\tconst blendingModeAttribute = ctx.dynamicValues.resolveAttributeFromDynamicValue(node.blendingMode, node)\n\t\tif (blendingModeAttribute) return { blendingMode: blendingModeAttribute }\n\t}\n\n\tconst blendingMode = node.resolveValue(\"blendingMode\")\n\tif (!isBlendingModeValue(blendingMode) || blendingMode === \"normal\") return\n\n\treturn { blendingMode }\n}\n\nexport const blendingMode = {\n\tfor: withBlending,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<WithBlending>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isBlockquoteStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tgetFourPixelNumberFromShorthand,\n\tgetFourPixelNumberShorthand,\n\tisPixelNumberShorthand,\n\tnormalizeFourPixelNumberShorthand,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport { lineStyleDefaults, withLine, type WithLine } from \"document/models/CanvasTree/traits/WithLine.ts\"\nimport { parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isRelativeNumber } from \"library/render/types/RelativeNumber.ts\"\nimport { isBooleanString, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport { expectedAttributeMessage, unsupportedAttributeMessage, warning } from \"./invalidValues.ts\"\nimport { colorDescription, percentageDescription, pixelShorthandDescription } from \"./traitDescriptions.ts\"\nimport {\n\tnodeToDSLType,\n\ttype DSLAttributes,\n\ttype DSLAttributeValue,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\ninterface BlockquoteLineAttributes {\n\tlineEnabled?: boolean\n\tlineColor?: string\n\tlineWidth?: number | string\n\tlineRadius?: string\n}\n\ninterface BlockquoteAttributes {\n\tblockquote: BlockquoteLineAttributes\n}\n\nconst lineEnabledDescription = `boolean | ${nullString}`\nconst lineColorDescription = `${colorDescription} | ${nullString}`\nconst lineWidthDescription = `number | \\${number}px | ${nullString}`\nconst lineRadiusDescription = `${pixelShorthandDescription} | ${percentageDescription} | ${nullString}`\n\nconst definition = {\n\tblockquote: {\n\t\tlineEnabled: {\n\t\t\tdescription: lineEnabledDescription,\n\t\t\toptional: true,\n\t\t},\n\t\tlineColor: {\n\t\t\tdescription: lineColorDescription,\n\t\t\toptional: true,\n\t\t},\n\t\tlineWidth: {\n\t\t\tdescription: lineWidthDescription,\n\t\t\texamples: [\"2px\", \"4px\"],\n\t\t\toptional: true,\n\t\t},\n\t\tlineRadius: {\n\t\t\tdescription: lineRadiusDescription,\n\t\t\texamples: [\"1px\", \"2px\"],\n\t\t\toptional: true,\n\t\t},\n\t},\n} satisfies TraitAttributeDefinition<BlockquoteAttributes>\n\nconst lineAttributeKeys = Object.keys(definition.blockquote)\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tconst { blockquote } = attributes\n\n\tif (isUndefined(blockquote)) return\n\tif (!isObject(blockquote)) return warning(\"blockquote\", blockquote, \"valid blockquote attributes\")\n\n\tif (!isBlockquoteStylePresetNode(node)) {\n\t\tconst warnings: TraitWarning[] = []\n\t\tfor (const key of lineAttributeKeys) {\n\t\t\tif (isUndefined(blockquote[key])) continue\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: `blockquote.${key}`,\n\t\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t\t})\n\t\t}\n\t\treturn warnings\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\tapplyLineEnabled(node, blockquote.lineEnabled, warnings)\n\tapplyLineColor(node, blockquote.lineColor, ctx, warnings)\n\tapplyLineWidth(node, blockquote.lineWidth, warnings)\n\tapplyLineRadius(node, blockquote.lineRadius, warnings)\n\n\treturn warnings\n}\n\nfunction applyLineEnabled(node: CanvasNode & WithLine, value: DSLAttributeValue | undefined, warnings: TraitWarning[]) {\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\tnode.set({ lineEnabled: lineStyleDefaults.lineEnabled })\n\t\treturn\n\t}\n\n\tif (isBooleanString(value)) {\n\t\tnode.set({ lineEnabled: value === \"true\" })\n\t\treturn\n\t}\n\n\twarnings.push({\n\t\tapplied: false,\n\t\tkey: \"blockquote.lineEnabled\",\n\t\tmessage: expectedAttributeMessage(value, lineEnabledDescription),\n\t})\n}\n\nfunction applyLineColor(\n\tnode: CanvasNode & WithLine,\n\tvalue: DSLAttributeValue | undefined,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) {\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\tnode.set({ lineColor: lineStyleDefaults.lineColor })\n\t\treturn\n\t}\n\n\tif (!isString(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"blockquote.lineColor\",\n\t\t\tmessage: expectedAttributeMessage(value, lineColorDescription),\n\t\t})\n\t\treturn\n\t}\n\n\tnode.set({ lineColor: ctx.tokens.resolve(value)?.toCSS() ?? value })\n}\n\nfunction applyLineWidth(node: CanvasNode & WithLine, value: DSLAttributeValue | undefined, warnings: TraitWarning[]) {\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\tnode.set({ lineWidth: lineStyleDefaults.lineWidth })\n\t\treturn\n\t}\n\n\tif (isString(value)) {\n\t\tconst [parsed, unit] = parseCSSDimension(value, \"px\")\n\t\tif (!Number.isNaN(parsed) && (isUndefined(unit) || unit === \"px\")) {\n\t\t\tnode.set({ lineWidth: parsed })\n\t\t\treturn\n\t\t}\n\t}\n\n\twarnings.push({\n\t\tapplied: false,\n\t\tkey: \"blockquote.lineWidth\",\n\t\tmessage: expectedAttributeMessage(value, lineWidthDescription),\n\t})\n}\n\nfunction applyLineRadius(node: CanvasNode & WithLine, value: DSLAttributeValue | undefined, warnings: TraitWarning[]) {\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\tnode.set({ lineRadius: lineStyleDefaults.lineRadius })\n\t\treturn\n\t}\n\n\tif (isRelativeNumber(value)) {\n\t\tnode.set({ lineRadius: value })\n\t\treturn\n\t}\n\n\tif (isPixelNumberShorthand(value)) {\n\t\tconst normalized = getFourPixelNumberShorthand(\n\t\t\tnormalizeFourPixelNumberShorthand(getFourPixelNumberFromShorthand(value)),\n\t\t)\n\t\tnode.set({ lineRadius: normalized })\n\t\treturn\n\t}\n\n\twarnings.push({\n\t\tapplied: false,\n\t\tkey: \"blockquote.lineRadius\",\n\t\tmessage: expectedAttributeMessage(value, lineRadiusDescription),\n\t})\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withLine(node)) return\n\n\tconst blockquote: DSLAttributes = {}\n\tif (node.lineEnabled !== lineStyleDefaults.lineEnabled) {\n\t\tblockquote.lineEnabled = node.lineEnabled\n\t}\n\tif (isString(node.lineColor) && node.lineColor !== lineStyleDefaults.lineColor) {\n\t\tblockquote.lineColor = ctx.tokens.resolve(node.lineColor)?.toCSS() ?? node.lineColor\n\t}\n\tif (isNumber(node.lineWidth) && node.lineWidth !== lineStyleDefaults.lineWidth) {\n\t\tblockquote.lineWidth = `${node.lineWidth}px`\n\t}\n\tif (isString(node.lineRadius) && node.lineRadius !== lineStyleDefaults.lineRadius) {\n\t\tblockquote.lineRadius = node.lineRadius\n\t}\n\n\tif (Object.keys(blockquote).length === 0) return\n\treturn { blockquote }\n}\n\nexport const blockquote = {\n\tfor: isBlockquoteStylePresetNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<BlockquoteAttributes>\n", "import { escapeValue } from \"app/ai/agents/prompt/utils.ts\"\nimport type { CanvasNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { BlockquoteStylePresetNode } from \"document/models/CanvasTree/nodes/BlockquoteStylePresetNode.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isBlockquoteStylePresetNode, isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { StylePresetType } from \"../context/stylePresetType.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\texpectedStylePresetTypeMessage,\n\tinvalidAttributeMessage,\n\tsingleWarning,\n\tunsupportedAttributeMessage,\n} from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\nimport { nodeToDSLType } from \"./types.ts\"\n\ninterface BlockquoteStylePresetAttributes {\n\tblockquoteStylePreset: string\n}\n\nconst definition: TraitAttributeDefinition<BlockquoteStylePresetAttributes> = {\n\tblockquoteStylePreset: {\n\t\tdescription: `The name or id of a ${ClassDiscriminator.BlockquoteStylePresetNode} | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] {\n\tconst presetNameOrId = attributes.blockquoteStylePreset\n\tif (!isString(presetNameOrId)) return []\n\tif (isRichTextNode(node)) return fromAttributesToRichTextNode(node, presetNameOrId, ctx)\n\treturn [\n\t\t{\n\t\t\tapplied: false,\n\t\t\tkey: \"blockquoteStylePreset\",\n\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t},\n\t]\n}\n\nfunction fromAttributesToRichTextNode(node: RichTextNode, presetNameOrId: string, ctx: AgentContext): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\n\tif (isNullString(presetNameOrId)) {\n\t\tnode.set({ stylePresetBlockquote: undefined })\n\t\treturn warnings\n\t}\n\n\tconst presetNode = resolveBlockquoteStylePreset(presetNameOrId, ctx, warnings)\n\tif (!presetNode) return warnings\n\n\tnode.setNodeBlockquoteStylePreset(presetNode)\n\treturn warnings\n}\n\nfunction resolveBlockquoteStylePreset(\n\tpresetNameOrId: string,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n): BlockquoteStylePresetNode | undefined {\n\tconst preset = ctx.stylePresets.forNameOrId(presetNameOrId, StylePresetType.Blockquote)\n\tif (!preset) {\n\t\tthrow new DeferTraitError(\n\t\t\t`${escapeValue(ClassDiscriminator.BlockquoteStylePresetNode)} with name or id \"${presetNameOrId}\" not found`,\n\t\t)\n\t}\n\n\tif (preset.type !== StylePresetType.Blockquote) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\n\t\t\t\t\"blockquoteStylePreset\",\n\t\t\t\tpresetNameOrId,\n\t\t\t\texpectedStylePresetTypeMessage(preset.type, StylePresetType.Blockquote),\n\t\t\t),\n\t\t)\n\t\treturn\n\t}\n\n\tconst presetNode = ctx.treeStore.tree.getNodeWithTrait(preset.id, isBlockquoteStylePresetNode)\n\tif (!presetNode) {\n\t\twarnings.push({\n\t\t\tkey: \"blockquoteStylePreset\",\n\t\t\tapplied: false,\n\t\t\tmessage: invalidAttributeMessage(presetNameOrId, \"Blockquote style preset not found in document\"),\n\t\t})\n\t\treturn\n\t}\n\n\treturn presetNode\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isRichTextNode(node)) return\n\treturn presetIdToAttributes(node.getNodeBlockquoteStylePreset(ctx.treeStore.tree)?.id, ctx)\n}\n\nfunction presetIdToAttributes(presetId: string | undefined, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!presetId) return\n\tconst presetName = ctx.stylePresets.forId(presetId)?.name\n\tif (!presetName) return\n\treturn { blockquoteStylePreset: presetName }\n}\n\nexport const blockquoteStylePreset = {\n\tfor: isRichTextNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<BlockquoteStylePresetAttributes, []>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { WithBorder } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport { withBorder } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport { createCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\tborderSideKeys,\n\tfromAttributesToBorderProps,\n\tisNullString,\n\tnullString,\n\tunsupportedAttributesWarnings,\n} from \"./helpers.ts\"\nimport { traitNotAppliedWarning } from \"./invalidValues.ts\"\nimport { colorDescription, dynamicValueDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst borderShorthand = \"border\" as const\nconst customShorthands = [borderShorthand] as const satisfies string[]\n\ntype BorderAttributeDefinition = Omit<WithBorder, \"borderEnabled\" | \"borderPerSide\">\n\nconst borderSideDescription = `number | \\${number}px | \\${number}px \\${solid | dashed | dotted | double} \\${${colorDescription}}`\n\nconst definition: TraitAttributeDefinition<BorderAttributeDefinition, typeof customShorthands> = {\n\tborderColor: {\n\t\tdescription: colorDescription,\n\t\toptional: true,\n\t},\n\tborderWidth: {\n\t\tdescription: \"number | ${number}px\",\n\t\toptional: true,\n\t},\n\tborderStyle: {\n\t\tdescription: \"solid | dashed | dotted | double\",\n\t\toptional: true,\n\t},\n\tborder: {\n\t\tdescription: `${nullString} | \\${number} \\${solid | dashed | dotted | double} \\${${colorDescription}} | ${dynamicValueDescription(\"border\")}`,\n\t\texamples: [\"10px solid red\", \"20px dashed var(--token-border-color)\", \"var(--variable-border)\"],\n\t\toptional: true,\n\t},\n\tborderTop: {\n\t\tdescription: borderSideDescription,\n\t\toptional: true,\n\t},\n\tborderRight: {\n\t\tdescription: borderSideDescription,\n\t\toptional: true,\n\t},\n\tborderBottom: {\n\t\tdescription: borderSideDescription,\n\t\toptional: true,\n\t},\n\tborderLeft: {\n\t\tdescription: borderSideDescription,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withBorder(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst warnings: TraitWarning[] = []\n\n\tif (borderShorthand in attributes) {\n\t\tif (isNullString(attributes.border)) {\n\t\t\tnode.set({ borderEnabled: false })\n\t\t\treturn\n\t\t}\n\n\t\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.border, { node })\n\n\t\tif (resolveHandleResult.type === \"resolved\") {\n\t\t\tnode.set({ borderEnabled: resolveHandleResult.handle.reference(node) })\n\t\t\treturn\n\t\t}\n\n\t\tif (resolveHandleResult.type === \"invalid\") {\n\t\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"border\", message)))\n\t\t}\n\t}\n\n\tconst borderProps = fromAttributesToBorderProps(undefined, node, attributes, ctx, warnings)\n\n\tif (borderProps.borderPerSide) {\n\t\tfor (const side of borderSideKeys) {\n\t\t\tif (borderProps[side] === undefined) {\n\t\t\t\tborderProps[side] = node.borderPerSide && isNumber(node[side]) ? node[side] : 0\n\t\t\t}\n\t\t}\n\t}\n\n\tnode.set(borderProps)\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withBorder(node)) return\n\tif (!node.borderEnabled) return\n\n\tif (isDynamicValue(node.borderEnabled)) {\n\t\treturn {\n\t\t\tborder: ctx.dynamicValues.resolveAttributeFromDynamicValue(node.borderEnabled, node),\n\t\t}\n\t}\n\n\tconst result: DSLAttributes = {}\n\tconst borderStyle = node.borderStyle\n\tconst borderColor = node.borderColor\n\tconst resolvedBorderColor = isString(borderColor)\n\t\t? (ctx.tokens.resolve(borderColor)?.toCSS() ?? borderColor)\n\t\t: borderColor\n\n\tif (node.borderPerSide === true) {\n\t\tif (isString(borderStyle)) result.borderStyle = borderStyle\n\t\tif (isString(resolvedBorderColor)) result.borderColor = resolvedBorderColor\n\t\tif (isNumber(node.borderTop) && node.borderTop > 0) {\n\t\t\tresult.borderTop = createCSSDimension(node.borderTop, \"px\")\n\t\t}\n\t\tif (isNumber(node.borderRight) && node.borderRight > 0) {\n\t\t\tresult.borderRight = createCSSDimension(node.borderRight, \"px\")\n\t\t}\n\t\tif (isNumber(node.borderBottom) && node.borderBottom > 0) {\n\t\t\tresult.borderBottom = createCSSDimension(node.borderBottom, \"px\")\n\t\t}\n\t\tif (isNumber(node.borderLeft) && node.borderLeft > 0) {\n\t\t\tresult.borderLeft = createCSSDimension(node.borderLeft, \"px\")\n\t\t}\n\t} else {\n\t\tconst borderWidth = isNumber(node.borderWidth) ? createCSSDimension(node.borderWidth, \"px\") : node.borderWidth\n\t\tconst parts = [borderWidth, borderStyle, resolvedBorderColor].filter(isString)\n\t\tif (parts.length > 0) {\n\t\t\tresult.border = parts.join(\" \")\n\t\t}\n\t}\n\n\treturn result\n}\n\nexport const border = {\n\tfor: withBorder,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<BorderAttributeDefinition, typeof customShorthands>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { supportsBoxShadow } from \"document/models/CanvasTree/traits/WithBoxShadow.ts\"\nimport { isBoxShadowList } from \"document/models/Shadow.ts\"\nimport { singleBoxShadowToCSS } from \"utils/boxShadowToCSS.ts\"\nimport { isArray, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { collectBoxShadows, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { traitNotAppliedWarning } from \"./invalidValues.ts\"\nimport { boxShadowDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\ninterface BoxShadowTrait {\n\tboxShadows: string[]\n}\n\nconst definition: TraitAttributeDefinition<BoxShadowTrait> = {\n\tboxShadows: [\n\t\t{\n\t\t\tdescription: `${boxShadowDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t],\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!supportsBoxShadow(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst boxShadowsAttr = attributes.boxShadows\n\tconst resolveHandleResult =\n\t\tisArray(boxShadowsAttr) && boxShadowsAttr.length === 1 && isString(boxShadowsAttr[0])\n\t\t\t? ctx.dynamicValues.resolveHandleFromAttribute(boxShadowsAttr[0], { node })\n\t\t\t: undefined\n\tif (resolveHandleResult?.type === \"resolved\") {\n\t\tnode.set({ boxShadows: resolveHandleResult.handle.reference(node) })\n\t\treturn\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\n\tif (resolveHandleResult?.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"boxShadows\", message)))\n\t}\n\n\tcollectBoxShadows(node, \"boxShadows\", attributes)\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!supportsBoxShadow(node)) return\n\n\tconst boxShadows = node.boxShadows\n\n\tif (isBoxShadowList(boxShadows)) {\n\t\tif (boxShadows.length === 0) return\n\t\treturn {\n\t\t\tboxShadows: boxShadows.map(shadow => singleBoxShadowToCSS(shadow, color => ctx.tokens.resolve(color)?.toCSS())),\n\t\t}\n\t}\n\n\tconst boxShadowsAttribute = ctx.dynamicValues.resolveAttributeFromDynamicValue(boxShadows, node)\n\tif (boxShadowsAttribute) {\n\t\treturn { boxShadows: [boxShadowsAttribute] }\n\t}\n}\n\nexport const boxShadows = {\n\tfor: supportsBoxShadow,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<BoxShadowTrait>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { ColorStyleTokenNode } from \"document/models/CanvasTree/nodes/ColorStyleTokenNode.ts\"\nimport { isColorStyleTokenNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { colorDescriptionWithoutToken } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\ntype ColorStyle = Pick<ColorStyleTokenNode, \"light\" | \"dark\">\nconst definition: TraitAttributeDefinition<ColorStyle> = {\n\tlight: { description: colorDescriptionWithoutToken },\n\tdark: { description: `${colorDescriptionWithoutToken} | ${nullString}`, optional: true },\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!isColorStyleTokenNode(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tif (isString(attributes.light)) node.set({ light: attributes.light })\n\tif (isNullString(attributes.dark)) {\n\t\tnode.set({ dark: undefined })\n\t} else if (isString(attributes.dark)) {\n\t\tnode.set({ dark: attributes.dark })\n\t}\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!isColorStyleTokenNode(node)) return undefined\n\treturn { light: node.light, dark: node.dark }\n}\n\nfunction withColorStyle<T extends CanvasNode>(node: T): node is T & ColorStyleTokenNode {\n\treturn isColorStyleTokenNode(node)\n}\n\nexport const colorStyle = {\n\tfor: withColorStyle,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<ColorStyle>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { metadataTags } from \"../context/metadataTags.ts\"\nimport { StylePresetType } from \"../context/stylePresetType.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport { expectedStylePresetReference, singleWarning, unsupportedAttributeMessage } from \"./invalidValues.ts\"\nimport type {\n\tAttributeDefinition,\n\tDSLAttributes,\n\tTraitAttributeDefinition,\n\tTraitDefinition,\n\tTraitWarning,\n} from \"./types.ts\"\nimport { nodeToDSLType } from \"./types.ts\"\n\ninterface ComponentPresetAttributes {\n\tcomponentPreset: Record<string, string>\n}\n\nconst componentPresetIdPlaceholder = \"<id>\" as const\n\nconst componentPresetDefinition = {\n\tdescription: `The name or id of a component preset from ${escapeValue(`<${metadataTags.stylePresets}>`)} for the component id from ${escapeValue(`<${metadataTags.availableComponents}>`)} | ${nullString}`,\n\toptional: true,\n} satisfies AttributeDefinition\n\nconst definition = {\n\tcomponentPreset: {\n\t\t[componentPresetIdPlaceholder]: componentPresetDefinition,\n\t},\n} satisfies TraitAttributeDefinition<ComponentPresetAttributes>\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tconst presetAttributes = attributes.componentPreset\n\tif (isUndefined(presetAttributes)) return\n\tif (!isObject(presetAttributes)) {\n\t\treturn [singleWarning(\"componentPreset\", presetAttributes, \"an object keyed by component id\")]\n\t}\n\n\tconst presentKeys: string[] = []\n\tfor (const key in presetAttributes) {\n\t\tconst value = presetAttributes[key]\n\t\tif (isUndefined(value)) continue\n\t\tpresentKeys.push(key)\n\t}\n\tif (presentKeys.length === 0) return\n\n\tif (!isRichTextNode(node)) {\n\t\tconst nodeType = nodeToDSLType(node, ctx)\n\t\treturn presentKeys.map(key => ({\n\t\t\tkey: getAttributeKey(key),\n\t\t\tapplied: false,\n\t\t\tmessage: unsupportedAttributeMessage(nodeType),\n\t\t}))\n\t}\n\n\tif (!isVariableReference(node.htmlContent)) {\n\t\treturn presentKeys.map(key => ({\n\t\t\tkey: getAttributeKey(key),\n\t\t\tapplied: false,\n\t\t\tmessage: `${getAttributeKey(key)} can only be set when the RichTextNode content is bound to a RichText variable.`,\n\t\t}))\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\n\tfor (const componentIdKey of presentKeys) {\n\t\tconst key = getAttributeKey(componentIdKey)\n\t\tconst value = presetAttributes[componentIdKey]\n\n\t\tif (!isString(value)) {\n\t\t\twarnings.push(singleWarning(key, value, expectedStylePresetReference))\n\t\t\tcontinue\n\t\t}\n\n\t\t// Resolve component ID to a module identifier.\n\t\tconst componentIdentifier = ctx.components.getModuleIdentifierForId(componentIdKey)\n\t\tif (!componentIdentifier) {\n\t\t\twarnings.push(singleWarning(key, value, `a component id from <${metadataTags.availableComponents}>`))\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isNullString(value)) {\n\t\t\tnode.setComponentPreset(componentIdentifier, undefined)\n\t\t\tcontinue\n\t\t}\n\n\t\tconst preset = ctx.stylePresets.forNameOrId(value, StylePresetType.Component)\n\t\tif (!preset) {\n\t\t\tthrow new DeferTraitError(\n\t\t\t\t`${escapeValue(ClassDiscriminator.ComponentPresetNode)} with name or id \"${value}\" not found`,\n\t\t\t)\n\t\t}\n\n\t\tif (preset.type !== StylePresetType.Component || preset.componentIdentifier !== componentIdentifier) {\n\t\t\tconst displayName = ctx.components.getDisplayName(componentIdentifier)\n\t\t\twarnings.push(singleWarning(key, value, `a ${displayName} component preset name or id or \"${nullString}\"`))\n\t\t\tcontinue\n\t\t}\n\n\t\tnode.setComponentPreset(componentIdentifier, preset.id)\n\t}\n\n\treturn warnings.length > 0 ? warnings : undefined\n}\n\nfunction getAttributeKey(componentId: string): string {\n\treturn `componentPreset.${componentId}`\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isRichTextNode(node)) return\n\tif (!isVariableReference(node.htmlContent)) return\n\n\tconst componentPresetAttributes: Record<string, string> = {}\n\tfor (const [componentIdentifier, presetId] of node.getComponentPresets()) {\n\t\tconst componentId = ctx.components.getIdForModuleIdentifier(componentIdentifier)\n\t\tif (!componentId) continue\n\n\t\tconst presetName = ctx.stylePresets.forId(presetId)?.name\n\t\tif (!presetName) continue\n\n\t\tcomponentPresetAttributes[componentId] = presetName\n\t}\n\n\treturn isEmptyObject(componentPresetAttributes) ? undefined : { componentPreset: componentPresetAttributes }\n}\n\nexport const componentPreset = {\n\tfor: isRichTextNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<ComponentPresetAttributes>\n", "import { ModuleType, isLocalModuleIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport { ComponentNodeClass } from \"app/ai/agents/dsl.ts\"\nimport { booleanString } from \"app/ai/agents/schemaUtils.ts\"\nimport type {\n\tAnySmartComponentNode,\n\tCanvasNode,\n\tLoadedSmartComponentNode,\n\tNodeID,\n} from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode, isSmartComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { parsePixelNumber } from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\tCustomCursorType,\n\tDEFAULT_CURSOR_OFFSET,\n\ttype NodeProvidingCursorComponent,\n\ttype WithCursor,\n\tcssCursors,\n\tcustomCursorDefaults,\n\tisCSSCursor,\n\tisNodeProvidingCustomCursorComponent,\n\twithCursor,\n} from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport { withDOMLayout } from \"document/models/CanvasTree/traits/WithDOMLayout.ts\"\nimport {\n\tDEFAULT_FLOATING_ALIGNMENT,\n\tDEFAULT_FLOATING_PLACEMENT,\n\ttype FloatingAlignment,\n\ttype FloatingPlacement,\n} from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { isBreakpointWithLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { createCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { isEmptyObject } from \"library/utils/utils.ts\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isVariableReferenceHandle, looksLikeVariableReference } from \"../context/dynamicValues.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport {\n\texistingVariantNameOrId,\n\texpectedPxValue,\n\tinvalidAttributeMessage,\n\tlayoutTemplateOverridesMessage,\n\tsingleWarning,\n\ttraitNotAppliedWarning,\n} from \"./invalidValues.ts\"\nimport { variableDescription } from \"./traitDescriptions.ts\"\nimport {\n\tparseDSLTransitionString,\n\tspringDSLTransitionTypes,\n\ttransitionWithDefault,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitToAttributesOutput,\n\ttype TraitWarning,\n} from \"./types.ts\"\nimport { zodErrorToWarnings } from \"./zodErrorToWarnings.ts\"\n\nconst customCursorDSLSetComponent = ComponentNodeClass\nconst customCursorDSLSetComponentVariant = `${ComponentNodeClass}-variant` as const\nconst customCursorAgentTypes = [customCursorDSLSetComponent, customCursorDSLSetComponentVariant]\ntype CustomCursorAgentType = (typeof customCursorAgentTypes)[number]\n\nconst floatingPlacements = [\"top\", \"right\", \"bottom\", \"left\"] as const satisfies readonly FloatingPlacement[]\nconst floatingAlignments = [\"start\", \"center\", \"end\"] as const satisfies readonly FloatingAlignment[]\n\nconst expectedAncestorProvidedCursorComponent = `a node or one of its ancestors to already provide a custom cursor ${escapeValue(ComponentNodeClass)}`\n\nexport const cursorTransitionWarningMessage =\n\t\"Custom cursor transitions often lead to sluggishness. The cursor movement will be smoother without a transition being applied. Were you asked explicitly for a **transition** to be applied to the cursor? If not, then disable and remove the transition.\"\n\nexport const variantIgnoresComponentConfigMessage = `Skipped because this is inherited from an ancestor when customCursor.type=\"${customCursorDSLSetComponentVariant}\".`\n\nexport const cursorRedundantWithCustomCursorMessage =\n\t'Setting cursor=\"none\" alongside customCursor.follow=\"true\" is unnecessary. Set cursor=\"null\" **AND** set customCursor.follow=\"false\" instead. Then the cursor will be replaced by the custom cursor.'\n\nexport const variantTypeOnlyAcceptsVariantMessage = `When ${escapeValue(`customCursor.type=\"${customCursorDSLSetComponentVariant}\"`)}, only ${escapeValue(\"customCursor.variant\")} may be supplied. Component configuration is inherited from the ancestor providing the cursor ${escapeValue(ComponentNodeClass)}.`\nfunction existingNodeId(): string {\n\treturn `a ${escapeValue(ComponentNodeClass)} id`\n}\n\nfunction customCursorComponentConfigRequiresOwnComponentMessage(attributeName: string, value: unknown): string {\n\treturn invalidAttributeMessage(\n\t\tvalue,\n\t\t`${escapeValue(attributeName)} only applies when this node already provides a custom cursor ${escapeValue(ComponentNodeClass)}. Set ${escapeValue(\"customCursor.componentNodeId\")} first`,\n\t)\n}\n\nfunction customCursorRequiresSmartComponentMessage(value: unknown): string {\n\treturn invalidAttributeMessage(\n\t\tvalue,\n\t\t`Custom cursor must be a ${escapeValue(ComponentNodeClass)}. Code components are not supported`,\n\t)\n}\n\nfunction fromDSLToCustomCursorType(value: CustomCursorAgentType): CustomCursorType {\n\tswitch (value) {\n\t\tcase customCursorDSLSetComponent:\n\t\t\treturn CustomCursorType.Component\n\t\tcase customCursorDSLSetComponentVariant:\n\t\t\treturn CustomCursorType.Variant\n\t\tdefault:\n\t\t\tassertNever(value)\n\t}\n}\n\nfunction fromCustomCursorTypeToDSL(value: CustomCursorType): CustomCursorAgentType {\n\tswitch (value) {\n\t\tcase CustomCursorType.Component:\n\t\t\treturn customCursorDSLSetComponent\n\t\tcase CustomCursorType.Variant:\n\t\t\treturn customCursorDSLSetComponentVariant\n\t\tdefault:\n\t\t\tassertNever(value)\n\t}\n}\n\nconst dslCustomCursorSchema = z\n\t.object({\n\t\ttype: z.enum(customCursorAgentTypes).transform(fromDSLToCustomCursorType).optional(),\n\t\tcomponentNodeId: z.string().optional(),\n\t\tvariant: z.string().optional(),\n\t\tfollow: booleanString.optional(),\n\t\toffsetX: z.string().optional(),\n\t\toffsetY: z.string().optional(),\n\t\tplacement: z.enum(floatingPlacements).optional(),\n\t\talignment: z.enum(floatingAlignments).optional(),\n\t\ttransition: z.string().optional(),\n\t})\n\t.strict()\n\ntype ParsedDSLCustomCursor = z.output<typeof dslCustomCursorSchema>\ntype DSLCustomCursor = TraitToAttributesOutput<ParsedDSLCustomCursor>\n\ninterface CursorAttributes {\n\tcursor: string\n\tcustomCursor: DSLCustomCursor\n}\n\nconst expectedCSSCursorValue = `${cssCursors.join(\" | \")} | ${variableDescription} | ${nullString}`\nconst expectedFloatingPlacement = floatingPlacements.join(\" | \")\nconst expectedFloatingAlignment = floatingAlignments.join(\" | \")\n\nconst definition: TraitAttributeDefinition<CursorAttributes> = {\n\tcursor: { description: expectedCSSCursorValue, optional: true },\n\tcustomCursor: {\n\t\ttype: { description: customCursorAgentTypes.join(\" | \"), optional: true },\n\t\tcomponentNodeId: { description: existingNodeId(), optional: true },\n\t\tvariant: { description: existingVariantNameOrId(ComponentNodeClass), optional: true },\n\t\tfollow: { description: \"boolean\", optional: true },\n\t\toffsetX: { description: \"${number}px\", optional: true },\n\t\toffsetY: { description: \"${number}px\", optional: true },\n\t\tplacement: { description: expectedFloatingPlacement, optional: true },\n\t\talignment: { description: expectedFloatingAlignment, optional: true },\n\t\ttransition: {\n\t\t\tdescription: [...springDSLTransitionTypes, nullString].join(\" | \"),\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nfunction getCurrentCustomCursorType(node: WithCursor): CustomCursorType | undefined {\n\treturn isVariableReference(node.customCursorType) ? undefined : node.customCursorType\n}\n\nfunction getEffectiveCustomCursorType(node: WithCursor, update: Partial<WithCursor>): CustomCursorType | undefined {\n\tif (update.customCursorType === CustomCursorType.Component || update.customCursorType === CustomCursorType.Variant) {\n\t\treturn update.customCursorType\n\t}\n\n\tif (!isUndefined(update.customCursorType)) return\n\treturn getCurrentCustomCursorType(node)\n}\n\n/**\n * Find the nearest ancestor providing a custom cursor component, using the\n * TreeResolver so it works even when `node` is still pending insertion and is\n * therefore not yet reachable via `tree.getAncestorThatMatches`.\n */\nfunction findAncestorProvidingCursorComponent(\n\tnode: CanvasNode,\n\tctx: AgentContext,\n): NodeProvidingCursorComponent | null {\n\tconst tree = ctx.treeStore.tree\n\tfor (const ancestor of ctx.treeResolver.getAncestorsFor(node.id)) {\n\t\tif (isNodeProvidingCustomCursorComponent(tree, ancestor)) return ancestor\n\t}\n\treturn null\n}\n\nfunction resolveCursorSmartComponent(value: string, ctx: AgentContext): CanvasNode | undefined {\n\tconst resolvedNode = ctx.treeResolver.get(value)\n\tif (resolvedNode) return resolvedNode\n\n\tconst identifier = ctx.components.getModuleIdentifierForId(value)\n\tif (!identifier) return\n\n\tconst parsed = parseModuleIdentifier(identifier)\n\tif (!parsed || !isLocalModuleIdentifier(parsed) || parsed.type !== ModuleType.Canvas) return\n\n\treturn ctx.treeResolver.get(parsed.localIdName) ?? undefined\n}\n\nfunction isCodeComponentReference(value: string, ctx: AgentContext): boolean {\n\tconst identifier = ctx.components.getModuleIdentifierForId(value) ?? value\n\tconst parsed = parseModuleIdentifier(identifier)\n\treturn Boolean(parsed && isLocalModuleIdentifier(parsed) && parsed.type === ModuleType.Code)\n}\n\nfunction resolveLoadedCursorSmartComponent(\n\tsmartComponentId: NodeID | undefined,\n\tctx: AgentContext,\n): LoadedSmartComponentNode | undefined {\n\tif (!smartComponentId) return\n\n\tconst smartComponent = ctx.treeStore.tree.get(smartComponentId)\n\tif (!isSmartComponentNode(smartComponent)) return\n\n\tctx.components.forIdentifier(smartComponent.instanceIdentifier, { deferUntilLoaded: true })\n\treturn smartComponent.loaded\n}\n\nfunction resolveCursorVariantId(\n\tsmartComponent: AnySmartComponentNode,\n\tvalue: string,\n\tctx: AgentContext,\n): NodeID | undefined {\n\tif (value === smartComponent.baseVariantId) {\n\t\treturn smartComponent.baseVariantId\n\t}\n\n\tconst resolvedId = ctx.treeResolver.get(value)?.id\n\tconst loaded = smartComponent.loaded\n\tif (!loaded) return resolvedId\n\n\tfor (const variant of loaded.getTopLevelVariants()) {\n\t\tif (resolvedId === variant.id) return variant.id\n\t\tif (variant.resolveValue(\"name\") === value) return variant.id\n\t\tif (variant.id === value) return variant.id\n\t}\n}\n\nasync function resolveLoadedCursorSmartComponentAsync(\n\tsmartComponentId: NodeID | undefined,\n\tctx: AgentContext,\n): Promise<LoadedSmartComponentNode | null> {\n\tif (!smartComponentId) return null\n\n\tconst smartComponent = ctx.treeStore.tree.get(smartComponentId)\n\tif (!isSmartComponentNode(smartComponent)) return null\n\tif (smartComponent.isLoaded()) return smartComponent\n\n\treturn smartComponent.load()\n}\n\nasync function resolveCustomCursorComponent(\n\tnode: CanvasNode & WithCursor,\n\tcustomCursorType: CustomCursorType,\n\tctx: AgentContext,\n): Promise<LoadedSmartComponentNode | undefined> {\n\tif (isString(node.customCursorSmartComponentId)) {\n\t\tconst component = await resolveLoadedCursorSmartComponentAsync(node.customCursorSmartComponentId, ctx)\n\t\tif (component) return component\n\t}\n\n\tif (customCursorType === CustomCursorType.Variant) {\n\t\tconst ancestor = findAncestorProvidingCursorComponent(node, ctx)\n\t\tif (ancestor) {\n\t\t\tconst component = await resolveLoadedCursorSmartComponentAsync(ancestor.customCursorSmartComponentId, ctx)\n\t\t\tif (component) return component\n\t\t}\n\t}\n}\n\nfunction applyCSSCursor(\n\tnode: CanvasNode & WithCursor,\n\tcursor: unknown,\n\tctx: AgentContext,\n\tupdate: Partial<WithCursor>,\n\twarnings: TraitWarning[],\n) {\n\tconst resolveHandleResult = isString(cursor)\n\t\t? ctx.dynamicValues.resolveHandleFromAttribute(cursor, { node })\n\t\t: undefined\n\n\tif (resolveHandleResult?.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"cursor\", message)))\n\t\treturn\n\t}\n\n\tif (resolveHandleResult?.type === \"resolved\") {\n\t\tupdate.cursor = resolveHandleResult.handle.reference(node)\n\t} else if (isNullString(cursor)) {\n\t\tObject.assign(update, { cursor: undefined })\n\t} else if (isCSSCursor(cursor)) {\n\t\tupdate.cursor = cursor\n\t} else if (!isUndefined(cursor) && !looksLikeVariableReference(cursor)) {\n\t\twarnings.push(singleWarning(\"cursor\", cursor, expectedCSSCursorValue))\n\t}\n}\n\nfunction applyCustomCursor(\n\tnode: CanvasNode & WithCursor,\n\tcustomCursor: unknown,\n\tctx: AgentContext,\n\tupdate: Partial<WithCursor>,\n\twarnings: TraitWarning[],\n) {\n\tconst resolveHandleResult = isString(customCursor)\n\t\t? ctx.dynamicValues.resolveHandleFromAttribute(customCursor, { node })\n\t\t: undefined\n\n\tif (resolveHandleResult?.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"customCursor\", message)))\n\t\treturn\n\t}\n\n\tif (resolveHandleResult?.type === \"resolved\" && isVariableReferenceHandle(resolveHandleResult.handle)) {\n\t\tupdate.customCursorType = resolveHandleResult.handle.reference(node)\n\t\treturn\n\t}\n\n\tif (isNullString(customCursor)) {\n\t\tObject.assign(update, customCursorDefaults, { customCursorType: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslCustomCursorSchema.safeParse(customCursor)\n\n\tif (!parsed.success) {\n\t\twarnings.push(\n\t\t\t...zodErrorToWarnings({\n\t\t\t\terror: parsed.error,\n\t\t\t\tschema: dslCustomCursorSchema,\n\t\t\t\tkeyPrefix: \"customCursor\",\n\t\t\t\tinput: customCursor,\n\t\t\t}),\n\t\t)\n\t\treturn\n\t}\n\n\tconst {\n\t\ttype,\n\t\tcomponentNodeId: component,\n\t\tvariant,\n\t\tfollow,\n\t\toffsetX,\n\t\toffsetY,\n\t\tplacement,\n\t\talignment,\n\t\ttransition,\n\t} = parsed.data\n\n\t// Validate variant - make sure correct properties are passed.\n\tif (type === CustomCursorType.Variant) {\n\t\tlet hasInvalidKeys = false\n\t\tfor (const [key, value] of Object.entries(parsed.data)) {\n\t\t\tif (key === \"type\" || key === \"variant\") continue\n\t\t\tif (!isUndefined(value)) {\n\t\t\t\twarnings.push({ applied: false, key: `customCursor.${key}`, message: variantTypeOnlyAcceptsVariantMessage })\n\t\t\t\thasInvalidKeys = true\n\t\t\t}\n\t\t}\n\t\tif (hasInvalidKeys) return\n\t}\n\n\t// Snapshot the node's current state so we can merge partial DSL updates.\n\t// A node can own a cursor component directly, or inherit one from an ancestor\n\t// (e.g. a parent sets the component, children override only the variant).\n\tconst currentType = getCurrentCustomCursorType(node)\n\tconst currentOwnComponentId = isString(node.customCursorSmartComponentId)\n\t\t? node.customCursorSmartComponentId\n\t\t: undefined\n\tconst inheritedCursorComponent = findAncestorProvidingCursorComponent(node, ctx)\n\tconst inheritedComponentId = inheritedCursorComponent?.customCursorSmartComponentId\n\n\t// Ensure the inherited smart component's definition is loaded before using its\n\t// id for type inference. Throws DeferTraitError to retry if not ready yet.\n\tif (inheritedComponentId) {\n\t\tresolveLoadedCursorSmartComponent(inheritedComponentId, ctx)\n\t}\n\n\tconst hasComponentValue = Boolean(component && !isNullString(component))\n\tconst hasVariantValue = Boolean(variant && !isNullString(variant))\n\n\t// Resolve the component reference from the DSL (by name or id) into a concrete node id.\n\tlet explicitComponentId: NodeID | undefined\n\n\tif (hasComponentValue && isString(component)) {\n\t\tconst resolvedComponent = resolveCursorSmartComponent(component, ctx)\n\t\tif (isSmartComponentNode(resolvedComponent)) {\n\t\t\texplicitComponentId = resolvedComponent.id\n\t\t\tupdate.customCursorSmartComponentId = resolvedComponent.id\n\t\t} else if (isCodeComponentNode(resolvedComponent) || isCodeComponentReference(component, ctx)) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"customCursor.componentNodeId\",\n\t\t\t\tmessage: customCursorRequiresSmartComponentMessage(component),\n\t\t\t})\n\t\t\treturn\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"customCursor.componentNodeId\", component, existingNodeId()))\n\t\t}\n\t}\n\n\t// Infer the cursor type when not explicitly set. Priority:\n\t//   1. Explicit type from DSL (e.g. type=\"set-component\")\n\t//   2. If a component was just provided, assume \"component\" mode\n\t//   3. Keep the node's existing type (supports partial updates like changing only variant)\n\t//   4. If only a variant was set and an ancestor provides the component, assume \"variant\" mode\n\tlet resolvedType: CustomCursorType | undefined = type\n\n\tif (!resolvedType && explicitComponentId) {\n\t\tresolvedType = CustomCursorType.Component\n\t} else if (!resolvedType) {\n\t\tresolvedType = currentType\n\t}\n\tif (!resolvedType && hasVariantValue && !currentOwnComponentId) {\n\t\tresolvedType = CustomCursorType.Variant\n\t}\n\n\t// The effective component is either this node's own or one inherited from an ancestor.\n\t// Setting component to null clears the own value but still allows inherited ones.\n\tconst ownComponentId = isNullString(component) ? undefined : (explicitComponentId ?? currentOwnComponentId)\n\tconst effectiveComponentId = ownComponentId ?? inheritedComponentId\n\n\t// Validate the resolved type against available components:\n\t// \"component\" requires the node itself to own a component,\n\t// \"variant\" only needs an effective component (own or inherited from an ancestor).\n\tif (resolvedType === CustomCursorType.Component) {\n\t\tif (ownComponentId) {\n\t\t\tupdate.customCursorType = CustomCursorType.Component\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"customCursor.componentNodeId\", component, existingNodeId()))\n\t\t}\n\t} else if (resolvedType === CustomCursorType.Variant) {\n\t\tif (effectiveComponentId) {\n\t\t\tupdate.customCursorType = CustomCursorType.Variant\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"customCursor.variant\", variant, expectedAncestorProvidedCursorComponent))\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Variant\n\tif (isNullString(variant)) {\n\t\tupdate.customCursorVariant = undefined\n\t} else if (hasVariantValue && isString(variant)) {\n\t\tconst effectiveSmartComponent = resolveLoadedCursorSmartComponent(effectiveComponentId, ctx)\n\t\tif (effectiveSmartComponent) {\n\t\t\tconst variantId = resolveCursorVariantId(effectiveSmartComponent, variant, ctx)\n\t\t\tif (variantId) {\n\t\t\t\tupdate.customCursorVariant = variantId\n\t\t\t} else {\n\t\t\t\twarnings.push(singleWarning(\"customCursor.variant\", variant, existingVariantNameOrId(ComponentNodeClass)))\n\t\t\t}\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"customCursor.variant\", variant, expectedAncestorProvidedCursorComponent))\n\t\t}\n\t}\n\n\tconst componentConfig = { follow, offsetX, offsetY, placement, alignment, transition }\n\n\t// Warn if passed follow, offset, placement, alignment, or transition. Those only apply to Component-type nodes.\n\tif (resolvedType === CustomCursorType.Variant) {\n\t\tconst nonVariantKeys = Object.entries(componentConfig)\n\t\tfor (const [key, value] of nonVariantKeys) {\n\t\t\tif (!isUndefined(value)) {\n\t\t\t\twarnings.push({ applied: false, key: `customCursor.${key}`, message: variantIgnoresComponentConfigMessage })\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\t// Ensure a component is applied to the node (either by update or already present) before allowing component-only config.\n\tif (update.customCursorType !== CustomCursorType.Component) {\n\t\tfor (const [key, value] of Object.entries(componentConfig)) {\n\t\t\tif (!isUndefined(value)) {\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: `customCursor.${key}`,\n\t\t\t\t\tmessage: customCursorComponentConfigRequiresOwnComponentMessage(`customCursor.${key}`, value),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\tlet hasFollowConfig = false\n\n\tif (!isUndefined(follow)) {\n\t\tupdate.customCursorFollow = follow\n\t}\n\n\tif (isString(offsetX)) {\n\t\tconst parsedOffsetX = parsePixelNumber(offsetX)\n\t\tif (isNumber(parsedOffsetX)) {\n\t\t\tupdate.customCursorOffsetX = parsedOffsetX\n\t\t\thasFollowConfig = true\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"customCursor.offsetX\", offsetX, expectedPxValue))\n\t\t}\n\t}\n\n\tif (isString(offsetY)) {\n\t\tconst parsedOffsetY = parsePixelNumber(offsetY)\n\t\tif (isNumber(parsedOffsetY)) {\n\t\t\tupdate.customCursorOffsetY = parsedOffsetY\n\t\t\thasFollowConfig = true\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"customCursor.offsetY\", offsetY, expectedPxValue))\n\t\t}\n\t}\n\n\tif (placement) {\n\t\tupdate.customCursorPlacement = placement\n\t\thasFollowConfig = true\n\t}\n\n\tif (alignment) {\n\t\tupdate.customCursorAlignment = alignment\n\t\thasFollowConfig = true\n\t}\n\n\tif (isNullString(transition)) {\n\t\tupdate.customCursorTransitionEnabled = undefined\n\t\tupdate.customCursorTransition = undefined\n\t} else if (isString(transition)) {\n\t\tconst parsedTransition = parseDSLTransitionString(transition, springDSLTransitionTypes, error => {\n\t\t\twarnings.push(singleWarning(\"customCursor.transition\", transition, error.message))\n\t\t})\n\n\t\tif (parsedTransition) {\n\t\t\tupdate.customCursorTransitionEnabled = true\n\t\t\tupdate.customCursorTransition = transitionWithDefault(parsedTransition, node.customCursorTransition)\n\n\t\t\t// Transition on a custom cursor is not a great default, but LLM sees transition and thinks ooh shiny.\n\t\t\t// Flag it as a warning here and let it self correct.\n\t\t\twarnings.push({ applied: true, key: \"customCursor.transition\", message: cursorTransitionWarningMessage })\n\t\t}\n\t}\n\n\tif (hasFollowConfig && isUndefined(update.customCursorFollow) && isUndefined(follow)) {\n\t\tupdate.customCursorFollow = true\n\t}\n}\n\nfunction cursorUnsupportedOnLayoutTemplateBreakpointWarnings(\n\tnode: CanvasNode,\n\tattributes: DSLAttributes,\n): TraitWarning[] | undefined {\n\tif (!withDOMLayout(node)) return\n\n\tconst layoutTemplateIdentifier = node.usesLayoutTemplateRectForModuleIdentifierCached()\n\tif (!layoutTemplateIdentifier) return\n\n\tconst hasCursor = !isUndefined(attributes.cursor) && !isNullString(attributes.cursor)\n\tconst hasCustomCursor = !isUndefined(attributes.customCursor) && !isNullString(attributes.customCursor)\n\tif (!hasCursor && !hasCustomCursor) return\n\n\tconst layoutTemplateId = parseModuleIdentifier(layoutTemplateIdentifier)?.localIdName ?? layoutTemplateIdentifier\n\tconst warnings: TraitWarning[] = []\n\n\tif (hasCursor) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"cursor\",\n\t\t\tmessage: layoutTemplateOverridesMessage(\"cursor\", layoutTemplateId),\n\t\t})\n\t}\n\n\tif (hasCustomCursor) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"customCursor\",\n\t\t\tmessage: layoutTemplateOverridesMessage(\"customCursor\", layoutTemplateId),\n\t\t})\n\t}\n\n\treturn warnings\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withCursor(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\t// Check if it's a breakpoint node with a layout template. If so, don't apply and return warnings.\n\tconst unsupportedWarnings = cursorUnsupportedOnLayoutTemplateBreakpointWarnings(node, attributes)\n\tif (unsupportedWarnings) return unsupportedWarnings\n\n\tconst warnings: TraitWarning[] = []\n\tconst update: Partial<WithCursor> = {}\n\n\tif (!isUndefined(attributes.cursor)) {\n\t\tapplyCSSCursor(node, attributes.cursor, ctx, update, warnings)\n\t}\n\n\tif (!isUndefined(attributes.customCursor)) {\n\t\tapplyCustomCursor(node, attributes.customCursor, ctx, update, warnings)\n\t}\n\n\t// If setting cursor=\"none\" alongside a following custom cursor, suggest `replace` mode instead.\n\tif (\n\t\tattributes.cursor === \"none\" &&\n\t\t!isUndefined(attributes.customCursor) &&\n\t\t!isNullString(attributes.customCursor) &&\n\t\tgetEffectiveCustomCursorType(node, update) === CustomCursorType.Component &&\n\t\tupdate.customCursorFollow === true\n\t) {\n\t\twarnings.push({ applied: true, key: \"cursor\", message: cursorRedundantWithCustomCursorMessage })\n\t}\n\n\tnode.set(update)\n\n\tif (warnings.length > 0) return warnings\n}\n\nasync function toAttributes(\n\tnode: CanvasNode,\n\t_parent: CanvasNode | null | undefined,\n\tctx: AgentContext,\n): Promise<DSLAttributes | undefined> {\n\tif (!withCursor(node)) return\n\tif (isBreakpointWithLayoutTemplate(node)) return\n\n\tconst result: DSLAttributes = {}\n\n\tconst cursor = node.cursor\n\tconst cursorVariable = isDynamicValue(cursor)\n\t\t? ctx.dynamicValues.resolveAttributeFromDynamicValue(cursor, node)\n\t\t: undefined\n\tif (cursorVariable) {\n\t\tresult.cursor = cursorVariable\n\t} else {\n\t\tconst resolvedCursor = node.resolveValue(\"cursor\")\n\t\tif (isCSSCursor(resolvedCursor)) {\n\t\t\tresult.cursor = resolvedCursor\n\t\t}\n\t}\n\n\tconst dynamicCustomCursorType = node.customCursorType\n\tconst customCursorVariable = isDynamicValue(dynamicCustomCursorType)\n\t\t? ctx.dynamicValues.resolveAttributeFromDynamicValue(dynamicCustomCursorType, node)\n\t\t: undefined\n\tif (customCursorVariable) {\n\t\tresult.customCursor = customCursorVariable\n\t\treturn result\n\t}\n\n\tconst customCursorType = getCurrentCustomCursorType(node)\n\tif (!customCursorType) {\n\t\treturn !isEmptyObject(result) ? result : undefined\n\t}\n\n\tconst smartComponent = await resolveCustomCursorComponent(node, customCursorType, ctx)\n\tif (!smartComponent) {\n\t\treturn !isEmptyObject(result) ? result : undefined\n\t}\n\n\tconst customCursor: DSLAttributes = { type: fromCustomCursorTypeToDSL(customCursorType) }\n\n\tconst variantId = node.customCursorVariant ?? smartComponent.baseVariantId\n\tcustomCursor.variant = ctx.treeStore.tree.get(variantId)?.resolveValue(\"name\") ?? variantId\n\n\tif (customCursorType === CustomCursorType.Component) {\n\t\tcustomCursor.componentNodeId = ctx.components.getIdForModuleIdentifier(smartComponent.instanceIdentifier)\n\t\tcustomCursor.follow = node.customCursorFollow ?? false\n\n\t\tif (customCursor.follow) {\n\t\t\tcustomCursor.offsetX = createCSSDimension(\n\t\t\t\ttoRoundedNumber(node.customCursorOffsetX ?? DEFAULT_CURSOR_OFFSET),\n\t\t\t\t\"px\",\n\t\t\t)\n\t\t\tcustomCursor.offsetY = createCSSDimension(\n\t\t\t\ttoRoundedNumber(node.customCursorOffsetY ?? DEFAULT_CURSOR_OFFSET),\n\t\t\t\t\"px\",\n\t\t\t)\n\t\t\tcustomCursor.placement = node.customCursorPlacement ?? DEFAULT_FLOATING_PLACEMENT\n\t\t\tcustomCursor.alignment = node.customCursorAlignment ?? DEFAULT_FLOATING_ALIGNMENT\n\t\t}\n\n\t\tif (node.customCursorTransitionEnabled && node.customCursorTransition) {\n\t\t\tcustomCursor.transition = vekterTransitionToDslTransitionString(node.customCursorTransition)\n\t\t}\n\t}\n\n\tresult.customCursor = customCursor\n\n\treturn result\n}\n\nexport const cursor = {\n\tfor: withCursor,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<CursorAttributes>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithDragEffect,\n\tdragEffectEnabledDefaults,\n\thasDragEffect,\n\twithDragEffect,\n} from \"document/models/CanvasTree/traits/WithDragEffect.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { EffectType, effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { isBoolean, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { booleanString } from \"../schemaUtils.ts\"\nimport { isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { breakpointUnsupportedMessage, singleWarning } from \"./invalidValues.ts\"\nimport {\n\tinertiaTransitionDefinition,\n\tinertiaTransitionSupportedTypes,\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport type {\n\tDSLAttributes,\n\tTraitAttributeDefinition,\n\tTraitDefinition,\n\tTraitToAttributesOutput,\n\tTraitWarning,\n} from \"./types.ts\"\n\nconst dslDragEffectSchema = z.object({\n\tfreeform: booleanString.optional().catch(undefined),\n\tsnapBack: booleanString.optional().catch(undefined),\n\tmomentum: booleanString.optional().catch(undefined),\n\ttransition: z.string().optional().catch(undefined),\n})\n\ntype ParsedDSLDragEffect = z.output<typeof dslDragEffectSchema>\ntype DSLDragEffect = TraitToAttributesOutput<ParsedDSLDragEffect>\n\nconst definition: TraitAttributeDefinition<{ dragEffect: DSLDragEffect }> = {\n\tdragEffect: {\n\t\tfreeform: {\n\t\t\tdescription: \"boolean\",\n\t\t\toptional: true,\n\t\t},\n\t\tsnapBack: {\n\t\t\tdescription: \"boolean\",\n\t\t\toptional: true,\n\t\t},\n\t\tmomentum: {\n\t\t\tdescription: \"boolean\",\n\t\t\toptional: true,\n\t\t},\n\t\ttransition: inertiaTransitionDefinition,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withDragEffect(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst { dragEffect } = attributes\n\n\tif (isBreakpointVariant(node) && !isUndefined(dragEffect)) {\n\t\treturn [{ applied: false, key: \"dragEffect\", message: breakpointUnsupportedMessage(\"drag effects\") }]\n\t}\n\n\tif (isNullString(dragEffect)) {\n\t\tnode.set({ dragEffectEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslDragEffectSchema.safeParse(dragEffect)\n\tif (!parsed.success) return\n\n\tconst { freeform, snapBack, momentum, transition } = parsed.data\n\n\tconst update: Partial<WithDragEffect> = {}\n\n\tif (isBoolean(freeform)) {\n\t\tupdate.dragEffectFreeform = freeform\n\t}\n\n\tif (isBoolean(snapBack)) {\n\t\tupdate.dragEffectSnapBack = snapBack\n\t}\n\n\tif (isBoolean(momentum)) {\n\t\tupdate.dragEffectMomentum = momentum\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\tconst parsedTransition = parseDSLTransitionString(transition, inertiaTransitionSupportedTypes, error => {\n\t\twarnings.push(singleWarning(\"dragEffect.transition\", transition, error.message))\n\t})\n\n\tif (parsedTransition) {\n\t\tupdate.dragEffectTransition = transitionWithDefault(\n\t\t\tparsedTransition,\n\t\t\tnode.dragEffectTransition,\n\t\t\teffectConfig[EffectType.Drag].enabledDefaults.dragEffectTransition,\n\t\t)\n\t}\n\n\tif (isEmptyObject(update)) return warnings.length > 0 ? warnings : undefined\n\n\tupdateWithFallback(update, node, dragEffectEnabledDefaults)\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!hasDragEffect(node)) return undefined\n\n\tconst nodeDragEffect: Partial<DSLDragEffect> = {\n\t\tfreeform: node.dragEffectFreeform,\n\t\tsnapBack: node.dragEffectSnapBack,\n\t\tmomentum: node.dragEffectMomentum,\n\t\ttransition: vekterTransitionToDslTransitionString(node.dragEffectTransition),\n\t}\n\n\treturn { dragEffect: nodeDragEffect }\n}\n\nexport const dragEffect = {\n\tfor: withDragEffect,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ dragEffect: DSLDragEffect }>\n", "import { Color, P3Color } from \"library/render/types/Color/Color.ts\"\nimport { stringToObject } from \"library/render/types/Color/converters.ts\"\nimport { ColorFormat } from \"library/render/types/Color/types.ts\"\nimport { parseCSSVariable } from \"library/render/utils/parseCSSVariable.ts\"\n\nimport { invalidColorMessage, unsupportedColorFormatMessage } from \"./invalidValues.ts\"\n\nexport class InvalidColorError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = \"InvalidColorError\"\n\t}\n}\n\n/**\n * Parses and normalizes an agent-supplied color string. Accepts hex, rgb, rgba, hsl, hsla,\n * named CSS colors, and `color(display-p3 ...)`. Named CSS colors are normalized to hex (or\n * rgba when an alpha component is present, like `transparent`). `hsv(...)` and unparseable\n * values throw {@link InvalidColorError} so the caller can surface a trait warning.\n */\nexport function parseColor(value: string): string {\n\tconst candidate = parseCSSVariable(value).fallback ?? value\n\n\tif (P3Color.isP3String(candidate)) {\n\t\tif (P3Color.fromString(candidate)) return value\n\t\tthrow new InvalidColorError(invalidColorMessage(value))\n\t}\n\n\tconst parsed = stringToObject(candidate)\n\tif (parsed === false) throw new InvalidColorError(invalidColorMessage(value))\n\n\tif (parsed.format === ColorFormat.HSV) {\n\t\tthrow new InvalidColorError(unsupportedColorFormatMessage(value))\n\t}\n\n\tif (parsed.format === ColorFormat.NAME) {\n\t\tconst color = Color(candidate)\n\t\treturn color.a === 1 ? Color.toHexString(color).toLowerCase() : Color.toRgbString(color)\n\t}\n\n\treturn value\n}\n", "import { parseAssetReference } from \"@framerjs/assets\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { isCompatibleFileType } from \"document/components/chrome/properties/utils/allowedFileTypes.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { withAltText } from \"document/models/CanvasTree/traits/WithAltText.ts\"\nimport type { FillImagePositionX, FillImagePositionY, WithFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport {\n\tisValidFillImagePosition,\n\tvalidPositionXValues,\n\tvalidPositionYValues,\n\twithOptionalFill,\n} from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { isBreakpointWithLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { isConicGradient } from \"document/models/ConicGradientClass.ts\"\nimport { isLinearGradient } from \"document/models/LinearGradientClass.ts\"\nimport { isRadialGradient } from \"document/models/RadialGradientClass.ts\"\nimport { isValidURL } from \"document/utils/domainValidation.ts\"\nimport { parseGradient } from \"document/utils/parseGradient.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { getMediaTypeFromURL } from \"utils/url.ts\"\nimport { extensions as imageAllowedFileTypes } from \"web/lib/images/supportedFormats.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isVariableReferenceHandle } from \"../context/dynamicValues.ts\"\nimport {\n\tassetReferenceToURL,\n\thasAnyAttribute,\n\tisNullString,\n\tnullString,\n\tunsupportedAttributesWarnings,\n\tunwrapCSSUrl,\n} from \"./helpers.ts\"\nimport {\n\tdisallowedFileTypeMessage,\n\texpectedAttributeMessage,\n\tlayoutTemplateBreakpointWarnings,\n\ttraitNotAppliedWarning,\n\tunsupportedAttributeMessage,\n\tuntrustedUrlMessage,\n} from \"./invalidValues.ts\"\nimport { InvalidColorError, parseColor } from \"./parseColor.ts\"\nimport { attributeHasGradient, colorDescription, gradientDescription, imageDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\nimport { nodeToDSLType } from \"./types.ts\"\n\ninterface Fill {\n\tfill: string | DSLAttributes\n\tfillImagePositionX: FillImagePositionX\n\tfillImagePositionY: FillImagePositionY\n\taltText?: string\n}\n\nconst definition: TraitAttributeDefinition<\n\t// Workaround for an infinite type recursion issue that is complex to solve\n\tOmit<Fill, \"fill\"> & { fill: string }\n> = {\n\tfill: {\n\t\tdescription: `${nullString} | ${colorDescription} | ${imageDescription} | ${gradientDescription}`,\n\t\toptional: true,\n\t},\n\tfillImagePositionX: {\n\t\tdescription: `${validPositionXValues.join(\" | \")} | \\${number}%`,\n\t\toptional: true,\n\t},\n\tfillImagePositionY: {\n\t\tdescription: `${validPositionYValues.join(\" | \")} | \\${number}%`,\n\t\toptional: true,\n\t},\n\taltText: {\n\t\tdescription: \"string\",\n\t\toptional: true,\n\t},\n}\n\ntype FillUpdates = Partial<WithFill> & { altAttribute?: string }\n\nconst nonImageAltTextWarning: TraitWarning[] = [\n\t{\n\t\tapplied: false,\n\t\tkey: \"altText\",\n\t\tmessage: \"altText can only be set when fill is an image or when updating an existing image fill.\",\n\t},\n]\n\nfunction collectAltText(\n\tnode: CanvasNode,\n\taltText: DSLAttributes[\"altText\"],\n\tctx: AgentContext,\n\tupdates: FillUpdates,\n\twarnings: TraitWarning[],\n) {\n\tif (isUndefined(altText)) return\n\n\tif (!isString(altText)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"altText\",\n\t\t\tmessage: expectedAttributeMessage(altText, \"string\"),\n\t\t})\n\t\treturn\n\t}\n\n\tif (!withAltText(node)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"altText\",\n\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t})\n\t\treturn\n\t}\n\n\tupdates.altAttribute = altText\n}\n\ntype FillAttributes = Partial<Fill>\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): FillAttributes | undefined {\n\tif (!withOptionalFill(node)) return\n\tif (isBreakpointWithLayoutTemplate(node)) return\n\n\tif (!node.fillEnabled) return\n\tif (!node.fillType) return\n\n\tswitch (node.fillType) {\n\t\tcase \"color\": {\n\t\t\tif (isString(node.fillColor)) return { fill: ctx.tokens.resolve(node.fillColor)?.toCSS() ?? node.fillColor }\n\t\t\tconst fillColor = ctx.dynamicValues.resolveAttributeFromDynamicValue(node.fillColor, node)\n\t\t\tif (fillColor) return { fill: fillColor }\n\t\t\treturn undefined\n\t\t}\n\t\tcase \"image\": {\n\t\t\tlet fillValue: string | undefined\n\n\t\t\tif (isDynamicValue(node.fillImage)) {\n\t\t\t\tconst fillImage = ctx.dynamicValues.resolveAttributeFromDynamicValue(node.fillImage, node)\n\t\t\t\t// Images can only be Variable References, not Computed Values\n\t\t\t\tif (typeof fillImage !== \"string\") return undefined\n\t\t\t\tfillValue = fillImage\n\t\t\t} else {\n\t\t\t\tif (!isString(node.fillImage)) return undefined\n\n\t\t\t\tif (!parseAssetReference(node.fillImage)) return undefined\n\t\t\t\tfillValue = assetReferenceToURL(node.fillImage)\n\t\t\t\tctx.files.registerTrustedUrl(fillValue)\n\t\t\t}\n\n\t\t\tconst result: FillAttributes = { fill: fillValue }\n\t\t\tif (!isUndefined(node.fillImagePositionX)) result.fillImagePositionX = node.fillImagePositionX\n\t\t\tif (!isUndefined(node.fillImagePositionY)) result.fillImagePositionY = node.fillImagePositionY\n\t\t\tif (withAltText(node) && isString(node.altAttribute)) result.altText = node.altAttribute\n\t\t\treturn result\n\t\t}\n\t\tcase \"linear-gradient\":\n\t\t\treturn node.fillLinearGradient ? { fill: node.fillLinearGradient.toCSS() } : undefined\n\t\tcase \"radial-gradient\":\n\t\t\treturn node.fillRadialGradient ? { fill: node.fillRadialGradient.toCSS() } : undefined\n\t\tcase \"conic-gradient\":\n\t\t\treturn node.fillConicGradient ? { fill: node.fillConicGradient.toCSS() } : undefined\n\t\tdefault:\n\t\t\tassertNever(node.fillType)\n\t}\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!hasAnyAttribute(attributes, definition)) return\n\tif (!withOptionalFill(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst layoutTemplateWarnings: TraitWarning[] | undefined = layoutTemplateBreakpointWarnings(node, \"fill\")\n\tif (layoutTemplateWarnings) return layoutTemplateWarnings\n\n\tconst warnings: TraitWarning[] = []\n\n\tconst { fill } = attributes\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(fill, { node })\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\treturn resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"fill\", message))\n\t}\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tif (\n\t\t\tisVariableReferenceHandle(resolveHandleResult.handle) &&\n\t\t\tresolveHandleResult.handle.outputType === ControlType.Image\n\t\t) {\n\t\t\tnode.set({\n\t\t\t\tfillEnabled: true,\n\t\t\t\tfillType: \"image\",\n\t\t\t\tfillImage: resolveHandleResult.handle.reference(node),\n\t\t\t\tfillLinearGradient: undefined,\n\t\t\t\tfillRadialGradient: undefined,\n\t\t\t\tfillConicGradient: undefined,\n\t\t\t})\n\t\t} else {\n\t\t\tnode.set({\n\t\t\t\tfillEnabled: true,\n\t\t\t\tfillType: \"color\",\n\t\t\t\tfillColor: resolveHandleResult.handle.reference(node),\n\t\t\t\tfillLinearGradient: undefined,\n\t\t\t\tfillRadialGradient: undefined,\n\t\t\t\tfillConicGradient: undefined,\n\t\t\t})\n\t\t\tif (!isUndefined(attributes.altText)) warnings.push(...nonImageAltTextWarning)\n\t\t}\n\t\treturn warnings\n\t}\n\n\tif (!isString(fill)) {\n\t\t// Still allow updating position on existing image fills\n\t\tif (node.fillType === \"image\" && node.fillEnabled) {\n\t\t\tconst updates: FillUpdates = {}\n\t\t\tif (isValidFillImagePosition(attributes.fillImagePositionX, \"x\")) {\n\t\t\t\tupdates.fillImagePositionX = attributes.fillImagePositionX\n\t\t\t}\n\t\t\tif (isValidFillImagePosition(attributes.fillImagePositionY, \"y\")) {\n\t\t\t\tupdates.fillImagePositionY = attributes.fillImagePositionY\n\t\t\t}\n\t\t\tcollectAltText(node, attributes.altText, ctx, updates, warnings)\n\t\t\tif (Object.keys(updates).length > 0) node.set(updates)\n\t\t} else if (!isUndefined(attributes.altText)) {\n\t\t\twarnings.push(...nonImageAltTextWarning)\n\t\t}\n\t\tif (warnings.length > 0) return warnings\n\t\treturn\n\t}\n\n\tif (isNullString(fill)) {\n\t\tnode.set({ fillEnabled: false })\n\t\tif (!isUndefined(attributes.altText)) return nonImageAltTextWarning\n\t\treturn\n\t}\n\n\tconst resolvedFill = unwrapCSSUrl(fill)\n\n\tif (attributeHasGradient(resolvedFill)) {\n\t\tconst gradient = parseGradient(resolvedFill)\n\t\tif (isLinearGradient(gradient)) {\n\t\t\tnode.set({\n\t\t\t\tfillEnabled: true,\n\t\t\t\tfillType: \"linear-gradient\",\n\t\t\t\tfillLinearGradient: gradient,\n\t\t\t\tfillRadialGradient: undefined,\n\t\t\t\tfillConicGradient: undefined,\n\t\t\t})\n\t\t} else if (isRadialGradient(gradient)) {\n\t\t\tnode.set({\n\t\t\t\tfillEnabled: true,\n\t\t\t\tfillType: \"radial-gradient\",\n\t\t\t\tfillLinearGradient: undefined,\n\t\t\t\tfillRadialGradient: gradient,\n\t\t\t\tfillConicGradient: undefined,\n\t\t\t})\n\t\t} else if (isConicGradient(gradient)) {\n\t\t\tnode.set({\n\t\t\t\tfillEnabled: true,\n\t\t\t\tfillType: \"conic-gradient\",\n\t\t\t\tfillLinearGradient: undefined,\n\t\t\t\tfillRadialGradient: undefined,\n\t\t\t\tfillConicGradient: gradient,\n\t\t\t})\n\t\t}\n\t\tif (!isUndefined(attributes.altText)) return nonImageAltTextWarning\n\t\treturn\n\t}\n\n\tif (isValidURL(resolvedFill)) {\n\t\tif (!ctx.files.isTrustedUrl(resolvedFill)) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"fill\",\n\t\t\t\tmessage: untrustedUrlMessage(resolvedFill),\n\t\t\t})\n\t\t\treturn warnings\n\t\t}\n\t\tconst mediaType = getMediaTypeFromURL(resolvedFill)\n\t\tif (mediaType && !isCompatibleFileType(mediaType, imageAllowedFileTypes)) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"fill\",\n\t\t\t\tmessage: disallowedFileTypeMessage(resolvedFill, imageAllowedFileTypes, mediaType),\n\t\t\t})\n\t\t\treturn warnings\n\t\t}\n\n\t\tconst imagePositioningProps: FillUpdates = {}\n\n\t\tif (isValidFillImagePosition(attributes.fillImagePositionX, \"x\")) {\n\t\t\timagePositioningProps.fillImagePositionX = attributes.fillImagePositionX\n\t\t}\n\n\t\tif (isValidFillImagePosition(attributes.fillImagePositionY, \"y\")) {\n\t\t\timagePositioningProps.fillImagePositionY = attributes.fillImagePositionY\n\t\t}\n\n\t\tcollectAltText(node, attributes.altText, ctx, imagePositioningProps, warnings)\n\n\t\tctx.files.updateNodeWithAsset(node, resolvedFill, (reference, latestNode) => {\n\t\t\tlatestNode.set({\n\t\t\t\tfillEnabled: true,\n\t\t\t\tfillType: \"image\",\n\t\t\t\tfillImage: reference,\n\t\t\t\t...imagePositioningProps,\n\t\t\t})\n\t\t\treturn true\n\t\t})\n\t\tif (warnings.length > 0) return warnings\n\t\treturn\n\t}\n\n\ttry {\n\t\tconst fillColor = ctx.tokens.resolve(resolvedFill)?.toCSS() ?? parseColor(resolvedFill)\n\t\tnode.set({\n\t\t\tfillEnabled: true,\n\t\t\tfillType: \"color\",\n\t\t\tfillColor,\n\t\t\tfillLinearGradient: undefined,\n\t\t\tfillRadialGradient: undefined,\n\t\t\tfillConicGradient: undefined,\n\t\t})\n\t} catch (error) {\n\t\tif (!(error instanceof InvalidColorError)) throw error\n\t\twarnings.push(traitNotAppliedWarning(\"fill\", error.message))\n\t\treturn warnings\n\t}\n\tif (!isUndefined(attributes.altText)) warnings.push(...nonImageAltTextWarning)\n\tif (warnings.length > 0) return warnings\n}\n\nexport const fill = {\n\tfor: withOptionalFill,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<\n\t// Workaround for an infinite type recursion issue that is complex to solve\n\tOmit<FillAttributes, \"fill\"> & { fill: string }\n>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { type WithFilters, withFilters } from \"document/models/CanvasTree/traits/WithFilters.ts\"\nimport { filterUnitMap } from \"document/models/CanvasTree/traits/collectStyles/collectFilters.ts\"\nimport {\n\tcreateCSSDimension,\n\tisCSSDimension,\n\tparseCSSDimension,\n} from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { traitNotAppliedWarning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithFilters> = {\n\tblur: {\n\t\tdescription: `$\\{number}px | ${nullString}`,\n\t\toptional: true,\n\t},\n\tbackgroundBlur: {\n\t\tdescription: `$\\{number}px | ${nullString}`,\n\t\toptional: true,\n\t},\n\tbrightness: {\n\t\tdescription: `$\\{number}% | ${nullString}`,\n\t\toptional: true,\n\t},\n\tcontrast: {\n\t\tdescription: `$\\{number}% | ${nullString}`,\n\t\toptional: true,\n\t},\n\tgrayscale: {\n\t\tdescription: `$\\{number}% | ${nullString}`,\n\t\toptional: true,\n\t},\n\thueRotate: {\n\t\tdescription: `$\\{number}deg | ${nullString}`,\n\t\toptional: true,\n\t},\n\tinvert: {\n\t\tdescription: `$\\{number}% | ${nullString}`,\n\t\toptional: true,\n\t},\n\tsaturate: {\n\t\tdescription: `$\\{number}% | ${nullString}`,\n\t\toptional: true,\n\t},\n\tsepia: {\n\t\tdescription: `$\\{number}% | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nconst filterKeys = [\n\t\"blur\",\n\t\"backgroundBlur\",\n\t\"brightness\",\n\t\"contrast\",\n\t\"grayscale\",\n\t\"hueRotate\",\n\t\"invert\",\n\t\"saturate\",\n\t\"sepia\",\n] as const satisfies readonly (keyof WithFilters)[]\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withFilters(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst warnings: TraitWarning[] = []\n\tconst updates: Partial<WithFilters> = {}\n\tfor (const key of filterKeys) {\n\t\tconst attributeValue = attributes[key]\n\t\tif (isUndefined(attributeValue)) continue\n\n\t\tif (isNullString(attributeValue)) {\n\t\t\tupdates[key] = undefined\n\t\t\tcontinue\n\t\t}\n\n\t\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(attributeValue, { node })\n\n\t\tif (resolveHandleResult.type === \"resolved\") {\n\t\t\tupdates[key] = resolveHandleResult.handle.reference(node)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (resolveHandleResult.type === \"invalid\") {\n\t\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(key, message)))\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!isCSSDimension(attributeValue)) continue\n\t\tconst [value, unit] = parseCSSDimension(attributeValue)\n\t\tif (!isNumber(value)) continue\n\t\tif (key === \"backgroundBlur\" && unit !== \"px\") continue\n\t\telse if (key !== \"backgroundBlur\" && filterUnitMap.get(key) !== unit) continue\n\t\tupdates[key] = value\n\t}\n\n\tnode.set(updates)\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withFilters(node)) return\n\n\tconst result: DSLAttributes = {}\n\tfor (const key of filterKeys) {\n\t\tconst rawValue: WithFilters[typeof key] = node[key]\n\n\t\tif (isDynamicValue(rawValue)) {\n\t\t\tresult[key] = ctx.dynamicValues.resolveAttributeFromDynamicValue(rawValue, node)\n\t\t\tcontinue\n\t\t}\n\n\t\tconst value = node.resolveValue(key)\n\t\tif (isUndefined(value)) continue\n\t\tif (key === \"backgroundBlur\") {\n\t\t\tresult[key] = createCSSDimension(value, \"px\")\n\t\t} else {\n\t\t\tconst unit = filterUnitMap.get(key)\n\t\t\tif (isUndefined(unit)) continue\n\t\t\tresult[key] = createCSSDimension(value, unit)\n\t\t}\n\t}\n\treturn result\n}\n\nexport const filters = {\n\tfor: withFilters,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<WithFilters>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithFlowEffect,\n\tflowEffectEnabledDefaults,\n\thasFlowEffect,\n\twithFlowEffect,\n} from \"document/models/CanvasTree/traits/WithFlowEffect.ts\"\nimport { isBreakpointWithLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { EffectType, effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { hasAnyAttribute, isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { layoutTemplateBreakpointWarnings, singleWarning } from \"./invalidValues.ts\"\nimport {\n\teffectTransitionDefinition,\n\teffectTransitionSupportedTypes,\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport type {\n\tDSLAttributes,\n\tTraitAttributeDefinition,\n\tTraitDefinition,\n\tTraitToAttributesOutput,\n\tTraitWarning,\n} from \"./types.ts\"\n\nconst dslFlowEffectSchema = z.object({\n\ttransition: z.string().optional().catch(undefined),\n})\n\ntype ParsedDSLFlowEffect = z.output<typeof dslFlowEffectSchema>\ntype DSLFlowEffect = TraitToAttributesOutput<ParsedDSLFlowEffect>\n\nconst definition: TraitAttributeDefinition<{ flowEffect: DSLFlowEffect }> = {\n\tflowEffect: {\n\t\ttransition: effectTransitionDefinition,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!hasAnyAttribute(attributes, definition)) return\n\tif (!withFlowEffect(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst layoutTemplateWarnings: TraitWarning[] | undefined = layoutTemplateBreakpointWarnings(node, \"flowEffect\")\n\tif (layoutTemplateWarnings) return layoutTemplateWarnings\n\n\tconst { flowEffect } = attributes\n\n\tif (isNullString(flowEffect)) {\n\t\tnode.set({ flowEffectEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslFlowEffectSchema.safeParse(flowEffect)\n\tif (!parsed.success) return\n\n\tconst { transition } = parsed.data\n\tconst update: Partial<WithFlowEffect> = {}\n\tconst warnings: TraitWarning[] = []\n\tconst parsedTransition = parseDSLTransitionString(transition, effectTransitionSupportedTypes, error => {\n\t\twarnings.push(singleWarning(\"flowEffect.transition\", transition, error.message))\n\t})\n\tif (parsedTransition) {\n\t\tupdate.flowEffectTransition = transitionWithDefault(\n\t\t\tparsedTransition,\n\t\t\tnode.flowEffectTransition,\n\t\t\teffectConfig[EffectType.Flow].enabledDefaults.flowEffectTransition,\n\t\t)\n\t}\n\n\tif (isEmptyObject(update)) return warnings.length > 0 ? warnings : undefined\n\n\tupdateWithFallback(update, node, flowEffectEnabledDefaults)\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!hasFlowEffect(node)) return undefined\n\tif (isBreakpointWithLayoutTemplate(node)) return undefined\n\n\tconst nodeFlowEffect: Partial<DSLFlowEffect> = {\n\t\ttransition: vekterTransitionToDslTransitionString(node.flowEffectTransition),\n\t}\n\n\treturn { flowEffect: nodeFlowEffect }\n}\n\nexport const flowEffect = {\n\tfor: withFlowEffect,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ flowEffect: DSLFlowEffect }>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { getFourPixelNumberShorthand } from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport type { WithBorder } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport {\n\ttype WithFormBooleanInputType,\n\tdefaultCheckedTransition,\n\twithFormBooleanInputType,\n} from \"document/models/CanvasTree/traits/forms/WithFormBooleanInputType.ts\"\nimport { parseBorderString } from \"document/models/CanvasTree/traits/utils/reduceFormInputFocusedStyles.ts\"\nimport { singleBoxShadowToCSS } from \"utils/boxShadowToCSS.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\tcollectBooleanOrVariableReference,\n\tcollectBoxShadows,\n\tfromAttributesToBorderProps,\n\tisNullString,\n\tnullString,\n\tunsupportedAttributesWarnings,\n} from \"./helpers.ts\"\nimport { singleWarning } from \"./invalidValues.ts\"\nimport { borderDescription, boxShadowDescription, colorDescription } from \"./traitDescriptions.ts\"\nimport {\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\ttweenTransitionDefinition,\n\ttweenTransitionSupportedTypes,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype PrefixObjectKeys,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\ninterface BooleanInputTypeAttributes\n\textends\n\t\tPrefixObjectKeys<WithBorder, \"formInputChecked\">,\n\t\tPick<WithFormBooleanInputType, \"formBooleanInputType\" | \"formBooleanInputValue\"> {\n\t// The agent doesn't like the prefix formBooleanInput so we use formInput instead\n\tformInputCheckedFill: WithFormBooleanInputType[\"formBooleanInputCheckedFillColor\"]\n\tformInputCheckedBoxShadow: WithFormBooleanInputType[\"formBooleanInputCheckedBoxShadow\"]\n\tformInputCheckedTransition?: string\n}\n\nconst definition: TraitAttributeDefinition<BooleanInputTypeAttributes> = {\n\tformBooleanInputType: {\n\t\tdescription: \"checkbox | radio\",\n\t\toptional: true,\n\t},\n\tformBooleanInputValue: {\n\t\tdescription: `boolean | ${nullString}`,\n\t\toptional: true,\n\t},\n\t...borderDescription(\"formInputChecked\"),\n\tformInputCheckedFill: {\n\t\tdescription: `${colorDescription} | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformInputCheckedBoxShadow: [\n\t\t{\n\t\t\tdescription: boxShadowDescription,\n\t\t\toptional: true,\n\t\t},\n\t],\n\tformInputCheckedTransition: tweenTransitionDefinition,\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withFormBooleanInputType(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tif (attributes.formBooleanInputType === \"checkbox\" || attributes.formBooleanInputType === \"radio\") {\n\t\tnode.set({ formBooleanInputType: attributes.formBooleanInputType })\n\t}\n\n\tcollectBooleanOrVariableReference(node, \"formBooleanInputValue\", attributes, ctx)\n\n\tconst warnings: TraitWarning[] = []\n\tconst borderProps = fromAttributesToBorderProps(\"formInputChecked\", node, attributes, ctx, warnings)\n\tif (borderProps.borderEnabled === false) {\n\t\tnode.set({\n\t\t\tformBooleanInputCheckedBorderColor: undefined,\n\t\t\tformBooleanInputCheckedBorderWidth: undefined,\n\t\t\tformBooleanInputCheckedBorderStyle: undefined,\n\t\t})\n\t}\n\n\tif (borderProps.borderColor !== undefined) {\n\t\tnode.set({ formBooleanInputCheckedBorderColor: borderProps.borderColor })\n\t}\n\n\tif (borderProps.borderStyle !== undefined) {\n\t\tnode.set({ formBooleanInputCheckedBorderStyle: borderProps.borderStyle })\n\t}\n\n\tif (borderProps.borderWidth !== undefined || borderProps.borderPerSide !== undefined) {\n\t\tconst existingBorderValues = parseBorderString(node.formBooleanInputCheckedBorderWidth ?? \"0px\")\n\t\tconst borderWidth = getFourPixelNumberShorthand({\n\t\t\tall: borderProps.borderWidth ?? existingBorderValues.borderWidth,\n\t\t\tperSide: borderProps.borderPerSide ?? existingBorderValues.borderPerSide,\n\t\t\ttop: borderProps.borderTop ?? existingBorderValues.borderTop,\n\t\t\tright: borderProps.borderRight ?? existingBorderValues.borderRight,\n\t\t\tbottom: borderProps.borderBottom ?? existingBorderValues.borderBottom,\n\t\t\tleft: borderProps.borderLeft ?? existingBorderValues.borderLeft,\n\t\t})\n\t\tnode.set({ formBooleanInputCheckedBorderWidth: borderWidth })\n\t}\n\n\tif (isNullString(attributes.formInputCheckedFill)) {\n\t\tnode.set({ formBooleanInputCheckedFillColor: undefined })\n\t} else if (isString(attributes.formInputCheckedFill)) {\n\t\tnode.set({\n\t\t\tformBooleanInputCheckedFillColor:\n\t\t\t\tctx.tokens.resolve(attributes.formInputCheckedFill)?.toCSS() ?? attributes.formInputCheckedFill,\n\t\t})\n\t}\n\n\tcollectBoxShadows(node, \"formBooleanInputCheckedBoxShadow\", {\n\t\tformBooleanInputCheckedBoxShadow: attributes.formInputCheckedBoxShadow,\n\t})\n\n\tconst parsedTransition = parseDSLTransitionString(\n\t\tattributes.formInputCheckedTransition,\n\t\ttweenTransitionSupportedTypes,\n\t\terror => {\n\t\t\twarnings.push(singleWarning(\"formInputCheckedTransition\", attributes.formInputCheckedTransition, error.message))\n\t\t},\n\t)\n\n\tif (parsedTransition) {\n\t\tnode.set({\n\t\t\tformBooleanInputCheckedTransition: transitionWithDefault(\n\t\t\t\tparsedTransition,\n\t\t\t\tnode.formBooleanInputCheckedTransition,\n\t\t\t\tdefaultCheckedTransition(),\n\t\t\t),\n\t\t})\n\t}\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!withFormBooleanInputType(node)) return\n\tconst result: DSLAttributes = {}\n\n\tif (node.formBooleanInputType) {\n\t\tresult.formBooleanInputType = node.formBooleanInputType\n\t}\n\n\tif (typeof node.formBooleanInputValue === \"boolean\") {\n\t\tresult.formBooleanInputValue = String(node.formBooleanInputValue)\n\t}\n\n\tif (node.formBooleanInputCheckedBorderColor) {\n\t\tresult.formInputCheckedBorderColor = node.formBooleanInputCheckedBorderColor\n\t}\n\tif (node.formBooleanInputCheckedBorderWidth) {\n\t\tconst borderValues = parseBorderString(node.formBooleanInputCheckedBorderWidth)\n\t\tresult.formInputCheckedBorderWidth = toRoundedNumber(borderValues.borderWidth)\n\t\tresult.formInputCheckedBorderTop = isNumber(borderValues.borderTop)\n\t\t\t? toRoundedNumber(borderValues.borderTop)\n\t\t\t: undefined\n\t\tresult.formInputCheckedBorderRight = isNumber(borderValues.borderRight)\n\t\t\t? toRoundedNumber(borderValues.borderRight)\n\t\t\t: undefined\n\t\tresult.formInputCheckedBorderBottom = isNumber(borderValues.borderBottom)\n\t\t\t? toRoundedNumber(borderValues.borderBottom)\n\t\t\t: undefined\n\t\tresult.formInputCheckedBorderLeft = isNumber(borderValues.borderLeft)\n\t\t\t? toRoundedNumber(borderValues.borderLeft)\n\t\t\t: undefined\n\t\tresult.formInputCheckedBorderPerSide = borderValues.borderPerSide\n\t}\n\tif (node.formBooleanInputCheckedBorderStyle) {\n\t\tresult.formInputCheckedBorderStyle = node.formBooleanInputCheckedBorderStyle\n\t}\n\tif (node.formBooleanInputCheckedFillColor) {\n\t\tresult.formInputCheckedFill = node.formBooleanInputCheckedFillColor\n\t}\n\tif (node.formBooleanInputCheckedBoxShadow && node.formBooleanInputCheckedBoxShadow.length > 0) {\n\t\tresult.formInputCheckedBoxShadow = node.formBooleanInputCheckedBoxShadow.map(shadow => singleBoxShadowToCSS(shadow))\n\t}\n\tif (node.formBooleanInputCheckedTransition) {\n\t\tresult.formInputCheckedTransition = vekterTransitionToDslTransitionString(node.formBooleanInputCheckedTransition)\n\t}\n\n\treturn result\n}\n\nexport const formBooleanInputType = {\n\tfor: withFormBooleanInputType,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<BooleanInputTypeAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { canLoadedComponentBeFormButtonSource } from \"document/models/CanvasTree/traits/WithFormVariants.ts\"\nimport { isFormContainer, withFormContainer } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\ninterface FormContainerAttributes {\n\tformSubmitButtonId: string | undefined\n}\n\nconst definition: TraitAttributeDefinition<FormContainerAttributes> = {\n\tformSubmitButtonId: {\n\t\tdescription: \"id of the descendant ComponentInstanceNode that acts as the form submit button\",\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withFormContainer(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tif (!isString(attributes.formSubmitButtonId)) return\n\n\tconst primaryId = ctx.treeResolver.get(attributes.formSubmitButtonId)?.getPrimaryId()\n\tif (!primaryId) {\n\t\tthrow new DeferTraitError(`Cannot set formSubmitButtonId: ${attributes.formSubmitButtonId} not found`)\n\t}\n\n\tconst loadedComponent = ctx.forms.deferUntilFormButtonIsLoaded(primaryId)\n\tassert(\n\t\tcanLoadedComponentBeFormButtonSource(loadedComponent),\n\t\t\"form submit button ComponentNode needs htmlTag button on all variants\",\n\t)\n\n\tnode.set({ formSubmitButtonId: primaryId })\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!isFormContainer(node) || !node.formSubmitButtonId) return\n\treturn { formSubmitButtonId: node.formSubmitButtonId }\n}\n\nexport const formContainer = {\n\tfor: withFormContainer,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<FormContainerAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { type WithFormInput, withFormInput } from \"document/models/CanvasTree/traits/forms/WithFormInput.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\tcollectBooleanOrVariableReference,\n\tcollectStringOrVariableReference,\n\tnullString,\n\tunsupportedAttributesWarnings,\n} from \"./helpers.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithFormInput> = {\n\tformInputName: {\n\t\tdescription: `string | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformInputRequired: {\n\t\tdescription: `boolean | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformInputHidden: {\n\t\tdescription: `boolean | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformInputValue: {\n\t\tdescription: `string | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformInputAutoFocus: {\n\t\tdescription: `boolean | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withFormInput(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tcollectStringOrVariableReference(node, \"formInputName\", attributes, ctx)\n\tcollectBooleanOrVariableReference(node, \"formInputRequired\", attributes, ctx)\n\tcollectBooleanOrVariableReference(node, \"formInputHidden\", attributes, ctx)\n\tcollectStringOrVariableReference(node, \"formInputValue\", attributes, ctx)\n\tcollectBooleanOrVariableReference(node, \"formInputAutoFocus\", attributes, ctx)\n}\n\nexport const formInput = {\n\tfor: withFormInput,\n\tdefinition,\n\tfromAttributes,\n} satisfies TraitDefinition<WithFormInput>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithFormInputAutofillEnabled,\n\twithFormInputAutofillEnabled,\n} from \"document/models/CanvasTree/traits/forms/WithFormInputAutofillEnabled.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { collectBooleanOrVariableReference, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithFormInputAutofillEnabled> = {\n\tformInputAutofillEnabled: {\n\t\tdescription: `boolean | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withFormInputAutofillEnabled(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tcollectBooleanOrVariableReference(node, \"formInputAutofillEnabled\", attributes, ctx)\n}\n\nexport const formInputAutofillEnabled = {\n\tfor: withFormInputAutofillEnabled,\n\tdefinition,\n\tfromAttributes,\n} satisfies TraitDefinition<WithFormInputAutofillEnabled>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { getFourPixelNumberShorthand } from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport type { WithBorder } from \"document/models/CanvasTree/traits/WithBorder.ts\"\nimport {\n\ttype WithFormInputFocusedStyles,\n\twithFormInputFocusedStyles,\n} from \"document/models/CanvasTree/traits/forms/WithFormInputFocusedStyles.ts\"\nimport { parseBorderString } from \"document/models/CanvasTree/traits/utils/reduceFormInputFocusedStyles.ts\"\nimport { singleBoxShadowToCSS } from \"utils/boxShadowToCSS.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\tcollectBoxShadows,\n\tfromAttributesToBorderProps,\n\tisNullString,\n\tnullString,\n\tunsupportedAttributesWarnings,\n} from \"./helpers.ts\"\nimport { borderDescription, boxShadowDescription, colorDescription } from \"./traitDescriptions.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype PrefixObjectKeys,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\ninterface FocusedStyleAttributes\n\textends\n\t\tPrefixObjectKeys<WithBorder, \"formInputFocused\">,\n\t\tPick<WithFormInputFocusedStyles, \"formInputFocusedBoxShadow\"> {\n\tformInputFocusedFill: string | undefined\n}\n\nconst definition: TraitAttributeDefinition<FocusedStyleAttributes> = {\n\t...borderDescription(\"formInputFocused\"),\n\tformInputFocusedFill: {\n\t\tdescription: `${colorDescription} | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformInputFocusedBoxShadow: [\n\t\t{\n\t\t\tdescription: boxShadowDescription,\n\t\t\toptional: true,\n\t\t},\n\t],\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withFormInputFocusedStyles(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst warnings: TraitWarning[] = []\n\tconst borderProps = fromAttributesToBorderProps(\"formInputFocused\", node, attributes, ctx, warnings)\n\tif (borderProps.borderEnabled === false) {\n\t\tnode.set({\n\t\t\tformInputFocusedBorderColor: undefined,\n\t\t\tformInputFocusedBorderWidth: undefined,\n\t\t\tformInputFocusedBorderStyle: undefined,\n\t\t})\n\t}\n\n\tif (borderProps.borderColor !== undefined) {\n\t\tnode.set({ formInputFocusedBorderColor: borderProps.borderColor })\n\t}\n\n\tif (borderProps.borderStyle !== undefined) {\n\t\tnode.set({ formInputFocusedBorderStyle: borderProps.borderStyle })\n\t}\n\n\tif (borderProps.borderWidth !== undefined || borderProps.borderPerSide !== undefined) {\n\t\tconst existingBorderValues = parseBorderString(node.formInputFocusedBorderWidth ?? \"0px\")\n\t\tconst borderWidth = getFourPixelNumberShorthand({\n\t\t\tall: borderProps.borderWidth ?? existingBorderValues.borderWidth,\n\t\t\tperSide: borderProps.borderPerSide ?? existingBorderValues.borderPerSide,\n\t\t\ttop: borderProps.borderTop ?? existingBorderValues.borderTop,\n\t\t\tright: borderProps.borderRight ?? existingBorderValues.borderRight,\n\t\t\tbottom: borderProps.borderBottom ?? existingBorderValues.borderBottom,\n\t\t\tleft: borderProps.borderLeft ?? existingBorderValues.borderLeft,\n\t\t})\n\t\tnode.set({ formInputFocusedBorderWidth: borderWidth })\n\t}\n\n\tif (isNullString(attributes.formInputFocusedFill)) {\n\t\tnode.set({ formInputFocusedBackgroundColor: undefined })\n\t} else if (isString(attributes.formInputFocusedFill)) {\n\t\tnode.set({\n\t\t\tformInputFocusedBackgroundColor:\n\t\t\t\tctx.tokens.resolve(attributes.formInputFocusedFill)?.toCSS() ?? attributes.formInputFocusedFill,\n\t\t})\n\t}\n\n\tcollectBoxShadows(node, \"formInputFocusedBoxShadow\", attributes)\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: unknown, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withFormInputFocusedStyles(node)) return\n\tconst result: DSLAttributes = {}\n\n\tif (node.formInputFocusedBorderColor) {\n\t\tresult.formInputFocusedBorderColor =\n\t\t\tctx.tokens.resolve(node.formInputFocusedBorderColor)?.toCSS() ?? node.formInputFocusedBorderColor\n\t}\n\tif (node.formInputFocusedBorderWidth) {\n\t\tconst borderValues = parseBorderString(node.formInputFocusedBorderWidth)\n\t\tresult.formInputFocusedBorderWidth = toRoundedNumber(borderValues.borderWidth)\n\t\tresult.formInputFocusedBorderTop = isNumber(borderValues.borderTop)\n\t\t\t? toRoundedNumber(borderValues.borderTop)\n\t\t\t: undefined\n\t\tresult.formInputFocusedBorderRight = isNumber(borderValues.borderRight)\n\t\t\t? toRoundedNumber(borderValues.borderRight)\n\t\t\t: undefined\n\t\tresult.formInputFocusedBorderBottom = isNumber(borderValues.borderBottom)\n\t\t\t? toRoundedNumber(borderValues.borderBottom)\n\t\t\t: undefined\n\t\tresult.formInputFocusedBorderLeft = isNumber(borderValues.borderLeft)\n\t\t\t? toRoundedNumber(borderValues.borderLeft)\n\t\t\t: undefined\n\t\tresult.formInputFocusedBorderPerSide = borderValues.borderPerSide\n\t}\n\tif (node.formInputFocusedBorderStyle) {\n\t\tresult.formInputFocusedBorderStyle = node.formInputFocusedBorderStyle\n\t}\n\tif (node.formInputFocusedBackgroundColor) {\n\t\tresult.formInputFocusedFill =\n\t\t\tctx.tokens.resolve(node.formInputFocusedBackgroundColor)?.toCSS() ?? node.formInputFocusedBackgroundColor\n\t}\n\tif (node.formInputFocusedBoxShadow && node.formInputFocusedBoxShadow.length > 0) {\n\t\tresult.formInputFocusedBoxShadow = node.formInputFocusedBoxShadow.map(shadow =>\n\t\t\tsingleBoxShadowToCSS(shadow, color => ctx.tokens.resolve(color)?.toCSS()),\n\t\t)\n\t}\n\n\treturn result\n}\n\nexport const formInputFocusedStyle = {\n\tfor: withFormInputFocusedStyles,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<FocusedStyleAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { type WithFormInputIcon, withFormInputIcon } from \"document/models/CanvasTree/traits/forms/WithFormInputIcon.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { assetReferenceToURL, isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { colorDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<Omit<WithFormInputIcon, \"formInputIconImage\">> = {\n\tformInputIconColor: {\n\t\tdescription: `${colorDescription} | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withFormInputIcon(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tif (isNullString(attributes.formInputIconColor)) {\n\t\tnode.set({ formInputIconColor: undefined })\n\t} else if (isString(attributes.formInputIconColor)) {\n\t\tnode.set({\n\t\t\tformInputIconColor: ctx.tokens.resolve(attributes.formInputIconColor)?.toCSS() ?? attributes.formInputIconColor,\n\t\t})\n\t}\n}\n\nfunction toAttributes(node: CanvasNode, _parent: unknown, ctx?: AgentContext): DSLAttributes | undefined {\n\tif (!withFormInputIcon(node)) return\n\tconst result: DSLAttributes = {}\n\n\tif (isString(node.formInputIconImage)) {\n\t\tresult.formInputIconImage = assetReferenceToURL(node.formInputIconImage)\n\t\tctx?.files.registerTrustedUrl(result.formInputIconImage)\n\t}\n\n\tif (node.formInputIconColor) {\n\t\tresult.formInputIconColor = node.formInputIconColor\n\t}\n\n\treturn result\n}\n\nexport const formInputIcon = {\n\tfor: withFormInputIcon,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<Omit<WithFormInputIcon, \"formInputIconImage\">>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { withFormInputInvalidStyles } from \"document/models/CanvasTree/traits/forms/WithFormInputInvalidStyles.ts\"\nimport { withFormInputPlaceholder } from \"document/models/CanvasTree/traits/forms/WithFormInputPlaceholder.ts\"\nimport { nullString } from \"../helpers.ts\"\nimport { colorDescription } from \"../traitDescriptions.ts\"\nimport type { TraitAttributeDefinition } from \"../types.ts\"\n\ninterface FormInputPlaceholderColorAttribute {\n\tformInputPlaceholderColor: string | undefined\n}\n\nexport const formInputPlaceholderColorAttributeDefinition = {\n\tdescription: `${colorDescription} | ${nullString}`,\n\toptional: true,\n} satisfies TraitAttributeDefinition<FormInputPlaceholderColorAttribute>[\"formInputPlaceholderColor\"]\n\nexport const supportsFormInputPlaceholder = withFormInputPlaceholder\n\nexport const supportsFormInputInvalidStyles = withFormInputInvalidStyles\n\nexport function supportsAnyFormInputColorTrait(node: CanvasNode) {\n\treturn supportsFormInputPlaceholder(node) || supportsFormInputInvalidStyles(node)\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { WithFormInputInvalidStyles } from \"document/models/CanvasTree/traits/forms/WithFormInputInvalidStyles.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport {\n\tformInputPlaceholderColorAttributeDefinition,\n\tsupportsAnyFormInputColorTrait,\n\tsupportsFormInputInvalidStyles,\n} from \"./shared/formInputPlaceholderColor.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\ninterface FormInputInvalidStylesAttribute {\n\t/** To make it easier for the agent we let it set formInputInvalidTextColor via formInputPlacehodlerColor because in the UI that is how it is presented. */\n\tformInputPlaceholderColor: WithFormInputInvalidStyles[\"formInputInvalidTextColor\"]\n}\n\nconst definition: TraitAttributeDefinition<FormInputInvalidStylesAttribute> = {\n\tformInputPlaceholderColor: formInputPlaceholderColorAttributeDefinition,\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!supportsFormInputInvalidStyles(node)) {\n\t\tif (supportsAnyFormInputColorTrait(node)) return\n\t\treturn unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\t}\n\n\tif (isNullString(attributes.formInputPlaceholderColor)) {\n\t\tnode.set({ formInputInvalidTextColor: undefined })\n\t} else if (isString(attributes.formInputPlaceholderColor)) {\n\t\tnode.set({\n\t\t\tformInputInvalidTextColor:\n\t\t\t\tctx.tokens.resolve(attributes.formInputPlaceholderColor)?.toCSS() ?? attributes.formInputPlaceholderColor,\n\t\t})\n\t}\n}\n\nfunction toAttributes(node: CanvasNode, _parent: unknown, ctx: AgentContext) {\n\tif (!supportsFormInputInvalidStyles(node)) return undefined\n\n\treturn {\n\t\tformInputPlaceholderColor: isString(node.formInputInvalidTextColor)\n\t\t\t? (ctx.tokens.resolve(node.formInputInvalidTextColor)?.toCSS() ?? node.formInputInvalidTextColor)\n\t\t\t: node.formInputInvalidTextColor,\n\t} satisfies DSLAttributes\n}\n\nexport const formInputInvalidStyles = {\n\tfor: supportsFormInputInvalidStyles,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<FormInputInvalidStylesAttribute>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { WithFormInputPlaceholder } from \"document/models/CanvasTree/traits/forms/WithFormInputPlaceholder.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { collectStringOrVariableReference, isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport {\n\tformInputPlaceholderColorAttributeDefinition,\n\tsupportsAnyFormInputColorTrait,\n\tsupportsFormInputPlaceholder,\n} from \"./shared/formInputPlaceholderColor.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\ntype FormInputPlaceholderAttribute = Pick<\n\tWithFormInputPlaceholder,\n\t\"formInputPlaceholder\" | \"formInputPlaceholderColor\"\n>\n\nconst definition: TraitAttributeDefinition<FormInputPlaceholderAttribute> = {\n\tformInputPlaceholder: {\n\t\tdescription: `string | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformInputPlaceholderColor: formInputPlaceholderColorAttributeDefinition,\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!supportsFormInputPlaceholder(node)) {\n\t\tconst unsupportedDefinition = supportsAnyFormInputColorTrait(node)\n\t\t\t? { ...definition, formInputPlaceholderColor: undefined }\n\t\t\t: definition\n\t\treturn unsupportedAttributesWarnings(node, attributes, unsupportedDefinition, ctx)\n\t}\n\n\tcollectStringOrVariableReference(node, \"formInputPlaceholder\", attributes, ctx)\n\n\tif (isNullString(attributes.formInputPlaceholderColor)) {\n\t\tnode.set({ formInputPlaceholderColor: undefined })\n\t} else if (isString(attributes.formInputPlaceholderColor)) {\n\t\tnode.set({\n\t\t\tformInputPlaceholderColor:\n\t\t\t\tctx.tokens.resolve(attributes.formInputPlaceholderColor)?.toCSS() ?? attributes.formInputPlaceholderColor,\n\t\t})\n\t}\n}\n\nexport const formInputPlaceholder = {\n\tfor: supportsFormInputPlaceholder,\n\tdefinition,\n\tfromAttributes,\n} satisfies TraitDefinition<FormInputPlaceholderAttribute>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { type WithFormInputStep, withFormInputStep } from \"document/models/CanvasTree/traits/forms/WithFormInputStep.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { collectNumberOrVariableReference, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithFormInputStep> = {\n\tformInputStep: {\n\t\tdescription: `number | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withFormInputStep(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tcollectNumberOrVariableReference(node, \"formInputStep\", attributes, ctx)\n}\n\nexport const formInputStep = {\n\tfor: withFormInputStep,\n\tdefinition,\n\tfromAttributes,\n} satisfies TraitDefinition<WithFormInputStep>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithFormTextInputType,\n\tinputTypes,\n\tisTextInputType,\n\twithFormTextInputType,\n} from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\tcollectBooleanOrVariableReference,\n\tcollectNumberOrVariableReference,\n\tisNullString,\n\tnullString,\n\tunsupportedAttributesWarnings,\n} from \"./helpers.ts\"\nimport { traitNotAppliedWarning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithFormTextInputType> = {\n\tformTextInputType: {\n\t\tdescription: `${inputTypes.join(\" | \")} | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformTextAreaResizable: {\n\t\tdescription: `boolean | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformTextInputMinNumber: {\n\t\tdescription: `number | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformTextInputMaxNumber: {\n\t\tdescription: `number | ${nullString}`,\n\t\toptional: true,\n\t},\n\tformInputMaxLength: {\n\t\tdescription: `number | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction collectTextInputType(\n\tnode: CanvasNode & WithFormTextInputType,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n) {\n\tconst value = attributes.formTextInputType\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, { node })\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tnode.set({ formTextInputType: resolveHandleResult.handle.reference(node) })\n\t\treturn\n\t}\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(\n\t\t\t...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"formTextInputType\", message)),\n\t\t)\n\t\treturn\n\t}\n\n\tif (isNullString(value)) {\n\t\tnode.set({ formTextInputType: undefined })\n\t\treturn\n\t}\n\n\tif (isTextInputType(value)) {\n\t\tnode.set({ formTextInputType: value })\n\t}\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withFormTextInputType(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst warnings: TraitWarning[] = []\n\tcollectTextInputType(node, attributes, ctx, warnings)\n\tcollectBooleanOrVariableReference(node, \"formTextAreaResizable\", attributes, ctx, warnings)\n\tcollectNumberOrVariableReference(node, \"formTextInputMinNumber\", attributes, ctx, warnings)\n\tcollectNumberOrVariableReference(node, \"formTextInputMaxNumber\", attributes, ctx, warnings)\n\tcollectNumberOrVariableReference(node, \"formInputMaxLength\", attributes, ctx, warnings)\n\treturn warnings\n}\n\nexport const formInputType = {\n\tfor: withFormTextInputType,\n\tdefinition,\n\tfromAttributes,\n} satisfies TraitDefinition<WithFormTextInputType>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype FormSelectOption,\n\tdefaultFormSelectOption,\n\twithFormSelect,\n} from \"document/models/CanvasTree/traits/forms/WithFormSelect.ts\"\nimport { isArray, isObject, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\ntype FormSelectOptionDSL = Required<Omit<FormSelectOption, \"id\" | \"titleLocalized\">>\n\ninterface FormSelectTrait {\n\tformSelectOptions: FormSelectOptionDSL[]\n}\n\nconst definition: TraitAttributeDefinition<FormSelectTrait> = {\n\tformSelectOptions: [\n\t\t{\n\t\t\ttype: { description: \"option | divider\", optional: true },\n\t\t\tvalue: { description: `string | ${nullString}`, optional: true },\n\t\t\ttitle: { description: `string | ${nullString}`, optional: true },\n\t\t\tdisabled: { description: `boolean | ${nullString}`, optional: true },\n\t\t},\n\t],\n}\n\nfunction parseOptionType(value: unknown): \"option\" | \"divider\" | undefined {\n\tif (value === \"option\" || value === \"divider\") return value\n\treturn undefined\n}\n\nfunction mergeOption(base: FormSelectOption, incoming: DSLAttributes): FormSelectOption {\n\tconst result = { ...base }\n\n\tconst type = parseOptionType(incoming.type)\n\tif (type) result.type = type\n\n\tif (isNullString(incoming.value)) {\n\t\tresult.value = undefined\n\t} else if (isString(incoming.value)) {\n\t\tresult.value = incoming.value\n\t}\n\n\tif (isNullString(incoming.title)) {\n\t\tresult.title = undefined\n\t} else if (isString(incoming.title)) {\n\t\tresult.title = incoming.title\n\t}\n\n\tif (isNullString(incoming.disabled)) {\n\t\tresult.disabled = undefined\n\t} else if (incoming.disabled === true || incoming.disabled === \"true\") {\n\t\tresult.disabled = true\n\t} else if (incoming.disabled === false || incoming.disabled === \"false\") {\n\t\tresult.disabled = false\n\t}\n\n\treturn result\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withFormSelect(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst { formSelectOptions } = attributes\n\tif (!isArray(formSelectOptions)) return\n\n\tif (formSelectOptions.length === 0) {\n\t\tnode.set({ formSelectOptions: undefined })\n\t\treturn\n\t}\n\n\tconst result: FormSelectOption[] = []\n\n\tfor (const [index, value] of formSelectOptions.entries()) {\n\t\tconst existing = node.formSelectOptions?.[index]\n\n\t\tif (!value && existing) {\n\t\t\tresult.push(existing)\n\t\t\tcontinue\n\t\t}\n\n\t\tif (value && isObject(value)) {\n\t\t\tresult.push(mergeOption(existing ?? defaultFormSelectOption(), value))\n\t\t}\n\t}\n\n\tnode.set({ formSelectOptions: result })\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!withFormSelect(node)) return\n\n\tconst options = node.formSelectOptions\n\tif (!isArray(options) || options.length === 0) return\n\n\treturn {\n\t\tformSelectOptions: options.map(option => {\n\t\t\tconst result: DSLAttributes = { type: option.type }\n\t\t\tif (option.value !== undefined) result.value = option.value\n\t\t\tif (option.title !== undefined) result.title = option.title\n\t\t\tif (option.disabled !== undefined) result.disabled = String(option.disabled)\n\t\t\treturn result\n\t\t}),\n\t}\n}\n\nexport const formSelect = {\n\tfor: withFormSelect,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<FormSelectTrait>\n", "/**\n * A type-safe version of Object.keys.\n */\nexport function keys<T extends object>(obj: T): Array<keyof T> {\n\treturn Object.keys(obj) as Array<keyof T>\n}\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\ttype WithFormVariants,\n\tisFormSubmitButtonInstance,\n\twithFormVariants,\n} from \"document/models/CanvasTree/traits/WithFormVariants.ts\"\nimport { withFormContainer } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport { isEmptyObject } from \"library/utils/utils.ts\"\nimport { keys } from \"utils/keys.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport { singleWarning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\nexport type FormVariantsTraitAttributes = Pick<\n\tWithFormVariants,\n\t\"formButtonSuccessVariant\" | \"formButtonPendingVariant\" | \"formButtonErrorVariant\" | \"formButtonIncompleteVariant\"\n>\n\nconst definition = {\n\tformButtonSuccessVariant: {\n\t\tdescription: `submit button variant id | ${nullString}`,\n\t},\n\tformButtonPendingVariant: {\n\t\tdescription: `submit button variant id | ${nullString}`,\n\t},\n\tformButtonErrorVariant: {\n\t\tdescription: `submit button variant id | ${nullString}`,\n\t},\n\tformButtonIncompleteVariant: {\n\t\tdescription: `submit button variant id | ${nullString}`,\n\t},\n} as const satisfies TraitAttributeDefinition<FormVariantsTraitAttributes>\n\nconst variantProperties = keys(definition)\n\nexport const formVariants = {\n\tfor: withFormVariants,\n\tdefinition: {\n\t\tformButtonSuccessVariant: {\n\t\t\tdescription: `submit button variant id | ${nullString}`,\n\t\t},\n\t\tformButtonPendingVariant: {\n\t\t\tdescription: `submit button variant id | ${nullString}`,\n\t\t},\n\t\tformButtonErrorVariant: {\n\t\t\tdescription: `submit button variant id | ${nullString}`,\n\t\t},\n\t\tformButtonIncompleteVariant: {\n\t\t\tdescription: `submit button variant id | ${nullString}`,\n\t\t},\n\t},\n\tfromAttributes: (node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) => {\n\t\tif (!withFormVariants(node)) return\n\n\t\tconst settingAnyVariant =\n\t\t\tattributes.formButtonSuccessVariant ||\n\t\t\tattributes.formButtonPendingVariant ||\n\t\t\tattributes.formButtonErrorVariant ||\n\t\t\tattributes.formButtonIncompleteVariant\n\t\tif (!settingAnyVariant) return\n\n\t\tif (!isCodeComponentNode(node) || !isFormSubmitButtonInstance(ctx.treeStore.tree, node)) {\n\t\t\tthrow new DeferTraitError(\"Cannot set form variants: node is not a form submit button\")\n\t\t}\n\n\t\tconst formContainer = ctx.treeStore.tree.getNodeWithTrait(node.cache.formContainerAncestorId, withFormContainer)\n\t\tif (!formContainer) {\n\t\t\tthrow new DeferTraitError(\"Cannot set form variants: form container not found\")\n\t\t}\n\n\t\tif (!formContainer.formSubmitButtonId) {\n\t\t\tthrow new Error(\"Cannot set form variants: form container has no form submit button\")\n\t\t}\n\n\t\tconst sourceButton = ctx.forms.deferUntilFormButtonIsLoaded(formContainer.formSubmitButtonId)\n\t\tconst variants = sourceButton.getVariants()\n\n\t\tconst formVariantsUpdate: Partial<WithFormVariants> = {}\n\t\tconst warnings: ReturnType<typeof singleWarning>[] = []\n\n\t\tfor (const variantProperty of variantProperties) {\n\t\t\tif (isNullString(attributes[variantProperty])) {\n\t\t\t\tformVariantsUpdate[variantProperty] = undefined\n\t\t\t\tformVariantsUpdate[`${variantProperty}Enabled`] = false\n\t\t\t} else if (typeof attributes[variantProperty] === \"string\") {\n\t\t\t\tif (!variants.some(v => v.id === attributes[variantProperty])) {\n\t\t\t\t\twarnings.push(\n\t\t\t\t\t\tsingleWarning(variantProperty, attributes[variantProperty], \"a valid variant of the source button\"),\n\t\t\t\t\t)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tformVariantsUpdate[variantProperty] = attributes[variantProperty]\n\t\t\t\tformVariantsUpdate[`${variantProperty}Enabled`] = true\n\t\t\t}\n\t\t}\n\n\t\tif (!isEmptyObject(formVariantsUpdate)) {\n\t\t\tnode.set(formVariantsUpdate)\n\t\t}\n\n\t\tif (warnings.length > 0) return warnings\n\t},\n\ttoAttributes: (node, _parent, _ctx) => {\n\t\tif (!withFormVariants(node)) return\n\n\t\tconst result: DSLAttributes = {}\n\n\t\tfor (const variant of variantProperties) {\n\t\t\tif (node[`${variant}Enabled`] && node[variant]) {\n\t\t\t\tresult[variant] = node[variant]\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t},\n} satisfies TraitDefinition<FormVariantsTraitAttributes>\n", "import { assert, isEmptyObject, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport { getScopeTypeForScope } from \"document/base-engine/BaseScopeStore.ts\"\nimport {\n\tcreateDismissOverlayAction,\n\tcreateShowOverlayAction,\n} from \"document/models/CanvasTree/actions/overlayActions.ts\"\nimport {\n\ttype SetVariableActionSupportedVariableDefinition,\n\tisValidVariableForSetVariableValueAction,\n\tisValidVariableTypeForSetVariableValueAction,\n} from \"document/models/CanvasTree/actions/setVariableValueActions.ts\"\nimport {\n\tcreateTriggerEventAction,\n\ttriggerEventActionKeys,\n} from \"document/models/CanvasTree/actions/triggerEventActions.ts\"\nimport { createSetVariantAction, setVariantActionKeys } from \"document/models/CanvasTree/actions/variantActions.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport {\n\tisCodeComponentNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isFixedOrRelativeOverlay } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { frameEventKeys, isFrameEvent, withFrameEvents } from \"document/models/CanvasTree/traits/WithFrameEvents.ts\"\nimport { isOptionalVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport {\n\tHardCodedCodeIdentifier,\n\tisHardCodedCodeIdentifier,\n} from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport { variableTypesMatching } from \"document/models/CanvasTree/traits/utils/isVariableType.ts\"\nimport { isEventAction, type EventAction } from \"document/models/EventAction.ts\"\nimport type { RawControlProps } from \"document/models/controlProps/RawControlProp.ts\"\nimport { isRawControlProp } from \"document/models/controlProps/RawControlProp.ts\"\nimport { isPrefixedControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport type { PropertyControls } from \"library/render/types/PropertyControls.ts\"\nimport type { Mutable } from \"utils/Mutable.ts\"\nimport { isArray, isBoolean, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { createCSSVariable, isVariableReferenceHandle, looksLikeVariableReference } from \"../context/dynamicValues.ts\"\nimport {\n\tComponentInstanceNodeClass,\n\tComponentNodeClass,\n\tDismissOverlayActionName,\n\tResetVariableValuesActionName,\n\tSetVariableValueActionName,\n\tSetVariantActionName,\n\tShowOverlayActionName,\n\tTriggerEventActionName,\n} from \"../dsl.ts\"\nimport { getUniqueEventHandlerAttributeKeys } from \"../eventHandlerKeys.ts\"\nimport { booleanString, multiCollectionReferenceArray, numericString } from \"../schemaUtils.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\tinvalidCodeComponentEventHandlerMessage,\n\tsingleWarning,\n\ttraitNotAppliedWarning,\n\tunresolvedVariableMessage,\n\tunsupportedAttributeMessage,\n\tvectorSetItemEventHandlerMessage,\n} from \"./invalidValues.ts\"\nimport { variableDescription } from \"./traitDescriptions.ts\"\nimport {\n\tnodeToDSLType,\n\ttoRoundedNumber,\n\ttype DSLAttributeValue,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\nimport { zodErrorToWarnings } from \"./zodErrorToWarnings.ts\"\n\nconst setVariantControlsSchema = z.object({ variant: z.string() }).strict()\nconst showOverlayControlsSchema = z.object({ overlay: z.string() }).strict()\nconst triggerEventControlsSchema = z.object({ id: z.string() }).strict()\nconst setVariableValueControlsSchema = z.object({ variable: z.string(), value: z.unknown() }).strict()\nconst expectedActionDelayValue = 'a non-negative time value like \"0.6s\" or \"600ms\", or \"null\"'\n\ntype LiteralValueControlType = Exclude<SetVariableActionSupportedVariableDefinition[\"type\"], \"controlReference\">\n\nconst literalValueSchemas: Record<LiteralValueControlType, z.ZodType> = {\n\t[ControlType.Boolean]: z.union([z.boolean(), booleanString]),\n\t[ControlType.Number]: z.union([z.number(), numericString]),\n\t[ControlType.String]: z.string(),\n\t[ControlType.Enum]: z.string(),\n\t[ControlType.Date]: z.string(),\n\t[ControlType.CollectionReference]: z.string(),\n\t[ControlType.MultiCollectionReference]: multiCollectionReferenceArray,\n}\n\nconst supportedVariableTypes = variableTypesMatching(isValidVariableTypeForSetVariableValueAction)\n\nfunction isLiteralValueControlType(type: ControlType): type is LiteralValueControlType {\n\treturn type in literalValueSchemas\n}\n\ntype SetVariantDSLControls = z.infer<typeof setVariantControlsSchema>\n\nfunction normalizeSetVariantControls(controls: SetVariantDSLControls): {\n\ttype: \"set\" | \"cycle\"\n\tvariantId?: string\n} {\n\tif (controls.variant === \"cycle\") return { type: \"cycle\" }\n\treturn { type: \"set\", variantId: controls.variant }\n}\n\ninterface ActionDefinition {\n\tname: string\n\tdescription: string\n\tcontrols: Record<string, string>\n\tnotes?: string[]\n}\n\nconst availableActionDefinitions: Record<string, ActionDefinition> = {\n\t[HardCodedCodeIdentifier.setVariantAction]: {\n\t\tname: SetVariantActionName,\n\t\tdescription: \"Set the active variant of the component, or cycle to the next variant.\",\n\t\tcontrols: {\n\t\t\tvariant: \"<variant-id | cycle>\",\n\t\t},\n\t\tnotes: [\n\t\t\t'When a component has only two variants, prefer `controls.variant=\"cycle\"` over referencing a specific variant id.',\n\t\t],\n\t},\n\t[HardCodedCodeIdentifier.showOverlayAction]: {\n\t\tname: ShowOverlayActionName,\n\t\tdescription: \"Show a fixed or relative overlay.\",\n\t\tcontrols: {\n\t\t\toverlay: \"<overlay-id>\",\n\t\t},\n\t},\n\t[HardCodedCodeIdentifier.dismissOverlayAction]: {\n\t\tname: DismissOverlayActionName,\n\t\tdescription: \"Dismiss the current overlay.\",\n\t\tcontrols: {},\n\t},\n\t[HardCodedCodeIdentifier.triggerEventAction]: {\n\t\tname: TriggerEventActionName,\n\t\tdescription: `Trigger an EventHandler variable from the same ${ComponentNodeClass}.`,\n\t\tcontrols: {\n\t\t\tid: \"var(--variable-<event-handler-variable-id>)\",\n\t\t},\n\t\tnotes: [\n\t\t\t`The \\`id\\` must reference an EventHandler variable in the same ${ComponentNodeClass}.`,\n\t\t\t\"Prefer the CSS variable form instead of a raw id string.\",\n\t\t],\n\t},\n\t[HardCodedCodeIdentifier.setVariableValueAction]: {\n\t\tname: SetVariableValueActionName,\n\t\tdescription: \"Set a variable to a specific value.\",\n\t\tcontrols: {\n\t\t\tvariable: variableDescription,\n\t\t\tvalue: `<value | ${variableDescription} | ${nullString}>`,\n\t\t},\n\t\tnotes: [\n\t\t\t`The value can be a literal matching the variable's type (${supportedVariableTypes.join(\", \")}) or a variable reference (${variableDescription}).`,\n\t\t\t`Use ${nullString} to clear the value of an optional variable.`,\n\t\t],\n\t},\n\t[HardCodedCodeIdentifier.resetVariableValuesAction]: {\n\t\tname: ResetVariableValuesActionName,\n\t\tdescription: \"Reset all variables in the current page to their initial values.\",\n\t\tcontrols: {},\n\t},\n}\n\nfunction formatDefinitions(definitions: readonly ActionDefinition[]): string {\n\treturn definitions\n\t\t.flatMap(({ notes, ...definition }) => [\n\t\t\t`- ${JSON.stringify(definition)}`,\n\t\t\t...(notes ?? []).map(note => `  - ${note}`),\n\t\t])\n\t\t.join(\"\\n\")\n}\n\nexport function formatActionDefinitions(\n\tactionIdentifiers?: readonly (keyof typeof availableActionDefinitions)[],\n): string {\n\tif (!actionIdentifiers) return formatDefinitions(Object.values(availableActionDefinitions))\n\n\treturn formatDefinitions(\n\t\tactionIdentifiers.flatMap(identifier => {\n\t\t\tconst definition = availableActionDefinitions[identifier]\n\t\t\treturn definition ? [definition] : []\n\t\t}),\n\t)\n}\n\nconst availableActions = Object.entries(availableActionDefinitions).reduce<{\n\t[title: string]: HardCodedCodeIdentifier\n}>((acc, [key, value]) => {\n\tassert(isHardCodedCodeIdentifier(key), \"Invalid hard coded code identifier\")\n\tacc[value.name] = key\n\treturn acc\n}, {})\n\nfunction isActionTitle(title: unknown): title is keyof typeof availableActions {\n\treturn isString(title) && title in availableActions\n}\n\nfunction isActionIdentifier(identifier: unknown): identifier is keyof typeof availableActionDefinitions {\n\treturn isString(identifier) && identifier in availableActionDefinitions\n}\n\nfunction toActionTitle(actionIdentifier: string): string | undefined {\n\t// Relative overlays are a document-model distinction; both variants must\n\t// round-trip through the single AI-facing SHOW_OVERLAY action definition.\n\tif (isShowOverlayIdentifier(actionIdentifier)) {\n\t\treturn availableActionDefinitions[HardCodedCodeIdentifier.showOverlayAction]?.name\n\t}\n\tif (!isActionIdentifier(actionIdentifier)) return\n\treturn availableActionDefinitions[actionIdentifier]?.name\n}\n\ninterface FrameEventAttributes {\n\t\"<event-handler>\": {\n\t\taction: string\n\t\tcontrols?: Record<string, string | number | boolean | undefined>\n\t\tdelay?: `${number}s` | \"null\"\n\t}[]\n}\n\nconst definition: TraitAttributeDefinition<FrameEventAttributes> = {\n\t\"<event-handler>\": [\n\t\t{\n\t\t\taction: {\n\t\t\t\t// A single action results in LLMs sometimes setting <ACTION> instead of ACTION. Adding\n\t\t\t\t// \"NONE\" disambiguates this until we add additional actions.\n\t\t\t\tdescription: [...Object.keys(availableActions), \"NONE\"].join(\" | \"),\n\t\t\t},\n\t\t\tcontrols: {\n\t\t\t\t\"<control-name>\": {\n\t\t\t\t\tdescription: \"value\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tdelay: {\n\t\t\t\tdescription: \"${number}s | null\",\n\t\t\t},\n\t\t},\n\t],\n}\n\n/**\n * Build RawControlProps from key->value controls using the action definition's property types.\n */\nfunction createRawControlProps(properties: PropertyControls, controls: unknown): RawControlProps | undefined {\n\tif (!isObject(controls) || isEmptyObject(controls)) return\n\n\tconst result: Mutable<RawControlProps> = {}\n\tfor (const key in controls) {\n\t\tconst propDef = properties[key]\n\t\tif (!propDef) continue\n\t\tresult[key] = { type: propDef.type, value: controls[key] }\n\t}\n\n\tif (isEmptyObject(result)) return\n\n\treturn result\n}\n\nconst resolvedIdKeys = new Set<string>([setVariantActionKeys.variantId, \"overlay\"])\n\nfunction isShowOverlayIdentifier(\n\tactionIdentifier: string,\n): actionIdentifier is HardCodedCodeIdentifier.showOverlayAction | HardCodedCodeIdentifier.showRelativeOverlayAction {\n\treturn (\n\t\tactionIdentifier === HardCodedCodeIdentifier.showOverlayAction ||\n\t\tactionIdentifier === HardCodedCodeIdentifier.showRelativeOverlayAction\n\t)\n}\n\nfunction resolveShowOverlayTarget(triggerNode: CanvasNode, overlayIdentifier: string, ctx: AgentContext): CanvasNode {\n\tconst overlayNode = ctx.treeResolver.get(overlayIdentifier)\n\tif (!overlayNode) throw new DeferTraitError(`Cannot show overlay: \"${overlayIdentifier}\" is not a valid id.`)\n\tif (!isFixedOrRelativeOverlay(overlayNode)) {\n\t\tthrow new DeferTraitError(`Cannot show overlay: \"${overlayIdentifier}\" is not an overlay.`)\n\t}\n\tconst overlayParent = ctx.treeResolver.getParentNode(overlayNode)\n\tif (!overlayParent || overlayParent.id !== triggerNode.id) {\n\t\tthrow new DeferTraitError(\n\t\t\t`Cannot show overlay: \"${overlayIdentifier}\" must be a direct child of \"${triggerNode.id}\".`,\n\t\t)\n\t}\n\treturn overlayNode\n}\n\nfunction resolveTriggerEventVariableId(node: CanvasNode, variableIdentifier: string, ctx: AgentContext): string {\n\tconst scopeNode = ctx.treeResolver.getScopeNodeFor(node.id)\n\tif (!scopeNode || !isSmartComponentNode(scopeNode)) {\n\t\tthrow new DeferTraitError(`Cannot trigger event: \"${node.id}\" is not inside a ${ComponentNodeClass}.`)\n\t}\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(variableIdentifier, {\n\t\texpectedType: [ControlType.EventHandler],\n\t\tnode,\n\t})\n\tif (\n\t\tresolveHandleResult.type !== \"resolved\" ||\n\t\t!isVariableReferenceHandle(resolveHandleResult.handle) ||\n\t\tresolveHandleResult.handle.scopeId !== scopeNode.id\n\t) {\n\t\tthrow new DeferTraitError(\n\t\t\t`Cannot trigger event: \"${variableIdentifier}\" is not an EventHandler variable in ${ComponentNodeClass} \"${scopeNode.id}\".`,\n\t\t)\n\t}\n\n\treturn resolveHandleResult.handle.variable.id\n}\n\nfunction validateShowOverlayControls(\n\ttriggerNode: CanvasNode,\n\tactionIdentifier: string,\n\tcontrols: RawControlProps,\n\tctx: AgentContext,\n): RawControlProps {\n\tif (!isShowOverlayIdentifier(actionIdentifier)) return controls\n\tconst overlayControl = controls.overlay\n\tif (!isRawControlProp(overlayControl) || !isString(overlayControl.value)) return controls\n\tresolveShowOverlayTarget(triggerNode, overlayControl.value, ctx)\n\treturn controls\n}\n\nfunction resolveIds(rawControlProps: RawControlProps, ctx: AgentContext): RawControlProps {\n\tfor (const key in rawControlProps) {\n\t\tconst prop = rawControlProps[key]\n\t\tif (prop && isString(prop.value) && resolvedIdKeys.has(key)) {\n\t\t\tconst id = ctx.treeResolver.get(prop.value)?.id\n\t\t\tif (!id) throw new DeferTraitError(`Cannot set ${key}: ${prop.value} is not a valid id.`)\n\t\t\tprop.value = id\n\t\t}\n\t}\n\treturn rawControlProps\n}\n\nfunction expandDSLControls(actionIdentifier: string, controls: unknown): unknown {\n\tif (actionIdentifier !== HardCodedCodeIdentifier.setVariantAction) return controls\n\tif (!isObject(controls)) return controls\n\tconst variant = controls.variant\n\tif (!isString(variant)) return controls\n\treturn normalizeSetVariantControls({ variant })\n}\n\nfunction getUpdatedActionIdentifier(\n\tnode: CanvasNode,\n\tcurrent: EventAction,\n\tresolvedControls: RawControlProps,\n\tctx: AgentContext,\n): EventAction[\"actionIdentifier\"] {\n\tif (!isShowOverlayIdentifier(current.actionIdentifier)) return current.actionIdentifier\n\n\tconst overlayControl = resolvedControls.overlay\n\tif (!isRawControlProp(overlayControl) || !isString(overlayControl.value)) return current.actionIdentifier\n\n\tconst overlayNode = resolveShowOverlayTarget(node, overlayControl.value, ctx)\n\treturn hasFloatingPosition(overlayNode)\n\t\t? HardCodedCodeIdentifier.showRelativeOverlayAction\n\t\t: HardCodedCodeIdentifier.showOverlayAction\n}\n\nfunction updateAction(\n\tnode: CanvasNode,\n\tcurrent: EventAction,\n\tupdate: Record<string, unknown>,\n\tctx: AgentContext,\n\teventKey: string,\n\twarnings: TraitWarning[],\n): EventAction | undefined {\n\tswitch (current.actionIdentifier) {\n\t\tcase HardCodedCodeIdentifier.setVariableValueAction:\n\t\t\treturn updateSetVariableValueAction(node, current, update, ctx, eventKey, warnings)\n\t\tdefault:\n\t\t\treturn updateGenericAction(node, current, update, ctx)\n\t}\n}\n\nfunction updateGenericAction(\n\tnode: CanvasNode,\n\tcurrent: EventAction,\n\tupdate: Record<string, unknown>,\n\tctx: AgentContext,\n): EventAction | undefined {\n\tif (current.actionIdentifier === HardCodedCodeIdentifier.triggerEventAction) {\n\t\tconst parsed = triggerEventControlsSchema.safeParse(update.controls)\n\t\tif (!parsed.success) return\n\n\t\tconst variableId = resolveTriggerEventVariableId(node, parsed.data.id, ctx)\n\t\treturn { ...createTriggerEventAction(variableId, current.identifier), meta: current.meta }\n\t}\n\n\tconst actionInfo = ctx.componentLoader.componentForIdentifier(current.actionIdentifier)\n\tif (!actionInfo?.properties) return\n\n\tconst controls = expandDSLControls(current.actionIdentifier, update.controls)\n\tconst rawControlProps = createRawControlProps(actionInfo.properties, controls)\n\tif (!rawControlProps) return\n\n\tconst resolvedControls = resolveIds(rawControlProps, ctx)\n\tvalidateShowOverlayControls(node, current.actionIdentifier, resolvedControls, ctx)\n\n\treturn {\n\t\t...current,\n\t\tactionIdentifier: getUpdatedActionIdentifier(node, current, resolvedControls, ctx),\n\t\tcontrols: { ...current.controls, ...resolvedControls },\n\t}\n}\n\nfunction withActionDelay(\n\taction: EventAction,\n\tupdate: Record<string, unknown>,\n\tdelayKey: string,\n\twarnings: TraitWarning[],\n): EventAction {\n\tif (!(\"delay\" in update)) return action\n\n\tconst delay = update.delay\n\tif (isNullString(delay)) {\n\t\tconst { delay: _delay, ...meta } = action.meta ?? {}\n\t\treturn { ...action, meta: isEmptyObject(meta) ? undefined : meta }\n\t}\n\n\tconst delayInSeconds = parseActionDelay(delay)\n\tif (isNumber(delayInSeconds)) {\n\t\treturn { ...action, meta: { ...action.meta, delay: delayInSeconds } }\n\t}\n\n\twarnings.push(singleWarning(delayKey, delay, expectedActionDelayValue))\n\treturn action\n}\n\nfunction parseActionDelay(value: unknown): number | undefined {\n\tif (isNumber(value)) return value >= 0 ? value : undefined\n\tif (!isString(value)) return\n\n\tconst [numberValue, unit] = parseCSSDimension(value, \"s\")\n\tif (Number.isNaN(numberValue) || numberValue < 0) return\n\n\tswitch (unit) {\n\t\tcase \"s\":\n\t\t\treturn numberValue\n\t\tcase \"ms\":\n\t\t\treturn numberValue / 1000\n\t\tdefault:\n\t\t\treturn\n\t}\n}\n\nfunction preserveReplacementActionDelay(\n\taction: EventAction,\n\tcurrent: EventAction,\n\tupdate: Record<string, unknown>,\n): EventAction {\n\tif (\"delay\" in update || !isNumber(current.meta?.delay)) return action\n\treturn { ...action, meta: { ...action.meta, delay: current.meta.delay } }\n}\n\nfunction updateSetVariableValueAction(\n\tnode: CanvasNode,\n\tcurrent: EventAction,\n\tupdate: Record<string, unknown>,\n\tctx: AgentContext,\n\teventKey: string,\n\twarnings: TraitWarning[],\n): EventAction | undefined {\n\tconst result = buildSetVariableValueControls(node, eventKey, update.controls, ctx)\n\tif (!result.success) {\n\t\twarnings.push(...result.warnings)\n\t\treturn\n\t}\n\treturn { ...current, controls: { ...current.controls, ...result.controls } }\n}\n\nfunction createAction(\n\tnode: CanvasNode,\n\tinput: DSLAttributes,\n\tctx: AgentContext,\n\teventKey: string,\n\tdelayKey: string,\n\twarnings: TraitWarning[],\n): EventAction | undefined {\n\tconst { action, controls } = input\n\tif (!isActionTitle(action)) return\n\n\tconst actionIdentifier = availableActions[action]\n\tif (!isActionIdentifier(actionIdentifier)) return\n\n\tswitch (actionIdentifier) {\n\t\tcase HardCodedCodeIdentifier.setVariantAction: {\n\t\t\tconst scopeNode = ctx.treeResolver.getScopeNodeFor(node.id)\n\t\t\tif (!scopeNode || !isSmartComponentNode(scopeNode)) return\n\t\t\tconst parsed = setVariantControlsSchema.safeParse(controls)\n\t\t\tif (!parsed.success) return\n\t\t\tconst model = createSetVariantAction(normalizeSetVariantControls(parsed.data))\n\t\t\treturn withActionDelay({ ...model, controls: resolveIds(model.controls, ctx) }, input, delayKey, warnings)\n\t\t}\n\t\tcase HardCodedCodeIdentifier.triggerEventAction: {\n\t\t\tconst parsed = triggerEventControlsSchema.safeParse(controls)\n\t\t\tif (!parsed.success) return\n\n\t\t\treturn withActionDelay(\n\t\t\t\tcreateTriggerEventAction(resolveTriggerEventVariableId(node, parsed.data.id, ctx)),\n\t\t\t\tinput,\n\t\t\t\tdelayKey,\n\t\t\t\twarnings,\n\t\t\t)\n\t\t}\n\t\tcase HardCodedCodeIdentifier.showOverlayAction: {\n\t\t\tconst parsed = showOverlayControlsSchema.safeParse(controls)\n\t\t\tif (!parsed.success) return\n\t\t\tconst overlayNode = resolveShowOverlayTarget(node, parsed.data.overlay, ctx)\n\t\t\treturn withActionDelay(\n\t\t\t\tcreateShowOverlayAction(\n\t\t\t\t\toverlayNode.id,\n\t\t\t\t\thasFloatingPosition(overlayNode)\n\t\t\t\t\t\t? HardCodedCodeIdentifier.showRelativeOverlayAction\n\t\t\t\t\t\t: HardCodedCodeIdentifier.showOverlayAction,\n\t\t\t\t),\n\t\t\t\tinput,\n\t\t\t\tdelayKey,\n\t\t\t\twarnings,\n\t\t\t)\n\t\t}\n\t\tcase HardCodedCodeIdentifier.dismissOverlayAction:\n\t\t\treturn withActionDelay(createDismissOverlayAction(), input, delayKey, warnings)\n\t\tcase HardCodedCodeIdentifier.setVariableValueAction: {\n\t\t\tconst result = buildSetVariableValueControls(node, eventKey, controls, ctx)\n\t\t\tif (!result.success) {\n\t\t\t\twarnings.push(...result.warnings)\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn withActionDelay(\n\t\t\t\t{\n\t\t\t\t\tidentifier: randomID(),\n\t\t\t\t\tactionIdentifier: HardCodedCodeIdentifier.setVariableValueAction,\n\t\t\t\t\tcontrols: result.controls,\n\t\t\t\t},\n\t\t\t\tinput,\n\t\t\t\tdelayKey,\n\t\t\t\twarnings,\n\t\t\t)\n\t\t}\n\t\tcase HardCodedCodeIdentifier.resetVariableValuesAction: {\n\t\t\tconst action = createResetVariableValuesAction(node, eventKey, ctx, warnings)\n\t\t\treturn action ? withActionDelay(action, input, delayKey, warnings) : undefined\n\t\t}\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\ntype BuildSetVariableValueControlsResult =\n\t| { success: true; controls: RawControlProps }\n\t| { success: false; warnings: TraitWarning[] }\n\nfunction buildSetVariableValueControls(\n\tnode: CanvasNode,\n\teventKey: string,\n\tcontrols: unknown,\n\tctx: AgentContext,\n): BuildSetVariableValueControlsResult {\n\tconst scopeNode = ctx.treeResolver.getScopeNodeFor(node.id)\n\n\tif (!scopeNode || !(isSmartComponentNode(scopeNode) || isWebPageNode(scopeNode))) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\twarnings: [\n\t\t\t\tsingleWarning(\n\t\t\t\t\teventKey,\n\t\t\t\t\tnode.id,\n\t\t\t\t\t`a node inside a ${ComponentNodeClass} or ${ClassDiscriminator.WebPageNode} that supports variables`,\n\t\t\t\t),\n\t\t\t],\n\t\t}\n\t}\n\n\tconst parsed = setVariableValueControlsSchema.safeParse(controls)\n\n\tif (!parsed.success) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\twarnings: [singleWarning(`${eventKey}.controls`, controls, \"an object with `variable` and `value` keys\")],\n\t\t}\n\t}\n\n\tconst resolveVariableHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(parsed.data.variable, { node })\n\n\tif (resolveVariableHandleResult.type === \"invalid\") {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\twarnings: resolveVariableHandleResult.errorMessages.map(message =>\n\t\t\t\ttraitNotAppliedWarning(`${eventKey}.controls.variable`, message),\n\t\t\t),\n\t\t}\n\t}\n\n\tif (\n\t\tresolveVariableHandleResult.type !== \"resolved\" ||\n\t\t!isVariableReferenceHandle(resolveVariableHandleResult.handle)\n\t) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\twarnings: [singleWarning(`${eventKey}.controls.variable`, parsed.data.variable, unresolvedVariableMessage)],\n\t\t}\n\t}\n\n\tif (!isValidVariableForSetVariableValueAction(resolveVariableHandleResult.handle.variable)) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\twarnings: [\n\t\t\t\tsingleWarning(\n\t\t\t\t\t`${eventKey}.controls.variable`,\n\t\t\t\t\tparsed.data.variable,\n\t\t\t\t\t`a variable with a value type ${supportedVariableTypes.join(\", \")}`,\n\t\t\t\t),\n\t\t\t],\n\t\t}\n\t}\n\n\tconst variableControlType = valueControlTypeForVariable(resolveVariableHandleResult.handle.variable)\n\tconst variableIdControl = { type: ControlType.String, value: resolveVariableHandleResult.handle.variable.id }\n\n\tif (looksLikeVariableReference(parsed.data.value)) {\n\t\tconst resolveValueHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(parsed.data.value, { node })\n\n\t\tif (resolveValueHandleResult.type === \"invalid\") {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\twarnings: resolveValueHandleResult.errorMessages.map(message =>\n\t\t\t\t\ttraitNotAppliedWarning(`${eventKey}.controls.value`, message),\n\t\t\t\t),\n\t\t\t}\n\t\t}\n\n\t\tif (resolveValueHandleResult.type !== \"resolved\" || !isVariableReferenceHandle(resolveValueHandleResult.handle)) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\twarnings: [singleWarning(`${eventKey}.controls.value`, parsed.data.value, unresolvedVariableMessage)],\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tcontrols: {\n\t\t\t\tvariableId: variableIdControl,\n\t\t\t\tvalue: { type: variableControlType, value: resolveValueHandleResult.handle.reference(node) },\n\t\t\t},\n\t\t}\n\t}\n\n\tif (isNullString(parsed.data.value)) {\n\t\tif (!isOptionalVariable(resolveVariableHandleResult.handle.variable, getScopeTypeForScope(scopeNode))) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\twarnings: [\n\t\t\t\t\tsingleWarning(`${eventKey}.controls.value`, parsed.data.value, \"only optional variables can be cleared\"),\n\t\t\t\t],\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tcontrols: {\n\t\t\t\tvariableId: variableIdControl,\n\t\t\t\tvalue: { type: variableControlType, value: undefined },\n\t\t\t},\n\t\t}\n\t}\n\n\tassert(\n\t\tisLiteralValueControlType(variableControlType),\n\t\t`Unsupported type ${variableControlType} for ${SetVariableValueActionName}`,\n\t)\n\n\tconst literalValueSchema = literalValueSchemas[variableControlType]\n\tconst result = literalValueSchema.safeParse(parsed.data.value)\n\tif (!result.success) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\twarnings: zodErrorToWarnings({\n\t\t\t\terror: result.error,\n\t\t\t\tschema: literalValueSchema,\n\t\t\t\tkeyPrefix: `${eventKey}.controls.value`,\n\t\t\t\tinput: parsed.data.value,\n\t\t\t}),\n\t\t}\n\t}\n\n\treturn {\n\t\tsuccess: true,\n\t\tcontrols: {\n\t\t\tvariableId: variableIdControl,\n\t\t\tvalue: { type: variableControlType, value: result.data },\n\t\t},\n\t}\n}\n\nfunction valueControlTypeForVariable(variable: SetVariableActionSupportedVariableDefinition): ControlType {\n\tif (variable.type !== \"controlReference\") return variable.type\n\tif (variable.expectedType === ControlType.SegmentedEnum) return ControlType.Enum\n\treturn variable.expectedType\n}\n\nfunction createResetVariableValuesAction(\n\tnode: CanvasNode,\n\teventKey: string,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n): EventAction | undefined {\n\tconst scopeNode = ctx.treeResolver.getScopeNodeFor(node.id)\n\tif (!scopeNode || !(isSmartComponentNode(scopeNode) || isWebPageNode(scopeNode))) {\n\t\twarnings.push(\n\t\t\tsingleWarning(eventKey, node.id, `a node inside a ${ComponentNodeClass} or ${ClassDiscriminator.WebPageNode}`),\n\t\t)\n\t\treturn\n\t}\n\n\treturn {\n\t\tidentifier: randomID(),\n\t\tactionIdentifier: HardCodedCodeIdentifier.resetVariableValuesAction,\n\t\tcontrols: {},\n\t}\n}\n\ninterface Action {\n\taction: keyof typeof availableActions\n\tcontrols: Record<string, unknown>\n}\n\nfunction isMatchingAction(current: EventAction, item: Partial<Action>): boolean {\n\tif (!item.action) return true\n\n\tconst itemAction = availableActions[item.action]\n\tif (!itemAction) return false\n\n\tif (itemAction === HardCodedCodeIdentifier.showOverlayAction) {\n\t\treturn isShowOverlayIdentifier(current.actionIdentifier)\n\t}\n\n\treturn current.actionIdentifier === itemAction\n}\n\ninterface EventActionTarget {\n\tattributeKey: string\n\tcurrentActions: EventAction[]\n\tsetActions: (actions: EventAction[]) => void\n}\n\ninterface CodeComponentEventHandle {\n\tcontrols: NonNullable<ReturnType<AgentContext[\"components\"][\"forIdentifier\"]>>[\"controls\"]\n\tproperties: Record<string, PropertyControls[string] | undefined>\n}\n\ninterface CodeComponentEventTarget extends EventActionTarget {\n\tcontrolKey: string\n\tcontrolName: string\n}\n\nconst potentialCodeComponentEventAttributeKey = /^on(?:$|[A-Z\\d])/u\n\nfunction isCodeComponentEventControl(\n\tcontrol: PropertyControls[string] | undefined,\n): control is Extract<PropertyControls[string], { type: ControlType.EventHandler }> {\n\treturn control?.type === ControlType.EventHandler\n}\n\ninterface GetCodeComponentEventHandleOptions {\n\tdeferUntilLoaded?: boolean\n}\n\nfunction getCodeComponentEventHandle(\n\tnode: CanvasNode,\n\tctx: AgentContext,\n\toptions?: GetCodeComponentEventHandleOptions,\n): CodeComponentEventHandle | undefined {\n\tif (!isCodeComponentNode(node) || !isModuleExportIdentifier(node.codeComponentIdentifier)) return\n\n\tconst component = ctx.components.forIdentifier(node.codeComponentIdentifier, {\n\t\tdeferUntilLoaded: options?.deferUntilLoaded,\n\t})\n\tconst controls = component?.controls\n\tconst properties = controls?.properties()\n\tif (!controls || !properties) return\n\n\treturn { controls, properties }\n}\n\nfunction getCodeComponentEventTargets(\n\tnode: CanvasNode,\n\tctx: AgentContext,\n\toptions?: GetCodeComponentEventHandleOptions,\n): CodeComponentEventTarget[] {\n\tconst handle = getCodeComponentEventHandle(node, ctx, options)\n\tif (!handle || !isCodeComponentNode(node)) return []\n\n\treturn createCodeComponentEventTargets(node, handle)\n}\n\nasync function getCodeComponentEventTargetsAsync(\n\tnode: CanvasNode,\n\tctx: AgentContext,\n): Promise<CodeComponentEventTarget[]> {\n\tif (!isCodeComponentNode(node) || !isModuleExportIdentifier(node.codeComponentIdentifier)) return []\n\n\tconst component = await ctx.components.async.forIdentifier(node.codeComponentIdentifier)\n\tconst controls = component?.controls\n\tconst properties = controls?.properties()\n\tif (!controls || !properties) return []\n\n\treturn createCodeComponentEventTargets(node, { controls, properties })\n}\n\nfunction createCodeComponentEventTargets(\n\tnode: CanvasNode,\n\thandle: CodeComponentEventHandle,\n): CodeComponentEventTarget[] {\n\tassert(isCodeComponentNode(node), \"Expected a code component node\")\n\n\tconst result: Omit<CodeComponentEventTarget, \"attributeKey\">[] = []\n\tfor (const controlKey in handle.properties) {\n\t\tconst control = handle.properties[controlKey]\n\t\tif (!isCodeComponentEventControl(control)) continue\n\n\t\tconst controlName = handle.controls.getControlTitle(controlKey) ?? controlKey\n\t\tconst controlProp = node.getRawControlProp(controlKey)\n\t\tconst currentActions =\n\t\t\tisArray(controlProp?.value) && controlProp.value.every(isEventAction) ? controlProp.value : []\n\t\tresult.push({\n\t\t\tcontrolKey,\n\t\t\tcontrolName,\n\t\t\tcurrentActions,\n\t\t\tsetActions: actions => {\n\t\t\t\tnode.setControlProp(controlKey, { type: ControlType.EventHandler, value: actions })\n\t\t\t},\n\t\t})\n\t}\n\n\tconst attributeKeys = getUniqueEventHandlerAttributeKeys(result.map(target => target.controlName))\n\treturn result.map((target, index) => ({\n\t\t...target,\n\t\tattributeKey: attributeKeys[index] ?? \"onEvent\",\n\t}))\n}\n\nfunction getUnloadedCodeComponentDefinitionId(node: CanvasNode, ctx: AgentContext): string | undefined {\n\tif (!isCodeComponentNode(node) || !isModuleExportIdentifier(node.codeComponentIdentifier)) return\n\tif (ctx.components.forIdentifier(node.codeComponentIdentifier)) return\n\treturn ctx.components.getIdForModuleIdentifier(node.codeComponentIdentifier)\n}\n\nfunction deferUntilCodeComponentDefinitionLoads(node: CanvasNode, componentId: string, ctx: AgentContext): never {\n\tif (!isCodeComponentNode(node) || !isModuleExportIdentifier(node.codeComponentIdentifier)) {\n\t\tthrow new DeferTraitError(`Component definition for \"${componentId}\" is not loaded`)\n\t}\n\tconst identifier = node.codeComponentIdentifier\n\n\tctx.deferred.deferUntil(\n\t\t() => ctx.components.async.forIdentifier(identifier),\n\t\t`Component definition for \"${componentId}\" is not loaded`,\n\t)\n}\n\nfunction describeCodeComponentEventTarget(target: CodeComponentEventTarget): string {\n\treturn target.attributeKey\n}\n\nfunction formatCodeComponentEventTargets(nodeId: string, eventTargets: readonly CodeComponentEventTarget[]): string {\n\tif (eventTargets.length === 0) return `No EventHandler controls are available on \"${nodeId}\".`\n\n\treturn `Valid handlers: ${eventTargets.map(describeCodeComponentEventTarget).join(\", \")}.`\n}\n\nfunction isPotentialCodeComponentEventAttributeKey(key: string): boolean {\n\treturn potentialCodeComponentEventAttributeKey.test(key)\n}\n\nfunction isPotentialCodeComponentEventValue(value: unknown): value is DSLAttributeValue[] {\n\treturn isArray(value) && value.every(item => isUndefined(item) || isNullString(item) || isObject(item))\n}\n\nfunction resolveEventActions(\n\tnode: CanvasNode,\n\tcurrentActions: readonly EventAction[] | undefined,\n\tvalue: readonly DSLAttributeValue[],\n\tctx: AgentContext,\n\teventKey: string,\n\twarnings: TraitWarning[],\n): EventAction[] {\n\tconst result: EventAction[] = []\n\n\tfor (let i = 0; i < value.length; i++) {\n\t\tconst item = value[i]\n\t\tconst delayKey = `${eventKey}.${i}.delay`\n\t\t// If the item is \"null\", filter it from the output.\n\t\tif (isNullString(item)) continue\n\n\t\t// If the item is undefined, or not an action object, use the current action if it exists.\n\t\tconst current = currentActions?.[i]\n\t\tif (isUndefined(item) || !isObject(item)) {\n\t\t\tif (current) result.push(current)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Update the current action if they are the same type.\n\t\tif (current && isMatchingAction(current, item)) {\n\t\t\tconst updated = withActionDelay(\n\t\t\t\tupdateAction(node, current, item, ctx, eventKey, warnings) ?? current,\n\t\t\t\titem,\n\t\t\t\tdelayKey,\n\t\t\t\twarnings,\n\t\t\t)\n\t\t\tresult.push(updated)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Otherwise replace/add the new action.\n\t\tconst createdAction = createAction(node, item, ctx, eventKey, delayKey, warnings)\n\t\tconst action =\n\t\t\tcreatedAction && current\n\t\t\t\t? preserveReplacementActionDelay(createdAction, current, item)\n\t\t\t\t: (createdAction ?? current)\n\t\tif (!action) continue\n\t\tresult.push(action)\n\t}\n\n\t// Keep any current actions beyond the value array length.\n\tif (currentActions && currentActions.length > value.length) {\n\t\tresult.push(...currentActions.slice(value.length))\n\t}\n\n\treturn result\n}\n\nfunction fromFrameEventAttributes(\n\tnode: CanvasNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): TraitWarning[] | undefined {\n\tconst supportsFrameEvents = withFrameEvents(node)\n\tconst warnings: TraitWarning[] = []\n\tconst nodeType = !supportsFrameEvents ? nodeToDSLType(node, ctx) : node.__class\n\n\tfor (const eventKey of frameEventKeys) {\n\t\tconst value = attributes[eventKey]\n\t\tif (isUndefined(value)) continue\n\n\t\tif (!supportsFrameEvents) {\n\t\t\tif (isCodeComponentNode(node)) {\n\t\t\t\t// Code component event keys are handled by `componentEvents`, which can\n\t\t\t\t// report the specific valid handler names for the current component.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: eventKey,\n\t\t\t\tmessage: isVectorSetItem(node)\n\t\t\t\t\t? vectorSetItemEventHandlerMessage(nodeType, ClassDiscriminator.FrameNode, eventKey)\n\t\t\t\t\t: unsupportedAttributeMessage(nodeType),\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!isArray(value)) continue\n\n\t\tnode.set({ [eventKey]: resolveEventActions(node, node[eventKey], value, ctx, eventKey, warnings) })\n\t}\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction fromComponentEventAttributes(\n\tnode: CanvasNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): TraitWarning[] | undefined {\n\tif (!isCodeComponentNode(node)) return\n\n\tconst eventTargets = getCodeComponentEventTargets(node, ctx, { deferUntilLoaded: true })\n\tconst eventTargetsByAttributeKey = new Map(eventTargets.map(target => [target.attributeKey, target]))\n\tconst unloadedComponentId = getUnloadedCodeComponentDefinitionId(node, ctx)\n\tconst warnings: TraitWarning[] = []\n\n\tfor (const [eventKey, value] of Object.entries(attributes)) {\n\t\tif (isPrefixedControlPropKey(eventKey) || !isPotentialCodeComponentEventValue(value)) continue\n\n\t\tconst target = eventTargetsByAttributeKey.get(eventKey)\n\t\tif (!target) {\n\t\t\tif (!isPotentialCodeComponentEventAttributeKey(eventKey) || value.length === 0) continue\n\n\t\t\t// Standard frame event keys (onTap, onMouseEnter, \u2026) are not valid on code\n\t\t\t// components that don't expose a matching EventHandler control. Report them\n\t\t\t// as unsupported on the node type rather than as invalid EventHandler events,\n\t\t\t// which would confuse the agent into looking for EventHandler controls.\n\t\t\tif (isFrameEvent(eventKey) && eventTargets.length === 0) {\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: eventKey,\n\t\t\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (unloadedComponentId) {\n\t\t\t\tdeferUntilCodeComponentDefinitionLoads(node, unloadedComponentId, ctx)\n\t\t\t}\n\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: eventKey,\n\t\t\t\tmessage: invalidCodeComponentEventHandlerMessage(\n\t\t\t\t\teventKey,\n\t\t\t\t\tnode.id,\n\t\t\t\t\tformatCodeComponentEventTargets(node.id, eventTargets),\n\t\t\t\t),\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\ttarget.setActions(resolveEventActions(node, target.currentActions, value, ctx, eventKey, warnings))\n\t}\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction serializeSetVariantControls(action: EventAction): DSLAttributes | undefined {\n\tconst typeControl = action.controls[setVariantActionKeys.type]\n\tif (!isRawControlProp(typeControl) || !isString(typeControl.value)) return\n\n\tif (typeControl.value === \"cycle\") return { variant: \"cycle\" }\n\n\tconst variantIdControl = action.controls[setVariantActionKeys.variantId]\n\tif (!isRawControlProp(variantIdControl) || !isString(variantIdControl.value)) return\n\n\treturn { variant: variantIdControl.value }\n}\n\nfunction serializeGenericControls(action: EventAction, ctx: AgentContext): DSLAttributes | undefined {\n\tconst actionInfo = ctx.componentLoader.componentForIdentifier(action.actionIdentifier)\n\tif (!actionInfo?.properties) return\n\n\tconst controls: DSLAttributes = {}\n\tfor (const key in actionInfo.properties) {\n\t\tconst control = action.controls[key]\n\t\tif (isUndefined(control) || !isRawControlProp(control)) continue\n\t\tif (!isString(control.value) && !isNumber(control.value) && !isBoolean(control.value)) continue\n\t\tcontrols[key] = isNumber(control.value) ? toRoundedNumber(control.value) : control.value\n\t}\n\n\tif (isEmptyObject(controls)) return\n\n\treturn controls\n}\n\nfunction serializeShowOverlayControls(action: EventAction): DSLAttributes | undefined {\n\tconst overlayControl = action.controls.overlay\n\tif (!isRawControlProp(overlayControl) || !isString(overlayControl.value)) return\n\treturn { overlay: overlayControl.value }\n}\n\nfunction serializeTriggerEventControls(action: EventAction): DSLAttributes | undefined {\n\tconst idControl = action.controls[triggerEventActionKeys.id]\n\tif (!isRawControlProp(idControl) || !isString(idControl.value)) return\n\treturn { id: createCSSVariable(idControl.value) }\n}\n\nfunction serializeSetVariableValueControls(\n\taction: EventAction,\n\tnode: CanvasNode,\n\tctx: AgentContext,\n): DSLAttributes | undefined {\n\tconst variableIdControl = action.controls.variableId\n\tif (!isRawControlProp(variableIdControl) || !isString(variableIdControl.value)) return\n\n\tconst handle = ctx.dynamicValues.getVariableReferenceHandleByVariableId(variableIdControl.value)\n\tif (!isVariableReferenceHandle(handle)) return\n\n\tconst valueControl = action.controls.value\n\tif (!isRawControlProp(valueControl)) return\n\n\tconst serializedValue = serializeSetVariableValueValue(valueControl.value, node, ctx)\n\tif (isUndefined(serializedValue)) return\n\n\treturn { variable: handle.toAttributes(node), value: serializedValue }\n}\n\nfunction serializeSetVariableValueValue(value: unknown, node: CanvasNode, ctx: AgentContext): DSLAttributeValue {\n\tif (isUndefined(value)) return nullString\n\tif (isBoolean(value) || isString(value)) return value\n\tif (isNumber(value)) return toRoundedNumber(value)\n\tif (isArray(value) && value.every(isString)) return value\n\n\tif (!isVariableReference(value)) return\n\n\tconst valueHandle = ctx.dynamicValues.resolveAttributeFromDynamicValue(value, node)\n\tif (valueHandle) return valueHandle\n}\n\nfunction serializeControls(action: EventAction, node: CanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tswitch (action.actionIdentifier) {\n\t\tcase HardCodedCodeIdentifier.setVariantAction:\n\t\t\treturn serializeSetVariantControls(action)\n\t\tcase HardCodedCodeIdentifier.triggerEventAction:\n\t\t\treturn serializeTriggerEventControls(action)\n\t\tcase HardCodedCodeIdentifier.showOverlayAction:\n\t\tcase HardCodedCodeIdentifier.showRelativeOverlayAction:\n\t\t\treturn serializeShowOverlayControls(action)\n\t\tcase HardCodedCodeIdentifier.dismissOverlayAction:\n\t\tcase HardCodedCodeIdentifier.resetVariableValuesAction:\n\t\t\treturn {}\n\t\tcase HardCodedCodeIdentifier.setVariableValueAction:\n\t\t\treturn serializeSetVariableValueControls(action, node, ctx)\n\t\tdefault:\n\t\t\treturn serializeGenericControls(action, ctx)\n\t}\n}\n\nfunction serializeEventActions(actions: readonly EventAction[], node: CanvasNode, ctx: AgentContext): DSLAttributes[] {\n\tconst serialized: DSLAttributes[] = []\n\tfor (const action of actions) {\n\t\tconst controls = serializeControls(action, node, ctx)\n\t\tif (!controls) continue\n\n\t\tconst actionTitle = toActionTitle(action.actionIdentifier)\n\t\tif (!actionTitle) continue\n\n\t\tserialized.push({\n\t\t\taction: actionTitle,\n\t\t\tcontrols,\n\t\t\t...(isNumber(action.meta?.delay) ? { delay: createCSSDimension(toRoundedNumber(action.meta.delay), \"s\") } : {}),\n\t\t})\n\t}\n\treturn serialized\n}\n\nfunction toFrameEventAttributes(\n\tnode: CanvasNode,\n\t_parent: CanvasNode | null | undefined,\n\tctx: AgentContext,\n): DSLAttributes | undefined {\n\tif (!withFrameEvents(node)) return\n\n\tconst result: DSLAttributes = {}\n\tfor (const eventKey of frameEventKeys) {\n\t\tconst actions = node[eventKey]\n\t\tif (!isArray(actions) || actions.length === 0) continue\n\n\t\tconst events = serializeEventActions(actions, node, ctx)\n\t\tif (events.length === 0) continue\n\n\t\tresult[eventKey] = events\n\t}\n\n\tif (isEmptyObject(result)) return\n\n\treturn result\n}\n\nasync function toComponentEventAttributes(\n\tnode: CanvasNode,\n\t_parent: CanvasNode | null | undefined,\n\tctx: AgentContext,\n): Promise<DSLAttributes | undefined> {\n\tif (!isCodeComponentNode(node)) return\n\n\tconst result: DSLAttributes = {}\n\tfor (const target of await getCodeComponentEventTargetsAsync(node, ctx)) {\n\t\tif (target.currentActions.length === 0) continue\n\n\t\tconst events = serializeEventActions(target.currentActions, node, ctx)\n\t\tif (events.length === 0) continue\n\n\t\tresult[target.attributeKey] = events\n\t}\n\n\tif (isEmptyObject(result)) return\n\n\treturn result\n}\n\nexport const frameEvents = {\n\tfor: { guard: withFrameEvents },\n\tdefinition,\n\tfromAttributes: fromFrameEventAttributes,\n\ttoAttributes: toFrameEventAttributes,\n} satisfies TraitDefinition<FrameEventAttributes>\n\nexport const componentEvents = {\n\tfor: { nodes: [ComponentInstanceNodeClass] },\n\tdefinition,\n\tfromAttributes: fromComponentEventAttributes,\n\ttoAttributes: toComponentEventAttributes,\n} satisfies TraitDefinition<FrameEventAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { couldCollapse } from \"document/models/CanvasTree/nodes/utils/couldCollapse.ts\"\nimport {\n\ttype WithGridItemLayout,\n\tisSupportedGridItemAlignment,\n\twithGridItemLayout,\n} from \"document/models/CanvasTree/traits/WithGridItemLayout.ts\"\nimport { type WithGridItemSize, withGridItemSize } from \"document/models/CanvasTree/traits/WithGridItemSize.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isBooleanString, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithGridItemLayout & WithGridItemSize> = {\n\tgridItemFillCellWidth: {\n\t\tdescription: \"boolean\",\n\t\toptional: true,\n\t},\n\tgridItemFillCellHeight: {\n\t\tdescription: \"boolean\",\n\t\toptional: true,\n\t},\n\tgridItemHorizontalAlignment: {\n\t\tdescription: \"start | center | end\",\n\t\toptional: true,\n\t},\n\tgridItemVerticalAlignment: {\n\t\tdescription: \"start | center | end\",\n\t\toptional: true,\n\t},\n\tgridItemColumnSpan: {\n\t\tdescription: \"number | all\",\n\t\toptional: true,\n\t},\n\tgridItemRowSpan: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withGridItemLayout(node) || !withGridItemSize(node)) {\n\t\treturn unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\n\tif (isBooleanString(attributes.gridItemFillCellWidth)) {\n\t\tnode.set({ gridItemFillCellWidth: attributes.gridItemFillCellWidth === \"true\" })\n\t}\n\n\tif (isBooleanString(attributes.gridItemFillCellHeight)) {\n\t\tnode.set({ gridItemFillCellHeight: attributes.gridItemFillCellHeight === \"true\" })\n\t\tconst draft = node.draftOrCurrent()\n\t\tif (\n\t\t\tattributes.gridItemFillCellHeight === \"true\" &&\n\t\t\tdraft.cache.parentDirected === \"grid\" &&\n\t\t\tdraft.cache.parentDirectedRowHeightType !== \"fixed\" &&\n\t\t\tcouldCollapse(draft)\n\t\t) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: true,\n\t\t\t\tkey: \"gridItemFillCellHeight\",\n\t\t\t\tmessage:\n\t\t\t\t\t'This grid item can collapse when filling row height. Prefer fit content (\"auto\") or fixed row height.',\n\t\t\t})\n\t\t}\n\t}\n\n\tif (isString(attributes.gridItemHorizontalAlignment)) {\n\t\tnode.set({\n\t\t\tgridItemHorizontalAlignment: isSupportedGridItemAlignment(attributes.gridItemHorizontalAlignment)\n\t\t\t\t? attributes.gridItemHorizontalAlignment\n\t\t\t\t: undefined,\n\t\t})\n\t}\n\tif (isString(attributes.gridItemVerticalAlignment)) {\n\t\tnode.set({\n\t\t\tgridItemVerticalAlignment: isSupportedGridItemAlignment(attributes.gridItemVerticalAlignment)\n\t\t\t\t? attributes.gridItemVerticalAlignment\n\t\t\t\t: undefined,\n\t\t})\n\t}\n\tif (isString(attributes.gridItemColumnSpan)) {\n\t\tconst value = attributes.gridItemColumnSpan === \"all\" ? \"all\" : tryParseNumber(attributes.gridItemColumnSpan, true)\n\t\tnode.set({ gridItemColumnSpan: value })\n\t}\n\n\tif (isString(attributes.gridItemRowSpan)) {\n\t\tconst value = tryParseNumber(attributes.gridItemRowSpan, true)\n\t\tnode.set({ gridItemRowSpan: value })\n\t}\n\n\treturn warnings\n}\n\nfunction withGridItem<T extends CanvasNode>(node: T): node is T & WithGridItemLayout & WithGridItemSize {\n\treturn withGridItemLayout(node) && withGridItemSize(node)\n}\n\nexport const gridItem = {\n\tfor: withGridItem,\n\tdefinition,\n\tfromAttributes,\n} satisfies TraitDefinition<WithGridItemLayout & WithGridItemSize>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport {\n\ttype WithWhileHover,\n\thasWhileHover,\n\twhileHoverEnabledDefaults,\n\twithWhileHover,\n} from \"document/models/CanvasTree/traits/WithWhileHover.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { EffectType, effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { parseBoxShadows } from \"document/models/CanvasTree/traits/utils/parseBoxShadowFromStyle.ts\"\nimport { singleBoxShadowToCSS } from \"utils/boxShadowToCSS.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, parseRotateShorthand, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { breakpointUnsupportedMessage, singleWarning } from \"./invalidValues.ts\"\nimport { colorDescription } from \"./traitDescriptions.ts\"\nimport {\n\teffectTransitionDefinition,\n\teffectTransitionSupportedTypes,\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitToAttributesOutput,\n} from \"./types.ts\"\n\n// Hover and tap effects share the same schema\nexport const dslHoverOrTapEffectSchema = z.object({\n\topacity: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tx: z\n\t\t.string()\n\t\t.transform(value => parseCSSDimension(value, \"px\")[0])\n\t\t.optional()\n\t\t.catch(undefined),\n\ty: z\n\t\t.string()\n\t\t.transform(value => parseCSSDimension(value, \"px\")[0])\n\t\t.optional()\n\t\t.catch(undefined),\n\tscale: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\trotate: z\n\t\t.string()\n\t\t.transform(value => parseRotateShorthand(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tskewX: z\n\t\t.string()\n\t\t.transform(value => parseCSSDimension(value, \"deg\")[0])\n\t\t.optional()\n\t\t.catch(undefined),\n\tskewY: z\n\t\t.string()\n\t\t.transform(value => parseCSSDimension(value, \"deg\")[0])\n\t\t.optional()\n\t\t.catch(undefined),\n\tbackgroundColor: z.string().optional().catch(undefined),\n\tshadow: z.string().optional().catch(undefined),\n\ttransition: z.string().optional().catch(undefined),\n})\n\ntype ParsedDSLHoverOrTapEffect = z.output<typeof dslHoverOrTapEffectSchema>\ntype RoundedParsedDSLHoverOrTapEffect = TraitToAttributesOutput<ParsedDSLHoverOrTapEffect>\nexport type DSLHoverOrTapEffect = Omit<\n\tRoundedParsedDSLHoverOrTapEffect,\n\t\"opacity\" | \"scale\" | \"rotate\" | \"x\" | \"y\" | \"skewX\" | \"skewY\"\n> & {\n\topacity?: RoundedParsedDSLHoverOrTapEffect[\"opacity\"]\n\tscale?: RoundedParsedDSLHoverOrTapEffect[\"scale\"]\n\tx?: `${number}px`\n\ty?: `${number}px`\n\tskewX?: `${number}deg`\n\tskewY?: `${number}deg`\n\trotate?: `${number}deg` | `${number}deg ${number}deg ${number}deg`\n}\n\nexport const hoverOrTapEffectDefinition: TraitAttributeDefinition<DSLHoverOrTapEffect> = {\n\topacity: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n\tx: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\ty: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tscale: {\n\t\tdescription: \"number\",\n\t\texamples: [\"0.9\", \"1.1\", \"1.5\"],\n\t\toptional: true,\n\t},\n\trotate: {\n\t\tdescription: \"${z}deg | ${x}deg ${y}deg ${z}deg\",\n\t\texamples: [\"-15deg\", \"15deg 45deg 90deg\"],\n\t\toptional: true,\n\t},\n\tskewX: {\n\t\tdescription: \"${number}deg\",\n\t\toptional: true,\n\t},\n\tskewY: {\n\t\tdescription: \"${number}deg\",\n\t\toptional: true,\n\t},\n\tbackgroundColor: {\n\t\tdescription: `${colorDescription} | ${nullString}`,\n\t\toptional: true,\n\t},\n\tshadow: {\n\t\tdescription: `{\"inset\" | \"\"} {offsetX}px {offsetY}px {blur}px {spread}px {${colorDescription}} | ${nullString}`,\n\t\toptional: true,\n\t},\n\ttransition: effectTransitionDefinition,\n}\n\nconst definition: TraitAttributeDefinition<{ hoverEffect: DSLHoverOrTapEffect }> = {\n\thoverEffect: hoverOrTapEffectDefinition,\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withWhileHover(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst { hoverEffect } = attributes\n\n\tif (isBreakpointVariant(node) && !isUndefined(hoverEffect)) {\n\t\treturn [{ applied: false, key: \"hoverEffect\", message: breakpointUnsupportedMessage(\"hover effects\") }]\n\t}\n\n\tif (isNullString(hoverEffect)) {\n\t\tnode.set({ whileHoverEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslHoverOrTapEffectSchema.safeParse(hoverEffect)\n\tif (!parsed.success) return\n\n\tconst { opacity, x, y, scale, rotate, skewX, skewY, backgroundColor, shadow, transition } = parsed.data\n\tconst update: Partial<WithWhileHover> = {}\n\n\tif (isNumber(opacity)) update.whileHoverOpacity = opacity\n\tif (isNumber(x)) update.whileHoverX = x\n\tif (isNumber(y)) update.whileHoverY = y\n\tif (isNumber(scale)) update.whileHoverScale = scale\n\n\tif (!isUndefined(rotate)) {\n\t\tif (isNumber(rotate)) {\n\t\t\tupdate.whileHoverRotate3d = false\n\t\t\tupdate.whileHoverRotate = rotate\n\t\t} else {\n\t\t\tupdate.whileHoverRotate3d = true\n\t\t\tupdate.whileHoverRotate = rotate.rotateZ\n\t\t\tupdate.whileHoverRotateX = rotate.rotateX\n\t\t\tupdate.whileHoverRotateY = rotate.rotateY\n\t\t}\n\t}\n\n\tif (isNumber(skewX)) update.whileHoverSkewX = skewX\n\tif (isNumber(skewY)) update.whileHoverSkewY = skewY\n\n\tif (isString(backgroundColor)) {\n\t\tif (isNullString(backgroundColor)) {\n\t\t\tupdate.whileHoverBackgroundColor = undefined\n\t\t} else {\n\t\t\tconst value = ctx.tokens.resolve(backgroundColor)?.toCSS() ?? backgroundColor\n\t\t\tupdate.whileHoverBackgroundColor = value\n\t\t}\n\t}\n\n\tif (isString(shadow)) {\n\t\tif (isNullString(shadow)) {\n\t\t\tupdate.whileHoverBoxShadow = undefined\n\t\t} else {\n\t\t\tconst boxShadows = parseBoxShadows(shadow)\n\t\t\tif (boxShadows.length > 0) update.whileHoverBoxShadow = boxShadows[0]\n\t\t}\n\t}\n\n\tconst warnings: ReturnType<typeof singleWarning>[] = []\n\tconst parsedTransition = parseDSLTransitionString(transition, effectTransitionSupportedTypes, error => {\n\t\twarnings.push(singleWarning(\"hoverEffect.transition\", transition, error.message))\n\t})\n\n\tif (parsedTransition) {\n\t\tupdate.whileHoverTransition = transitionWithDefault(\n\t\t\tparsedTransition,\n\t\t\tnode.whileHoverTransition,\n\t\t\teffectConfig[EffectType.Hover].enabledDefaults.whileHoverTransition,\n\t\t)\n\t}\n\n\tif (isEmptyObject(update)) return warnings.length > 0 ? warnings : undefined\n\n\tupdateWithFallback(update, node, whileHoverEnabledDefaults)\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: unknown, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!hasWhileHover(node)) return undefined\n\n\tconst nodeHoverEffect: Partial<DSLHoverOrTapEffect> = {\n\t\topacity: isNumber(node.whileHoverOpacity) ? toRoundedNumber(node.whileHoverOpacity) : undefined,\n\t\tx: isNumber(node.whileHoverX) ? createCSSDimension(toRoundedNumber(node.whileHoverX), \"px\") : undefined,\n\t\ty: isNumber(node.whileHoverY) ? createCSSDimension(toRoundedNumber(node.whileHoverY), \"px\") : undefined,\n\t\tscale: isNumber(node.whileHoverScale) ? toRoundedNumber(node.whileHoverScale) : undefined,\n\t\tskewX: isNumber(node.whileHoverSkewX)\n\t\t\t? createCSSDimension(toRoundedNumber(node.whileHoverSkewX), \"deg\")\n\t\t\t: undefined,\n\t\tskewY: isNumber(node.whileHoverSkewY)\n\t\t\t? createCSSDimension(toRoundedNumber(node.whileHoverSkewY), \"deg\")\n\t\t\t: undefined,\n\t\tbackgroundColor: node.whileHoverBackgroundColor\n\t\t\t? (ctx.tokens.resolve(node.whileHoverBackgroundColor)?.toCSS() ?? node.whileHoverBackgroundColor)\n\t\t\t: undefined,\n\t\tshadow: node.whileHoverBoxShadow\n\t\t\t? singleBoxShadowToCSS(node.whileHoverBoxShadow, color => ctx.tokens.resolve(color)?.toCSS())\n\t\t\t: undefined,\n\t\ttransition: vekterTransitionToDslTransitionString(node.whileHoverTransition),\n\t}\n\n\tif (!isUndefined(node.whileHoverRotate3d) && node.whileHoverRotate3d) {\n\t\tnodeHoverEffect.rotate = `${createCSSDimension(toRoundedNumber(node.whileHoverRotateX ?? 0), \"deg\")} ${createCSSDimension(toRoundedNumber(node.whileHoverRotateY ?? 0), \"deg\")} ${createCSSDimension(toRoundedNumber(node.whileHoverRotate ?? 0), \"deg\")}`\n\t} else if (isNumber(node.whileHoverRotate)) {\n\t\tnodeHoverEffect.rotate = createCSSDimension(toRoundedNumber(node.whileHoverRotate), \"deg\")\n\t}\n\n\treturn { hoverEffect: nodeHoverEffect }\n}\n\nexport const hoverEffect = {\n\tfor: withWhileHover,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ hoverEffect: DSLHoverOrTapEffect }>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { type WithHTMLTag, allHTMLTags, isHTMLTag, withHTMLTag } from \"document/models/CanvasTree/traits/WithHTMLTag.ts\"\nimport {\n\tformContainerDefaults,\n\tisFormContainer,\n\twithFormContainer,\n} from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { isNullString } from \"./helpers.ts\"\nimport { warning } from \"./invalidValues.ts\"\nimport { type DSLAttributes, type TraitAttributeDefinition, type TraitDefinition, nodeToDSLType } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithHTMLTag> = {\n\thtmlTag: {\n\t\tdescription: `${allHTMLTags.filter(tag => tag !== \"ol\" && tag !== \"ul\").join(\" | \")} | form`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (attributes.htmlTag === undefined) return\n\n\tif (isNullString(attributes.htmlTag)) {\n\t\tif (withHTMLTag(node)) node.set({ htmlTag: undefined })\n\t\tif (isFormContainer(node)) node.set({ isFormContainer: false })\n\t\treturn\n\t}\n\n\tif (attributes.htmlTag === \"form\" && withFormContainer(node)) {\n\t\tif (!node.isFormContainer) {\n\t\t\tconst isInserted = ctx.treeStore.tree.get(node.id)\n\t\t\tif (!isInserted) {\n\t\t\t\tthrow new DeferTraitError(`Cannot save form config: node not inserted yet`)\n\t\t\t}\n\t\t\tnode.set({\n\t\t\t\tisFormContainer: true,\n\t\t\t})\n\t\t\tvoid ctx.forms.saveDefaultDestination(node.id)\n\t\t}\n\t\treturn\n\t}\n\n\tif (isHTMLTag(attributes.htmlTag) && withHTMLTag(node)) {\n\t\tnode.set({ htmlTag: attributes.htmlTag })\n\n\t\tif (isFormContainer(node)) {\n\t\t\tnode.set(formContainerDefaults)\n\t\t}\n\t\treturn\n\t}\n\n\tconst expected = `a supported htmlTag for ${nodeToDSLType(node, ctx)} nodes`\n\treturn warning(\"htmlTag\", attributes.htmlTag, expected)\n}\n\nexport const htmlTag = {\n\tfor: withHTMLTag,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes: node => {\n\t\tif (isFormContainer(node)) {\n\t\t\treturn {\n\t\t\t\thtmlTag: \"form\",\n\t\t\t}\n\t\t}\n\n\t\tif (withHTMLTag(node)) {\n\t\t\treturn {\n\t\t\t\thtmlTag: node.htmlTag,\n\t\t\t}\n\t\t}\n\n\t\treturn undefined\n\t},\n} satisfies TraitDefinition<WithHTMLTag>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isImageStylePresetNode, isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { StylePresetType } from \"../context/stylePresetType.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\texpectedAttributeMessage,\n\texpectedStylePresetReference,\n\timageStylePresetRequiresHtmlContentVariable,\n\tinvalidAttributeMessage,\n\tunsupportedAttributeMessage,\n\twarning,\n} from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\nimport { nodeToDSLType } from \"./types.ts\"\n\ninterface ImageStylePresetAttributes {\n\timageStylePreset: string\n}\n\nconst definition: TraitAttributeDefinition<ImageStylePresetAttributes> = {\n\timageStylePreset: {\n\t\tdescription: `The name or id of the image style preset. Only use when the RichTextNode content is bound to a RichText variable. | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nconst dslAttributeKey = \"imageStylePreset\" satisfies keyof ImageStylePresetAttributes\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tconst { stylePresets, treeStore } = ctx\n\n\tconst presetNameOrId = attributes.imageStylePreset\n\tif (isUndefined(presetNameOrId)) return\n\n\tif (!isString(presetNameOrId)) {\n\t\treturn warning(dslAttributeKey, presetNameOrId, expectedStylePresetReference)\n\t}\n\tif (!isRichTextNode(node)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: dslAttributeKey,\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (isNullString(presetNameOrId)) {\n\t\tnode.set({ stylePresetImage: undefined })\n\t\treturn\n\t}\n\n\tif (!isVariableReference(node.htmlContent)) {\n\t\treturn [{ key: dslAttributeKey, applied: false, message: imageStylePresetRequiresHtmlContentVariable }]\n\t}\n\n\tconst preset = stylePresets.forNameOrId(presetNameOrId, StylePresetType.Image)\n\tif (!preset) {\n\t\t// Defer: the preset may be mid-registration from a just-issued `+ImageStylePresetNode`\n\t\tthrow new DeferTraitError(\n\t\t\t`${escapeValue(ClassDiscriminator.ImageStylePresetNode)} with name or id \"${presetNameOrId}\" not found`,\n\t\t)\n\t}\n\n\tif (preset.type !== StylePresetType.Image) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: false,\n\t\t\t\tkey: dslAttributeKey,\n\t\t\t\tmessage: expectedAttributeMessage(\n\t\t\t\t\tpresetNameOrId,\n\t\t\t\t\t`a ${StylePresetType.Image} style preset, but received a ${preset.type} style preset`,\n\t\t\t\t),\n\t\t\t},\n\t\t]\n\t}\n\n\tconst presetNode = treeStore.tree.getNodeWithTrait(preset.id, isImageStylePresetNode)\n\tif (!presetNode) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: dslAttributeKey,\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: invalidAttributeMessage(presetNameOrId, \"Image style preset node not found in document\"),\n\t\t\t},\n\t\t]\n\t}\n\n\tnode.setNodeImageStylePreset(presetNode)\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isRichTextNode(node)) return\n\tif (isUndefined(node.stylePresetImage)) return\n\tif (!isVariableReference(node.htmlContent)) return\n\n\tconst presetNode = node.getNodeImageStylePreset(ctx.treeStore.tree)\n\tif (!presetNode) return\n\n\tconst presetName = ctx.stylePresets.forId(node.stylePresetImage)?.name\n\tif (!presetName) return\n\n\treturn { imageStylePreset: presetName }\n}\n\nexport const imageStylePreset = {\n\tfor: isRichTextNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<ImageStylePresetAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isInlineCodeStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tinlineCodeStyleDefaults,\n\twithInlineCodeStyle,\n\ttype WithInlineCodeStyle,\n} from \"document/models/CanvasTree/traits/WithInlineCodeStyle.ts\"\nimport { parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport { expectedAttributeMessage, unsupportedAttributeMessage } from \"./invalidValues.ts\"\nimport {\n\tnodeToDSLType,\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\ninterface InlineCodeStyleAttributes {\n\tfontSizeScale?: number\n\tpaddingXScale?: number\n\tpaddingYScale?: number\n}\n\ntype SerializedScaleValue = `${ReturnType<typeof toRoundedNumber>}em`\ninterface SerializedInlineCodeStyleAttributes {\n\tfontSizeScale?: SerializedScaleValue\n\tpaddingXScale?: SerializedScaleValue\n\tpaddingYScale?: SerializedScaleValue\n}\n\nconst scaleValueDescription = `number (in em units) | \\${number}em | ${nullString}`\n\nconst definition: TraitAttributeDefinition<InlineCodeStyleAttributes> = {\n\tfontSizeScale: {\n\t\tdescription: scaleValueDescription,\n\t\texamples: [\"1.0\"],\n\t\toptional: true,\n\t},\n\tpaddingXScale: {\n\t\tdescription: scaleValueDescription,\n\t\texamples: [\"0.2\", \"0.3\"],\n\t\toptional: true,\n\t},\n\tpaddingYScale: {\n\t\tdescription: scaleValueDescription,\n\t\texamples: [\"0.2\", \"0.3\"],\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tconst warnings: TraitWarning[] = []\n\tif (!isInlineCodeStylePresetNode(node)) {\n\t\tfor (const key of inlineCodeStyleAttributeKeys) {\n\t\t\tif (isUndefined(attributes[key])) continue\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey,\n\t\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t\t})\n\t\t}\n\n\t\treturn warnings\n\t}\n\n\tapplyScaleAttribute(node, attributes, warnings, \"fontSizeScale\", \"inlineCodeFontSizeScale\")\n\tapplyScaleAttribute(node, attributes, warnings, \"paddingXScale\", \"inlineCodePaddingHorizontal\")\n\tapplyScaleAttribute(node, attributes, warnings, \"paddingYScale\", \"inlineCodePaddingVertical\")\n\n\treturn warnings\n}\n\nconst inlineCodeStyleAttributeKeys = Object.keys(definition)\n\nfunction applyScaleAttribute(\n\tnode: CanvasNode & WithInlineCodeStyle,\n\tattributes: DSLAttributes,\n\twarnings: TraitWarning[],\n\tattribute: keyof typeof definition,\n\tkey: keyof WithInlineCodeStyle,\n) {\n\tconst value = attributes[attribute]\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\tnode.set({ [key]: inlineCodeStyleDefaults[key] })\n\t\treturn\n\t}\n\n\tif (!isString(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: attribute,\n\t\t\tmessage: expectedAttributeMessage(value, scaleValueDescription),\n\t\t})\n\t\treturn\n\t}\n\n\tconst [dimensionValue, unit] = parseCSSDimension(value)\n\tconst isValidUnit = isUndefined(unit) || unit === \"em\"\n\tif (Number.isNaN(dimensionValue) || !isValidUnit) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: attribute,\n\t\t\tmessage: expectedAttributeMessage(value, scaleValueDescription),\n\t\t})\n\t\treturn\n\t}\n\n\tnode.set({ [key]: dimensionValue })\n}\n\nfunction toAttributes(\n\tnode: CanvasNode,\n\t_parent: MaybeCanvasNode,\n\t_ctx: AgentContext,\n): SerializedInlineCodeStyleAttributes | undefined {\n\tif (!withInlineCodeStyle(node)) return\n\n\tconst attributes: SerializedInlineCodeStyleAttributes = {}\n\tif (node.inlineCodeFontSizeScale !== inlineCodeStyleDefaults.inlineCodeFontSizeScale) {\n\t\tattributes.fontSizeScale = `${toRoundedNumber(node.inlineCodeFontSizeScale)}em`\n\t}\n\tif (node.inlineCodePaddingHorizontal !== inlineCodeStyleDefaults.inlineCodePaddingHorizontal) {\n\t\tattributes.paddingXScale = `${toRoundedNumber(node.inlineCodePaddingHorizontal)}em`\n\t}\n\tif (node.inlineCodePaddingVertical !== inlineCodeStyleDefaults.inlineCodePaddingVertical) {\n\t\tattributes.paddingYScale = `${toRoundedNumber(node.inlineCodePaddingVertical)}em`\n\t}\n\n\treturn Object.keys(attributes).length > 0 ? attributes : undefined\n}\n\nexport const inlineCodeStyle = {\n\tfor: isInlineCodeStylePresetNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<InlineCodeStyleAttributes>\n", "import { parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isLayoutTemplateNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport {\n\tclearCustomCursorFromGroundNode,\n\tensureAllBreakpointsAreVerticalStack,\n\tremoveFlowEffectFromBreakpoints,\n} from \"export/exportLayoutTemplates.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { hasAnyAttribute, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { singleWarning, traitNotAppliedWarning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst layoutTemplateKey = \"layoutTemplate\" as const\n\nexport const noneValue = \"null\" as const\nexport const defaultValue = \"default\" as const\n\nconst expectedDescription = `${defaultValue} | <layout-template-id> |${noneValue}`\n\ninterface LayoutTemplateAttributes {\n\tlayoutTemplate: string | undefined\n}\n\nconst definition: TraitAttributeDefinition<LayoutTemplateAttributes> = {\n\t[layoutTemplateKey]: {\n\t\tdescription: expectedDescription,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (!hasAnyAttribute(attributes, definition)) return\n\tif (!withLayoutTemplate(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst value = attributes[layoutTemplateKey]\n\tif (isUndefined(value)) return\n\n\tif (!isString(value)) {\n\t\treturn [singleWarning(layoutTemplateKey, value, expectedDescription)]\n\t}\n\n\tconst targetNode = ctx.treeResolver.get(value)\n\tconst tree = ctx.treeResolver.getLookupTree()\n\n\tif (!tree.get(node.id)) {\n\t\tthrow new DeferTraitError(`Cannot set layoutTemplate: web page ${node.id} not inserted yet`)\n\t}\n\n\tconst isHomePage = node.id === tree.root.homePageNodeId\n\tif (value === noneValue) {\n\t\tif (isHomePage) {\n\t\t\ttree.root.set({ layoutTemplateIdentifier: undefined })\n\t\t} else {\n\t\t\tnode.set({ layoutTemplateIdentifier: null })\n\t\t}\n\t\treturn\n\t}\n\n\tif (value === defaultValue) {\n\t\tif (isHomePage) return\n\t\tnode.set({ layoutTemplateIdentifier: undefined })\n\t\treturn\n\t}\n\n\tif (!targetNode || !isLayoutTemplateNode(targetNode)) {\n\t\treturn [\n\t\t\ttraitNotAppliedWarning(\n\t\t\t\tlayoutTemplateKey,\n\t\t\t\t`No ${escapeValue(ClassDiscriminator.LayoutTemplateNode)} found with id ${escapeValue(value)}.`,\n\t\t\t),\n\t\t]\n\t}\n\n\tif (isHomePage) {\n\t\ttree.root.set({ layoutTemplateIdentifier: targetNode.instanceIdentifier })\n\t\tnormalizeBreakpointsForLayoutTemplate(node, tree)\n\t\treturn\n\t}\n\n\tnode.set({ layoutTemplateIdentifier: targetNode.instanceIdentifier })\n\tnormalizeBreakpointsForLayoutTemplate(node, tree)\n}\n\n/** Prepare breakpoint for layout template, matching behaviour of properties panel */\nfunction normalizeBreakpointsForLayoutTemplate(node: CanvasNode, tree: CanvasTree) {\n\tif (!isWebPageNode(node) || !node.isLoaded()) return\n\tif (!tree.getNode(node.baseVariantId)) return\n\tensureAllBreakpointsAreVerticalStack(tree, node)\n\tclearCustomCursorFromGroundNode(tree, node)\n\tremoveFlowEffectFromBreakpoints(tree, node)\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\t// Root/default layout template is passed as a context message, we don't collect the layout\n\t// template off the root node.\n\tif (!isWebPageNode(node)) return\n\n\tconst tree = ctx.treeResolver.getLookupTree()\n\tconst override = node.layoutTemplateIdentifierOverride\n\n\tif (override === null) {\n\t\treturn { [layoutTemplateKey]: noneValue }\n\t}\n\n\tif (override === undefined) {\n\t\tconst rootLayoutTemplate = tree.root.layoutTemplateIdentifier\n\t\treturn rootLayoutTemplate ? { [layoutTemplateKey]: defaultValue } : undefined\n\t}\n\n\tconst parsed = parseModuleIdentifier(override)\n\tif (!parsed) return\n\n\tconst layoutTemplateNode = tree.getNodeWithTrait(parsed.localIdName, isLayoutTemplateNode)\n\tif (layoutTemplateNode) {\n\t\treturn { [layoutTemplateKey]: layoutTemplateNode.id }\n\t}\n}\n\nexport const layoutTemplate = {\n\tfor: withLayoutTemplate,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<LayoutTemplateAttributes>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tgetFourPixelNumberFromShorthand,\n\tisPixelNumberShorthand,\n\tnormalizeFourPixelNumberShorthand,\n\tparsePixelNumber,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport {\n\ttype WithLightboxEffect,\n\thasLightboxEffect,\n\tlightboxEffectEnabledDefaults,\n\twithLightboxEffect,\n} from \"document/models/CanvasTree/traits/WithLightboxEffect.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { EffectType, effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { breakpointUnsupportedMessage, singleWarning } from \"./invalidValues.ts\"\nimport { colorDescription, pixelShorthandDescription } from \"./traitDescriptions.ts\"\nimport {\n\teffectTransitionDefinition,\n\teffectTransitionSupportedTypes,\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitToAttributesOutput,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\nconst dslLightboxEffectSchema = z.object({\n\tpadding: z.string().optional().catch(undefined),\n\tmaxWidth: z\n\t\t.string()\n\t\t.transform(value => parsePixelNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tzIndex: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tbackdrop: z.string().optional().catch(undefined),\n\ttransition: z.string().optional().catch(undefined),\n})\n\ntype ParsedDSLLightboxEffect = z.output<typeof dslLightboxEffectSchema>\ntype DSLLightboxEffect = TraitToAttributesOutput<ParsedDSLLightboxEffect>\n\nfunction deserializeLightboxPadding(\n\tpadding: DSLLightboxEffect[\"padding\"],\n\twarnings: TraitWarning[],\n): Partial<WithLightboxEffect> | undefined {\n\tif (padding === undefined) return\n\tif (!isString(padding)) {\n\t\twarnings.push(singleWarning(\"lightboxEffect.padding\", padding, pixelShorthandDescription))\n\t\treturn\n\t}\n\n\tconst singleValue = parsePixelNumber(padding)\n\tif (isNumber(singleValue)) {\n\t\treturn {\n\t\t\tlightboxEffectPadding: singleValue,\n\t\t\tlightboxEffectPaddingPerSide: false,\n\t\t}\n\t}\n\n\tif (!isPixelNumberShorthand(padding)) {\n\t\twarnings.push(singleWarning(\"lightboxEffect.padding\", padding, pixelShorthandDescription))\n\t\treturn\n\t}\n\n\tconst normalized = normalizeFourPixelNumberShorthand(getFourPixelNumberFromShorthand(padding))\n\tif (normalized.perSide) {\n\t\treturn {\n\t\t\tlightboxEffectPaddingTop: normalized.top,\n\t\t\tlightboxEffectPaddingRight: normalized.right,\n\t\t\tlightboxEffectPaddingBottom: normalized.bottom,\n\t\t\tlightboxEffectPaddingLeft: normalized.left,\n\t\t\tlightboxEffectPaddingPerSide: true,\n\t\t}\n\t}\n\n\treturn {\n\t\tlightboxEffectPadding: normalized.all,\n\t\tlightboxEffectPaddingPerSide: false,\n\t}\n}\n\nfunction serializeLightboxPadding(node: WithLightboxEffect): string | undefined {\n\tconst defaultPadding = lightboxEffectEnabledDefaults.lightboxEffectPadding\n\tif (node.lightboxEffectPaddingPerSide === true) {\n\t\treturn [\n\t\t\tnode.lightboxEffectPaddingTop,\n\t\t\tnode.lightboxEffectPaddingRight,\n\t\t\tnode.lightboxEffectPaddingBottom,\n\t\t\tnode.lightboxEffectPaddingLeft,\n\t\t]\n\t\t\t.map(value => `${value ?? defaultPadding}px`)\n\t\t\t.join(\" \")\n\t}\n\n\treturn createCSSDimension(node.lightboxEffectPadding ?? defaultPadding, \"px\")\n}\n\nconst definition: TraitAttributeDefinition<{ lightboxEffect: DSLLightboxEffect }> = {\n\tlightboxEffect: {\n\t\tpadding: {\n\t\t\tdescription: pixelShorthandDescription,\n\t\t\toptional: true,\n\t\t},\n\t\tmaxWidth: {\n\t\t\tdescription: \"number | ${number}px\",\n\t\t\toptional: true,\n\t\t},\n\t\tzIndex: {\n\t\t\tdescription: \"number\",\n\t\t\toptional: true,\n\t\t},\n\t\tbackdrop: {\n\t\t\tdescription: `${colorDescription} | null`,\n\t\t\toptional: true,\n\t\t},\n\t\ttransition: effectTransitionDefinition,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withLightboxEffect(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst { lightboxEffect } = attributes\n\n\tif (isBreakpointVariant(node) && lightboxEffect !== undefined) {\n\t\treturn [{ applied: false, key: \"lightboxEffect\", message: breakpointUnsupportedMessage(\"lightbox effects\") }]\n\t}\n\n\tif (isNullString(lightboxEffect)) {\n\t\tnode.set({ lightboxEffectEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslLightboxEffectSchema.safeParse(lightboxEffect)\n\tif (!parsed.success) return\n\n\tconst { padding, maxWidth, zIndex, backdrop, transition } = parsed.data\n\n\tconst warnings: TraitWarning[] = []\n\tconst update: Partial<WithLightboxEffect> = deserializeLightboxPadding(padding, warnings) ?? {}\n\n\tif (isNumber(maxWidth)) {\n\t\tupdate.lightboxEffectMaxWidth = maxWidth\n\t}\n\n\tif (isNumber(zIndex)) {\n\t\tupdate.lightboxEffectZIndex = zIndex\n\t}\n\n\tif (isString(backdrop) && backdrop !== nullString) {\n\t\tupdate.lightboxEffectBackdrop = backdrop\n\t}\n\n\tconst parsedTransition = parseDSLTransitionString(transition, effectTransitionSupportedTypes, error => {\n\t\twarnings.push(singleWarning(\"lightboxEffect.transition\", transition, error.message))\n\t})\n\n\tif (parsedTransition) {\n\t\tupdate.lightboxEffectTransition = transitionWithDefault(\n\t\t\tparsedTransition,\n\t\t\tnode.lightboxEffectTransition,\n\t\t\teffectConfig[EffectType.Lightbox].enabledDefaults.lightboxEffectTransition,\n\t\t)\n\t}\n\n\tif (!isEmptyObject(update)) updateWithFallback(update, node, lightboxEffectEnabledDefaults)\n\n\t// Explicitly set to undefined to clear the backdrop, bypassing the default value.\n\tif (isNullString(backdrop)) node.set({ lightboxEffectBackdrop: undefined })\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!hasLightboxEffect(node)) return undefined\n\n\tconst nodeLightboxEffect: Partial<DSLLightboxEffect> = {\n\t\tpadding: serializeLightboxPadding(node),\n\t\tmaxWidth: isNumber(node.lightboxEffectMaxWidth) ? toRoundedNumber(node.lightboxEffectMaxWidth) : undefined,\n\t\tzIndex: isNumber(node.lightboxEffectZIndex) ? toRoundedNumber(node.lightboxEffectZIndex) : undefined,\n\t\tbackdrop: isString(node.lightboxEffectBackdrop) ? node.lightboxEffectBackdrop : nullString,\n\t\ttransition: vekterTransitionToDslTransitionString(node.lightboxEffectTransition),\n\t}\n\n\treturn { lightboxEffect: nodeLightboxEffect }\n}\n\nexport const lightboxEffect = {\n\tfor: withLightboxEffect,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ lightboxEffect: DSLLightboxEffect }>\n", "import { isEmptyObject } from \"@framerjs/shared/src/isEmptyObject.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { LinkStylePresetNode } from \"document/models/CanvasTree/nodes/LinkStylePresetNode.ts\"\nimport { isLinkStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\ttype SupportedLinkStyleSuffix,\n\ttype LinkStyleKeyPrefix,\n\tgetLinkStyleKey,\n} from \"document/models/CanvasTree/traits/WithLinkStyle.ts\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport { isObject, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { nullString } from \"./helpers.ts\"\nimport { expectedAttributeMessage, unsupportedAttributeMessage } from \"./invalidValues.ts\"\nimport {\n\ttype SerializedTextAppearanceAttributes,\n\ttype TextAppearanceAttributes,\n\tapplyTextDecoration,\n\tapplyTextDecorationColor,\n\tapplyTextDecorationOffset,\n\tapplyTextDecorationSkipInk,\n\tapplyTextDecorationStyle,\n\tapplyTextDecorationThickness,\n\tserializeTextAppearanceAttributes,\n\ttextAppearanceDefinition,\n} from \"./textStyle/textAppearance.ts\"\nimport {\n\tapplyTextBackgroundCornerShape,\n\tapplyTextBackgroundPadding,\n\tapplyTextBackgroundRadius,\n\tserializeTextBackgroundAttributes,\n\ttextBackgroundDefinition,\n\ttype TextBackgroundAttributes,\n} from \"./textStyle/textBackground.ts\"\nimport {\n\ttype SerializedTextBackgroundColorAttributes,\n\tapplyTextBackgroundColor,\n\tserializeTextBackgroundColorAttributes,\n\ttextBackgroundColorDefinition,\n} from \"./textStyle/textBackgroundColor.ts\"\nimport {\n\ttype SerializedTextColorAttributes,\n\tapplyTextColor,\n\tserializeTextColorAttributes,\n} from \"./textStyle/textColor.ts\"\nimport { colorDescription } from \"./traitDescriptions.ts\"\nimport type {\n\tAttributeDefinition,\n\tAttributesDefinition,\n\tDSLAttributes,\n\tTraitDefinition,\n\tTraitWarning,\n} from \"./types.ts\"\nimport { nodeToDSLType } from \"./types.ts\"\n\ntype LinkStyleDSLKey = Uncapitalize<SupportedLinkStyleSuffix>\n\ntype LinkStyleVariation = \"hover\" | \"current\" | undefined\n\ninterface LinkVariation {\n\tvariation: LinkStyleVariation\n\ttraitPrefix: LinkStyleKeyPrefix\n}\n\nconst linkVariations: LinkVariation[] = [\n\t{ variation: undefined, traitPrefix: \"link\" },\n\t{ variation: \"hover\", traitPrefix: \"linkHover\" },\n\t{ variation: \"current\", traitPrefix: \"linkCurrent\" },\n]\n\nfunction getFullDSLKey(variation: LinkStyleVariation, dslKey: LinkStyleDSLKey): string {\n\treturn variation ? `link.${variation}.${dslKey}` : `link.${dslKey}`\n}\n\nconst variationDefinition = {\n\t// textColor doesn't support gradients in linkStylePresetNode\n\ttextColor: { description: `${colorDescription} | ${nullString}`, optional: true },\n\ttextDecoration: textAppearanceDefinition.textDecoration,\n\ttextDecorationColor: textAppearanceDefinition.textDecorationColor,\n\ttextDecorationThickness: textAppearanceDefinition.textDecorationThickness,\n\ttextDecorationStyle: textAppearanceDefinition.textDecorationStyle,\n\ttextDecorationSkipInk: textAppearanceDefinition.textDecorationSkipInk,\n\ttextDecorationOffset: textAppearanceDefinition.textDecorationOffset,\n\ttextBackgroundColor: textBackgroundColorDefinition.textBackgroundColor,\n\ttextBackgroundRadius: textBackgroundDefinition.textBackgroundRadius,\n\ttextBackgroundCornerShape: textBackgroundDefinition.textBackgroundCornerShape,\n\ttextBackgroundPadding: textBackgroundDefinition.textBackgroundPadding,\n} satisfies Record<LinkStyleDSLKey, AttributeDefinition>\n\nconst dslKeys = objectKeys(variationDefinition)\n\nconst definition = {\n\t\"<link | link.hover | link.current>\": variationDefinition,\n} satisfies AttributesDefinition\n\n// ---------------------------------------------------------------------------\n// fromAttributes\n// ---------------------------------------------------------------------------\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\tconst { link } = attributes\n\tif (!isObject(link)) {\n\t\tif (!isUndefined(link) && isLinkStylePresetNode(node)) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"link\",\n\t\t\t\tmessage: expectedAttributeMessage(\n\t\t\t\t\tlink,\n\t\t\t\t\t\"link sub-properties with style attributes (e.g. link.textColor, link.hover.textDecoration, etc.)\",\n\t\t\t\t),\n\t\t\t})\n\t\t}\n\t\treturn warnings\n\t}\n\n\tfor (const { variation, traitPrefix } of linkVariations) {\n\t\tconst variationAttributes = variation ? link[variation] : link\n\t\tif (!isObject(variationAttributes)) continue\n\n\t\tif (!isLinkStylePresetNode(node)) {\n\t\t\t// Warn about any linkStyle owned attributes being set on a non-link-style-preset node, and ignore them\n\t\t\tfor (const key of dslKeys) {\n\t\t\t\tif (isUndefined(variationAttributes[key])) continue\n\t\t\t\tconst fullDSLKey = getFullDSLKey(variation, key)\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: fullDSLKey,\n\t\t\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t\t\t})\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tapplyVariation(node, variationAttributes, ctx, warnings, variation, traitPrefix)\n\t}\n\n\treturn warnings\n}\n\nfunction applyVariation(\n\tnode: LinkStylePresetNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\tvariation: LinkStyleVariation,\n\tlinkStylePrefix: LinkStyleKeyPrefix,\n): void {\n\tconst getVariationFullDSLKey = (key: LinkStyleDSLKey) => getFullDSLKey(variation, key)\n\tapplyTextColor(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n\tapplyTextDecoration(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n\tapplyTextDecorationColor(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n\tapplyTextDecorationThickness(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n\tapplyTextDecorationStyle(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n\tapplyTextDecorationSkipInk(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n\tapplyTextDecorationOffset(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n\tapplyTextBackgroundColor(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n\tapplyTextBackgroundRadius(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n\tapplyTextBackgroundCornerShape(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n\tapplyTextBackgroundPadding(node, attributes, ctx, warnings, getVariationFullDSLKey, linkStylePrefix)\n}\n\n// ---------------------------------------------------------------------------\n// toAttributes\n// ---------------------------------------------------------------------------\n\ntype SerializedLinkStyleVariationAttributes = SerializedTextAppearanceAttributes &\n\tSerializedTextColorAttributes &\n\tSerializedTextBackgroundColorAttributes\n\ninterface SerializedLinkStyleAttributes extends SerializedLinkStyleVariationAttributes {\n\thover?: SerializedLinkStyleVariationAttributes\n\tcurrent?: SerializedLinkStyleVariationAttributes\n}\n\nfunction toAttributes(\n\tnode: CanvasNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): { link: SerializedLinkStyleAttributes } | undefined {\n\tif (!isLinkStylePresetNode(node)) return\n\n\tconst link: SerializedLinkStyleAttributes = serializeVariation(node, \"link\", ctx)\n\tconst hover = serializeVariation(node, \"linkHover\", ctx)\n\tconst current = serializeVariation(node, \"linkCurrent\", ctx)\n\n\tif (!isEmptyObject(hover)) link.hover = hover\n\tif (!isEmptyObject(current)) link.current = current\n\tif (isEmptyObject(link)) return\n\n\treturn { link }\n}\n\nfunction serializeVariation(\n\tnode: LinkStylePresetNode,\n\ttraitPrefix: LinkStyleKeyPrefix,\n\tctx: AgentContext,\n): SerializedLinkStyleVariationAttributes {\n\tconst textStyleAttributes: Partial<TextAppearanceAttributes> = {\n\t\ttextDecoration: node[getLinkStyleKey(traitPrefix, \"TextDecoration\")],\n\t\ttextDecorationColor: node[getLinkStyleKey(traitPrefix, \"TextDecorationColor\")],\n\t\ttextDecorationThickness: node[getLinkStyleKey(traitPrefix, \"TextDecorationThickness\")],\n\t\ttextDecorationStyle: node[getLinkStyleKey(traitPrefix, \"TextDecorationStyle\")],\n\t\ttextDecorationSkipInk: node[getLinkStyleKey(traitPrefix, \"TextDecorationSkipInk\")],\n\t\ttextDecorationOffset: node[getLinkStyleKey(traitPrefix, \"TextDecorationOffset\")],\n\t}\n\n\tconst textBackgroundAttributes: Partial<TextBackgroundAttributes> = {\n\t\ttextBackgroundRadius: node[getLinkStyleKey(traitPrefix, \"TextBackgroundRadius\")],\n\t\ttextBackgroundCornerShape: node[getLinkStyleKey(traitPrefix, \"TextBackgroundCornerShape\")],\n\t\ttextBackgroundPadding: node[getLinkStyleKey(traitPrefix, \"TextBackgroundPadding\")],\n\t}\n\n\treturn {\n\t\t...serializeTextAppearanceAttributes(textStyleAttributes, ctx.tokens, node, ctx),\n\t\t...serializeTextBackgroundAttributes(textBackgroundAttributes),\n\t\t...serializeTextColorAttributes(\n\t\t\t{ textColor: node[getLinkStyleKey(traitPrefix, \"TextColor\")] },\n\t\t\tctx.tokens,\n\t\t\tctx,\n\t\t\tnode,\n\t\t),\n\t\t...serializeTextBackgroundColorAttributes(\n\t\t\t{ textBackgroundColor: node[getLinkStyleKey(traitPrefix, \"TextBackgroundColor\")] },\n\t\t\tctx.tokens,\n\t\t\tctx,\n\t\t\tnode,\n\t\t),\n\t}\n}\n\nexport const linkStyle = {\n\tfor: isLinkStylePresetNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<object>\n", "import { escapeValue } from \"app/ai/agents/prompt/utils.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isLinkStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isLinkTransition, type LinkTransition } from \"document/models/CanvasTree/traits/WithLinkTransition.ts\"\nimport { transitionDelayKey, transitionDurationKey, transitionEaseKey } from \"document/models/Transition.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport { invalidAttributeMessage, unsupportedAttributeMessage } from \"./invalidValues.ts\"\nimport {\n\tDSLTransitionType,\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\ttweenTransitionSupportedTypes,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\nimport { nodeToDSLType } from \"./types.ts\"\n\ninterface LinkTransitionAttributes {\n\tlink: { transition: string }\n}\n\nconst tween = DSLTransitionType.tween satisfies LinkTransition[\"type\"]\n\nconst definition: TraitAttributeDefinition<LinkTransitionAttributes> = {\n\tlink: {\n\t\ttransition: {\n\t\t\tdescription: `${tween} <${transitionEaseKey}> <${transitionDurationKey}> <${transitionDelayKey}> | ${nullString}`,\n\t\t\texamples: [`${tween} 0.44,0,0.56,1 0.4s 0s`],\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nconst dslKey = \"link.transition\"\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\tconst { link } = attributes\n\tif (!isObject(link)) return warnings\n\tconst value = link.transition\n\tif (!isString(value)) return warnings\n\n\tif (!isLinkStylePresetNode(node)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t})\n\t\treturn warnings\n\t}\n\n\tif (isNullString(value)) {\n\t\tnode.set({ linkTransition: undefined })\n\t\treturn warnings\n\t}\n\n\tconst update = parseDSLTransitionString(value, tweenTransitionSupportedTypes, error => {\n\t\twarnings.push({ applied: false, key: dslKey, message: invalidAttributeMessage(value, error.message) })\n\t})\n\tif (!update) {\n\t\treturn warnings\n\t}\n\n\tconst transition = transitionWithDefault(update, node.linkTransition)\n\n\tif (!isLinkTransition(transition)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: dslKey,\n\t\t\tmessage: invalidAttributeMessage(\n\t\t\t\tvalue,\n\t\t\t\t`Unsupported type: ${escapeValue(String(transition.type))}. Only ${escapeValue(tween)} transitions are supported for ${escapeValue(dslKey)}`,\n\t\t\t),\n\t\t})\n\t\treturn warnings\n\t}\n\n\tnode.set({ linkTransition: transition })\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, _ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isLinkStylePresetNode(node)) return\n\n\tconst value = node.linkTransition\n\tif (!value) return\n\n\tconst serialized = vekterTransitionToDslTransitionString(value)\n\tif (!serialized) return\n\n\treturn { link: { transition: serialized } }\n}\n\nexport const linkTransition = {\n\tfor: isLinkStylePresetNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<LinkTransitionAttributes>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype LoopEffectRepeatType,\n\ttype WithLoopEffect,\n\thasLoopEffect,\n\tloopEffectEnabledDefaults,\n\twithLoopEffect,\n} from \"document/models/CanvasTree/traits/WithLoopEffect.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { EffectType, effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isBoolean, isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { booleanString } from \"../schemaUtils.ts\"\nimport { isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { breakpointUnsupportedMessage, singleWarning } from \"./invalidValues.ts\"\nimport {\n\teffectTransitionDefinition,\n\teffectTransitionSupportedTypes,\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitToAttributesOutput,\n} from \"./types.ts\"\n\nconst repeatTypes = [\"loop\", \"mirror\"] as const satisfies readonly LoopEffectRepeatType[]\n\nfunction parseRepeatDelay(value: string): number | undefined {\n\tconst [numberValue, unit] = parseCSSDimension(value, \"s\")\n\tif (Number.isNaN(numberValue)) return\n\tif (unit === \"s\") return numberValue\n\tif (unit === \"ms\") return numberValue / 1000\n}\n\nconst dslLoopEffectSchema = z.object({\n\trepeatType: z.enum(repeatTypes).optional().catch(undefined),\n\trepeatDelay: z\n\t\t.string()\n\t\t.transform(value => parseRepeatDelay(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tpauseOffscreen: booleanString.optional().catch(undefined),\n\topacity: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tx: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\ty: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tscale: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\trotate: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\trotateX: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\trotateY: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tskewX: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tskewY: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\ttransition: z.string().optional().catch(undefined),\n})\n\ntype ParsedDSLLoopEffect = z.output<typeof dslLoopEffectSchema>\ntype RoundedParsedDSLLoopEffect = TraitToAttributesOutput<ParsedDSLLoopEffect>\ntype DSLLoopEffect = Omit<RoundedParsedDSLLoopEffect, \"repeatDelay\"> & {\n\trepeatDelay?: `${number}s`\n}\n\nconst definition: TraitAttributeDefinition<{ loopEffect: DSLLoopEffect }> = {\n\tloopEffect: {\n\t\trepeatType: {\n\t\t\tdescription: repeatTypes.join(\" | \"),\n\t\t\toptional: true,\n\t\t},\n\t\trepeatDelay: {\n\t\t\tdescription: \"${number}s\",\n\t\t\texamples: [\"0s\", \"0.5s\", \"1.0s\"],\n\t\t\toptional: true,\n\t\t},\n\t\tpauseOffscreen: {\n\t\t\tdescription: \"boolean\",\n\t\t\toptional: true,\n\t\t},\n\t\topacity: {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\"0.0\", \"0.5\", \"1.0\"],\n\t\t\toptional: true,\n\t\t},\n\t\tx: {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\"-10\", \"10\", \"25\"],\n\t\t\toptional: true,\n\t\t},\n\t\ty: {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\"-10\", \"10\", \"25\"],\n\t\t\toptional: true,\n\t\t},\n\t\tscale: {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\"0.5\", \"1.2\", \"2.0\"],\n\t\t\toptional: true,\n\t\t},\n\t\trotate: {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\"-90\", \"30\", \"90\", \"360\"],\n\t\t\toptional: true,\n\t\t},\n\t\trotateX: {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\"-90\", \"30\", \"90\", \"360\"],\n\t\t\toptional: true,\n\t\t},\n\t\trotateY: {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\"-90\", \"30\", \"90\", \"360\"],\n\t\t\toptional: true,\n\t\t},\n\t\tskewX: {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\"-10\", \"5\", \"25\"],\n\t\t\toptional: true,\n\t\t},\n\t\tskewY: {\n\t\t\tdescription: \"number\",\n\t\t\texamples: [\"-10\", \"5\", \"25\"],\n\t\t\toptional: true,\n\t\t},\n\t\ttransition: effectTransitionDefinition,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withLoopEffect(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst { loopEffect } = attributes\n\n\tif (isBreakpointVariant(node) && !isUndefined(loopEffect)) {\n\t\treturn [{ applied: false, key: \"loopEffect\", message: breakpointUnsupportedMessage(\"loop effects\") }]\n\t}\n\n\tif (isNullString(loopEffect)) {\n\t\tnode.set({ loopEffectEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslLoopEffectSchema.safeParse(loopEffect)\n\tif (!parsed.success) return\n\n\tconst {\n\t\trepeatType,\n\t\trepeatDelay,\n\t\tpauseOffscreen,\n\t\topacity,\n\t\tx,\n\t\ty,\n\t\tscale,\n\t\trotate,\n\t\trotateX,\n\t\trotateY,\n\t\tskewX,\n\t\tskewY,\n\t\ttransition,\n\t} = parsed.data\n\tconst update: Partial<WithLoopEffect> = {}\n\n\tif (repeatType) {\n\t\tupdate.loopEffectRepeatType = repeatType\n\t}\n\n\tif (isNumber(repeatDelay)) {\n\t\tupdate.loopEffectRepeatDelay = repeatDelay\n\t}\n\n\tif (isBoolean(pauseOffscreen)) {\n\t\tupdate.loopEffectPauseOffscreen = pauseOffscreen\n\t}\n\n\tif (isNumber(opacity)) {\n\t\tupdate.loopEffectOpacity = opacity\n\t}\n\n\tif (isNumber(x)) {\n\t\tupdate.loopEffectX = x\n\t}\n\n\tif (isNumber(y)) {\n\t\tupdate.loopEffectY = y\n\t}\n\n\tif (isNumber(scale)) {\n\t\tupdate.loopEffectScale = scale\n\t}\n\n\tif (isNumber(rotate)) {\n\t\tupdate.loopEffectRotate = rotate\n\t}\n\n\tif (isNumber(rotateX) && rotateX) {\n\t\tupdate.loopEffectRotate3d = true\n\t\tupdate.loopEffectRotateX = rotateX\n\t}\n\n\tif (isNumber(rotateY) && rotateY) {\n\t\tupdate.loopEffectRotate3d = true\n\t\tupdate.loopEffectRotateY = rotateY\n\t}\n\n\tif (isNumber(skewX)) {\n\t\tupdate.loopEffectSkewX = skewX\n\t}\n\n\tif (isNumber(skewY)) {\n\t\tupdate.loopEffectSkewY = skewY\n\t}\n\n\tconst warnings: ReturnType<typeof singleWarning>[] = []\n\tconst parsedTransition = parseDSLTransitionString(transition, effectTransitionSupportedTypes, error => {\n\t\twarnings.push(singleWarning(\"loopEffect.transition\", transition, error.message))\n\t})\n\n\tif (parsedTransition) {\n\t\tupdate.loopEffectTransition = transitionWithDefault(\n\t\t\tparsedTransition,\n\t\t\tnode.loopEffectTransition,\n\t\t\teffectConfig[EffectType.Loop].enabledDefaults.loopEffectTransition,\n\t\t)\n\t}\n\n\tif (isEmptyObject(update)) return warnings.length > 0 ? warnings : undefined\n\n\tupdateWithFallback(update, node, loopEffectEnabledDefaults)\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!hasLoopEffect(node)) return undefined\n\n\tconst nodeLoopEffect: Partial<DSLLoopEffect> = {\n\t\trepeatType: node.loopEffectRepeatType,\n\t\trepeatDelay: isNumber(node.loopEffectRepeatDelay)\n\t\t\t? createCSSDimension(toRoundedNumber(node.loopEffectRepeatDelay), \"s\")\n\t\t\t: undefined,\n\t\tpauseOffscreen: node.loopEffectPauseOffscreen,\n\t\topacity: isNumber(node.loopEffectOpacity) ? toRoundedNumber(node.loopEffectOpacity) : undefined,\n\t\tx: isNumber(node.loopEffectX) ? toRoundedNumber(node.loopEffectX) : undefined,\n\t\ty: isNumber(node.loopEffectY) ? toRoundedNumber(node.loopEffectY) : undefined,\n\t\tscale: isNumber(node.loopEffectScale) ? toRoundedNumber(node.loopEffectScale) : undefined,\n\t\trotate: isNumber(node.loopEffectRotate) ? toRoundedNumber(node.loopEffectRotate) : undefined,\n\t\trotateX: isNumber(node.loopEffectRotateX) ? toRoundedNumber(node.loopEffectRotateX) : undefined,\n\t\trotateY: isNumber(node.loopEffectRotateY) ? toRoundedNumber(node.loopEffectRotateY) : undefined,\n\t\tskewX: isNumber(node.loopEffectSkewX) ? toRoundedNumber(node.loopEffectSkewX) : undefined,\n\t\tskewY: isNumber(node.loopEffectSkewY) ? toRoundedNumber(node.loopEffectSkewY) : undefined,\n\t\ttransition: vekterTransitionToDslTransitionString(node.loopEffectTransition),\n\t}\n\n\treturn { loopEffect: nodeLoopEffect }\n}\n\nexport const loopEffect = {\n\tfor: withLoopEffect,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ loopEffect: DSLLoopEffect }>\n", "import { parseAssetReference } from \"@framerjs/assets\"\nimport { assertNever } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { Mask, MaskType } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { maskAddedImageDefaults, withMasks } from \"document/models/CanvasTree/traits/WithMasks.ts\"\nimport { isConicGradient } from \"document/models/ConicGradientClass.ts\"\nimport { ConicGradient, LinearGradient, RadialGradient } from \"document/models/Gradient.ts\"\nimport { GradientColorStop } from \"document/models/GradientColorStop.ts\"\nimport { isLinearGradient } from \"document/models/LinearGradientClass.ts\"\nimport { isRadialGradient } from \"document/models/RadialGradientClass.ts\"\nimport { isValidURL } from \"document/utils/domainValidation.ts\"\nimport { parseGradient } from \"document/utils/parseGradient.ts\"\nimport { isArray, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\tassetReferenceToURL,\n\tisNullString,\n\tnullString,\n\tunsupportedAttributesWarnings,\n\tunwrapCSSUrl,\n} from \"./helpers.ts\"\nimport { untrustedUrlMessage } from \"./invalidValues.ts\"\nimport { attributeHasGradient, gradientDescription, imageDescription } from \"./traitDescriptions.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n\ttype TraitToAttributesOutput,\n} from \"./types.ts\"\n\nconst defaultGradientStops: readonly GradientColorStop[] = [\n\tnew GradientColorStop({ value: \"rgba(0,0,0,0)\", position: 0 }),\n\tnew GradientColorStop({ value: \"rgba(0,0,0,1)\", position: 1 }),\n]\n\nconst dslMaskAttributesSchema = z\n\t.object({\n\t\tmask: z.string(),\n\t\tmaskComposite: z.enum([\"add\", \"subtract\", \"intersect\", \"exclude\"]).optional(),\n\t\tmaskMode: z.enum([\"luminance\", \"alpha\"]).optional(),\n\t\tmaskResize: z.union([z.enum([\"contain\", \"cover\"]), z.number()]).optional(),\n\t\tmaskRepeat: z.enum([\"repeat\", \"no-repeat\"]).optional(),\n\t\tmaskPosition: z\n\t\t\t.enum([\"center\", \"top\", \"right\", \"bottom\", \"left\", \"top right\", \"top left\", \"bottom right\", \"bottom left\"])\n\t\t\t.optional(),\n\t})\n\t.strict()\n\ntype ParsedDSLMaskAttributes = z.output<typeof dslMaskAttributesSchema>\ntype DSLMaskAttributes = TraitToAttributesOutput<ParsedDSLMaskAttributes>\ninterface MasksTrait {\n\tmasks: DSLMaskAttributes[]\n}\n\nconst definition: TraitAttributeDefinition<MasksTrait> = {\n\tmasks: [\n\t\t{\n\t\t\tmask: {\n\t\t\t\tdescription: `${gradientDescription} | ${imageDescription} | ${nullString}`,\n\t\t\t},\n\t\t\tmaskComposite: {\n\t\t\t\tdescription: \"add | subtract | intersect | exclude\",\n\t\t\t\toptional: true,\n\t\t\t},\n\t\t\tmaskMode: {\n\t\t\t\tdescription: \"luminance | alpha\",\n\t\t\t\toptional: true,\n\t\t\t},\n\t\t\tmaskResize: {\n\t\t\t\tdescription: \"contain | cover | ${number}\",\n\t\t\t\toptional: true,\n\t\t\t},\n\t\t\tmaskRepeat: {\n\t\t\t\tdescription: \"repeat | no-repeat\",\n\t\t\t\toptional: true,\n\t\t\t},\n\t\t\tmaskPosition: {\n\t\t\t\tdescription: \"center | top | right | bottom | left | top right | top left | bottom right | bottom left\",\n\t\t\t\toptional: true,\n\t\t\t},\n\t\t},\n\t],\n}\n\nfunction createMask(maskType: MaskType, overrides: Partial<Mask>): Mask {\n\tconst base: Omit<Mask, \"id\"> = {\n\t\tmaskType,\n\t\tmaskLinearGradient: new LinearGradient({ stops: defaultGradientStops, angle: 0 }),\n\t\tmaskRadialGradient: new RadialGradient({ stops: defaultGradientStops }),\n\t\tmaskConicGradient: new ConicGradient({ stops: defaultGradientStops }),\n\t\tmaskImage: null,\n\t\tmaskComposite: \"add\",\n\t\t...maskAddedImageDefaults,\n\t\t...overrides,\n\t}\n\n\treturn {\n\t\tid: randomID(),\n\t\t...base,\n\t}\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withMasks(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst { masks: masksArray } = attributes\n\tif (!isArray(masksArray)) return\n\n\tconst warnings: TraitWarning[] = []\n\n\tif (masksArray.length === 0) {\n\t\tnode.set({ masks: undefined })\n\t\treturn\n\t}\n\n\tconst firstMask = masksArray[0]\n\tif (masksArray.length === 1 && isObject(firstMask) && isNullString(firstMask.mask)) {\n\t\tnode.set({ masks: undefined })\n\t\treturn\n\t}\n\n\t// Track original indices for proper ordering when mixing gradients and images\n\tconst maskIndexMap = new Map<string, number>()\n\tconst masks: Mask[] = []\n\tlet hasAnyMasks = false\n\n\tfor (let i = 0; i < masksArray.length; i++) {\n\t\tconst maskObj = masksArray[i]\n\t\tconst parsed = dslMaskAttributesSchema.safeParse(maskObj)\n\t\tif (!parsed.success) continue\n\n\t\tconst { mask: maskValue, maskComposite, maskMode, maskResize, maskRepeat, maskPosition } = parsed.data\n\n\t\tif (isNullString(maskValue)) continue\n\n\t\tconst resolvedMaskValue = unwrapCSSUrl(maskValue)\n\n\t\t// Check for gradient (same as fill.ts)\n\t\tif (attributeHasGradient(resolvedMaskValue)) {\n\t\t\tconst gradient = parseGradient(resolvedMaskValue)\n\t\t\tconst overrides: Partial<Mask> = {}\n\n\t\t\t// Note: maskMode, maskResize, maskRepeat, and maskPosition are only available for image\n\t\t\t// masks, so they are skipped here for gradient masks\n\t\t\tif (!isUndefined(maskComposite)) overrides.maskComposite = maskComposite\n\n\t\t\tlet mask: Mask | undefined\n\t\t\tif (isLinearGradient(gradient)) {\n\t\t\t\tmask = createMask(\"linear-gradient\", { maskLinearGradient: gradient, ...overrides })\n\t\t\t} else if (isRadialGradient(gradient)) {\n\t\t\t\tmask = createMask(\"radial-gradient\", { maskRadialGradient: gradient, ...overrides })\n\t\t\t} else if (isConicGradient(gradient)) {\n\t\t\t\tmask = createMask(\"conic-gradient\", { maskConicGradient: gradient, ...overrides })\n\t\t\t}\n\n\t\t\tif (mask) {\n\t\t\t\tmaskIndexMap.set(mask.id, i)\n\t\t\t\tmasks.push(mask)\n\t\t\t\thasAnyMasks = true\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check for image mask\n\t\tif (isValidURL(resolvedMaskValue)) {\n\t\t\tif (!ctx.files.isTrustedUrl(resolvedMaskValue)) {\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: `masks.${i}.mask`,\n\t\t\t\t\tmessage: untrustedUrlMessage(resolvedMaskValue),\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\thasAnyMasks = true\n\t\t\tconst originalIndex = i\n\t\t\tctx.files.updateNodeWithAsset(node, resolvedMaskValue, (reference, latestNode) => {\n\t\t\t\tconst currentMasks = latestNode.masks ? [...latestNode.masks] : []\n\t\t\t\tconst overrides: Partial<Mask> = {\n\t\t\t\t\tmaskImage: reference,\n\t\t\t\t}\n\t\t\t\tif (!isUndefined(maskComposite)) overrides.maskComposite = maskComposite\n\t\t\t\tif (!isUndefined(maskMode)) overrides.maskMode = maskMode\n\t\t\t\tif (!isUndefined(maskResize)) overrides.maskImageResize = maskResize\n\t\t\t\tif (!isUndefined(maskRepeat)) overrides.maskRepeat = maskRepeat\n\t\t\t\tif (!isUndefined(maskPosition)) overrides.maskPosition = maskPosition\n\t\t\t\tconst newMask = createMask(\"image\", overrides)\n\n\t\t\t\t// Find correct insertion position by counting masks with lower original indices\n\t\t\t\tlet insertPosition = 0\n\t\t\t\tfor (const existingMask of currentMasks) {\n\t\t\t\t\tconst existingIndex = maskIndexMap.get(existingMask.id)\n\t\t\t\t\tif (existingIndex !== undefined && existingIndex < originalIndex) {\n\t\t\t\t\t\tinsertPosition++\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Track this mask's index for future insertions\n\t\t\t\tmaskIndexMap.set(newMask.id, originalIndex)\n\n\t\t\t\tcurrentMasks.splice(insertPosition, 0, newMask)\n\t\t\t\tlatestNode.set({ masks: currentMasks })\n\t\t\t\treturn true\n\t\t\t})\n\t\t}\n\t}\n\n\t// Set initial masks with gradients (images will be inserted at correct positions asynchronously)\n\tif (hasAnyMasks) {\n\t\tnode.set({ masks })\n\t}\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: unknown, ctx?: AgentContext): DSLAttributes | undefined {\n\tif (!withMasks(node)) return\n\n\tconst masks = node.masks\n\tif (!masks || masks.length === 0) return\n\n\tconst result: DSLMaskAttributes[] = []\n\n\tfor (const mask of masks) {\n\t\tlet maskValue: string | undefined\n\t\tswitch (mask.maskType) {\n\t\t\tcase \"linear-gradient\":\n\t\t\t\tmaskValue = mask.maskLinearGradient.toCSS()\n\t\t\t\tbreak\n\t\t\tcase \"radial-gradient\":\n\t\t\t\tmaskValue = mask.maskRadialGradient.toCSS()\n\t\t\t\tbreak\n\t\t\tcase \"conic-gradient\":\n\t\t\t\tmaskValue = mask.maskConicGradient.toCSS()\n\t\t\t\tbreak\n\t\t\tcase \"image\": {\n\t\t\t\tif (!isString(mask.maskImage)) break\n\t\t\t\tif (!parseAssetReference(mask.maskImage)) break\n\t\t\t\tmaskValue = assetReferenceToURL(mask.maskImage)\n\t\t\t\tctx?.files.registerTrustedUrl(maskValue)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(mask.maskType)\n\t\t}\n\n\t\tif (!maskValue) continue\n\n\t\tconst maskObj: DSLMaskAttributes = { mask: maskValue }\n\n\t\tif (mask.maskComposite !== \"add\") maskObj.maskComposite = mask.maskComposite\n\n\t\tif (!isUndefined(mask.maskMode) && mask.maskMode !== maskAddedImageDefaults.maskMode) {\n\t\t\tmaskObj.maskMode = mask.maskMode\n\t\t}\n\n\t\tif (!isUndefined(mask.maskImageResize) && mask.maskImageResize !== maskAddedImageDefaults.maskImageResize) {\n\t\t\tmaskObj.maskResize =\n\t\t\t\ttypeof mask.maskImageResize === \"number\" ? toRoundedNumber(mask.maskImageResize) : mask.maskImageResize\n\t\t}\n\n\t\tif (!isUndefined(mask.maskRepeat) && mask.maskRepeat !== maskAddedImageDefaults.maskRepeat) {\n\t\t\tmaskObj.maskRepeat = mask.maskRepeat\n\t\t}\n\n\t\tif (!isUndefined(mask.maskPosition) && mask.maskPosition !== maskAddedImageDefaults.maskPosition) {\n\t\t\tmaskObj.maskPosition = mask.maskPosition\n\t\t}\n\n\t\tresult.push(maskObj)\n\t}\n\n\treturn result.length > 0 ? { masks: result } : undefined\n}\n\nexport const masks = {\n\tfor: withMasks,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<MasksTrait>\n", "import { parseAssetReference } from \"@framerjs/assets\"\nimport {\n\tisEditorComponentLoader,\n\ttype AnyComponentLoader,\n\ttype ComponentLoader,\n\ttype DataDefinition,\n} from \"@framerjs/framer-runtime\"\nimport { assert, isEmptyObject } from \"@framerjs/shared\"\nimport { isCompatibleFileType } from \"document/components/chrome/properties/utils/allowedFileTypes.ts\"\nimport {\n\tconvertTemplateVariableIdsToNames,\n\tconvertTemplateVariableNamesToIds,\n\tgetTemplateVariableWarningMessage,\n\twrapInTemplateVariable,\n} from \"document/components/chrome/siteSettings/templateVariables.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { ShallowWebPageNode } from \"document/models/CanvasTree/nodes/WebPageNode.ts\"\nimport { isRootNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { webMetadataTextMaxLength } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport type { WebMetadata } from \"document/models/CanvasTree/traits/WithWebMetadata.ts\"\nimport { isValidURL } from \"document/utils/domainValidation.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { parseCSSVarRange, parseCSSVariable } from \"library/render/utils/parseCSSVariable.ts\"\nimport { isBoolean, isBooleanString, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { getMediaTypeFromURL } from \"utils/url.ts\"\nimport { extensions as imageAllowedFileTypes } from \"web/lib/images/supportedFormats.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { createCSSVariable, isVariableReferenceHandle } from \"../context/dynamicValues.ts\"\nimport { assetReferenceToURL, isNullString, nullString } from \"./helpers.ts\"\nimport {\n\tdisallowedFileTypeMessage,\n\texpectedAttributeMessage,\n\tsingleWarning,\n\ttraitNotAppliedWarning,\n\tunsupportedAttributeMessage,\n\tuntrustedUrlMessage,\n\tvariableTypeMismatchMessage,\n} from \"./invalidValues.ts\"\nimport { dynamicValueDescription, imageDescription, variableDescription } from \"./traitDescriptions.ts\"\nimport {\n\tnodeToDSLType,\n\ttype DSLAttributeValue,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\ninterface SharedMetadataAttributes {\n\ttitle: string | undefined\n\tdescription: string | undefined\n\tsocialImage: string | undefined\n}\n\ninterface PageMetadataAttributes extends SharedMetadataAttributes {\n\tnoIndex: boolean | string | DSLAttributes | undefined\n\tnoIndexSite: boolean | string | DSLAttributes | undefined\n}\ninterface RootMetadataAttributes extends SharedMetadataAttributes {\n\tfavicon: string | undefined\n\tfaviconDark: string | undefined\n\tappleTouchIcon: string | undefined\n\treducedMotion: boolean | undefined\n\tpreserveQueryParams: boolean | undefined\n}\n\ntype RootOnlyMetadataKey = keyof Omit<RootMetadataAttributes, keyof SharedMetadataAttributes>\ntype PageMetadataKey = keyof PageMetadataAttributes\ntype RootMetadataKey = keyof RootMetadataAttributes\n\nconst templateVariableDescription = \"string with optional template variables\"\nconst textFieldDescription = `string | ${nullString}`\nconst booleanFieldDescription = `boolean | ${nullString}`\nconst imageFieldDescription = `${imageDescription} | ${nullString}`\n\nconst metadataSubPropertiesDescription =\n\t\"metadata sub-properties (e.g. metadata.title, metadata.description, metadata.<etc>)\"\nconst variableCustomPropertyPrefix = \"--variable-\"\n\nfunction metadataTextMaxLengthMessage(maxLength: number, actualLength: number): string {\n\treturn `Max length is ${maxLength} characters (got ${actualLength}). Shorten the value and try again.`\n}\n\nexport const metadataKey = \"metadata\" as const\n\nconst definition: TraitAttributeDefinition<{\n\t// Workaround for an infinite type recursion issue that is complex to solve\n\tmetadata: Omit<PageMetadataAttributes, \"noIndex\" | \"noIndexSite\"> & {\n\t\tnoIndex: boolean | string | undefined\n\t\tnoIndexSite: boolean | string | undefined\n\t}\n}> = {\n\t[metadataKey]: {\n\t\ttitle: {\n\t\t\tdescription: `${templateVariableDescription} | ${textFieldDescription}`,\n\t\t\texamples: [\"My Framer Site\", \"{{Title}} - My Framer Site\", \"{{Title}} {{Slug}}\"],\n\t\t\toptional: true,\n\t\t},\n\t\tdescription: {\n\t\t\tdescription: `${templateVariableDescription} | ${textFieldDescription}`,\n\t\t\texamples: [\"The easiest way to publish with Framer.\", \"{{Title}} {{Slug}}\"],\n\t\t\toptional: true,\n\t\t},\n\t\tsocialImage: {\n\t\t\tdescription: `${variableDescription} | ${imageFieldDescription}`,\n\t\t\toptional: true,\n\t\t},\n\t\tnoIndex: {\n\t\t\tdescription: `${booleanFieldDescription} | ${dynamicValueDescription(\"boolean\")}`,\n\t\t\toptional: true,\n\t\t},\n\t\tnoIndexSite: {\n\t\t\tdescription: `${booleanFieldDescription} | ${dynamicValueDescription(\"boolean\")}`,\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nconst rootMetadataDefinition: TraitAttributeDefinition<{ metadata: RootMetadataAttributes }> = {\n\t[metadataKey]: {\n\t\ttitle: {\n\t\t\tdescription: textFieldDescription,\n\t\t\toptional: true,\n\t\t},\n\t\tdescription: {\n\t\t\tdescription: textFieldDescription,\n\t\t\toptional: true,\n\t\t},\n\t\tsocialImage: {\n\t\t\tdescription: imageFieldDescription,\n\t\t\toptional: true,\n\t\t},\n\t\tfavicon: {\n\t\t\tdescription: imageFieldDescription,\n\t\t\toptional: true,\n\t\t},\n\t\tfaviconDark: {\n\t\t\tdescription: imageFieldDescription,\n\t\t\toptional: true,\n\t\t},\n\t\tappleTouchIcon: {\n\t\t\tdescription: imageFieldDescription,\n\t\t\toptional: true,\n\t\t},\n\t\treducedMotion: {\n\t\t\tdescription: booleanFieldDescription,\n\t\t\toptional: true,\n\t\t},\n\t\tpreserveQueryParams: {\n\t\t\tdescription: booleanFieldDescription,\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nconst rootOnlyMetadataKeys: readonly RootOnlyMetadataKey[] = [\n\t\"favicon\",\n\t\"faviconDark\",\n\t\"appleTouchIcon\",\n\t\"reducedMotion\",\n\t\"preserveQueryParams\",\n]\nconst pageMetadataKeys = new Set<PageMetadataKey>([\"title\", \"description\", \"socialImage\", \"noIndex\", \"noIndexSite\"])\nconst rootMetadataKeys = new Set<RootMetadataKey>([\"title\", \"description\", \"socialImage\", ...rootOnlyMetadataKeys])\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isWebPageNode(node) || !node.webMetadata) return\n\n\tconst templateVariables = getEditorTemplateVariablesContext(ctx.componentLoader, node.dataIdentifier)\n\tconst metadata: Partial<PageMetadataAttributes> = {}\n\tconst { webMetadata } = node\n\n\tif (isString(webMetadata.title)) {\n\t\tmetadata.title = templateVariables\n\t\t\t? convertTemplateVariableIdsToNames(\n\t\t\t\t\twebMetadata.title,\n\t\t\t\t\ttemplateVariables.collectionData,\n\t\t\t\t\ttemplateVariables.componentLoader,\n\t\t\t\t)\n\t\t\t: webMetadata.title\n\t}\n\n\tif (isString(webMetadata.description)) {\n\t\tmetadata.description = templateVariables\n\t\t\t? convertTemplateVariableIdsToNames(\n\t\t\t\t\twebMetadata.description,\n\t\t\t\t\ttemplateVariables.collectionData,\n\t\t\t\t\ttemplateVariables.componentLoader,\n\t\t\t\t)\n\t\t\t: webMetadata.description\n\t}\n\n\tconst socialImage = webMetadata.socialImage\n\tif (isVariableReference(socialImage)) {\n\t\tmetadata.socialImage =\n\t\t\tctx.dynamicValues.resolveAttributeFromDynamicValue(socialImage, node) ?? createCSSVariable(socialImage.id)\n\t} else if (isString(socialImage) && socialImage.length > 0) {\n\t\tmetadata.socialImage = serializeTrustedImageField(socialImage, ctx)\n\t}\n\n\tconst noIndex = serializeMetadataBooleanField(webMetadata.noIndex, node, ctx)\n\tif (!isUndefined(noIndex)) metadata.noIndex = noIndex\n\n\tconst noIndexSite = serializeMetadataBooleanField(webMetadata.noIndexSite, node, ctx)\n\tif (!isUndefined(noIndexSite)) metadata.noIndexSite = noIndexSite\n\n\tif (isEmptyObject(metadata)) return\n\n\treturn { [metadataKey]: metadata }\n}\n\nfunction serializeMetadataBooleanField(\n\tvalue: WebMetadata[\"noIndex\"],\n\tnode: CanvasNode,\n\tctx: AgentContext,\n): boolean | string | DSLAttributes | undefined {\n\tif (isUndefined(value)) return\n\tif (isDynamicValue(value)) return ctx.dynamicValues.resolveAttributeFromDynamicValue(value, node)\n\treturn value\n}\n\nfunction serializeTrustedImageField(value: string, ctx: AgentContext): string {\n\tconst url = assetReferenceToURL(value)\n\tctx.files.registerTrustedUrl(url, parseAssetReference(value) ? value : undefined)\n\treturn url\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tconst { [metadataKey]: metadata } = attributes\n\tif (isUndefined(metadata)) return\n\tif (isRootNode(node)) return\n\tif (!isWebPageNode(node)) {\n\t\treturn [{ applied: false, key: metadataKey, message: unsupportedAttributeMessage(nodeToDSLType(node, ctx)) }]\n\t}\n\n\tif (!isObject(metadata)) {\n\t\treturn [{ applied: false, key: metadataKey, message: metadataSubPropertiesDescription }]\n\t}\n\n\tconst templateVariables = getEditorTemplateVariablesContext(ctx.componentLoader, node.dataIdentifier)\n\tconst warnings: TraitWarning[] = []\n\tconst metadataUpdates: Partial<WebMetadata> = {}\n\n\tcollectPageMetadataTextField(\"title\", metadata.title, metadataUpdates, warnings, templateVariables, node, ctx)\n\tcollectPageMetadataTextField(\n\t\t\"description\",\n\t\tmetadata.description,\n\t\tmetadataUpdates,\n\t\twarnings,\n\t\ttemplateVariables,\n\t\tnode,\n\t\tctx,\n\t)\n\tcollectPageMetadataSocialImage(node, metadata.socialImage, metadataUpdates, warnings, ctx)\n\tcollectPageMetadataBooleanField(node, \"noIndex\", metadata.noIndex, metadataUpdates, warnings, ctx)\n\tcollectPageMetadataBooleanField(node, \"noIndexSite\", metadata.noIndexSite, metadataUpdates, warnings, ctx)\n\tbackfillLegacyNoIndexSite(metadataUpdates, node.webMetadata)\n\n\tif (!isEmptyObject(metadataUpdates)) {\n\t\tnode.set({ webMetadata: { ...node.webMetadata, ...metadataUpdates } })\n\t}\n\n\tif (warnings.length > 0) return warnings\n}\n\ninterface CollectTextFieldOptions {\n\tkey: keyof Pick<SharedMetadataAttributes, \"title\" | \"description\">\n\tvalue: unknown\n\tmetadataUpdates: Partial<WebMetadata>\n\twarnings: TraitWarning[]\n\tdescription: string\n\tmaxLength: number\n\ttransform?: (value: string) => string\n\tinvalidValueMessage?: (value: unknown) => string\n\tgetAppliedWarning?: (storedValue: string) => string | undefined\n}\n\nfunction collectTextField({\n\tkey,\n\tvalue,\n\tmetadataUpdates,\n\twarnings,\n\tdescription,\n\tmaxLength,\n\ttransform = rawValue => rawValue,\n\tinvalidValueMessage = invalidValue => expectedAttributeMessage(invalidValue, description),\n\tgetAppliedWarning,\n}: CollectTextFieldOptions) {\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value) || value === \"\") {\n\t\tmetadataUpdates[key] = undefined\n\t\treturn\n\t}\n\n\tconst keyPrefix = `${metadataKey}.${key}`\n\n\tif (!isString(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: keyPrefix,\n\t\t\tmessage: invalidValueMessage(value),\n\t\t})\n\t\treturn\n\t}\n\n\tconst storedValue = transform(value)\n\tif (storedValue.length > maxLength) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: keyPrefix,\n\t\t\tmessage: metadataTextMaxLengthMessage(maxLength, storedValue.length),\n\t\t})\n\t\treturn\n\t}\n\n\tmetadataUpdates[key] = storedValue\n\n\tconst warningMessage = getAppliedWarning?.(storedValue)\n\tif (!warningMessage) return\n\n\twarnings.push({\n\t\tapplied: true,\n\t\tkey: keyPrefix,\n\t\tmessage: warningMessage,\n\t})\n}\n\nfunction collectPageMetadataTextField(\n\tkey: keyof Pick<PageMetadataAttributes, \"title\" | \"description\">,\n\tvalue: unknown,\n\tmetadataUpdates: Partial<WebMetadata>,\n\twarnings: TraitWarning[],\n\ttemplateVariables: EditorTemplateVariablesContext | undefined,\n\tnode: CanvasNode,\n\tctx: AgentContext,\n) {\n\tcollectTextField({\n\t\tkey,\n\t\tvalue,\n\t\tmetadataUpdates,\n\t\twarnings,\n\t\tdescription: textFieldDescription,\n\t\tmaxLength: webMetadataTextMaxLength,\n\t\ttransform: rawValue => {\n\t\t\tconst normalizedValue = normalizeMetadataTemplateVariables(rawValue, node, ctx)\n\t\t\treturn templateVariables\n\t\t\t\t? convertTemplateVariableNamesToIds(\n\t\t\t\t\t\tnormalizedValue,\n\t\t\t\t\t\ttemplateVariables.collectionData,\n\t\t\t\t\t\ttemplateVariables.componentLoader,\n\t\t\t\t\t)\n\t\t\t\t: normalizedValue\n\t\t},\n\t\tgetAppliedWarning: storedValue =>\n\t\t\ttemplateVariables\n\t\t\t\t? getTemplateVariableWarningMessage({\n\t\t\t\t\t\tcollectionData: templateVariables.collectionData,\n\t\t\t\t\t\tcomponentLoader: templateVariables.componentLoader,\n\t\t\t\t\t\ttype: \"id\",\n\t\t\t\t\t\tvalue: storedValue,\n\t\t\t\t\t})\n\t\t\t\t: undefined,\n\t})\n}\n\nfunction collectPageMetadataSocialImage(\n\tnode: ShallowWebPageNode,\n\tvalue: unknown,\n\tmetadataUpdates: Partial<WebMetadata>,\n\twarnings: TraitWarning[],\n\tctx: AgentContext,\n) {\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value) || value === \"\") {\n\t\tmetadataUpdates.socialImage = undefined\n\t\treturn\n\t}\n\n\tconst keyPrefix = `${metadataKey}.socialImage`\n\n\tif (!isString(value)) {\n\t\twarnings.push(singleWarning(keyPrefix, value, imageFieldDescription))\n\t\treturn\n\t}\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, { node })\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(keyPrefix, message)))\n\t\treturn\n\t}\n\n\tif (resolveHandleResult.type === \"resolved\" && isVariableReferenceHandle(resolveHandleResult.handle)) {\n\t\tif (resolveHandleResult.handle.variable.type === ControlType.Image) {\n\t\t\tmetadataUpdates.socialImage = resolveHandleResult.handle.reference(node)\n\t\t\treturn\n\t\t}\n\n\t\twarnings.push(\n\t\t\tsingleWarning(\n\t\t\t\tkeyPrefix,\n\t\t\t\tvalue,\n\t\t\t\tvariableTypeMismatchMessage(resolveHandleResult.handle.variable.name, \"an image\"),\n\t\t\t),\n\t\t)\n\t\treturn\n\t}\n\n\tif (parseAssetReference(value)) {\n\t\tmetadataUpdates.socialImage = value\n\t\treturn\n\t}\n\n\tif (!isValidURL(value)) {\n\t\twarnings.push(singleWarning(keyPrefix, value, imageFieldDescription))\n\t\treturn\n\t}\n\n\tif (!ctx.files.isTrustedUrl(value)) {\n\t\twarnings.push({ applied: false, key: keyPrefix, message: untrustedUrlMessage(value) })\n\t\treturn\n\t}\n\n\tctx.files.updateNodeWithAsset(node, value, (reference, latestNode) => {\n\t\tassert(isWebPageNode(latestNode), `${keyPrefix} uploads only target WebPageNode`)\n\t\tlatestNode.set({ webMetadata: { ...latestNode.webMetadata, socialImage: reference } })\n\t\treturn true\n\t})\n}\n\nfunction collectPageMetadataBooleanField(\n\tnode: ShallowWebPageNode,\n\tkey: keyof Pick<PageMetadataAttributes, \"noIndex\" | \"noIndexSite\">,\n\tvalue: DSLAttributeValue,\n\tmetadataUpdates: Partial<WebMetadata>,\n\twarnings: TraitWarning[],\n\tctx: AgentContext,\n) {\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\tmetadataUpdates[key] = undefined\n\t\treturn\n\t}\n\n\tconst keyPrefix = `${metadataKey}.${key}`\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, {\n\t\texpectedType: [ControlType.Boolean],\n\t\tnode,\n\t})\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(keyPrefix, message)))\n\t\treturn\n\t}\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tmetadataUpdates[key] = resolveHandleResult.handle.reference(node)\n\t\treturn\n\t}\n\n\tif (isBoolean(value)) {\n\t\tmetadataUpdates[key] = value\n\t\treturn\n\t}\n\n\tif (!isBooleanString(value)) {\n\t\twarnings.push(singleWarning(keyPrefix, value, booleanFieldDescription))\n\t\treturn\n\t}\n\n\tmetadataUpdates[key] = value === \"true\"\n}\n\nfunction backfillLegacyNoIndexSite(\n\tmetadataUpdates: Partial<WebMetadata>,\n\tcurrentMetadata: WebMetadata | undefined,\n): void {\n\tif (!(\"noIndex\" in metadataUpdates)) return\n\tif (\"noIndexSite\" in metadataUpdates) return\n\tif (currentMetadata?.noIndexSite !== undefined) return\n\n\tmetadataUpdates.noIndexSite = metadataUpdates.noIndex\n}\n\nfunction rootMetadataToAttributes(\n\tnode: CanvasNode,\n\t_parent: MaybeCanvasNode,\n\tctx: AgentContext,\n): DSLAttributes | undefined {\n\tif (!isRootNode(node) || !node.webMetadata) return\n\n\tconst metadata: Partial<RootMetadataAttributes> = {}\n\tconst { webMetadata } = node\n\n\tif (isString(webMetadata.title)) metadata.title = webMetadata.title\n\tif (isString(webMetadata.description)) metadata.description = webMetadata.description\n\n\tif (isString(webMetadata.socialImage) && webMetadata.socialImage.length > 0) {\n\t\tmetadata.socialImage = serializeTrustedImageField(webMetadata.socialImage, ctx)\n\t}\n\n\tif (isString(webMetadata.favicon) && webMetadata.favicon.length > 0) {\n\t\tmetadata.favicon = serializeTrustedImageField(webMetadata.favicon, ctx)\n\t}\n\n\tif (isString(webMetadata.faviconDark) && webMetadata.faviconDark.length > 0) {\n\t\tmetadata.faviconDark = serializeTrustedImageField(webMetadata.faviconDark, ctx)\n\t}\n\n\tif (isString(webMetadata.appleTouchIcon) && webMetadata.appleTouchIcon.length > 0) {\n\t\tmetadata.appleTouchIcon = serializeTrustedImageField(webMetadata.appleTouchIcon, ctx)\n\t}\n\n\tif (isBoolean(webMetadata.reducedMotion)) metadata.reducedMotion = webMetadata.reducedMotion\n\tif (isBoolean(webMetadata.preserveQueryParams)) metadata.preserveQueryParams = webMetadata.preserveQueryParams\n\n\tif (isEmptyObject(metadata)) return\n\n\treturn { [metadataKey]: metadata }\n}\n\nfunction rootMetadataFromAttributes(\n\tnode: CanvasNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): TraitWarning[] | undefined {\n\tconst { metadata } = attributes\n\tif (isUndefined(metadata)) return\n\tif (!isRootNode(node)) return getUnsupportedRootMetadataWarnings(node, metadata, ctx)\n\n\tif (!isObject(metadata)) {\n\t\treturn [{ applied: false, key: metadataKey, message: metadataSubPropertiesDescription }]\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\tconst metadataUpdates: Partial<WebMetadata> = {}\n\n\tcollectTextField({\n\t\tkey: \"title\",\n\t\tvalue: metadata.title,\n\t\tmetadataUpdates,\n\t\twarnings,\n\t\tdescription: textFieldDescription,\n\t\tmaxLength: webMetadataTextMaxLength,\n\t})\n\tcollectTextField({\n\t\tkey: \"description\",\n\t\tvalue: metadata.description,\n\t\tmetadataUpdates,\n\t\twarnings,\n\t\tdescription: textFieldDescription,\n\t\tmaxLength: webMetadataTextMaxLength,\n\t})\n\tcollectRootImageField(node, \"socialImage\", metadata.socialImage, metadataUpdates, warnings, ctx)\n\tcollectRootImageField(node, \"favicon\", metadata.favicon, metadataUpdates, warnings, ctx)\n\tcollectRootImageField(node, \"faviconDark\", metadata.faviconDark, metadataUpdates, warnings, ctx)\n\tcollectRootImageField(node, \"appleTouchIcon\", metadata.appleTouchIcon, metadataUpdates, warnings, ctx)\n\tcollectRootBooleanField(\"reducedMotion\", metadata.reducedMotion, metadataUpdates, warnings)\n\tcollectRootBooleanField(\"preserveQueryParams\", metadata.preserveQueryParams, metadataUpdates, warnings)\n\tcollectUnsupportedMetadataKeyWarnings(metadata, rootMetadataKeys, node, warnings, ctx)\n\n\tif (!isEmptyObject(metadataUpdates)) {\n\t\tnode.set({ webMetadata: { ...node.webMetadata, ...metadataUpdates } })\n\t}\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction getUnsupportedRootMetadataWarnings(\n\tnode: CanvasNode,\n\tmetadata: unknown,\n\tctx: AgentContext,\n): TraitWarning[] | undefined {\n\tif (!isObject(metadata)) return\n\n\tconst warnings: TraitWarning[] = []\n\tcollectUnsupportedMetadataKeyWarnings(metadata, pageMetadataKeys, node, warnings, ctx)\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction collectUnsupportedMetadataKeyWarnings(\n\tmetadata: Record<string, unknown>,\n\tsupportedKeys: ReadonlySet<string>,\n\tnode: CanvasNode,\n\twarnings: TraitWarning[],\n\tctx: AgentContext,\n) {\n\tfor (const key of Object.keys(metadata)) {\n\t\tif (supportedKeys.has(key)) continue\n\t\tif (isUndefined(metadata[key])) continue\n\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: `${metadataKey}.${key}`,\n\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t})\n\t}\n}\n\nfunction collectRootImageField(\n\tnode: CanvasNode,\n\tkey: keyof Pick<RootMetadataAttributes, \"favicon\" | \"faviconDark\" | \"appleTouchIcon\" | \"socialImage\">,\n\tvalue: unknown,\n\tmetadataUpdates: Partial<WebMetadata>,\n\twarnings: TraitWarning[],\n\tctx: AgentContext,\n) {\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value) || value === \"\") {\n\t\tmetadataUpdates[key] = undefined\n\t\treturn\n\t}\n\n\tconst keyPrefix = `${metadataKey}.${key}`\n\n\tif (!isString(value)) {\n\t\twarnings.push(singleWarning(keyPrefix, value, imageFieldDescription))\n\t\treturn\n\t}\n\n\tif (parseAssetReference(value)) {\n\t\tmetadataUpdates[key] = value\n\t\treturn\n\t}\n\n\tif (!isValidURL(value)) {\n\t\twarnings.push(singleWarning(keyPrefix, value, imageFieldDescription))\n\t\treturn\n\t}\n\n\tif (!ctx.files.isTrustedUrl(value)) {\n\t\twarnings.push({ applied: false, key: keyPrefix, message: untrustedUrlMessage(value) })\n\t\treturn\n\t}\n\n\tconst mediaType = getMediaTypeFromURL(value)\n\tif (mediaType && !isCompatibleFileType(mediaType, imageAllowedFileTypes)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: keyPrefix,\n\t\t\tmessage: disallowedFileTypeMessage(value, imageAllowedFileTypes, mediaType),\n\t\t})\n\t\treturn\n\t}\n\n\tctx.files.updateNodeWithAsset(node, value, (reference, latestNode) => {\n\t\tassert(isRootNode(latestNode), `${keyPrefix} uploads only target RootNode`)\n\t\tlatestNode.set({ webMetadata: { ...latestNode.webMetadata, [key]: reference } })\n\t\treturn true\n\t})\n}\n\nfunction collectRootBooleanField(\n\tkey: keyof Pick<RootMetadataAttributes, \"reducedMotion\" | \"preserveQueryParams\">,\n\tvalue: unknown,\n\tmetadataUpdates: Partial<WebMetadata>,\n\twarnings: TraitWarning[],\n) {\n\tif (isUndefined(value)) return\n\n\tif (isNullString(value)) {\n\t\tmetadataUpdates[key] = undefined\n\t\treturn\n\t}\n\n\tif (isBoolean(value)) {\n\t\tmetadataUpdates[key] = value\n\t\treturn\n\t}\n\n\tif (!isBooleanString(value)) {\n\t\twarnings.push(singleWarning(`${metadataKey}.${key}`, value, booleanFieldDescription))\n\t\treturn\n\t}\n\n\tmetadataUpdates[key] = value === \"true\"\n}\n\nfunction normalizeMetadataTemplateVariables(value: string, node: CanvasNode, ctx: AgentContext): string {\n\tlet normalized = \"\"\n\tlet cursor = 0\n\n\twhile (true) {\n\t\tconst range = parseCSSVarRange(value, cursor)\n\t\tif (!range) return normalized + value.slice(cursor)\n\n\t\tnormalized += value.slice(cursor, range.start)\n\n\t\tconst cssReference = value.slice(range.start, range.end)\n\t\tconst templateSymbol = getTemplateVariableSymbolFromCSSReference(cssReference, node, ctx)\n\t\tif (!templateSymbol) {\n\t\t\tnormalized += cssReference\n\t\t\tcursor = range.end\n\t\t\tcontinue\n\t\t}\n\n\t\tnormalized += wrapInTemplateVariable(templateSymbol)\n\t\tcursor = range.end\n\t}\n}\n\nfunction getTemplateVariableSymbolFromCSSReference(\n\tvalue: string,\n\tnode: CanvasNode,\n\tctx: AgentContext,\n): string | undefined {\n\tconst resolvedReference = ctx.dynamicValues.getVariableReferenceHandleByVariableId(value)?.toAttributes(node) ?? value\n\tconst customProperty = parseCSSVariable(resolvedReference).customProperty?.trim()\n\tif (!customProperty?.startsWith(variableCustomPropertyPrefix)) return\n\treturn customProperty.slice(variableCustomPropertyPrefix.length)\n}\n\ninterface EditorTemplateVariablesContext {\n\tcollectionData: DataDefinition | null\n\tcomponentLoader: ComponentLoader\n}\n\nfunction getEditorTemplateVariablesContext(\n\tcomponentLoader: AnyComponentLoader,\n\tdataIdentifier: string | undefined,\n): EditorTemplateVariablesContext | undefined {\n\tif (!isEditorComponentLoader(componentLoader)) return\n\n\treturn {\n\t\tcollectionData: componentLoader.dataForIdentifier(dataIdentifier),\n\t\tcomponentLoader,\n\t}\n}\n\nexport const metadata = {\n\tfor: isWebPageNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{\n\t// Workaround for an infinite type recursion issue that is complex to solve\n\tmetadata: Omit<PageMetadataAttributes, \"noIndex\" | \"noIndexSite\"> & {\n\t\tnoIndex: boolean | string | undefined\n\t\tnoIndexSite: boolean | string | undefined\n\t}\n}>\n\nexport const rootMetadata = {\n\tfor: isRootNode,\n\tdefinition: rootMetadataDefinition,\n\tfromAttributes: rootMetadataFromAttributes,\n\ttoAttributes: rootMetadataToAttributes,\n} satisfies TraitDefinition<{ metadata: RootMetadataAttributes }>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isColorStyleTokenNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { uniqueStylePresetName } from \"utils/textStylePresetUtils.ts\"\nimport type { AgentContext } from \"./context/AgentContext.ts\"\nimport { StylePresetType, isAgentSupportedStylePresetNode, stylePresetTypeForNode } from \"./context/stylePresetType.ts\"\n\n/** Returns a unique name for a new style preset, checked against existing presets of the same type. */\nexport function uniqueNameForNewStylePreset(type: StylePresetType, desiredName: string, ctx: AgentContext): string {\n\treturn uniqueNameByType(type, desiredName, ctx.stylePresets.existingNamesForType(type))\n}\n\n/** Returns a unique name for a new color token, checked against existing tokens. */\nexport function uniqueNameForNewColorToken(desiredName: string, ctx: AgentContext): string {\n\treturn uniqueName(desiredName, ctx.tokens.existingNames())\n}\n\n/**\n * Returns a unique name for renaming an existing style preset or color token. Returns undefined\n * when the desired name is already unique (or when the node is neither a preset nor a token).\n */\nexport function uniqueNameForRename(node: CanvasNode, desiredName: string, ctx: AgentContext) {\n\tif (isAgentSupportedStylePresetNode(node)) {\n\t\tconst type = stylePresetTypeForNode(node)\n\t\tconst existingNames = new Set(ctx.stylePresets.existingNamesForType(type))\n\t\texistingNames.delete(ctx.stylePresets.forId(node.id)?.name ?? \"\")\n\t\tconst finalName = uniqueNameByType(type, desiredName, existingNames)\n\t\tif (finalName === desiredName) return\n\t\treturn { name: finalName, kind: `${type} style preset` }\n\t}\n\n\tif (isColorStyleTokenNode(node)) {\n\t\tconst existingNames = new Set(ctx.tokens.existingNames())\n\t\tconst currentName = ctx.tokens.nameForNode(node)\n\t\tif (currentName) existingNames.delete(currentName)\n\t\tconst finalName = uniqueName(desiredName, existingNames)\n\t\tif (finalName === desiredName) return\n\t\treturn { name: finalName, kind: \"color style\" }\n\t}\n}\n\n// Text presets use the heading letter scheme (\"Heading 1\" -> \"Heading 1b\") to match the sidebar's\n// duplicate behavior; everything else falls back to the numeric suffix scheme (\"Body\" -> \"Body 2\").\nfunction uniqueNameByType(type: StylePresetType, desiredName: string, existingNames: ReadonlySet<string>): string {\n\tif (type === StylePresetType.Text) return uniqueStylePresetName(desiredName, existingNames)\n\treturn uniqueName(desiredName, existingNames)\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport { getNodeName } from \"document/components/chrome/assets/utils/getNodeName.ts\"\nimport { getRawWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport type { CanvasNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { getPathForReferencedNode } from \"document/models/CanvasTree/nodes/utils/entityFolderNode.ts\"\nimport { isColorStyleTokenNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { type WithName, withName } from \"document/models/CanvasTree/traits/WithName.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { getCollectionNameForPage, normalizeRouteForLLM } from \"../../utils/siteMap.ts\"\nimport { createEntityFolderParentNodeIfNeeded, getEntityTypeRootIdForNode } from \"../TreeResolver.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isAgentSupportedStylePresetNode } from \"../context/stylePresetType.ts\"\nimport { uniqueNameForRename } from \"../presetNaming.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithName> = {\n\tname: {\n\t\tdescription: \"The name of the node\",\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withName(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tif (!isString(attributes.name)) return\n\n\t// If the name clashes with an existing name, make it unique (e.g. \"Heading 1\" -> \"Heading 1b\" or \"Link 1\" -> \"Link 2\")\n\tconst renamed = uniqueNameForRename(node, attributes.name, ctx)\n\tconst finalName = renamed?.name ?? attributes.name\n\n\tif (!createEntityFolderParentNodeIfNeeded(node, finalName, ctx.treeStore)) {\n\t\tnode.set({ name: finalName })\n\t}\n\n\t// Keep the name caches in sync so a follow-up rename in the same turn sees the new state.\n\tif (isColorStyleTokenNode(node)) ctx.tokens.setName(node.id, finalName)\n\tif (isAgentSupportedStylePresetNode(node)) ctx.stylePresets.setName(node.id, finalName)\n\n\tif (renamed) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: true,\n\t\t\t\tkey: \"name\",\n\t\t\t\tmessage: `A ${renamed.kind} named ${escapeValue(attributes.name)} already exists; renamed to ${escapeValue(renamed.name)}.`,\n\t\t\t} satisfies TraitWarning,\n\t\t]\n\t}\n}\n\nexport function getNameValue(tree: CanvasTree, node: CanvasNode) {\n\tif (!withName(node)) return\n\tif (isWebPageNode(node)) {\n\t\tif (tree.root.homePageNodeId === node.id) return Dictionary.Home\n\t\tconst rawPath = getRawWebPagePath(tree, node)\n\t\tif (!rawPath) return\n\t\tconst collectionName = getCollectionNameForPage(tree, node)\n\t\treturn normalizeRouteForLLM(rawPath, collectionName)\n\t}\n\tconst entityTypeRootId = getEntityTypeRootIdForNode(node)\n\tif (entityTypeRootId) {\n\t\treturn getPathForReferencedNode(tree, node, entityTypeRootId, { leadingSlash: false })\n\t}\n\tconst nameValue = getNodeName(node)\n\tif (nameValue === Dictionary.Unknown) return\n\treturn nameValue\n}\n\nexport const name = {\n\tfor: withName,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes: (node, _parent, ctx) => {\n\t\tconst nameValue = getNameValue(ctx.treeStore.getDataTreeOrPartialTree(), node)\n\t\tif (isUndefined(nameValue)) return\n\t\treturn { name: nameValue }\n\t},\n} satisfies TraitDefinition<WithName>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { type WithOpacity, withOpacity } from \"document/models/CanvasTree/traits/WithOpacity.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { looksLikeVariableReference } from \"../context/dynamicValues.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { expectedNumberValue, traitNotAppliedWarning, warning } from \"./invalidValues.ts\"\nimport { dynamicValueDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithOpacity> = {\n\topacity: {\n\t\tdescription: `number | ${dynamicValueDescription(\"number\")}`,\n\t\texamples: [\"0.0\", \"0.5\", \"1.0\", \"var(--variable-opacity)\"],\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withOpacity(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.opacity, { node })\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\treturn resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"opacity\", message))\n\t}\n\n\tconst reference = resolveHandleResult.type === \"resolved\" ? resolveHandleResult.handle.reference(node) : undefined\n\tconst opacity = reference ?? tryParseNumber(attributes.opacity)\n\tif (!isUndefined(opacity)) {\n\t\tnode.set({ opacity })\n\t\treturn\n\t}\n\n\tif (!isUndefined(attributes.opacity) && !looksLikeVariableReference(attributes.opacity)) {\n\t\treturn warning(\"opacity\", attributes.opacity, expectedNumberValue)\n\t}\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withOpacity(node)) return {}\n\n\tconst opacityAttribute = isDynamicValue(node.opacity)\n\t\t? ctx.dynamicValues.resolveAttributeFromDynamicValue(node.opacity, node)\n\t\t: undefined\n\tif (opacityAttribute) {\n\t\treturn {\n\t\t\topacity: opacityAttribute,\n\t\t}\n\t}\n\n\t// Skip default opacity. All nodes have 1.\n\tconst opacity = node.resolveValue(\"opacity\")\n\tif (isUndefined(opacity) || opacity === 1) return {}\n\n\treturn {\n\t\topacity: opacity.toString(),\n\t}\n}\n\nexport const opacity = {\n\tfor: withOpacity,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<WithOpacity>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\ttype Overflow,\n\ttype WithOverflow,\n\tallOverflowValues,\n\tisOverflowValue,\n\twithOverflow,\n} from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { looksLikeVariableReference } from \"../context/dynamicValues.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { singleWarning, traitNotAppliedWarning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst overflowDescription = allOverflowValues.join(\" | \")\n\nconst definition: TraitAttributeDefinition<WithOverflow> = {\n\toverflow: {\n\t\tdescription: overflowDescription,\n\t\toptional: true,\n\t},\n\toverflowX: {\n\t\tdescription: overflowDescription,\n\t\toptional: true,\n\t},\n\toverflowY: {\n\t\tdescription: overflowDescription,\n\t\toptional: true,\n\t},\n}\n\nconst expectedOverflowValues = allOverflowValues.map(v => `\"${v}\"`).join(\", \")\n\nfunction normalizeOverflowValue(value: unknown): Exclude<Overflow, \"scroll\"> | undefined {\n\tif (value === \"scroll\") return \"auto\"\n\tif (isOverflowValue(value)) return value\n\treturn undefined\n}\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withOverflow(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst warnings: TraitWarning[] = []\n\tconst resolveOverflowResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.overflow, { node })\n\n\tif (resolveOverflowResult.type === \"resolved\") {\n\t\tnode.set({ overflow: resolveOverflowResult.handle.reference(node) })\n\t} else if (resolveOverflowResult.type === \"invalid\") {\n\t\twarnings.push(...resolveOverflowResult.errorMessages.map(message => traitNotAppliedWarning(\"overflow\", message)))\n\t} else if (attributes.overflow !== undefined && !looksLikeVariableReference(attributes.overflow)) {\n\t\tconst normalizedOverflow = normalizeOverflowValue(attributes.overflow)\n\t\tif (normalizedOverflow !== undefined) {\n\t\t\tnode.set({ overflow: normalizedOverflow })\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"overflow\", attributes.overflow, expectedOverflowValues))\n\t\t}\n\t}\n\n\tconst resolveOverflowXResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.overflowX, { node })\n\n\tif (resolveOverflowXResult.type === \"resolved\") {\n\t\tnode.set({ overflowX: resolveOverflowXResult.handle.reference(node) })\n\t} else if (resolveOverflowXResult.type === \"invalid\") {\n\t\twarnings.push(...resolveOverflowXResult.errorMessages.map(message => traitNotAppliedWarning(\"overflowX\", message)))\n\t} else if (attributes.overflowX !== undefined && !looksLikeVariableReference(attributes.overflowX)) {\n\t\tconst normalizedOverflowX = normalizeOverflowValue(attributes.overflowX)\n\t\tif (normalizedOverflowX !== undefined) {\n\t\t\tnode.set({ overflowX: normalizedOverflowX })\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"overflowX\", attributes.overflowX, expectedOverflowValues))\n\t\t}\n\t}\n\n\tconst resolveOverflowYResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.overflowY, { node })\n\n\tif (resolveOverflowYResult.type === \"resolved\") {\n\t\tnode.set({ overflowY: resolveOverflowYResult.handle.reference(node) })\n\t} else if (resolveOverflowYResult.type === \"invalid\") {\n\t\twarnings.push(...resolveOverflowYResult.errorMessages.map(message => traitNotAppliedWarning(\"overflowY\", message)))\n\t} else if (attributes.overflowY !== undefined && !looksLikeVariableReference(attributes.overflowY)) {\n\t\tconst normalizedOverflowY = normalizeOverflowValue(attributes.overflowY)\n\t\tif (normalizedOverflowY !== undefined) {\n\t\t\tnode.set({ overflowY: normalizedOverflowY })\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"overflowY\", attributes.overflowY, expectedOverflowValues))\n\t\t}\n\t}\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: unknown, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withOverflow(node)) return\n\n\tconst result: DSLAttributes = {}\n\tconst overflow = isDynamicValue(node.overflow)\n\t\t? ctx.dynamicValues.resolveAttributeFromDynamicValue(node.overflow, node)\n\t\t: undefined\n\tif (overflow) {\n\t\tresult.overflow = overflow\n\t} else {\n\t\tconst overflowValue = node.resolveValue(\"overflow\")\n\t\tif (isOverflowValue(overflowValue) && overflowValue !== \"visible\") {\n\t\t\tresult.overflow = overflowValue\n\t\t}\n\t}\n\n\tconst overflowX = isDynamicValue(node.overflowX)\n\t\t? ctx.dynamicValues.resolveAttributeFromDynamicValue(node.overflowX, node)\n\t\t: undefined\n\tif (overflowX) {\n\t\tresult.overflowX = overflowX\n\t} else {\n\t\tconst overflowValue = node.resolveValue(\"overflowX\")\n\t\tif (isOverflowValue(overflowValue) && overflowValue !== \"visible\") result.overflowX = overflowValue\n\t}\n\n\tconst overflowY = isDynamicValue(node.overflowY)\n\t\t? ctx.dynamicValues.resolveAttributeFromDynamicValue(node.overflowY, node)\n\t\t: undefined\n\tif (overflowY) {\n\t\tresult.overflowY = overflowY\n\t} else {\n\t\tconst overflowValue = node.resolveValue(\"overflowY\")\n\t\tif (isOverflowValue(overflowValue) && overflowValue !== \"visible\") result.overflowY = overflowValue\n\t}\n\n\treturn Object.keys(result).length > 0 ? result : undefined\n}\n\nexport const overflow = {\n\tfor: withOverflow,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<WithOverflow>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\ttype WithOverscrollBehavior,\n\tallOverscrollBehaviorValues,\n\tisOverscrollBehavior,\n\twithOverscrollBehavior,\n} from \"document/models/CanvasTree/traits/WithOverscrollBehavior.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { traitNotAppliedWarning, warning } from \"./invalidValues.ts\"\nimport { variableDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\ninterface DSLOverscrollAttributes {\n\toverscroll: WithOverscrollBehavior[\"overscrollBehavior\"]\n}\n\nconst definition: TraitAttributeDefinition<DSLOverscrollAttributes> = {\n\toverscroll: {\n\t\tdescription: `${allOverscrollBehaviorValues.join(\" | \")} | ${nullString} | ${variableDescription}`,\n\t\toptional: true,\n\t},\n}\n\nconst expectedOverscrollValues = [...allOverscrollBehaviorValues.map(value => `\"${value}\"`), `\"${nullString}\"`].join(\n\t\", \",\n)\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withOverscrollBehavior(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst { overscroll } = attributes\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(overscroll, { node })\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tnode.set({ overscrollBehavior: resolveHandleResult.handle.reference(node) })\n\t\treturn\n\t}\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\treturn resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"overscroll\", message))\n\t}\n\n\tif (isNullString(overscroll)) {\n\t\tnode.set({ overscrollBehavior: undefined })\n\t\treturn\n\t}\n\n\tif (isOverscrollBehavior(overscroll)) {\n\t\tnode.set({ overscrollBehavior: overscroll })\n\t\treturn\n\t}\n\n\tif (!isUndefined(overscroll)) {\n\t\treturn warning(\"overscroll\", overscroll, expectedOverscrollValues)\n\t}\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withOverscrollBehavior(node)) return\n\n\tconst overscroll = isDynamicValue(node.overscrollBehavior)\n\t\t? ctx.dynamicValues.resolveAttributeFromDynamicValue(node.overscrollBehavior, node)\n\t\t: undefined\n\tif (overscroll) return { overscroll }\n\n\tconst overscrollValue = node.resolveValue(\"overscrollBehavior\")\n\tif (!isOverscrollBehavior(overscrollValue)) return\n\n\treturn { overscroll: overscrollValue }\n}\n\nexport const overscroll = {\n\tfor: withOverscrollBehavior,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<DSLOverscrollAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\ttype FourPixelNumberShorthandValue,\n\tgetFourPixelNumberFromShorthand,\n\tgetFourPixelNumberShorthand,\n\tisDefaultFourPixelNumberShorthand,\n\tisPixelNumberShorthand,\n\tnormalizeFourPixelNumberShorthand,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport { isBreakpointWithLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { type WithPadding, withPadding } from \"document/models/CanvasTree/traits/WithPadding.ts\"\nimport { parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { looksLikeVariableReference } from \"../context/dynamicValues.ts\"\nimport { hasAnyAttribute, isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport {\n\texpectedPxValue,\n\tlayoutTemplateBreakpointWarnings,\n\tsingleWarning,\n\ttraitNotAppliedWarning,\n} from \"./invalidValues.ts\"\nimport { dynamicValueDescription, pixelShorthandDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\ntype PaddingAttributes = Omit<WithPadding, \"paddingPerSide\">\n\nconst definition: TraitAttributeDefinition<PaddingAttributes> = {\n\tpadding: {\n\t\tdescription: `${pixelShorthandDescription} | ${dynamicValueDescription(\"padding\")} | ${nullString}`,\n\t\toptional: true,\n\t},\n\tpaddingTop: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tpaddingRight: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tpaddingBottom: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tpaddingLeft: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n}\n\nconst sidePaddingKeys = [\n\t\"paddingTop\",\n\t\"paddingRight\",\n\t\"paddingBottom\",\n\t\"paddingLeft\",\n] as const satisfies readonly (keyof WithPadding)[]\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!hasAnyAttribute(attributes, definition)) return\n\tif (!withPadding(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst layoutTemplateWarnings: TraitWarning[] | undefined = layoutTemplateBreakpointWarnings(node, \"padding\")\n\tif (layoutTemplateWarnings) return layoutTemplateWarnings\n\n\tconst warnings: TraitWarning[] = []\n\tconst paddingValue = attributes.padding\n\tif (isNullString(paddingValue)) {\n\t\tnode.set({ padding: undefined })\n\t\treturn warnings\n\t}\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.padding, { node })\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tnode.set({ padding: resolveHandleResult.handle.reference(node) })\n\t\treturn warnings\n\t}\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"padding\", message)))\n\t}\n\n\tif (isPixelNumberShorthand(paddingValue)) {\n\t\tconst normalized = normalizeFourPixelNumberShorthand(getFourPixelNumberFromShorthand(paddingValue))\n\t\tif (normalized.perSide) {\n\t\t\tnode.set({\n\t\t\t\tpaddingPerSide: true,\n\t\t\t\tpaddingTop: normalized.top,\n\t\t\t\tpaddingRight: normalized.right,\n\t\t\t\tpaddingBottom: normalized.bottom,\n\t\t\t\tpaddingLeft: normalized.left,\n\t\t\t})\n\t\t} else {\n\t\t\tnode.set({\n\t\t\t\tpadding: normalized.all,\n\t\t\t\tpaddingPerSide: false,\n\t\t\t\tpaddingTop: normalized.top,\n\t\t\t\tpaddingRight: normalized.right,\n\t\t\t\tpaddingBottom: normalized.bottom,\n\t\t\t\tpaddingLeft: normalized.left,\n\t\t\t})\n\t\t}\n\t\treturn\n\t}\n\n\tif (isString(paddingValue)) {\n\t\tconst [value, unit] = parseCSSDimension(paddingValue, \"px\")\n\t\tif (Number.isNaN(value) || unit !== \"px\") {\n\t\t\tif (!looksLikeVariableReference(paddingValue)) {\n\t\t\t\twarnings.push(singleWarning(\"padding\", paddingValue, pixelShorthandDescription))\n\t\t\t}\n\t\t\treturn warnings\n\t\t}\n\t\tnode.set({ padding: value, paddingPerSide: false })\n\t\treturn warnings\n\t}\n\n\tfor (const key of sidePaddingKeys) {\n\t\tif (!isString(attributes[key])) continue\n\t\tconst [value, unit] = parseCSSDimension(attributes[key], \"px\")\n\t\tif (Number.isNaN(value) || unit !== \"px\") {\n\t\t\tif (!looksLikeVariableReference(attributes[key])) {\n\t\t\t\twarnings.push(singleWarning(key, attributes[key], expectedPxValue))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tnode.set({ paddingPerSide: true, [key]: value })\n\t}\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withPadding(node)) return\n\tif (isBreakpointWithLayoutTemplate(node)) return\n\n\tif (isDynamicValue(node.padding)) {\n\t\treturn {\n\t\t\tpadding: ctx.dynamicValues.resolveAttributeFromDynamicValue(node.padding, node),\n\t\t}\n\t}\n\n\tconst paddingShorthandValue: FourPixelNumberShorthandValue = {\n\t\tall: isNumber(node.padding) ? node.padding : undefined,\n\t\tperSide: node.paddingPerSide === true,\n\t\ttop: node.paddingTop,\n\t\tright: node.paddingRight,\n\t\tbottom: node.paddingBottom,\n\t\tleft: node.paddingLeft,\n\t}\n\n\tif (isDefaultFourPixelNumberShorthand(paddingShorthandValue)) return\n\n\treturn { padding: getFourPixelNumberShorthand(paddingShorthandValue) }\n}\n\nexport const padding = {\n\tfor: withPadding,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<PaddingAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport {\n\twithParagraphSpacing,\n\ttype WithParagraphSpacing,\n} from \"document/models/CanvasTree/traits/WithParagraphSpacing.ts\"\nimport { parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { expectedAttributeMessage, expectedPositiveInteger } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst paragraphSpacingDefinition = {\n\tparagraphSpacing: {\n\t\tdescription: `number | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<WithParagraphSpacing>\n\ninterface SerializedParagraphSpacingAttributes {\n\tparagraphSpacing?: number | string\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tconst value = attributes.paragraphSpacing\n\tif (isUndefined(value)) return\n\n\tif (!withParagraphSpacing(node)) {\n\t\treturn unsupportedAttributesWarnings(node, attributes, paragraphSpacingDefinition, ctx)\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\n\tif (isNullString(value)) {\n\t\tnode.set({ paragraphSpacing: undefined })\n\t\treturn warnings\n\t}\n\n\tif (!isString(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"paragraphSpacing\",\n\t\t\tmessage: expectedAttributeMessage(value, expectedPositiveInteger),\n\t\t})\n\t\treturn warnings\n\t}\n\n\t// We allow `20px` values too because the number represent a pixel value.\n\tconst [paragraphSpacing, unit] = parseCSSDimension(value, \"px\")\n\tif (Number.isNaN(paragraphSpacing) || !Number.isFinite(paragraphSpacing) || paragraphSpacing < 0 || unit !== \"px\") {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"paragraphSpacing\",\n\t\t\tmessage: expectedAttributeMessage(value, expectedPositiveInteger),\n\t\t})\n\t\treturn warnings\n\t}\n\n\tnode.set({ paragraphSpacing })\n\treturn warnings\n}\n\nfunction toAttributes(\n\tnode: CanvasNode,\n\t_parent: MaybeCanvasNode,\n\t_ctx: AgentContext,\n): SerializedParagraphSpacingAttributes | undefined {\n\tif (!withParagraphSpacing(node)) return\n\tif (isUndefined(node.paragraphSpacing)) return\n\n\t// The default is `undefined` on RichTextNode but `0` on PresetNodes\n\t// Because `0` has no effect, we hide it to save some tokens.\n\tif (node.paragraphSpacing === 0) return\n\n\treturn { paragraphSpacing: node.paragraphSpacing }\n}\n\nexport const paragraphSpacing = {\n\tfor: withParagraphSpacing,\n\tdefinition: paragraphSpacingDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedParagraphSpacingAttributes, [], CanvasNode>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithParallax,\n\thasParallaxEffect,\n\tparallaxEnabledDefaults,\n\twithParallax,\n} from \"document/models/CanvasTree/traits/WithParallax.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { breakpointUnsupportedMessage } from \"./invalidValues.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitToAttributesOutput,\n} from \"./types.ts\"\n\nconst dslParallaxInputSchema = z.object({\n\tspeed: z\n\t\t.string()\n\t\t.transform(value => {\n\t\t\tconst [dimension, unit] = parseCSSDimension(value, \"%\")\n\t\t\tif (unit !== \"%\") return\n\t\t\treturn dimension\n\t\t})\n\t\t.optional()\n\t\t.catch(undefined),\n})\n\ntype ParsedDSLParallax = z.output<typeof dslParallaxInputSchema>\ntype DSLParallax = TraitToAttributesOutput<ParsedDSLParallax>\n\nconst definition: TraitAttributeDefinition<{ parallaxEffect: DSLParallax }> = {\n\tparallaxEffect: {\n\t\tspeed: {\n\t\t\tdescription: \"number | ${number}%\",\n\t\t\texamples: [\"110%\", \"110\", \"90%\", \"200\"],\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withParallax(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst { parallaxEffect } = attributes\n\n\tif (isBreakpointVariant(node) && !isUndefined(parallaxEffect)) {\n\t\treturn [{ applied: false, key: \"parallaxEffect\", message: breakpointUnsupportedMessage(\"parallax effects\") }]\n\t}\n\n\tif (isNullString(parallaxEffect)) {\n\t\tnode.set({ parallaxEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslParallaxInputSchema.safeParse(parallaxEffect)\n\tif (!parsed.success) return\n\n\tconst { speed } = parsed.data\n\tconst update: Partial<WithParallax> = {}\n\n\tif (isNumber(speed)) {\n\t\tupdate.parallaxSpeed = speed\n\t}\n\n\tif (isEmptyObject(update)) return\n\n\tupdateWithFallback(update, node, parallaxEnabledDefaults)\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!hasParallaxEffect(node)) return undefined\n\n\tconst nodeParallax: Partial<DSLParallax> = {\n\t\tspeed: isNumber(node.parallaxSpeed) ? toRoundedNumber(node.parallaxSpeed) : undefined,\n\t}\n\n\treturn { parallaxEffect: nodeParallax }\n}\n\nexport const parallaxEffect = {\n\tfor: withParallax,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ parallaxEffect: DSLParallax }>\n", "import { assert } from \"@framerjs/shared\"\nimport type { CanvasNode, CanvasTree, VectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { isVectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { shouldGuessPinToBottom } from \"document/models/shouldGuessPinToBottom.ts\"\nimport { shouldGuessPinToRight } from \"document/models/shouldGuessPinToRight.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport { withGridItemSize } from \"../WithGridItemSize.ts\"\nimport { getLayoutType, hasAnyLayout, hasGridLayout } from \"../WithLayout.ts\"\nimport type { WithConstraints, WithPins } from \"../WithPins.ts\"\nimport { isPinnable } from \"../WithPins.ts\"\nimport type { WithPositionType } from \"../WithPositionType.ts\"\nimport { hasViewportHeight, hasViewportWidth } from \"../WithSizeDimensionType.ts\"\nimport type { PositionType } from \"./reducePositionType.ts\"\nimport { isPositionRelativeToParent } from \"./reducePositionType.ts\"\nimport { getSizeMinusPadding } from \"./sizeMinusPadding.ts\"\n\nexport function updateNodeConstraintsForPosition(\n\ttree: CanvasTree,\n\tnode: CanvasNode & WithPositionType,\n\tparent: CanvasNode,\n\tposition: PositionType,\n) {\n\tif (isVectorNode(node)) {\n\t\tupdateShapeConstraintsForPosition(tree, node, parent, position)\n\t} else if (isPinnable(node)) {\n\t\tupdateConstraintsForPosition(tree, node, parent, position)\n\t}\n}\n\n/**\n * Update the shape node's constraints. Shapes cannot be pinned, but when changing from\n * relative to absolute positioning, their position must be updated with a rect in order to\n * prevent jumping on the canvas.\n *\n * ShapeContainerNodes are pinnable, so they are handled by `updateConstraintsForPosition`.\n */\nfunction updateShapeConstraintsForPosition(\n\ttree: CanvasTree,\n\tnode: VectorNode,\n\tparent: CanvasNode,\n\tposition: PositionType,\n) {\n\tconst parentRelative = isPositionRelativeToParent(parent, position)\n\tconst { sizing, positioning, viewport } = tree.getParentSizeInfo(node, parent)\n\n\tconst update = node.updateForRect({\n\t\trect: tree.getRect(node),\n\t\t// This property is needed for Path node's overridden method\n\t\tparentSizeInfo: {\n\t\t\tsizing: parentRelative ? getSizeMinusPadding(tree, parent) : sizing,\n\t\t\tpositioning,\n\t\t\tviewport,\n\t\t\tlayout: getLayoutType(parent),\n\t\t},\n\t\t// These properties are not needed for Vector nodes' overridden methods\n\t\tconstraintsLocked: false,\n\t\tshouldGuessPinToBottom: false,\n\t\tshouldGuessPinToRight: false,\n\t})\n\n\tnode.set(update)\n}\n\n/**\n * Update the node's constraints from viewport relative to parent relative (or\n * vice versa, depending on the enabled value), so that visually it doesn't jump\n * on the canvas.\n */\nexport function updateConstraintsForPosition(\n\ttree: CanvasTree,\n\tnode: CanvasNode & WithPins & WithPositionType & WithConstraints,\n\tparent: CanvasNode,\n\tposition: PositionType,\n) {\n\tconst parentRelative = isPositionRelativeToParent(parent, position)\n\tconst isGridItem = hasGridLayout(parent) && withGridItemSize(node)\n\n\tif (isGridItem && parentRelative && !isPositionRelativeToParent(parent, node.position)) {\n\t\t// When changing the position type of a layer in a grid from a position\n\t\t// type that isn't relative to the grid cells, to one that is, snap the\n\t\t// layer back to fill the grid cell.\n\t\tnode.set({\n\t\t\tgridItemFillCellHeight: true,\n\t\t\tgridItemFillCellWidth: true,\n\t\t})\n\t\treturn\n\t}\n\n\tconst rect = tree.getRect(node)\n\tconst { sizing, positioning, viewport } = tree.getParentSizeInfo(node, parent)\n\tassert(\n\t\t!isNull(sizing),\n\t\t\"Parent sizing should not be null, since the position type row should only be visible for nodes with a parent.\",\n\t)\n\tconst parentSizeMinusPadding = getSizeMinusPadding(tree, parent)\n\n\tconst update: Partial<WithPins> = node.updateForRect({\n\t\trect,\n\t\tparentSizeInfo: {\n\t\t\t// If the node uses viewport units, preserve the original sizing which contains viewport\n\t\t\t// dimensions. Otherwise consider the padding if the parent is relative\n\t\t\tsizing: {\n\t\t\t\twidth: parentRelative && !hasViewportWidth(node) ? parentSizeMinusPadding.width : sizing.width,\n\t\t\t\theight: parentRelative && !hasViewportHeight(node) ? parentSizeMinusPadding.height : sizing.height,\n\t\t\t},\n\t\t\tpositioning,\n\t\t\tviewport,\n\t\t\tlayout: getLayoutType(parent),\n\t\t},\n\t\t// We just want to convert the pins/anchors, so don't change the\n\t\t// constraints unless the parent is a stack, in which case we want to\n\t\t// guess new pins\n\t\tconstraintsLocked: !hasAnyLayout(parent),\n\t\tshouldGuessPinToBottom: shouldGuessPinToBottom(tree, node, parent),\n\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, parent),\n\t})\n\n\t// When changing the position type of a layer in a grid from a position\n\t// type that is relative to the grid cells, to one that isn't, reset the\n\t// grid item fill cell width and height.\n\tif (isGridItem && !parentRelative) {\n\t\tnode.set({\n\t\t\tgridItemFillCellHeight: false,\n\t\t\tgridItemFillCellWidth: false,\n\t\t})\n\t}\n\n\t// If we are enabling position fixed or absolute in a stack child, fractions\n\t// are not supported.\n\tif (!parentRelative) {\n\t\tif (node.widthType === DimensionType.FractionOfFreeSpace) {\n\t\t\tupdate.widthType = DimensionType.FixedNumber\n\t\t\tupdate.width = rect.width\n\t\t}\n\t\tif (node.heightType === DimensionType.FractionOfFreeSpace) {\n\t\t\tupdate.heightType = DimensionType.FixedNumber\n\t\t\tupdate.height = rect.height\n\t\t}\n\t}\n\n\tnode.set(update)\n}\n", "import { type CanvasNode, isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isDesignPageNode, isSlotPropertyNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { parsePixelNumber } from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { WithGridItemLayout } from \"document/models/CanvasTree/traits/WithGridItemLayout.ts\"\nimport { hasAnyLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport { type WithPins, isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { WithPositionType } from \"document/models/CanvasTree/traits/WithPositionType.ts\"\nimport {\n\tisPositionType,\n\tpositionTypeOptions,\n\twithPositionType,\n} from \"document/models/CanvasTree/traits/WithPositionType.ts\"\nimport type { WithSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport type { WithSizeDimensionType } from \"document/models/CanvasTree/traits/WithSizeDimensionType.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport {\n\tcanBePositionAbsolute,\n\tcanBePositionFixed,\n\tcanBePositionSticky,\n\tisPositionRelative,\n} from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport { updateNodeConstraintsForPosition } from \"document/models/CanvasTree/traits/utils/updateConstraintsForPosition.ts\"\nimport { withShape } from \"library/render/traits/Shape.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isBooleanString, isNull, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport {\n\texpectedPercentageValue,\n\texpectedPxValue,\n\tsingleWarning,\n\ttraitNotAppliedWarning,\n\twarning,\n} from \"./invalidValues.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\nconst positionTypesWithRelative = [...positionTypeOptions, \"relative\"] as const\ntype RequestedPositionType = (typeof positionTypesWithRelative)[number]\nconst positionTypesDescription = positionTypesWithRelative.join(\" | \")\nconst expectedPositionTypes = () => positionTypesWithRelative.map(positionType => `\"${positionType}\"`).join(\", \")\nconst absoluteHorizontalPinKeys = [\"left\", \"right\"] as const\nconst absoluteVerticalPinKeys = [\"top\", \"bottom\"] as const\nconst pinKeys = [\"left\", \"right\", \"top\", \"bottom\"] as const\nconst centerAnchorKeys = [\"centerAnchorX\", \"centerAnchorY\"] as const\ntype AbsolutePinKeys = (typeof absoluteHorizontalPinKeys)[number] | (typeof absoluteVerticalPinKeys)[number]\ntype PinAttributes = Omit<WithPins, keyof WithSize | keyof WithGridItemLayout | keyof WithSizeDimensionType>\ntype PlacementAttributes = WithPositionType & PinAttributes\ntype GuardedPositionType = Exclude<RequestedPositionType, \"relative\">\n\nconst absolutePositionWithoutPinsMessage =\n\t'position=\"absolute\" requires one explicit horizontal pin (left or right) and one explicit vertical pin (top or bottom).'\n\nconst unsupportedPositionModeMessages = {\n\tabsolute:\n\t\t'position=\"absolute\" is not supported in this parent. For normal page or breakpoint children, omit position and set pins instead.',\n\tfixed:\n\t\t'position=\"fixed\" is only supported for direct children of a page breakpoint or top-level frame on a design page.',\n\tsticky: 'position=\"sticky\" is only supported for children inside a stack or grid.',\n} satisfies Record<GuardedPositionType, string>\n\nconst positionDefinition: TraitAttributeDefinition<WithPositionType> = {\n\tposition: {\n\t\tdescription: positionTypesDescription,\n\t\toptional: true,\n\t},\n\tpositionStickyTop: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n\tpositionStickyRight: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n\tpositionStickyBottom: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n\tpositionStickyLeft: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n}\n\nconst pinsDefinition: TraitAttributeDefinition<PinAttributes> = {\n\tleft: {\n\t\tdescription: \"${number}px | null\",\n\t\toptional: true,\n\t},\n\tright: {\n\t\tdescription: \"${number}px | null\",\n\t\toptional: true,\n\t},\n\ttop: {\n\t\tdescription: \"${number}px | null\",\n\t\toptional: true,\n\t},\n\tbottom: {\n\t\tdescription: \"${number}px | null\",\n\t\toptional: true,\n\t},\n\tcenterAnchorX: {\n\t\tdescription: \"${number}%\",\n\t\toptional: true,\n\t},\n\tcenterAnchorY: {\n\t\tdescription: \"${number}%\",\n\t\toptional: true,\n\t},\n\tconstraintsLocked: {\n\t\tdescription: \"boolean\",\n\t\toptional: true,\n\t},\n}\n\nconst definition = {\n\t...positionDefinition,\n\t...pinsDefinition,\n} satisfies TraitAttributeDefinition<PlacementAttributes>\n\nfunction collectWarnings(warnings: TraitWarning[], result: TraitWarning[] | undefined) {\n\tif (result) warnings.push(...result)\n}\n\nfunction collectStickyPosition(\n\tnode: CanvasNode,\n\tstring: \"positionStickyTop\" | \"positionStickyRight\" | \"positionStickyBottom\" | \"positionStickyLeft\",\n\tattributes: DSLAttributes,\n) {\n\tconst value = attributes[string]\n\tconst numberValue = tryParseNumber(value)\n\tif (isUndefined(numberValue)) return\n\tnode.set({ [string]: numberValue })\n}\n\nfunction hasExplicitAbsolutePin(attributes: DSLAttributes, keys: readonly AbsolutePinKeys[]): boolean {\n\treturn keys.some(key => {\n\t\tconst value = attributes[key]\n\t\tif (!isString(value) || isNullString(value)) return false\n\t\tconst [numberValue, unit] = parseCSSDimension(value, \"px\")\n\t\treturn !Number.isNaN(numberValue) && unit === \"px\"\n\t})\n}\n\n// Require an explicit pin on both axes. Otherwise absolute positioning can accidentally\n// rely on the model's default zero-valued pins instead of the agent's intended placement.\nfunction shouldWarnAboutAbsoluteWithoutPins(attributes: DSLAttributes): boolean {\n\treturn (\n\t\tattributes.position === \"absolute\" &&\n\t\t!(\n\t\t\thasExplicitAbsolutePin(attributes, absoluteHorizontalPinKeys) &&\n\t\t\thasExplicitAbsolutePin(attributes, absoluteVerticalPinKeys)\n\t\t)\n\t)\n}\n\nfunction unsupportedPositionModeWarning(position: GuardedPositionType): TraitWarning {\n\treturn traitNotAppliedWarning(\"position\", unsupportedPositionModeMessages[position])\n}\n\nfunction isPendingAwareGroundNode(node: CanvasNode, ctx: AgentContext): boolean {\n\tconst tree = ctx.treeStore.tree\n\tif (tree.has(node.id)) return tree.isGroundNode(node)\n\n\treturn isScopeNode(ctx.treeResolver.getParentNode(node))\n}\n\nfunction canApplyPositionFixed(\n\tnode: CanvasNode & WithPositionType,\n\tparent: MaybeCanvasNode,\n\tctx: AgentContext,\n): boolean {\n\tconst tree = ctx.treeStore.tree\n\tif (tree.has(node.id)) return canBePositionFixed(tree, node)\n\n\t// First SET can run before insertion, so mirror the shared fixed-position guard\n\t// with TreeResolver parent lookups instead of tree-only parent lookups.\n\tif (withShape(node)) return false\n\tif (!parent || isSlotPropertyNode(parent)) return false\n\tif (!isPendingAwareGroundNode(parent, ctx)) return false\n\n\tconst scope = ctx.treeResolver.getScopeNodeFor(parent.id)\n\tif (isDesignPageNode(scope)) return true\n\treturn isBreakpointVariant(parent)\n}\n\nfunction canApplyPositionAbsolute(node: CanvasNode & WithPositionType, parent: MaybeCanvasNode): boolean {\n\tif (parent && isSlotPropertyNode(parent)) return false\n\tif (!parent || !hasAnyLayout(parent)) return true\n\n\treturn canBePositionAbsolute(node, parent)\n}\n\nfunction storedPositionTypeFor(position: RequestedPositionType, parent: MaybeCanvasNode): WithPositionType[\"position\"] {\n\tif (position === \"relative\") return undefined\n\t// Outside stack/grid layout, absolute is the default stored as an unset position.\n\t// This mirrors the properties panel while still allowing authored pins to apply.\n\tif (position === \"absolute\" && (!parent || !hasAnyLayout(parent))) return undefined\n\n\treturn position\n}\n\nfunction getUnsupportedPositionModeWarning(\n\tnode: CanvasNode & WithPositionType,\n\tposition: RequestedPositionType,\n\tparent: MaybeCanvasNode,\n\tctx: AgentContext,\n): TraitWarning | undefined {\n\tswitch (position) {\n\t\tcase \"relative\":\n\t\t\treturn\n\t\tcase \"fixed\":\n\t\t\treturn canApplyPositionFixed(node, parent, ctx) ? undefined : unsupportedPositionModeWarning(position)\n\t\tcase \"sticky\":\n\t\t\treturn canBePositionSticky(node, parent) ? undefined : unsupportedPositionModeWarning(position)\n\t\tcase \"absolute\":\n\t\t\treturn canApplyPositionAbsolute(node, parent) ? undefined : unsupportedPositionModeWarning(position)\n\t}\n}\n\nfunction collectCenterAnchorPreservation(\n\tnode: CanvasNode & WithPositionType,\n\tattributes: DSLAttributes,\n): Pick<Partial<WithPins>, \"centerAnchorX\" | \"centerAnchorY\"> {\n\tconst update: Pick<Partial<WithPins>, \"centerAnchorX\" | \"centerAnchorY\"> = {}\n\tif (!isPinnable(node)) return update\n\n\tconst hasHorizontalPlacement =\n\t\t!isUndefined(attributes.left) || !isUndefined(attributes.right) || !isUndefined(attributes.centerAnchorX)\n\tconst hasVerticalPlacement =\n\t\t!isUndefined(attributes.top) || !isUndefined(attributes.bottom) || !isUndefined(attributes.centerAnchorY)\n\n\t// Edge pins do not carry center anchors through the pins branch. Keep anchors\n\t// stable on explicitly touched axes so position conversion does not leave\n\t// newly guessed latent anchors paired with authored pins.\n\tif (hasHorizontalPlacement) update.centerAnchorX = node.centerAnchorX\n\tif (hasVerticalPlacement) update.centerAnchorY = node.centerAnchorY\n\n\treturn update\n}\n\nfunction applyPositionType(\n\tnode: CanvasNode & WithPositionType,\n\tposition: RequestedPositionType,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n\tparent: MaybeCanvasNode,\n): CanvasNode & WithPositionType {\n\tconst centerAnchorUpdate = collectCenterAnchorPreservation(node, attributes)\n\tif (parent) updateNodeConstraintsForPosition(ctx.treeStore.tree, node, parent, position)\n\tconst currentNode = ctx.treeStore.tree.current(node) ?? node\n\tconst update: Partial<WithPins & WithPositionType> = {\n\t\t...centerAnchorUpdate,\n\t\tposition: storedPositionTypeFor(position, parent),\n\t}\n\n\tif (position === \"absolute\" && isPinnable(currentNode)) {\n\t\t// Keep conversion so layout-managed sizing, such as stack/grid fr dimensions,\n\t\t// becomes fixed before absolute positioning. Then clear guessed pins; this\n\t\t// placement trait reapplies the authored pins immediately after conversion.\n\t\tupdate.left = null\n\t\tupdate.right = null\n\t\tupdate.top = null\n\t\tupdate.bottom = null\n\t}\n\n\tcurrentNode.set(update)\n\treturn ctx.treeStore.tree.current(currentNode) ?? currentNode\n}\n\nfunction fromPositionAttributes(\n\tnode: CanvasNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): TraitWarning[] | undefined {\n\tif (!withPositionType(node) || hasFloatingPosition(node)) {\n\t\treturn unsupportedAttributesWarnings(node, attributes, positionDefinition, ctx)\n\t}\n\n\tconst position = attributes.position\n\tconst parent = ctx.treeResolver.getParentNode(node)\n\tif (position === \"relative\") {\n\t\tapplyPositionType(node, position, attributes, ctx, parent)\n\t\treturn\n\t}\n\n\tlet currentNode = node\n\tif (isPositionType(position)) {\n\t\tconst unsupportedWarning = getUnsupportedPositionModeWarning(node, position, parent, ctx)\n\t\tif (unsupportedWarning) return [unsupportedWarning]\n\n\t\tif (shouldWarnAboutAbsoluteWithoutPins(attributes)) {\n\t\t\treturn [traitNotAppliedWarning(\"position\", absolutePositionWithoutPinsMessage)]\n\t\t}\n\t\tcurrentNode = applyPositionType(node, position, attributes, ctx, parent)\n\t} else if (position !== undefined) {\n\t\treturn warning(\"position\", position, expectedPositionTypes())\n\t}\n\n\tif (currentNode.position !== \"sticky\") return\n\n\tcollectStickyPosition(currentNode, \"positionStickyTop\", attributes)\n\tcollectStickyPosition(currentNode, \"positionStickyRight\", attributes)\n\tcollectStickyPosition(currentNode, \"positionStickyBottom\", attributes)\n\tcollectStickyPosition(currentNode, \"positionStickyLeft\", attributes)\n}\n\nfunction collectPin(node: CanvasNode, key: \"left\" | \"right\" | \"top\" | \"bottom\", attributes: DSLAttributes) {\n\tconst value = attributes[key]\n\tif (isUndefined(value)) return\n\tif (!isString(value)) return singleWarning(key, value, expectedPxValue)\n\n\tif (isNullString(value)) {\n\t\tnode.set({ [key]: null })\n\t\treturn\n\t}\n\n\tconst numberValue = parsePixelNumber(value)\n\tif (isUndefined(numberValue)) return singleWarning(key, value, expectedPxValue)\n\n\tnode.set({ [key]: numberValue })\n}\n\nfunction fromPinAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (!isPinnable(node) || hasFloatingPosition(node)) {\n\t\treturn unsupportedAttributesWarnings(node, attributes, pinsDefinition, ctx)\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\n\tfor (const key of pinKeys) {\n\t\tconst pinWarning = collectPin(node, key, attributes)\n\t\tif (pinWarning) warnings.push(pinWarning)\n\t}\n\n\tfor (const key of centerAnchorKeys) {\n\t\tconst value = attributes[key]\n\t\tif (isUndefined(value)) continue\n\t\tif (!isString(value)) {\n\t\t\twarnings.push(singleWarning(key, value, expectedPercentageValue))\n\t\t\tcontinue\n\t\t}\n\n\t\tconst [parsedValue, unit] = parseCSSDimension(value, \"%\")\n\t\tif (Number.isNaN(parsedValue) || unit !== \"%\") {\n\t\t\twarnings.push(singleWarning(key, value, expectedPercentageValue))\n\t\t\tcontinue\n\t\t}\n\n\t\tnode.set({ [key]: parsedValue / 100 })\n\t}\n\n\tconst constraintsLocked = attributes.constraintsLocked\n\tif (isBooleanString(constraintsLocked)) {\n\t\tnode.set({ constraintsLocked: constraintsLocked === \"true\" })\n\t}\n\n\treturn warnings.length > 0 ? warnings : undefined\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tconst warnings: TraitWarning[] = []\n\n\tcollectWarnings(warnings, fromPositionAttributes(node, attributes, ctx))\n\n\tconst currentNode = ctx.treeStore.tree.current(node) ?? node\n\tcollectWarnings(warnings, fromPinAttributes(currentNode, attributes, ctx))\n\n\treturn warnings.length > 0 ? warnings : undefined\n}\n\nfunction createPin(value: number) {\n\treturn createCSSDimension(toRoundedNumber(value), \"px\")\n}\n\nfunction createCenterAnchor(value: number) {\n\treturn createCSSDimension(toRoundedNumber(value * 100), \"%\")\n}\n\nfunction positionToAttributes(node: CanvasNode | null | undefined, parent: MaybeCanvasNode): DSLAttributes | undefined {\n\tif (!withPositionType(node)) return\n\tif (hasFloatingPosition(node)) return\n\n\tif (isUndefined(node.position)) {\n\t\t// When the parent is a Stack or Grid and the node has no explicit position, it behaves as\n\t\t// position: relative.\n\t\tif (isPositionRelative(node, parent)) return { position: \"relative\" }\n\t\treturn\n\t}\n\n\tconst result: DSLAttributes = { position: node.position }\n\tif (node.position === \"sticky\") {\n\t\tresult.positionStickyTop = isNumber(node.positionStickyTop) ? toRoundedNumber(node.positionStickyTop) : undefined\n\t\tresult.positionStickyRight = isNumber(node.positionStickyRight)\n\t\t\t? toRoundedNumber(node.positionStickyRight)\n\t\t\t: undefined\n\t\tresult.positionStickyBottom = isNumber(node.positionStickyBottom)\n\t\t\t? toRoundedNumber(node.positionStickyBottom)\n\t\t\t: undefined\n\t\tresult.positionStickyLeft = isNumber(node.positionStickyLeft) ? toRoundedNumber(node.positionStickyLeft) : undefined\n\t}\n\treturn result\n}\n\nfunction pinsToAttributes(node: CanvasNode | null | undefined, parent: MaybeCanvasNode) {\n\tif (!node || !isPinnable(node) || hasFloatingPosition(node)) return\n\t// Nodes in stacks that are position relative are not pinned.\n\tif (isPositionRelative(node, parent)) return\n\n\treturn {\n\t\tleft: isNull(node.left) ? nullString : createPin(node.left),\n\t\tright: isNull(node.right) ? nullString : createPin(node.right),\n\t\ttop: isNull(node.top) ? nullString : createPin(node.top),\n\t\tbottom: isNull(node.bottom) ? nullString : createPin(node.bottom),\n\t\tcenterAnchorX: createCenterAnchor(node.centerAnchorX),\n\t\tcenterAnchorY: createCenterAnchor(node.centerAnchorY),\n\t\tconstraintsLocked: node.constraintsLocked,\n\t}\n}\n\nfunction toAttributes(node: CanvasNode, parent: MaybeCanvasNode): DSLAttributes {\n\treturn {\n\t\t...positionToAttributes(node, parent),\n\t\t...pinsToAttributes(node, parent),\n\t}\n}\n\ntype PlacementNode = (CanvasNode & WithPositionType) | (CanvasNode & WithPins)\n\nfunction isPlacementNode(node: CanvasNode): node is PlacementNode {\n\treturn withPositionType(node) || isPinnable(node)\n}\n\nexport const placement = {\n\tfor: isPlacementNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<PlacementAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\ttype FourPixelNumberShorthandValue,\n\tgetFourPixelNumberFromShorthand,\n\tgetFourPixelNumberShorthand,\n\tisDefaultFourPixelNumberShorthand,\n\tisPixelNumberShorthand,\n\tnormalizeFourPixelNumberShorthand,\n} from \"document/models/CanvasTree/traits/NumberShorthand.ts\"\nimport { type WithRadius, withRadius, withRelativeRadius } from \"document/models/CanvasTree/traits/WithRadius.ts\"\nimport { type WithRadiusPerCorner, withRadiusPerCorner } from \"document/models/CanvasTree/traits/WithRadiusPerCorner.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { looksLikeVariableReference } from \"../context/dynamicValues.ts\"\nimport { isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport {\n\tbreakpointUnsupportedMessage,\n\texpectedPxValue,\n\tsingleWarning,\n\ttraitNotAppliedWarning,\n} from \"./invalidValues.ts\"\nimport { dynamicValueDescription, percentageDescription, pixelShorthandDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\ntype RadiusAttributes = Omit<WithRadius & WithRadiusPerCorner, \"radiusPerCorner\">\n\nconst definition: TraitAttributeDefinition<RadiusAttributes> = {\n\tradius: {\n\t\tdescription: `${pixelShorthandDescription} | ${percentageDescription} | ${dynamicValueDescription(\"border-radius\")}`,\n\t\toptional: true,\n\t},\n\tradiusTopLeft: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tradiusTopRight: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tradiusBottomLeft: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tradiusBottomRight: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n}\n\nconst cornerRadiusKeys = [\n\t\"radiusTopLeft\",\n\t\"radiusTopRight\",\n\t\"radiusBottomRight\",\n\t\"radiusBottomLeft\",\n] as const satisfies readonly (keyof WithRadiusPerCorner)[]\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (!withRadius(node) || !withRadiusPerCorner(node)) {\n\t\treturn unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\tconst hasRadiusAttributes =\n\t\t!isUndefined(attributes.radius) || cornerRadiusKeys.some(key => !isUndefined(attributes[key]))\n\n\tif (isBreakpointVariant(node) && hasRadiusAttributes) {\n\t\treturn [{ applied: false, key: \"radius\", message: breakpointUnsupportedMessage(\"radius\") }]\n\t}\n\n\tconst radiusValue = attributes.radius\n\tif (isNullString(radiusValue)) {\n\t\tnode.set({ radius: undefined })\n\t\tif (withRelativeRadius(node)) node.set({ radiusIsRelative: false })\n\t\treturn\n\t}\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.radius, { node })\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tnode.set({ radius: resolveHandleResult.handle.reference(node) })\n\t\tif (withRelativeRadius(node)) node.set({ radiusIsRelative: false })\n\t\treturn\n\t}\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"radius\", message)))\n\t}\n\n\tif (isString(radiusValue)) {\n\t\tconst [value, unit] = parseCSSDimension(radiusValue)\n\t\tif (!Number.isNaN(value) && unit === \"%\") {\n\t\t\tif (withRelativeRadius(node)) {\n\t\t\t\tnode.set({ radius: value, radiusIsRelative: true, radiusPerCorner: false })\n\t\t\t} else {\n\t\t\t\twarnings.push(singleWarning(\"radius\", radiusValue, expectedPxValue))\n\t\t\t}\n\t\t\treturn warnings.length > 0 ? warnings : undefined\n\t\t}\n\t}\n\n\tif (isPixelNumberShorthand(radiusValue)) {\n\t\tconst normalized = normalizeFourPixelNumberShorthand(getFourPixelNumberFromShorthand(radiusValue))\n\t\tif (normalized.perSide) {\n\t\t\tnode.set({\n\t\t\t\tradiusPerCorner: true,\n\t\t\t\tradiusTopLeft: normalized.top,\n\t\t\t\tradiusTopRight: normalized.right,\n\t\t\t\tradiusBottomRight: normalized.bottom,\n\t\t\t\tradiusBottomLeft: normalized.left,\n\t\t\t})\n\t\t} else {\n\t\t\tnode.set({\n\t\t\t\tradius: normalized.all,\n\t\t\t\tradiusPerCorner: false,\n\t\t\t\tradiusTopLeft: normalized.top,\n\t\t\t\tradiusTopRight: normalized.right,\n\t\t\t\tradiusBottomRight: normalized.bottom,\n\t\t\t\tradiusBottomLeft: normalized.left,\n\t\t\t})\n\t\t}\n\n\t\t// Make sure we set radius is relative to false for px based radius\n\t\tif (withRelativeRadius(node)) node.set({ radiusIsRelative: false })\n\n\t\treturn\n\t}\n\n\tif (isString(radiusValue)) {\n\t\tconst [value, unit] = parseCSSDimension(radiusValue, \"px\")\n\t\tif (Number.isNaN(value) || unit !== \"px\") {\n\t\t\tif (!looksLikeVariableReference(radiusValue)) {\n\t\t\t\tconst expected = withRelativeRadius(node)\n\t\t\t\t\t? `${pixelShorthandDescription} | ${percentageDescription}`\n\t\t\t\t\t: pixelShorthandDescription\n\t\t\t\twarnings.push(singleWarning(\"radius\", radiusValue, expected))\n\t\t\t}\n\t\t\treturn warnings\n\t\t}\n\n\t\tnode.set({ radius: value, radiusPerCorner: false })\n\n\t\t// Make sure we set radius is relative to false for px based radius\n\t\tif (withRelativeRadius(node)) node.set({ radiusIsRelative: false })\n\t\treturn\n\t}\n\n\tlet appliedCorner = false\n\tfor (const key of cornerRadiusKeys) {\n\t\tif (!isString(attributes[key])) continue\n\t\tconst [value, unit] = parseCSSDimension(attributes[key], \"px\")\n\t\tif (Number.isNaN(value) || unit !== \"px\") {\n\t\t\tif (!looksLikeVariableReference(attributes[key])) {\n\t\t\t\twarnings.push(singleWarning(key, attributes[key], expectedPxValue))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tnode.set({ radiusPerCorner: true, [key]: value })\n\t\tappliedCorner = true\n\t}\n\n\tif (appliedCorner && withRelativeRadius(node)) node.set({ radiusIsRelative: false })\n\n\treturn warnings\n}\n\nexport const radius = {\n\tfor: withRadius,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes: (node, _parent, ctx) => {\n\t\tif (!withRadius(node) || !withRadiusPerCorner(node)) return\n\n\t\tif (isDynamicValue(node.radius)) {\n\t\t\treturn {\n\t\t\t\tradius: ctx.dynamicValues.resolveAttributeFromDynamicValue(node.radius, node),\n\t\t\t}\n\t\t}\n\n\t\tif (withRelativeRadius(node) && node.radiusIsRelative && isNumber(node.radius) && node.radius !== 0) {\n\t\t\treturn { radius: createCSSDimension(node.radius, \"%\") }\n\t\t}\n\n\t\tconst radiusShorthandValue: FourPixelNumberShorthandValue = {\n\t\t\tall: isNumber(node.radius) ? node.radius : undefined,\n\t\t\tperSide: node.radiusPerCorner === true,\n\t\t\ttop: node.radiusTopLeft,\n\t\t\tright: node.radiusTopRight,\n\t\t\tbottom: node.radiusBottomRight,\n\t\t\tleft: node.radiusBottomLeft,\n\t\t}\n\n\t\tif (isDefaultFourPixelNumberShorthand(radiusShorthandValue)) return\n\n\t\treturn { radius: getFourPixelNumberShorthand(radiusShorthandValue) }\n\t},\n} satisfies TraitDefinition<RadiusAttributes>\n", "import { isRelativeUrl } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { validateRedirectTo } from \"document/components/chrome/siteSettings/Redirects/validateRedirects.ts\"\nimport { getReadableWebPageLinkPaths } from \"document/components/utils/getReadableWebPageLinkPaths.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/CanvasTree.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { RedirectRouteNode } from \"document/models/CanvasTree/nodes/RedirectRouteNode.ts\"\nimport { RoutesNode } from \"document/models/CanvasTree/nodes/RoutesNode.ts\"\nimport { isRedirectRouteNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tgetRedirectToPath,\n\tgetWebPageLinksWithLocaleInfo,\n} from \"document/models/CanvasTree/nodes/utils/redirectRouteNode.ts\"\nimport type { LinkToWebPage } from \"document/models/CanvasTree/traits/utils/Link.ts\"\nimport { assert, assertNever } from \"library/utils/assert.ts\"\nimport { getLinkToWebPageFromPath } from \"utils/getLinkToWebPageFromPath.ts\"\nimport { isBooleanString, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { ValidationResult } from \"web/pages/projects/components/Domains/validation/ValidationResult.ts\"\nimport {\n\tvalidateRouteNodePath,\n\tvalidateRouteNodePathUniqueness,\n} from \"web/pages/projects/components/Domains/validation/validateRouteNode.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { expectedBooleanValue, invalidAttributeMessage, singleWarning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\ninterface RedirectAttributes {\n\tfrom: string | undefined\n\tto: string | undefined\n\texpandToAllLocales: boolean | string | undefined\n}\n\nconst definition: TraitAttributeDefinition<RedirectAttributes> = {\n\tfrom: {\n\t\tdescription: \"source path\",\n\t\texamples: [\"/old-page\"],\n\t\toptional: true,\n\t},\n\tto: {\n\t\tdescription: \"destination path or URL\",\n\t\texamples: [\"/new-page\", \"https://example.com\"],\n\t\toptional: true,\n\t},\n\texpandToAllLocales: {\n\t\tdescription: \"boolean\",\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (!isRedirectRouteNode(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tif (isUndefined(attributes.from) && isUndefined(attributes.to) && isUndefined(attributes.expandToAllLocales)) {\n\t\treturn\n\t}\n\tconst engine = ctx.hooks.getEngine()\n\tassert(engine, \"Redirects require an active project engine.\")\n\n\tconst warnings: TraitWarning[] = []\n\tconst path = getValidatedRedirectPath(node, attributes.from, ctx, warnings)\n\tconst normalizedFrom = path ?? node.path\n\tconst to = getValidatedRedirectTo(attributes.to, normalizedFrom, engine, warnings)\n\tconst canApplyPath = canApplyRedirectPath(node, path, to, engine, warnings)\n\tconst expandToAllLocales = getValidatedExpandToAllLocales(attributes.expandToAllLocales, warnings)\n\n\tif (isUndefined(path) && isUndefined(to) && isUndefined(expandToAllLocales)) {\n\t\treturn warnings.length > 0 ? warnings : undefined\n\t}\n\n\tconst update: Partial<RedirectRouteNode> = {}\n\tif (!isUndefined(path) && canApplyPath) update.path = path\n\tif (!isUndefined(to)) update.to = to\n\tif (!isUndefined(expandToAllLocales)) update.expandToAllLocales = expandToAllLocales\n\n\tnode.set(update)\n\treturn warnings.length > 0 ? warnings : undefined\n}\n\nfunction getRedirects(tree: CanvasTree): readonly RedirectRouteNode[] {\n\tconst routesNode = RoutesNode.get(tree)\n\tif (!routesNode?.isLoaded()) return []\n\treturn routesNode.getRedirects()\n}\n\nfunction getValidatedRedirectPath(\n\tnode: RedirectRouteNode,\n\tvalue: unknown,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n): string | undefined {\n\tif (isUndefined(value)) return\n\tif (!isString(value)) {\n\t\twarnings.push(singleWarning(\"from\", value, \"a valid redirect path\"))\n\t\treturn\n\t}\n\n\tconst validationResult = validateRouteNodePath(\"redirect\", value)\n\tconst normalizedValue = getNormalizedValue(\"from\", value, validationResult, warnings)\n\tif (!normalizedValue) return\n\n\tconst redirects = getRedirects(ctx.treeResolver.getLookupTree())\n\tconst uniquenessResult = validateRouteNodePathUniqueness(\"redirect\", normalizedValue, redirects, node.id)\n\tif (uniquenessResult.result !== \"ok\") {\n\t\tgetNormalizedValue(\"from\", value, uniquenessResult, warnings)\n\t\treturn\n\t}\n\treturn normalizedValue\n}\n\nfunction getValidatedRedirectTo(\n\tvalue: unknown,\n\tnormalizedFrom: string | undefined,\n\tengine: VekterEngine,\n\twarnings: TraitWarning[],\n): string | LinkToWebPage | undefined {\n\tif (isUndefined(value)) return\n\tif (!isString(value)) {\n\t\twarnings.push(singleWarning(\"to\", value, \"a valid redirect destination\"))\n\t\treturn\n\t}\n\n\tconst linkToWebPage = isRelativeUrl(value) ? getLinkToWebPageFromPath(value, engine, null) : undefined\n\tconst validationResult = validateRedirectTo(engine.tree, linkToWebPage ?? value, normalizedFrom)\n\treturn getNormalizedValue(\"to\", value, validationResult, warnings)\n}\n\nfunction canApplyRedirectPath(\n\tnode: RedirectRouteNode,\n\tpath: string | undefined,\n\tto: string | LinkToWebPage | undefined,\n\tengine: VekterEngine,\n\twarnings: TraitWarning[],\n): boolean {\n\tif (isUndefined(path)) return true\n\n\tconst effectiveTo = to ?? node.to\n\tif (isUndefined(effectiveTo)) return true\n\n\tconst validationResult = validateRedirectTo(engine.tree, effectiveTo, path)\n\tswitch (validationResult.result) {\n\t\tcase \"ok\":\n\t\t\treturn true\n\t\tcase \"empty\":\n\t\t\twarnings.push(singleWarning(\"from\", path, \"a source path that keeps the redirect destination valid\"))\n\t\t\treturn false\n\t\tcase \"warning\":\n\t\tcase \"error\":\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"from\",\n\t\t\t\tmessage: invalidAttributeMessage(path, validationResult.message),\n\t\t\t})\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(validationResult)\n\t}\n}\n\nfunction getValidatedExpandToAllLocales(value: unknown, warnings: TraitWarning[]): boolean | undefined {\n\tif (isUndefined(value)) return\n\tif (isBooleanString(value)) return value === \"true\"\n\n\twarnings.push(singleWarning(\"expandToAllLocales\", value, expectedBooleanValue))\n}\n\nfunction getNormalizedValue<T>(\n\tattribute: string,\n\tvalue: unknown,\n\tvalidationResult: ValidationResult<T>,\n\twarnings: TraitWarning[],\n): T | undefined {\n\tswitch (validationResult.result) {\n\t\tcase \"ok\":\n\t\t\treturn validationResult.normalizedValue\n\t\tcase \"empty\":\n\t\t\twarnings.push(singleWarning(attribute, value, \"a non-empty value\"))\n\t\t\treturn\n\t\tcase \"warning\":\n\t\tcase \"error\":\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: attribute,\n\t\t\t\tmessage: invalidAttributeMessage(value, validationResult.message),\n\t\t\t})\n\t\t\treturn\n\t\tdefault:\n\t\t\tassertNever(validationResult)\n\t}\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isRedirectRouteNode(node)) return {}\n\n\tconst tree = ctx.treeResolver.getLookupTree()\n\tconst redirects = getRedirects(tree)\n\tconst { linksWithLocale, linkWithLocaleByRedirect } = getWebPageLinksWithLocaleInfo(redirects, tree.root.locales)\n\tconst readableWebPageLinkPaths = getReadableWebPageLinkPaths(tree, linksWithLocale)\n\n\treturn {\n\t\tfrom: node.path,\n\t\tto: getRedirectToPath(node, redirect => {\n\t\t\tconst linkWithLocale = linkWithLocaleByRedirect.get(redirect)\n\t\t\tif (!linkWithLocale) return null\n\t\t\treturn readableWebPageLinkPaths.get(linkWithLocale) ?? null\n\t\t}),\n\t\texpandToAllLocales: node.shouldExpandToAllLocales(),\n\t}\n}\n\nexport const redirect = {\n\tfor: isRedirectRouteNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<RedirectAttributes>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tDEFAULT_FLOATING_ALIGNMENT,\n\tDEFAULT_FLOATING_PLACEMENT,\n\ttype WithFloatingPosition,\n\thasFloatingPosition,\n} from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport { parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isBoolean, isBooleanString, isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { RelativeOverlayNodeClass } from \"../dsl.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { expectedBooleanValue, expectedPxValue, singleWarning } from \"./invalidValues.ts\"\nimport {\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n\ttype TraitToAttributesOutput,\n\ttoRoundedNumber,\n} from \"./types.ts\"\n\nconst floatingPlacementValues = [\"top\", \"right\", \"bottom\", \"left\"] as const\nconst floatingAlignmentValues = [\"start\", \"center\", \"end\"] as const\nconst floatingCollisionDetectionValues = [\"true\", \"false\"] as const\n\ntype FloatingPlacement = (typeof floatingPlacementValues)[number]\ntype FloatingAlignment = (typeof floatingAlignmentValues)[number]\n\ninterface RelativeOverlayAttributes {\n\tfloatingPlacement?: FloatingPlacement\n\tfloatingAlignment?: FloatingAlignment\n\tfloatingOffsetX?: number\n\tfloatingOffsetY?: number\n\tfloatingCollisionDetection?: boolean\n}\n\nconst floatingPlacementSchema = z.enum(floatingPlacementValues)\nconst floatingAlignmentSchema = z.enum(floatingAlignmentValues)\nconst floatingOffsetSchema = z\n\t.union([z.number(), z.string()])\n\t.transform(value => {\n\t\tif (isNumber(value)) return value\n\t\tconst [offset, unit] = parseCSSDimension(value, \"px\")\n\t\treturn !Number.isNaN(offset) && unit === \"px\" ? offset : Number.NaN\n\t})\n\t.pipe(z.number())\n\t.optional()\n\t.catch(undefined)\n\nconst relativeOverlaySchemaShape = {\n\tfloatingPlacement: floatingPlacementSchema.optional().catch(undefined),\n\tfloatingAlignment: floatingAlignmentSchema.optional().catch(undefined),\n\tfloatingOffsetX: floatingOffsetSchema,\n\tfloatingOffsetY: floatingOffsetSchema,\n\tfloatingCollisionDetection: z\n\t\t.enum(floatingCollisionDetectionValues)\n\t\t.transform(value => value === \"true\")\n\t\t.optional()\n\t\t.catch(undefined),\n} satisfies Record<keyof RelativeOverlayAttributes, z.ZodTypeAny>\n\nconst relativeOverlaySchema = z.object(relativeOverlaySchemaShape)\n\ntype RelativeOverlayDSL = TraitToAttributesOutput<RelativeOverlayAttributes>\n\nfunction enumDescription(values: readonly string[]): string {\n\treturn values.join(\" | \")\n}\n\nconst definition: TraitAttributeDefinition<RelativeOverlayDSL> = {\n\tfloatingPlacement: {\n\t\tdescription: enumDescription(floatingPlacementValues),\n\t\toptional: true,\n\t},\n\tfloatingAlignment: {\n\t\tdescription: enumDescription(floatingAlignmentValues),\n\t\toptional: true,\n\t},\n\tfloatingOffsetX: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tfloatingOffsetY: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tfloatingCollisionDetection: {\n\t\tdescription: enumDescription(floatingCollisionDetectionValues),\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (!hasFloatingPosition(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst parsed = relativeOverlaySchema.safeParse({\n\t\tfloatingPlacement: isString(attributes.floatingPlacement) ? attributes.floatingPlacement : undefined,\n\t\tfloatingAlignment: isString(attributes.floatingAlignment) ? attributes.floatingAlignment : undefined,\n\t\tfloatingOffsetX: attributes.floatingOffsetX,\n\t\tfloatingOffsetY: attributes.floatingOffsetY,\n\t\tfloatingCollisionDetection: isBooleanString(attributes.floatingCollisionDetection)\n\t\t\t? attributes.floatingCollisionDetection\n\t\t\t: undefined,\n\t})\n\tif (!parsed.success) return\n\n\tconst { floatingPlacement, floatingAlignment, floatingOffsetX, floatingOffsetY, floatingCollisionDetection } =\n\t\tparsed.data\n\tconst updates: Partial<WithFloatingPosition> = {}\n\tconst warnings: TraitWarning[] = []\n\n\tif (!isUndefined(floatingPlacement)) {\n\t\tupdates.floatingPlacement = floatingPlacement\n\t} else if (isString(attributes.floatingPlacement)) {\n\t\twarnings.push(singleWarning(\"floatingPlacement\", attributes.floatingPlacement, \"top | right | bottom | left\"))\n\t}\n\n\tif (!isUndefined(floatingAlignment)) {\n\t\tupdates.floatingAlignment = floatingAlignment\n\t} else if (isString(attributes.floatingAlignment)) {\n\t\twarnings.push(singleWarning(\"floatingAlignment\", attributes.floatingAlignment, \"start | center | end\"))\n\t}\n\n\tif (!isUndefined(floatingOffsetX)) {\n\t\tupdates.floatingOffsetX = floatingOffsetX\n\t} else if (!isUndefined(attributes.floatingOffsetX)) {\n\t\twarnings.push(singleWarning(\"floatingOffsetX\", attributes.floatingOffsetX, expectedPxValue))\n\t}\n\n\tif (!isUndefined(floatingOffsetY)) {\n\t\tupdates.floatingOffsetY = floatingOffsetY\n\t} else if (!isUndefined(attributes.floatingOffsetY)) {\n\t\twarnings.push(singleWarning(\"floatingOffsetY\", attributes.floatingOffsetY, expectedPxValue))\n\t}\n\n\tif (!isUndefined(floatingCollisionDetection)) {\n\t\tupdates.floatingCollisionDetection = floatingCollisionDetection\n\t} else if (!isUndefined(attributes.floatingCollisionDetection)) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\"floatingCollisionDetection\", attributes.floatingCollisionDetection, expectedBooleanValue),\n\t\t)\n\t}\n\n\tif (!isEmptyObject(updates)) {\n\t\tnode.set({ ...updates, floatingPositionEnabled: true })\n\t}\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!hasFloatingPosition(node)) return\n\n\tconst result: DSLAttributes = {\n\t\tfloatingPlacement: node.floatingPlacement ?? DEFAULT_FLOATING_PLACEMENT,\n\t\tfloatingAlignment: node.floatingAlignment ?? DEFAULT_FLOATING_ALIGNMENT,\n\t}\n\n\tif (!isUndefined(node.floatingOffsetX)) {\n\t\tresult.floatingOffsetX = `${toRoundedNumber(node.floatingOffsetX)}px`\n\t}\n\n\tif (!isUndefined(node.floatingOffsetY)) {\n\t\tresult.floatingOffsetY = `${toRoundedNumber(node.floatingOffsetY)}px`\n\t}\n\n\tif (isBoolean(node.floatingCollisionDetection)) {\n\t\tresult.floatingCollisionDetection = node.floatingCollisionDetection\n\t}\n\n\treturn result\n}\n\nexport const relativeOverlay = {\n\tfor: { guard: hasFloatingPosition, nodes: [RelativeOverlayNodeClass] as const },\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<RelativeOverlayDSL>\n", "import type { ReactComponentDefinition } from \"@framerjs/framer-runtime\"\nimport type { ExternalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { assert, getLogger, hostInfo } from \"@framerjs/shared\"\nimport { experiments } from \"app/experiments.ts\"\nimport { ensureModulesAreLoaded } from \"code-generation/components/helpers/ensureModulesAreLoaded.ts\"\nimport { getRelatedReplicaNodes } from \"code-generation/utils/isOnlyVisibleInCurrentVariant.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport {\n\tgetInfiniteScrollIdentifier,\n\tgetLoadMoreIdentifier,\n} from \"document/components/chrome/insertSidebar/dataSources/utils.tsx\"\nimport { createLoadMoreAction } from \"document/models/CanvasTree/actions/paginationActions.ts\"\nimport { type CanvasTree, CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport type { DataRepeater } from \"document/models/CanvasTree/nodes/FrameNode.ts\"\nimport { TemplateHelper } from \"document/models/CanvasTree/nodes/TemplateHelper.ts\"\nimport { isCodeComponentNode, isGridComponent } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { WithCollectionOptions } from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { prefixControlProps } from \"document/models/controlProps/controlPropKey.ts\"\nimport { ControlType, DimensionType } from \"library/index.ts\"\nimport { isKeySetAndNotInherited } from \"utils/isKeySetAndNotInherited.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\n\nconst log = getLogger(\"addPagination\")\n\nexport const defaultPaginationPageSize = 4\n\nfunction getFirstEventHandlerKey(component: ReactComponentDefinition): string | undefined {\n\tfor (const key in component.properties) {\n\t\tconst control = component.properties[key]\n\t\tif (control?.type === ControlType.EventHandler) {\n\t\t\treturn key\n\t\t}\n\t}\n}\n\nfunction getVariantIdForVariantName(component: ReactComponentDefinition, variantName: string): string | undefined {\n\tconst variantProperty = component.properties.variant\n\tif (variantProperty?.type !== ControlType.Enum) return\n\tif (!variantProperty.optionTitles) return\n\n\tconst variantIndex = variantProperty.optionTitles.findIndex(variant => variant.toLowerCase() === variantName)\n\tconst variantByIndex = variantProperty.options[variantIndex]\n\treturn isString(variantByIndex) ? variantByIndex : undefined\n}\n\nfunction findExistingCodeComponentWithDataIdentifier(\n\trepeater: DataRepeater,\n\tdataIdentifier: ExternalModuleExportIdentifierString,\n): CodeComponentNode | undefined {\n\tfor (const node of repeater.walk()) {\n\t\tif (!isCodeComponentNode(node)) continue\n\t\tif (node.codeComponentIdentifier !== dataIdentifier) continue\n\t\treturn node\n\t}\n}\n\nfunction getButtonLayout(repeater: DataRepeater): Partial<CodeComponentNode> | undefined {\n\tif (!isGridComponent(repeater)) return undefined\n\n\t// For grids, we don't want the spinner or load more button to render within the grid layout,\n\t// but centred below it.\n\treturn {\n\t\tposition: \"absolute\",\n\t\ttop: null,\n\t\tleft: null,\n\t\tright: null,\n\t\tbottom: 0,\n\t\tcenterAnchorX: 0.5,\n\t\tcenterAnchorY: 0.5,\n\t}\n}\n\nfunction getCollectionPaginationPageSize(repeater: DataRepeater): number {\n\treturn repeater.collectionPaginationPageSize ?? defaultPaginationPageSize\n}\n\nfunction reportErrorIfNeeded(\n\tbuttonType: \"infinite scroll\" | \"load more\",\n\tproperty: \"event handler key\" | \"loading variant\" | \"hidden variant\",\n\tusedValue: string,\n\texpectedValue: string | undefined,\n) {\n\tif (usedValue === expectedValue) return\n\n\tlog.reportError(\n\t\t`Error while adding ${buttonType} pagination. Wrong ${property}: ${usedValue}, component expects: ${expectedValue}`,\n\t)\n}\n\n/**\n * Resets the collectionPaginationPageSize property on all replicas of the repeater node, because\n * this property is used to enable/disable the pagination buttons. And you never want those to be\n * stuck in a disabled (undefined) state\n */\nexport function resetPaginationPageSizeReplicaOverrides(tree: CanvasTree, repeaterInPrimary: DataRepeater) {\n\tassert(!isReplicaOrReplicaChild(repeaterInPrimary), \"Expects the primary repeater node to be passed in\")\n\n\tfor (const { relatedNode, replicaRoot } of getRelatedReplicaNodes(tree, repeaterInPrimary)) {\n\t\tconst collectionPaginationPageSizeKey: keyof WithCollectionOptions = \"collectionPaginationPageSize\"\n\t\tif (!isKeySetAndNotInherited(tree, relatedNode, collectionPaginationPageSizeKey)) continue\n\t\tTemplateHelper.resetOverridesByProperty(tree, replicaRoot, relatedNode, [collectionPaginationPageSizeKey])\n\t}\n}\n\nexport async function addInfiniteScrollPagination(engine: VekterEngine, repeater: DataRepeater) {\n\tconst codeComponentIdentifier = await getInfiniteScrollIdentifier(engine)\n\tassert(codeComponentIdentifier, \"Infinite scroll code component identifier not found\")\n\n\tconst { isProduction } = hostInfo\n\n\tconst loadingVariant = isProduction ? \"G47S15YSn\" : \"UkNlsLhiD\"\n\tconst hiddenVariant = isProduction ? \"PX1MOnVXY\" : \"ZyV4hSTo1\"\n\n\tconst repeaterInPrimary = engine.tree.get<DataRepeater>(repeater.getPrimaryId())\n\tassert(repeaterInPrimary, \"Primary repeater node not found\")\n\n\tengine.scheduler.processWhenReady(() => {\n\t\tconst infiniteScrollIndicator = new CodeComponentNode({\n\t\t\tcodeComponentIdentifier,\n\t\t\t...getButtonLayout(repeaterInPrimary),\n\t\t\theightType: DimensionType.Auto,\n\t\t\twidthType: DimensionType.Auto,\n\t\t\tdataLoaderLoadingVariantEnabled: true,\n\t\t\tdataLoaderLoadingVariant: loadingVariant,\n\t\t\tdataLoaderDisabledVariantEnabled: true,\n\t\t\tdataLoaderDisabledVariant: hiddenVariant,\n\t\t\tslotsAreChildNodes: experiments.isOn(\"componentSlotsAreChildNodes\"),\n\t\t})\n\n\t\tengine.tree.insertNode(infiniteScrollIndicator, repeaterInPrimary.id)\n\n\t\trepeaterInPrimary.set({\n\t\t\tdataSourceLoaderId: infiniteScrollIndicator.id,\n\t\t\tcollectionPaginationPageSize: getCollectionPaginationPageSize(repeaterInPrimary),\n\t\t})\n\t\tresetPaginationPageSizeReplicaOverrides(engine.tree, repeaterInPrimary)\n\t})\n\n\t// Wait for component to be available in the component loader.\n\tawait ensureModulesAreLoaded([codeComponentIdentifier], engine.stores.modulesStore, engine.componentLoader)\n\n\tconst component = engine.componentLoader.reactComponentForIdentifier(codeComponentIdentifier)\n\tif (!component) return\n\n\t// Check if the synchronously set properties are correct according to the component definition.\n\n\tconst actualLoadingVariant = getVariantIdForVariantName(component, \"loading\")\n\treportErrorIfNeeded(\"infinite scroll\", \"loading variant\", loadingVariant, actualLoadingVariant)\n\n\tconst actualHiddenVariant = getVariantIdForVariantName(component, \"hidden\")\n\treportErrorIfNeeded(\"infinite scroll\", \"hidden variant\", hiddenVariant, actualHiddenVariant)\n}\n\nexport async function addLoadMorePagination(engine: VekterEngine, repeater: DataRepeater) {\n\tconst codeComponentIdentifier = await getLoadMoreIdentifier(engine)\n\tassert(codeComponentIdentifier, \"Load more code component identifier not found\")\n\n\tconst { isProduction } = hostInfo\n\n\t// These ids are coming from the generated component we insert, if these values start becoming\n\t// wrong, the logging at the end should tell us exactly how to fix it.\n\tconst eventHandlerKey = isProduction ? \"Wld3NDzSj\" : \"BqagkgZ8q\"\n\tconst loadingVariant = isProduction ? \"HjxzgyO9l\" : \"wtqmTofgE\"\n\tconst hiddenVariant = isProduction ? \"RY1CAqXo3\" : \"dyXUF_qKW\"\n\n\tconst repeaterInPrimary = engine.tree.get<DataRepeater>(repeater.getPrimaryId())\n\tassert(repeaterInPrimary, \"Primary repeater node not found\")\n\n\tengine.scheduler.processWhenReady(() => {\n\t\trepeaterInPrimary.set({ collectionPaginationPageSize: getCollectionPaginationPageSize(repeaterInPrimary) })\n\t\tresetPaginationPageSizeReplicaOverrides(engine.tree, repeaterInPrimary)\n\n\t\tconst variantsAndLoadMoreAction: Partial<CodeComponentNode> = {\n\t\t\tdataLoaderLoadingVariantEnabled: true,\n\t\t\tdataLoaderLoadingVariant: loadingVariant,\n\t\t\tdataLoaderDisabledVariantEnabled: true,\n\t\t\tdataLoaderDisabledVariant: hiddenVariant,\n\t\t\t...prefixControlProps({\n\t\t\t\t[eventHandlerKey]: {\n\t\t\t\t\ttype: ControlType.EventHandler,\n\t\t\t\t\tvalue: [createLoadMoreAction()],\n\t\t\t\t},\n\t\t\t}),\n\t\t}\n\n\t\tconst existingLoadMoreButton = findExistingCodeComponentWithDataIdentifier(\n\t\t\trepeaterInPrimary,\n\t\t\tcodeComponentIdentifier,\n\t\t)\n\n\t\tif (existingLoadMoreButton) {\n\t\t\t// Update existing load more button with variants and load more action\n\t\t\texistingLoadMoreButton.set(variantsAndLoadMoreAction)\n\t\t} else {\n\t\t\t// Create new load more button instance\n\t\t\tconst loadMoreButton = new CodeComponentNode({\n\t\t\t\tcodeComponentIdentifier,\n\t\t\t\tslotsAreChildNodes: experiments.isOn(\"componentSlotsAreChildNodes\"),\n\t\t\t\t...getButtonLayout(repeaterInPrimary),\n\t\t\t\theightType: DimensionType.Auto,\n\t\t\t\twidthType: DimensionType.Auto,\n\t\t\t\t...variantsAndLoadMoreAction,\n\t\t\t})\n\n\t\t\tengine.tree.insertNode(loadMoreButton, repeaterInPrimary.id)\n\t\t}\n\t})\n\n\t// Wait for component to be available in the component loader.\n\tawait ensureModulesAreLoaded([codeComponentIdentifier], engine.stores.modulesStore, engine.componentLoader)\n\n\tconst component = engine.componentLoader.reactComponentForIdentifier(codeComponentIdentifier)\n\tif (!component) return\n\n\t// Check if the synchronously set properties are correct according to the component definition.\n\n\tconst actualEventHandlerKey = getFirstEventHandlerKey(component)\n\treportErrorIfNeeded(\"load more\", \"event handler key\", eventHandlerKey, actualEventHandlerKey)\n\n\tconst actualLoadingVariant = getVariantIdForVariantName(component, \"loading\")\n\treportErrorIfNeeded(\"load more\", \"loading variant\", loadingVariant, actualLoadingVariant)\n\n\tconst actualHiddenVariant = getVariantIdForVariantName(component, \"hidden\")\n\treportErrorIfNeeded(\"load more\", \"hidden variant\", hiddenVariant, actualHiddenVariant)\n}\n", "import { assert, assertNever, localModuleIdentifierForStableName, ModuleType } from \"@framerjs/shared\"\nimport { getRelatedReplicaNodes } from \"code-generation/utils/isOnlyVisibleInCurrentVariant.ts\"\nimport {\n\taddInfiniteScrollPagination,\n\taddLoadMorePagination,\n\tresetPaginationPageSizeReplicaOverrides,\n} from \"document/components/utils/pagination.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isCollectionRepeater, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\ttype CollectionFilterTransform,\n\ttype CollectionFilterTransformName,\n\tgetCollectionFilterTransformValueTypes,\n\tisCollectionFilterTransform,\n\ttype ValueTransformType,\n\ttype ValueTransformWithoutIdAndType,\n} from \"document/models/CanvasTree/traits/ValueTransform.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport {\n\thasCollectionDataSource,\n\twithCollectionDataSource,\n} from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport {\n\ttype CollectionFilter,\n\ttype CollectionFilterData,\n\ttype CollectionFilterOperator,\n\ttype CollectionOrder,\n\ttype CollectionOrderItem,\n\tdefaultFiltersOperator,\n\twithCollectionOptions,\n} from \"document/models/CanvasTree/traits/WithCollectionOptions.ts\"\nimport { removeLoadMoreActions } from \"document/models/CanvasTree/traits/WithDataLoaderVariants.ts\"\nimport { hasRepeatArray } from \"document/models/CanvasTree/traits/WithRepeatArray.ts\"\nimport { isFiniteNumber } from \"library/index.ts\"\nimport { getRepeatedItemIdUpdate } from \"utils/repeaterUtils.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { isVariableReferenceHandle } from \"../context/dynamicValues.ts\"\nimport { jsonString } from \"../schemaUtils.ts\"\nimport { isNullString } from \"./helpers.ts\"\nimport {\n\texpectedNonNegativeInteger,\n\texpectedPositiveInteger,\n\tunsupportedAttributeMessage,\n\twarning,\n} from \"./invalidValues.ts\"\nimport { createFilterSchema, type FilterDefinition, serializeValueTransform } from \"./transforms.ts\"\nimport {\n\ttype DSLAttributes,\n\tnodeToDSLType,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\nimport { zodErrorToWarnings } from \"./zodErrorToWarnings.ts\"\n\nexport const filtersOperatorAnd = \"and\"\nexport const filtersOperatorOr = \"or\"\n\nconst SortEntryObject = z.object({\n\tvariable: z.string(),\n\tdirection: z.enum([\"asc\", \"desc\"]),\n})\n\nconst SortEntry = jsonString.pipe(SortEntryObject).or(SortEntryObject)\ntype SortEntry = z.infer<typeof SortEntry>\n\nconst SortSchema = jsonString.pipe(z.array(SortEntry)).or(z.array(SortEntry))\n\ninterface CollectionListAttributes {\n\tcollection: string\n\trepeatedDescendantId: string\n\tlimit: number\n\toffset: number\n\tsorting: SortEntry[]\n\tfilters: FilterDefinition[]\n\tfiltersOperator: string\n\tpaginationPageSize: number\n\tpagination: string\n}\n\nexport const collectionListPrefix = \"collectionList\" as const\n\ntype CollectionDefinition = Record<typeof collectionListPrefix, CollectionListAttributes>\n\nconst definition: TraitAttributeDefinition<CollectionDefinition> = {\n\t[collectionListPrefix]: {\n\t\tcollection: {\n\t\t\tdescription:\n\t\t\t\t\"The name of the CMS collection this node repeats over. Descendants are repeated per item with collection variables in scope.\",\n\t\t\toptional: true,\n\t\t},\n\t\trepeatedDescendantId: {\n\t\t\tdescription:\n\t\t\t\t\"The id of the direct descendant node used as the repeated template. Required when setting collectionList.collection.\",\n\t\t\toptional: true,\n\t\t},\n\t\tlimit: {\n\t\t\tdescription: \"When repeating over a CMS collection, the maximum number of items shown. positive integer | null\",\n\t\t\toptional: true,\n\t\t},\n\t\toffset: {\n\t\t\tdescription:\n\t\t\t\t\"When repeating over a CMS collection, number of items to skip from the start. non-negative integer | null\",\n\t\t\toptional: true,\n\t\t},\n\t\tsorting: [\n\t\t\t{\n\t\t\t\tvariable: { description: \"When repeating over a CMS collection, collection variable id to sort by\" },\n\t\t\t\tdirection: { description: \"asc | desc\" },\n\t\t\t},\n\t\t],\n\t\tfilters: [\n\t\t\t{\n\t\t\t\tvariableId: { description: \"variable id to filter on\" },\n\t\t\t\ttransforms: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: { description: \"transform name \u2014 see Filtering collection lists section\" },\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t\tfiltersOperator: {\n\t\t\tdescription: `${filtersOperatorAnd} | ${filtersOperatorOr}`,\n\t\t\toptional: true,\n\t\t},\n\t\tpaginationPageSize: {\n\t\t\tdescription: \"number | null\",\n\t\t\toptional: true,\n\t\t},\n\t\tpagination: {\n\t\t\tdescription: \"infinite-scroll | load-more | null\",\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nfunction guard<T extends CanvasNode>(node: T): node is T {\n\treturn (withCollectionDataSource(node) || withCollectionOptions(node)) && !isWebPageNode(node)\n}\n\nfunction serializeSort(order: CollectionOrder): SortEntry[] {\n\tconst result: SortEntry[] = []\n\tfor (const item of order) {\n\t\tif (!item.itemKey) continue\n\t\tresult.push({ variable: item.itemKey, direction: item.direction })\n\t}\n\treturn result\n}\n\nfunction serializeFilter(filter: CollectionFilter, node: CanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!filter.itemKey) return undefined\n\tif (filter.transforms.length === 0) return undefined\n\n\treturn {\n\t\tvariableId: filter.itemKey,\n\t\ttransforms: filter.transforms\n\t\t\t.filter(isCollectionFilterTransform)\n\t\t\t.map(transform => serializeValueTransform(transform, node, ctx.dynamicValues)),\n\t}\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (isWebPageNode(node)) return undefined\n\tif (!hasCollectionDataSource(node)) return undefined\n\n\tconst result: DSLAttributes = {}\n\n\tconst collectionName = ctx.collections.collectionNameFromInstanceIdentifier(node.dataIdentifier)\n\tif (collectionName) {\n\t\tresult.collection = collectionName\n\t}\n\n\tif (withCollectionOptions(node)) {\n\t\tconst repeatedItemId = node.repeatedItemId ?? node.collectionRepeatedItemId\n\t\tif (!isUndefined(repeatedItemId)) {\n\t\t\tresult.repeatedDescendantId = repeatedItemId\n\t\t}\n\n\t\tif (!isUndefined(node.collectionLimit)) {\n\t\t\tresult.limit = node.collectionLimit.toString()\n\t\t}\n\t\tif (!isUndefined(node.collectionStartOffset)) {\n\t\t\tresult.offset = node.collectionStartOffset.toString()\n\t\t}\n\n\t\tif (node.collectionOrder && node.collectionOrder.length > 0) {\n\t\t\tconst sorting = serializeSort(node.collectionOrder)\n\t\t\tif (sorting.length > 0) {\n\t\t\t\tresult.sorting = sorting\n\t\t\t}\n\t\t}\n\n\t\tif (node.collectionFilters && node.collectionFilters.filters.length > 0) {\n\t\t\tconst filters = node.collectionFilters.filters.flatMap(filter => serializeFilter(filter, node, ctx) ?? [])\n\n\t\t\tif (filters.length > 0) {\n\t\t\t\tresult.filters = filters\n\t\t\t\tresult.filtersOperator =\n\t\t\t\t\t(node.collectionFiltersOperator ?? defaultFiltersOperator) === \"any\" ? filtersOperatorOr : filtersOperatorAnd\n\t\t\t}\n\t\t}\n\n\t\tif (!isUndefined(node.collectionPaginationPageSize)) {\n\t\t\tresult.paginationPageSize = node.collectionPaginationPageSize.toString()\n\t\t}\n\t}\n\n\tif (Object.keys(result).length === 0) return undefined\n\treturn { [collectionListPrefix]: result }\n}\n\nfunction applyCollection(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (!withCollectionDataSource(node)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: false,\n\t\t\t\tkey: `${collectionListPrefix}.collection`,\n\t\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (isWebPageNode(node)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: false,\n\t\t\t\tkey: `${collectionListPrefix}.collection`,\n\t\t\t\tmessage: \"Use :CollectionName in the page path to create a detail page.\",\n\t\t\t},\n\t\t]\n\t}\n\n\tif (!isString(attributes.collection)) {\n\t\treturn warning(`${collectionListPrefix}.collection`, attributes.collection, \"a collection name\")\n\t}\n\n\tconst collectionId = ctx.collections.collectionIdFromName(attributes.collection)\n\tif (!collectionId) {\n\t\treturn warning(`${collectionListPrefix}.collection`, attributes.collection, \"a valid collection name\")\n\t}\n\n\tconst identifier = localModuleIdentifierForStableName(ModuleType.Collection, collectionId, \"default\").value\n\tnode.set({ dataIdentifier: identifier })\n\tctx.collections.registerVariables(collectionId)\n}\n\nfunction applyRepeatedDescendantId(\n\tnode: CanvasNode,\n\tattributes: DSLAttributes,\n\tctx: AgentContext,\n): TraitWarning[] | undefined {\n\tif (!withCollectionOptions(node)) {\n\t\treturn warning(\n\t\t\t`${collectionListPrefix}.repeatedDescendantId`,\n\t\t\tattributes.repeatedDescendantId,\n\t\t\t\"a node that supports collection options\",\n\t\t)\n\t}\n\n\tif (!isString(attributes.repeatedDescendantId)) {\n\t\treturn warning(`${collectionListPrefix}.repeatedDescendantId`, attributes.repeatedDescendantId, \"a node id string\")\n\t}\n\n\tconst repeatedDescendant = ctx.treeResolver.get(attributes.repeatedDescendantId)\n\tif (!repeatedDescendant) {\n\t\tthrow new DeferTraitError(\n\t\t\t`collectionList.repeatedDescendantId: child \"${attributes.repeatedDescendantId}\" not found yet`,\n\t\t)\n\t}\n\n\tconst repeatedDescendantParent = ctx.treeResolver.getParentNode(repeatedDescendant)\n\tif (!repeatedDescendantParent || repeatedDescendantParent.id !== node.id) {\n\t\treturn warning(\n\t\t\t`${collectionListPrefix}.repeatedDescendantId`,\n\t\t\tattributes.repeatedDescendantId,\n\t\t\t\"a direct child of this repeater\",\n\t\t)\n\t}\n\tif (hasRepeatArray(repeatedDescendant)) {\n\t\treturn warning(\n\t\t\t`${collectionListPrefix}.repeatedDescendantId`,\n\t\t\tattributes.repeatedDescendantId,\n\t\t\t\"a descendant that is not itself a repeater\",\n\t\t)\n\t}\n\n\tnode.set(getRepeatedItemIdUpdate(repeatedDescendant.id))\n}\n\nfunction applyLimit(node: CanvasNode, attributes: DSLAttributes): TraitWarning[] | undefined {\n\tif (!withCollectionOptions(node)) {\n\t\treturn warning(`${collectionListPrefix}.limit`, attributes.limit, \"a node that supports collection options\")\n\t}\n\tif (isNullString(attributes.limit)) {\n\t\tnode.set({ collectionLimit: undefined })\n\t\treturn\n\t}\n\tconst limit = tryParseNumber(attributes.limit, true)\n\tif (!isFiniteNumber(limit) || limit < 1) {\n\t\treturn warning(`${collectionListPrefix}.limit`, attributes.limit, expectedPositiveInteger)\n\t}\n\tnode.set({ collectionLimit: limit })\n}\n\nfunction applyOffset(node: CanvasNode, attributes: DSLAttributes): TraitWarning[] | undefined {\n\tif (!withCollectionOptions(node)) {\n\t\treturn warning(`${collectionListPrefix}.offset`, attributes.offset, \"a node that supports collection options\")\n\t}\n\tif (isNullString(attributes.offset)) {\n\t\tnode.set({ collectionStartOffset: undefined })\n\t\treturn\n\t}\n\tconst offset = tryParseNumber(attributes.offset, true)\n\tif (!isFiniteNumber(offset) || offset < 0) {\n\t\treturn warning(`${collectionListPrefix}.offset`, attributes.offset, expectedNonNegativeInteger)\n\t}\n\tnode.set({ collectionStartOffset: offset === 0 ? undefined : offset })\n}\n\nfunction applySort(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (!withCollectionOptions(node)) {\n\t\treturn warning(`${collectionListPrefix}.sorting`, attributes.sorting, \"a node that supports collection options\")\n\t}\n\n\tif (isNullString(attributes.sorting)) {\n\t\tnode.set({ collectionOrder: undefined })\n\t\treturn\n\t}\n\n\tconst result = SortSchema.safeParse(attributes.sorting)\n\tif (!result.success) {\n\t\treturn zodErrorToWarnings({\n\t\t\terror: result.error,\n\t\t\tschema: SortSchema,\n\t\t\tkeyPrefix: `${collectionListPrefix}.sorting`,\n\t\t\tinput: attributes.sorting,\n\t\t})\n\t}\n\n\tif (result.data.length === 0) {\n\t\tnode.set({ collectionOrder: undefined })\n\t\treturn\n\t}\n\n\tconst orderItems: CollectionOrderItem[] = result.data.map(entry => {\n\t\tconst handle = ctx.dynamicValues.getVariableReferenceHandleByVariableId(entry.variable)\n\t\tconst resolvedVariable = isVariableReferenceHandle(handle) ? handle.variable.id : entry.variable\n\t\treturn { id: randomID(), itemKey: resolvedVariable, direction: entry.direction }\n\t})\n\n\tnode.set({ collectionOrder: orderItems })\n}\n\nfunction applyFilters(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (!withCollectionOptions(node)) {\n\t\treturn warning(\"collectionList.filters\", attributes.filters, \"a node that supports collection options\")\n\t}\n\n\tif (isNullString(attributes.filters)) {\n\t\tnode.set({ collectionFilters: undefined })\n\t\treturn\n\t}\n\n\tconst filterSchema = createFilterSchema(node, ctx.dynamicValues)\n\tconst result = filterSchema.safeParse(attributes.filters)\n\tif (!result.success) {\n\t\treturn zodErrorToWarnings({\n\t\t\terror: result.error,\n\t\t\tschema: filterSchema,\n\t\t\tkeyPrefix: \"collectionList.filters\",\n\t\t\tinput: attributes.filters,\n\t\t})\n\t}\n\n\tif (result.data.length === 0) {\n\t\tnode.set({ collectionFilters: undefined })\n\t\treturn\n\t}\n\n\tconst transformWarning = validateFilterTransformValueTypes(result.data, ctx)\n\tif (transformWarning) return [transformWarning]\n\n\tconst filterItems: CollectionFilter[] = result.data.map(entry => ({\n\t\tid: randomID(),\n\t\titemKey: entry.variableId,\n\t\ttransforms: entry.transforms,\n\t}))\n\n\tconst filterData: CollectionFilterData = { filters: filterItems }\n\tnode.set({ collectionFilters: filterData })\n}\n\nfunction validateFilterTransformValueTypes(filters: FilterDefinition[], ctx: AgentContext): TraitWarning | undefined {\n\tfor (const [filterIndex, { transforms }] of filters.entries()) {\n\t\t/** See {@link maxTransformCountToReachOutputType} */\n\t\tif (transforms.length > 2) {\n\t\t\treturn {\n\t\t\t\tkey: `collectionList.filters.${filterIndex}.transforms`,\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: `Expected at most 2 transforms, got ${transforms.length}.`,\n\t\t\t}\n\t\t}\n\n\t\tif (transforms.length === 2 && transforms[1]?.name !== \"negate\") {\n\t\t\treturn {\n\t\t\t\tkey: `collectionList.filters.${filterIndex}.transforms.1`,\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: `The second transform must be \"negate\", got \"${transforms[1]?.name}\".`,\n\t\t\t}\n\t\t}\n\n\t\tconst first = transforms[0]\n\t\tif (!first) continue\n\n\t\tconst valueWarning = validateTransformValues(first, filterIndex, ctx)\n\t\tif (valueWarning) return valueWarning\n\t}\n}\n\nfunction validateTransformValues(\n\ttransform: ValueTransformWithoutIdAndType<CollectionFilterTransform>,\n\tfilterIndex: number,\n\tctx: AgentContext,\n): TraitWarning | undefined {\n\tswitch (transform.name) {\n\t\tcase \"contains\":\n\t\tcase \"containsAll\":\n\t\tcase \"containsAny\":\n\t\tcase \"endsWith\":\n\t\tcase \"equals\":\n\t\tcase \"greaterThan\":\n\t\tcase \"isAfter\":\n\t\tcase \"isBefore\":\n\t\tcase \"isIncludedIn\":\n\t\tcase \"lessThan\":\n\t\tcase \"startsWith\": {\n\t\t\tconst types = getCollectionFilterTransformValueTypes(transform.name)\n\t\t\tassert(types, `Expected value types for \"${transform.name}\"`)\n\t\t\treturn validateTransformValueTypes(transform.value, types.value, transform.name, filterIndex, ctx)\n\t\t}\n\t\tcase \"isBetweenDates\": {\n\t\t\tconst types = getCollectionFilterTransformValueTypes(transform.name)\n\t\t\tassert(types, `Expected value types for \"${transform.name}\"`)\n\t\t\treturn (\n\t\t\t\tvalidateTransformValueTypes(transform.start, types.start, transform.name, filterIndex, ctx) ??\n\t\t\t\tvalidateTransformValueTypes(transform.end, types.end, transform.name, filterIndex, ctx)\n\t\t\t)\n\t\t}\n\t\tcase \"convertFromEnum\":\n\t\tcase \"convertFromString\":\n\t\tcase \"isSet\":\n\t\tcase \"negate\":\n\t\t\treturn\n\t\tdefault:\n\t\t\tassertNever(transform)\n\t}\n}\n\nfunction validateTransformValueTypes(\n\tvalue: unknown,\n\tacceptedTypes: readonly ValueTransformType[],\n\ttransformName: CollectionFilterTransformName,\n\tfilterIndex: number,\n\tctx: AgentContext,\n): TraitWarning | undefined {\n\tif (!isVariableReference(value)) return\n\n\tconst handle = ctx.dynamicValues.getVariableReferenceHandleByVariableReference(value)\n\tassert(handle, \"Variable references must be resolvable\")\n\n\tif (!acceptedTypes.includes(handle.outputType)) {\n\t\treturn {\n\t\t\tkey: `collectionList.filters.${filterIndex}.transforms.0`,\n\t\t\tapplied: false,\n\t\t\tmessage: `\"${transformName}\" is not compatible with variable type \"${handle.outputType}\". Expected: ${acceptedTypes.join(\", \")}.`,\n\t\t}\n\t}\n}\n\nfunction parseFiltersOperator(value: unknown): CollectionFilterOperator | undefined {\n\tif (!isString(value)) return undefined\n\tconst normalized = value.toLowerCase()\n\tif (normalized === filtersOperatorAnd) return \"all\"\n\tif (normalized === filtersOperatorOr) return \"any\"\n\treturn undefined\n}\n\nfunction applyFiltersOperator(node: CanvasNode, attributes: DSLAttributes): TraitWarning[] | undefined {\n\tif (!withCollectionOptions(node)) {\n\t\treturn warning(\n\t\t\t\"collectionList.filtersOperator\",\n\t\t\tattributes.filtersOperator,\n\t\t\t\"a node that supports collection options\",\n\t\t)\n\t}\n\n\tif (isNullString(attributes.filtersOperator)) {\n\t\tnode.set({ collectionFiltersOperator: undefined })\n\t\treturn\n\t}\n\n\tconst operator = parseFiltersOperator(attributes.filtersOperator)\n\tif (!operator) {\n\t\treturn warning(\n\t\t\t\"collectionList.filtersOperator\",\n\t\t\tattributes.filtersOperator,\n\t\t\t`\"${filtersOperatorAnd}\" or \"${filtersOperatorOr}\"`,\n\t\t)\n\t}\n\n\tnode.set({ collectionFiltersOperator: operator })\n}\n\nconst paginationInfiniteScroll = \"infinite-scroll\"\nconst paginationLoadMore = \"load-more\"\n\nfunction applyPaginationPageSize(node: CanvasNode, attributes: DSLAttributes): TraitWarning[] | undefined {\n\tif (!withCollectionOptions(node)) {\n\t\treturn warning(\n\t\t\t`${collectionListPrefix}.paginationPageSize`,\n\t\t\tattributes.paginationPageSize,\n\t\t\t\"a node that supports collection options\",\n\t\t)\n\t}\n\tif (isNullString(attributes.paginationPageSize)) {\n\t\tnode.set({ collectionPaginationPageSize: undefined })\n\t\treturn\n\t}\n\tconst pageSize = tryParseNumber(attributes.paginationPageSize, true)\n\tif (!isFiniteNumber(pageSize) || pageSize < 1) {\n\t\treturn warning(`${collectionListPrefix}.paginationPageSize`, attributes.paginationPageSize, expectedPositiveInteger)\n\t}\n\tnode.set({ collectionPaginationPageSize: pageSize })\n}\n\nfunction applyPagination(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (!withCollectionOptions(node)) {\n\t\treturn warning(\n\t\t\t`${collectionListPrefix}.pagination`,\n\t\t\tattributes.pagination,\n\t\t\t\"a node that supports collection options\",\n\t\t)\n\t}\n\n\tconst value = attributes.pagination\n\n\tif (isNullString(value)) {\n\t\tconst currentNode = ctx.treeStore.tree.current(node) ?? node\n\t\tcurrentNode.set({ collectionPaginationPageSize: undefined })\n\n\t\tif (isCollectionRepeater(currentNode)) {\n\t\t\tconst engine = ctx.hooks.getEngine()\n\t\t\tif (engine) {\n\t\t\t\tresetPaginationPageSizeReplicaOverrides(engine.tree, currentNode)\n\n\t\t\t\tfor (const descendant of currentNode.walk()) {\n\t\t\t\t\tremoveLoadMoreActions(engine.tree, engine.componentLoader, descendant)\n\t\t\t\t\tfor (const { relatedNode } of getRelatedReplicaNodes(engine.tree, descendant)) {\n\t\t\t\t\t\tremoveLoadMoreActions(engine.tree, engine.componentLoader, relatedNode)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (currentNode.dataSourceLoaderId) {\n\t\t\t\t\tengine.tree.remove(currentNode.dataSourceLoaderId)\n\t\t\t\t\tcurrentNode.set({ dataSourceLoaderId: undefined })\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\tif (!isString(value) || (value !== paginationInfiniteScroll && value !== paginationLoadMore)) {\n\t\treturn warning(\n\t\t\t`${collectionListPrefix}.pagination`,\n\t\t\tvalue,\n\t\t\t`\"${paginationInfiniteScroll}\" or \"${paginationLoadMore}\"`,\n\t\t)\n\t}\n\n\t// Resolve the current node because earlier traits (e.g. applyCollection) may\n\t// have called node.set(), making the original reference stale (copy-on-write).\n\tconst currentNode = ctx.treeStore.tree.current(node) ?? node\n\n\tif (!isCollectionRepeater(currentNode)) {\n\t\treturn warning(`${collectionListPrefix}.pagination`, value, \"a CMS collection list with a stack or grid layout\")\n\t}\n\n\tconst engine = ctx.hooks.getEngine()\n\tif (!engine) {\n\t\treturn warning(`${collectionListPrefix}.pagination`, value, \"an active project engine\")\n\t}\n\n\tif (value === paginationInfiniteScroll) {\n\t\tvoid ctx.deferred.trackBlockingPromise(addInfiniteScrollPagination(engine, currentNode))\n\t} else {\n\t\tvoid ctx.deferred.trackBlockingPromise(addLoadMorePagination(engine, currentNode))\n\t}\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (isUndefined(attributes[collectionListPrefix])) return\n\tif (!isObject(attributes[collectionListPrefix])) {\n\t\treturn warning(collectionListPrefix, attributes[collectionListPrefix], \"a collection list object\")\n\t}\n\tconst collectionList = attributes[collectionListPrefix]\n\n\tconst warnings: TraitWarning[] = []\n\n\tif (!isUndefined(collectionList.collection)) {\n\t\tconst newWarnings = applyCollection(node, collectionList, ctx)\n\t\tif (newWarnings) {\n\t\t\twarnings.push(...newWarnings)\n\t\t} else if (\n\t\t\tisUndefined(collectionList.repeatedDescendantId) &&\n\t\t\twithCollectionOptions(node) &&\n\t\t\tisUndefined(node.repeatedItemId ?? node.collectionRepeatedItemId)\n\t\t) {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: `${collectionListPrefix}.repeatedDescendantId`,\n\t\t\t\tmessage: \"collectionList.repeatedDescendantId is required when setting collectionList.collection.\",\n\t\t\t})\n\t\t}\n\t}\n\n\tif (!isUndefined(collectionList.repeatedDescendantId)) {\n\t\tconst newWarnings = applyRepeatedDescendantId(node, collectionList, ctx)\n\t\tif (newWarnings) {\n\t\t\twarnings.push(...newWarnings)\n\t\t}\n\t}\n\n\tif (!isUndefined(collectionList.limit)) {\n\t\tconst newWarnings = applyLimit(node, collectionList)\n\t\tif (newWarnings) {\n\t\t\twarnings.push(...newWarnings)\n\t\t}\n\t}\n\n\tif (!isUndefined(collectionList.offset)) {\n\t\tconst newWarnings = applyOffset(node, collectionList)\n\t\tif (newWarnings) {\n\t\t\twarnings.push(...newWarnings)\n\t\t}\n\t}\n\n\tif (!isUndefined(collectionList.sorting)) {\n\t\tconst newWarnings = applySort(node, collectionList, ctx)\n\t\tif (newWarnings) {\n\t\t\twarnings.push(...newWarnings)\n\t\t}\n\t}\n\n\tif (!isUndefined(collectionList.filters)) {\n\t\tconst newWarnings = applyFilters(node, collectionList, ctx)\n\t\tif (newWarnings) {\n\t\t\twarnings.push(...newWarnings)\n\t\t}\n\t}\n\n\tif (!isUndefined(collectionList.filtersOperator)) {\n\t\tconst newWarnings = applyFiltersOperator(node, collectionList)\n\t\tif (newWarnings) {\n\t\t\twarnings.push(...newWarnings)\n\t\t}\n\t}\n\n\tif (!isUndefined(collectionList.paginationPageSize)) {\n\t\tconst newWarnings = applyPaginationPageSize(node, collectionList)\n\t\tif (newWarnings) {\n\t\t\twarnings.push(...newWarnings)\n\t\t}\n\t}\n\n\tif (!isUndefined(collectionList.pagination)) {\n\t\tconst newWarnings = applyPagination(node, collectionList, ctx)\n\t\tif (newWarnings) {\n\t\t\twarnings.push(...newWarnings)\n\t\t}\n\t}\n\n\tif (warnings.length > 0) return warnings\n}\n\nexport const repeater = {\n\tfor: guard,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<CollectionDefinition>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isBreakpointWithLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport { type WithRootFontSize, withRootFontSize } from \"document/models/CanvasTree/traits/WithRootFontSize.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { hasAnyAttribute, isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { expectedPxValue, layoutTemplateBreakpointWarnings, singleWarning } from \"./invalidValues.ts\"\nimport type {\n\tDSLAttributes,\n\tTraitAttributeDefinition,\n\tTraitDefinition,\n\tTraitToAttributesOutput,\n\tTraitWarning,\n} from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithRootFontSize> = {\n\trootFontSize: {\n\t\tdescription: \"${number}px | null\",\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tif (!hasAnyAttribute(attributes, definition)) return\n\tif (!withRootFontSize(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst layoutTemplateWarnings = layoutTemplateBreakpointWarnings(node, \"rootFontSize\")\n\tif (layoutTemplateWarnings) return layoutTemplateWarnings\n\n\t// Null is a valid value, it allows us to clear the root font size value and start using the default value.\n\tif (isNullString(attributes.rootFontSize)) {\n\t\tnode.set({ rootFontSize: undefined })\n\t\treturn\n\t}\n\n\tif (!isString(attributes.rootFontSize)) {\n\t\treturn [singleWarning(\"rootFontSize\", attributes.rootFontSize, expectedPxValue)]\n\t}\n\n\tconst [value, unit] = parseCSSDimension(attributes.rootFontSize, \"px\")\n\t// Keeping it consistent with the UI that enforces a minimum value of 1.\n\tif (Number.isNaN(value) || unit !== \"px\" || value < 1) {\n\t\treturn [singleWarning(\"rootFontSize\", attributes.rootFontSize, expectedPxValue)]\n\t}\n\n\tnode.set({ rootFontSize: value })\n}\n\nfunction toAttributes(node: CanvasNode): TraitToAttributesOutput<WithRootFontSize> | undefined {\n\tif (!withRootFontSize(node)) return\n\tif (isBreakpointWithLayoutTemplate(node)) return\n\tif (!isNumber(node.rootFontSize)) return\n\treturn { rootFontSize: createCSSDimension(node.rootFontSize, \"px\") }\n}\n\nexport const rootFontSize = {\n\tfor: withRootFontSize,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<WithRootFontSize>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { type WithRotation, withRotation } from \"document/models/CanvasTree/traits/WithRotation.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { looksLikeVariableReference } from \"../context/dynamicValues.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { expectedDegreeValue, traitNotAppliedWarning, warning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithRotation> = {\n\trotation: {\n\t\tdescription: \"${number}deg\",\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withRotation(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst warnings: TraitWarning[] = []\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.rotation, { node })\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tnode.set({ rotation: resolveHandleResult.handle.reference(node) })\n\t\treturn warnings\n\t}\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"rotation\", message)))\n\t}\n\n\tif (isNumber(attributes.rotation)) {\n\t\tnode.set({ rotation: attributes.rotation })\n\t\treturn warnings\n\t}\n\tif (!isString(attributes.rotation)) return warnings\n\n\tconst [rotation, unit] = parseCSSDimension(attributes.rotation, \"deg\")\n\tif (Number.isNaN(rotation) || unit !== \"deg\") {\n\t\tif (!looksLikeVariableReference(attributes.rotation)) {\n\t\t\twarnings.push(...warning(\"rotation\", attributes.rotation, expectedDegreeValue))\n\t\t}\n\t\treturn warnings\n\t}\n\n\tnode.set({ rotation })\n\treturn warnings\n}\n\nexport const rotation = {\n\tfor: withRotation,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes: (node: CanvasNode, _parent: unknown, ctx: AgentContext) => {\n\t\tif (!withRotation(node)) return\n\t\tif (node.rotation === 0 || isUndefined(node.rotation)) return\n\t\tif (isDynamicValue(node.rotation)) {\n\t\t\tconst rotation = ctx.dynamicValues.resolveAttributeFromDynamicValue(node.rotation, node)\n\t\t\tif (rotation) return { rotation }\n\t\t\treturn\n\t\t}\n\t\treturn { rotation: createCSSDimension(node.rotation, \"deg\") }\n\t},\n} satisfies TraitDefinition<WithRotation>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithScrollTarget,\n\thasScrollTarget,\n\twithScrollTarget,\n} from \"document/models/CanvasTree/traits/WithScrollTarget.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isBooleanString, isNumber, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { expectedPxValue, singleWarning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithScrollTarget> = {\n\tscrollTargetEnabled: {\n\t\tdescription: \"boolean\",\n\t\toptional: true,\n\t},\n\telementId: {\n\t\tdescription: \"string\",\n\t\toptional: true,\n\t},\n\tscrollMarginTop: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withScrollTarget(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst warnings: TraitWarning[] = []\n\n\tconst update: Partial<WithScrollTarget> = {}\n\n\tif (isString(attributes.elementId)) {\n\t\tupdate.elementId = attributes.elementId\n\t\tupdate.scrollTargetEnabled = true\n\t}\n\n\tif (isString(attributes.scrollMarginTop)) {\n\t\tconst [value, unit] = parseCSSDimension(attributes.scrollMarginTop, \"px\")\n\t\tif (isNumber(value) && unit === \"px\") {\n\t\t\tupdate.scrollMarginTop = value\n\t\t\tupdate.scrollTargetEnabled = true\n\t\t} else {\n\t\t\twarnings.push(singleWarning(\"scrollMarginTop\", attributes.scrollMarginTop, expectedPxValue))\n\t\t}\n\t}\n\n\tif (isBooleanString(attributes.scrollTargetEnabled)) {\n\t\tupdate.scrollTargetEnabled = attributes.scrollTargetEnabled === \"true\"\n\t}\n\n\tnode.set(update)\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!withScrollTarget(node)) return\n\tif (!hasScrollTarget(node)) return\n\n\tconst result: DSLAttributes = {\n\t\tscrollTargetEnabled: true,\n\t\telementId: node.elementId,\n\t}\n\n\tif (isNumber(node.scrollMarginTop) && node.scrollMarginTop !== 0) {\n\t\tresult.scrollMarginTop = createCSSDimension(node.scrollMarginTop, \"px\")\n\t}\n\n\treturn result\n}\n\nexport const scrollTarget = {\n\tfor: withScrollTarget,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<WithScrollTarget>\n", "import { emptyArray, isEmptyObject } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isSmartComponentInstance } from \"document/models/CanvasTree/nodes/utils/smartComponentInstanceHelpers.ts\"\nimport {\n\ttype EffectVariantScrollTarget,\n\ttype VariantAppearEffectTrigger,\n\ttype WithVariantAppearEffect,\n\tappearEffectEnabledDefaults,\n\thasVariantAppearEffect,\n\twithVariantAppearPageEffect,\n} from \"document/models/CanvasTree/traits/WithVariantAppearEffect.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport type { ScrollDirection } from \"library/modules/createTransformInputRange.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isArray, isBoolean, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { booleanString } from \"../schemaUtils.ts\"\nimport { applyArrayAttributePatch, isNullString, nullString } from \"./helpers.ts\"\nimport { singleWarning, unsupportedAttributeMessage } from \"./invalidValues.ts\"\nimport {\n\tnodeToDSLType,\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\nconst supportedTriggers = [\n\tEffectTrigger.OnInView,\n\tEffectTrigger.OnScrollTarget,\n\tEffectTrigger.OnScrollDirection,\n] as const satisfies readonly VariantAppearEffectTrigger[]\nconst supportedDirections = [\"up\", \"down\"] as const satisfies readonly ScrollDirection[]\n\nconst dslScrollVariantSectionSchema = z.object({\n\ttarget: z.string().optional().catch(undefined),\n\tvariant: z.string().optional().catch(undefined),\n})\n\nconst dslScrollVariantEffectSchema = z.object({\n\ttrigger: z.enum(supportedTriggers).optional().catch(undefined),\n\tthreshold: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\treplay: booleanString.optional().catch(undefined),\n\tfromVariant: z.string().optional().catch(undefined),\n\ttoVariant: z.string().optional().catch(undefined),\n\tdirection: z.enum(supportedDirections).optional().catch(undefined),\n\tdirectionTarget: z.string().optional().catch(undefined),\n\tsections: z\n\t\t.array(z.union([dslScrollVariantSectionSchema, z.literal(nullString)]))\n\t\t.optional()\n\t\t.catch(undefined),\n})\n\ntype DSLScrollVariantSection = z.output<typeof dslScrollVariantSectionSchema>\n\ninterface DSLScrollVariantEffect {\n\ttrigger?: VariantAppearEffectTrigger\n\tthreshold?: number\n\treplay?: boolean\n\tfromVariant?: string\n\ttoVariant?: string\n\tdirection?: ScrollDirection\n\tdirectionTarget?: string\n\tsections?: DSLScrollVariantSection[]\n}\n\nconst definition: TraitAttributeDefinition<{ scrollVariantEffect: DSLScrollVariantEffect }> = {\n\tscrollVariantEffect: {\n\t\ttrigger: {\n\t\t\tdescription: supportedTriggers.join(\" | \"),\n\t\t\toptional: true,\n\t\t},\n\t\tthreshold: {\n\t\t\tdescription: \"number\",\n\t\t\toptional: true,\n\t\t},\n\t\treplay: {\n\t\t\tdescription: \"boolean\",\n\t\t\toptional: true,\n\t\t},\n\t\tfromVariant: {\n\t\t\tdescription: \"id | null\",\n\t\t\toptional: true,\n\t\t},\n\t\ttoVariant: {\n\t\t\tdescription: \"id | null\",\n\t\t\toptional: true,\n\t\t},\n\t\tdirection: {\n\t\t\tdescription: supportedDirections.join(\" | \"),\n\t\t\toptional: true,\n\t\t},\n\t\tdirectionTarget: {\n\t\t\tdescription: \"id | null\",\n\t\t\toptional: true,\n\t\t},\n\t\tsections: [\n\t\t\t{\n\t\t\t\ttarget: {\n\t\t\t\t\tdescription: \"id | null\",\n\t\t\t\t\toptional: true,\n\t\t\t\t},\n\t\t\t\tvariant: {\n\t\t\t\t\tdescription: \"id | null\",\n\t\t\t\t\toptional: true,\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t},\n}\n\nfunction supportsScrollVariantEffect(\n\tnode: CanvasNode,\n\tctx: AgentContext,\n): node is CanvasNode & WithVariantAppearEffect {\n\tif (!withVariantAppearPageEffect(node)) return false\n\tif (!isSmartComponentInstance(ctx.treeStore.tree, node)) return false\n\n\tconst componentDefinition = ctx.componentLoader.reactComponentForIdentifier(node.codeComponentIdentifier)\n\treturn !!componentDefinition?.properties && \"variant\" in componentDefinition.properties\n}\n\nfunction resolveId(value: string, key: string, ctx: AgentContext): string | undefined {\n\tif (isNullString(value)) return undefined\n\n\tconst id = ctx.treeResolver.get(value)?.id\n\tif (!id) throw new DeferTraitError(`Cannot set ${key}: ${value} is not a valid id.`)\n\treturn id\n}\n\nfunction serializeId(value: unknown, ctx: AgentContext): string | undefined {\n\tif (!isString(value)) return undefined\n\treturn ctx.treeResolver.getLlmId(value) ?? value\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tconst { scrollVariantEffect } = attributes\n\n\tif (isUndefined(scrollVariantEffect)) return\n\n\tif (!supportsScrollVariantEffect(node, ctx)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"scrollVariantEffect\",\n\t\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (isNullString(scrollVariantEffect)) {\n\t\tnode.set({ appearEffectEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslScrollVariantEffectSchema.safeParse(scrollVariantEffect)\n\tif (!parsed.success) {\n\t\treturn [singleWarning(\"scrollVariantEffect\", scrollVariantEffect, \"valid scroll variant effect attributes\")]\n\t}\n\n\tconst { trigger, threshold, replay, fromVariant, toVariant, direction, directionTarget, sections } = parsed.data\n\tconst warnings: TraitWarning[] = []\n\tconst update: Partial<WithVariantAppearEffect> = {}\n\tconst explicitClears: Partial<\n\t\tPick<\n\t\t\tWithVariantAppearEffect,\n\t\t\t\"appearEffectObscuredVariantId\" | \"appearEffectVisibleVariantId\" | \"appearEffectScrollDirectionTarget\"\n\t\t>\n\t> = {}\n\n\tif (isObject(scrollVariantEffect) && isString(scrollVariantEffect.trigger) && isUndefined(trigger)) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\n\t\t\t\t\"scrollVariantEffect.trigger\",\n\t\t\t\tscrollVariantEffect.trigger,\n\t\t\t\t`one of: ${supportedTriggers.join(\", \")}`,\n\t\t\t),\n\t\t)\n\t}\n\n\tif (isObject(scrollVariantEffect) && isString(scrollVariantEffect.direction) && isUndefined(direction)) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\n\t\t\t\t\"scrollVariantEffect.direction\",\n\t\t\t\tscrollVariantEffect.direction,\n\t\t\t\t`one of: ${supportedDirections.join(\", \")}`,\n\t\t\t),\n\t\t)\n\t}\n\n\tif (isString(trigger)) {\n\t\tupdate.appearEffectTrigger = trigger\n\t}\n\n\tif (isNumber(threshold)) {\n\t\tupdate.appearEffectThreshold = threshold\n\t}\n\n\tif (isBoolean(replay)) {\n\t\tupdate.appearEffectAnimateOnce = !replay\n\t}\n\n\tif (isString(fromVariant)) {\n\t\tconst resolvedFromVariant = resolveId(fromVariant, \"scrollVariantEffect.fromVariant\", ctx)\n\t\tif (isUndefined(resolvedFromVariant)) {\n\t\t\texplicitClears.appearEffectObscuredVariantId = undefined\n\t\t} else {\n\t\t\tupdate.appearEffectObscuredVariantId = resolvedFromVariant\n\t\t}\n\t}\n\n\tif (isString(toVariant)) {\n\t\tconst resolvedToVariant = resolveId(toVariant, \"scrollVariantEffect.toVariant\", ctx)\n\t\tif (isUndefined(resolvedToVariant)) {\n\t\t\texplicitClears.appearEffectVisibleVariantId = undefined\n\t\t} else {\n\t\t\tupdate.appearEffectVisibleVariantId = resolvedToVariant\n\t\t}\n\t}\n\n\tif (isString(direction)) {\n\t\tupdate.appearEffectScrollDirection = direction\n\t}\n\n\tif (isString(directionTarget)) {\n\t\tconst resolvedDirectionTarget = resolveId(directionTarget, \"scrollVariantEffect.directionTarget\", ctx)\n\t\tif (isUndefined(resolvedDirectionTarget)) {\n\t\t\texplicitClears.appearEffectScrollDirectionTarget = undefined\n\t\t} else {\n\t\t\tupdate.appearEffectScrollDirectionTarget = resolvedDirectionTarget\n\t\t}\n\t}\n\n\tif (isArray(sections)) {\n\t\tconst nextSections = applyArrayAttributePatch({\n\t\t\tcurrentItems: node.appearEffectScrollTargets,\n\t\t\tpatch: sections,\n\t\t\tparsePatchItem: (item, index) => {\n\t\t\t\tif (!isObject(item)) return\n\n\t\t\t\tconst currentItem = node.appearEffectScrollTargets?.[index]\n\t\t\t\tconst hasTarget = isString(item.target)\n\t\t\t\tconst hasVariant = isString(item.variant)\n\t\t\t\tif (!hasTarget && !hasVariant) {\n\t\t\t\t\treturn currentItem ? [currentItem] : undefined\n\t\t\t\t}\n\n\t\t\t\tconst nextItem: EffectVariantScrollTarget = {\n\t\t\t\t\tid: currentItem?.id ?? randomID(),\n\t\t\t\t\ttarget: currentItem?.target,\n\t\t\t\t\tcollectionItem: currentItem?.collectionItem,\n\t\t\t\t\tvariant: currentItem?.variant,\n\t\t\t\t}\n\n\t\t\t\tif (isString(item.target)) {\n\t\t\t\t\tnextItem.target = resolveId(item.target, `scrollVariantEffect.sections.${index}.target`, ctx)\n\t\t\t\t}\n\n\t\t\t\tif (isString(item.variant)) {\n\t\t\t\t\tnextItem.variant = resolveId(item.variant, `scrollVariantEffect.sections.${index}.variant`, ctx)\n\t\t\t\t}\n\n\t\t\t\treturn [nextItem]\n\t\t\t},\n\t\t})\n\n\t\tif (nextSections) {\n\t\t\tupdate.appearEffectScrollTargets = nextSections\n\t\t}\n\t}\n\n\tif (isEmptyObject(update) && isEmptyObject(explicitClears)) return warnings.length > 0 ? warnings : undefined\n\n\tif (!isEmptyObject(update)) {\n\t\tupdateWithFallback(update, node, appearEffectEnabledDefaults)\n\t}\n\tif (!isEmptyObject(explicitClears)) {\n\t\tnode.set(explicitClears)\n\t}\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(\n\tnode: CanvasNode,\n\t_parent: CanvasNode | null | undefined,\n\tctx: AgentContext,\n): DSLAttributes | undefined {\n\tif (!supportsScrollVariantEffect(node, ctx) || !hasVariantAppearEffect(node)) return undefined\n\n\tconst trigger = node.appearEffectTrigger ?? EffectTrigger.OnInView\n\tconst scrollVariantEffect: DSLAttributes = {\n\t\ttrigger,\n\t\treplay: isBoolean(node.appearEffectAnimateOnce) ? !node.appearEffectAnimateOnce : undefined,\n\t}\n\n\tif (trigger !== EffectTrigger.OnScrollDirection && isNumber(node.appearEffectThreshold)) {\n\t\tscrollVariantEffect.threshold = toRoundedNumber(node.appearEffectThreshold)\n\t}\n\n\tswitch (trigger) {\n\t\tcase EffectTrigger.OnInView:\n\t\t\tscrollVariantEffect.fromVariant = serializeId(node.appearEffectObscuredVariantId, ctx)\n\t\t\tscrollVariantEffect.toVariant = serializeId(node.appearEffectVisibleVariantId, ctx)\n\t\t\tbreak\n\t\tcase EffectTrigger.OnScrollTarget:\n\t\t\tscrollVariantEffect.sections = node.appearEffectScrollTargets?.flatMap(target => {\n\t\t\t\tconst serializedTarget = serializeId(target.target, ctx)\n\t\t\t\tconst serializedVariant = serializeId(target.variant, ctx)\n\t\t\t\tif (!serializedTarget && !serializedVariant) return emptyArray()\n\t\t\t\treturn {\n\t\t\t\t\ttarget: serializedTarget,\n\t\t\t\t\tvariant: serializedVariant,\n\t\t\t\t}\n\t\t\t})\n\t\t\tbreak\n\t\tcase EffectTrigger.OnScrollDirection:\n\t\t\tscrollVariantEffect.direction = node.appearEffectScrollDirection ?? \"down\"\n\t\t\tscrollVariantEffect.directionTarget = serializeId(node.appearEffectScrollDirectionTarget, ctx)\n\t\t\tbreak\n\t\tdefault:\n\t\t\tbreak\n\t}\n\n\treturn { scrollVariantEffect }\n}\n\nexport const scrollVariantEffect = {\n\tfor: withVariantAppearPageEffect,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ scrollVariantEffect: DSLScrollVariantEffect }>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithSizeConstraints,\n\tisConstraintDimension,\n\tsupportsSizeConstraints,\n\twithSizeConstraints,\n} from \"document/models/CanvasTree/traits/WithSizeConstraints.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { keys } from \"utils/keys.ts\"\nimport { isNumber, isString } from \"utils/typeChecks.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport { breakpointSizeConstraintsUnsupportedMessage, expectedConstraintValue, singleWarning } from \"./invalidValues.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithSizeConstraints> = {\n\tminWidth: {\n\t\tdescription: `number | \\${number}px | \\${number}% | ${nullString}`,\n\t\toptional: true,\n\t},\n\tmaxWidth: {\n\t\tdescription: `number | \\${number}px | \\${number}% | ${nullString}`,\n\t\toptional: true,\n\t},\n\tminHeight: {\n\t\tdescription: `number | \\${number}px | \\${number}% | \\${number}vh | ${nullString}`,\n\t\toptional: true,\n\t},\n\tmaxHeight: {\n\t\tdescription: `number | \\${number}px | \\${number}% | \\${number}vh | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction parseAndSetConstraint(\n\tnode: CanvasNode & WithSizeConstraints,\n\tkey: keyof WithSizeConstraints,\n\tvalue: unknown,\n\twarnings: TraitWarning[],\n) {\n\tif (!isString(value)) return\n\tif (isNullString(value)) {\n\t\tnode.set({ [key]: undefined })\n\t\treturn\n\t}\n\n\tif (!isConstraintDimension(value)) {\n\t\twarnings.push(singleWarning(key, value, expectedConstraintValue))\n\t\treturn\n\t}\n\n\tnode.set({ [key]: value })\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes) {\n\tconst warnings: TraitWarning[] = []\n\n\tif (isBreakpointVariant(node)) {\n\t\tfor (const key of keys(definition)) {\n\t\t\tif (isString(attributes[key])) {\n\t\t\t\twarnings.push({\n\t\t\t\t\tapplied: false,\n\t\t\t\t\tkey: key,\n\t\t\t\t\tmessage: breakpointSizeConstraintsUnsupportedMessage(key),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!supportsSizeConstraints(node)) {\n\t\treturn warnings.length > 0 ? warnings : undefined\n\t}\n\n\tparseAndSetConstraint(node, \"minWidth\", attributes.minWidth, warnings)\n\tparseAndSetConstraint(node, \"maxWidth\", attributes.maxWidth, warnings)\n\tparseAndSetConstraint(node, \"minHeight\", attributes.minHeight, warnings)\n\tparseAndSetConstraint(node, \"maxHeight\", attributes.maxHeight, warnings)\n\n\treturn warnings\n}\n\nexport const sizeConstraints = {\n\tfor: withSizeConstraints,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes: node => {\n\t\tif (!supportsSizeConstraints(node)) return\n\n\t\treturn {\n\t\t\tminWidth: isNumber(node.minWidth) ? toRoundedNumber(node.minWidth) : node.minWidth,\n\t\t\tmaxWidth: isNumber(node.maxWidth) ? toRoundedNumber(node.maxWidth) : node.maxWidth,\n\t\t\tminHeight: isNumber(node.minHeight) ? toRoundedNumber(node.minHeight) : node.minHeight,\n\t\t\tmaxHeight: isNumber(node.maxHeight) ? toRoundedNumber(node.maxHeight) : node.maxHeight,\n\t\t}\n\t},\n} satisfies TraitDefinition<WithSizeConstraints>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tcornerShapeToPercentage,\n\tpercentageToCornerShape,\n\twithCornerShape,\n} from \"document/models/CanvasTree/traits/WithCornerShape.ts\"\nimport { parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { expectedPercentageValue, warning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\ninterface SquircleAttributes {\n\tsquircle: number | undefined\n}\n\nconst definition: TraitAttributeDefinition<SquircleAttributes> = {\n\tsquircle: {\n\t\tdescription: \"${number}%\",\n\t\texamples: [\"0% for regular rounded corners\", \"50% for half-squircle\", \"100% for full squircle\"],\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withCornerShape(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tif (!isString(attributes.squircle)) return\n\n\tconst [percentage, unit] = parseCSSDimension(attributes.squircle, \"%\")\n\tif (isUndefined(percentage) || unit !== \"%\") {\n\t\treturn warning(\"squircle\", attributes.squircle, expectedPercentageValue)\n\t}\n\n\tnode.set({ cornerShape: percentageToCornerShape(percentage) })\n}\n\nexport const squircle = {\n\tfor: withCornerShape,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes: node => {\n\t\tif (!withCornerShape(node)) return\n\n\t\tconst value = node.resolveValue(\"cornerShape\")\n\t\tif (!isNumber(value)) return\n\n\t\treturn { squircle: `${cornerShapeToPercentage(value)}%` }\n\t},\n} satisfies TraitDefinition<SquircleAttributes>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { getUpdateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type {\n\tEffectStyleScrollTarget,\n\tScrollStyle,\n\tStyleTransformEffectTrigger,\n\tWithStyleTransformEffect,\n} from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport {\n\tdefaultEffect,\n\tdefaultStyle,\n\thasStyleTransformEffect,\n\tstyleTransformEffectEnabledDefaults,\n\twithStyleTransformEffect,\n} from \"document/models/CanvasTree/traits/WithStyleTransformEffect.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { EffectTrigger } from \"document/models/CanvasTree/traits/utils/EffectTrigger.ts\"\nimport { fallbackPhysicsBasedSpringTransition } from \"document/models/Transition.ts\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport { hasOwn } from \"utils/objectHasOwn.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isArray, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport {\n\tapplyArrayAttributePatch,\n\tgetExpectedObjectValue,\n\tisNullString,\n\tnullString,\n\tparseRotateShorthand,\n\tunsupportedAttributesWarnings,\n} from \"./helpers.ts\"\nimport { breakpointUnsupportedMessage, singleWarning } from \"./invalidValues.ts\"\nimport {\n\teffectTransitionDefinition,\n\teffectTransitionSupportedTypes,\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport {\n\tisAttributeDefinition,\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitToAttributesOutput,\n\ttype TraitWarning,\n} from \"./types.ts\"\nimport { zodErrorToWarnings } from \"./zodErrorToWarnings.ts\"\n\nconst styleTransformEffectTriggers = [\n\tEffectTrigger.OnInView,\n\tEffectTrigger.OnScroll,\n\tEffectTrigger.OnScrollTarget,\n] as const satisfies readonly StyleTransformEffectTrigger[]\n\nconst styleTransformViewportPositions = [\"start\", \"middle\", \"end\"] as const\nconst styleTransformViewportThresholds = [0, 0.5, 1] as const\nconst expectedStyleTransformViewportPosition = `one of: ${styleTransformViewportPositions.join(\", \")}`\n\ntype StyleTransformViewportPosition = (typeof styleTransformViewportPositions)[number]\n\nconst styleTransformViewportThresholdByPosition: Record<\n\tStyleTransformViewportPosition,\n\t(typeof styleTransformViewportThresholds)[number]\n> = {\n\tstart: 0,\n\tmiddle: 0.5,\n\tend: 1,\n}\n\nfunction viewportPositionToThreshold(\n\tviewport: StyleTransformViewportPosition,\n): (typeof styleTransformViewportThresholds)[number] {\n\treturn styleTransformViewportThresholdByPosition[viewport]\n}\n\nfunction thresholdToViewportPosition(threshold: number | undefined): StyleTransformViewportPosition | undefined {\n\tswitch (threshold) {\n\t\tcase 0:\n\t\t\treturn \"start\"\n\t\tcase 0.5:\n\t\t\treturn \"middle\"\n\t\tcase 1:\n\t\t\treturn \"end\"\n\t\tdefault:\n\t\t\treturn undefined\n\t}\n}\n\nfunction parseOptionalDimension(value: string, unit: \"px\" | \"deg\"): number | undefined {\n\tconst [parsedValue, parsedUnit] = parseCSSDimension(value, unit)\n\tif (!Number.isFinite(parsedValue)) return undefined\n\treturn parsedUnit === unit ? parsedValue : undefined\n}\n\nconst dslStyleTransformStyleSchema = z.object({\n\topacity: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tx: z\n\t\t.string()\n\t\t.transform(value => parseOptionalDimension(value, \"px\"))\n\t\t.optional()\n\t\t.catch(undefined),\n\ty: z\n\t\t.string()\n\t\t.transform(value => parseOptionalDimension(value, \"px\"))\n\t\t.optional()\n\t\t.catch(undefined),\n\tscale: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\trotate: z\n\t\t.string()\n\t\t.transform(value => parseRotateShorthand(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tskewX: z\n\t\t.string()\n\t\t.transform(value => parseOptionalDimension(value, \"deg\"))\n\t\t.optional()\n\t\t.catch(undefined),\n\tskewY: z\n\t\t.string()\n\t\t.transform(value => parseOptionalDimension(value, \"deg\"))\n\t\t.optional()\n\t\t.catch(undefined),\n})\n\nconst dslStyleTransformTargetSchema = dslStyleTransformStyleSchema.extend({\n\ttarget: z.string().optional().catch(undefined),\n})\n\nconst dslStyleTransformEffectSchema = z.object({\n\ttrigger: z.enum(styleTransformEffectTriggers).optional().catch(undefined),\n\tviewport: z.enum(styleTransformViewportPositions).optional().catch(undefined),\n\ttransition: z.string().optional().catch(undefined),\n\tsections: z.array(dslStyleTransformTargetSchema.optional().catch(undefined)).optional().catch(undefined),\n})\n\ntype ParsedDSLStyleTransformStyle = z.output<typeof dslStyleTransformStyleSchema>\ntype RoundedParsedDSLStyleTransformStyle = TraitToAttributesOutput<ParsedDSLStyleTransformStyle>\ntype DSLStyleTransformStyle = Omit<\n\tRoundedParsedDSLStyleTransformStyle,\n\t\"opacity\" | \"scale\" | \"rotate\" | \"x\" | \"y\" | \"skewX\" | \"skewY\"\n> & {\n\topacity?: RoundedParsedDSLStyleTransformStyle[\"opacity\"]\n\tscale?: RoundedParsedDSLStyleTransformStyle[\"scale\"]\n\tx?: `${number}px`\n\ty?: `${number}px`\n\tskewX?: `${number}deg`\n\tskewY?: `${number}deg`\n\trotate?: `${number}deg` | `${number}deg ${number}deg ${number}deg`\n}\n\ntype ParsedDSLStyleTransformTarget = z.output<typeof dslStyleTransformTargetSchema>\ntype DSLStyleTransformTarget = DSLStyleTransformStyle & {\n\ttarget?: ParsedDSLStyleTransformTarget[\"target\"]\n}\n\ntype ParsedDSLStyleTransformEffect = z.output<typeof dslStyleTransformEffectSchema>\ntype RoundedParsedDSLStyleTransformEffect = TraitToAttributesOutput<ParsedDSLStyleTransformEffect>\ntype DSLStyleTransformEffect = Omit<RoundedParsedDSLStyleTransformEffect, \"sections\"> & {\n\tviewport?: StyleTransformViewportPosition\n\tsections?: DSLStyleTransformTarget[]\n}\n\nconst styleTransformStyleDefinition: TraitAttributeDefinition<DSLStyleTransformStyle> = {\n\topacity: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n\tx: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\ty: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tscale: {\n\t\tdescription: \"number\",\n\t\texamples: [\"0.5\", \"1.0\", \"1.5\"],\n\t\toptional: true,\n\t},\n\trotate: {\n\t\tdescription: \"${z}deg | ${x}deg ${y}deg ${z}deg\",\n\t\texamples: [\"-15deg\", \"15deg 45deg 90deg\"],\n\t\toptional: true,\n\t},\n\tskewX: {\n\t\tdescription: \"${number}deg\",\n\t\toptional: true,\n\t},\n\tskewY: {\n\t\tdescription: \"${number}deg\",\n\t\toptional: true,\n\t},\n}\n\nconst styleTransformTargetDefinition: TraitAttributeDefinition<DSLStyleTransformTarget> = {\n\ttarget: {\n\t\tdescription: \"node id | null\",\n\t\toptional: true,\n\t},\n\t...styleTransformStyleDefinition,\n}\nconst styleTransformTargetKeys = objectKeys(styleTransformTargetDefinition)\n\nconst definition: TraitAttributeDefinition<{ styleTransformEffect: DSLStyleTransformEffect }> = {\n\tstyleTransformEffect: {\n\t\ttrigger: {\n\t\t\tdescription: styleTransformEffectTriggers.join(\" | \"),\n\t\t\toptional: true,\n\t\t},\n\t\tviewport: {\n\t\t\tdescription: styleTransformViewportPositions.join(\" | \"),\n\t\t\toptional: true,\n\t\t},\n\t\ttransition: {\n\t\t\t...effectTransitionDefinition,\n\t\t\tdescription: `${effectTransitionDefinition.description} | ${nullString}`,\n\t\t},\n\t\tsections: [styleTransformTargetDefinition],\n\t},\n}\n\nfunction createDefaultScrollTargets(): [EffectStyleScrollTarget, EffectStyleScrollTarget] {\n\treturn [defaultEffect({ opacity: 0.5, scale: 0.5 }), defaultEffect()]\n}\n\nfunction serializeDimension(value: number, unit: \"px\"): `${number}px`\nfunction serializeDimension(value: number, unit: \"deg\"): `${number}deg`\nfunction serializeDimension(value: number, unit: \"px\" | \"deg\") {\n\treturn createCSSDimension(toRoundedNumber(value), unit)\n}\n\nfunction serializeRotate(style: ScrollStyle, neutral: ScrollStyle): DSLStyleTransformStyle[\"rotate\"] | undefined {\n\tif (style.rotate3d) {\n\t\tconst rotateX = style.rotateX ?? 0\n\t\tconst rotateY = style.rotateY ?? 0\n\t\tconst rotate = style.rotate ?? 0\n\t\tif (rotateX === 0 && rotateY === 0 && rotate === 0) return undefined\n\n\t\treturn `${serializeDimension(rotateX, \"deg\")} ${serializeDimension(rotateY, \"deg\")} ${serializeDimension(rotate, \"deg\")}`\n\t}\n\n\tif (!isNumber(style.rotate) || style.rotate === neutral.rotate) return undefined\n\treturn serializeDimension(style.rotate, \"deg\")\n}\n\nfunction ensureScrollTargets(\n\tscrollTargets: readonly EffectStyleScrollTarget[] | undefined,\n): [EffectStyleScrollTarget, EffectStyleScrollTarget, ...EffectStyleScrollTarget[]] {\n\tconst [defaultFrom, defaultTo] = createDefaultScrollTargets()\n\tif (!isArray(scrollTargets) || scrollTargets.length === 0) return [defaultFrom, defaultTo]\n\n\tconst [from, to, ...sections] = scrollTargets\n\treturn [from ?? defaultFrom, to ?? defaultTo, ...sections]\n}\n\nfunction applyStyleUpdate(baseStyle: ScrollStyle, style: ParsedDSLStyleTransformStyle | undefined): ScrollStyle {\n\tif (!style) return baseStyle\n\n\tconst nextStyle: ScrollStyle = { ...baseStyle }\n\n\tif (isNumber(style.opacity)) nextStyle.opacity = style.opacity\n\tif (isNumber(style.x)) nextStyle.x = style.x\n\tif (isNumber(style.y)) nextStyle.y = style.y\n\tif (isNumber(style.scale)) nextStyle.scale = style.scale\n\n\tif (!isUndefined(style.rotate)) {\n\t\tif (isNumber(style.rotate)) {\n\t\t\tnextStyle.rotate3d = false\n\t\t\tnextStyle.rotate = style.rotate\n\t\t} else if (style.rotate) {\n\t\t\tnextStyle.rotate3d = true\n\t\t\tnextStyle.rotate = style.rotate.rotateZ\n\t\t\tnextStyle.rotateX = style.rotate.rotateX\n\t\t\tnextStyle.rotateY = style.rotate.rotateY\n\t\t}\n\t}\n\n\tif (isNumber(style.skewX)) nextStyle.skewX = style.skewX\n\tif (isNumber(style.skewY)) nextStyle.skewY = style.skewY\n\n\treturn nextStyle\n}\n\nfunction resolveId(value: unknown, ctx: AgentContext, key: string): EffectStyleScrollTarget[\"target\"] {\n\tif (isUndefined(value) || isNullString(value)) return undefined\n\tif (!isString(value)) return undefined\n\n\tconst id = ctx.treeResolver.get(value)?.id\n\tif (!id) {\n\t\tthrow new DeferTraitError(`Cannot set ${key}: ${value} is not a valid id.`)\n\t}\n\n\treturn id\n}\n\nfunction updateScrollTarget(\n\tcurrentTarget: EffectStyleScrollTarget,\n\trawTarget: unknown,\n\tparsedTarget: ParsedDSLStyleTransformTarget | ParsedDSLStyleTransformStyle | undefined,\n\tctx: AgentContext,\n\tkeyPrefix: string,\n): EffectStyleScrollTarget {\n\tif (!isObject(rawTarget)) return currentTarget\n\n\tconst nextTarget: EffectStyleScrollTarget = {\n\t\t...currentTarget,\n\t\tstyle: applyStyleUpdate(currentTarget.style, parsedTarget),\n\t}\n\n\tif (hasOwn(rawTarget, \"target\")) {\n\t\tconst rawTargetValue = rawTarget.target\n\t\tif (isUndefined(rawTargetValue) || isString(rawTargetValue) || isNullString(rawTargetValue)) {\n\t\t\tnextTarget.target = resolveId(rawTargetValue, ctx, `${keyPrefix}.target`)\n\t\t}\n\t}\n\n\treturn nextTarget\n}\n\nfunction getExpectedStyleTransformTargetValue(key: keyof DSLStyleTransformTarget): string {\n\tconst attribute = styleTransformTargetDefinition[key]\n\treturn isAttributeDefinition(attribute) ? attribute.description : \"a valid value\"\n}\n\nfunction hasAnyParsedStyleTransformTargetValue(value: ParsedDSLStyleTransformTarget | undefined): boolean {\n\tif (!value) return false\n\n\tfor (const key of styleTransformTargetKeys) {\n\t\tif (!isUndefined(value[key])) return true\n\t}\n\n\treturn false\n}\n\nfunction collectStyleTransformTargetWarnings(\n\tvalue: Record<string, unknown>,\n\tparsedValue: ParsedDSLStyleTransformTarget | undefined,\n\tkeyPrefix: string,\n\twarnings: TraitWarning[],\n) {\n\tif (isEmptyObject(value)) return\n\n\tlet hasSupportedKey = false\n\tfor (const key of styleTransformTargetKeys) {\n\t\tif (hasOwn(value, key)) {\n\t\t\thasSupportedKey = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif (!hasSupportedKey) {\n\t\twarnings.push(singleWarning(keyPrefix, value, getExpectedObjectValue(styleTransformTargetDefinition)))\n\t\treturn\n\t}\n\n\tfor (const key of styleTransformTargetKeys) {\n\t\tif (!hasOwn(value, key)) continue\n\n\t\tconst rawValue = value[key]\n\t\tconst expectedValue = getExpectedStyleTransformTargetValue(key)\n\n\t\tif (isNullString(rawValue)) {\n\t\t\tconst attribute = styleTransformTargetDefinition[key]\n\t\t\tif (!isAttributeDefinition(attribute) || !attribute.description.includes(\"null\")) {\n\t\t\t\twarnings.push(singleWarning(`${keyPrefix}.${key}`, rawValue, expectedValue))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isUndefined(parsedValue?.[key])) {\n\t\t\twarnings.push(singleWarning(`${keyPrefix}.${key}`, rawValue, expectedValue))\n\t\t}\n\t}\n}\n\nfunction serializeStyle(style: ScrollStyle): DSLStyleTransformStyle {\n\tconst neutral = defaultStyle()\n\tconst result: DSLStyleTransformStyle = {}\n\n\tif (style.opacity !== neutral.opacity && isNumber(style.opacity)) {\n\t\tresult.opacity = toRoundedNumber(style.opacity)\n\t}\n\tif (style.x !== neutral.x && isNumber(style.x)) {\n\t\tresult.x = serializeDimension(style.x, \"px\")\n\t}\n\tif (style.y !== neutral.y && isNumber(style.y)) {\n\t\tresult.y = serializeDimension(style.y, \"px\")\n\t}\n\tif (style.scale !== neutral.scale && isNumber(style.scale)) {\n\t\tresult.scale = toRoundedNumber(style.scale)\n\t}\n\tif (style.skewX !== neutral.skewX && isNumber(style.skewX)) {\n\t\tresult.skewX = serializeDimension(style.skewX, \"deg\")\n\t}\n\tif (style.skewY !== neutral.skewY && isNumber(style.skewY)) {\n\t\tresult.skewY = serializeDimension(style.skewY, \"deg\")\n\t}\n\n\tconst rotate = serializeRotate(style, neutral)\n\tif (!isUndefined(rotate)) {\n\t\tresult.rotate = rotate\n\t}\n\n\treturn result\n}\n\nfunction serializeTarget(target: EffectStyleScrollTarget): DSLStyleTransformTarget {\n\tconst result: DSLStyleTransformTarget = {\n\t\t...serializeStyle(target.style),\n\t}\n\n\tif (isString(target.target)) {\n\t\tresult.target = target.target\n\t}\n\n\treturn result\n}\n\nfunction parseStyleTransformSections(\n\tcurrentTargets: readonly EffectStyleScrollTarget[] | undefined,\n\trawSections: unknown,\n\tparsedSections: readonly (ParsedDSLStyleTransformTarget | undefined)[] | undefined,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n\teffectiveTrigger: StyleTransformEffectTrigger,\n): [EffectStyleScrollTarget, EffectStyleScrollTarget, ...EffectStyleScrollTarget[]] {\n\tconst defaultTargets = ensureScrollTargets(currentTargets)\n\n\tif (isNullString(rawSections) || parsedSections?.length === 0) {\n\t\treturn [defaultTargets[0], defaultTargets[1]]\n\t}\n\n\tif (!isArray(rawSections) || !parsedSections) return defaultTargets\n\n\tconst nextTargets =\n\t\tapplyArrayAttributePatch({\n\t\t\tcurrentItems: defaultTargets,\n\t\t\tpatch: rawSections,\n\t\t\tparsePatchItem: (value, index) => {\n\t\t\t\tif (!isObject(value)) {\n\t\t\t\t\twarnings.push(\n\t\t\t\t\t\tsingleWarning(\n\t\t\t\t\t\t\t`styleTransformEffect.sections.${index}`,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\tgetExpectedObjectValue(styleTransformTargetDefinition),\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tconst parsedSection = parsedSections[index]\n\t\t\t\tcollectStyleTransformTargetWarnings(value, parsedSection, `styleTransformEffect.sections.${index}`, warnings)\n\n\t\t\t\tconst currentTarget = defaultTargets[index]\n\t\t\t\tif (!currentTarget && !hasAnyParsedStyleTransformTargetValue(parsedSection)) return\n\n\t\t\t\tconst nextTarget = updateScrollTarget(\n\t\t\t\t\tcurrentTarget ?? defaultEffect(),\n\t\t\t\t\tvalue,\n\t\t\t\t\tparsedSection,\n\t\t\t\t\tctx,\n\t\t\t\t\t`styleTransformEffect.sections.${index}`,\n\t\t\t\t)\n\t\t\t\treturn [nextTarget]\n\t\t\t},\n\t\t}) ?? defaultTargets\n\n\tconst [fromTarget = defaultTargets[0], toTarget = defaultTargets[1], ...sectionTargets] = nextTargets\n\n\tif (effectiveTrigger !== EffectTrigger.OnScrollTarget) {\n\t\tif (sectionTargets.length > 0) {\n\t\t\twarnings.push(\n\t\t\t\tsingleWarning(\n\t\t\t\t\t\"styleTransformEffect.sections\",\n\t\t\t\t\trawSections,\n\t\t\t\t\t\"at most two sections unless styleTransformEffect.trigger is onScrollTarget\",\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\t\treturn [fromTarget, toTarget]\n\t}\n\n\treturn [fromTarget, toTarget, ...sectionTargets]\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withStyleTransformEffect(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst { styleTransformEffect } = attributes\n\tif (isUndefined(styleTransformEffect)) return\n\n\tif (isBreakpointVariant(node) && !isUndefined(styleTransformEffect)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"styleTransformEffect\",\n\t\t\t\tmessage: breakpointUnsupportedMessage(\"style transform effects\"),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (isNullString(styleTransformEffect)) {\n\t\tnode.set({ styleTransformEffectEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslStyleTransformEffectSchema.safeParse(styleTransformEffect)\n\tif (!parsed.success) {\n\t\treturn zodErrorToWarnings({\n\t\t\terror: parsed.error,\n\t\t\tschema: dslStyleTransformEffectSchema,\n\t\t\tkeyPrefix: \"styleTransformEffect\",\n\t\t\tinput: styleTransformEffect,\n\t\t})\n\t}\n\n\tconst { trigger, viewport, transition, sections } = parsed.data\n\tconst rawStyleTransformEffect = isObject(styleTransformEffect) ? styleTransformEffect : undefined\n\tconst shouldUpdateSections = isNullString(rawStyleTransformEffect?.sections) || !isUndefined(sections)\n\tconst update: Partial<WithStyleTransformEffect> = {}\n\tconst warnings: TraitWarning[] = []\n\tconst effectiveTrigger: StyleTransformEffectTrigger =\n\t\ttrigger ?? node.styleTransformEffectTrigger ?? EffectTrigger.OnScroll\n\n\tif (isString(rawStyleTransformEffect?.trigger) && isUndefined(trigger)) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\n\t\t\t\t\"styleTransformEffect.trigger\",\n\t\t\t\trawStyleTransformEffect.trigger,\n\t\t\t\t`one of: ${styleTransformEffectTriggers.join(\", \")}`,\n\t\t\t),\n\t\t)\n\t}\n\tif (isString(rawStyleTransformEffect?.viewport) && isUndefined(viewport)) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\n\t\t\t\t\"styleTransformEffect.viewport\",\n\t\t\t\trawStyleTransformEffect.viewport,\n\t\t\t\texpectedStyleTransformViewportPosition,\n\t\t\t),\n\t\t)\n\t}\n\n\tif (trigger) update.styleTransformEffectTrigger = trigger\n\tif (viewport) update.styleTransformEffectViewportThreshold = viewportPositionToThreshold(viewport)\n\n\tif (isNullString(transition)) {\n\t\tupdate.styleTransformEffectTransitionEnabled = false\n\t} else if (!isUndefined(transition)) {\n\t\tconst parsedTransition = parseDSLTransitionString(transition, effectTransitionSupportedTypes, error => {\n\t\t\twarnings.push(singleWarning(\"styleTransformEffect.transition\", transition, error.message))\n\t\t})\n\n\t\tif (parsedTransition) {\n\t\t\tupdate.styleTransformEffectTransitionEnabled = true\n\t\t\tupdate.styleTransformEffectTransition = transitionWithDefault(\n\t\t\t\tparsedTransition,\n\t\t\t\tnode.styleTransformEffectTransition,\n\t\t\t\tfallbackPhysicsBasedSpringTransition,\n\t\t\t)\n\t\t}\n\t}\n\n\tif (shouldUpdateSections) {\n\t\t// Raw sections are needed because .catch(undefined) in the Zod schema erases\n\t\t// invalid values, losing the distinction between \"not specified\" and \"explicitly\n\t\t// cleared\", and the original values needed for per-field warnings.\n\t\tupdate.styleTransformEffectScrollTargets = parseStyleTransformSections(\n\t\t\tnode.styleTransformEffectScrollTargets,\n\t\t\trawStyleTransformEffect?.sections,\n\t\t\tsections,\n\t\t\tctx,\n\t\t\twarnings,\n\t\t\teffectiveTrigger,\n\t\t)\n\t} else if (!isEmptyObject(update) && !node.styleTransformEffectScrollTargets?.length) {\n\t\tupdate.styleTransformEffectScrollTargets = createDefaultScrollTargets()\n\t}\n\n\tif (isEmptyObject(update)) return warnings.length > 0 ? warnings : undefined\n\n\tnode.set(getUpdateWithFallback(update, node, styleTransformEffectEnabledDefaults))\n\tif (isNullString(transition)) {\n\t\tnode.set({ styleTransformEffectTransition: undefined })\n\t}\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!hasStyleTransformEffect(node)) return undefined\n\n\tconst result: Partial<DSLStyleTransformEffect> = {\n\t\ttrigger: node.styleTransformEffectTrigger,\n\t}\n\n\tconst viewport = thresholdToViewportPosition(\n\t\tisNumber(node.styleTransformEffectViewportThreshold)\n\t\t\t? toRoundedNumber(node.styleTransformEffectViewportThreshold)\n\t\t\t: undefined,\n\t)\n\tif (!isUndefined(viewport)) {\n\t\tresult.viewport = viewport\n\t}\n\n\tif (node.styleTransformEffectTransitionEnabled) {\n\t\tresult.transition = vekterTransitionToDslTransitionString(\n\t\t\tnode.styleTransformEffectTransition ?? fallbackPhysicsBasedSpringTransition,\n\t\t)\n\t}\n\n\tconst scrollTargets = node.styleTransformEffectScrollTargets\n\tif (scrollTargets?.length) {\n\t\tconst serializedSections = (\n\t\t\tnode.styleTransformEffectTrigger === EffectTrigger.OnScrollTarget ? scrollTargets : scrollTargets.slice(0, 2)\n\t\t).map(serializeTarget)\n\t\tif (serializedSections.length > 0) {\n\t\t\tresult.sections = serializedSections\n\t\t}\n\t}\n\n\treturn { styleTransformEffect: result }\n}\n\nexport const styleTransformEffect = {\n\tfor: withStyleTransformEffect,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ styleTransformEffect: DSLStyleTransformEffect }>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isTableStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type {\n\tTableBorderInner,\n\tTableBorderOuter,\n\tTableBorderStyle,\n\tWithTableBorder,\n} from \"document/models/CanvasTree/traits/WithTableBorder.ts\"\nimport type { WithTableStyle } from \"document/models/CanvasTree/traits/WithTableStyle.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { objectKeys } from \"library/utils/objectKeys.ts\"\nimport { isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, parseBorderShorthand } from \"./helpers.ts\"\nimport { expectedAttributeMessage, unsupportedAttributeMessage, warning } from \"./invalidValues.ts\"\nimport { colorDescription } from \"./traitDescriptions.ts\"\nimport {\n\tnodeToDSLType,\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\ninterface TableAttributes {\n\tfillColor?: string\n\theaderFillColor?: string\n\tborder?: string\n\tborderColor?: string\n\tborderWidth?: number | string\n\tborderStyle?: TableBorderStyle\n\tborderInner?: TableBorderInner\n\tborderOuter?: TableBorderOuter\n}\n\ninterface TableStyleAttributes {\n\ttable: TableAttributes\n}\n\nconst tableBorderInnerValues: readonly TableBorderInner[] = [\"all\", \"horizontal\", \"vertical\"]\nconst tableBorderOuterValues: readonly TableBorderOuter[] = [\"all\"]\nconst tableBorderStyleValues: readonly TableBorderStyle[] = [\"solid\", \"dashed\", \"dotted\"]\n\nconst tableBorderInnerDescription = tableBorderInnerValues.join(\" | \")\nconst tableBorderOuterDescription = tableBorderOuterValues.join(\" | \")\nconst tableBorderStyleDescription = tableBorderStyleValues.join(\" | \")\nconst borderWidthDescription = `number | \\${number}px`\nconst borderShorthandDescription = `\\${number} \\${${tableBorderStyleDescription}} \\${${colorDescription}}`\n\nconst definition = {\n\ttable: {\n\t\tfillColor: {\n\t\t\tdescription: `${colorDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t\theaderFillColor: {\n\t\t\tdescription: `${colorDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t\tborder: {\n\t\t\tdescription: `${borderShorthandDescription} | ${nullString}`,\n\t\t\texamples: [\"1px solid red\", \"2px dashed #cccccc\"],\n\t\t\toptional: true,\n\t\t},\n\t\tborderColor: {\n\t\t\tdescription: `${colorDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t\tborderWidth: {\n\t\t\tdescription: `${borderWidthDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t\tborderStyle: {\n\t\t\tdescription: `${tableBorderStyleDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t\tborderInner: {\n\t\t\tdescription: `${tableBorderInnerDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t\tborderOuter: {\n\t\t\tdescription: `${tableBorderOuterDescription} | ${nullString}`,\n\t\t\toptional: true,\n\t\t},\n\t},\n} satisfies TraitAttributeDefinition<TableStyleAttributes>\n\nconst tableAttributeKeys = objectKeys(definition.table)\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tconst { table } = attributes\n\n\tif (isUndefined(table)) return\n\tif (!isObject(table)) return warning(\"table\", table, \"valid table attributes\")\n\n\tif (!isTableStylePresetNode(node)) {\n\t\tconst warnings: TraitWarning[] = []\n\t\tfor (const key of tableAttributeKeys) {\n\t\t\tif (isUndefined(table[key])) continue\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: `table.${key}`,\n\t\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t\t})\n\t\t}\n\t\treturn warnings\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\tconst updates: Partial<WithTableStyle & WithTableBorder> = {}\n\n\tapplyColorAttribute(table, \"fillColor\", \"tableFillColor\", updates, warnings)\n\tapplyColorAttribute(table, \"headerFillColor\", \"tableHeaderFillColor\", updates, warnings)\n\tapplyEnumAttribute(\n\t\ttable,\n\t\t\"borderInner\",\n\t\t\"tableBorderInner\",\n\t\ttableBorderInnerValues,\n\t\ttableBorderInnerDescription,\n\t\tupdates,\n\t\twarnings,\n\t)\n\tapplyEnumAttribute(\n\t\ttable,\n\t\t\"borderOuter\",\n\t\t\"tableBorderOuter\",\n\t\ttableBorderOuterValues,\n\t\ttableBorderOuterDescription,\n\t\tupdates,\n\t\twarnings,\n\t)\n\n\tapplyTableBorderAttributes(table, ctx, updates, warnings)\n\n\tif (Object.keys(updates).length > 0) {\n\t\tnode.set(updates)\n\t}\n\n\treturn warnings\n}\n\ntype KeysOf<T, K extends keyof T> = K\n\ntype ColorKey = KeysOf<TableAttributes, \"fillColor\" | \"headerFillColor\">\ntype ColorNodeKey = KeysOf<WithTableStyle, \"tableFillColor\" | \"tableHeaderFillColor\">\n\nfunction applyColorAttribute(\n\ttable: DSLAttributes,\n\tkey: ColorKey,\n\tnodeKey: ColorNodeKey,\n\tupdates: Partial<WithTableStyle & WithTableBorder>,\n\twarnings: TraitWarning[],\n) {\n\tconst value = table[key]\n\tif (isUndefined(value)) return\n\tif (isNullString(value)) {\n\t\tupdates[nodeKey] = undefined\n\t\treturn\n\t}\n\tif (!isString(value)) {\n\t\twarnings.push({ applied: false, key: `table.${key}`, message: expectedAttributeMessage(value, colorDescription) })\n\t\treturn\n\t}\n\tupdates[nodeKey] = value\n}\n\ntype EnumKey = KeysOf<TableAttributes, \"borderInner\" | \"borderOuter\">\ntype EnumNodeKey = KeysOf<WithTableBorder, \"tableBorderInner\" | \"tableBorderOuter\">\n\nfunction applyEnumAttribute<K extends EnumNodeKey>(\n\ttable: DSLAttributes,\n\tkey: EnumKey,\n\tnodeKey: K,\n\tallowed: readonly NonNullable<WithTableBorder[K]>[],\n\tdescription: string,\n\tupdates: Partial<WithTableStyle & WithTableBorder>,\n\twarnings: TraitWarning[],\n) {\n\tconst value = table[key]\n\tif (isUndefined(value)) return\n\tif (isNullString(value)) {\n\t\tupdates[nodeKey] = undefined\n\t\treturn\n\t}\n\tif (!isString(value) || !allowed.includes(value as NonNullable<WithTableBorder[K]>)) {\n\t\twarnings.push({ applied: false, key: `table.${key}`, message: expectedAttributeMessage(value, description) })\n\t\treturn\n\t}\n\tupdates[nodeKey] = value as NonNullable<WithTableBorder[K]>\n}\n\nfunction applyTableBorderAttributes(\n\ttable: DSLAttributes,\n\tctx: AgentContext,\n\tupdates: Partial<WithTableBorder>,\n\twarnings: TraitWarning[],\n) {\n\tlet { borderColor, borderWidth, borderStyle } = table\n\tconst borderShorthand = table.border\n\n\t// A `null` on any individual key clears the entire border. Tables have no `borderEnabled` flag \u2014\n\t// rendering is gated on color, style, AND width all being set, so leaving any single one undefined\n\t// would render with a CSS browser default (e.g. `medium` width) instead of disabling the border.\n\tif (\n\t\tisNullString(borderShorthand) ||\n\t\tisNullString(borderColor) ||\n\t\tisNullString(borderWidth) ||\n\t\tisNullString(borderStyle)\n\t) {\n\t\tupdates.tableBorderColor = undefined\n\t\tupdates.tableBorderStyle = undefined\n\t\tupdates.tableBorderWidth = undefined\n\t\treturn\n\t}\n\n\tif (!isUndefined(borderShorthand) && !isString(borderShorthand)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"table.border\",\n\t\t\tmessage: expectedAttributeMessage(borderShorthand, borderShorthandDescription),\n\t\t})\n\t} else if (isString(borderShorthand)) {\n\t\tconst parsed = parseBorderShorthand(borderShorthand, ctx)\n\t\tif (parsed && !isUndefined(parsed.width)) {\n\t\t\tborderWidth = toRoundedNumber(parsed.width)\n\t\t\tif (!isUndefined(parsed.style)) borderStyle = parsed.style\n\t\t\tif (!isUndefined(parsed.color)) borderColor = parsed.color\n\t\t} else {\n\t\t\twarnings.push({\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"table.border\",\n\t\t\t\tmessage: expectedAttributeMessage(borderShorthand, borderShorthandDescription),\n\t\t\t})\n\t\t}\n\t}\n\n\tapplyBorderColor(borderColor, updates, warnings)\n\tapplyBorderStyle(borderStyle, updates, warnings)\n\tapplyBorderWidth(borderWidth, updates, warnings)\n}\n\nfunction applyBorderColor(value: DSLAttributes[string], updates: Partial<WithTableBorder>, warnings: TraitWarning[]) {\n\tif (isUndefined(value)) return\n\tif (!isString(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"table.borderColor\",\n\t\t\tmessage: expectedAttributeMessage(value, colorDescription),\n\t\t})\n\t\treturn\n\t}\n\tupdates.tableBorderColor = value\n}\n\nfunction applyBorderStyle(value: DSLAttributes[string], updates: Partial<WithTableBorder>, warnings: TraitWarning[]) {\n\tif (isUndefined(value)) return\n\tif (!isString(value) || !tableBorderStyleValues.includes(value as TableBorderStyle)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"table.borderStyle\",\n\t\t\tmessage: expectedAttributeMessage(value, tableBorderStyleDescription),\n\t\t})\n\t\treturn\n\t}\n\tupdates.tableBorderStyle = value as TableBorderStyle\n}\n\nfunction applyBorderWidth(value: DSLAttributes[string], updates: Partial<WithTableBorder>, warnings: TraitWarning[]) {\n\tif (isUndefined(value)) return\n\tif (isNumber(value)) {\n\t\tupdates.tableBorderWidth = value\n\t\treturn\n\t}\n\tif (!isString(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"table.borderWidth\",\n\t\t\tmessage: expectedAttributeMessage(value, borderWidthDescription),\n\t\t})\n\t\treturn\n\t}\n\tconst [dimensionValue, unit] = parseCSSDimension(value)\n\tconst isValidUnit = isUndefined(unit) || unit === \"px\"\n\tif (Number.isNaN(dimensionValue) || !isValidUnit) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"table.borderWidth\",\n\t\t\tmessage: expectedAttributeMessage(value, borderWidthDescription),\n\t\t})\n\t\treturn\n\t}\n\tupdates.tableBorderWidth = dimensionValue\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, _ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isTableStylePresetNode(node)) return\n\n\tconst result: DSLAttributes = {}\n\n\tconst table: DSLAttributes = {}\n\tif (isString(node.tableFillColor)) table.fillColor = node.tableFillColor\n\tif (isString(node.tableHeaderFillColor)) table.headerFillColor = node.tableHeaderFillColor\n\n\tconst borderWidth = isNumber(node.tableBorderWidth) ? createCSSDimension(node.tableBorderWidth, \"px\") : undefined\n\tconst borderParts = [borderWidth, node.tableBorderStyle, node.tableBorderColor].filter(isString)\n\tif (borderParts.length > 0) table.border = borderParts.join(\" \")\n\n\tif (isString(node.tableBorderInner)) table.borderInner = node.tableBorderInner\n\tif (isString(node.tableBorderOuter)) table.borderOuter = node.tableBorderOuter\n\tif (Object.keys(table).length > 0) result.table = table\n\n\tif (Object.keys(result).length === 0) return\n\treturn result\n}\n\nexport const tableStyle = {\n\tfor: isTableStylePresetNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<TableStyleAttributes>\n", "import { escapeValue } from \"app/ai/agents/prompt/utils.ts\"\nimport type { CanvasNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { TableStylePresetNode } from \"document/models/CanvasTree/nodes/TableStylePresetNode.ts\"\nimport { isRichTextNode, isTableStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { StylePresetType } from \"../context/stylePresetType.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\texpectedStylePresetReference,\n\texpectedStylePresetTypeMessage,\n\tinvalidAttributeMessage,\n\tsingleWarning,\n\tunsupportedAttributeMessage,\n\twarning,\n} from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\nimport { nodeToDSLType } from \"./types.ts\"\n\ninterface TableStylePresetAttributes {\n\ttableStylePreset: string\n}\n\nconst definition: TraitAttributeDefinition<TableStylePresetAttributes> = {\n\ttableStylePreset: {\n\t\tdescription: `The name or id of a ${ClassDiscriminator.TableStylePresetNode} | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] {\n\tconst presetNameOrId = attributes.tableStylePreset\n\tif (isUndefined(presetNameOrId)) return []\n\tif (!isString(presetNameOrId)) {\n\t\treturn warning(\"tableStylePreset\", presetNameOrId, expectedStylePresetReference)\n\t}\n\tif (isRichTextNode(node)) return fromAttributesToRichTextNode(node, presetNameOrId, ctx)\n\treturn [\n\t\t{\n\t\t\tapplied: false,\n\t\t\tkey: \"tableStylePreset\",\n\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t},\n\t]\n}\n\nfunction fromAttributesToRichTextNode(node: RichTextNode, presetNameOrId: string, ctx: AgentContext): TraitWarning[] {\n\tconst warnings: TraitWarning[] = []\n\n\tif (isNullString(presetNameOrId)) {\n\t\tnode.set({ stylePresetTable: undefined })\n\t\treturn warnings\n\t}\n\n\tconst presetNode = resolveTableStylePreset(presetNameOrId, ctx, warnings)\n\tif (!presetNode) return warnings\n\n\tnode.setNodeTableStylePreset(presetNode)\n\treturn warnings\n}\n\nfunction resolveTableStylePreset(\n\tpresetNameOrId: string,\n\tctx: AgentContext,\n\twarnings: TraitWarning[],\n): TableStylePresetNode | undefined {\n\tconst preset = ctx.stylePresets.forNameOrId(presetNameOrId, StylePresetType.Table)\n\tif (!preset) {\n\t\tthrow new DeferTraitError(\n\t\t\t`${escapeValue(ClassDiscriminator.TableStylePresetNode)} with name or id \"${presetNameOrId}\" not found`,\n\t\t)\n\t}\n\n\tif (preset.type !== StylePresetType.Table) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\n\t\t\t\t\"tableStylePreset\",\n\t\t\t\tpresetNameOrId,\n\t\t\t\texpectedStylePresetTypeMessage(preset.type, StylePresetType.Table),\n\t\t\t),\n\t\t)\n\t\treturn\n\t}\n\n\tconst presetNode = ctx.treeStore.tree.getNodeWithTrait(preset.id, isTableStylePresetNode)\n\tif (!presetNode) {\n\t\twarnings.push({\n\t\t\tkey: \"tableStylePreset\",\n\t\t\tapplied: false,\n\t\t\tmessage: invalidAttributeMessage(presetNameOrId, \"Table style preset not found in document\"),\n\t\t})\n\t\treturn\n\t}\n\n\treturn presetNode\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isRichTextNode(node)) return\n\treturn presetIdToAttributes(node.getTableStylePreset(ctx.treeStore.tree)?.id, ctx)\n}\n\nfunction presetIdToAttributes(presetId: string | undefined, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!presetId) return\n\tconst presetName = ctx.stylePresets.forId(presetId)?.name\n\tif (!presetName) return\n\treturn { tableStylePreset: presetName }\n}\n\nexport const tableStylePreset = {\n\tfor: isRichTextNode,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<TableStylePresetAttributes>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport {\n\ttype WithWhileTap,\n\thasWhileTap,\n\twhileTapEnabledDefaults,\n\twithWhileTap,\n} from \"document/models/CanvasTree/traits/WithWhileTap.ts\"\nimport { createCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { EffectType, effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { parseBoxShadows } from \"document/models/CanvasTree/traits/utils/parseBoxShadowFromStyle.ts\"\nimport { singleBoxShadowToCSS } from \"utils/boxShadowToCSS.ts\"\nimport { isNumber, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { type DSLHoverOrTapEffect, dslHoverOrTapEffectSchema, hoverOrTapEffectDefinition } from \"./hoverEffect.ts\"\nimport { breakpointUnsupportedMessage, singleWarning } from \"./invalidValues.ts\"\nimport {\n\teffectTransitionSupportedTypes,\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport { toRoundedNumber, type DSLAttributes, type TraitAttributeDefinition, type TraitDefinition } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<{ tapEffect: DSLHoverOrTapEffect }> = {\n\ttapEffect: hoverOrTapEffectDefinition,\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withWhileTap(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst { tapEffect } = attributes\n\n\tif (isBreakpointVariant(node) && tapEffect !== undefined) {\n\t\treturn [{ applied: false, key: \"tapEffect\", message: breakpointUnsupportedMessage(\"tap effects\") }]\n\t}\n\n\tif (isNullString(tapEffect)) {\n\t\tnode.set({ whileTapEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslHoverOrTapEffectSchema.safeParse(tapEffect)\n\tif (!parsed.success) return\n\n\tconst { opacity, x, y, scale, rotate, skewX, skewY, backgroundColor, shadow, transition } = parsed.data\n\tconst update: Partial<WithWhileTap> = {}\n\n\tif (isNumber(opacity)) update.whileTapOpacity = opacity\n\tif (isNumber(x)) update.whileTapX = x\n\tif (isNumber(y)) update.whileTapY = y\n\tif (isNumber(scale)) update.whileTapScale = scale\n\n\tif (!isUndefined(rotate)) {\n\t\tif (isNumber(rotate)) {\n\t\t\tupdate.whileTapRotate3d = false\n\t\t\tupdate.whileTapRotate = rotate\n\t\t} else {\n\t\t\tupdate.whileTapRotate3d = true\n\t\t\tupdate.whileTapRotate = rotate.rotateZ\n\t\t\tupdate.whileTapRotateX = rotate.rotateX\n\t\t\tupdate.whileTapRotateY = rotate.rotateY\n\t\t}\n\t}\n\n\tif (isNumber(skewX)) update.whileTapSkewX = skewX\n\tif (isNumber(skewY)) update.whileTapSkewY = skewY\n\n\tif (isString(backgroundColor)) {\n\t\tif (isNullString(backgroundColor)) {\n\t\t\tupdate.whileTapBackgroundColor = undefined\n\t\t} else {\n\t\t\tconst value = ctx.tokens.resolve(backgroundColor)?.toCSS() ?? backgroundColor\n\t\t\tupdate.whileTapBackgroundColor = value\n\t\t}\n\t}\n\n\tif (isString(shadow)) {\n\t\tif (isNullString(shadow)) {\n\t\t\tupdate.whileTapBoxShadow = undefined\n\t\t} else {\n\t\t\tconst boxShadows = parseBoxShadows(shadow)\n\t\t\tif (boxShadows.length > 0) update.whileTapBoxShadow = boxShadows[0]\n\t\t}\n\t}\n\n\tconst warnings: ReturnType<typeof singleWarning>[] = []\n\tconst parsedTransition = parseDSLTransitionString(transition, effectTransitionSupportedTypes, error => {\n\t\twarnings.push(singleWarning(\"tapEffect.transition\", transition, error.message))\n\t})\n\n\tif (parsedTransition) {\n\t\tupdate.whileTapTransition = transitionWithDefault(\n\t\t\tparsedTransition,\n\t\t\tnode.whileTapTransition,\n\t\t\teffectConfig[EffectType.Tap].enabledDefaults.whileTapTransition,\n\t\t)\n\t}\n\n\tif (isEmptyObject(update)) return warnings.length > 0 ? warnings : undefined\n\n\tupdateWithFallback(update, node, whileTapEnabledDefaults)\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: unknown, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!hasWhileTap(node)) return undefined\n\n\tconst nodeTapEffect: Partial<DSLHoverOrTapEffect> = {\n\t\topacity: isNumber(node.whileTapOpacity) ? toRoundedNumber(node.whileTapOpacity) : undefined,\n\t\tx: isNumber(node.whileTapX) ? createCSSDimension(toRoundedNumber(node.whileTapX), \"px\") : undefined,\n\t\ty: isNumber(node.whileTapY) ? createCSSDimension(toRoundedNumber(node.whileTapY), \"px\") : undefined,\n\t\tscale: isNumber(node.whileTapScale) ? toRoundedNumber(node.whileTapScale) : undefined,\n\t\tskewX: isNumber(node.whileTapSkewX) ? createCSSDimension(toRoundedNumber(node.whileTapSkewX), \"deg\") : undefined,\n\t\tskewY: isNumber(node.whileTapSkewY) ? createCSSDimension(toRoundedNumber(node.whileTapSkewY), \"deg\") : undefined,\n\t\tbackgroundColor: node.whileTapBackgroundColor\n\t\t\t? (ctx.tokens.resolve(node.whileTapBackgroundColor)?.toCSS() ?? node.whileTapBackgroundColor)\n\t\t\t: undefined,\n\t\tshadow: node.whileTapBoxShadow\n\t\t\t? singleBoxShadowToCSS(node.whileTapBoxShadow, color => ctx.tokens.resolve(color)?.toCSS())\n\t\t\t: undefined,\n\t\ttransition: vekterTransitionToDslTransitionString(node.whileTapTransition),\n\t}\n\n\tif (!isUndefined(node.whileTapRotate3d) && node.whileTapRotate3d) {\n\t\tnodeTapEffect.rotate = `${createCSSDimension(toRoundedNumber(node.whileTapRotateX ?? 0), \"deg\")} ${createCSSDimension(toRoundedNumber(node.whileTapRotateY ?? 0), \"deg\")} ${createCSSDimension(toRoundedNumber(node.whileTapRotate ?? 0), \"deg\")}`\n\t} else if (isNumber(node.whileTapRotate)) {\n\t\tnodeTapEffect.rotate = createCSSDimension(toRoundedNumber(node.whileTapRotate), \"deg\")\n\t}\n\n\treturn { tapEffect: nodeTapEffect }\n}\n\nexport const tapEffect = {\n\tfor: withWhileTap,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ tapEffect: DSLHoverOrTapEffect }>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { getUpdateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithTextEffect,\n\thasTextEffect,\n\tisSupportedTrigger,\n\ttextEffectEnabledDefaults,\n\ttextEffectTriggers,\n\ttokenizationOptions,\n\twithTextEffect,\n} from \"document/models/CanvasTree/traits/WithTextEffect.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { EffectType, effectConfig } from \"document/models/CanvasTree/traits/utils/effects.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isBoolean, isNumber, isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { booleanString } from \"../schemaUtils.ts\"\nimport { isNullString, parseRotateShorthand, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { singleWarning } from \"./invalidValues.ts\"\nimport {\n\teffectTransitionDefinition,\n\teffectTransitionSupportedTypes,\n\tparseDSLTransitionString,\n\ttransitionWithDefault,\n\tvekterTransitionToDslTransitionString,\n} from \"./transition.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitToAttributesOutput,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\nconst dslTextEffectStyleSchema = z.object({\n\topacity: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\tx: z\n\t\t.string()\n\t\t.transform(value => parseCSSDimension(value, \"px\")[0])\n\t\t.optional()\n\t\t.catch(undefined),\n\ty: z\n\t\t.string()\n\t\t.transform(value => parseCSSDimension(value, \"px\")[0])\n\t\t.optional()\n\t\t.catch(undefined),\n\tscale: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional(),\n\trotate: z\n\t\t.string()\n\t\t.transform(value => parseRotateShorthand(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tskewX: z\n\t\t.string()\n\t\t.transform(value => parseCSSDimension(value, \"deg\")[0])\n\t\t.optional()\n\t\t.catch(undefined),\n\tskewY: z\n\t\t.string()\n\t\t.transform(value => parseCSSDimension(value, \"deg\")[0])\n\t\t.optional()\n\t\t.catch(undefined),\n\tblur: z\n\t\t.string()\n\t\t.transform(value => parseCSSDimension(value, \"px\")[0])\n\t\t.optional()\n\t\t.catch(undefined),\n\ttransition: z.string().optional().catch(undefined),\n})\n\ntype ParsedDSLTextEffectStyle = z.output<typeof dslTextEffectStyleSchema>\ntype RoundedParsedDSLTextEffectStyle = TraitToAttributesOutput<ParsedDSLTextEffectStyle>\ntype DSLTextEffectStyle = Omit<\n\tRoundedParsedDSLTextEffectStyle,\n\t\"opacity\" | \"scale\" | \"rotate\" | \"x\" | \"y\" | \"skewX\" | \"skewY\" | \"blur\"\n> & {\n\topacity?: RoundedParsedDSLTextEffectStyle[\"opacity\"]\n\tscale?: RoundedParsedDSLTextEffectStyle[\"scale\"]\n\tx?: `${number}px`\n\ty?: `${number}px`\n\tskewX?: `${number}deg`\n\tskewY?: `${number}deg`\n\tblur?: `${number}px`\n\trotate?: `${number}deg` | `${number}deg ${number}deg ${number}deg`\n}\n\nconst textEffectStyleDefinition: TraitAttributeDefinition<DSLTextEffectStyle> = {\n\topacity: {\n\t\tdescription: \"number\",\n\t\toptional: true,\n\t},\n\tx: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\ty: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\tscale: {\n\t\tdescription: \"number\",\n\t\texamples: [\"0.9\", \"1.1\", \"1.5\"],\n\t\toptional: true,\n\t},\n\trotate: {\n\t\tdescription: \"${z}deg | ${x}deg ${y}deg ${z}deg\",\n\t\texamples: [\"-15deg\", \"15deg 45deg 90deg\"],\n\t\toptional: true,\n\t},\n\tskewX: {\n\t\tdescription: \"${number}deg\",\n\t\toptional: true,\n\t},\n\tskewY: {\n\t\tdescription: \"${number}deg\",\n\t\toptional: true,\n\t},\n\tblur: {\n\t\tdescription: \"${number}px\",\n\t\toptional: true,\n\t},\n\ttransition: effectTransitionDefinition,\n}\n\nconst dslTextEffectSchema = z.object({\n\ttrigger: z.enum(textEffectTriggers).optional().catch(undefined),\n\tthreshold: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\ttokenization: z.enum(tokenizationOptions).optional().catch(undefined),\n\tdelay: z\n\t\t.string()\n\t\t.transform(value => parseCSSDimension(value, \"s\")[0])\n\t\t.optional()\n\t\t.catch(undefined),\n\treplay: booleanString.optional().catch(undefined),\n\tstyle: dslTextEffectStyleSchema.optional().catch(undefined),\n})\n\ntype ParsedDSLTextEffect = z.output<typeof dslTextEffectSchema>\ntype RoundedParsedDSLTextEffect = TraitToAttributesOutput<ParsedDSLTextEffect>\ntype DSLTextEffect = Omit<RoundedParsedDSLTextEffect, \"delay\" | \"style\"> & {\n\tdelay?: `${number}s`\n\tstyle?: DSLTextEffectStyle\n}\n\nconst definition: TraitAttributeDefinition<{ textEffect: DSLTextEffect }> = {\n\ttextEffect: {\n\t\ttrigger: {\n\t\t\tdescription: textEffectTriggers.join(\" | \"),\n\t\t\toptional: true,\n\t\t},\n\t\tthreshold: {\n\t\t\tdescription: \"number\",\n\t\t\toptional: true,\n\t\t},\n\t\ttokenization: {\n\t\t\tdescription: tokenizationOptions.join(\" | \"),\n\t\t\toptional: true,\n\t\t},\n\t\tdelay: {\n\t\t\tdescription: \"${number}s\",\n\t\t\toptional: true,\n\t\t},\n\t\treplay: {\n\t\t\tdescription: \"boolean\",\n\t\t\toptional: true,\n\t\t},\n\t\tstyle: textEffectStyleDefinition,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withTextEffect(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tconst { textEffect } = attributes\n\n\tif (isUndefined(textEffect)) return\n\n\tif (isNullString(textEffect)) {\n\t\tnode.set({ textEffectEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslTextEffectSchema.safeParse(textEffect)\n\tif (!parsed.success) return\n\n\tconst { trigger, threshold, tokenization, delay, replay, style } = parsed.data\n\tconst update: Partial<WithTextEffect> = {}\n\tconst warnings: TraitWarning[] = []\n\n\tif (isString(trigger) && isSupportedTrigger(trigger)) {\n\t\tupdate.textEffectTrigger = trigger\n\t} else if (isObject(textEffect) && isString(textEffect.trigger) && isUndefined(trigger)) {\n\t\twarnings.push(singleWarning(\"textEffect.trigger\", textEffect.trigger, `one of: ${textEffectTriggers.join(\", \")}`))\n\t}\n\n\tif (isNumber(threshold)) {\n\t\tupdate.textEffectThreshold = threshold\n\t}\n\n\tif (isString(tokenization) && tokenizationOptions.includes(tokenization)) {\n\t\tupdate.textEffectTokenization = tokenization\n\t} else if (isObject(textEffect) && isString(textEffect.tokenization) && isUndefined(tokenization)) {\n\t\twarnings.push(\n\t\t\tsingleWarning(\"textEffect.tokenization\", textEffect.tokenization, `one of: ${tokenizationOptions.join(\", \")}`),\n\t\t)\n\t}\n\n\tif (isNumber(delay)) {\n\t\tupdate.textEffectDelay = delay\n\t}\n\n\tif (isBoolean(replay)) {\n\t\tupdate.textEffectReplay = replay\n\t}\n\n\tif (style) {\n\t\tif (isNumber(style.opacity)) {\n\t\t\tupdate.textEffectOpacity = style.opacity\n\t\t}\n\n\t\tif (isNumber(style.x)) {\n\t\t\tupdate.textEffectX = style.x\n\t\t}\n\n\t\tif (isNumber(style.y)) {\n\t\t\tupdate.textEffectY = style.y\n\t\t}\n\n\t\tif (isNumber(style.scale)) {\n\t\t\tupdate.textEffectScale = style.scale\n\t\t}\n\n\t\tif (!isUndefined(style.rotate)) {\n\t\t\tif (isNumber(style.rotate)) {\n\t\t\t\tupdate.textEffectRotate3d = false\n\t\t\t\tupdate.textEffectRotate = style.rotate\n\t\t\t} else if (style.rotate) {\n\t\t\t\tupdate.textEffectRotate3d = true\n\t\t\t\tupdate.textEffectRotate = style.rotate.rotateZ\n\t\t\t\tupdate.textEffectRotateX = style.rotate.rotateX\n\t\t\t\tupdate.textEffectRotateY = style.rotate.rotateY\n\t\t\t}\n\t\t}\n\n\t\tif (isNumber(style.skewX)) {\n\t\t\tupdate.textEffectSkewX = style.skewX\n\t\t}\n\n\t\tif (isNumber(style.skewY)) {\n\t\t\tupdate.textEffectSkewY = style.skewY\n\t\t}\n\n\t\tif (isNumber(style.blur)) {\n\t\t\tupdate.textEffectBlur = style.blur\n\t\t}\n\n\t\tconst parsedTransition = parseDSLTransitionString(style.transition, effectTransitionSupportedTypes, error => {\n\t\t\twarnings.push(singleWarning(\"textEffect.transition\", style.transition, error.message))\n\t\t})\n\n\t\tif (parsedTransition) {\n\t\t\tupdate.textEffectTransition = transitionWithDefault(\n\t\t\t\tparsedTransition,\n\t\t\t\tnode.textEffectTransition,\n\t\t\t\teffectConfig[EffectType.Text].enabledDefaults.textEffectTransition,\n\t\t\t)\n\t\t}\n\t}\n\n\tif (isEmptyObject(update)) return warnings.length > 0 ? warnings : undefined\n\n\tlet nodeUpdate: WithTextEffect = { ...getUpdateWithFallback(update, node, textEffectEnabledDefaults) }\n\n\t// For text effects, Transition.delay is used as the inter-token stagger interval\n\t// at runtime. When that delay is 0, all tokens animate simultaneously, which\n\t// visually looks like per-element. Fall back to the preset's delay so the\n\t// per-token effect is actually visible.\n\tif (nodeUpdate.textEffectTokenization !== \"element\" && nodeUpdate.textEffectTransition?.delay === 0) {\n\t\tconst defaultDelay = textEffectEnabledDefaults.textEffectTransition?.delay\n\t\tif (defaultDelay) {\n\t\t\tnodeUpdate = { ...nodeUpdate, textEffectTransition: { ...nodeUpdate.textEffectTransition, delay: defaultDelay } }\n\t\t}\n\t}\n\n\tnode.set(nodeUpdate)\n\n\tif (warnings.length > 0) return warnings\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!hasTextEffect(node)) return undefined\n\n\tconst nodeTextEffect: Partial<DSLTextEffect> = {\n\t\tthreshold: isNumber(node.textEffectThreshold) ? toRoundedNumber(node.textEffectThreshold) : undefined,\n\t\ttrigger: node.textEffectTrigger,\n\t\ttokenization: node.textEffectTokenization,\n\t\tdelay: isNumber(node.textEffectDelay) ? createCSSDimension(toRoundedNumber(node.textEffectDelay), \"s\") : undefined,\n\t\treplay: node.textEffectReplay,\n\t}\n\n\tconst styleEffect: Partial<DSLTextEffectStyle> = {\n\t\topacity: isNumber(node.textEffectOpacity) ? toRoundedNumber(node.textEffectOpacity) : undefined,\n\t\tx: isNumber(node.textEffectX) ? createCSSDimension(toRoundedNumber(node.textEffectX), \"px\") : undefined,\n\t\ty: isNumber(node.textEffectY) ? createCSSDimension(toRoundedNumber(node.textEffectY), \"px\") : undefined,\n\t\tscale: isNumber(node.textEffectScale) ? toRoundedNumber(node.textEffectScale) : undefined,\n\t\tskewX: isNumber(node.textEffectSkewX)\n\t\t\t? createCSSDimension(toRoundedNumber(node.textEffectSkewX), \"deg\")\n\t\t\t: undefined,\n\t\tskewY: isNumber(node.textEffectSkewY)\n\t\t\t? createCSSDimension(toRoundedNumber(node.textEffectSkewY), \"deg\")\n\t\t\t: undefined,\n\t\tblur: isNumber(node.textEffectBlur) ? createCSSDimension(toRoundedNumber(node.textEffectBlur), \"px\") : undefined,\n\t\ttransition: vekterTransitionToDslTransitionString(node.textEffectTransition),\n\t}\n\n\tif (!isUndefined(node.textEffectRotate3d) && node.textEffectRotate3d) {\n\t\tstyleEffect.rotate = `${createCSSDimension(toRoundedNumber(node.textEffectRotateX ?? 0), \"deg\")} ${createCSSDimension(toRoundedNumber(node.textEffectRotateY ?? 0), \"deg\")} ${createCSSDimension(toRoundedNumber(node.textEffectRotate ?? 0), \"deg\")}`\n\t} else if (isNumber(node.textEffectRotate)) {\n\t\tstyleEffect.rotate = createCSSDimension(toRoundedNumber(node.textEffectRotate), \"deg\")\n\t}\n\n\tnodeTextEffect.style = styleEffect\n\n\treturn { textEffect: nodeTextEffect }\n}\n\nexport const textEffect = {\n\tfor: withTextEffect,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ textEffect: DSLTextEffect }>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isBreakpointWithLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport {\n\ttype TextSelection,\n\ttype WithTextSelection,\n\tisTextSelection,\n\ttextSelectionAddedDefaults,\n\twithTextSelection,\n} from \"document/models/CanvasTree/traits/WithTextSelection.ts\"\nimport { isObject, isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { hasAnyAttribute, isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { layoutTemplateBreakpointWarnings } from \"./invalidValues.ts\"\nimport { colorDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\ninterface TextSelectionValueAttributes {\n\tcolor: string\n\tbackgroundColor: string\n}\n\ninterface TextSelectionAttributes {\n\ttextSelection: TextSelectionValueAttributes\n}\n\nconst definition: TraitAttributeDefinition<TextSelectionAttributes> = {\n\ttextSelection: {\n\t\tcolor: {\n\t\t\tdescription: colorDescription,\n\t\t\toptional: true,\n\t\t},\n\t\tbackgroundColor: {\n\t\t\tdescription: colorDescription,\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nfunction supportsTextSelection<T extends CanvasNode>(node: T): node is T & WithTextSelection {\n\treturn withTextSelection(node)\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!hasAnyAttribute(attributes, definition)) return\n\tif (!withTextSelection(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst layoutTemplateWarnings = layoutTemplateBreakpointWarnings(node, \"textSelection\")\n\tif (layoutTemplateWarnings) return layoutTemplateWarnings\n\n\tif (isNullString(attributes.textSelection)) {\n\t\tnode.set({ textSelection: null })\n\t\treturn\n\t}\n\n\tconst next: Partial<TextSelection> = {}\n\tif (!isObject(attributes.textSelection)) return\n\n\tif (isString(attributes.textSelection.color)) {\n\t\tnext.color = ctx.tokens.resolve(attributes.textSelection.color)?.toCSS() ?? attributes.textSelection.color\n\t}\n\tif (isString(attributes.textSelection.backgroundColor)) {\n\t\tnext.backgroundColor =\n\t\t\tctx.tokens.resolve(attributes.textSelection.backgroundColor)?.toCSS() ?? attributes.textSelection.backgroundColor\n\t}\n\n\tif (!isString(next.color) && !isString(next.backgroundColor)) return\n\n\tconst baseSelection = isTextSelection(node.textSelection)\n\t\t? node.textSelection\n\t\t: textSelectionAddedDefaults.textSelection\n\tnode.set({ textSelection: { ...baseSelection, ...next } })\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withTextSelection(node)) return undefined\n\tif (isBreakpointWithLayoutTemplate(node)) return undefined\n\tif (node.textSelection === null) return undefined\n\tif (!isTextSelection(node.textSelection)) return undefined\n\treturn {\n\t\ttextSelection: {\n\t\t\tcolor: ctx.tokens.resolve(node.textSelection.color)?.toCSS() ?? node.textSelection.color,\n\t\t\tbackgroundColor:\n\t\t\t\tctx.tokens.resolve(node.textSelection.backgroundColor)?.toCSS() ?? node.textSelection.backgroundColor,\n\t\t},\n\t}\n}\n\nexport const textSelection = {\n\tfor: supportsTextSelection,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<TextSelectionAttributes>\n", "import { assert } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isRichTextNode, isTextStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { richTextTags } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport { getTextStylePresetKey, withStylePresets } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { applyTextStylePreset } from \"../context/richtext/styleInheritance.ts\"\nimport { StylePresetType } from \"../context/stylePresetType.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\texpectedStylePresetTypeMessage,\n\texpectedTextStylePresetReference,\n\tinvalidAttributeMessage,\n\trichTextVariableDoesNotSupportTextStylePreset,\n\tsingleWarning,\n\twarning,\n} from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\ninterface TextStylePresetAttributes {\n\ttextStylePreset: string\n}\n\nconst definition: TraitAttributeDefinition<TextStylePresetAttributes> = {\n\ttextStylePreset: {\n\t\tdescription: `The name or id of the text style | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(\n\tnode: CanvasNode,\n\tattributes: DSLAttributes,\n\t{ stylePresets, virtualText, treeStore }: AgentContext,\n): TraitWarning[] | undefined {\n\tif (!isRichTextNode(node)) return\n\tconst document = virtualText.maybeHydrateDocument(node)\n\n\tconst presetReference = attributes.textStylePreset\n\tif (isUndefined(presetReference)) return\n\n\tif (!isString(presetReference)) {\n\t\treturn [singleWarning(\"textStylePreset\", presetReference, expectedTextStylePresetReference)]\n\t}\n\n\tif (isVariableReference(node.htmlContent)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: \"textStylePreset\",\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: richTextVariableDoesNotSupportTextStylePreset,\n\t\t\t},\n\t\t]\n\t}\n\n\tif (isNullString(presetReference)) {\n\t\tconst presetIds = node.getTextStylePresets(false).filter(isString)\n\n\t\tif (presetIds.length > 0) {\n\t\t\t// Flush pending virtual text changes to prosemirror before detaching\n\t\t\tvirtualText.apply(node)\n\n\t\t\tfor (const presetId of presetIds) {\n\t\t\t\tconst currentNode = treeStore.tree.current(node)\n\t\t\t\tassert(currentNode && isRichTextNode(currentNode), \"Expected RichTextNode\")\n\n\t\t\t\tconst presetNode = treeStore.tree.getNode(presetId)\n\t\t\t\tif (isTextStylePresetNode(presetNode)) {\n\t\t\t\t\tcurrentNode.detachTextStylePreset(presetNode, false)\n\t\t\t\t} else {\n\t\t\t\t\t// Preset node not found (deleted/stale) \u2013 clear the reference without copying styles\n\t\t\t\t\tcurrentNode.removeTextStylePreset(presetId, false)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Re-hydrate virtual text from the updated prosemirror state so the\n\t\t\t// inlined styles are picked up by the final virtual text apply.\n\t\t\tconst detachedNode = treeStore.tree.current(node)\n\t\t\tassert(detachedNode && isRichTextNode(detachedNode), \"Expected RichTextNode after detach\")\n\t\t\tvirtualText.hydrate(detachedNode)\n\t\t} else {\n\t\t\tapplyTextStylePreset(document, undefined)\n\t\t}\n\n\t\tconst latestNode = treeStore.tree.current(node) ?? node\n\t\tlatestNode.set(Object.fromEntries(richTextTags.map(tag => [getTextStylePresetKey(tag), undefined])))\n\t\treturn\n\t}\n\n\tconst preset = stylePresets.forNameOrId(presetReference, StylePresetType.Text)\n\tif (!preset) {\n\t\t// Defer: the preset may be mid-registration from a just-issued `+TextStylePresetNode`\n\t\tthrow new DeferTraitError(\n\t\t\t`${escapeValue(ClassDiscriminator.TextStylePresetNode)} with name or id \"${presetReference}\" not found`,\n\t\t)\n\t}\n\n\tif (preset.type !== StylePresetType.Text) {\n\t\treturn warning(\n\t\t\t\"textStylePreset\",\n\t\t\tpresetReference,\n\t\t\texpectedStylePresetTypeMessage(preset.type, StylePresetType.Text),\n\t\t)\n\t}\n\n\tif (!preset.tag) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"textStylePreset\",\n\t\t\t\tmessage: invalidAttributeMessage(presetReference, \"The referenced text style preset is missing a tag\"),\n\t\t\t},\n\t\t] satisfies TraitWarning[]\n\t}\n\tconst presetTag = preset.tag\n\n\tapplyTextStylePreset(document, { id: preset.id, tag: presetTag })\n\tnode.set({ [getTextStylePresetKey(presetTag)]: preset.id })\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isRichTextNode(node)) return\n\tif (isVariableReference(node.htmlContent)) return\n\n\tconst textStylePresetId = ctx.virtualText.getDocument(node.id)?.textStylePreset\n\tif (!textStylePresetId) return\n\n\tconst presetName = ctx.stylePresets.forId(textStylePresetId)?.name\n\tif (!presetName) return\n\n\treturn { textStylePreset: presetName }\n}\n\nexport const textStylePreset = {\n\tfor: withStylePresets,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<TextStylePresetAttributes>\n", "import {\n\tdefaultBreakpointWidths,\n\tgetBreakpointWidths,\n\tpickStylePresetBreakpointWidth,\n\tscaleStylePresetFontSize,\n} from \"document/components/chrome/properties/panels/breakpointUtils.tsx\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { TemplateHelper } from \"document/models/CanvasTree/nodes/TemplateHelper.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport {\n\tisTextStylePresetPrimaryNode,\n\ttype TextStylePresetPrimaryNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isMaster } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport {\n\tisLetterSpacingUnit,\n\tisLineHeightUnit,\n\tisValidFontSizeUnit,\n} from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport { createCSSDimension, parseCSSDimension } from \"document/models/CanvasTree/traits/utils/CSSDimension.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isObject, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\tbreakpointLabelNotAvailable,\n\tbreakpointMinWidthReadOnly,\n\tcannotDeleteDefaultBreakpoint,\n\tdefaultBreakpointMinWidthReadOnly,\n\texpectedPxValue,\n\tinvalidAttributeMessage,\n\tsingleWarning,\n\tunknownBreakpointLabel,\n\tunsupportedAttributeMessage,\n\tunsupportedBreakpointProperty,\n} from \"./invalidValues.ts\"\nimport {\n\ttype BreakpointLabel,\n\ttype BreakpointSlot,\n\tdefaultBreakpointLabel,\n\tgetBreakpointsForPreset,\n\tisBreakpointLabel,\n\treplicaIndexForLabel,\n\tresolveBreakpointLabel,\n\tserializeAllBreakpointSlots,\n} from \"./textStylePresetBreakpointSlots.ts\"\nimport {\n\tnodeToDSLType,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\n/**\n * This is not a traditional trait that maps DSL attributes 1:1 to node properties.\n * It encapsulates breakpoint replica management (creation, deletion, updates) behind\n * label-based keys so the LLM never needs to know about the internal replica model.\n * We use the trait interface to keep the read/write logic self-contained and to\n * integrate with the existing attribute pipeline (prompt generation, fromAttributes,\n * toAttributes).\n */\n\ninterface TextStylePresetBreakpointAttributes {\n\tbreakpoint: Record<BreakpointLabel, BreakpointSlot | typeof nullString> // null should remove the breakpoint slot\n}\n\nconst breakpointSlotDefinitions = {\n\tminWidth: { description: \"${number}px\", optional: true },\n\tfontSize: { description: \"${number}px | ${number}rem\", optional: true },\n\tletterSpacing: { description: \"${number}px | ${number}rem\", optional: true },\n\tlineHeight: { description: \"${number}px | ${number}em\", optional: true },\n\tparagraphSpacing: { description: \"number\", optional: true },\n} as const\n\nconst definition: TraitAttributeDefinition<TextStylePresetBreakpointAttributes> = {\n\tbreakpoint: {\n\t\tdefault: breakpointSlotDefinitions,\n\t\tlarge: breakpointSlotDefinitions,\n\t\tmedium: breakpointSlotDefinitions,\n\t\tsmall: breakpointSlotDefinitions,\n\t\textraSmall: breakpointSlotDefinitions,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tconst breakpointAttr = attributes.breakpoint\n\tif (isUndefined(breakpointAttr)) return\n\n\t// check if we got a breakpoint attribute for the correct node type.\n\tif (!isTextStylePresetPrimaryNode(node)) {\n\t\tconst nodeType = nodeToDSLType(node, ctx)\n\t\treturn [{ key: \"breakpoint\", applied: false, message: unsupportedAttributeMessage(nodeType) }]\n\t}\n\n\tif (!isObject(breakpointAttr)) {\n\t\treturn [singleWarning(\"breakpoint\", breakpointAttr, \"a valid breakpoint slot\")]\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\tconst tree = ctx.treeStore.tree\n\tlet breakpoints = getBreakpointsForPreset(tree, node)\n\tconst pendingMinWidthWrites: { label: BreakpointLabel; slotAttrs: Record<string, unknown>; keyPrefix: string }[] = []\n\n\tfor (const [label, slotValue] of Object.entries(breakpointAttr)) {\n\t\tif (isUndefined(slotValue)) continue\n\n\t\tif (!isBreakpointLabel(label)) {\n\t\t\twarnings.push(singleWarning(`breakpoint.${label}`, slotValue, unknownBreakpointLabel))\n\t\t\tcontinue\n\t\t}\n\n\t\tif (isNullString(slotValue)) {\n\t\t\tif (label === defaultBreakpointLabel) {\n\t\t\t\twarnings.push(singleWarning(`breakpoint.${defaultBreakpointLabel}`, nullString, cannotDeleteDefaultBreakpoint))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst replica = resolveBreakpointLabel(label, node, breakpoints)\n\t\t\tif (replica) {\n\t\t\t\ttree.remove(replica.id)\n\t\t\t\tctx.stylePresets.remove(replica.id)\n\t\t\t\t// Update the breakpoints list to reflect the deletion.\n\t\t\t\tbreakpoints = getBreakpointsForPreset(tree, node)\n\t\t\t} else {\n\t\t\t\twarnings.push(singleWarning(`breakpoint.${label}`, nullString, breakpointLabelNotAvailable))\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!isObject(slotValue)) {\n\t\t\twarnings.push(singleWarning(`breakpoint.${label}`, slotValue, \"an object with breakpoint slot properties\"))\n\t\t\tcontinue\n\t\t}\n\n\t\tif (label === defaultBreakpointLabel) {\n\t\t\t// The default slot is always the primary node.\n\t\t\tapplySlotProperties(node, slotValue, `breakpoint.${defaultBreakpointLabel}`, warnings)\n\t\t\tif (!isUndefined(slotValue.minWidth)) {\n\t\t\t\twarnings.push(\n\t\t\t\t\tsingleWarning(\n\t\t\t\t\t\t`breakpoint.${defaultBreakpointLabel}.minWidth`,\n\t\t\t\t\t\tslotValue.minWidth,\n\t\t\t\t\t\tdefaultBreakpointMinWidthReadOnly,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tlet targetReplica = resolveBreakpointLabel(label, node, breakpoints)\n\n\t\tif (!targetReplica) {\n\t\t\t// If the text style preset node is not in the tree, we need to defer the trait until it is inserted.\n\t\t\tif (!tree.has(node.id)) {\n\t\t\t\tthrow new DeferTraitError(\"Cannot create breakpoint slot before node is inserted into the tree\")\n\t\t\t}\n\n\t\t\tensureMaster(node)\n\t\t\tcreateSingleSlot(node, breakpoints, tree, ctx)\n\t\t\tbreakpoints = getBreakpointsForPreset(tree, node)\n\n\t\t\t// To avoid creating new breakpoint slots wrongly sized or in the wrong order we expect the LLM to create\n\t\t\t// the right breakpoints with the correct label for the current number of breakpoints.\n\t\t\tconst resolved = resolveBreakpointLabel(label, node, breakpoints)\n\t\t\tif (!resolved) {\n\t\t\t\twarnings.push(singleWarning(`breakpoint.${label}`, slotValue, breakpointLabelNotAvailable))\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ttargetReplica = resolved\n\t\t}\n\n\t\tapplySlotProperties(targetReplica, slotValue, `breakpoint.${label}`, warnings)\n\n\t\tif (!isUndefined(slotValue.minWidth)) {\n\t\t\tpendingMinWidthWrites.push({ label, slotAttrs: slotValue, keyPrefix: `breakpoint.${label}` })\n\t\t}\n\t}\n\n\tif (pendingMinWidthWrites.length > 0) {\n\t\tbreakpoints = getBreakpointsForPreset(tree, node)\n\t\tfor (const { label, slotAttrs, keyPrefix } of pendingMinWidthWrites) {\n\t\t\thandleMinWidthWrite(label, slotAttrs, breakpoints, keyPrefix, warnings)\n\t\t}\n\t}\n\n\treturn warnings.length > 0 ? warnings : undefined\n}\n\nfunction applySlotProperties(\n\tnode: TextStylePresetNode,\n\tslotAttrs: Record<string, unknown>,\n\tkeyPrefix: string,\n\twarnings: TraitWarning[],\n) {\n\tfor (const [property, value] of Object.entries(slotAttrs)) {\n\t\tif (isUndefined(value)) continue\n\t\t// Handled separately in handleMinWidthWrite because these are written in the sibling replicas.\n\t\tif (property === \"minWidth\") continue\n\n\t\tif (!(property in breakpointSlotDefinitions)) {\n\t\t\twarnings.push(singleWarning(`${keyPrefix}.${property}`, value, unsupportedBreakpointProperty(property)))\n\t\t\tcontinue\n\t\t}\n\n\t\tif (!isString(value)) {\n\t\t\twarnings.push(singleWarning(`${keyPrefix}.${property}`, value, \"a string\"))\n\t\t\tcontinue\n\t\t}\n\n\t\tswitch (property) {\n\t\t\tcase \"fontSize\": {\n\t\t\t\tconst [num, unit] = parseCSSDimension(value)\n\t\t\t\tif (Number.isNaN(num) || !isValidFontSizeUnit(unit)) {\n\t\t\t\t\twarnings.push(singleWarning(`${keyPrefix}.fontSize`, value, breakpointSlotDefinitions.fontSize.description))\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tnode.set({ fontSize: createCSSDimension(num, unit) })\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"letterSpacing\": {\n\t\t\t\tconst [num, unit] = parseCSSDimension(value)\n\t\t\t\tif (Number.isNaN(num) || !isLetterSpacingUnit(unit)) {\n\t\t\t\t\twarnings.push(\n\t\t\t\t\t\tsingleWarning(`${keyPrefix}.letterSpacing`, value, breakpointSlotDefinitions.letterSpacing.description),\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tnode.set({ letterSpacing: [num, unit] })\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"lineHeight\": {\n\t\t\t\tconst [num, unit] = parseCSSDimension(value, \"em\")\n\t\t\t\tif (Number.isNaN(num) || !isLineHeightUnit(unit)) {\n\t\t\t\t\twarnings.push(\n\t\t\t\t\t\tsingleWarning(`${keyPrefix}.lineHeight`, value, breakpointSlotDefinitions.lineHeight.description),\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tnode.set({ lineHeight: [num, unit] })\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"paragraphSpacing\": {\n\t\t\t\tconst parsed = tryParseNumber(value)\n\t\t\t\tif (isUndefined(parsed) || Number.isNaN(parsed)) {\n\t\t\t\t\twarnings.push(\n\t\t\t\t\t\tsingleWarning(\n\t\t\t\t\t\t\t`${keyPrefix}.paragraphSpacing`,\n\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\tbreakpointSlotDefinitions.paragraphSpacing.description,\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tnode.set({ paragraphSpacing: parsed })\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction handleMinWidthWrite(\n\tlabel: BreakpointLabel,\n\tslotAttrs: Record<string, unknown>,\n\tbreakpoints: TextStylePresetNode[],\n\tkeyPrefix: string,\n\twarnings: TraitWarning[],\n) {\n\tconst minWidthValue = slotAttrs.minWidth\n\tif (isUndefined(minWidthValue)) return\n\n\tif (!isString(minWidthValue)) {\n\t\twarnings.push(singleWarning(`${keyPrefix}.minWidth`, minWidthValue, \"a string\"))\n\t\treturn\n\t}\n\n\tif (label === defaultBreakpointLabel) return\n\n\tconst labelIndex = replicaIndexForLabel(label, breakpoints.length)\n\tif (labelIndex === undefined) return\n\tconst isLastSlot = labelIndex === breakpoints.length - 1\n\n\tif (isLastSlot) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: `${keyPrefix}.minWidth`,\n\t\t\tmessage: invalidAttributeMessage(minWidthValue, breakpointMinWidthReadOnly),\n\t\t})\n\t\treturn\n\t}\n\n\tconst [num, unit] = parseCSSDimension(minWidthValue, \"px\")\n\tif (Number.isNaN(num) || unit !== \"px\") {\n\t\twarnings.push(singleWarning(`${keyPrefix}.minWidth`, minWidthValue, expectedPxValue))\n\t\treturn\n\t}\n\n\tconst nextReplica = breakpoints[labelIndex + 1]\n\tif (nextReplica) {\n\t\tnextReplica.set({ breakpointWidth: num })\n\t}\n}\n\nfunction ensureMaster(node: TextStylePresetPrimaryNode) {\n\tif (isMaster(node)) return\n\tnode.set({\n\t\tisMaster: true,\n\t\treplicaInfo: null,\n\t\toriginalid: null,\n\t})\n}\n\n/**\n * Creates a single breakpoint replica, matching the UI's addBreakpoint behavior:\n * picks a unique width from canvas breakpoints (or fallbacks) and inherits font\n * size from the nearest larger breakpoint, scaled down by the major-third factor.\n */\nfunction createSingleSlot(\n\tprimary: TextStylePresetPrimaryNode,\n\texistingBreakpoints: TextStylePresetNode[],\n\ttree: AgentContext[\"treeStore\"][\"tree\"],\n\tctx: AgentContext,\n): TextStylePresetNode {\n\tconst listNode = PresetsListNode.ensure(tree)\n\n\tconst engine = ctx.hooks.getEngine()\n\tconst canvasWidths = engine ? getBreakpointWidths(engine) : defaultBreakpointWidths\n\n\tconst master = tree.current(primary)\n\tassert(master && isMaster(master), \"Expected master node for breakpoint creation\")\n\n\tconst existingSizes = new Set(existingBreakpoints.map(n => n.breakpointWidth ?? 0))\n\tconst lastBreakpointWidth = existingBreakpoints[existingBreakpoints.length - 1]?.breakpointWidth\n\tconst width = pickStylePresetBreakpointWidth(canvasWidths, existingSizes, lastBreakpointWidth)\n\n\tconst prevBreakpoint = [...existingBreakpoints].reverse().find(n => (n.breakpointWidth ?? 0) > width)\n\tconst prevFontSize = (prevBreakpoint ?? primary).fontSize\n\n\tconst replica = TemplateHelper.create(tree, master, {\n\t\toverrides: {\n\t\t\t[master.id]: {\n\t\t\t\tbreakpointWidth: width,\n\t\t\t\tfontSize: scaleStylePresetFontSize(prevFontSize, 0),\n\t\t\t},\n\t\t},\n\t})\n\n\ttree.insertNode(replica, listNode.id)\n\n\treturn replica\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isTextStylePresetPrimaryNode(node)) return\n\tconst breakpoints = getBreakpointsForPreset(ctx.treeStore.tree, node)\n\treturn { breakpoint: serializeAllBreakpointSlots(node, breakpoints) }\n}\n\nexport const textStylePresetBreakpoint = {\n\tfor: node => isTextStylePresetPrimaryNode(node),\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<TextStylePresetBreakpointAttributes>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { getRichTextTagName, type RichTextTag } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport { textStylePresetKeys, type WithStylePresets } from \"document/models/CanvasTree/traits/WithStylePresets.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { DeferTraitError } from \"../context/DeferTraitError.ts\"\nimport { StylePresetType } from \"../context/stylePresetType.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\texpectedTextStylePresetReferenceForTag,\n\tperTagTextStylePresetsRequireRichTextVariable,\n\tsingleWarning,\n\tunsupportedAttributeMessage,\n} from \"./invalidValues.ts\"\nimport {\n\tnodeToDSLType,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\ntype TextStylePresetDefaultKey = (typeof textStylePresetKeys)[number]\ntype TextStylePresetDefaultAttributes = Pick<WithStylePresets, TextStylePresetDefaultKey>\n\nconst tagByTextStylePresetKey = {\n\tstylePresetHeading1: \"h1\",\n\tstylePresetHeading2: \"h2\",\n\tstylePresetHeading3: \"h3\",\n\tstylePresetHeading4: \"h4\",\n\tstylePresetHeading5: \"h5\",\n\tstylePresetHeading6: \"h6\",\n\tstylePresetParagraph: \"p\",\n} as const satisfies Record<TextStylePresetDefaultKey, RichTextTag>\n\nfunction createDefinition(): TraitAttributeDefinition<TextStylePresetDefaultAttributes> {\n\tconst definition: Partial<TraitAttributeDefinition<TextStylePresetDefaultAttributes>> = {}\n\n\tfor (const key of textStylePresetKeys) {\n\t\tconst tag = tagByTextStylePresetKey[key]\n\t\tdefinition[key] = {\n\t\t\tdescription: `The text style preset name or id for ${getRichTextTagName(tag)} blocks | ${nullString}`,\n\t\t\toptional: true,\n\t\t}\n\t}\n\n\treturn definition as TraitAttributeDefinition<TextStylePresetDefaultAttributes>\n}\n\nconst definition = createDefinition()\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tconst presentKeys = textStylePresetKeys.filter(key => !isUndefined(attributes[key]))\n\tif (presentKeys.length === 0) return\n\n\tif (!isRichTextNode(node)) {\n\t\tconst nodeType = nodeToDSLType(node, ctx)\n\t\treturn presentKeys.map(key => ({\n\t\t\tkey,\n\t\t\tapplied: false,\n\t\t\tmessage: unsupportedAttributeMessage(nodeType),\n\t\t}))\n\t}\n\n\tif (!isVariableReference(node.htmlContent)) {\n\t\treturn presentKeys.map(key => ({\n\t\t\tkey,\n\t\t\tapplied: false,\n\t\t\tmessage: perTagTextStylePresetsRequireRichTextVariable,\n\t\t}))\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\tconst updates: Partial<TextStylePresetDefaultAttributes> = {}\n\tconst unresolvedReferences: string[] = []\n\n\tfor (const key of presentKeys) {\n\t\tconst value = attributes[key]\n\t\tif (isNullString(value)) {\n\t\t\tupdates[key] = undefined\n\t\t\tcontinue\n\t\t}\n\n\t\tconst expectedTag = tagByTextStylePresetKey[key]\n\t\tif (!isString(value)) {\n\t\t\twarnings.push(singleWarning(key, value, expectedTextStylePresetReferenceForTag(getRichTextTagName(expectedTag))))\n\t\t\tcontinue\n\t\t}\n\n\t\tconst preset = ctx.stylePresets.forNameOrId(value, StylePresetType.Text)\n\t\tif (!preset) {\n\t\t\t// Defer: the preset may be mid-registration from a just-issued `+TextStylePresetNode`\n\t\t\tunresolvedReferences.push(value)\n\t\t\tcontinue\n\t\t}\n\t\tif (preset.tag !== expectedTag) {\n\t\t\twarnings.push(singleWarning(key, value, expectedTextStylePresetReferenceForTag(getRichTextTagName(expectedTag))))\n\t\t\tcontinue\n\t\t}\n\n\t\tupdates[key] = preset.id\n\t}\n\n\t// Apply resolved updates before deferring so a single unresolved reference doesn't drop\n\t// the rest of the SET. node.set is idempotent, so retries re-applying the same values is fine.\n\tif (!isEmptyObject(updates)) node.set(updates)\n\n\tif (unresolvedReferences.length > 0) {\n\t\tconst list = unresolvedReferences.map(reference => `\"${reference}\"`).join(\", \")\n\t\tconst plural = unresolvedReferences.length > 1 ? \"s\" : \"\"\n\t\tthrow new DeferTraitError(\n\t\t\t`${escapeValue(ClassDiscriminator.TextStylePresetNode)}${plural} with name or id ${list} not found`,\n\t\t)\n\t}\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!isRichTextNode(node)) return\n\tif (!isVariableReference(node.htmlContent)) return\n\n\tconst attributes: DSLAttributes = {}\n\tfor (const key of textStylePresetKeys) {\n\t\tconst value = node[key]\n\t\tif (!isString(value)) continue\n\n\t\tconst presetName = ctx.stylePresets.forId(value)?.name\n\t\tif (presetName) attributes[key] = presetName\n\t}\n\n\treturn Object.keys(attributes).length > 0 ? attributes : undefined\n}\n\nexport const textStylePresetsByTag = {\n\tfor: node => isRichTextNode(node),\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<TextStylePresetDefaultAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport {\n\tcompatibleOverflowCounterpart,\n\tisNonClippingOverflowValue,\n\twithOverflow,\n} from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport { withTextTruncation, type WithTextTruncation } from \"document/models/CanvasTree/traits/WithTextTruncation.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport {\n\texpectedAttributeMessage,\n\texpectedPositiveInteger,\n\ttraitNotAppliedWarning,\n\tunsupportedAttributeMessage,\n} from \"./invalidValues.ts\"\nimport { dynamicValueDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst textTruncationDefinition = {\n\ttextTruncation: {\n\t\tdescription: `positive integer (number of visible lines) | ${dynamicValueDescription(\"number\")} | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<WithTextTruncation>\n\nfunction supportsTextTruncationCanvasNode(node: CanvasNode): node is CanvasNode & WithTextTruncation {\n\treturn withTextTruncation(node)\n}\n\nfunction tryParseStrictPositiveInteger(value: string): number | undefined {\n\tif (!/^\\d+$/.test(value)) return undefined\n\tconst parsed = Number(value)\n\tif (parsed < 1) return undefined\n\treturn parsed\n}\n\nfunction applyClippingOverflow(node: CanvasNode & WithTextTruncation): void {\n\tif (!withOverflow(node)) return\n\n\tif (isNonClippingOverflowValue(node.overflowY)) {\n\t\tnode.set({ overflowY: compatibleOverflowCounterpart[node.overflowY] })\n\t\treturn\n\t}\n\tif (isNonClippingOverflowValue(node.overflow)) {\n\t\tnode.set({ overflowY: compatibleOverflowCounterpart[node.overflow] })\n\t\treturn\n\t}\n\tif (isUndefined(node.overflow)) {\n\t\tnode.set({ overflow: \"clip\" })\n\t\treturn\n\t}\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tconst value = attributes.textTruncation\n\tif (isUndefined(value)) return\n\n\tif (!withTextTruncation(node)) {\n\t\treturn [{ applied: false, key: \"textTruncation\", message: unsupportedAttributeMessage(node.__class) }]\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(value, {\n\t\texpectedType: [ControlType.Number],\n\t\tnode,\n\t})\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\treturn resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"textTruncation\", message))\n\t}\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tnode.set({ textTruncation: resolveHandleResult.handle.reference(node) })\n\t\tapplyClippingOverflow(node)\n\t\treturn warnings\n\t}\n\n\tif (isNullString(value)) {\n\t\tnode.set({ textTruncation: undefined })\n\t\treturn warnings\n\t}\n\n\tif (!isString(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"textTruncation\",\n\t\t\tmessage: expectedAttributeMessage(value, expectedPositiveInteger),\n\t\t})\n\t\treturn warnings\n\t}\n\n\tconst parsed = tryParseStrictPositiveInteger(value)\n\tif (isUndefined(parsed)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"textTruncation\",\n\t\t\tmessage: expectedAttributeMessage(value, expectedPositiveInteger),\n\t\t})\n\n\t\treturn warnings\n\t}\n\n\tnode.set({ textTruncation: parsed })\n\tapplyClippingOverflow(node)\n\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!withTextTruncation(node)) return\n\tif (isUndefined(node.textTruncation)) return\n\n\tif (isDynamicValue(node.textTruncation)) {\n\t\treturn {\n\t\t\ttextTruncation: ctx.dynamicValues.resolveAttributeFromDynamicValue(node.textTruncation, node),\n\t\t}\n\t}\n\n\treturn { textTruncation: node.textTruncation.toString() }\n}\n\nexport const textTruncation = {\n\tfor: supportsTextTruncationCanvasNode,\n\tdefinition: textTruncationDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<WithTextTruncation>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithTextVerticalAlignment,\n\tisTextVerticalAlignment,\n\tsupportsVerticalAlignment,\n\ttextVerticalAlignments,\n\twithTextVerticalAlignment,\n} from \"document/models/CanvasTree/traits/WithTextVerticalAlignment.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\ntype TextVerticalAlignmentAttributes = Pick<WithTextVerticalAlignment, \"textVerticalAlignment\">\n\nconst definition: TraitAttributeDefinition<TextVerticalAlignmentAttributes> = {\n\ttextVerticalAlignment: {\n\t\tdescription: textVerticalAlignments.join(\" | \"),\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!supportsVerticalAlignment(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\tif (!isString(attributes.textVerticalAlignment)) return\n\tif (!isTextVerticalAlignment(attributes.textVerticalAlignment)) return\n\tnode.set({ textVerticalAlignment: attributes.textVerticalAlignment })\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!supportsVerticalAlignment(node)) return\n\treturn { textVerticalAlignment: node.textVerticalAlignment }\n}\n\nexport const textVerticalAlignment = {\n\tfor: withTextVerticalAlignment,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<TextVerticalAlignmentAttributes>\n", "import type { CanvasNode, RichTextNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { TextStylePresetNode } from \"document/models/CanvasTree/nodes/TextStylePresetNode.ts\"\nimport { isRichTextNode, isTextStylePresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withTextWrapBalance, type WithTextWrapBalance } from \"document/models/CanvasTree/traits/WithTextWrapBalance.ts\"\nimport { isBooleanString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport { expectedAttributeMessage } from \"./invalidValues.ts\"\nimport {\n\thasRichTextVariableBinding,\n\trejectTextStyleAttributesForRichTextVariableBinding,\n\twarnUnsupportedTextStyleKeys,\n} from \"./textStyle/utils.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst textWrapBalanceDefinition = {\n\ttextWrapBalance: {\n\t\tdescription: `boolean | ${nullString}`,\n\t\toptional: true,\n\t},\n} satisfies TraitAttributeDefinition<WithTextWrapBalance>\n\nconst textWrapBalanceAttributeKeys = Object.keys(textWrapBalanceDefinition)\n\ninterface SerializedTextWrapBalanceAttributes {\n\ttextWrapBalance?: boolean | string\n}\n\ntype TextWrapBalanceCanvasNode = RichTextNode | TextStylePresetNode\n\nfunction supportsTextWrapBalanceCanvasNode(node: CanvasNode): node is TextWrapBalanceCanvasNode {\n\treturn isRichTextNode(node) || isTextStylePresetNode(node)\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tconst value = attributes.textWrapBalance\n\tif (isUndefined(value)) return\n\n\tif (!withTextWrapBalance(node)) {\n\t\treturn warnUnsupportedTextStyleKeys(node, textWrapBalanceAttributeKeys, attributes, ctx)\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\tif (rejectTextStyleAttributesForRichTextVariableBinding(node, attributes, warnings, textWrapBalanceAttributeKeys)) {\n\t\treturn warnings\n\t}\n\n\tif (isNullString(value)) {\n\t\tnode.set({ textWrapBalance: undefined })\n\t\treturn warnings\n\t}\n\n\tif (!isBooleanString(value)) {\n\t\twarnings.push({\n\t\t\tapplied: false,\n\t\t\tkey: \"textWrapBalance\",\n\t\t\tmessage: expectedAttributeMessage(value, textWrapBalanceDefinition.textWrapBalance.description),\n\t\t})\n\n\t\treturn warnings\n\t}\n\n\tconst textWrapBalance = value === \"true\"\n\tnode.set({ textWrapBalance })\n\n\treturn warnings\n}\n\nfunction toAttributes(\n\tnode: CanvasNode,\n\t_parent: MaybeCanvasNode,\n\t_ctx: AgentContext,\n): SerializedTextWrapBalanceAttributes | undefined {\n\tif (!withTextWrapBalance(node)) return\n\tif (isUndefined(node.textWrapBalance)) return\n\tif (hasRichTextVariableBinding(node)) return\n\n\treturn { textWrapBalance: node.textWrapBalance }\n}\n\nexport const textWrapBalance = {\n\tfor: supportsTextWrapBalanceCanvasNode,\n\tdefinition: textWrapBalanceDefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<SerializedTextWrapBalanceAttributes, [], CanvasNode>\n", "import { isEmptyObject } from \"@framerjs/shared\"\nimport { updateWithFallback } from \"app/ai/utils/updateWithFallback.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { withLayout } from \"document/models/CanvasTree/traits/WithLayout.ts\"\nimport {\n\ttype WithTickerEffect,\n\tisTickerEffectDirectionModifier,\n\thasTickerEffect,\n\ttickerEffectEnabledDefaults,\n\twithTickerEffect,\n} from \"document/models/CanvasTree/traits/WithTickerEffect.ts\"\nimport { isBreakpointVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isBoolean, isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { booleanString } from \"../schemaUtils.ts\"\nimport { isNullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { breakpointUnsupportedMessage } from \"./invalidValues.ts\"\nimport {\n\ttoRoundedNumber,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitToAttributesOutput,\n} from \"./types.ts\"\n\nconst dslTickerEffectSchema = z.object({\n\tvelocity: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\thoverModifier: z\n\t\t.string()\n\t\t.transform(value => tryParseNumber(value))\n\t\t.optional()\n\t\t.catch(undefined),\n\tdirectionModifier: z.enum([\"default\", \"reverse\"]).optional().catch(undefined),\n\tdraggable: booleanString.optional().catch(undefined),\n})\n\ntype ParsedDSLTickerEffect = z.output<typeof dslTickerEffectSchema>\ntype DSLTickerEffect = TraitToAttributesOutput<ParsedDSLTickerEffect>\n\nconst definition: TraitAttributeDefinition<{ tickerEffect: DSLTickerEffect }> = {\n\ttickerEffect: {\n\t\tvelocity: {\n\t\t\tdescription: \"number\",\n\t\t\toptional: true,\n\t\t},\n\t\thoverModifier: {\n\t\t\tdescription: \"number\",\n\t\t\toptional: true,\n\t\t},\n\t\tdirectionModifier: {\n\t\t\tdescription: \"default | reverse\",\n\t\t\toptional: true,\n\t\t},\n\t\tdraggable: {\n\t\t\tdescription: \"boolean\",\n\t\t\toptional: true,\n\t\t},\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withTickerEffect(node) || !withLayout(node)) {\n\t\treturn unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\t}\n\tconst { tickerEffect } = attributes\n\n\tif (isBreakpointVariant(node) && !isUndefined(tickerEffect)) {\n\t\treturn [{ applied: false, key: \"tickerEffect\", message: breakpointUnsupportedMessage(\"ticker effects\") }]\n\t}\n\n\tif (isNullString(tickerEffect)) {\n\t\tnode.set({ tickerEffectEnabled: undefined })\n\t\treturn\n\t}\n\n\tconst parsed = dslTickerEffectSchema.safeParse(tickerEffect)\n\tif (!parsed.success) return\n\n\tconst { velocity, hoverModifier, directionModifier, draggable } = parsed.data\n\tconst update: Partial<WithTickerEffect> = {}\n\n\tif (isNumber(velocity)) {\n\t\tupdate.tickerEffectVelocity = velocity\n\t}\n\n\tif (isNumber(hoverModifier)) {\n\t\tupdate.tickerEffectHoverModifier = hoverModifier\n\t}\n\n\tif (isTickerEffectDirectionModifier(directionModifier)) {\n\t\tupdate.tickerEffectDirectionModifier = directionModifier\n\t}\n\n\tif (isBoolean(draggable)) {\n\t\tupdate.tickerEffectDraggable = draggable\n\t}\n\n\tif (isEmptyObject(update)) return\n\n\tnode.set({ layout: \"stack\" })\n\tupdateWithFallback(update, node, tickerEffectEnabledDefaults)\n}\n\nfunction toAttributes(node: CanvasNode): DSLAttributes | undefined {\n\tif (!hasTickerEffect(node)) return\n\n\tconst tickerEffectVelocity = node.resolveValue(\"tickerEffectVelocity\")\n\tconst tickerEffectHoverModifier = node.resolveValue(\"tickerEffectHoverModifier\")\n\treturn {\n\t\ttickerEffect: {\n\t\t\tvelocity: isNumber(tickerEffectVelocity) ? toRoundedNumber(tickerEffectVelocity) : tickerEffectVelocity,\n\t\t\thoverModifier: isNumber(tickerEffectHoverModifier)\n\t\t\t\t? toRoundedNumber(tickerEffectHoverModifier)\n\t\t\t\t: tickerEffectHoverModifier,\n\t\t\tdirectionModifier: node.resolveValue(\"tickerEffectDirectionModifier\"),\n\t\t\tdraggable: node.resolveValue(\"tickerEffectDraggable\") ? \"true\" : \"false\",\n\t\t},\n\t}\n}\n\nexport const tickerEffect = {\n\tfor: withTickerEffect,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<{ tickerEffect: DSLTickerEffect }>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\ttype WithUserSelect,\n\tallUserSelectValues,\n\tisUserSelectValue,\n\twithUserSelect,\n} from \"document/models/CanvasTree/traits/WithUserSelect.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isNullString, nullString, unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { traitNotAppliedWarning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithUserSelect> = {\n\tuserSelect: {\n\t\tdescription: `${allUserSelectValues.join(\" | \")} | ${nullString}`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withUserSelect(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.userSelect, { node })\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tnode.set({ userSelect: resolveHandleResult.handle.reference(node) })\n\t\treturn\n\t}\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\treturn resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"userSelect\", message))\n\t}\n\n\tif (isNullString(attributes.userSelect)) {\n\t\tnode.set({ userSelect: undefined })\n\t\treturn\n\t}\n\n\tif (!isUserSelectValue(attributes.userSelect)) return\n\tnode.set({ userSelect: attributes.userSelect })\n}\n\nexport const userSelect = {\n\tfor: withUserSelect,\n\tdefinition,\n\tfromAttributes,\n} satisfies TraitDefinition<WithUserSelect>\n", "import { assert, assertNever } from \"@framerjs/shared\"\nimport type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { VariableDefinition, VariableType } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { InputType } from \"document/models/CanvasTree/traits/forms/WithTextInputType.ts\"\nimport { isFoundAndNotMixedAndNotUndefined } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { commonValue } from \"utils/commonValue.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\n\nexport const compatibleVariableTypesByNode = {\n\t[ClassDiscriminator.FormBooleanInputNode]: [ControlType.Boolean, ControlType.MultiCollectionReference],\n\t[ClassDiscriminator.FormPlainTextInputNode]: [ControlType.String, ControlType.Number, ControlType.Date],\n\t[ClassDiscriminator.FormSelectNode]: [ControlType.Boolean, ControlType.CollectionReference, \"controlReference\"],\n} as const satisfies Partial<Record<ClassDiscriminator, readonly VariableType[]>>\n\nexport function isNodeClassWithCompatibleVariableTypes(\n\tnodeClass: ClassDiscriminator,\n): nodeClass is keyof typeof compatibleVariableTypesByNode {\n\treturn nodeClass in compatibleVariableTypesByNode\n}\n\nexport function getCompatibleVariableTypesForNodes(\n\ttree: CanvasTree,\n\tnodeIds: NodeID[],\n): readonly VariableType[] | undefined {\n\tconst nodeClasses = nodeIds.map(id => tree.getNode(id)?.__class)\n\tconst commonNodeClass = commonValue(nodeClasses)\n\tif (!isFoundAndNotMixedAndNotUndefined(commonNodeClass)) return undefined\n\tif (!isNodeClassWithCompatibleVariableTypes(commonNodeClass)) return undefined\n\treturn compatibleVariableTypesByNode[commonNodeClass]\n}\n\nexport function textInputTypeForVariable(variable: VariableDefinition): InputType {\n\tassert(\n\t\tvariableIsOfCompatibleType(variable, compatibleVariableTypesByNode.FormPlainTextInputNode),\n\t\t`Variable of type ${variable.type} has no compatible text input type`,\n\t)\n\n\tswitch (variable.type) {\n\t\tcase ControlType.String:\n\t\t\treturn \"text\"\n\t\tcase ControlType.Number:\n\t\t\treturn \"number\"\n\t\tcase ControlType.Date:\n\t\t\treturn \"date\"\n\t\tdefault:\n\t\t\tassertNever(variable)\n\t}\n}\n\nfunction variableIsOfCompatibleType<T extends VariableType>(\n\tvariable: VariableDefinition,\n\tcompatibleVariables: readonly T[],\n): variable is VariableDefinition & { type: T } {\n\treturn compatibleVariables.some(type => type === variable.type)\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { DeferTraitError } from \"app/ai/agents/context/DeferTraitError.ts\"\nimport {\n\tcompatibleVariableTypesByNode,\n\ttextInputTypeForVariable,\n\tisNodeClassWithCompatibleVariableTypes,\n} from \"document/components/chrome/properties/rows/FormInputRows/formNodeVariableTypes.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport {\n\tisCollectionNode,\n\tisCollectionRepeater,\n\tisDataRepeater,\n\tisFormPlainTextInputNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasVariableBinding, withVariableBinding } from \"document/models/CanvasTree/traits/WithVariableBinding.ts\"\nimport {\n\tisMultiCollectionReferenceVariableDefinition,\n\tisVariableDefinition,\n\ttype VariableType,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isRepeatedItem } from \"utils/repeaterUtils.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport {\n\ttype VariableReferenceHandle,\n\tisVariableReferenceHandle,\n\tlooksLikeVariableReference,\n} from \"../context/dynamicValues.ts\"\nimport { isNullString } from \"./helpers.ts\"\nimport { singleWarning, traitNotAppliedWarning, unsupportedAttributeMessage } from \"./invalidValues.ts\"\nimport { variableDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\ninterface VariableBindingAttributes {\n\tvariableBinding: string | undefined\n}\n\nconst definition: TraitAttributeDefinition<VariableBindingAttributes> = {\n\tvariableBinding: {\n\t\tdescription: variableDescription,\n\t\toptional: true,\n\t},\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!hasVariableBinding(node)) return\n\n\tconst variableBinding = ctx.dynamicValues.resolveAttributeFromDynamicValue(node.variableBinding, node)\n\tif (!variableBinding) return\n\n\treturn { variableBinding }\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext): TraitWarning[] | undefined {\n\tconst { variableBinding } = attributes\n\n\tif (!isString(variableBinding)) return\n\n\tif (!withVariableBinding(node)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: \"variableBinding\",\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: unsupportedAttributeMessage(node.__class),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (isNullString(variableBinding)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: \"variableBinding\",\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: hasVariableBinding(node)\n\t\t\t\t\t? \"Cannot unset variableBinding from a variable-bound node.\"\n\t\t\t\t\t: \"Cannot unset variableBinding: node is form-bound and it doesn't have a variableBinding.\",\n\t\t\t},\n\t\t]\n\t}\n\n\tif (!looksLikeVariableReference(variableBinding)) {\n\t\treturn [singleWarning(\"variableBinding\", variableBinding, variableDescription)]\n\t}\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(variableBinding, { node })\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\treturn resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"variableBinding\", message))\n\t}\n\n\tif (\n\t\tresolveHandleResult.type !== \"resolved\" ||\n\t\t!isVariableReferenceHandle(resolveHandleResult.handle) ||\n\t\t!isVariableDefinition(resolveHandleResult.handle.variable)\n\t) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: \"variableBinding\",\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: `Could not resolve variable from \"${variableBinding}\".`,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst scopeNode = ctx.treeResolver.getScopeNodeFor(node.id)\n\tif (!scopeNode) throw new DeferTraitError(\"Cannot update variableBinding of a node not in tree\")\n\n\tif (resolveHandleResult.handle.scopeId !== scopeNode.id) {\n\t\t// This will remain true unless we introduce a new kind of variables in Framer.\n\t\t// This assert keeps the warning message below accurate.\n\t\tassert(\n\t\t\tctx.treeStore.tree.getNodeWithTrait(resolveHandleResult.handle.scopeId, isCollectionNode),\n\t\t\t\"A variable that doesn't exist in the scope node can only be a collection variable\",\n\t\t)\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tkey: \"variableBinding\",\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: `Variable \"${resolveHandleResult.handle.variable.name}\" is a read-only CMS variable that cannot be bound to an input.`,\n\t\t\t},\n\t\t]\n\t}\n\n\tconst typeWarning = validateVariableTypeCompatibility(node, resolveHandleResult.handle, ctx)\n\tif (typeWarning) return [typeWarning]\n\n\tnode.set({ variableBinding: resolveHandleResult.handle.reference(node), bindingType: \"variable\" })\n\n\tif (isFormPlainTextInputNode(node)) {\n\t\tnode.set({ formTextInputType: textInputTypeForVariable(resolveHandleResult.handle.variable) })\n\t}\n}\n\n/**\n * Pending-aware variant of `getNearestAncestorRepeaterContext`. Walks ancestors via\n * `ctx.treeResolver` so this works even when `node` is still scheduled for insertion\n * and is therefore not yet reachable via `node.ancestors()`.\n */\nfunction getNearestAncestorRepeaterContextForPending(node: CanvasNode, ctx: AgentContext) {\n\tlet child: CanvasNode = node\n\tfor (const parent of ctx.treeResolver.getAncestorsFor(node.id)) {\n\t\tif (isDataRepeater(parent)) {\n\t\t\treturn {\n\t\t\t\trepeater: parent,\n\t\t\t\tinRepeatedChild: isRepeatedItem(ctx.treeStore.tree, child, parent),\n\t\t\t}\n\t\t}\n\t\tchild = parent\n\t}\n}\n\nfunction validateVariableTypeCompatibility(\n\tnode: CanvasNode,\n\thandle: VariableReferenceHandle,\n\tctx: AgentContext,\n): TraitWarning | undefined {\n\tif (!isNodeClassWithCompatibleVariableTypes(node.__class)) return\n\tif (handle.variable.type === \"divider\") {\n\t\treturn {\n\t\t\tkey: \"variableBinding\",\n\t\t\tapplied: false,\n\t\t\tmessage: \"Dividers cannot be bound to nodes.\",\n\t\t}\n\t}\n\n\tconst compatibleTypes: readonly VariableType[] = compatibleVariableTypesByNode[node.__class]\n\tconst variableType = handle.variable.type\n\n\tif (!compatibleTypes.includes(variableType)) {\n\t\treturn {\n\t\t\tkey: \"variableBinding\",\n\t\t\tapplied: false,\n\t\t\tmessage: `Variable type \"${variableType}\" is not compatible with ${node.__class}. Expected: ${compatibleTypes.join(\", \")}.`,\n\t\t}\n\t}\n\n\tconst repeaterContext = getNearestAncestorRepeaterContextForPending(node, ctx)\n\tconst inCollectionRepeater = repeaterContext?.inRepeatedChild && isCollectionRepeater(repeaterContext.repeater)\n\n\tif (isMultiCollectionReferenceVariableDefinition(handle.variable)) {\n\t\tif (!inCollectionRepeater) {\n\t\t\treturn {\n\t\t\t\tkey: \"variableBinding\",\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: \"Multi-collection reference variables can only be bound to nodes inside a collection repeater.\",\n\t\t\t}\n\t\t}\n\t\tif (repeaterContext.repeater.dataIdentifier !== handle.variable.dataIdentifier) {\n\t\t\treturn {\n\t\t\t\tkey: \"variableBinding\",\n\t\t\t\tapplied: false,\n\t\t\t\tmessage: \"Multi-collection reference variable's collection does not match the repeater's collection.\",\n\t\t\t}\n\t\t}\n\t} else if (\n\t\tinCollectionRepeater &&\n\t\trepeaterContext.repeater.dataIdentifier &&\n\t\thasMatchingMultiRefVariable(ctx, handle.scopeId, repeaterContext.repeater.dataIdentifier)\n\t) {\n\t\treturn {\n\t\t\tkey: \"variableBinding\",\n\t\t\tapplied: false,\n\t\t\t// This is an artificial rule that we enforce to avoid setups that are too complex.\n\t\t\tmessage:\n\t\t\t\t\"A multi-collection reference variable matching this CMS Collection List's collection is available. Under this setup, it is not allowed to add variable bindings to variables of other types. Nodes that need to be bound to other variable types must be placed outside this CMS Collection List.\",\n\t\t}\n\t}\n}\n\nfunction hasMatchingMultiRefVariable(ctx: AgentContext, scopeId: string, dataIdentifier: string): boolean {\n\tfor (const variable of ctx.dynamicValues.variablesForScope(scopeId)) {\n\t\tif (isMultiCollectionReferenceVariableDefinition(variable) && variable.dataIdentifier === dataIdentifier) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}\n\nexport const variableBinding = {\n\tfor: withVariableBinding,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<VariableBindingAttributes>\n", "import type { ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport { isModuleExportIdentifier } from \"@framerjs/shared\"\nimport type { CanvasNode, CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { createVariableReference, isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { prefixControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { isVariableReferenceHandle, looksLikeVariableReference } from \"../context/dynamicValues.ts\"\nimport { IconNodeClass } from \"../dsl.ts\"\nimport { invalidAttributeMessage, traitNotAppliedWarning } from \"./invalidValues.ts\"\nimport type { DSLAttributes, TraitDefinition } from \"./types.ts\"\n\nfunction isKnownVectorNode(\n\tnode: CanvasNode,\n\tvectorSets: AgentContext[\"vectorSets\"],\n): node is CodeComponentNode & { codeComponentIdentifier: ModuleExportIdentifierString } {\n\tif (!isCodeComponentNode(node) || !isModuleExportIdentifier(node.codeComponentIdentifier)) return false\n\treturn node.isVectorInstance || !!vectorSets.forInstanceIdentifier(node.codeComponentIdentifier)\n}\n\nasync function toAttributes(node: CanvasNode, _: MaybeCanvasNode, { dynamicValues, vectorSets }: AgentContext) {\n\tif (!isKnownVectorNode(node, vectorSets)) return\n\tif (isVariableReference(node.dynamicVectorSetIdentifier)) {\n\t\tconst dynamicValue = dynamicValues.resolveAttributeFromDynamicValue(node.dynamicVectorSetIdentifier, node)\n\t\tif (dynamicValue) return { [prefixControlPropKey(\"icon\")]: dynamicValue }\n\t}\n\n\tconst handle = await vectorSets.async.forInstanceIdentifier(node.codeComponentIdentifier)\n\tconst iconName = handle?.getName()\n\tif (!iconName) return\n\n\treturn { [prefixControlPropKey(\"icon\")]: iconName }\n}\n\nfunction invalidIconWarning(iconName: string, setName: string) {\n\treturn [\n\t\t{\n\t\t\tapplied: false,\n\t\t\tkey: prefixControlPropKey(\"icon\"),\n\t\t\tmessage: invalidAttributeMessage(iconName, `Icon is not available in set \\`${setName}\\``),\n\t\t},\n\t]\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tconst iconName = attributes[prefixControlPropKey(\"icon\")]\n\tif (!isString(iconName)) return\n\n\tif (isKnownVectorNode(node, ctx.vectorSets)) {\n\t\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(iconName, {\n\t\t\texpectedType: [ControlType.VectorSetItem],\n\t\t\tnode,\n\t\t})\n\n\t\tif (resolveHandleResult.type === \"invalid\") {\n\t\t\treturn resolveHandleResult.errorMessages.map(message =>\n\t\t\t\ttraitNotAppliedWarning(prefixControlPropKey(\"icon\"), message),\n\t\t\t)\n\t\t}\n\n\t\tif (resolveHandleResult.type === \"resolved\" && isVariableReferenceHandle(resolveHandleResult.handle)) {\n\t\t\tnode.set({ dynamicVectorSetIdentifier: resolveHandleResult.handle.reference(node) })\n\t\t\treturn\n\t\t}\n\n\t\tconst set = ctx.vectorSets.forInstanceIdentifier(node.codeComponentIdentifier)\n\t\tif (!set) return\n\n\t\tconst identifier = set.getIdentifierByName(iconName)\n\t\tif (!identifier) {\n\t\t\tif (looksLikeVariableReference(iconName)) return\n\t\t\treturn invalidIconWarning(iconName, set.name)\n\t\t}\n\n\t\tnode.set({ codeComponentIdentifier: identifier, dynamicVectorSetIdentifier: undefined })\n\t\treturn\n\t}\n\n\tif (!isCodeComponentNode(node)) return\n\n\tconst pendingInsertion = ctx.treeResolver.getPendingInsertionInfo(node.id)\n\tif (pendingInsertion?.attributes?.node !== IconNodeClass || !isString(pendingInsertion.attributes.set)) return\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(iconName, {\n\t\texpectedType: [ControlType.VectorSetItem],\n\t\tnode,\n\t})\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\treturn resolveHandleResult.errorMessages.map(message =>\n\t\t\ttraitNotAppliedWarning(prefixControlPropKey(\"icon\"), message),\n\t\t)\n\t}\n\n\tif (\n\t\tresolveHandleResult.type === \"resolved\" &&\n\t\tisVariableReferenceHandle(resolveHandleResult.handle) &&\n\t\tresolveHandleResult.handle.variable.type === ControlType.VectorSetItem\n\t) {\n\t\tnode.set({\n\t\t\tcodeComponentIdentifier: resolveHandleResult.handle.variable.initialValue.identifier,\n\t\t\tdynamicVectorSetIdentifier: createVariableReference(\n\t\t\t\tresolveHandleResult.handle.variable.id,\n\t\t\t\tresolveHandleResult.handle.scopeId,\n\t\t\t),\n\t\t})\n\t\treturn\n\t}\n\n\tconst setName = pendingInsertion.attributes.set\n\tconst pendingSet = ctx.vectorSets.forSet(setName)\n\tif (!pendingSet) {\n\t\tif (looksLikeVariableReference(iconName)) return\n\t\tctx.deferred.deferUntil(() => ctx.vectorSets.insert(setName, iconName), `Icon set \"${setName}\" is not loaded`)\n\t}\n\n\tconst identifier = pendingSet.getIdentifierByName(iconName)\n\tif (!identifier) {\n\t\tif (looksLikeVariableReference(iconName)) return\n\t\treturn invalidIconWarning(iconName, setName)\n\t}\n\n\tnode.set({ codeComponentIdentifier: identifier, dynamicVectorSetIdentifier: undefined })\n}\n\nexport const vectors = {\n\t// This trait has no attributes, but a guard is required so we use a noop guard. If any attributes are added\n\t// a more specific guard should be used to avoid them being applied to all supported nodes.\n\tfor: noopGuard,\n\tdefinition: {},\n\ttoAttributes,\n\tfromAttributes,\n} satisfies TraitDefinition<object>\n\nfunction noopGuard<T extends CanvasNode>(node: T): node is T {\n\treturn true\n}\n", "import { type CanvasNode, isScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport {\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisRedirectRouteNode,\n\tisRootNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { type WithVisibility, withVisibility } from \"document/models/CanvasTree/traits/WithVisibility.ts\"\nimport { isBooleanString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { looksLikeVariableReference } from \"../context/dynamicValues.ts\"\nimport { expectedBooleanValue, traitNotAppliedWarning, unsupportedAttributeMessage, warning } from \"./invalidValues.ts\"\nimport { dynamicValueDescription } from \"./traitDescriptions.ts\"\nimport {\n\tnodeToDSLType,\n\ttype DSLAttributes,\n\ttype TraitAttributeDefinition,\n\ttype TraitDefinition,\n\ttype TraitWarning,\n} from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithVisibility> = {\n\tvisible: {\n\t\tdescription: `boolean | ${dynamicValueDescription(\"boolean\")}`,\n\t\toptional: true,\n\t},\n}\n\nfunction supportsVisibleTrait(node: CanvasNode): node is CanvasNode & WithVisibility {\n\tif (isScopeNode(node) || isRootNode(node)) return false\n\tif (isCollectionNode(node) || isCollectionItemNode(node)) return false\n\tif (isRedirectRouteNode(node)) return false\n\treturn withVisibility(node)\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (isUndefined(attributes.visible)) return\n\n\tif (!supportsVisibleTrait(node)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: false,\n\t\t\t\tkey: \"visible\",\n\t\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t\t},\n\t\t]\n\t}\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.visible, { node })\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tnode.set({ visible: resolveHandleResult.handle.reference(node) })\n\t\treturn\n\t}\n\n\tconst warnings: TraitWarning[] = []\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"visible\", message)))\n\t}\n\n\tif (!isBooleanString(attributes.visible)) {\n\t\tif (!looksLikeVariableReference(attributes.visible)) {\n\t\t\twarnings.push(...warning(\"visible\", attributes.visible, expectedBooleanValue))\n\t\t}\n\t\treturn warnings\n\t}\n\tnode.set({ visible: attributes.visible === \"true\" })\n\treturn warnings\n}\n\nfunction toAttributes(node: CanvasNode, _parent: MaybeCanvasNode, ctx: AgentContext): DSLAttributes | undefined {\n\tif (!supportsVisibleTrait(node)) return {}\n\n\tif (isDynamicValue(node.visible)) {\n\t\treturn {\n\t\t\tvisible: ctx.dynamicValues.resolveAttributeFromDynamicValue(node.visible, node),\n\t\t}\n\t}\n\n\tconst visible = node.resolveValue(\"visible\")\n\tif (isUndefined(visible) || visible === true) return {}\n\n\treturn {\n\t\tvisible: \"false\",\n\t}\n}\n\nexport const visible = {\n\tfor: supportsVisibleTrait,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<WithVisibility>\n", "import { assert, isEmptyObject, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport type { CanvasNode, CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tisCodeComponentNode,\n\tisSmartComponentNode,\n\tisVectorInstance,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isLocalSmartComponentInstance } from \"document/models/CanvasTree/nodes/utils/smartComponentInstanceHelpers.ts\"\nimport {\n\thasWhileOpenEffect,\n\ttype WithWhileOpenEffect,\n\twithWhileOpenEffect,\n} from \"document/models/CanvasTree/traits/WithWhileOpenEffect.ts\"\nimport { fallbackTitleForOption } from \"utils/enumControlUtils.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { ComponentInstanceNodeClass, IconNodeClass } from \"../dsl.ts\"\nimport { isNullString, nullString } from \"./helpers.ts\"\nimport { singleWarning, unsupportedAttributeMessage } from \"./invalidValues.ts\"\nimport { nodeToDSLType, type DSLAttributes, type TraitAttributeDefinition, type TraitDefinition } from \"./types.ts\"\n\nconst attributeKey = \"whileOpen\" as const\n\ninterface WhileOpenAttributes {\n\t[attributeKey]: string\n}\n\nconst expectedWhileOpenValue = `a valid variant name or id or ${nullString}`\n\nconst definition = {\n\t[attributeKey]: {\n\t\tdescription: `variant-id | variant-name | ${nullString}`,\n\t},\n} as const satisfies TraitAttributeDefinition<WhileOpenAttributes>\n\nfunction supportsWhileOpen(node: CanvasNode, ctx?: AgentContext): node is CodeComponentNode & WithWhileOpenEffect {\n\tif (!withWhileOpenEffect(node) || !isCodeComponentNode(node) || isVectorInstance(node)) return false\n\n\tif (ctx?.treeResolver.getPendingInsertionInfo(node.id)?.attributes?.node === IconNodeClass) return false\n\n\treturn !(\n\t\tisModuleExportIdentifier(node.codeComponentIdentifier) &&\n\t\tctx?.vectorSets.forInstanceIdentifier(node.codeComponentIdentifier)\n\t)\n}\n\nfunction resolveLocalVariant(node: CodeComponentNode, value: string, ctx: AgentContext): string | undefined {\n\tconst scopeId = node.getLocalSmartComponentNodeId()\n\tif (!scopeId) return\n\n\tconst smartComponent = ctx.treeResolver.get(scopeId)\n\tif (!isSmartComponentNode(smartComponent)) return\n\n\tif (!smartComponent.isLoaded()) {\n\t\tctx.deferred.deferUntil(\n\t\t\t() => smartComponent.load(),\n\t\t\t`Cannot set ${attributeKey}: component source for \"${node.id}\" is not loaded.`,\n\t\t)\n\t}\n\n\tconst resolvedId = ctx.treeResolver.get(value)?.id\n\tfor (const variant of smartComponent.getTopLevelVariants()) {\n\t\tif (variant.id === value || variant.id === resolvedId) return variant.id\n\t\tif (variant.resolveValue(\"name\") === value) return variant.id\n\t}\n}\n\nfunction resolveExternalVariant(node: CodeComponentNode, value: string, ctx: AgentContext): string | undefined {\n\tconst identifier = node.codeComponentIdentifier\n\tassert(isModuleExportIdentifier(identifier), \"Expected a module export identifier\")\n\n\tconst component = ctx.components.forIdentifier(identifier, {\n\t\tdeferUntilLoaded: true,\n\t\tdeferMessage: `Cannot set ${attributeKey}: component definition for \"${ctx.components.getIdForModuleIdentifier(identifier)}\" is not loaded.`,\n\t})\n\n\tconst variantControl = component?.controls?.properties()?.variant\n\tif (!variantControl || !(\"options\" in variantControl)) return\n\n\tfor (let index = 0; index < variantControl.options.length; index++) {\n\t\tconst optionId = variantControl.options[index]?.toString()\n\t\tif (!optionId) continue\n\t\tconst optionTitle = variantControl.optionTitles?.[index] ?? fallbackTitleForOption(optionId)\n\t\tif (optionId === value || optionTitle === value) return optionId\n\t}\n}\n\nfunction resolveWhileOpenVariant(node: CodeComponentNode, value: string, ctx: AgentContext): string | undefined {\n\tif (isLocalSmartComponentInstance(node)) return resolveLocalVariant(node, value, ctx)\n\treturn resolveExternalVariant(node, value, ctx)\n}\n\nfunction serializeWhileOpenVariant(node: CodeComponentNode, ctx: AgentContext): string | undefined {\n\tconst value = node.whileOpenEffectVariant\n\tif (!isString(value)) return\n\n\tif (isLocalSmartComponentInstance(node)) {\n\t\treturn ctx.treeResolver.getLlmId(value) ?? value\n\t}\n\n\treturn value\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tconst value = attributes[attributeKey]\n\tif (isUndefined(value)) return\n\n\tif (!supportsWhileOpen(node, ctx)) {\n\t\treturn [\n\t\t\t{\n\t\t\t\tapplied: false,\n\t\t\t\tkey: attributeKey,\n\t\t\t\tmessage: unsupportedAttributeMessage(nodeToDSLType(node, ctx)),\n\t\t\t},\n\t\t]\n\t}\n\n\tif (isNullString(value)) {\n\t\tnode.set({ whileOpenEffectEnabled: false, whileOpenEffectVariant: undefined })\n\t\treturn\n\t}\n\n\tif (!isString(value)) return [singleWarning(attributeKey, value, expectedWhileOpenValue)]\n\n\tconst variantId = resolveWhileOpenVariant(node, value, ctx)\n\tif (!variantId) return [singleWarning(attributeKey, value, expectedWhileOpenValue)]\n\n\tconst update: Partial<WithWhileOpenEffect> = {\n\t\twhileOpenEffectEnabled: true,\n\t\twhileOpenEffectVariant: variantId,\n\t}\n\n\tif (!isEmptyObject(update)) {\n\t\tnode.set(update)\n\t}\n}\n\nfunction toAttributes(\n\tnode: CanvasNode,\n\t_parent: CanvasNode | null | undefined,\n\tctx: AgentContext,\n): DSLAttributes | undefined {\n\tif (!supportsWhileOpen(node, ctx) || !hasWhileOpenEffect(node)) return\n\n\tconst variant = serializeWhileOpenVariant(node, ctx)\n\tif (!variant) return\n\n\treturn { [attributeKey]: variant }\n}\n\nexport const whileOpen = {\n\tfor: { nodes: [ComponentInstanceNodeClass] },\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes,\n} satisfies TraitDefinition<WhileOpenAttributes>\n", "import type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport {\n\ttype WithZIndex,\n\tgetDefaultZIndex,\n\tmaxZIndex,\n\twithZIndex,\n} from \"document/models/CanvasTree/traits/WithZIndex.ts\"\nimport {\n\tisPositionAbsolute,\n\tisPositionFixed,\n\tisPositionSticky,\n} from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport { tryParseNumber } from \"utils/tryParseNumber.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { looksLikeVariableReference } from \"../context/dynamicValues.ts\"\nimport { unsupportedAttributesWarnings } from \"./helpers.ts\"\nimport { expectedNumberValue, traitNotAppliedWarning, warning } from \"./invalidValues.ts\"\nimport { dynamicValueDescription } from \"./traitDescriptions.ts\"\nimport type { DSLAttributes, TraitAttributeDefinition, TraitDefinition, TraitWarning } from \"./types.ts\"\n\nconst definition: TraitAttributeDefinition<WithZIndex> = {\n\tzIndex: {\n\t\tdescription: `number (max ${maxZIndex}) | ${dynamicValueDescription(\"number\")}`,\n\t\toptional: true,\n\t},\n}\n\nfunction fromAttributes(node: CanvasNode, attributes: DSLAttributes, ctx: AgentContext) {\n\tif (!withZIndex(node)) return unsupportedAttributesWarnings(node, attributes, definition, ctx)\n\n\tconst warnings: TraitWarning[] = []\n\n\tconst resolveHandleResult = ctx.dynamicValues.resolveHandleFromAttribute(attributes.zIndex, { node })\n\n\tif (resolveHandleResult.type === \"resolved\") {\n\t\tnode.set({ zIndex: resolveHandleResult.handle.reference(node) })\n\t\treturn warnings\n\t}\n\n\tif (resolveHandleResult.type === \"invalid\") {\n\t\twarnings.push(...resolveHandleResult.errorMessages.map(message => traitNotAppliedWarning(\"zIndex\", message)))\n\t}\n\n\tconst zIndex = tryParseNumber(attributes.zIndex, true)\n\tif (isUndefined(zIndex)) {\n\t\tif (!isUndefined(attributes.zIndex) && !looksLikeVariableReference(attributes.zIndex)) {\n\t\t\twarnings.push(...warning(\"zIndex\", attributes.zIndex, expectedNumberValue + ` (max ${maxZIndex})`))\n\t\t}\n\t\treturn warnings\n\t}\n\n\tnode.set({ zIndex })\n\treturn warnings\n}\n\nexport const zIndex = {\n\tfor: withZIndex,\n\tdefinition,\n\tfromAttributes,\n\ttoAttributes: (node, _parent, ctx) => {\n\t\tif (!withZIndex(node)) return\n\t\tif (isUndefined(node.zIndex)) return\n\n\t\tif (isDynamicValue(node.zIndex)) {\n\t\t\treturn {\n\t\t\t\tzIndex: ctx.dynamicValues.resolveAttributeFromDynamicValue(node.zIndex, node),\n\t\t\t}\n\t\t}\n\n\t\tconst defaultZIndex = getDefaultZIndex(\n\t\t\tisPositionSticky(node) || isPositionFixed(node) || isPositionAbsolute(node),\n\t\t\thasFloatingPosition(node),\n\t\t)\n\n\t\tconst zIndexValue = node.resolveValue(\"zIndex\")\n\t\tif (zIndexValue === defaultZIndex) return\n\n\t\treturn {\n\t\t\tzIndex: zIndexValue?.toString(),\n\t\t}\n\t},\n} satisfies TraitDefinition<WithZIndex>\n", "import { unflatten } from \"app/ai/utils/flatten.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { RejectedCommandError, RejectedCommandKind } from \"../RejectedCommandError.ts\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { applyTrait } from \"../context/deferred.ts\"\nimport { isRejectedCommandError } from \"../context/issues.ts\"\nimport { hydrateAndSerializeRichText } from \"../context/richtext/serialize.ts\"\nimport { appearEffect } from \"./appearEffect.ts\"\nimport { aspectRatio } from \"./aspectRatio.ts\"\nimport { backdrop } from \"./backdrop.ts\"\nimport { blendingMode } from \"./blendingMode.ts\"\nimport { blockquote } from \"./blockquote.ts\"\nimport { blockquoteStylePreset } from \"./blockquoteStylePreset.ts\"\nimport { border } from \"./border.ts\"\nimport { boxShadows } from \"./boxShadows.ts\"\nimport { colorStyle } from \"./colorStyle.ts\"\nimport { componentPreset } from \"./componentPreset.ts\"\nimport { controls } from \"./controls.ts\"\nimport { cursor } from \"./cursor.ts\"\nimport { dragEffect } from \"./dragEffect.ts\"\nimport { fill } from \"./fill.ts\"\nimport { filters } from \"./filters.ts\"\nimport { flowEffect } from \"./flowEffect.ts\"\nimport { formBooleanInputType } from \"./formBooleanInputType.ts\"\nimport { formContainer } from \"./formContainer.ts\"\nimport { formInput } from \"./formInput.ts\"\nimport { formInputAutofillEnabled } from \"./formInputAutofillEnabled.ts\"\nimport { formInputFocusedStyle } from \"./formInputFocusedStyle.ts\"\nimport { formInputIcon } from \"./formInputIcon.ts\"\nimport { formInputInvalidStyles } from \"./formInputInvalidStyles.ts\"\nimport { formInputPlaceholder } from \"./formInputPlaceholder.ts\"\nimport { formInputStep } from \"./formInputStep.ts\"\nimport { formInputType } from \"./formInputType.ts\"\nimport { formSelect } from \"./formSelect.ts\"\nimport { formVariants } from \"./formVariants.ts\"\nimport { componentEvents, frameEvents } from \"./frameEvents.ts\"\nimport { gridItem } from \"./gridItem.ts\"\nimport { hoverEffect } from \"./hoverEffect.ts\"\nimport { htmlTag } from \"./htmlTag.ts\"\nimport { imageStylePreset } from \"./imageStylePreset.ts\"\nimport { inlineCodeStyle } from \"./inlineCodeStyle.ts\"\nimport { inlineCodeStylePreset } from \"./inlineCodeStylePreset.ts\"\nimport { layout } from \"./layout.ts\"\nimport { layoutTemplate } from \"./layoutTemplate.ts\"\nimport { lightboxEffect } from \"./lightboxEffect.ts\"\nimport { link } from \"./link.ts\"\nimport { linkStyle } from \"./linkStyle.ts\"\nimport { linkStylePreset } from \"./linkStylePreset.ts\"\nimport { linkTransition } from \"./linkTransition.ts\"\nimport { loopEffect } from \"./loopEffect.ts\"\nimport { masks } from \"./masks.ts\"\nimport { metadata, rootMetadata } from \"./metadata.ts\"\nimport { name } from \"./name.ts\"\nimport { opacity } from \"./opacity.ts\"\nimport { overflow } from \"./overflow.ts\"\nimport { overscroll } from \"./overscroll.ts\"\nimport { padding } from \"./padding.ts\"\nimport { paragraphSpacing } from \"./paragraphSpacing.ts\"\nimport { parallaxEffect } from \"./parallaxEffect.ts\"\nimport { placement } from \"./placement.ts\"\nimport { radius } from \"./radius.ts\"\nimport { redirect } from \"./redirect.ts\"\nimport { relativeOverlay } from \"./relativeOverlay.ts\"\nimport { repeater } from \"./repeater.ts\"\nimport { rootFontSize } from \"./rootFontSize.ts\"\nimport { rotation } from \"./rotation.ts\"\nimport { scrollTarget } from \"./scrollTarget.ts\"\nimport { scrollVariantEffect } from \"./scrollVariantEffect.ts\"\nimport { size } from \"./size.ts\"\nimport { sizeConstraints } from \"./sizeConstraints.ts\"\nimport { squircle } from \"./squircle.ts\"\nimport { styleTransformEffect } from \"./styleTransformEffect.ts\"\nimport { tableStyle } from \"./tableStyle.ts\"\nimport { tableStylePreset } from \"./tableStylePreset.ts\"\nimport { tapEffect } from \"./tapEffect.ts\"\nimport { text } from \"./text.ts\"\nimport { textEffect } from \"./textEffect.ts\"\nimport { textSelection } from \"./textSelection.ts\"\nimport { textStyleTraitDefinitionsByName } from \"./textStyle/textStyle.ts\"\nimport { textStylePreset } from \"./textStylePreset.ts\"\nimport { textStylePresetBreakpoint } from \"./textStylePresetBreakpoint.ts\"\nimport { textStylePresetsByTag } from \"./textStylePresetsByTag.ts\"\nimport { textTag } from \"./textTag.ts\"\nimport { textTruncation } from \"./textTruncation.ts\"\nimport { textVerticalAlignment } from \"./textVerticalAlignment.ts\"\nimport { textWrapBalance } from \"./textWrapBalance.ts\"\nimport { tickerEffect } from \"./tickerEffect.ts\"\nimport { traitsToAttributes } from \"./traitsToAttributes.ts\"\nimport { transition } from \"./transition.ts\"\nimport type { DSLAttributes, TraitDefinition, TraitSerializers } from \"./types.ts\"\nimport { userSelect } from \"./userSelect.ts\"\nimport { variableBinding } from \"./variableBinding.ts\"\nimport { vectors } from \"./vectors.ts\"\nimport { visible } from \"./visible.ts\"\nimport { whileOpen } from \"./whileOpen.ts\"\nimport { zIndex } from \"./zIndex.ts\"\n\n/* Please keep alphabetically sorted to avoid conflicts in snapshots */\nexport const supportedTraitsByName = {\n\tappearEffect,\n\taspectRatio,\n\tbackdrop,\n\tblendingMode,\n\tblockquote,\n\tblockquoteStylePreset,\n\tborder,\n\tboxShadows,\n\tcolorStyle,\n\tcomponentEvents,\n\tcomponentPreset,\n\tcontrols,\n\tcursor,\n\tdragEffect,\n\tfill,\n\tfilters,\n\tflowEffect,\n\tformBooleanInputType,\n\tformContainer,\n\tformInput,\n\tformInputAutofillEnabled,\n\tformInputFocusedStyle,\n\tformInputIcon,\n\tformInputInvalidStyles,\n\tformInputPlaceholder,\n\tformInputStep,\n\tformInputType,\n\tformSelect,\n\tformVariants,\n\tframeEvents,\n\tgridItem,\n\thoverEffect,\n\thtmlTag,\n\timageStylePreset,\n\tinlineCodeStyle,\n\tinlineCodeStylePreset,\n\tlayout,\n\tlayoutTemplate,\n\tlightboxEffect,\n\tlink,\n\tlinkStyle,\n\tlinkStylePreset,\n\tlinkTransition,\n\tloopEffect,\n\tmasks,\n\tmetadata,\n\tname,\n\topacity,\n\toverflow,\n\toverscroll,\n\tpadding,\n\tparagraphSpacing,\n\tparallaxEffect,\n\tplacement,\n\tradius,\n\tredirect,\n\trelativeOverlay,\n\trepeater,\n\trootFontSize,\n\trootMetadata,\n\trotation,\n\tscrollTarget,\n\tscrollVariantEffect,\n\tsize,\n\tsizeConstraints,\n\tsquircle,\n\tstyleTransformEffect,\n\ttableStyle,\n\ttableStylePreset,\n\ttapEffect,\n\ttext,\n\ttextEffect,\n\ttextSelection,\n\ttextTruncation,\n\t...textStyleTraitDefinitionsByName,\n\ttextWrapBalance,\n\ttextStylePreset,\n\ttextStylePresetBreakpoint,\n\ttextStylePresetsByTag,\n\ttextTag,\n\ttextVerticalAlignment,\n\ttickerEffect,\n\ttransition,\n\tuserSelect,\n\tvariableBinding,\n\tvectors,\n\tvisible,\n\twhileOpen,\n\tzIndex,\n} as const satisfies Record<string, TraitDefinition<object>>\n\ntype SupportedTraitsByName = typeof supportedTraitsByName\ntype TraitDefinitions = SupportedTraitsByName[keyof SupportedTraitsByName][\"definition\"]\n\ntype KeysOf<T> = T extends object ? keyof T : never\nexport type TraitKey = KeysOf<TraitDefinitions>\n\nexport const supportedTraits: readonly TraitDefinition<object>[] = Object.values(supportedTraitsByName)\n\nexport function toAttributes(\n\tnode: CanvasNode,\n\tparent: MaybeCanvasNode,\n\tctx: AgentContext,\n\tserializers: TraitSerializers = { richText: hydrateAndSerializeRichText },\n): Promise<DSLAttributes> {\n\treturn traitsToAttributes(supportedTraits, node, parent, ctx, serializers)\n}\n\nexport function fromAttributes(\n\tnode: CanvasNode,\n\tattributes: Record<string, string | undefined>,\n\tctx: AgentContext,\n\trawDsl: string,\n) {\n\ttry {\n\t\tconst unflattened = unflatten(attributes)\n\t\tfor (const trait of supportedTraits) {\n\t\t\tnode = ctx.treeStore.tree.current(node) ?? node\n\t\t\tapplyTrait(node, trait, unflattened, ctx, rawDsl)\n\t\t}\n\t} catch (error) {\n\t\tif (isRejectedCommandError(error)) {\n\t\t\tthrow error\n\t\t}\n\n\t\tthrow new RejectedCommandError(\n\t\t\tRejectedCommandKind.FromAttributesFailed,\n\t\t\terror instanceof Error ? error.message : undefined,\n\t\t)\n\t}\n}\n", "import { assert, assertNever, emptyArray, getLogger, isEmptyObject, isModuleExportIdentifier } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { createMediaQueriesFromBreakpoints } from \"code-generation/components/helpers/breakpoints.ts\"\nimport { countChildNodes } from \"document/components/utils/countChildNodes.ts\"\nimport { getRawWebPagePath } from \"document/components/utils/getWebPagePath.ts\"\nimport type { TaskScheduler } from \"document/loader/TaskScheduler.ts\"\nimport {\n\ttype CanvasNode,\n\ttype CanvasTree,\n\ttype NodeID,\n\ttype ScopeNode,\n\tisScopeNode,\n\ttype AnyWebPageNode,\n\ttype AnyLayoutTemplateNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport type { MaybeCanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport {\n\tisCodeComponentNode,\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisColorStyleTokenNode,\n\tisLayoutTemplateNode,\n\tisOverlayNode,\n\tisRichTextNode,\n\tisRootNode,\n\tisRedirectRouteNode,\n\tisShaderNode,\n\tisSlotNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getGeneratedValue } from \"document/models/CanvasTree/traits/Generated.ts\"\nimport { isVariableReference } from \"document/models/CanvasTree/traits/VariableReference.ts\"\nimport { withBreakpointVariants } from \"document/models/CanvasTree/traits/WithBreakpointVariants.ts\"\nimport { withDOMLayout } from \"document/models/CanvasTree/traits/WithDOMLayout.ts\"\nimport {\n\ttype WithItemsOrder,\n\thasItemsOrderOverride,\n\tsupportsItemsOrder,\n} from \"document/models/CanvasTree/traits/WithItemsOrder.ts\"\nimport { isPinnable } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport { withReplicaVariants } from \"document/models/CanvasTree/traits/WithReplicaVariants.ts\"\nimport { hasRootFontSize } from \"document/models/CanvasTree/traits/WithRootFontSize.ts\"\nimport type { Loaded } from \"document/models/CanvasTree/traits/WithScopeLoader.ts\"\nimport {\n\ttype IsReplica,\n\ttype IsReplicaChild,\n\tisReplica,\n\tisReplicaChild,\n\tisReplicaOrReplicaChild,\n} from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport {\n\tisBreakpointVariant,\n\tisPrimaryVariant,\n\tisReplicaVariant,\n\twithVariant,\n\ttype GestureType,\n} from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isPositionRelative } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport { Rect } from \"library/index.ts\"\nimport { DimensionType } from \"library/render/types/Constraints.ts\"\nimport { getCollectionIdForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { join } from \"utils/join.ts\"\nimport { isArray, isNull, isNumber, isObject, isObjectWithKey, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getCollectionNameForPage, normalizeRouteForLLM } from \"../../utils/siteMap.ts\"\nimport type { SelectionForContext } from \"../Agent.ts\"\nimport {\n\tComponentInstanceNodeClass,\n\tComponentNodeClass,\n\ttype DSLNodeClass,\n\tFixedOverlayNodeClass,\n\tIconNodeClass,\n\tisSpecialCaseClassDiscriminator,\n\tRelativeOverlayNodeClass,\n\tRedirectNodeClass,\n\trootNodeId,\n} from \"../dsl.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { serializeVariablesForAgent } from \"../tools/collectionSchema.ts\"\nimport type { nextCursorResultField } from \"../tools/nodeById/cursor.ts\"\nimport { truncatedPlaceholderType } from \"../tools/nodeById/truncatedPlaceholderType.ts\"\nimport type { DeletedNodeChange } from \"../tools/serializeChanges.ts\"\nimport { toAttributes } from \"../traits/attributes.ts\"\nimport { getNameValue } from \"../traits/name.ts\"\nimport type { DSLAttributes } from \"../traits/types.ts\"\nimport type { AgentContext } from \"./AgentContext.ts\"\nimport { getSpecialCaseDSLNodeClass } from \"./dslNodeClass.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\nimport type { VirtualTargetAttributeFilter } from \"./nodeAttributeChanges.ts\"\nimport type { RichTextTarget, VirtualRichTextNode, VirtualRichTextRoot } from \"./richtext/document.ts\"\nimport {\n\ttype SerializedVirtualTextNode,\n\ttype SerializedVirtualTextRootNode,\n\ttype TextBlockquoteNode,\n\ttype TextBulletListNode,\n\ttype TextListItemNode,\n\ttype TextMediaBlockNode,\n\ttype TextBlockNode,\n\ttype TextLineBreakNode,\n\ttype TextNumberedListNode,\n\ttype TextRunNode,\n\ttype TextTableCellNode,\n\ttype TextTableNode,\n\ttype TextTableRowNode,\n\ttype UnsupportedBlockNode,\n\ttype VirtualAttributeFilter,\n\tserializeVirtualText,\n} from \"./richtext/serialize.ts\"\nimport { getVirtualRichTextChildren } from \"./richtext/traversal.ts\"\nimport { filterSerializedKeyValues } from \"./serializeAttributes.ts\"\nimport type { SerializedVariable } from \"./serializeVariable.ts\"\n\ninterface Node extends Metadata {\n\ttype: string\n\tid: NodeID\n\tname?: string\n\tattributes?: Record<string, unknown>\n}\n\nexport interface TruncatedNodePlaceholder {\n\ttype: typeof truncatedPlaceholderType\n\t[nextCursorResultField]: number\n\tremainingChildren: number\n\tmessage: string\n}\ninterface MediaQueryMetadata {\n\trange: string\n\tname: string\n}\n\ninterface MetadataVariant {\n\tid: NodeID\n\tname: string\n}\n\ninterface MetadataBreakpoint extends MetadataVariant {\n\tmediaQueryRange: string | undefined\n\trootFontSize: number | undefined\n}\n\nexport interface Metadata {\n\t$isPrimary?: boolean\n\t$isReplica?: boolean\n\t$truncated?: boolean\n\t$descendantCount?: number\n\t$rect?: Partial<Rect>\n\t$mediaQuery?: MediaQueryMetadata\n\t$parentId?: NodeID\n\t$groundNodeId?: NodeID\n\t$scopeId?: NodeID\n\t$layoutTemplateId?: NodeID\n\t$path?: string\n\t$detailPageId?: NodeID\n\t$itemCount?: number\n\t$originalId?: NodeID\n\t$inheritsFrom?: NodeID\n\t$gesture?: GestureType\n\t$replicaId?: NodeID\n\t$variants?: readonly MetadataVariant[]\n\t$breakpoints?: readonly MetadataBreakpoint[]\n\t/** Display name of the referenced component (virtual, not stored). */\n\t$componentDisplayName?: string\n\t$layoutTemplateDisplayName?: string\n}\n\nexport function serializeVirtualMetadata(key: keyof Metadata, value?: Metadata[keyof Metadata]): string {\n\tif (isUndefined(value)) return escapeValue(key)\n\tif (isArray(value) || isObject(value)) return escapeValue(`${key}:${JSON.stringify(value)}`)\n\treturn escapeValue(`${key}:${value}`)\n}\n\ntype AllSerializedNodeClasses = DSLNodeClass | SerializedVirtualTextNode[\"type\"] | ReadonlyNodeAliases\n\nexport interface AnyNode extends Node {\n\ttype: DSLNodeClass\n\tchildren?: AIContextNodeChild[]\n}\n\nexport interface RedactedNode extends Omit<Node, \"attributes\" | \"type\"> {\n\ttype: AllSerializedNodeClasses\n\tmessage: string\n}\n\nconst redactedNodeKey = \"message\" satisfies keyof RedactedNode\nexport function isRedactedNode(node: AIContextNode | ChangesAIContextNode): node is RedactedNode {\n\treturn redactedNodeKey in node && isString(node.message)\n}\n\nconst nameKey = \"name\"\nexport function getName(node: AIContextNode): string | undefined {\n\tif (nameKey in node && isString(node.name)) return node.name\n\tif (!hasAttributes(node)) return\n\treturn isString(node.attributes.name) ? node.attributes.name : undefined\n}\n\ninterface ComponentInstanceNode extends Node {\n\ttype: typeof ComponentInstanceNodeClass\n\tcomponent: string\n\tchildren?: readonly AIContextNodeChild[]\n}\n\ninterface ShaderInstanceNode extends Node {\n\ttype: ClassDiscriminator.ShaderNode\n\tshader: string\n}\n\ninterface TextNode extends Node {\n\ttype: ClassDiscriminator.RichTextNode\n\tchildren?: readonly SerializedVirtualTextRootNode[]\n}\n\ninterface IconNode extends Node {\n\ttype: typeof IconNodeClass\n\tset: string\n\t$control__icon: string\n}\n\ninterface ColorStyleTokenNode extends Node {\n\ttype: ClassDiscriminator.ColorStyleTokenNode\n\tlight: string\n\tdark?: string\n}\n\ninterface SmartComponentNode extends Node {\n\ttype: typeof ComponentNodeClass\n\tname: string\n\tvariables: SerializedVariable[]\n}\n\ninterface CollectionNode extends Node {\n\ttype: ClassDiscriminator.CollectionNode\n\tname: string\n\tvariables: SerializedVariable[]\n}\n\ninterface WebPageNode extends Node {\n\ttype: ClassDiscriminator.WebPageNode\n\tname: string\n\tvariables: SerializedVariable[]\n}\n\ninterface LayoutTemplateNode extends Node {\n\ttype: ClassDiscriminator.LayoutTemplateNode\n\tname: string\n\tvariables: SerializedVariable[]\n}\n\ninterface LayoutTemplatePlaceholderNode extends Node {\n\ttype: typeof PlaceholderNodeClass\n\tid: string\n}\n\n// Readonly, cannot be target node of a DSL command.\nexport const PlaceholderNodeClass = \"PlaceholderNode\" as const\nconst readonlyNodeAliases = [PlaceholderNodeClass] as const\nexport type ReadonlyNodeAliases = (typeof readonlyNodeAliases)[number]\n\ninterface RootNode extends Node {\n\ttype: ClassDiscriminator.RootNode\n}\n\ntype WithOptionalId<T extends { id: string }> = T extends { id: string } ? Omit<T, \"id\"> & { id?: NodeID } : never\nexport type WithRequiredId<T extends { id?: string }> = T extends { id?: string }\n\t? Omit<T, \"id\"> & { id: NodeID }\n\t: never\n\nexport type AIContextNode =\n\t| AnyNode\n\t| TextNode\n\t| IconNode\n\t| ComponentInstanceNode\n\t| ShaderInstanceNode\n\t| ColorStyleTokenNode\n\t| SmartComponentNode\n\t| TextRunNode\n\t| TextLineBreakNode\n\t| TextBlockNode\n\t| TextBlockquoteNode\n\t| TextTableNode\n\t| TextTableRowNode\n\t| TextTableCellNode\n\t| TextBulletListNode\n\t| TextNumberedListNode\n\t| TextListItemNode\n\t| TextMediaBlockNode\n\t| UnsupportedBlockNode\n\t| CollectionNode\n\t| WebPageNode\n\t| LayoutTemplateNode\n\t| LayoutTemplatePlaceholderNode\n\t| RootNode\n\t| RedactedNode\n\nexport interface TransformToAiNodeOptions {\n\tincludeMediaQueryRange?: boolean\n\tincludeRect?: boolean\n\tattributeFilter?: ReadonlySet<string>\n\tattributeFilterMarkNullOnUndefined?: boolean\n\tvirtualAttributeFiltersByTarget?: ReadonlyMap<RichTextTarget, VirtualTargetAttributeFilter>\n}\n\nexport interface VirtualRichTextTreeMismatchState {\n\tbeforeRoots: readonly VirtualRichTextRoot[] | undefined\n\thydratedRoots: readonly VirtualRichTextRoot[]\n}\n\nexport type ChangesAIContextNode = WithOptionalId<AIContextNode>\n\nexport function isAIContextNode(value: unknown): value is AIContextNode {\n\treturn (\n\t\tisObjectWithKey<keyof AIContextNode>(value, \"id\") &&\n\t\tisObjectWithKey<keyof AIContextNode>(value, \"type\") &&\n\t\tisString(value.id) &&\n\t\tisString(value.type) &&\n\t\t!isTruncatedNodePlaceholder(value)\n\t)\n}\n\nexport function hydrateToAIContextNode(nodeId: string, node: ChangesAIContextNode): AIContextNode {\n\treturn {\n\t\t...(node as AIContextNode),\n\t\tid: node.id ?? nodeId,\n\t}\n}\n\nfunction isTruncatedNodePlaceholder(value: unknown): value is TruncatedNodePlaceholder {\n\treturn isObjectWithKey<keyof TruncatedNodePlaceholder>(value, \"type\") && value.type === truncatedPlaceholderType\n}\n\nexport function isDeletedNodeChange(value: unknown): value is DeletedNodeChange {\n\treturn isObjectWithKey<keyof DeletedNodeChange>(value, \"deleted\") && value.deleted === true\n}\n\nexport function isAiContextTextNode(node: AIContextNode): node is TextNode {\n\treturn node.type === ClassDiscriminator.RichTextNode\n}\n\nconst key = \"children\" satisfies keyof AnyNode\nexport function hasChildren<T extends AIContextNode>(\n\tnode: T,\n): node is Extract<T, { children: readonly AIContextNodeChild[] }> {\n\treturn key in node && isArray(node.children) && node.children.length > 0\n}\n\nconst attributesKey = \"attributes\" satisfies keyof AnyNode\nexport function hasAttributes<T extends AIContextNode>(node: T): node is T & { attributes: Record<string, unknown> } {\n\treturn attributesKey in node\n}\n\nfunction shouldUseChildrenInVisualOrder<T extends CanvasNode>(\n\tparent: CanvasNode,\n): parent is T & (WithItemsOrder & (IsReplica | IsReplicaChild)) {\n\treturn supportsItemsOrder(parent) && isReplicaOrReplicaChild(parent) && hasItemsOrderOverride(parent)\n}\n\nexport function getContextChildNodes(parent: CanvasNode): readonly CanvasNode[] {\n\tif (shouldUseChildrenInVisualOrder(parent)) {\n\t\treturn parent.getChildrenInVisualOrder()\n\t}\n\treturn parent.children?.toArray() ?? emptyArray()\n}\n\nfunction getCodeComponentContextChildren(\n\tnode: CanvasNode,\n\tctx: AgentContext,\n\tincludeChildren: boolean,\n): readonly CanvasNode[] {\n\tif (!includeChildren || !node.children?.length) return emptyArray()\n\n\treturn getContextChildNodes(node).filter(child => {\n\t\tconst nodeClass = getSpecialCaseDSLNodeClass(child, ctx, node)\n\t\treturn nodeClass === FixedOverlayNodeClass || nodeClass === RelativeOverlayNodeClass\n\t})\n}\n\nfunction serialize<T extends object>(\n\ttree: CanvasTree | undefined,\n\tcanvasNode: CanvasNode,\n\tparent: MaybeCanvasNode,\n\tnode: T,\n\tattributes?: DSLAttributes,\n\tchildren?: AIContextNode[],\n\toptions?: TransformToAiNodeOptions,\n\tnodeMetadata?: Metadata,\n): T {\n\tconst metadata: Metadata = {}\n\tcollectMetadata(tree, canvasNode, metadata, {\n\t\tparent,\n\t\tincludeMediaQueryRange: options?.includeMediaQueryRange,\n\t\tincludeRect: options?.includeRect,\n\t})\n\tconst collectedMetadata = filterSerializedKeyValues(metadata, options?.attributeFilter, {\n\t\tfilter: path => Object.hasOwn(metadata, path[0]) || hoistedAttributeKeys.has(path[0]),\n\t\t// Because filter removes all keys not present in attributes anyway, this option would not work as `true`\n\t\t// marking false to highlight that and also that attributeFilterMarkNullOnUndefined is intended for attributes only, not metadata.\n\t\tmarkNullOnUndefined: false,\n\t})\n\n\tObject.assign(node, collectedMetadata)\n\tif (nodeMetadata && !isEmptyObject(nodeMetadata)) {\n\t\tObject.assign(node, nodeMetadata)\n\t}\n\n\t// Put attributes after metadata.\n\tconst resolvedAttributes = attributes\n\t\t? filterSerializedKeyValues(attributes, options?.attributeFilter, {\n\t\t\t\tfilter: path => !Object.hasOwn(metadata, path[0]) && !hoistedAttributeKeys.has(path[0]),\n\t\t\t\tmarkNullOnUndefined: options?.attributeFilterMarkNullOnUndefined,\n\t\t\t})\n\t\t: undefined\n\tif (resolvedAttributes && !isEmptyObject(resolvedAttributes)) {\n\t\tObject.assign(node, { attributes: resolvedAttributes })\n\t}\n\n\t// Put children last.\n\tif (children) {\n\t\tObject.assign(node, { children })\n\t}\n\n\treturn node\n}\n\n/**\n * A fixed dimension is redundant with the node's attributes unless a min/max constraint\n * clamps the rendered size to a different value.\n */\nfunction isFixedDimensionRedundant(node: CanvasNode, axis: \"x\" | \"y\", roundedDimension: number): boolean {\n\tif (!isPinnable(node)) return false\n\n\tswitch (axis) {\n\t\tcase \"x\":\n\t\t\tif (node.widthType !== DimensionType.FixedNumber) return false\n\t\t\treturn Math.round(node.width * 100) / 100 === roundedDimension\n\t\tcase \"y\":\n\t\t\tif (node.heightType !== DimensionType.FixedNumber) return false\n\t\t\treturn Math.round(node.height * 100) / 100 === roundedDimension\n\t\tdefault:\n\t\t\tassertNever(axis)\n\t}\n}\n\n/**\n * Returns a partial rect, omitting fields that are redundant with the node's own attributes:\n * - width/height are omitted when the node uses a fixed pixel dimension whose rendered size\n *   matches the declared value (i.e. not clamped by min/max constraints)\n * - x/y are omitted when the node is not position-relative (i.e. absolutely positioned either\n *   explicitly or implicitly by not being inside a layout parent) \u2014 placement is expressed via\n *   pin attributes instead\n */\nfunction collectContextRect(\n\ttree: CanvasTree | undefined,\n\tnode: CanvasNode,\n\tparent: MaybeCanvasNode,\n\tmetadata: Metadata,\n): void {\n\tif (!tree) return\n\n\tif (isCollectionNode(node) || isCollectionItemNode(node) || isRedirectRouteNode(node)) return\n\tif (isMissingRequiredDOMRect(node)) return\n\n\tconst rounded = getRoundedContextRect(tree, node)\n\tif (!rounded) return\n\n\tconst serializePosition = isPositionRelative(node, parent)\n\tconst serializeWidth = !isFixedDimensionRedundant(node, \"x\", rounded.width)\n\tconst serializeHeight = !isFixedDimensionRedundant(node, \"y\", rounded.height)\n\n\tif (!serializePosition && !serializeWidth && !serializeHeight) return\n\n\tconst result: Partial<Rect> = {}\n\tif (serializePosition) result.x = rounded.x\n\tif (serializePosition) result.y = rounded.y\n\tif (serializeWidth) result.width = rounded.width\n\tif (serializeHeight) result.height = rounded.height\n\n\tif (isEmptyObject(result)) return\n\n\tmetadata.$rect = result\n}\n\nfunction isMissingRequiredDOMRect(node: CanvasNode): boolean {\n\tif (!withDOMLayout(node)) return false\n\tif (!node.usesDOMRect()) return false\n\treturn node.getDOMRect() === null\n}\n\nexport function getRoundedContextRect(tree: CanvasTree, node: CanvasNode): Rect {\n\tconst domRect = tree.getRect(node, false, true)\n\tconst rounded = Rect.round(domRect, 2)\n\n\treturn rounded\n}\n\nfunction collectMediaQueryRange(\n\ttree: CanvasTree | undefined,\n\tnode: CanvasNode,\n\tparent: MaybeCanvasNode,\n\tmetadata: Metadata,\n): void {\n\tif (!tree) return\n\n\tconst isTopLevelSelection = !parent\n\tconst breakpoint = isTopLevelSelection ? tree.getGroundNodeFor(node) : node\n\tif (!isBreakpointVariant(breakpoint)) return\n\n\tconst scope = tree.getScopeNodeFor(breakpoint)\n\tconst mediaQuery = getMediaQueryRange(scope, breakpoint)\n\tif (!mediaQuery) return\n\n\tmetadata.$mediaQuery = {\n\t\trange: mediaQuery,\n\t\tname: getGeneratedValue(breakpoint.name) ?? Dictionary.Breakpoint,\n\t}\n}\n\nfunction getMediaQueryRange(scope: ScopeNode | null | undefined, breakpoint: CanvasNode): string | undefined {\n\tif (!withBreakpointVariants(scope)) return\n\tconst breakpoints = scope.getBreakpointValues()\n\tconst mediaQueries = createMediaQueriesFromBreakpoints(breakpoints)\n\treturn mediaQueries[breakpoint.id]\n}\n\nfunction collectVariants(scope: CanvasNode, metadata: Metadata): void {\n\tif (!withReplicaVariants(scope) || !isScopeNode(scope) || !scope.isLoaded()) return\n\n\tif (isWebPageNode(scope) || isLayoutTemplateNode(scope)) {\n\t\tmetadata.$breakpoints = scope.getTopLevelVariants().map(variant => ({\n\t\t\tid: variant.id,\n\t\t\tname: variant.resolveValue(\"name\") ?? Dictionary.Breakpoint,\n\t\t\tmediaQueryRange: getMediaQueryRange(scope, variant),\n\t\t\trootFontSize: hasRootFontSize(variant) ? variant.rootFontSize : undefined,\n\t\t}))\n\t}\n\n\tif (!isSmartComponentNode(scope)) return\n\n\tmetadata.$variants = scope.getVariants().map(variant => ({\n\t\tid: variant.id,\n\t\tname: variant.resolveValue(\"name\") ?? Dictionary.Variant,\n\t}))\n}\n\nfunction collectReplica(node: CanvasNode, metadata: Metadata): void {\n\tif (isReplica(node)) {\n\t\tmetadata.$gesture = withVariant(node) ? node.gesture : undefined\n\t\tmetadata.$originalId = node.replicaInfo?.master\n\t\tmetadata.$inheritsFrom = node.replicaInfo?.inheritsFrom\n\t\treturn\n\t}\n\tif (!isReplicaChild(node)) return\n\n\tconst replicaId = node.id.slice(0, -node.originalid.length)\n\n\t// TODO: Try to remove replicaId to reduce the size of the context (require inference to go from\n\t// ReplicaChildId + ChildId to ReplicaId)\n\tmetadata.$replicaId = replicaId\n\tmetadata.$originalId = node.originalid\n}\n\nfunction collectTopLevelContextIds(\n\ttree: CanvasTree | undefined,\n\tnode: CanvasNode,\n\tparent: MaybeCanvasNode,\n\tmetadata: Metadata,\n): void {\n\tif (!tree || isRootNode(node) || isRedirectRouteNode(node)) return\n\n\tconst isTopLevelSelection = !parent\n\tif (!isTopLevelSelection) return\n\n\tconst parentId = tree.getParentId(node)\n\tif (parentId) metadata.$parentId = parentId\n\n\tconst groundNode = tree.getGroundNodeFor(node)\n\tif (groundNode && groundNode.id !== node.id) metadata.$groundNodeId = groundNode.id\n\n\tconst scopeNode = isScopeNode(node) ? node : tree.getScopeNodeFor(node)\n\tif (scopeNode && scopeNode.id !== node.id) metadata.$scopeId = scopeNode.id\n\n\tconst layoutTemplate = getLayoutTemplateForNode(tree, node)\n\tif (!layoutTemplate) return\n\n\tmetadata.$layoutTemplateId = layoutTemplate.id\n\tmetadata.$layoutTemplateDisplayName = layoutTemplate.resolveValue(\"name\") ?? undefined\n}\n\nfunction nodeHasRect(node: CanvasNode): boolean {\n\tif (isRootNode(node)) return false\n\tif (isLayoutTemplateNode(node)) return false\n\tif (isWebPageNode(node)) return false\n\tif (isCollectionNode(node)) return false\n\tif (isCollectionItemNode(node)) return false\n\tif (isColorStyleTokenNode(node)) return false\n\tif (isShaderNode(node)) return false\n\tif (isSmartComponentNode(node)) return false\n\n\treturn true\n}\n\nexport function collectMetadata(\n\ttree: CanvasTree | undefined,\n\tnode: CanvasNode,\n\tmetadata: Metadata,\n\toptions: {\n\t\tparent?: MaybeCanvasNode\n\t\tincludeMediaQueryRange?: boolean\n\t\tincludeRect?: boolean\n\t} = {},\n): void {\n\tconst { parent, includeMediaQueryRange = true, includeRect = true } = options\n\n\tif (isPrimaryVariant(node)) metadata.$isPrimary = true\n\tif (isReplicaVariant(node)) metadata.$isReplica = true\n\tcollectTopLevelContextIds(tree, node, parent, metadata)\n\tcollectReplica(node, metadata)\n\n\tif (includeRect && nodeHasRect(node)) {\n\t\tcollectContextRect(tree, node, parent, metadata)\n\t}\n\n\tif (includeMediaQueryRange) {\n\t\tcollectMediaQueryRange(tree, node, parent, metadata)\n\t}\n\tcollectVariants(node, metadata)\n}\n\nfunction resolveDetailPageIdForCollection(tree: CanvasTree, collectionId: NodeID): NodeID | undefined {\n\tfor (const page of tree.root.children) {\n\t\tif (!isWebPageNode(page) || !page.dataIdentifier) continue\n\t\tif (getCollectionIdForIdentifier(page.dataIdentifier) !== collectionId) continue\n\n\t\t// Skip A/B test variants to avoid multiple pages mapping to the same path.\n\t\tif (page.abTestingParentId) continue\n\t\treturn page.id\n\t}\n}\n\nfunction resolveWebPagePathForContext(tree: CanvasTree, page: AnyWebPageNode): string | undefined {\n\tconst path = getRawWebPagePath(tree, page)\n\tif (!path) return\n\n\tconst collectionName = getCollectionNameForPage(tree, page)\n\n\treturn normalizeRouteForLLM(path, collectionName)\n}\n\nconst hoistedAttributeNames = [\"$control__icon\", \"name\"] as const\nconst hoistedAttributeKeys = new Set<string>(hoistedAttributeNames)\ntype HoistedAttributeKey = (typeof hoistedAttributeNames)[number]\nfunction isHoistedAttributeKey(key: string): key is HoistedAttributeKey {\n\treturn hoistedAttributeKeys.has(key)\n}\n\nasync function transformNode(\n\tnode: CanvasNode,\n\tparent: MaybeCanvasNode,\n\tctx: AgentContext,\n\tincludeChildren: boolean,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: TransformToAiNodeOptions,\n): Promise<AIContextNode | null> {\n\tawait taskScheduler?.yield()\n\n\tconst id = node.id\n\tconst tree = ctx.treeStore.getDataTreeOrPartialTree()\n\n\t// Hydrate up front so rich-text traits called from toAttributes can read the doc root.\n\tlet richTextBlocks: VirtualRichTextRoot[] | undefined = undefined\n\tif (isRichTextNode(node) && !isVariableReference(node.htmlContent)) {\n\t\trichTextBlocks = ctx.virtualText.hydrate(node)?.children\n\t}\n\n\tconst attributes: typeof collectedAttributes = {}\n\tconst hoistedAttributes: Partial<Record<HoistedAttributeKey, unknown>> = {}\n\tconst collectedAttributes = await toAttributes(node, parent, ctx)\n\tfor (const attributeKey in collectedAttributes) {\n\t\tif (isHoistedAttributeKey(attributeKey)) {\n\t\t\thoistedAttributes[attributeKey] = collectedAttributes[attributeKey]\n\t\t} else {\n\t\t\tattributes[attributeKey] = collectedAttributes[attributeKey]\n\t\t}\n\t}\n\tconst name = hoistedAttributes[nameKey]\n\n\tif (isRootNode(node)) {\n\t\treturn serialize<RootNode>(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: ClassDiscriminator.RootNode,\n\t\t\t\tid: rootNodeId,\n\t\t\t},\n\t\t\tattributes,\n\t\t\tundefined,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tif (isCodeComponentNode(node) && isModuleExportIdentifier(node.codeComponentIdentifier)) {\n\t\t// Normally, the node determines it is a vector based on the module identifier. If identifier is\n\t\t// external we use the tree to determine the external module type. When we are deserializing\n\t\t// examples, we don't have the external module data, but we have already created the Agent\n\t\t// Context and can check if this is an icon recorded.\n\t\t// TODO: Consider a way to make sure that other examples don't hit this foot-gun.\n\t\tif (node.isVectorInstance || ctx.vectorSets.forInstanceIdentifier(node.codeComponentIdentifier)) {\n\t\t\tconst set = await ctx.vectorSets.async.forInstanceIdentifier(node.codeComponentIdentifier)\n\t\t\tif (!set || isNull(hoistedAttributes.$control__icon)) return null\n\n\t\t\treturn serialize(\n\t\t\t\ttree,\n\t\t\t\tnode,\n\t\t\t\tparent,\n\t\t\t\t{\n\t\t\t\t\ttype: IconNodeClass,\n\t\t\t\t\tid,\n\t\t\t\t\tname: isString(name) ? name : undefined,\n\t\t\t\t\tset: set.name,\n\t\t\t\t\t$control__icon: hoistedAttributes.$control__icon,\n\t\t\t\t},\n\t\t\t\tattributes,\n\t\t\t\tundefined,\n\t\t\t\toptions,\n\t\t\t)\n\t\t} else {\n\t\t\tconst component = ctx.components.getIdForModuleIdentifier(node.codeComponentIdentifier)\n\t\t\tif (!component) return null\n\n\t\t\tconst codeComponentChildren = getCodeComponentContextChildren(node, ctx, includeChildren)\n\t\t\tconst children =\n\t\t\t\tcodeComponentChildren.length > 0\n\t\t\t\t\t? await transformChildNodes(codeComponentChildren, node, ctx, taskScheduler, options)\n\t\t\t\t\t: undefined\n\n\t\t\treturn serialize(\n\t\t\t\ttree,\n\t\t\t\tnode,\n\t\t\t\tparent,\n\t\t\t\t{\n\t\t\t\t\ttype: ComponentInstanceNodeClass,\n\t\t\t\t\tid,\n\t\t\t\t\tname: isString(name) ? name : undefined,\n\t\t\t\t\tcomponent,\n\t\t\t\t},\n\t\t\t\tattributes,\n\t\t\t\tchildren,\n\t\t\t\toptions,\n\t\t\t\t{ $componentDisplayName: ctx.components.getDisplayName(node.codeComponentIdentifier) },\n\t\t\t)\n\t\t}\n\t}\n\n\tif (isShaderNode(node)) {\n\t\tconst shader = await ctx.shaders.async.forIdentifier(node.shaderModuleIdentifier)\n\t\tif (!shader) return null\n\n\t\treturn serialize<ShaderInstanceNode>(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: ClassDiscriminator.ShaderNode,\n\t\t\t\tid,\n\t\t\t\tname: isString(name) ? name : undefined,\n\t\t\t\tshader: shader.name,\n\t\t\t},\n\t\t\tattributes,\n\t\t\tundefined,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tif (isRichTextNode(node)) {\n\t\tconst virtualAttributeFilter = options?.virtualAttributeFiltersByTarget?.get(node.id)\n\t\tconst remappedVirtualAttributeFilter = richTextBlocks\n\t\t\t? remapAttributeFilterVirtualNodeIds(virtualAttributeFilter, richTextBlocks)\n\t\t\t: undefined\n\n\t\t// When a variable is bound to the RichTextNode the underlying blocks/runs still exist,\n\t\t// but the agent must not edit them \u2014 suppress virtual children in the serialized output.\n\t\tconst hasVariableContent = !isUndefined(node.htmlContent) || !isUndefined(node.textContent)\n\t\tconst children =\n\t\t\trichTextBlocks && !hasVariableContent\n\t\t\t\t? await serializeVirtualText(richTextBlocks, ctx, remappedVirtualAttributeFilter, taskScheduler, {\n\t\t\t\t\t\tmarkNullOnUndefined: options?.attributeFilterMarkNullOnUndefined,\n\t\t\t\t\t})\n\t\t\t\t: undefined\n\n\t\treturn serialize<TextNode>(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: ClassDiscriminator.RichTextNode,\n\t\t\t\tname: isString(name) ? name : undefined,\n\t\t\t\tid,\n\t\t\t},\n\t\t\tattributes,\n\t\t\tchildren,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tif (isColorStyleTokenNode(node)) {\n\t\tif (node.softDeleted) return null\n\t\treturn serialize<ColorStyleTokenNode>(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: ClassDiscriminator.ColorStyleTokenNode,\n\t\t\t\tid,\n\t\t\t\tname: isString(name) ? name : undefined,\n\t\t\t\tlight: node.light,\n\t\t\t\tdark: node.dark,\n\t\t\t},\n\t\t\tattributes,\n\t\t\tundefined,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tif (isCollectionItemNode(node)) {\n\t\treturn serialize<AnyNode>(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: ClassDiscriminator.CollectionItemNode,\n\t\t\t\tid,\n\t\t\t},\n\t\t\tattributes,\n\t\t\tundefined,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tconst children =\n\t\tnode.children?.length && includeChildren\n\t\t\t? await transformChildNodes(node.children, node, ctx, taskScheduler, options)\n\t\t\t: undefined\n\n\tif (isRedirectRouteNode(node)) {\n\t\treturn serialize(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: RedirectNodeClass,\n\t\t\t\tid,\n\t\t\t},\n\t\t\tattributes,\n\t\t\tchildren,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tif (isSmartComponentNode(node)) {\n\t\t// Ensure that we have the component definition loaded for the smart component node, so that we\n\t\t// report external vector sets.\n\t\tawait ctx.components.async.forIdentifier(node.instanceIdentifier)\n\n\t\treturn serialize<SmartComponentNode & { children?: AIContextNode[] }>(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: ComponentNodeClass,\n\t\t\t\tid,\n\t\t\t\tname: isString(name) ? name : Dictionary.Component,\n\t\t\t\tvariables: await serializeVariablesForAgent(tree, node, ctx),\n\t\t\t},\n\t\t\tattributes,\n\t\t\tchildren,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tif (isCollectionNode(node)) {\n\t\treturn serialize<CollectionNode & { children?: AIContextNode[] }>(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: ClassDiscriminator.CollectionNode,\n\t\t\t\tid,\n\t\t\t\tname: isString(name) ? name : Dictionary.Collection,\n\t\t\t\tvariables: await serializeVariablesForAgent(tree, node, ctx),\n\t\t\t\t$itemCount: node.getItemCount(),\n\t\t\t\t$detailPageId: resolveDetailPageIdForCollection(tree, node.id),\n\t\t\t},\n\t\t\tattributes,\n\t\t\tchildren,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tif (isWebPageNode(node)) {\n\t\treturn serialize<WebPageNode & { children?: AIContextNode[] }>(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: ClassDiscriminator.WebPageNode,\n\t\t\t\tid,\n\t\t\t\tname: isString(name) ? name : Dictionary.WebPage,\n\t\t\t\tvariables: await serializeVariablesForAgent(tree, node, ctx),\n\t\t\t\t$path: resolveWebPagePathForContext(tree, node),\n\t\t\t},\n\t\t\tattributes,\n\t\t\tchildren,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tif (isLayoutTemplateNode(node)) {\n\t\treturn serialize<LayoutTemplateNode & { children?: AIContextNode[] }>(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: ClassDiscriminator.LayoutTemplateNode,\n\t\t\t\tid,\n\t\t\t\tname: isString(name) ? name : Dictionary.Template,\n\t\t\t\tvariables: await serializeVariablesForAgent(tree, node, ctx),\n\t\t\t},\n\t\t\tattributes,\n\t\t\tchildren,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tif (isSlotNode(node)) {\n\t\treturn { type: PlaceholderNodeClass, id: node.id }\n\t}\n\n\tif (getSpecialCaseDSLNodeClass(node, ctx, parent) === RelativeOverlayNodeClass) {\n\t\treturn serialize(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: RelativeOverlayNodeClass,\n\t\t\t\tid,\n\t\t\t\tname: isString(name) ? name : undefined,\n\t\t\t},\n\t\t\tattributes,\n\t\t\tchildren,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tif (isOverlayNode(node)) {\n\t\treturn serialize(\n\t\t\ttree,\n\t\t\tnode,\n\t\t\tparent,\n\t\t\t{\n\t\t\t\ttype: FixedOverlayNodeClass,\n\t\t\t\tid,\n\t\t\t},\n\t\t\tattributes,\n\t\t\tchildren,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tassert(!isSpecialCaseClassDiscriminator(node.__class), \"Node is a special case class\")\n\n\treturn serialize(\n\t\ttree,\n\t\tnode,\n\t\tparent,\n\t\t{\n\t\t\ttype: node.__class,\n\t\t\tname: isString(name) ? name : undefined,\n\t\t\tid,\n\t\t},\n\t\tattributes,\n\t\tchildren,\n\t\toptions,\n\t)\n}\n\nconst log = getLogger(\"ai:agents\")\n\nfunction remapAttributeFilterVirtualNodeIds(\n\tfilter: VirtualTargetAttributeFilter | undefined,\n\thydratedRoots: readonly VirtualRichTextRoot[],\n): VirtualAttributeFilter | undefined {\n\tif (!filter) return\n\n\t// The tree can mismatch because of bugs,\n\t// but it can also mismatch because prosemirror normalises trees in ways which are hard to reconcile.\n\t// We therefore can't guarantee that we can remap IDs in every situation, and want to log these situations for later analysis\n\tfunction mismatchingTree(): undefined {\n\t\tconst state: VirtualRichTextTreeMismatchState = {\n\t\t\tbeforeRoots: filter?.sourceRoots,\n\t\t\thydratedRoots,\n\t\t}\n\n\t\tlog.warn(\"Virtual rich text tree structure does not match the filter's source tree\", state)\n\n\t\trecord(\"agent_unhandled_case\", {\n\t\t\tcase: \"nodes/remap_virtual_tree_ids_tree_mismatch\",\n\t\t\tstate: JSON.stringify(state),\n\t\t})\n\n\t\treturn undefined\n\t}\n\n\tconst remappedIds = new Map<string, string>()\n\n\t// we walk the tree using a queue to keep it simple and fast\n\tconst queue: [VirtualRichTextNode, VirtualRichTextNode][] = []\n\tfunction zipNodes(beforeRoots: readonly VirtualRichTextNode[], afterRoots: readonly VirtualRichTextNode[]): boolean {\n\t\tif (beforeRoots.length !== afterRoots.length) {\n\t\t\treturn false\n\t\t}\n\n\t\tfor (let index = 0; index < beforeRoots.length; index++) {\n\t\t\tconst before = beforeRoots[index]\n\t\t\tconst after = afterRoots[index]\n\t\t\tif (!before || !after) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tqueue.push([before, after])\n\t\t}\n\n\t\treturn true\n\t}\n\n\t// Enumerate entire tree and build node mappings\n\tconst didZipRoots = zipNodes(filter.sourceRoots, hydratedRoots)\n\tif (!didZipRoots) {\n\t\treturn mismatchingTree()\n\t}\n\twhile (queue.length > 0) {\n\t\tconst pair = queue.shift()\n\t\tassert(pair, \"Queue cannot be empty here\")\n\n\t\tconst [before, after] = pair\n\t\tif (before.type !== after.type) {\n\t\t\treturn mismatchingTree()\n\t\t}\n\t\tremappedIds.set(before.id, after.id)\n\n\t\tconst beforeChildren = getVirtualRichTextChildren(before) ?? emptyArray()\n\t\tconst afterChildren = getVirtualRichTextChildren(after) ?? emptyArray()\n\t\tconst didZipChildren = zipNodes(beforeChildren, afterChildren)\n\t\tif (!didZipChildren) {\n\t\t\treturn mismatchingTree()\n\t\t}\n\t}\n\n\t// Update IDs\n\tconst remappedAttributesByNodeId: Map<string, ReadonlySet<string>> = new Map()\n\tfor (const [beforeVirtualNodeId, virtualNodeAttributes] of filter.attributesByNodeId) {\n\t\tconst remappedId = remappedIds.get(beforeVirtualNodeId)\n\t\tif (!remappedId) return\n\t\tremappedAttributesByNodeId.set(remappedId, virtualNodeAttributes)\n\t}\n\n\treturn remappedAttributesByNodeId\n}\n\nasync function transformChildNodes(\n\tnodes: Iterable<CanvasNode>,\n\tparent: CanvasNode,\n\tctx: AgentContext,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: TransformToAiNodeOptions,\n): Promise<AIContextNode[]> {\n\tconst sourceNodes = shouldUseChildrenInVisualOrder(parent) ? parent.getChildrenInVisualOrder() : nodes\n\tconst result: AIContextNode[] = []\n\tfor (const node of sourceNodes) {\n\t\tconst context = await transformNode(node, parent, ctx, true, taskScheduler, options)\n\t\tif (context) result.push(context)\n\t}\n\treturn result\n}\n\nexport function* walkContextNodeWithSkipChildren(root: AIContextNode): IterableIterator<{\n\tnode: AIContextNode\n\tskipChildren: () => void\n}> {\n\tconst children = hasChildren(root) ? root.children : emptyArray<AIContextNode>()\n\tlet shouldSkipChildren = false\n\tyield {\n\t\tnode: root,\n\t\tskipChildren() {\n\t\t\tshouldSkipChildren = true\n\t\t},\n\t}\n\tif (shouldSkipChildren || children.length === 0) return\n\tfor (const child of children) {\n\t\tif (!child || !isAIContextNode(child)) continue\n\t\tyield* walkContextNodeWithSkipChildren(child)\n\t}\n}\n\nasync function applyDepthLimitToContextNode(\n\tnode: AIContextNode,\n\tdepth: number,\n\ttaskScheduler?: TaskScheduler,\n): Promise<AIContextNode> {\n\tawait taskScheduler?.yield()\n\n\tif (!hasChildren(node)) return node\n\n\tif (depth <= 0) {\n\t\tconst descendantCount = await countContextDescendants(node, taskScheduler)\n\t\treturn {\n\t\t\t...node,\n\t\t\tchildren: undefined,\n\t\t\t$truncated: true,\n\t\t\t$descendantCount: descendantCount,\n\t\t} satisfies AIContextNode\n\t}\n\n\tconst children: AIContextNodeChild[] = []\n\tfor (const child of node.children) {\n\t\tchildren.push(isAIContextNode(child) ? await applyDepthLimitToContextNode(child, depth - 1, taskScheduler) : child)\n\t}\n\n\treturn {\n\t\t...node,\n\t\tchildren,\n\t}\n}\n\nasync function countContextDescendants(node: AIContextNode, taskScheduler?: TaskScheduler): Promise<number> {\n\tlet count = 0\n\tfor (const { node: descendant } of walkContextNodeWithSkipChildren(node)) {\n\t\tif (count % 100 === 0) await taskScheduler?.yield()\n\t\tif (descendant === node) continue\n\t\tcount++\n\t}\n\treturn count\n}\n\n/** Snapshot of a node and it's key context for the LLM. */\ninterface AIContextNodeSnapshot extends Metadata {\n\tid: NodeID\n\tname?: string\n}\n\nfunction transformToAiNodeSnapshot(nodes: readonly CanvasNode[], ctx: AgentContext): readonly AIContextNodeSnapshot[] {\n\tconst tree = ctx.treeStore.getDataTreeOrPartialTree()\n\treturn nodes.map(node => {\n\t\treturn serialize(tree, node, null, {\n\t\t\tid: node.id,\n\t\t\tname: getNameValue(tree, node),\n\t\t})\n\t})\n}\n\n/**\n * Get the layout template applied on the ancestor of a given node.\n * @TODO: For now we only do this for web pages and breakpoints, consider supporting it for node\n * queries in general.\n */\nfunction getLayoutTemplateForNode(\n\ttree: CanvasTree,\n\tnode: CanvasNode | Loaded<ScopeNode>,\n): AnyLayoutTemplateNode | null {\n\tif (isWebPageNode(node)) {\n\t\treturn node.getLayoutTemplateNode(tree)\n\t}\n\n\tif (isBreakpointVariant(node)) {\n\t\tconst scope = tree.getScopeNodeFor(node)\n\t\tif (!isWebPageNode(scope)) return null\n\t\treturn scope.getLayoutTemplateNode(tree)\n\t}\n\n\treturn null\n}\n\nexport async function transformToAiNode(\n\tnodes: readonly (CanvasNode | Loaded<ScopeNode>)[],\n\tctx: AgentContext,\n\tincludeChildren = true,\n\tmaxDepth?: number,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: TransformToAiNodeOptions,\n): Promise<AIContextNode[]> {\n\tconst normalizedMaxDepth = isNumber(maxDepth) ? Math.max(0, maxDepth) : undefined\n\tconst result: AIContextNode[] = []\n\tfor (const node of nodes) {\n\t\tconst context = await transformNode(node, null, ctx, includeChildren, taskScheduler, options)\n\t\tif (context) result.push(context)\n\t}\n\n\tif (!isNumber(normalizedMaxDepth)) return result\n\n\tconst limitedResult: AIContextNode[] = []\n\tfor (const node of result) {\n\t\tlimitedResult.push(await applyDepthLimitToContextNode(node, normalizedMaxDepth, taskScheduler))\n\t}\n\treturn limitedResult\n}\n\nexport async function transformCanvasNodeToAiContext(\n\tnode: CanvasNode,\n\tctx: AgentContext,\n\tparent: MaybeCanvasNode,\n\tincludeChildren = true,\n\tmaxDepth?: number,\n\ttaskScheduler?: TaskScheduler,\n\toptions?: TransformToAiNodeOptions,\n): Promise<AIContextNode | null> {\n\tconst normalizedMaxDepth = isNumber(maxDepth) ? Math.max(0, maxDepth) : undefined\n\n\tconst result = await transformNode(node, parent, ctx, includeChildren, taskScheduler, options)\n\tif (!result) return null\n\n\tif (!isNumber(normalizedMaxDepth)) return result\n\treturn applyDepthLimitToContextNode(result, normalizedMaxDepth, taskScheduler)\n}\n\n/**\n * Arbitrary threshold to determine if we should use a snapshot of the selection instead of the full\n * context node/tree.\n */\nconst SELECTION_SIZE_THRESHOLD = 50\nconst SELECTION_SERIALIZED_TEXT_LENGTH_THRESHOLD = 20_000\n\nfunction getSelectionSize(nodes: readonly CanvasNode[], includeChildren: boolean): number {\n\treturn nodes.reduce((acc, node) => acc + (includeChildren ? countChildNodes(node) + 1 : 1), 0)\n}\n\nfunction serializeSelectionContextMessage(\n\tselectionTag: typeof metadataTags.selectedNodes | typeof metadataTags.selectedNodeIds,\n\tselectionPayload: unknown,\n): string {\n\treturn serializeSelectionContextMessageFromJson(selectionTag, JSON.stringify(selectionPayload))\n}\n\nfunction serializeSelectionContextMessageFromJson(\n\tselectionTag: typeof metadataTags.selectedNodes | typeof metadataTags.selectedNodeIds,\n\tselectionJson: string,\n): string {\n\treturn join.lines(`<${selectionTag}>`, selectionJson, `</${selectionTag}>`)\n}\n\nfunction serializeSelectedNodesContextMessage(\n\tselectionPayload: readonly AIContextNode[],\n\tliteSelectionNodes: readonly CanvasNode[],\n\tctx: AgentContext,\n): string {\n\tconst selectionJson = JSON.stringify(selectionPayload)\n\tif (selectionJson.length <= SELECTION_SERIALIZED_TEXT_LENGTH_THRESHOLD) {\n\t\treturn serializeSelectionContextMessageFromJson(metadataTags.selectedNodes, selectionJson)\n\t}\n\n\treturn serializeSelectionContextMessage(\n\t\tmetadataTags.selectedNodeIds,\n\t\ttransformToAiNodeSnapshot(liteSelectionNodes, ctx),\n\t)\n}\n\nasync function serializeMixedSelectionContextMessage(\n\tshallowSelectionNodes: readonly CanvasNode[],\n\tfullySerializedNodes: readonly CanvasNode[],\n\tliteSelectionNodes: readonly CanvasNode[],\n\tctx: AgentContext,\n): Promise<string> {\n\tconst [shallowContextNodes, fullContextNodes] = await Promise.all([\n\t\ttransformToAiNode(shallowSelectionNodes, ctx, false),\n\t\ttransformToAiNode(fullySerializedNodes, ctx, true),\n\t])\n\treturn serializeSelectedNodesContextMessage([...shallowContextNodes, ...fullContextNodes], liteSelectionNodes, ctx)\n}\n\ninterface PartitionedSelection {\n\tshallowCandidates: Set<NodeID>\n\tfull: Set<NodeID>\n}\n\n/** Split selection into prompt-referenced nodes that may be shallow vs. fully-serialized nodes. */\nfunction partitionSelection(selectionForContext: SelectionForContext): PartitionedSelection {\n\tconst shallowCandidates: Set<NodeID> = new Set()\n\tconst full: Set<NodeID> = new Set()\n\n\tfor (const [nodeId, skimmed] of selectionForContext) {\n\t\tif (skimmed) shallowCandidates.add(nodeId)\n\t\telse full.add(nodeId)\n\t}\n\n\treturn { shallowCandidates, full }\n}\n\ntype SelectionStrategy =\n\t| { kind: \"full\"; nodes: readonly CanvasNode[]; liteNodes: readonly CanvasNode[] }\n\t| { kind: \"mixed\"; shallow: readonly CanvasNode[]; full: readonly CanvasNode[]; liteNodes: readonly CanvasNode[] }\n\t| { kind: \"snapshot\"; nodes: readonly CanvasNode[] }\n\nfunction pickSelectionStrategy(tree: CanvasTree, shallowIds: Set<NodeID>, fullIds: Set<NodeID>): SelectionStrategy {\n\t// In \"full\" mode event `shallow` candidates are serialized in full, so any explicit selection that is\n\t// already nested under a shallow root is redundant and gets dropped.\n\tconst explicitlyFullNodes = tree.getNodes(fullIds)\n\tconst dedupedFullNodes = tree.withoutDescendants(explicitlyFullNodes)\n\tconst shallowNodes = tree.getNodes(shallowIds)\n\tconst selectedContextRoots = [...shallowNodes, ...dedupedFullNodes]\n\tconst serializedTextFallbackNodes = [...shallowNodes, ...explicitlyFullNodes]\n\tconst prunedContextRoots = tree.withoutDescendants(selectedContextRoots)\n\n\tconst fullSize = getSelectionSize(prunedContextRoots, true)\n\tif (fullSize <= SELECTION_SIZE_THRESHOLD) {\n\t\treturn { kind: \"full\", nodes: prunedContextRoots, liteNodes: serializedTextFallbackNodes }\n\t}\n\n\tif (shallowNodes.length > 0) {\n\t\t// In \"mixed\" mode shallow roots lose their children, so overlapping full nodes are\n\t\t// no longer duplicated. Include every explicit selection at top level.\n\t\tconst mixedSize = getSelectionSize(shallowNodes, false) + getSelectionSize(dedupedFullNodes, true)\n\t\tif (mixedSize <= SELECTION_SIZE_THRESHOLD) {\n\t\t\treturn {\n\t\t\t\tkind: \"mixed\",\n\t\t\t\tshallow: shallowNodes,\n\t\t\t\tfull: dedupedFullNodes,\n\t\t\t\tliteNodes: serializedTextFallbackNodes,\n\t\t\t}\n\t\t}\n\t}\n\n\treturn { kind: \"snapshot\", nodes: selectedContextRoots }\n}\n\n/**\n * Builds the <selected-nodes> (or <selected-node-ids>) context message.\n *\n * `shallowNodeIds` are IDs already referenced by the prompt (e.g. page/component mentions).\n * Their children can be omitted when needed to save tokens, because the LLM can fetch them on demand.\n *\n * Strategy (first that fits within SELECTION_SIZE_THRESHOLD wins):\n *   1. \"full\":     shallow roots are serialized with children; explicit selections that already\n *                  live inside a shallow subtree are dropped to avoid duplication.\n *   2. \"mixed\":    shallow roots are serialized without children; explicit selections with children.\n *   3. \"snapshot\": fall back to IDs + name metadata only.\n */\nexport async function createSelectedNodesContextMessage(\n\tselectionForContext: SelectionForContext,\n\tctx: AgentContext,\n): Promise<string> {\n\tconst tree = ctx.treeStore.getDataTreeOrPartialTree()\n\n\tconst { shallowCandidates, full: rawFull } = partitionSelection(selectionForContext)\n\tconst strategy = pickSelectionStrategy(tree, shallowCandidates, rawFull)\n\n\tswitch (strategy.kind) {\n\t\tcase \"full\":\n\t\t\treturn serializeSelectedNodesContextMessage(await transformToAiNode(strategy.nodes, ctx), strategy.liteNodes, ctx)\n\t\tcase \"mixed\":\n\t\t\treturn serializeMixedSelectionContextMessage(strategy.shallow, strategy.full, strategy.liteNodes, ctx)\n\t\tcase \"snapshot\":\n\t\t\treturn serializeSelectionContextMessage(\n\t\t\t\tmetadataTags.selectedNodeIds,\n\t\t\t\ttransformToAiNodeSnapshot(strategy.nodes, ctx),\n\t\t\t)\n\t\tdefault:\n\t\t\tassertNever(strategy)\n\t}\n}\n\nexport type AIContextNodeChild = AIContextNode | TruncatedNodePlaceholder\n", "import { assert, murmurHash } from \"@framerjs/shared\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { z } from \"zod/v4\"\nimport { getContextChildNodes } from \"../../context/nodes.ts\"\nimport { escapeValue } from \"../../prompt/utils.ts\"\n\nexport const cursorQueryField = \"cursor\" as const\nexport const nextCursorResultField = \"nextCursor\" as const\nexport const reasonQueryField = \"reason\" as const\nexport const hintQueryField = \"hint\" as const\n\nexport const truncatedNodeMessage = `Read truncated at this boundary. Continue with the provided ${escapeValue(nextCursorResultField)} to load the remaining subtree.`\nexport const cursorStaleRestartHint = `The tree changed since the last partial read. Restart the same node-by-id query without ${escapeValue(cursorQueryField)}.`\nexport const cursorInvalidRestartHint = `The provided ${escapeValue(cursorQueryField)} is invalid for this query. Retry with a correct one, or restart the same node-by-id query without ${escapeValue(cursorQueryField)}.`\nexport const readTooLargeNarrowingHint = `The requested node cannot fit safely for this query shape. Narrow the read to a smaller subtree. ${escapeValue(\"descendants:false\")} only removes children, so it will not help when the node itself is oversized.`\nexport const continuationBlockedHint = `The previous partial read could not advance because the next omitted subtree still exceeds the safe read budget. Do not retry the same ${escapeValue(cursorQueryField)}. Narrow the read or query a smaller subtree instead.`\nexport const cursorStaleReason = \"cursor-stale\"\nexport const cursorInvalidReason = \"cursor-invalid\"\nexport const readTooLargeReason = \"read-too-large\"\nexport const continuationBlockedReason = \"continuation-blocked\"\n\ninterface NodeByIdCursorQuery {\n\tid: string\n\tdescendants?: boolean\n\tattributeFilter?: readonly string[]\n\t[cursorQueryField]?: number\n}\n\nexport type NodeByIdErrorReason =\n\t| typeof cursorStaleReason\n\t| typeof cursorInvalidReason\n\t| typeof readTooLargeReason\n\t| typeof continuationBlockedReason\n\nexport interface NodeByIdCursorPayload {\n\trootId: string\n\tqueryShape: string\n\tboundaryPath: readonly string[]\n\trootSnapshotToken: string\n}\n\nconst NodeByIdCursorPayloadSchema: z.ZodType<NodeByIdCursorPayload> = z.object({\n\trootId: z.string(),\n\tqueryShape: z.string(),\n\tboundaryPath: z.array(z.string()).min(1),\n\trootSnapshotToken: z.string(),\n})\n\nexport function normalizeAttributeFilter(\n\tattributeFilter: readonly string[] | undefined,\n): readonly string[] | undefined {\n\treturn attributeFilter ? Array.from(attributeFilter).sort() : undefined\n}\n\nexport function getNodeByIdCursorQueryShape(query: NodeByIdCursorQuery): string {\n\tconst normalizedAttributeFilter = normalizeAttributeFilter(query.attributeFilter)\n\treturn JSON.stringify({\n\t\tdescendants: query.descendants !== false,\n\t\tattributeFilter: normalizedAttributeFilter,\n\t})\n}\n\n/*\n * `nextCursor` is an opaque continuation token for budgeted `node-by-id` reads.\n *\n * Why this exists:\n * - Pagination is based on serializer-visible output size, not child indexes.\n * - Serializer order is not always raw storage order: replica / replica-child parents can emit\n *   children in visual order via `itemsOrder`.\n * - A path-only cursor is too weak. Earlier serializer-visible edits can move the cutoff boundary\n *   even when the omitted subtree path still exists.\n *\n * The cursor therefore carries continuation signals:\n * 1. root/query-shape identity\n *    The cursor is resumable only for the exact root and query shape that produced it.\n * 2. `boundaryPath`\n *    The path from the queried root to the first omitted subtree in exact serializer order.\n * 3. `rootSnapshotToken`\n *    A soft-staleness signal derived from the queried-root lineage. Token mismatch alone does not\n *    block continuation in phase 1; it is kept for analytics/debugging and future tuning.\n *\n * Generation algorithm:\n * - Resolve the queried root and query shape (`id`, descendants behavior, `attributeFilter`).\n * - Compute `rootSnapshotToken` from the queried-root lineage.\n * - Traverse in the exact serializer order used by `node-by-id`.\n * - When the next subtree would exceed budget, record its path as `boundaryPath`.\n * - Build the cursor payload and return it behind an opaque `nextCursor` key.\n *\n * Resume / validation algorithm:\n * - Decode the opaque payload and verify it still matches the same root and query shape.\n * - Reject payloads with no path segments: real continuation cursors always include the cut boundary.\n * - Require that `boundaryPath` still resolves exactly.\n * - If the token changed, treat that as soft-stale and continue optimistically in phase 1.\n * - Hard-fail only when continuation is no longer clearly resolvable.\n */\nexport function createNodeByIdCursorPayload(\n\tquery: NodeByIdCursorQuery,\n\tboundaryPath: readonly string[],\n\trootSnapshotToken: string,\n): NodeByIdCursorPayload {\n\treturn {\n\t\trootId: query.id,\n\t\tqueryShape: getNodeByIdCursorQueryShape(query),\n\t\tboundaryPath,\n\t\trootSnapshotToken,\n\t}\n}\n\nexport function parseNodeByIdCursorPayload(cursor: unknown): NodeByIdCursorPayload | undefined {\n\tconst result = NodeByIdCursorPayloadSchema.safeParse(cursor)\n\treturn result.success ? result.data : undefined\n}\n\nfunction getNodeByIdLineage(\n\tnode: CanvasNode,\n\tgetVersion: (node: CanvasNode) => number | undefined,\n): number[] | undefined {\n\tconst tree = node.tree()\n\tconst revisions: number[] = []\n\tlet current: CanvasNode | null = node\n\n\twhile (current) {\n\t\tconst revision = getVersion(current)\n\t\tif (revision === undefined) return\n\t\trevisions.push(revision)\n\t\tif (!current.parentid) return revisions\n\t\tif (!tree) return\n\t\tcurrent = tree.get<CanvasNode>(current.parentid) ?? null\n\t}\n\n\treturn revisions\n}\n\n// We intentionally hash the queried-root lineage `update` revisions. This is a cheap, best-effort\n// soft-staleness signal; strict resume safety still comes from boundary-path validation.\n// `update` is not a durable cross-session revision source (nodes hydrate with `update: 0`), so we\n// cannot treat token mismatches as hard cursor invalidation.\nfunction getNodeByIdRevisionLineage(node: CanvasNode): number[] | undefined {\n\treturn getNodeByIdLineage(node, current => current.update)\n}\n\nfunction rootSnapshotToken(node: CanvasNode, query: NodeByIdCursorQuery): string {\n\tconst lineage = getNodeByIdRevisionLineage(node)\n\tconst normalizedAttributeFilter = normalizeAttributeFilter(query.attributeFilter)\n\treturn murmurHash(\n\t\tJSON.stringify([query.id, query.descendants !== false, normalizedAttributeFilter, lineage]),\n\t).toString(36)\n}\n\nexport function getOrCreateNodeByIdRootSnapshotToken(\n\tnode: CanvasNode,\n\tstate: { query: NodeByIdCursorQuery; rootSnapshotToken?: string },\n): string {\n\tstate.rootSnapshotToken ??= rootSnapshotToken(node, state.query)\n\tconst snapshotToken = state.rootSnapshotToken\n\tassert(snapshotToken, \"Expected root snapshot token for paginated node-by-id read\")\n\treturn snapshotToken\n}\n\nexport const testing = {\n\trootSnapshotToken,\n\tparseNodeByIdCursorPayload,\n}\n\nfunction resolveContextChildNodeById(parent: CanvasNode, childId: string): CanvasNode | undefined {\n\tconst tree = parent.tree()\n\tif (tree) {\n\t\tconst indexedChild = tree.get<CanvasNode>(childId)\n\t\tif (indexedChild?.parentid === parent.id) return indexedChild\n\t}\n\treturn getContextChildNodes(parent).find(child => child.id === childId)\n}\n\nexport function validateCursorBoundaryPath(root: CanvasNode, boundaryPath: readonly string[]): boolean {\n\tlet current: CanvasNode = root\n\tfor (const segment of boundaryPath) {\n\t\tconst next = resolveContextChildNodeById(current, segment)\n\t\tif (!next) return false\n\t\tcurrent = next\n\t}\n\treturn true\n}\n", "import { assert, murmurHash } from \"@framerjs/shared\"\nimport { parseNodeByIdCursorPayload, type NodeByIdCursorPayload } from \"./cursor.ts\"\n\nexport interface NodeByIdCursorStore {\n\tresolve(cursor: number): NodeByIdCursorPayload | undefined\n\tstore(cursor: NodeByIdCursorPayload): number\n\tstoreWithStatus(cursor: NodeByIdCursorPayload): { key: number; inserted: boolean }\n\tremove(cursor: number): void\n}\n\nexport interface NodeByIdCursorStoreState {\n\tnextCursorIndex: number\n\tcursorByKey: Record<string, NodeByIdCursorPayload>\n}\n\nexport function createNodeByIdCursorStoreState(): NodeByIdCursorStoreState {\n\treturn {\n\t\tnextCursorIndex: 0,\n\t\tcursorByKey: {},\n\t}\n}\n\n// Three digits is the shortest \"looks opaque\" width that still gives us enough non-adjacent-repeat\n// keys (`9 + 9 ** 2 + 9 ** 3 = 819`) before we need to spill into four digits.\nconst shortKeyDigits = 3\n\n/**\n * Generates a short, deterministic cursor key from a zero-based index.\n * Each range is shuffled with a deterministic pseudorandom permutation before it is unranked into a\n * concrete number. That keeps keys stable while making nearby indices harder to predict for LLMs.\n *\n * Keys are numeric only, non-sequential, never start with `0`, and never repeat the same digit\n * twice in a row.\n *\n * We enumerate only numbers whose adjacent digits differ. Each exact digit length has `9 ** digits`\n * values: the first digit can be `1..9`, and every later digit can be any decimal digit except the\n * previous one.\n *\n * To avoid obvious local patterns, we do not walk `1`, then `2`, then `3` digit buckets in order.\n * Instead, the first `9 + 9 ** 2 + 9 ** 3 = 819` indices are permuted across the entire valid\n * short-key space (`1..3` digits), so early keys already use the full short range. Index `819` is\n * therefore the first one that spills into four digits.\n */\nexport function toNodeByIdCursorKey(index: number): string {\n\tassert(index >= 0, \"Expected non-negative node-by-id cursor index\")\n\n\tconst shortKeyRangeSize = totalNodeByIdCursorKeyRangeSize(shortKeyDigits)\n\tif (index < shortKeyRangeSize) {\n\t\t// Early cursors draw from the full short-key space instead of walking 1-, 2-, then 3-digit\n\t\t// keys in order. This makes nearby indices look less related.\n\t\treturn toNodeByIdCursorKeyWithinDigits(\n\t\t\tpermuteNodeByIdCursorIndex(index, shortKeyRangeSize, shortKeyDigits),\n\t\t\tshortKeyDigits,\n\t\t)\n\t}\n\n\tlet digits = shortKeyDigits + 1\n\tlet remaining = index - shortKeyRangeSize\n\twhile (true) {\n\t\tconst rangeSize = 9 ** digits\n\t\tif (remaining < rangeSize) {\n\t\t\t// Once the short-key pool is exhausted, keep expanding to the next exact digit length.\n\t\t\treturn toNodeByIdCursorKeyForDigits(permuteNodeByIdCursorIndex(remaining, rangeSize, digits), digits)\n\t\t}\n\t\tremaining -= rangeSize\n\t\tdigits++\n\t}\n}\n\nfunction totalNodeByIdCursorKeyRangeSize(maxDigits: number): number {\n\tlet rangeSize = 0\n\tfor (let digits = 1; digits <= maxDigits; digits++) {\n\t\trangeSize += 9 ** digits\n\t}\n\treturn rangeSize\n}\n\nfunction toNodeByIdCursorKeyWithinDigits(index: number, maxDigits: number): string {\n\tlet remaining = index\n\tfor (let digits = 1; digits <= maxDigits; digits++) {\n\t\tconst rangeSize = 9 ** digits\n\t\t// `remaining` is a rank within the concatenated 1..maxDigits space; peel off each exact-digit\n\t\t// bucket until we know which width this key belongs to.\n\t\tif (remaining < rangeSize) return toNodeByIdCursorKeyForDigits(remaining, digits)\n\t\tremaining -= rangeSize\n\t}\n\n\tassert(false, \"Expected node-by-id cursor key range to resolve within digit limit\")\n}\n\nfunction toNodeByIdCursorKeyForDigits(index: number, digits: number): string {\n\tlet remaining = index\n\tlet previousDigit: number | undefined\n\tlet key = \"\"\n\tfor (let position = 0; position < digits; position++) {\n\t\tconst placeValue = 9 ** (digits - position - 1)\n\t\t// Every position has 9 legal choices: the first excludes `0`, later positions exclude only\n\t\t// the immediately previous digit.\n\t\tconst choiceIndex = Math.floor(remaining / placeValue)\n\t\tremaining %= placeValue\n\t\tconst digit = position === 0 ? choiceIndex + 1 : toNodeByIdCursorDigit(previousDigit, choiceIndex)\n\t\tkey += String(digit)\n\t\tpreviousDigit = digit\n\t}\n\treturn key\n}\n\nfunction permuteNodeByIdCursorIndex(index: number, rangeSize: number, seed: number): number {\n\tassert(index >= 0 && index < rangeSize, \"Expected node-by-id cursor index within permutation range\")\n\n\tconst halfBits = Math.ceil(Math.log2(rangeSize) / 2)\n\tconst halfMask = 2 ** halfBits - 1\n\tlet value = index\n\n\t// The Feistel network works over the next power-of-two sized domain. Cycle-walking retries until\n\t// the permuted value lands back inside our actual `[0, rangeSize)` interval.\n\tfor (let attempts = 0; attempts <= rangeSize; attempts++) {\n\t\tvalue = permuteNodeByIdCursorValue(value, halfBits, halfMask, seed)\n\t\tif (value < rangeSize) return value\n\t}\n\n\tassert(false, \"Expected node-by-id cursor permutation to resolve\")\n}\n\nfunction permuteNodeByIdCursorValue(value: number, halfBits: number, halfMask: number, seed: number): number {\n\tconst halfBase = 2 ** halfBits\n\tlet left = Math.floor(value / halfBase)\n\tlet right = value % halfBase\n\n\tfor (let round = 0; round < 4; round++) {\n\t\tconst nextLeft = right\n\t\t// Murmur gives us a deterministic round function without introducing a visible arithmetic\n\t\t// pattern like simple multiply/add shuffles do.\n\t\tconst mix = (murmurHash(`node-by-id-cursor:${seed}:${round}:${right}`) >>> 0) & halfMask\n\t\tconst nextRight = (left ^ mix) & halfMask\n\t\tleft = nextLeft\n\t\tright = nextRight\n\t}\n\n\treturn left * halfBase + right\n}\n\nfunction toNodeByIdCursorDigit(previousDigit: number | undefined, choiceIndex: number): number {\n\tassert(previousDigit !== undefined, \"Expected previous node-by-id cursor digit\")\n\n\tlet remainingChoiceIndex = choiceIndex\n\tfor (let digit = 0; digit <= 9; digit++) {\n\t\t// Skip only the immediately previous digit so keys never contain runs like `11` or `200`.\n\t\tif (digit === previousDigit) continue\n\t\tif (remainingChoiceIndex === 0) return digit\n\t\tremainingChoiceIndex--\n\t}\n\n\tassert(false, \"Expected node-by-id cursor digit choice to resolve\")\n}\n\nfunction cursorByKeyIndexFromState(value: string): number | undefined {\n\tconst parsed = Number(value)\n\tif (!Number.isSafeInteger(parsed) || parsed < 0) return\n\treturn parsed\n}\n\nfunction toStoredNodeByIdCursorKey(index: number): number {\n\tconst key = Number(toNodeByIdCursorKey(index))\n\tassert(Number.isSafeInteger(key) && key >= 0, \"Expected node-by-id cursor key to be a safe non-negative integer\")\n\treturn key\n}\n\nexport function createNodeByIdCursorStore(state: NodeByIdCursorStoreState): NodeByIdCursorStore {\n\tconst cursorByKey = new Map<number, NodeByIdCursorPayload>()\n\tconst keyBySerializedCursor = new Map<string, number>()\n\tfor (const [key, cursor] of Object.entries(state.cursorByKey)) {\n\t\tconst numericKey = cursorByKeyIndexFromState(key)\n\t\tif (numericKey === undefined) continue\n\t\tconst parsedCursor = parseNodeByIdCursorPayload(cursor)\n\t\tif (!parsedCursor) continue\n\t\tcursorByKey.set(numericKey, parsedCursor)\n\t\tkeyBySerializedCursor.set(serializeNodeByIdCursorPayload(parsedCursor), numericKey)\n\t}\n\t// Persist the next rank, not just the assigned keys, so future aliases stay deterministic after\n\t// rehydration.\n\tlet nextCursorIndex =\n\t\tNumber.isSafeInteger(state.nextCursorIndex) && state.nextCursorIndex >= 0 ? state.nextCursorIndex : 0\n\n\tfunction storeWithStatus(cursor: NodeByIdCursorPayload): { key: number; inserted: boolean } {\n\t\tconst serializedCursor = serializeNodeByIdCursorPayload(cursor)\n\t\tconst existingKey = keyBySerializedCursor.get(serializedCursor)\n\t\tif (existingKey !== undefined) return { key: existingKey, inserted: false }\n\n\t\tlet key = toStoredNodeByIdCursorKey(nextCursorIndex++)\n\t\twhile (cursorByKey.has(key)) {\n\t\t\t// Collisions are only possible when restoring persisted state whose index counter lagged\n\t\t\t// behind the assigned keys, so keep walking forward until we find a free key.\n\t\t\tkey = toStoredNodeByIdCursorKey(nextCursorIndex)\n\t\t\tnextCursorIndex++\n\t\t}\n\t\tcursorByKey.set(key, cursor)\n\t\tkeyBySerializedCursor.set(serializedCursor, key)\n\t\tstate.cursorByKey[key] = cursor\n\t\tstate.nextCursorIndex = nextCursorIndex\n\t\treturn { key, inserted: true }\n\t}\n\n\treturn {\n\t\tresolve(cursor: number): NodeByIdCursorPayload | undefined {\n\t\t\treturn cursorByKey.get(cursor)\n\t\t},\n\t\tstore(cursor: NodeByIdCursorPayload): number {\n\t\t\treturn storeWithStatus(cursor).key\n\t\t},\n\t\tstoreWithStatus,\n\t\tremove(cursor: number): void {\n\t\t\tconst existing = cursorByKey.get(cursor)\n\t\t\tif (existing === undefined) return\n\n\t\t\tcursorByKey.delete(cursor)\n\t\t\tdelete state.cursorByKey[cursor]\n\t\t\tkeyBySerializedCursor.delete(serializeNodeByIdCursorPayload(existing))\n\t\t},\n\t}\n}\n\nfunction serializeNodeByIdCursorPayload(cursor: NodeByIdCursorPayload): string {\n\treturn JSON.stringify({\n\t\trootId: cursor.rootId,\n\t\tqueryShape: cursor.queryShape,\n\t\tboundaryPath: cursor.boundaryPath,\n\t\trootSnapshotToken: cursor.rootSnapshotToken,\n\t})\n}\n", "export const createUnusedObject = <T extends object>(name: string): T => {\n\tconst handler: ProxyHandler<T>[\"get\"] = (_target, p) => {\n\t\tthrow new Error(\n\t\t\t`[createUnusedObject] Attempted to access property ${String(p)} on what's expected to be an unused '${name}' object`,\n\t\t)\n\t}\n\treturn new Proxy({} as T, {\n\t\tget: handler,\n\t\tset: handler,\n\t})\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { CommandType, type Command } from \"./dsl.ts\"\nimport type { BlockingTaskType, ReadTaskSubType } from \"./types.ts\"\n\nconst DESIGN_PLAN_STEP_MESSAGE = \"Creating design plan\u2026\"\nconst DESIGN_PLAN_COMPLETED_MESSAGE = \"Created design plan\"\nconst FETCH_URL_STEP_MESSAGE = \"Fetching URL\u2026\"\nconst FETCH_URL_COMPLETED_MESSAGE = \"Fetched URL\"\n\nexport function getReadTaskDisplayMessage(task: ReadTaskSubType | undefined): string {\n\tswitch (task) {\n\t\tcase \"review\":\n\t\t\treturn \"\"\n\t\tcase undefined:\n\t\t\treturn \"\"\n\t\tdefault:\n\t\t\treturn assertNever(task, \"Invalid read task subtype\")\n\t}\n}\n\nexport function getBlockingTaskStartMessage(task: BlockingTaskType, message?: string): string {\n\tswitch (task) {\n\t\tcase \"font-search\":\n\t\t\treturn \"\"\n\t\tcase \"screenshot\":\n\t\t\treturn \"\"\n\t\tcase \"image-search\":\n\t\t\treturn \"\"\n\t\tcase \"deprecated-design-plan\":\n\t\t\treturn DESIGN_PLAN_STEP_MESSAGE\n\t\tcase \"fetch\":\n\t\t\treturn message ? `Fetching URL: ${message}` : FETCH_URL_STEP_MESSAGE\n\t\tcase \"publish\":\n\t\t\treturn message ?? \"\"\n\t\tcase \"search-with-script\":\n\t\t\treturn message ?? \"\"\n\t\tcase \"analyze\":\n\t\t\treturn message ?? \"\"\n\t\tcase \"search\":\n\t\t\treturn message ?? \"\"\n\t\tcase \"make-external-component-local\":\n\t\t\treturn \"\"\n\t\tdefault:\n\t\t\treturn assertNever(task, \"Invalid blocking task type\")\n\t}\n}\n\nexport function getBlockingTaskCompletedMessage(task: BlockingTaskType, message?: string): string {\n\tswitch (task) {\n\t\tcase \"font-search\":\n\t\t\treturn \"\"\n\t\tcase \"screenshot\":\n\t\t\treturn \"\"\n\t\tcase \"image-search\":\n\t\t\treturn \"\"\n\t\tcase \"deprecated-design-plan\":\n\t\t\treturn DESIGN_PLAN_COMPLETED_MESSAGE\n\t\tcase \"fetch\":\n\t\t\treturn FETCH_URL_COMPLETED_MESSAGE\n\t\tcase \"publish\":\n\t\t\treturn message ?? \"\"\n\t\tcase \"search-with-script\":\n\t\t\treturn \"\"\n\t\tcase \"analyze\":\n\t\t\treturn \"\"\n\t\tcase \"search\":\n\t\t\treturn \"\"\n\t\tcase \"make-external-component-local\":\n\t\t\treturn \"\"\n\t\tdefault:\n\t\t\treturn assertNever(task, \"Invalid blocking task type\")\n\t}\n}\n\nexport function getDSLCommandStartMessage(command: Command): string {\n\tswitch (command.type) {\n\t\tcase CommandType.Add:\n\t\t\treturn \"Adding layer\u2026\"\n\t\tcase CommandType.Update:\n\t\t\treturn \"Editing layer\u2026\"\n\t\tcase CommandType.Remove:\n\t\t\treturn \"Removing layer\u2026\"\n\t\tcase CommandType.Move:\n\t\t\treturn \"Moving layer\u2026\"\n\t\tcase CommandType.Duplicate:\n\t\tcase CommandType.CreateVariant:\n\t\t\treturn \"Duplicating layer\u2026\"\n\t\tdefault:\n\t\t\treturn assertNever(command, \"Invalid command type\")\n\t}\n}\n\nexport function getDSLCommandCompletedMessage(command: Command): string {\n\tswitch (command.type) {\n\t\tcase CommandType.Add:\n\t\t\treturn \"Added layer\"\n\t\tcase CommandType.Update:\n\t\t\treturn \"Edited layer\"\n\t\tcase CommandType.Remove:\n\t\t\treturn \"Removed layer\"\n\t\tcase CommandType.Move:\n\t\t\treturn \"Moved layer\"\n\t\tcase CommandType.Duplicate:\n\t\tcase CommandType.CreateVariant:\n\t\t\treturn \"Duplicated layer\"\n\t\tdefault:\n\t\t\treturn assertNever(command, \"Invalid command type\")\n\t}\n}\n", "// ../core/dist/chunk-4UCYIEH4.js\nfunction getCrypto() {\n  const c = globalThis.crypto;\n  return c;\n}\nfunction randomBytes(length) {\n  const cryptoObj = getCrypto();\n  const out = new Uint8Array(length);\n  if (cryptoObj && typeof cryptoObj.getRandomValues === \"function\") {\n    cryptoObj.getRandomValues(out);\n    return out;\n  }\n  for (let i = 0; i < out.length; i++) out[i] = Math.floor(Math.random() * 256);\n  return out;\n}\nfunction randomUUID() {\n  const cryptoObj = getCrypto();\n  if (cryptoObj && typeof cryptoObj.randomUUID === \"function\") {\n    return cryptoObj.randomUUID();\n  }\n  const b = randomBytes(16);\n  b[6] = b[6] & 15 | 64;\n  b[8] = b[8] & 63 | 128;\n  const hex = [...b].map((x) => x.toString(16).padStart(2, \"0\")).join(\"\");\n  return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\nfunction base64Encode(bytes) {\n  const maybeBuffer = globalThis.Buffer;\n  if (maybeBuffer) {\n    return maybeBuffer.from(bytes).toString(\"base64\");\n  }\n  let binary = \"\";\n  for (let i2 = 0; i2 < bytes.length; i2++) {\n    binary += String.fromCharCode(bytes[i2]);\n  }\n  const btoaFn = globalThis.btoa;\n  if (typeof btoaFn === \"function\") return btoaFn(binary);\n  const alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\n  let out = \"\";\n  let i = 0;\n  while (i < binary.length) {\n    const c1 = binary.charCodeAt(i++) & 255;\n    const c2 = i < binary.length ? binary.charCodeAt(i++) & 255 : NaN;\n    const c3 = i < binary.length ? binary.charCodeAt(i++) & 255 : NaN;\n    const e1 = c1 >> 2;\n    const e2 = (c1 & 3) << 4 | (Number.isNaN(c2) ? 0 : c2 >> 4);\n    const e3 = Number.isNaN(c2) ? 64 : (c2 & 15) << 2 | (Number.isNaN(c3) ? 0 : c3 >> 6);\n    const e4 = Number.isNaN(c3) ? 64 : c3 & 63;\n    out += alphabet.charAt(e1);\n    out += alphabet.charAt(e2);\n    out += e3 === 64 ? \"=\" : alphabet.charAt(e3);\n    out += e4 === 64 ? \"=\" : alphabet.charAt(e4);\n  }\n  return out;\n}\nfunction wait(ms) {\n  return new Promise((resolve) => setTimeout(resolve, ms));\n}\nfunction formatEndpoint(endpoint) {\n  if (!endpoint) return void 0;\n  return endpoint.endsWith(\"/\") ? endpoint : `${endpoint}/`;\n}\nfunction parseRetryAfter(headers) {\n  var _a;\n  const value = (_a = headers.get(\"Retry-After\")) != null ? _a : headers.get(\"retry-after\");\n  if (!value) return void 0;\n  const asNumber = Number(value);\n  if (value.trim() !== \"\" && !Number.isNaN(asNumber)) return asNumber * 1e3;\n  const asDate = new Date(value).getTime();\n  if (!Number.isNaN(asDate)) {\n    const delta = asDate - Date.now();\n    return delta > 0 ? delta : 0;\n  }\n  return void 0;\n}\nfunction getRetryDelayMs(attemptNumber, previousError) {\n  if (previousError && typeof previousError === \"object\" && previousError !== null && \"retryAfterMs\" in previousError) {\n    const v = previousError.retryAfterMs;\n    if (typeof v === \"number\") return Math.max(0, v);\n  }\n  if (attemptNumber <= 1) return 0;\n  const base = 500;\n  const factor = Math.pow(2, attemptNumber - 2);\n  return base * factor;\n}\nasync function withRetry(operation, opName2, opts) {\n  const prefix = opts.sdkName ? `[raindrop-ai/${opts.sdkName}]` : \"[raindrop-ai/core]\";\n  let lastError = void 0;\n  for (let attemptNumber = 1; attemptNumber <= opts.maxAttempts; attemptNumber++) {\n    if (attemptNumber > 1) {\n      const delay = getRetryDelayMs(attemptNumber, lastError);\n      if (opts.debug) {\n        console.warn(\n          `${prefix} ${opName2} retry ${attemptNumber}/${opts.maxAttempts} in ${delay}ms`\n        );\n      }\n      if (delay > 0) await wait(delay);\n    } else if (opts.debug) {\n      console.log(`${prefix} ${opName2} attempt ${attemptNumber}/${opts.maxAttempts}`);\n    }\n    try {\n      return await operation();\n    } catch (err) {\n      lastError = err;\n      if (opts.debug) {\n        const msg = err instanceof Error ? err.message : String(err);\n        console.warn(\n          `${prefix} ${opName2} attempt ${attemptNumber} failed: ${msg}${attemptNumber === opts.maxAttempts ? \" (no more retries)\" : \"\"}`\n        );\n      }\n      if (lastError && typeof lastError === \"object\" && \"retryable\" in lastError && !lastError.retryable)\n        break;\n      if (attemptNumber === opts.maxAttempts) break;\n    }\n  }\n  throw lastError instanceof Error ? lastError : new Error(String(lastError));\n}\nasync function postJson(url, body, headers, opts) {\n  const opName2 = `POST ${url}`;\n  await withRetry(\n    async () => {\n      const resp = await fetch(url, {\n        method: \"POST\",\n        headers: {\n          \"Content-Type\": \"application/json\",\n          ...headers\n        },\n        body: JSON.stringify(body)\n      });\n      if (!resp.ok) {\n        const text = await resp.text().catch(() => \"\");\n        const err = new Error(\n          `HTTP ${resp.status} ${resp.statusText}${text ? `: ${text}` : \"\"}`\n        );\n        const retryAfterMs = parseRetryAfter(resp.headers);\n        if (typeof retryAfterMs === \"number\") err.retryAfterMs = retryAfterMs;\n        err.retryable = resp.status === 429 || resp.status >= 500;\n        throw err;\n      }\n    },\n    opName2,\n    opts\n  );\n}\nvar SpanStatusCode = {\n  UNSET: 0,\n  ERROR: 2\n};\nfunction createSpanIds(parent) {\n  const traceId = parent ? parent.traceIdB64 : base64Encode(randomBytes(16));\n  const spanId = base64Encode(randomBytes(8));\n  return {\n    traceIdB64: traceId,\n    spanIdB64: spanId,\n    parentSpanIdB64: parent ? parent.spanIdB64 : void 0\n  };\n}\nfunction nowUnixNanoString() {\n  return Date.now().toString() + \"000000\";\n}\nfunction unixMsToNanoString(ms) {\n  return String(Math.floor(ms)) + \"000000\";\n}\nfunction attrString(key, value) {\n  if (value === void 0) return void 0;\n  return { key, value: { stringValue: value } };\n}\nfunction attrInt(key, value) {\n  if (value === void 0) return void 0;\n  if (!Number.isFinite(value)) return void 0;\n  return { key, value: { intValue: String(Math.trunc(value)) } };\n}\nfunction attrDouble(key, value) {\n  if (value === void 0) return void 0;\n  if (!Number.isFinite(value)) return void 0;\n  return { key, value: { doubleValue: value } };\n}\nfunction attrBool(key, value) {\n  if (value === void 0) return void 0;\n  return { key, value: { boolValue: value } };\n}\nfunction attrStringArray(key, values) {\n  if (!values || values.length === 0) return void 0;\n  return {\n    key,\n    value: {\n      arrayValue: {\n        values: values.filter((v) => typeof v === \"string\").map((v) => ({ stringValue: v }))\n      }\n    }\n  };\n}\nfunction buildOtlpSpan(args) {\n  const attrs = args.attributes.filter((x) => x !== void 0);\n  const span = {\n    traceId: args.ids.traceIdB64,\n    spanId: args.ids.spanIdB64,\n    name: args.name,\n    startTimeUnixNano: args.startTimeUnixNano,\n    endTimeUnixNano: args.endTimeUnixNano\n  };\n  if (args.ids.parentSpanIdB64) span.parentSpanId = args.ids.parentSpanIdB64;\n  if (attrs.length) span.attributes = attrs;\n  if (args.status) span.status = args.status;\n  return span;\n}\nfunction buildExportTraceServiceRequest(spans, serviceName = \"raindrop.core\", serviceVersion = \"0.0.0\") {\n  return {\n    resourceSpans: [\n      {\n        resource: {\n          attributes: [{ key: \"service.name\", value: { stringValue: serviceName } }]\n        },\n        scopeSpans: [\n          {\n            scope: { name: serviceName, version: serviceVersion },\n            spans\n          }\n        ]\n      }\n    ]\n  };\n}\nfunction mergePatches(target, source) {\n  var _a, _b, _c, _d;\n  const out = { ...target, ...source };\n  if (target.properties || source.properties) {\n    out.properties = { ...(_a = target.properties) != null ? _a : {}, ...(_b = source.properties) != null ? _b : {} };\n  }\n  if (target.attachments || source.attachments) {\n    out.attachments = [...(_c = target.attachments) != null ? _c : [], ...(_d = source.attachments) != null ? _d : []];\n  }\n  return out;\n}\nvar EventShipper = class {\n  constructor(opts) {\n    this.buffers = /* @__PURE__ */ new Map();\n    this.sticky = /* @__PURE__ */ new Map();\n    this.timers = /* @__PURE__ */ new Map();\n    this.inFlight = /* @__PURE__ */ new Set();\n    var _a, _b, _c, _d, _e, _f, _g;\n    this.writeKey = (_a = opts.writeKey) == null ? void 0 : _a.trim();\n    this.baseUrl = (_b = formatEndpoint(opts.endpoint)) != null ? _b : \"https://api.raindrop.ai/v1/\";\n    this.enabled = opts.enabled !== false;\n    this.debug = opts.debug;\n    this.partialFlushMs = (_c = opts.partialFlushMs) != null ? _c : 1e3;\n    this.sdkName = (_d = opts.sdkName) != null ? _d : \"core\";\n    this.prefix = `[raindrop-ai/${this.sdkName}]`;\n    this.defaultEventName = (_e = opts.defaultEventName) != null ? _e : \"ai_generation\";\n    const isNode = typeof process !== \"undefined\" && typeof process.version === \"string\";\n    this.context = {\n      library: {\n        name: (_f = opts.libraryName) != null ? _f : \"@raindrop-ai/core\",\n        version: (_g = opts.libraryVersion) != null ? _g : \"0.0.0\"\n      },\n      metadata: {\n        jsRuntime: isNode ? \"node\" : \"web\",\n        ...isNode ? { nodeVersion: process.version } : {}\n      }\n    };\n  }\n  isDebugEnabled() {\n    return this.debug;\n  }\n  authHeaders() {\n    return this.writeKey ? { Authorization: `Bearer ${this.writeKey}` } : {};\n  }\n  async patch(eventId, patch) {\n    var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;\n    if (!this.enabled) return;\n    if (!eventId || !eventId.trim()) return;\n    if (this.debug) {\n      console.log(`${this.prefix} queue patch`, {\n        eventId,\n        userId: patch.userId,\n        convoId: patch.convoId,\n        eventName: patch.eventName,\n        hasInput: typeof patch.input === \"string\" && patch.input.length > 0,\n        hasOutput: typeof patch.output === \"string\" && patch.output.length > 0,\n        attachments: (_b = (_a = patch.attachments) == null ? void 0 : _a.length) != null ? _b : 0,\n        isPending: patch.isPending\n      });\n    }\n    const sticky = (_c = this.sticky.get(eventId)) != null ? _c : {};\n    const existing = (_d = this.buffers.get(eventId)) != null ? _d : {};\n    const merged = mergePatches(existing, patch);\n    merged.isPending = (_g = (_f = (_e = patch.isPending) != null ? _e : existing.isPending) != null ? _f : sticky.isPending) != null ? _g : true;\n    this.buffers.set(eventId, merged);\n    this.sticky.set(eventId, {\n      userId: (_h = merged.userId) != null ? _h : sticky.userId,\n      convoId: (_i = merged.convoId) != null ? _i : sticky.convoId,\n      eventName: (_j = merged.eventName) != null ? _j : sticky.eventName,\n      isPending: (_k = merged.isPending) != null ? _k : sticky.isPending\n    });\n    const t = this.timers.get(eventId);\n    if (t) clearTimeout(t);\n    if (merged.isPending === false) {\n      await this.flushOne(eventId);\n      return;\n    }\n    const timeout = setTimeout(() => {\n      void this.flushOne(eventId).catch(() => {\n      });\n    }, this.partialFlushMs);\n    this.timers.set(eventId, timeout);\n  }\n  async finish(eventId, patch) {\n    await this.patch(eventId, { ...patch, isPending: false });\n  }\n  async flush() {\n    if (!this.enabled) return;\n    const ids = [...this.buffers.keys()];\n    await Promise.all(ids.map((id) => this.flushOne(id)));\n    await Promise.all([...this.inFlight].map((p) => p.catch(() => {\n    })));\n  }\n  async shutdown() {\n    for (const t of this.timers.values()) clearTimeout(t);\n    this.timers.clear();\n    await this.flush();\n  }\n  async trackSignal(signal) {\n    var _a, _b;\n    if (!this.enabled) return;\n    const body = [\n      {\n        event_id: signal.eventId,\n        signal_name: signal.name,\n        signal_type: (_a = signal.type) != null ? _a : \"default\",\n        timestamp: signal.timestamp,\n        sentiment: signal.sentiment,\n        attachment_id: signal.attachmentId,\n        properties: {\n          ...(_b = signal.properties) != null ? _b : {},\n          ...signal.comment ? { comment: signal.comment } : {},\n          ...signal.after ? { after: signal.after } : {}\n        }\n      }\n    ];\n    const url = `${this.baseUrl}signals/track`;\n    try {\n      await postJson(url, body, this.authHeaders(), {\n        maxAttempts: 3,\n        debug: this.debug,\n        sdkName: this.sdkName\n      });\n    } catch (err) {\n      const msg = err instanceof Error ? err.message : String(err);\n      console.warn(`${this.prefix} failed to send signal (dropping): ${msg}`);\n    }\n  }\n  async identify(users) {\n    if (!this.enabled) return;\n    const list = Array.isArray(users) ? users : [users];\n    const body = list.filter((user) => {\n      if (!(user == null ? void 0 : user.userId) || !user.userId.trim()) {\n        if (this.debug) {\n          console.warn(`${this.prefix} skipping identify: missing userId`);\n        }\n        return false;\n      }\n      return true;\n    }).map((user) => {\n      var _a;\n      return {\n        user_id: user.userId,\n        traits: (_a = user.traits) != null ? _a : {}\n      };\n    });\n    if (body.length === 0) return;\n    const url = `${this.baseUrl}users/identify`;\n    try {\n      await postJson(url, body, this.authHeaders(), {\n        maxAttempts: 3,\n        debug: this.debug,\n        sdkName: this.sdkName\n      });\n    } catch (err) {\n      const msg = err instanceof Error ? err.message : String(err);\n      console.warn(`${this.prefix} failed to send identify (dropping): ${msg}`);\n    }\n  }\n  async flushOne(eventId) {\n    var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;\n    if (!this.enabled) return;\n    const timer = this.timers.get(eventId);\n    if (timer) {\n      clearTimeout(timer);\n      this.timers.delete(eventId);\n    }\n    const accumulated = this.buffers.get(eventId);\n    this.buffers.delete(eventId);\n    if (!accumulated) return;\n    const sticky = (_a = this.sticky.get(eventId)) != null ? _a : {};\n    const eventName = (_c = (_b = accumulated.eventName) != null ? _b : sticky.eventName) != null ? _c : this.defaultEventName;\n    const userId = (_d = accumulated.userId) != null ? _d : sticky.userId;\n    if (!userId) {\n      if (this.debug) {\n        console.warn(`${this.prefix} skipping track_partial for ${eventId}: missing userId`);\n      }\n      this.sticky.delete(eventId);\n      return;\n    }\n    const { wizardSession, ...restProperties } = (_e = accumulated.properties) != null ? _e : {};\n    const convoId = (_f = accumulated.convoId) != null ? _f : sticky.convoId;\n    const isPending = (_h = (_g = accumulated.isPending) != null ? _g : sticky.isPending) != null ? _h : true;\n    const payload = {\n      event_id: eventId,\n      user_id: userId,\n      event: eventName,\n      timestamp: (_i = accumulated.timestamp) != null ? _i : (/* @__PURE__ */ new Date()).toISOString(),\n      ai_data: {\n        input: accumulated.input,\n        output: accumulated.output,\n        model: accumulated.model,\n        convo_id: convoId\n      },\n      properties: {\n        ...restProperties,\n        ...wizardSession ? { \"raindrop.wizardSession\": wizardSession } : {},\n        $context: this.context\n      },\n      attachments: accumulated.attachments,\n      is_pending: isPending\n    };\n    const url = `${this.baseUrl}events/track_partial`;\n    if (this.debug) {\n      console.log(`${this.prefix} sending track_partial`, {\n        eventId,\n        eventName,\n        userId,\n        convoId,\n        isPending,\n        inputPreview: typeof accumulated.input === \"string\" ? accumulated.input.slice(0, 120) : void 0,\n        outputPreview: typeof accumulated.output === \"string\" ? accumulated.output.slice(0, 120) : void 0,\n        attachments: (_k = (_j = accumulated.attachments) == null ? void 0 : _j.length) != null ? _k : 0,\n        attachmentKinds: (_m = (_l = accumulated.attachments) == null ? void 0 : _l.map((a) => ({\n          type: a.type,\n          role: a.role,\n          name: a.name,\n          valuePreview: a.value.slice(0, 60)\n        }))) != null ? _m : [],\n        endpoint: url\n      });\n    }\n    const p = postJson(url, payload, this.authHeaders(), {\n      maxAttempts: 3,\n      debug: this.debug,\n      sdkName: this.sdkName\n    });\n    this.inFlight.add(p);\n    try {\n      try {\n        await p;\n        if (this.debug) {\n          console.log(`${this.prefix} sent track_partial ${eventId} (${eventName})`);\n        }\n      } catch (err) {\n        const msg = err instanceof Error ? err.message : String(err);\n        console.warn(`${this.prefix} failed to send track_partial (dropping): ${msg}`);\n      }\n    } finally {\n      this.inFlight.delete(p);\n    }\n    if (!isPending) {\n      this.sticky.delete(eventId);\n    }\n  }\n};\nvar LOCAL_DEBUGGER_ENV_VAR = \"RAINDROP_LOCAL_DEBUGGER\";\nfunction resolveLocalDebuggerBaseUrl(baseUrl) {\n  var _a, _b, _c;\n  const resolved = (_b = baseUrl != null ? baseUrl : typeof process !== \"undefined\" ? (_a = process.env) == null ? void 0 : _a[LOCAL_DEBUGGER_ENV_VAR] : void 0) != null ? _b : null;\n  return resolved ? (_c = formatEndpoint(resolved)) != null ? _c : null : null;\n}\nfunction localDebuggerEnabled(baseUrl) {\n  return resolveLocalDebuggerBaseUrl(baseUrl) !== null;\n}\nfunction normalizeLocalDebuggerLiveEventType(type) {\n  switch (type) {\n    case \"text-delta\":\n      return \"text_delta\";\n    case \"reasoning\":\n    case \"reasoning-delta\":\n      return \"reasoning_delta\";\n    case \"tool-call\":\n      return \"tool_start\";\n    case \"tool-result\":\n      return \"tool_result\";\n    default:\n      return type;\n  }\n}\nfunction mirrorTraceExportToLocalDebugger(body, options = {}) {\n  var _a;\n  const baseUrl = resolveLocalDebuggerBaseUrl(options.baseUrl);\n  if (!baseUrl) return;\n  void postJson(`${baseUrl}traces`, body, {}, {\n    maxAttempts: 1,\n    debug: (_a = options.debug) != null ? _a : false,\n    sdkName: options.sdkName\n  }).catch(() => {\n  });\n}\nfunction sendLocalDebuggerLiveEvent(event, options = {}) {\n  var _a, _b;\n  const baseUrl = resolveLocalDebuggerBaseUrl(options.baseUrl);\n  if (!baseUrl) return;\n  void postJson(\n    `${baseUrl}live`,\n    {\n      ...event,\n      type: normalizeLocalDebuggerLiveEventType(event.type),\n      timestamp: (_a = event.timestamp) != null ? _a : Date.now()\n    },\n    {},\n    {\n      maxAttempts: 1,\n      debug: (_b = options.debug) != null ? _b : false,\n      sdkName: options.sdkName\n    }\n  ).catch(() => {\n  });\n}\nvar TraceShipper = class {\n  constructor(opts) {\n    this.queue = [];\n    this.inFlight = /* @__PURE__ */ new Set();\n    var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;\n    this.writeKey = (_a = opts.writeKey) == null ? void 0 : _a.trim();\n    this.baseUrl = (_b = formatEndpoint(opts.endpoint)) != null ? _b : \"https://api.raindrop.ai/v1/\";\n    this.enabled = opts.enabled !== false;\n    this.debug = opts.debug;\n    this.debugSpans = opts.debugSpans === true;\n    this.flushIntervalMs = (_c = opts.flushIntervalMs) != null ? _c : 1e3;\n    this.maxBatchSize = (_d = opts.maxBatchSize) != null ? _d : 50;\n    this.maxQueueSize = (_e = opts.maxQueueSize) != null ? _e : 5e3;\n    this.sdkName = (_f = opts.sdkName) != null ? _f : \"core\";\n    this.prefix = `[raindrop-ai/${this.sdkName}]`;\n    this.serviceName = (_g = opts.serviceName) != null ? _g : \"raindrop.core\";\n    this.serviceVersion = (_h = opts.serviceVersion) != null ? _h : \"0.0.0\";\n    const localDebugger = typeof process !== \"undefined\" ? (_i = process.env) == null ? void 0 : _i.RAINDROP_LOCAL_DEBUGGER : void 0;\n    if (localDebugger) {\n      this.localDebuggerUrl = (_j = resolveLocalDebuggerBaseUrl(localDebugger)) != null ? _j : void 0;\n      if (this.debug) {\n        console.log(`${this.prefix} Local debugger mirroring: ${this.localDebuggerUrl}`);\n      }\n    }\n  }\n  isDebugEnabled() {\n    return this.debug;\n  }\n  authHeaders() {\n    return this.writeKey ? { Authorization: `Bearer ${this.writeKey}` } : {};\n  }\n  startSpan(args) {\n    var _a, _b;\n    const ids = createSpanIds(args.parent);\n    const started = (_a = args.startTimeUnixNano) != null ? _a : nowUnixNanoString();\n    const attrs = [\n      attrString(\"ai.telemetry.metadata.raindrop.eventId\", args.eventId),\n      attrString(\"ai.operationId\", args.operationId)\n    ];\n    if ((_b = args.attributes) == null ? void 0 : _b.length) attrs.push(...args.attributes);\n    const span = { ids, name: args.name, startTimeUnixNano: started, attributes: attrs };\n    if (this.localDebuggerUrl) {\n      const openSpan = buildOtlpSpan({\n        ids: span.ids,\n        name: span.name,\n        startTimeUnixNano: span.startTimeUnixNano,\n        endTimeUnixNano: span.startTimeUnixNano,\n        // placeholder \u2014 will be updated on endSpan\n        attributes: span.attributes,\n        status: { code: SpanStatusCode.UNSET }\n      });\n      const body = buildExportTraceServiceRequest([openSpan], this.serviceName, this.serviceVersion);\n      mirrorTraceExportToLocalDebugger(body, {\n        baseUrl: this.localDebuggerUrl,\n        debug: false,\n        sdkName: this.sdkName\n      });\n    }\n    return span;\n  }\n  endSpan(span, extra) {\n    var _a, _b;\n    if (span.endTimeUnixNano) return;\n    span.endTimeUnixNano = (_a = extra == null ? void 0 : extra.endTimeUnixNano) != null ? _a : nowUnixNanoString();\n    if ((_b = extra == null ? void 0 : extra.attributes) == null ? void 0 : _b.length) {\n      span.attributes.push(...extra.attributes);\n    }\n    let status = extra == null ? void 0 : extra.status;\n    if (!status && (extra == null ? void 0 : extra.error) !== void 0) {\n      const message = extra.error instanceof Error ? extra.error.message : String(extra.error);\n      status = { code: SpanStatusCode.ERROR, message };\n    }\n    const otlp = buildOtlpSpan({\n      ids: span.ids,\n      name: span.name,\n      startTimeUnixNano: span.startTimeUnixNano,\n      endTimeUnixNano: span.endTimeUnixNano,\n      attributes: span.attributes,\n      status\n    });\n    this.enqueue(otlp);\n    if (this.localDebuggerUrl) {\n      const body = buildExportTraceServiceRequest([otlp], this.serviceName, this.serviceVersion);\n      mirrorTraceExportToLocalDebugger(body, {\n        baseUrl: this.localDebuggerUrl,\n        debug: false,\n        sdkName: this.sdkName\n      });\n    }\n  }\n  createSpan(args) {\n    var _a;\n    const ids = createSpanIds(args.parent);\n    const attrs = [\n      attrString(\"ai.telemetry.metadata.raindrop.eventId\", args.eventId)\n    ];\n    if ((_a = args.attributes) == null ? void 0 : _a.length) attrs.push(...args.attributes);\n    const otlp = buildOtlpSpan({\n      ids,\n      name: args.name,\n      startTimeUnixNano: args.startTimeUnixNano,\n      endTimeUnixNano: args.endTimeUnixNano,\n      attributes: attrs,\n      status: args.status\n    });\n    this.enqueue(otlp);\n    if (this.localDebuggerUrl) {\n      const body = buildExportTraceServiceRequest([otlp], this.serviceName, this.serviceVersion);\n      mirrorTraceExportToLocalDebugger(body, {\n        baseUrl: this.localDebuggerUrl,\n        debug: false,\n        sdkName: this.sdkName\n      });\n    }\n  }\n  enqueue(span) {\n    if (!this.enabled) return;\n    if (this.debugSpans) {\n      const short = (s) => s ? s.slice(-8) : \"none\";\n      console.log(\n        `${this.prefix}[span] name=${span.name} trace=${short(span.traceId)} span=${short(span.spanId)} parent=${short(\n          span.parentSpanId\n        )}`\n      );\n    }\n    if (this.queue.length >= this.maxQueueSize) {\n      this.queue.shift();\n    }\n    this.queue.push(span);\n    if (this.queue.length >= this.maxBatchSize) {\n      void this.flush().catch(() => {\n      });\n      return;\n    }\n    if (!this.timer) {\n      this.timer = setTimeout(() => {\n        this.timer = void 0;\n        void this.flush().catch(() => {\n        });\n      }, this.flushIntervalMs);\n    }\n  }\n  async flush() {\n    if (!this.enabled) return;\n    if (this.timer) {\n      clearTimeout(this.timer);\n      this.timer = void 0;\n    }\n    while (this.queue.length > 0) {\n      const batch = this.queue.splice(0, this.maxBatchSize);\n      const body = buildExportTraceServiceRequest(batch, this.serviceName, this.serviceVersion);\n      const url = `${this.baseUrl}traces`;\n      if (this.debug) {\n        console.log(`${this.prefix} sending traces batch`, {\n          spans: batch.length,\n          endpoint: url\n        });\n      }\n      const p = postJson(url, body, this.authHeaders(), {\n        maxAttempts: 3,\n        debug: this.debug,\n        sdkName: this.sdkName\n      });\n      this.inFlight.add(p);\n      try {\n        try {\n          await p;\n          if (this.debug) console.log(`${this.prefix} sent ${batch.length} spans`);\n        } catch (err) {\n          const msg = err instanceof Error ? err.message : String(err);\n          console.warn(`${this.prefix} failed to send ${batch.length} spans: ${msg}`);\n        }\n      } finally {\n        this.inFlight.delete(p);\n      }\n    }\n  }\n  async shutdown() {\n    if (this.timer) {\n      clearTimeout(this.timer);\n      this.timer = void 0;\n    }\n    await this.flush();\n    await Promise.all([...this.inFlight].map((p) => p.catch(() => {\n    })));\n  }\n};\nvar NOOP_SPAN = {\n  traceIdB64: \"\",\n  spanIdB64: \"\",\n  eventId: \"\",\n  log() {\n  }\n};\nfunction getAsyncLocalStorageCtor() {\n  return globalThis.RAINDROP_ASYNC_LOCAL_STORAGE;\n}\nvar SynchronousContextStorage = class {\n  constructor() {\n    this._stack = [];\n  }\n  isEmpty() {\n    return this._stack.length === 0;\n  }\n  getStore() {\n    return this._stack[this._stack.length - 1];\n  }\n  run(store, callback) {\n    this._stack.push(store);\n    try {\n      return callback();\n    } finally {\n      this._stack.pop();\n    }\n  }\n};\nvar ContextManager = class {\n};\nvar RaindropContextManager = class extends ContextManager {\n  constructor() {\n    super();\n    this._fallback = null;\n    const Ctor = getAsyncLocalStorageCtor();\n    if (Ctor) {\n      this._storage = new Ctor();\n      return;\n    }\n    this._fallback = new SynchronousContextStorage();\n    this._storage = this._fallback;\n  }\n  maybeAdoptAsyncLocalStorage() {\n    if (!this._fallback || !this._fallback.isEmpty()) return;\n    const Ctor = getAsyncLocalStorageCtor();\n    if (!Ctor) return;\n    this._storage = new Ctor();\n    this._fallback = null;\n  }\n  isReady() {\n    return true;\n  }\n  getParentSpanIds() {\n    this.maybeAdoptAsyncLocalStorage();\n    const span = this._storage.getStore();\n    if (!span || span === NOOP_SPAN) return void 0;\n    return {\n      traceIdB64: span.traceIdB64,\n      spanIdB64: span.spanIdB64,\n      eventId: span.eventId\n    };\n  }\n  runInContext(span, callback) {\n    this.maybeAdoptAsyncLocalStorage();\n    return this._storage.run(span, callback);\n  }\n  getCurrentSpan() {\n    this.maybeAdoptAsyncLocalStorage();\n    return this._storage.getStore();\n  }\n};\nvar _contextManager = null;\nfunction getContextManager() {\n  if (!_contextManager) {\n    _contextManager = globalThis.RAINDROP_CONTEXT_MANAGER ? new globalThis.RAINDROP_CONTEXT_MANAGER() : new RaindropContextManager();\n  }\n  return _contextManager;\n}\nfunction currentSpan() {\n  var _a;\n  return (_a = getContextManager().getCurrentSpan()) != null ? _a : NOOP_SPAN;\n}\nfunction withCurrent(span, callback) {\n  return getContextManager().runInContext(span, callback);\n}\nasync function getCurrentParentSpanContext() {\n  return getContextManager().getParentSpanIds();\n}\nasync function runWithParentSpanContext(ctx, fn) {\n  const cm = getContextManager();\n  const span = {\n    traceIdB64: ctx.traceIdB64,\n    spanIdB64: ctx.spanIdB64,\n    eventId: ctx.eventId\n  };\n  return cm.runInContext(span, fn);\n}\nasync function* asyncGeneratorWithCurrent(span, gen) {\n  let nextValue;\n  while (true) {\n    const result = await withCurrent(span, async () => {\n      try {\n        return await gen.next(nextValue);\n      } catch (e) {\n        return { value: void 0, done: true, error: e };\n      }\n    });\n    if (\"error\" in result && result.error !== void 0) {\n      throw result.error;\n    }\n    if (result.done) {\n      return result.value;\n    }\n    nextValue = yield result.value;\n  }\n}\n\n// package.json\nvar package_default = {\n  name: \"@raindrop-ai/ai-sdk\",\n  version: \"0.0.25\"};\n\n// src/internal/version.ts\nvar libraryName = package_default.name;\nvar libraryVersion = package_default.version;\n\n// src/internal/events.ts\nvar EventShipper2 = class extends EventShipper {\n  constructor(opts) {\n    var _a, _b, _c;\n    super({\n      ...opts,\n      sdkName: (_a = opts.sdkName) != null ? _a : \"ai-sdk\",\n      libraryName: (_b = opts.libraryName) != null ? _b : libraryName,\n      libraryVersion: (_c = opts.libraryVersion) != null ? _c : libraryVersion\n    });\n  }\n};\n\n// src/internal/wrap/helpers.ts\nfunction isRecord(value) {\n  return typeof value === \"object\" && value !== null;\n}\nfunction isFunction(value) {\n  return typeof value === \"function\";\n}\nfunction isModuleNamespace(obj) {\n  var _a;\n  if (!obj || typeof obj !== \"object\") return false;\n  const asObject = obj;\n  if (((_a = asObject.constructor) == null ? void 0 : _a.name) === \"Module\") return true;\n  try {\n    const keys = Object.keys(obj);\n    if (keys.length === 0) return false;\n    const descriptor = Object.getOwnPropertyDescriptor(obj, keys[0]);\n    if (!descriptor) return false;\n    const isWritable = \"writable\" in descriptor ? descriptor.writable : true;\n    return !descriptor.configurable && !isWritable;\n  } catch (e) {\n    return false;\n  }\n}\nfunction safeJson(value) {\n  try {\n    return JSON.stringify(value);\n  } catch (e) {\n    return void 0;\n  }\n}\nfunction safeJsonWithUint8(value) {\n  try {\n    return JSON.stringify(value, (_key, v) => {\n      if (v instanceof Uint8Array) return base64Encode(v);\n      return v;\n    });\n  } catch (e) {\n    return void 0;\n  }\n}\nfunction extractModelInfo(model) {\n  if (typeof model === \"string\") {\n    const slashIndex2 = model.indexOf(\"/\");\n    if (slashIndex2 > 0 && slashIndex2 < model.length - 1) {\n      return {\n        provider: model.slice(0, slashIndex2),\n        modelId: model.slice(slashIndex2 + 1)\n      };\n    }\n    return { modelId: model };\n  }\n  if (!isRecord(model)) return {};\n  const provider = typeof model[\"provider\"] === \"string\" ? model[\"provider\"] : void 0;\n  let modelIdRaw;\n  if (typeof model[\"modelId\"] === \"string\") {\n    modelIdRaw = model[\"modelId\"];\n  } else if (typeof model[\"model\"] === \"string\") {\n    modelIdRaw = model[\"model\"];\n  }\n  if (!modelIdRaw) {\n    return { provider };\n  }\n  const slashIndex = modelIdRaw.indexOf(\"/\");\n  if (!provider && slashIndex > 0 && slashIndex < modelIdRaw.length - 1) {\n    return {\n      provider: modelIdRaw.slice(0, slashIndex),\n      modelId: modelIdRaw.slice(slashIndex + 1)\n    };\n  }\n  return { provider, modelId: modelIdRaw };\n}\nfunction extractTextOutput(result) {\n  if (!isRecord(result)) return void 0;\n  const text = result[\"text\"];\n  return typeof text === \"string\" ? text : void 0;\n}\nfunction extractObjectOutput(result) {\n  var _a;\n  if (!isRecord(result)) return void 0;\n  const obj = result[\"object\"];\n  if (obj === void 0) return void 0;\n  return (_a = safeJson(obj)) != null ? _a : String(obj);\n}\nfunction isAgentClass(value) {\n  if (typeof value !== \"function\") return false;\n  const proto = value.prototype;\n  if (!isRecord(proto)) return false;\n  return typeof proto[\"generate\"] === \"function\" && typeof proto[\"stream\"] === \"function\";\n}\nfunction extractModel(result) {\n  if (!isRecord(result)) return void 0;\n  const model = result[\"model\"];\n  if (typeof model === \"string\" && model.length) return model;\n  const response = result[\"response\"];\n  if (isRecord(response)) {\n    const modelId = response[\"modelId\"];\n    if (typeof modelId === \"string\" && modelId.length) return modelId;\n  }\n  return void 0;\n}\nfunction extractFinishReason(result) {\n  if (!isRecord(result)) return void 0;\n  if (typeof result[\"finishReason\"] === \"string\") return result[\"finishReason\"];\n  if (isRecord(result[\"finishReason\"]) && typeof result[\"finishReason\"][\"unified\"] === \"string\") {\n    return result[\"finishReason\"][\"unified\"];\n  }\n  return void 0;\n}\nfunction bytesToBase64(bytes) {\n  if (typeof Buffer !== \"undefined\") return Buffer.from(bytes).toString(\"base64\");\n  let binary = \"\";\n  for (let i = 0; i < bytes.length; i++) {\n    binary += String.fromCharCode(bytes[i]);\n  }\n  if (typeof btoa === \"function\") return btoa(binary);\n  return \"\";\n}\nfunction asDataUrl(value, mediaType) {\n  if (value instanceof URL) return value.toString();\n  if (typeof value === \"string\") {\n    if (value.startsWith(\"data:\")) return value;\n    if (value.startsWith(\"http://\") || value.startsWith(\"https://\")) return value;\n    return `data:${mediaType};base64,${value}`;\n  }\n  if (value instanceof Uint8Array) {\n    const base64 = bytesToBase64(value);\n    if (!base64) return void 0;\n    return `data:${mediaType};base64,${base64}`;\n  }\n  if (value instanceof ArrayBuffer) {\n    const base64 = bytesToBase64(new Uint8Array(value));\n    if (!base64) return void 0;\n    return `data:${mediaType};base64,${base64}`;\n  }\n  return void 0;\n}\nfunction dataPartToAttachmentValue(value) {\n  if (typeof value === \"string\") return value;\n  if (value instanceof URL) return value.toString();\n  if (value instanceof Uint8Array) return `[binary:${value.byteLength} bytes]`;\n  if (value instanceof ArrayBuffer) return `[binary:${value.byteLength} bytes]`;\n  return void 0;\n}\nfunction attachmentMediaType(part) {\n  if (typeof part[\"mediaType\"] === \"string\") return part[\"mediaType\"];\n  if (typeof part[\"mimeType\"] === \"string\") return part[\"mimeType\"];\n  const file = part[\"file\"];\n  if (isRecord(file)) {\n    if (typeof file[\"mediaType\"] === \"string\") return file[\"mediaType\"];\n    if (typeof file[\"mimeType\"] === \"string\") return file[\"mimeType\"];\n  }\n  return void 0;\n}\nfunction attachmentName(part) {\n  if (typeof part[\"filename\"] === \"string\") return part[\"filename\"];\n  if (typeof part[\"name\"] === \"string\") return part[\"name\"];\n  const file = part[\"file\"];\n  if (isRecord(file)) {\n    if (typeof file[\"filename\"] === \"string\") return file[\"filename\"];\n    if (typeof file[\"name\"] === \"string\") return file[\"name\"];\n  }\n  return void 0;\n}\nfunction attachmentData(part) {\n  if (\"data\" in part) return part[\"data\"];\n  const file = part[\"file\"];\n  if (isRecord(file)) {\n    if (\"file_data\" in file) return file[\"file_data\"];\n    if (\"data\" in file) return file[\"data\"];\n  }\n  return void 0;\n}\nfunction contentPartToAttachment(part, role) {\n  var _a, _b, _c;\n  const partType = part[\"type\"];\n  if (typeof partType !== \"string\") return void 0;\n  if (partType === \"image\") {\n    const mediaType = (_a = attachmentMediaType(part)) != null ? _a : \"image/png\";\n    const value = asDataUrl(part[\"image\"], mediaType);\n    if (!value) return void 0;\n    return { type: \"image\", role, value };\n  }\n  if (partType === \"image_url\") {\n    const imageUrlPart = part[\"image_url\"];\n    const imageUrlValue = isRecord(imageUrlPart) ? imageUrlPart[\"url\"] : imageUrlPart;\n    const value = asDataUrl(imageUrlValue, \"image/png\");\n    if (!value) return void 0;\n    return { type: \"image\", role, value };\n  }\n  if (partType === \"file\") {\n    const mediaType = attachmentMediaType(part);\n    const data = attachmentData(part);\n    const isImage = (mediaType == null ? void 0 : mediaType.startsWith(\"image/\")) === true;\n    const value = isImage && mediaType ? asDataUrl(data, mediaType) : dataPartToAttachmentValue(data);\n    if (!value) return void 0;\n    const name = (_c = (_b = attachmentName(part)) != null ? _b : mediaType) != null ? _c : \"file\";\n    return { type: isImage ? \"image\" : \"text\", role, name, value };\n  }\n  return void 0;\n}\nfunction attachmentsFromContent(content, role) {\n  if (!Array.isArray(content)) return void 0;\n  const attachments = [];\n  for (const part of content) {\n    if (!isRecord(part)) continue;\n    const attachment = contentPartToAttachment(part, role);\n    if (attachment) attachments.push(attachment);\n  }\n  return attachments.length ? attachments : void 0;\n}\nfunction generatedFileToAttachment(file) {\n  var _a, _b, _c, _d;\n  const mediaType = typeof file[\"mediaType\"] === \"string\" ? file[\"mediaType\"] : typeof file[\"mimeType\"] === \"string\" ? file[\"mimeType\"] : void 0;\n  const data = (_d = (_c = (_b = (_a = file[\"base64Data\"]) != null ? _a : file[\"base64\"]) != null ? _b : file[\"uint8ArrayData\"]) != null ? _c : file[\"uint8Array\"]) != null ? _d : file[\"data\"];\n  const isImage = (mediaType == null ? void 0 : mediaType.startsWith(\"image/\")) === true;\n  const value = isImage && mediaType ? asDataUrl(data, mediaType) : dataPartToAttachmentValue(data);\n  if (!value) return void 0;\n  const name = typeof file[\"filename\"] === \"string\" ? file[\"filename\"] : typeof file[\"name\"] === \"string\" ? file[\"name\"] : mediaType != null ? mediaType : \"file\";\n  return {\n    type: isImage ? \"image\" : \"text\",\n    role: \"output\",\n    name,\n    value\n  };\n}\nasync function outputAttachmentsFromFiles(files) {\n  let resolvedFiles = files;\n  if (resolvedFiles && (typeof resolvedFiles === \"object\" || typeof resolvedFiles === \"function\") && typeof resolvedFiles.then === \"function\") {\n    try {\n      resolvedFiles = await resolvedFiles;\n    } catch (e) {\n      return void 0;\n    }\n  }\n  if (!Array.isArray(resolvedFiles)) return void 0;\n  const attachments = [];\n  for (const file of resolvedFiles) {\n    if (!isRecord(file)) continue;\n    const attachment = generatedFileToAttachment(file);\n    if (attachment) attachments.push(attachment);\n  }\n  return attachments.length ? attachments : void 0;\n}\nfunction extractTextFromMessageContent(content) {\n  if (typeof content === \"string\") return content;\n  if (!Array.isArray(content)) return void 0;\n  let result = \"\";\n  for (const part of content) {\n    if (!isRecord(part) || part[\"type\"] !== \"text\" || typeof part[\"text\"] !== \"string\") continue;\n    result += part[\"text\"];\n  }\n  return result.length ? result : void 0;\n}\nfunction messagesFromArgs(args) {\n  const messages = args[\"messages\"];\n  if (Array.isArray(messages)) return messages;\n  const prompt = args[\"prompt\"];\n  if (Array.isArray(prompt)) return prompt;\n  return void 0;\n}\nfunction lastUserMessageFromArgs(args) {\n  const messages = messagesFromArgs(args);\n  if (!messages) return void 0;\n  for (let i = messages.length - 1; i >= 0; i--) {\n    const message = messages[i];\n    if (isRecord(message) && message[\"role\"] === \"user\") {\n      return message;\n    }\n  }\n  return void 0;\n}\nfunction extractInputAttachmentsFromArgs(args) {\n  var _a;\n  if (!isRecord(args)) return void 0;\n  return attachmentsFromContent((_a = lastUserMessageFromArgs(args)) == null ? void 0 : _a[\"content\"], \"input\");\n}\nasync function extractOutputAttachmentsFromResult(result) {\n  if (!isRecord(result)) return void 0;\n  const fileAttachments = await outputAttachmentsFromFiles(result[\"files\"]);\n  if (fileAttachments == null ? void 0 : fileAttachments.length) return fileAttachments;\n  const responseMessages = extractResponseMessages(result);\n  for (let i = responseMessages.length - 1; i >= 0; i--) {\n    const message = responseMessages[i];\n    if (!isRecord(message) || message[\"role\"] !== \"assistant\") continue;\n    return attachmentsFromContent(message[\"content\"], \"output\");\n  }\n  return attachmentsFromContent(result[\"content\"], \"output\");\n}\nfunction lastUserMessageTextFromArgs(args) {\n  var _a, _b;\n  if (!isRecord(args)) return void 0;\n  const content = (_a = lastUserMessageFromArgs(args)) == null ? void 0 : _a[\"content\"];\n  if (content === void 0) return void 0;\n  const text = extractTextFromMessageContent(content);\n  if (text !== void 0) return text;\n  return (_b = safeJsonWithUint8(content)) != null ? _b : String(content);\n}\nfunction extractInputFromArgs(args) {\n  var _a;\n  if (!isRecord(args)) return void 0;\n  const prompt = args[\"prompt\"];\n  if (typeof prompt === \"string\") return prompt;\n  const messages = messagesFromArgs(args);\n  if (Array.isArray(messages) && messages.length > 0) {\n    const last = messages[messages.length - 1];\n    if (isRecord(last)) {\n      const content = last[\"content\"];\n      const text = extractTextFromMessageContent(content);\n      if (text !== void 0) return text;\n      const asJson = safeJson(content);\n      if (asJson) return asJson;\n    }\n    return (_a = safeJson(messages)) != null ? _a : void 0;\n  }\n  const input = args[\"input\"];\n  if (typeof input === \"string\") return input;\n  return safeJson(args);\n}\nfunction coerceMessagesFromArgs(args) {\n  if (!isRecord(args)) return [];\n  const result = [];\n  if (typeof args[\"system\"] === \"string\" && args[\"system\"]) {\n    result.push({ role: \"system\", content: args[\"system\"] });\n  }\n  const messages = messagesFromArgs(args);\n  if (Array.isArray(messages)) {\n    for (const message of messages) {\n      if (isRecord(message) && typeof message[\"role\"] === \"string\") {\n        result.push(message);\n      }\n    }\n    return result;\n  }\n  if (typeof args[\"prompt\"] === \"string\" && args[\"prompt\"]) {\n    result.push({ role: \"user\", content: args[\"prompt\"] });\n  }\n  return result;\n}\nfunction extractResponseMessages(result) {\n  if (!isRecord(result)) return [];\n  const response = result[\"response\"];\n  if (isRecord(response) && Array.isArray(response[\"messages\"])) {\n    return response[\"messages\"].filter(\n      (message) => isRecord(message) && typeof message[\"role\"] === \"string\" && \"content\" in message\n    ).map((message) => message);\n  }\n  const steps = result[\"steps\"];\n  if (Array.isArray(steps) && steps.length > 0) {\n    const lastStep = steps[steps.length - 1];\n    if (isRecord(lastStep) && isRecord(lastStep[\"response\"])) {\n      const responseMessages = lastStep[\"response\"][\"messages\"];\n      if (Array.isArray(responseMessages)) {\n        return responseMessages.filter(\n          (message) => isRecord(message) && typeof message[\"role\"] === \"string\" && \"content\" in message\n        ).map((message) => message);\n      }\n    }\n  }\n  return [];\n}\nfunction buildToolCallMatchKey(info) {\n  if (typeof info.toolCallId === \"string\" && info.toolCallId.length > 0) {\n    return `id:${info.toolCallId}`;\n  }\n  if (typeof info.toolName === \"string\" && info.toolName.length > 0) {\n    const inputJson = safeJsonWithUint8(info.input);\n    return inputJson !== void 0 ? `name:${info.toolName}|input:${inputJson}` : `name:${info.toolName}`;\n  }\n  return void 0;\n}\nfunction isTranscriptToolResultError(part, result) {\n  if (part[\"isError\"] === true || part[\"type\"] === \"tool-error\") {\n    return true;\n  }\n  if (isRecord(result) && typeof result[\"type\"] === \"string\") {\n    return result[\"type\"].startsWith(\"error\") || result[\"type\"] === \"execution-denied\";\n  }\n  return false;\n}\nfunction getTranscriptToolErrorMessage(result) {\n  if (typeof result === \"string\" && result.length > 0) {\n    return result;\n  }\n  if (isRecord(result)) {\n    if (typeof result[\"value\"] === \"string\" && result[\"value\"].length > 0) {\n      return result[\"value\"];\n    }\n    if (typeof result[\"reason\"] === \"string\" && result[\"reason\"].length > 0) {\n      return result[\"reason\"];\n    }\n    if (typeof result[\"message\"] === \"string\" && result[\"message\"].length > 0) {\n      return result[\"message\"];\n    }\n  }\n  return safeJsonWithUint8(result);\n}\nfunction getTranscriptMessageParts(message) {\n  if (!isRecord(message)) return [];\n  const content = message[\"content\"];\n  if (Array.isArray(content)) {\n    return content.filter(isRecord);\n  }\n  return isRecord(content) ? [content] : [];\n}\nfunction getTranscriptToolCallInput(part) {\n  return \"input\" in part ? part[\"input\"] : \"args\" in part ? part[\"args\"] : void 0;\n}\nfunction getTranscriptToolCallId(part) {\n  const toolCallId = part[\"toolCallId\"];\n  return typeof toolCallId === \"string\" && toolCallId.length > 0 ? toolCallId : void 0;\n}\nfunction getTranscriptToolResultValue(part) {\n  if (\"output\" in part) return part[\"output\"];\n  if (\"result\" in part) return part[\"result\"];\n  return part[\"error\"];\n}\nfunction rememberPendingTranscriptToolCallKey(pendingKeysByToolName, toolName, key) {\n  var _a;\n  if (!toolName) return;\n  const pendingKeys = (_a = pendingKeysByToolName.get(toolName)) != null ? _a : [];\n  if (pendingKeys.includes(key)) return;\n  pendingKeys.push(key);\n  pendingKeysByToolName.set(toolName, pendingKeys);\n}\nfunction takePendingTranscriptToolCallKey(pendingKeysByToolName, toolName) {\n  if (!toolName) return void 0;\n  const pendingKeys = pendingKeysByToolName.get(toolName);\n  if (!pendingKeys || pendingKeys.length === 0) return void 0;\n  const key = pendingKeys.shift();\n  if (key === void 0) return void 0;\n  if (pendingKeys.length === 0) {\n    pendingKeysByToolName.delete(toolName);\n  }\n  return key;\n}\nfunction mergeTranscriptToolCallPart(params) {\n  var _a, _b, _c, _d;\n  const { spans, pendingKeysByToolName, part } = params;\n  const toolCallId = getTranscriptToolCallId(part);\n  const toolName = typeof part[\"toolName\"] === \"string\" ? part[\"toolName\"] : void 0;\n  const input = getTranscriptToolCallInput(part);\n  const key = buildToolCallMatchKey({ toolCallId, toolName, input });\n  if (!key) return;\n  const placeholderKey = toolCallId == null ? buildToolCallMatchKey({ toolCallId: void 0, toolName, input: void 0 }) : void 0;\n  const placeholder = placeholderKey && placeholderKey !== key ? spans.get(placeholderKey) : void 0;\n  const existing = (_a = spans.get(key)) != null ? _a : placeholder;\n  spans.set(key, {\n    key,\n    toolCallId: (_b = existing == null ? void 0 : existing.toolCallId) != null ? _b : toolCallId,\n    toolName: (_c = existing == null ? void 0 : existing.toolName) != null ? _c : toolName,\n    input: (_d = existing == null ? void 0 : existing.input) != null ? _d : input,\n    result: existing == null ? void 0 : existing.result,\n    status: existing == null ? void 0 : existing.status,\n    errorMessage: existing == null ? void 0 : existing.errorMessage\n  });\n  if (placeholderKey && placeholderKey !== key) {\n    spans.delete(placeholderKey);\n  }\n  if (!toolCallId && (existing == null ? void 0 : existing.result) === void 0) {\n    rememberPendingTranscriptToolCallKey(pendingKeysByToolName, toolName, key);\n  }\n}\nfunction mergeTranscriptToolResultPart(params) {\n  var _a, _b, _c;\n  const { spans, pendingKeysByToolName, part } = params;\n  const toolCallId = getTranscriptToolCallId(part);\n  const toolName = typeof part[\"toolName\"] === \"string\" ? part[\"toolName\"] : void 0;\n  const result = getTranscriptToolResultValue(part);\n  const fallbackKey = buildToolCallMatchKey({ toolCallId, toolName, input: void 0 });\n  const key = toolCallId != null ? fallbackKey : (_a = takePendingTranscriptToolCallKey(pendingKeysByToolName, toolName)) != null ? _a : fallbackKey;\n  if (!key) return;\n  const existing = spans.get(key);\n  const isError = isTranscriptToolResultError(part, result);\n  spans.set(key, {\n    key,\n    toolCallId: (_b = existing == null ? void 0 : existing.toolCallId) != null ? _b : toolCallId,\n    toolName: (_c = existing == null ? void 0 : existing.toolName) != null ? _c : toolName,\n    input: existing == null ? void 0 : existing.input,\n    result,\n    status: isError ? \"ERROR\" : \"OK\",\n    errorMessage: isError ? getTranscriptToolErrorMessage(result) : void 0\n  });\n}\nfunction extractToolSpansFromMessages(messages) {\n  const spans = /* @__PURE__ */ new Map();\n  const pendingKeysByToolName = /* @__PURE__ */ new Map();\n  for (const message of messages) {\n    for (const part of getTranscriptMessageParts(message)) {\n      if (part[\"type\"] === \"tool-call\") {\n        mergeTranscriptToolCallPart({ spans, pendingKeysByToolName, part });\n        continue;\n      }\n      if (part[\"type\"] === \"tool-result\" || part[\"type\"] === \"tool-error\") {\n        mergeTranscriptToolResultPart({ spans, pendingKeysByToolName, part });\n      }\n    }\n  }\n  return [...spans.values()];\n}\nfunction extractTextFromLmContent(content) {\n  if (!Array.isArray(content)) return void 0;\n  let result = \"\";\n  for (const part of content) {\n    if (isRecord(part) && part[\"type\"] === \"text\" && typeof part[\"text\"] === \"string\") {\n      result += part[\"text\"];\n    }\n  }\n  return result.length ? result : void 0;\n}\nfunction extractToolCallsFromLmContent(content) {\n  if (!Array.isArray(content)) return void 0;\n  const calls = [];\n  for (const part of content) {\n    if (!isRecord(part) || part[\"type\"] !== \"tool-call\") continue;\n    const toolCallId = getTranscriptToolCallId(part);\n    const toolName = typeof part[\"toolName\"] === \"string\" ? part[\"toolName\"] : void 0;\n    if (toolCallId || toolName) {\n      calls.push({ toolCallId, toolName, input: part[\"input\"] });\n    }\n  }\n  return calls.length ? calls : void 0;\n}\nfunction extractExperimentalTelemetry(args) {\n  if (!isRecord(args)) return void 0;\n  const telemetryConfig = args[\"experimental_telemetry\"];\n  if (!isRecord(telemetryConfig)) return void 0;\n  return {\n    functionId: typeof telemetryConfig[\"functionId\"] === \"string\" ? telemetryConfig[\"functionId\"] : void 0,\n    isEnabled: typeof telemetryConfig[\"isEnabled\"] === \"boolean\" ? telemetryConfig[\"isEnabled\"] : void 0,\n    recordInputs: typeof telemetryConfig[\"recordInputs\"] === \"boolean\" ? telemetryConfig[\"recordInputs\"] : void 0,\n    recordOutputs: typeof telemetryConfig[\"recordOutputs\"] === \"boolean\" ? telemetryConfig[\"recordOutputs\"] : void 0,\n    metadata: isRecord(telemetryConfig[\"metadata\"]) ? telemetryConfig[\"metadata\"] : void 0\n  };\n}\nfunction opName(operationId, functionId) {\n  return {\n    operationName: `${operationId}${functionId ? ` ${functionId}` : \"\"}`,\n    resourceName: functionId\n  };\n}\nfunction toOtlpAttr(key, value) {\n  if (value === void 0 || value === null) return void 0;\n  if (typeof value === \"string\") return attrString(key, value);\n  if (typeof value === \"number\")\n    return Number.isInteger(value) ? attrInt(key, value) : attrDouble(key, value);\n  if (typeof value === \"boolean\") return attrBool(key, value);\n  if (Array.isArray(value) && value.every((v) => typeof v === \"string\"))\n    return attrStringArray(key, value);\n  const asJson = safeJsonWithUint8(value);\n  return asJson ? attrString(key, asJson) : void 0;\n}\nfunction attrsFromTelemetryMetadata(metadata) {\n  if (!metadata) return [];\n  return Object.entries(metadata).filter(([k]) => !k.startsWith(\"raindrop.internal.\")).map(([k, v]) => {\n    const key = k === \"raindrop.userId\" ? \"raindrop.ai.userId\" : k;\n    return toOtlpAttr(`ai.telemetry.metadata.${key}`, v);\n  });\n}\nfunction attrsFromHeaders(headers) {\n  if (!isRecord(headers)) return [];\n  return Object.entries(headers).filter(([, v]) => typeof v === \"string\").map(([k, v]) => attrString(`ai.request.headers.${k}`, v));\n}\nfunction attrsFromSettings(args) {\n  if (!isRecord(args)) return [];\n  const result = [];\n  const settingKeys = [\n    \"maxRetries\",\n    \"timeout\",\n    \"maxOutputTokens\",\n    \"temperature\",\n    \"topP\",\n    \"topK\",\n    \"presencePenalty\",\n    \"frequencyPenalty\",\n    \"seed\",\n    \"stopSequences\"\n  ];\n  for (const key of settingKeys) {\n    if (!(key in args)) continue;\n    const value = args[key];\n    if (key === \"stopSequences\" && Array.isArray(value) && value.every((item) => typeof item === \"string\")) {\n      result.push(attrStringArray(`ai.settings.${key}`, value));\n    } else if (key === \"timeout\" && typeof value === \"number\") {\n      result.push(attrInt(`ai.settings.${key}`, value));\n    } else {\n      result.push(toOtlpAttr(`ai.settings.${key}`, value));\n    }\n  }\n  return result;\n}\nfunction attrsFromGenAiRequest(options) {\n  if (!isRecord(options)) return [];\n  return [\n    attrDouble(\n      \"gen_ai.request.frequency_penalty\",\n      typeof options[\"frequencyPenalty\"] === \"number\" ? options[\"frequencyPenalty\"] : void 0\n    ),\n    attrInt(\n      \"gen_ai.request.max_tokens\",\n      typeof options[\"maxOutputTokens\"] === \"number\" ? options[\"maxOutputTokens\"] : void 0\n    ),\n    attrDouble(\n      \"gen_ai.request.presence_penalty\",\n      typeof options[\"presencePenalty\"] === \"number\" ? options[\"presencePenalty\"] : void 0\n    ),\n    ...Array.isArray(options[\"stopSequences\"]) && options[\"stopSequences\"].every((x) => typeof x === \"string\") ? [attrStringArray(\"gen_ai.request.stop_sequences\", options[\"stopSequences\"])] : [],\n    attrDouble(\n      \"gen_ai.request.temperature\",\n      typeof options[\"temperature\"] === \"number\" ? options[\"temperature\"] : void 0\n    ),\n    attrInt(\n      \"gen_ai.request.top_k\",\n      typeof options[\"topK\"] === \"number\" ? options[\"topK\"] : void 0\n    ),\n    attrDouble(\n      \"gen_ai.request.top_p\",\n      typeof options[\"topP\"] === \"number\" ? options[\"topP\"] : void 0\n    )\n  ];\n}\n\n// src/internal/raindrop-telemetry-integration.ts\nvar RaindropTelemetryIntegration = class {\n  constructor(opts) {\n    this.callStates = /* @__PURE__ */ new Map();\n    // \u2500\u2500 onStart \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.onStart = (event) => {\n      var _a, _b, _c, _d;\n      if (event.isEnabled !== true) return;\n      const isEmbed = event.operationId === \"ai.embed\" || event.operationId === \"ai.embedMany\";\n      const recordInputs = event.recordInputs !== false;\n      const recordOutputs = event.recordOutputs !== false;\n      const functionId = event.functionId;\n      const metadata = event.metadata;\n      const callMeta = this.extractRaindropMetadata(metadata);\n      const inherited = getContextManager().getParentSpanIds();\n      const eventIdGenerated = (metadata == null ? void 0 : metadata[\"raindrop.internal.eventIdGenerated\"]) === \"true\" || (metadata == null ? void 0 : metadata[\"raindrop.internal.eventIdGenerated\"]) === true;\n      const explicitEventId = callMeta.eventId && !eventIdGenerated ? callMeta.eventId : void 0;\n      const eventId = (_d = (_c = (_b = explicitEventId != null ? explicitEventId : (_a = this.defaultContext) == null ? void 0 : _a.eventId) != null ? _b : inherited == null ? void 0 : inherited.eventId) != null ? _c : callMeta.eventId) != null ? _d : randomUUID();\n      const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;\n      const { operationName, resourceName } = opName(\n        event.operationId,\n        functionId\n      );\n      let rootSpan;\n      if (this.sendTraces) {\n        const promptAttrs = !isEmbed && recordInputs ? [\n          attrString(\n            \"ai.prompt\",\n            safeJsonWithUint8({\n              system: event.system,\n              prompt: event.prompt,\n              messages: event.messages\n            })\n          )\n        ] : [];\n        const embedAttrs = isEmbed && recordInputs ? event.operationId === \"ai.embedMany\" ? [\n          attrString(\n            \"ai.values\",\n            safeJsonWithUint8(event.value)\n          )\n        ] : [attrString(\"ai.value\", safeJsonWithUint8(event.value))] : [];\n        rootSpan = this.traceShipper.startSpan({\n          name: event.operationId,\n          parent: inheritedParent,\n          eventId,\n          operationId: event.operationId,\n          attributes: [\n            attrString(\"operation.name\", operationName),\n            attrString(\"resource.name\", resourceName),\n            attrString(\"ai.telemetry.functionId\", functionId),\n            attrString(\"ai.model.provider\", event.provider),\n            attrString(\"ai.model.id\", event.modelId),\n            // Filter out raindrop.eventId from metadata attrs since TraceShipper\n            // already sets it via the eventId arg. Without this, eventMetadata()'s\n            // auto-generated ID would duplicate and override the resolved one.\n            ...attrsFromTelemetryMetadata(\n              metadata ? Object.fromEntries(\n                Object.entries(metadata).filter(\n                  ([k]) => k !== \"raindrop.eventId\" && k !== \"raindrop.internal.eventIdGenerated\"\n                )\n              ) : void 0\n            ),\n            ...promptAttrs,\n            ...embedAttrs\n          ]\n        });\n      }\n      this.callStates.set(event.callId, {\n        operationId: event.operationId,\n        eventId,\n        rootSpan,\n        rootParent: rootSpan ? this.spanParentRef(rootSpan) : inheritedParent,\n        stepSpan: void 0,\n        stepParent: void 0,\n        toolSpans: /* @__PURE__ */ new Map(),\n        embedSpans: /* @__PURE__ */ new Map(),\n        recordInputs,\n        recordOutputs,\n        functionId,\n        metadata,\n        accumulatedText: \"\",\n        inputText: isEmbed ? void 0 : this.extractInputText(event),\n        toolCallCount: 0\n      });\n    };\n    // \u2500\u2500 onStepStart \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.onStepStart = (event) => {\n      const state = this.getState(event.callId);\n      if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;\n      const isStream = state.operationId === \"ai.streamText\" || state.operationId === \"ai.streamObject\";\n      const stepOperationId = isStream ? `${state.operationId}.doStream` : `${state.operationId}.doGenerate`;\n      const { operationName, resourceName } = opName(\n        stepOperationId,\n        state.functionId\n      );\n      const inputAttrs = [];\n      if (state.recordInputs) {\n        if (event.promptMessages) {\n          inputAttrs.push(\n            attrString(\n              \"ai.prompt.messages\",\n              safeJsonWithUint8(event.promptMessages)\n            )\n          );\n        }\n        if (event.stepTools) {\n          inputAttrs.push(\n            attrStringArray(\n              \"ai.prompt.tools\",\n              event.stepTools.map((t) => JSON.stringify(t))\n            )\n          );\n        }\n        if (event.stepToolChoice != null) {\n          inputAttrs.push(\n            attrString(\n              \"ai.prompt.toolChoice\",\n              JSON.stringify(event.stepToolChoice)\n            )\n          );\n        }\n      }\n      const stepSpan = this.traceShipper.startSpan({\n        name: stepOperationId,\n        parent: state.rootParent,\n        eventId: state.eventId,\n        operationId: stepOperationId,\n        attributes: [\n          attrString(\"operation.name\", operationName),\n          attrString(\"resource.name\", resourceName),\n          attrString(\"ai.telemetry.functionId\", state.functionId),\n          attrString(\"ai.model.provider\", event.provider),\n          attrString(\"ai.model.id\", event.modelId),\n          attrString(\"gen_ai.system\", event.provider),\n          attrString(\"gen_ai.request.model\", event.modelId),\n          ...inputAttrs\n        ]\n      });\n      state.stepSpan = stepSpan;\n      state.stepParent = this.spanParentRef(stepSpan);\n    };\n    // \u2500\u2500 onToolCallStart \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.onToolCallStart = (event) => {\n      const state = this.getState(event.callId);\n      if (!(state == null ? void 0 : state.stepParent)) return;\n      const { toolCall } = event;\n      const { operationName, resourceName } = opName(\n        \"ai.toolCall\",\n        state.functionId\n      );\n      const inputAttrs = state.recordInputs ? [attrString(\"ai.toolCall.args\", safeJsonWithUint8(toolCall.input))] : [];\n      const toolSpan = this.traceShipper.startSpan({\n        name: \"ai.toolCall\",\n        parent: state.stepParent,\n        eventId: state.eventId,\n        operationId: \"ai.toolCall\",\n        attributes: [\n          attrString(\"operation.name\", operationName),\n          attrString(\"resource.name\", resourceName),\n          attrString(\"ai.telemetry.functionId\", state.functionId),\n          attrString(\"ai.toolCall.name\", toolCall.toolName),\n          attrString(\"ai.toolCall.id\", toolCall.toolCallId),\n          ...inputAttrs\n        ]\n      });\n      state.toolSpans.set(toolCall.toolCallId, toolSpan);\n      this.emitLive(state, \"tool_start\", toolCall.toolName, { args: toolCall.input });\n    };\n    // \u2500\u2500 onToolCallFinish \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.onToolCallFinish = (event) => {\n      const state = this.getState(event.callId);\n      if (!state) return;\n      const toolSpan = state.toolSpans.get(event.toolCall.toolCallId);\n      if (!toolSpan) return;\n      state.toolCallCount += 1;\n      if (event.success) {\n        const outputAttrs = state.recordOutputs ? [attrString(\"ai.toolCall.result\", safeJsonWithUint8(event.output))] : [];\n        this.traceShipper.endSpan(toolSpan, { attributes: outputAttrs });\n      } else {\n        this.traceShipper.endSpan(toolSpan, { error: event.error });\n      }\n      this.emitLive(state, \"tool_result\", event.toolCall.toolName);\n      state.toolSpans.delete(event.toolCall.toolCallId);\n    };\n    // \u2500\u2500 onChunk (streaming) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.onChunk = (event) => {\n      var _a, _b, _c, _d, _e;\n      const callId = (_b = event.callId) != null ? _b : (_a = event.chunk) == null ? void 0 : _a.callId;\n      if (!callId) return;\n      const state = this.getState(callId);\n      if (!state) return;\n      const chunk = event.chunk;\n      if (!chunk || typeof chunk !== \"object\") return;\n      if (chunk.type === \"text-delta\") {\n        const delta = (_c = chunk.textDelta) != null ? _c : chunk.delta;\n        if (typeof delta === \"string\") {\n          state.accumulatedText += delta;\n          this.emitLive(state, \"text_delta\", delta);\n        }\n      } else if (chunk.type === \"reasoning\" || chunk.type === \"reasoning-delta\") {\n        const text = (_e = (_d = chunk.textDelta) != null ? _d : chunk.text) != null ? _e : chunk.delta;\n        if (typeof text === \"string\") {\n          this.emitLive(state, \"reasoning_delta\", text);\n        }\n      }\n    };\n    // \u2500\u2500 onStepFinish \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.onStepFinish = (event) => {\n      var _a, _b, _c, _d, _e, _f, _g, _h, _i;\n      const state = this.getState(event.callId);\n      if (!(state == null ? void 0 : state.stepSpan)) return;\n      const outputAttrs = [];\n      if (state.recordOutputs) {\n        outputAttrs.push(\n          attrString(\"ai.response.finishReason\", event.finishReason),\n          attrString(\"ai.response.text\", (_a = event.text) != null ? _a : void 0),\n          attrString(\"ai.response.id\", (_b = event.response) == null ? void 0 : _b.id),\n          attrString(\"ai.response.model\", (_c = event.response) == null ? void 0 : _c.modelId),\n          attrString(\n            \"ai.response.timestamp\",\n            ((_d = event.response) == null ? void 0 : _d.timestamp) instanceof Date ? event.response.timestamp.toISOString() : (_e = event.response) == null ? void 0 : _e.timestamp\n          ),\n          attrString(\n            \"ai.response.providerMetadata\",\n            event.providerMetadata ? safeJsonWithUint8(event.providerMetadata) : void 0\n          )\n        );\n        if (((_f = event.toolCalls) == null ? void 0 : _f.length) > 0) {\n          outputAttrs.push(\n            attrString(\n              \"ai.response.toolCalls\",\n              JSON.stringify(\n                event.toolCalls.map((tc) => ({\n                  toolCallId: tc.toolCallId,\n                  toolName: tc.toolName,\n                  input: tc.input\n                }))\n              )\n            )\n          );\n        }\n        if (((_g = event.reasoning) == null ? void 0 : _g.length) > 0) {\n          const reasoningText = event.reasoning.filter((part) => \"text\" in part).map((part) => part.text).join(\"\\n\");\n          if (reasoningText) {\n            outputAttrs.push(attrString(\"ai.response.reasoning\", reasoningText));\n          }\n        }\n      }\n      outputAttrs.push(\n        attrStringArray(\"gen_ai.response.finish_reasons\", [event.finishReason]),\n        attrString(\"gen_ai.response.id\", (_h = event.response) == null ? void 0 : _h.id),\n        attrString(\"gen_ai.response.model\", (_i = event.response) == null ? void 0 : _i.modelId)\n      );\n      const usage = event.usage;\n      if (usage) {\n        outputAttrs.push(\n          attrInt(\"ai.usage.inputTokens\", usage.inputTokens),\n          attrInt(\"ai.usage.outputTokens\", usage.outputTokens),\n          attrInt(\"ai.usage.totalTokens\", usage.totalTokens),\n          attrInt(\"ai.usage.reasoningTokens\", usage.reasoningTokens),\n          attrInt(\"ai.usage.cachedInputTokens\", usage.cachedInputTokens),\n          attrInt(\"gen_ai.usage.input_tokens\", usage.inputTokens),\n          attrInt(\"gen_ai.usage.output_tokens\", usage.outputTokens)\n        );\n      }\n      this.traceShipper.endSpan(state.stepSpan, { attributes: outputAttrs });\n      state.stepSpan = void 0;\n      state.stepParent = void 0;\n    };\n    // \u2500\u2500 onEmbedStart \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.onEmbedStart = (event) => {\n      const state = this.getState(event.callId);\n      if (!(state == null ? void 0 : state.rootSpan) || !state.rootParent) return;\n      const { operationName, resourceName } = opName(\n        event.operationId,\n        state.functionId\n      );\n      const inputAttrs = state.recordInputs ? [\n        attrString(\n          \"ai.values\",\n          safeJsonWithUint8(event.values)\n        )\n      ] : [];\n      const embedSpan = this.traceShipper.startSpan({\n        name: event.operationId,\n        parent: state.rootParent,\n        eventId: state.eventId,\n        operationId: event.operationId,\n        attributes: [\n          attrString(\"operation.name\", operationName),\n          attrString(\"resource.name\", resourceName),\n          attrString(\"ai.telemetry.functionId\", state.functionId),\n          ...inputAttrs\n        ]\n      });\n      state.embedSpans.set(event.embedCallId, embedSpan);\n    };\n    // \u2500\u2500 onEmbedFinish \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.onEmbedFinish = (event) => {\n      var _a;\n      const state = this.getState(event.callId);\n      if (!state) return;\n      const embedSpan = state.embedSpans.get(event.embedCallId);\n      if (!embedSpan) return;\n      const outputAttrs = [];\n      if (state.recordOutputs) {\n        outputAttrs.push(\n          attrString(\n            \"ai.embeddings\",\n            safeJsonWithUint8(event.embeddings)\n          )\n        );\n      }\n      if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {\n        outputAttrs.push(attrInt(\"ai.usage.tokens\", event.usage.tokens));\n      }\n      this.traceShipper.endSpan(embedSpan, { attributes: outputAttrs });\n      state.embedSpans.delete(event.embedCallId);\n    };\n    // \u2500\u2500 onFinish \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.onFinish = (event) => {\n      const state = this.getState(event.callId);\n      if (!state) return;\n      const isEmbed = state.operationId === \"ai.embed\" || state.operationId === \"ai.embedMany\";\n      if (isEmbed) {\n        this.finishEmbed(event, state);\n      } else {\n        this.finishGenerate(event, state);\n      }\n      this.cleanup(event.callId);\n    };\n    // \u2500\u2500 onError \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.onError = (error) => {\n      var _a;\n      const event = error;\n      if (!(event == null ? void 0 : event.callId)) return;\n      const state = this.getState(event.callId);\n      if (!state) return;\n      const actualError = (_a = event.error) != null ? _a : error;\n      if (state.stepSpan) {\n        this.traceShipper.endSpan(state.stepSpan, { error: actualError });\n      }\n      for (const embedSpan of state.embedSpans.values()) {\n        this.traceShipper.endSpan(embedSpan, { error: actualError });\n      }\n      state.embedSpans.clear();\n      for (const toolSpan of state.toolSpans.values()) {\n        this.traceShipper.endSpan(toolSpan, { error: actualError });\n      }\n      state.toolSpans.clear();\n      if (state.rootSpan) {\n        this.traceShipper.endSpan(state.rootSpan, { error: actualError });\n      }\n      this.cleanup(event.callId);\n    };\n    // \u2500\u2500 executeTool \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n    this.executeTool = async ({\n      callId,\n      toolCallId,\n      execute\n    }) => {\n      const state = this.getState(callId);\n      const toolSpan = state == null ? void 0 : state.toolSpans.get(toolCallId);\n      if (!toolSpan) return execute();\n      return runWithParentSpanContext(\n        {\n          traceIdB64: toolSpan.ids.traceIdB64,\n          spanIdB64: toolSpan.ids.spanIdB64,\n          eventId: state.eventId\n        },\n        () => execute()\n      );\n    };\n    this.traceShipper = opts.traceShipper;\n    this.eventShipper = opts.eventShipper;\n    this.sendTraces = opts.sendTraces !== false;\n    this.sendEvents = opts.sendEvents !== false;\n    this.debug = opts.debug === true;\n    this.defaultContext = opts.context;\n  }\n  // \u2500\u2500 helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n  getState(callId) {\n    return this.callStates.get(callId);\n  }\n  cleanup(callId) {\n    this.callStates.delete(callId);\n  }\n  spanParentRef(span) {\n    return { traceIdB64: span.ids.traceIdB64, spanIdB64: span.ids.spanIdB64 };\n  }\n  emitLive(state, type, content, extra) {\n    var _a, _b, _c, _d, _e, _f;\n    if (!localDebuggerEnabled() || !state.rootSpan) return;\n    const callMeta = this.extractRaindropMetadata(state.metadata);\n    sendLocalDebuggerLiveEvent({\n      traceId: state.rootSpan.ids.traceIdB64,\n      type,\n      content,\n      metadata: {\n        userId: (_b = callMeta.userId) != null ? _b : (_a = this.defaultContext) == null ? void 0 : _a.userId,\n        convoId: (_d = callMeta.convoId) != null ? _d : (_c = this.defaultContext) == null ? void 0 : _c.convoId,\n        eventName: (_f = callMeta.eventName) != null ? _f : (_e = this.defaultContext) == null ? void 0 : _e.eventName,\n        eventId: state.eventId,\n        ...extra\n      }\n    });\n  }\n  extractRaindropMetadata(metadata) {\n    if (!metadata) return {};\n    const result = {};\n    const userId = metadata[\"raindrop.userId\"];\n    if (typeof userId === \"string\" && userId) result.userId = userId;\n    const eventId = metadata[\"raindrop.eventId\"];\n    if (typeof eventId === \"string\" && eventId) result.eventId = eventId;\n    const convoId = metadata[\"raindrop.convoId\"];\n    if (typeof convoId === \"string\" && convoId) result.convoId = convoId;\n    const eventName = metadata[\"raindrop.eventName\"];\n    if (typeof eventName === \"string\" && eventName) result.eventName = eventName;\n    const properties = metadata[\"raindrop.properties\"];\n    if (typeof properties === \"string\") {\n      try {\n        result.properties = JSON.parse(properties);\n      } catch (e) {\n      }\n    } else if (properties && typeof properties === \"object\") {\n      result.properties = properties;\n    }\n    return result;\n  }\n  /**\n   * Extract the user-facing input text from an onStart event.\n   * Mirrors the logic in the v4-v6 Proxy path (lastUserMessageTextFromArgs / extractInputFromArgs).\n   */\n  extractInputText(event) {\n    if (typeof event.prompt === \"string\") return event.prompt;\n    if (Array.isArray(event.messages)) {\n      for (let i = event.messages.length - 1; i >= 0; i--) {\n        const msg = event.messages[i];\n        if ((msg == null ? void 0 : msg.role) === \"user\") {\n          if (typeof msg.content === \"string\") return msg.content;\n          if (Array.isArray(msg.content)) {\n            const textPart = msg.content.find(\n              (p) => (p == null ? void 0 : p.type) === \"text\" && typeof p.text === \"string\"\n            );\n            if (textPart) return textPart.text;\n          }\n        }\n      }\n    }\n    return void 0;\n  }\n  finishGenerate(event, state) {\n    var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;\n    if (state.rootSpan) {\n      const outputAttrs = [];\n      if (state.recordOutputs) {\n        outputAttrs.push(\n          attrString(\"ai.response.finishReason\", event.finishReason),\n          attrString(\"ai.response.text\", (_a = event.text) != null ? _a : void 0),\n          attrString(\n            \"ai.response.providerMetadata\",\n            event.providerMetadata ? safeJsonWithUint8(event.providerMetadata) : void 0\n          )\n        );\n        if (((_b = event.toolCalls) == null ? void 0 : _b.length) > 0) {\n          outputAttrs.push(\n            attrString(\n              \"ai.response.toolCalls\",\n              JSON.stringify(\n                event.toolCalls.map((tc) => ({\n                  toolCallId: tc.toolCallId,\n                  toolName: tc.toolName,\n                  input: tc.input\n                }))\n              )\n            )\n          );\n        }\n        if (((_c = event.reasoning) == null ? void 0 : _c.length) > 0) {\n          const reasoningText = event.reasoning.filter((part) => \"text\" in part).map((part) => part.text).join(\"\\n\");\n          if (reasoningText) {\n            outputAttrs.push(attrString(\"ai.response.reasoning\", reasoningText));\n          }\n        }\n      }\n      const usage = (_d = event.totalUsage) != null ? _d : event.usage;\n      if (usage) {\n        outputAttrs.push(\n          attrInt(\"ai.usage.inputTokens\", usage.inputTokens),\n          attrInt(\"ai.usage.outputTokens\", usage.outputTokens),\n          attrInt(\"ai.usage.totalTokens\", usage.totalTokens),\n          attrInt(\"ai.usage.reasoningTokens\", usage.reasoningTokens),\n          attrInt(\"ai.usage.cachedInputTokens\", usage.cachedInputTokens)\n        );\n      }\n      outputAttrs.push(\n        attrInt(\"ai.toolCall.count\", state.toolCallCount)\n      );\n      this.traceShipper.endSpan(state.rootSpan, { attributes: outputAttrs });\n    }\n    if (this.sendEvents) {\n      const callMeta = this.extractRaindropMetadata(state.metadata);\n      const userId = (_f = callMeta.userId) != null ? _f : (_e = this.defaultContext) == null ? void 0 : _e.userId;\n      if (userId) {\n        const eventName = (_i = (_h = callMeta.eventName) != null ? _h : (_g = this.defaultContext) == null ? void 0 : _g.eventName) != null ? _i : state.operationId;\n        const output = (_j = event.text) != null ? _j : state.accumulatedText || void 0;\n        const input = state.inputText;\n        const model = (_k = event.response) == null ? void 0 : _k.modelId;\n        const properties = {\n          ...(_l = this.defaultContext) == null ? void 0 : _l.properties,\n          ...callMeta.properties\n        };\n        const convoId = (_n = callMeta.convoId) != null ? _n : (_m = this.defaultContext) == null ? void 0 : _m.convoId;\n        void this.eventShipper.patch(state.eventId, {\n          eventName,\n          userId,\n          convoId,\n          input,\n          output,\n          model,\n          properties: Object.keys(properties).length > 0 ? properties : void 0,\n          isPending: false\n        }).catch((err) => {\n          if (this.debug) {\n            console.warn(\n              `[raindrop-ai/ai-sdk] event patch failed: ${err instanceof Error ? err.message : err}`\n            );\n          }\n        });\n      }\n    }\n  }\n  finishEmbed(event, state) {\n    var _a;\n    if (!state.rootSpan) return;\n    const outputAttrs = [];\n    const isMany = state.operationId === \"ai.embedMany\";\n    if (state.recordOutputs) {\n      if (isMany) {\n        outputAttrs.push(\n          attrString(\"ai.embeddings\", safeJsonWithUint8(event.embedding))\n        );\n      } else {\n        outputAttrs.push(\n          attrString(\"ai.embedding\", safeJsonWithUint8(event.embedding))\n        );\n      }\n    }\n    if (((_a = event.usage) == null ? void 0 : _a.tokens) != null) {\n      outputAttrs.push(attrInt(\"ai.usage.tokens\", event.usage.tokens));\n    }\n    this.traceShipper.endSpan(state.rootSpan, { attributes: outputAttrs });\n  }\n};\n\n// src/internal/traces.ts\nvar TraceShipper2 = class extends TraceShipper {\n  constructor(opts) {\n    var _a, _b, _c;\n    super({\n      ...opts,\n      sdkName: (_a = opts.sdkName) != null ? _a : \"ai-sdk\",\n      serviceName: (_b = opts.serviceName) != null ? _b : \"raindrop.ai-sdk\",\n      serviceVersion: (_c = opts.serviceVersion) != null ? _c : libraryVersion\n    });\n  }\n};\n\n// src/internal/wrap/wrapAISDK.ts\nvar AGENT_REPORTING_TOOL_NAME_DEFAULT = \"__raindrop_report\";\nvar AGENT_REPORTING_SIGNALS_DEFAULT = {\n  missing_context: {\n    description: \"You cannot complete the task because critical information, credentials, or access is missing and the user cannot provide it. Do NOT report this for normal clarifying questions \\u2014 only when you are blocked.\",\n    sentiment: \"NEGATIVE\"\n  },\n  repeatedly_broken_tool: {\n    description: \"A tool has failed or not returned the expected response on multiple distinct attempts in this conversation, preventing task completion. A single tool error is NOT enough \\u2014 the tool must be persistently broken or aberrantly behaving across retries.\",\n    sentiment: \"NEGATIVE\"\n  },\n  capability_gap: {\n    description: \"The task requires a tool, permission, or capability that you do not have. For example, the user asks you to perform an action but no suitable tool exists, or you lack the necessary access. Do NOT report this if you simply need more information from the user \\u2014 only when the gap is in your own capabilities.\",\n    sentiment: \"NEGATIVE\"\n  },\n  complete_task_failure: {\n    description: \"You were unable to accomplish what the user asked despite making genuine attempts. This might be things like, you genuinely do not have the capabilities the user is asking for. You have tried but run into a persistent bug in the environment etc. This is NOT a refusal or policy block \\u2014 you tried and failed to deliver the result.\",\n    sentiment: \"NEGATIVE\"\n  }\n};\nvar AGENT_REPORTING_TOOL_PREAMBLE = \"You have a diagnostic tool for flagging serious failures for developer review. Only call this when you hit a significant, unrecoverable problem \\u2014 not for minor hiccups or routine clarifications. If you can still help the user, do that instead of calling this tool. This tool is invisible to the user \\u2014 never mention it or its output.\";\nvar pendingStoresByShipper = /* @__PURE__ */ new WeakMap();\nvar PendingToolSpanStore = class _PendingToolSpanStore {\n  constructor() {\n    this.spans = /* @__PURE__ */ new Map();\n  }\n  static for(traceShipper, eventId) {\n    let byEvent = pendingStoresByShipper.get(traceShipper);\n    if (!byEvent) {\n      byEvent = /* @__PURE__ */ new Map();\n      pendingStoresByShipper.set(traceShipper, byEvent);\n    }\n    let store = byEvent.get(eventId);\n    if (!store) {\n      store = new _PendingToolSpanStore();\n      byEvent.set(eventId, store);\n    }\n    return store;\n  }\n  resolve(resolvedToolSpans, ctx) {\n    for (const [key, span] of this.spans) {\n      const toolCall = resolvedToolSpans.get(key);\n      if (!toolCall) continue;\n      finishToolSpan(toolCall, span, ctx, span.startTimeUnixNano);\n      this.spans.delete(key);\n    }\n  }\n  remember(toolCall, rootSpan, ctx, startTimeUnixNano) {\n    if (this.spans.has(toolCall.key)) return;\n    this.spans.set(toolCall.key, startToolSpan(toolCall, rootSpan, ctx, startTimeUnixNano));\n  }\n  closeAll(traceShipper) {\n    for (const [, span] of this.spans) {\n      traceShipper.endSpan(span, { endTimeUnixNano: span.startTimeUnixNano });\n    }\n    this.spans.clear();\n  }\n  cleanup(traceShipper, eventId) {\n    if (this.spans.size > 0) return;\n    const byEvent = pendingStoresByShipper.get(traceShipper);\n    if (!byEvent) return;\n    byEvent.delete(eventId);\n    if (byEvent.size === 0) pendingStoresByShipper.delete(traceShipper);\n  }\n};\nvar warnedMissingUserId = false;\nfunction warnMissingUserIdOnce() {\n  if (warnedMissingUserId) return;\n  warnedMissingUserId = true;\n  console.warn(\n    \"[raindrop-ai/ai-sdk] userId was not provided in wrap() context or via eventMetadata(). Events will be skipped unless a userId is provided.\"\n  );\n}\nfunction _resetWarnedMissingUserId() {\n  warnedMissingUserId = false;\n}\nfunction extractRaindropCallOptions(options) {\n  if (!isRecord(options)) return {};\n  const em = options[\"metadata\"];\n  if (isRecord(em)) return extractRaindropMetadata(em);\n  const telemetry = extractExperimentalTelemetry(options);\n  if (telemetry == null ? void 0 : telemetry.metadata) return extractRaindropMetadata(telemetry.metadata);\n  return {};\n}\nfunction extractRaindropMetadata(metadata) {\n  if (!metadata || typeof metadata !== \"object\") return {};\n  const result = {};\n  const userId = metadata[\"raindrop.userId\"];\n  if (typeof userId === \"string\" && userId) result.userId = userId;\n  const eventId = metadata[\"raindrop.eventId\"];\n  if (typeof eventId === \"string\" && eventId) result.eventId = eventId;\n  const eventIdGenerated = metadata[\"raindrop.internal.eventIdGenerated\"];\n  if (eventIdGenerated === true || eventIdGenerated === \"true\" || eventIdGenerated === \"1\") {\n    result.eventIdGenerated = true;\n  }\n  const convoId = metadata[\"raindrop.convoId\"];\n  if (typeof convoId === \"string\" && convoId) result.convoId = convoId;\n  const eventName = metadata[\"raindrop.eventName\"];\n  if (typeof eventName === \"string\" && eventName) result.eventName = eventName;\n  const properties = metadata[\"raindrop.properties\"];\n  if (typeof properties === \"string\") {\n    try {\n      result.properties = JSON.parse(properties);\n    } catch (e) {\n    }\n  } else if (properties && typeof properties === \"object\") {\n    result.properties = properties;\n  }\n  return result;\n}\nfunction mergeContexts(wrapTime, callTime) {\n  const result = { ...wrapTime };\n  if (callTime.userId) result.userId = callTime.userId;\n  if (callTime.eventId) result.eventId = callTime.eventId;\n  if (callTime.convoId) result.convoId = callTime.convoId;\n  if (callTime.eventName) result.eventName = callTime.eventName;\n  if (callTime.properties) {\n    result.properties = {\n      ...wrapTime.properties,\n      ...callTime.properties\n    };\n  }\n  return result;\n}\nfunction normalizeSelfDiagnosticsSignals(signals) {\n  if (!signals) return AGENT_REPORTING_SIGNALS_DEFAULT;\n  const normalizedEntries = Object.entries(signals).map(([key, value]) => {\n    var _a;\n    const signalKey = key.trim();\n    if (!signalKey || !value || typeof value !== \"object\") return void 0;\n    const description = (_a = value.description) == null ? void 0 : _a.trim();\n    if (!description) return void 0;\n    const sentiment = value.sentiment;\n    return [\n      signalKey,\n      {\n        description,\n        ...sentiment === \"POSITIVE\" || sentiment === \"NEGATIVE\" ? { sentiment } : {}\n      }\n    ];\n  }).filter(\n    (entry) => entry !== void 0\n  );\n  if (normalizedEntries.length === 0) return AGENT_REPORTING_SIGNALS_DEFAULT;\n  return Object.fromEntries(normalizedEntries);\n}\nfunction normalizeSelfDiagnosticsConfig(options) {\n  var _a, _b;\n  if (!(options == null ? void 0 : options.enabled)) return void 0;\n  const signalDefinitions = normalizeSelfDiagnosticsSignals(options.signals);\n  const signalKeys = Object.keys(signalDefinitions);\n  const signalDescriptions = {};\n  const signalSentiments = {};\n  for (const signalKey of signalKeys) {\n    const def = signalDefinitions[signalKey];\n    if (!def) continue;\n    signalDescriptions[signalKey] = def.description;\n    signalSentiments[signalKey] = def.sentiment;\n  }\n  const customGuidanceText = ((_a = options.guidance) == null ? void 0 : _a.trim()) || \"\";\n  const toolName = ((_b = options.toolName) == null ? void 0 : _b.trim()) || AGENT_REPORTING_TOOL_NAME_DEFAULT;\n  const signalList = signalKeys.map((signalKey) => {\n    const sentiment = signalSentiments[signalKey];\n    const sentimentTag = sentiment ? ` [${sentiment.toLowerCase()}]` : \"\";\n    return `- ${signalKey}: ${signalDescriptions[signalKey]}${sentimentTag}`;\n  }).join(\"\\n\");\n  const guidanceBlock = customGuidanceText ? `\nAdditional guidance: ${customGuidanceText}\n` : \"\";\n  const toolDescription = `${AGENT_REPORTING_TOOL_PREAMBLE}\n\nWhen to call:\n- You are blocked from completing the task due to missing information or access that the user cannot provide.\n- A tool is persistently failing across multiple attempts, not just a single transient error.\n- The task requires a tool, permission, or capability you do not have.\n- You genuinely cannot deliver what the user asked for despite trying.\n\nWhen NOT to call:\n- Normal clarifying questions or back-and-forth with the user.\n- A single tool error that you can recover from or retry.\n- You successfully completed the task, even if it was difficult.\n- Policy refusals or content filtering \\u2014 those are working as intended.\n\nRules:\n1. Pick the single best category.\n2. Do not fabricate issues. Only report what is evident from the conversation.\n3. Err on the side of NOT calling this tool. When in doubt, help the user instead.\n${guidanceBlock}\nCategories:\n${signalList}`;\n  return {\n    toolName,\n    toolDescription,\n    signalKeys,\n    signalKeySet: new Set(signalKeys),\n    signalDescriptions,\n    signalSentiments\n  };\n}\nfunction resolveJsonSchemaFactory(aiSDK) {\n  if (!isRecord(aiSDK) || !isFunction(aiSDK[\"jsonSchema\"])) return void 0;\n  return aiSDK[\"jsonSchema\"];\n}\nfunction detectAISDKVersion(aiSDK) {\n  if (!isRecord(aiSDK)) return \"unknown\";\n  if (isFunction(aiSDK[\"jsonSchema\"])) return \"6\";\n  if (isFunction(aiSDK[\"tool\"])) return \"5\";\n  return \"4\";\n}\nfunction hasStructuredTelemetryEvents(aiSDK) {\n  return isRecord(aiSDK) && isFunction(aiSDK[\"registerTelemetryIntegration\"]) && isFunction(aiSDK[\"experimental_streamModelCall\"]);\n}\nfunction asVercelSchema(jsonSchemaObj) {\n  const validatorSymbol = /* @__PURE__ */ Symbol.for(\"vercel.ai.validator\");\n  const schemaSymbol = /* @__PURE__ */ Symbol.for(\"vercel.ai.schema\");\n  return {\n    [schemaSymbol]: true,\n    [validatorSymbol]: true,\n    _type: void 0,\n    jsonSchema: jsonSchemaObj,\n    validate: (value) => ({ success: true, value })\n  };\n}\nfunction createSelfDiagnosticsTool(ctx) {\n  const config = ctx.selfDiagnostics;\n  if (!config) return void 0;\n  const schema = {\n    type: \"object\",\n    additionalProperties: false,\n    properties: {\n      category: {\n        type: \"string\",\n        enum: config.signalKeys,\n        description: \"The single best-matching category from the list above.\"\n      },\n      detail: {\n        type: \"string\",\n        description: \"One sentence of factual context: what happened and why it matters. Do not include PII or secrets.\"\n      }\n    },\n    required: [\"category\", \"detail\"]\n  };\n  const parameters = asVercelSchema(schema);\n  let inputSchema = parameters;\n  if (ctx.jsonSchemaFactory) {\n    try {\n      inputSchema = ctx.jsonSchemaFactory(schema);\n    } catch (e) {\n      inputSchema = parameters;\n    }\n  }\n  const execute = async (rawInput) => {\n    var _a;\n    const input = isRecord(rawInput) ? rawInput : void 0;\n    const fallbackCategory = (_a = config.signalKeys[0]) != null ? _a : \"unknown\";\n    const categoryCandidate = typeof (input == null ? void 0 : input[\"category\"]) === \"string\" ? input[\"category\"].trim() : void 0;\n    const category = categoryCandidate && config.signalKeySet.has(categoryCandidate) ? categoryCandidate : fallbackCategory;\n    const detail = typeof (input == null ? void 0 : input[\"detail\"]) === \"string\" ? input[\"detail\"].trim() : \"\";\n    const signalDescription = config.signalDescriptions[category];\n    const signalSentiment = config.signalSentiments[category];\n    void ctx.eventShipper.trackSignal({\n      eventId: ctx.eventId,\n      name: `self diagnostics - ${category}`,\n      type: \"agent\",\n      sentiment: signalSentiment,\n      properties: {\n        source: \"agent_reporting_tool\",\n        category,\n        signal_description: signalDescription,\n        ai_sdk_version: ctx.aiSDKVersion,\n        ...detail ? { detail } : {}\n      }\n    }).catch((err) => {\n      if (ctx.debug) {\n        const msg = err instanceof Error ? err.message : String(err);\n        console.warn(`[raindrop-ai/ai-sdk] selfDiagnostics signal dispatch failed: ${msg}`);\n      }\n    });\n    return { acknowledged: true, category };\n  };\n  return {\n    description: config.toolDescription,\n    execute,\n    parameters,\n    inputSchema\n  };\n}\nfunction getCurrentParentSpanContextSync() {\n  return getContextManager().getParentSpanIds();\n}\nfunction runWithParentSpanContextSync(ctx, fn) {\n  const cm = getContextManager();\n  const span = {\n    traceIdB64: ctx.traceIdB64,\n    spanIdB64: ctx.spanIdB64,\n    eventId: ctx.eventId\n  };\n  return cm.runInContext(span, fn);\n}\nfunction isAsyncIterable(value) {\n  return value !== null && typeof value === \"object\" && Symbol.asyncIterator in value;\n}\nfunction firstFiniteNumber(...values) {\n  for (const value of values) {\n    if (typeof value === \"number\" && Number.isFinite(value)) {\n      return value;\n    }\n  }\n  return void 0;\n}\nfunction resolveUsageRecord(result) {\n  if (!isRecord(result)) return void 0;\n  let usage;\n  try {\n    if (isRecord(result[\"totalUsage\"])) {\n      usage = result[\"totalUsage\"];\n    } else if (isRecord(result[\"usage\"])) {\n      usage = result[\"usage\"];\n    }\n  } catch (e) {\n    return void 0;\n  }\n  return isRecord(usage) ? usage : void 0;\n}\nfunction extractUsageMetrics(result) {\n  const usage = resolveUsageRecord(result);\n  if (!usage) return {};\n  const inputTokenValue = usage[\"inputTokens\"];\n  const outputTokenValue = usage[\"outputTokens\"];\n  const inputTokens = firstFiniteNumber(\n    isRecord(inputTokenValue) ? inputTokenValue[\"total\"] : void 0,\n    inputTokenValue,\n    usage[\"promptTokens\"],\n    usage[\"prompt_tokens\"]\n  );\n  const outputTokens = firstFiniteNumber(\n    isRecord(outputTokenValue) ? outputTokenValue[\"total\"] : void 0,\n    outputTokenValue,\n    usage[\"completionTokens\"],\n    usage[\"completion_tokens\"]\n  );\n  const totalTokens = firstFiniteNumber(\n    usage[\"totalTokens\"],\n    usage[\"tokens\"],\n    usage[\"total_tokens\"],\n    inputTokens !== void 0 && outputTokens !== void 0 ? inputTokens + outputTokens : void 0\n  );\n  const reasoningTokens = firstFiniteNumber(\n    isRecord(outputTokenValue) ? outputTokenValue[\"reasoning\"] : void 0,\n    usage[\"reasoningTokens\"],\n    usage[\"completionReasoningTokens\"],\n    usage[\"completion_reasoning_tokens\"],\n    usage[\"reasoning_tokens\"],\n    usage[\"thinkingTokens\"],\n    usage[\"thinking_tokens\"]\n  );\n  const cachedInputTokens = firstFiniteNumber(\n    isRecord(inputTokenValue) ? inputTokenValue[\"cacheRead\"] : void 0,\n    usage[\"cachedInputTokens\"],\n    usage[\"promptCachedTokens\"],\n    usage[\"prompt_cached_tokens\"]\n  );\n  return {\n    inputTokens,\n    outputTokens,\n    totalTokens,\n    reasoningTokens,\n    cachedInputTokens\n  };\n}\nfunction isObjectOperation(operation) {\n  return operation === \"generateObject\" || operation === \"streamObject\";\n}\nfunction logFinalizeError(debug, err) {\n  if (debug) {\n    console.warn(\n      `[raindrop-ai/ai-sdk] finalize failed: ${err instanceof Error ? err.message : err}`\n    );\n  }\n}\nfunction shouldKeepEventPending(params) {\n  if (params.error != null || !params.canKeepEventPending) return false;\n  return params.finishReason === \"tool-calls\" || params.finishReason === \"tool_calls\";\n}\nfunction normalizePromptAttr(arg) {\n  if (!isRecord(arg)) return arg;\n  const system = arg[\"system\"];\n  const prompt = arg[\"prompt\"];\n  const messages = arg[\"messages\"];\n  if (Array.isArray(messages)) {\n    if (system) {\n      const sysContent = typeof system === \"string\" ? system : JSON.stringify(system);\n      return [{ role: \"system\", content: sysContent }, ...messages];\n    }\n    return messages;\n  }\n  if (typeof prompt === \"string\") {\n    const msgs = [];\n    if (system) {\n      msgs.push({ role: \"system\", content: typeof system === \"string\" ? system : JSON.stringify(system) });\n    }\n    msgs.push({ role: \"user\", content: prompt });\n    return msgs;\n  }\n  return { system, prompt, messages };\n}\nfunction getLocalDebuggerMetadata(ctx) {\n  return {\n    eventId: ctx.eventId,\n    ...ctx.eventName ? { eventName: ctx.eventName } : {},\n    ...ctx.userId ? { userId: ctx.userId } : {},\n    ...ctx.convoId ? { convoId: ctx.convoId } : {}\n  };\n}\nasync function safeFinalize(finalize, debug, result, error) {\n  try {\n    await finalize(result, error);\n  } catch (finalizeErr) {\n    logFinalizeError(debug, finalizeErr);\n  }\n}\nfunction runWithRootContextSync(rootSpan, eventId, fn) {\n  if (!rootSpan) return fn();\n  return runWithParentSpanContextSync(\n    { traceIdB64: rootSpan.ids.traceIdB64, spanIdB64: rootSpan.ids.spanIdB64, eventId },\n    fn\n  );\n}\nasync function runWithRootContextAsync(rootSpan, eventId, fn) {\n  if (!rootSpan) return await fn();\n  return await runWithParentSpanContext(\n    { traceIdB64: rootSpan.ids.traceIdB64, spanIdB64: rootSpan.ids.spanIdB64, eventId },\n    fn\n  );\n}\nfunction teeStreamObjectBaseStream(result) {\n  if (!result || !isRecord(result)) return;\n  const baseStream = result[\"baseStream\"];\n  if (!(baseStream && typeof baseStream === \"object\" && \"tee\" in baseStream)) return;\n  try {\n    const [consumeStream, userStream] = baseStream.tee();\n    result[\"baseStream\"] = userStream;\n    consumeStream.pipeTo(new WritableStream({ write() {\n    } })).catch(() => {\n    });\n  } catch (e) {\n  }\n}\nfunction setupOperation(params) {\n  var _a, _b, _c;\n  const {\n    operation,\n    arg,\n    inherited,\n    aiSDK,\n    options,\n    eventShipper,\n    traceShipper,\n    debug,\n    selfDiagnostics,\n    sendTraces\n  } = params;\n  const wrapTimeCtx = resolveContext(options.context, { operation, args: arg });\n  const telemetry = extractExperimentalTelemetry(arg);\n  const callTimeCtx = extractRaindropMetadata(telemetry == null ? void 0 : telemetry.metadata);\n  const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);\n  if (!mergedCtx.userId) warnMissingUserIdOnce();\n  const hasCallTimeEventId = callTimeCtx.eventId != null;\n  const hasWrapTimeEventId = wrapTimeCtx.eventId != null;\n  const eventId = (_c = (_b = (_a = callTimeCtx.eventId) != null ? _a : wrapTimeCtx.eventId) != null ? _b : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();\n  const ctx = { ...mergedCtx, eventId };\n  const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;\n  const outerOperationId = `ai.${operation}`;\n  const { operationName, resourceName } = opName(outerOperationId, telemetry == null ? void 0 : telemetry.functionId);\n  const modelInfoFromArgs = isRecord(arg) ? extractModelInfo(arg[\"model\"]) : {};\n  const rootSpan = sendTraces ? traceShipper.startSpan({\n    name: outerOperationId,\n    parent: inheritedParent,\n    eventId,\n    operationId: outerOperationId,\n    attributes: [\n      attrString(\"operation.name\", operationName),\n      attrString(\"resource.name\", resourceName),\n      attrString(\"ai.telemetry.functionId\", telemetry == null ? void 0 : telemetry.functionId),\n      attrString(\"ai.model.provider\", modelInfoFromArgs.provider),\n      attrString(\"ai.model.id\", modelInfoFromArgs.modelId),\n      attrString(\"ai.telemetry.metadata.raindrop.eventId\", eventId),\n      attrString(\"ai.telemetry.metadata.raindrop.eventName\", mergedCtx.eventName),\n      attrString(\"ai.telemetry.metadata.raindrop.ai.userId\", mergedCtx.userId),\n      attrString(\"ai.telemetry.metadata.raindrop.convoId\", mergedCtx.convoId),\n      ...attrsFromTelemetryMetadata(telemetry == null ? void 0 : telemetry.metadata),\n      ...attrsFromHeaders(isRecord(arg) ? arg[\"headers\"] : void 0),\n      ...attrsFromSettings(arg),\n      ...(telemetry == null ? void 0 : telemetry.recordInputs) === false ? [] : [\n        attrString(\n          \"ai.prompt\",\n          safeJsonWithUint8(normalizePromptAttr(arg))\n        )\n      ]\n    ]\n  }) : void 0;\n  const rootParentForChildren = rootSpan ? { traceIdB64: rootSpan.ids.traceIdB64, spanIdB64: rootSpan.ids.spanIdB64 } : inheritedParent;\n  const operationSelfDiagnostics = isObjectOperation(operation) ? void 0 : selfDiagnostics;\n  const wrapCtx = {\n    eventId,\n    context: mergedCtx,\n    telemetry,\n    sendTraces,\n    debug,\n    eventShipper,\n    traceShipper,\n    rootParentForChildren,\n    jsonSchemaFactory: resolveJsonSchemaFactory(aiSDK),\n    selfDiagnostics: operationSelfDiagnostics,\n    aiSDKVersion: detectAISDKVersion(aiSDK)\n  };\n  const toolCalls = [];\n  const argsWithWrappedTools = wrapTools(arg, wrapCtx, toolCalls);\n  const wrappedArgs = wrapModel(argsWithWrappedTools, aiSDK, outerOperationId, wrapCtx);\n  return {\n    eventId,\n    ctx,\n    canKeepEventPending: hasCallTimeEventId ? callTimeCtx.eventIdGenerated !== true : hasWrapTimeEventId,\n    telemetry,\n    rootSpan,\n    wrappedArgs,\n    toolCalls\n  };\n}\nfunction createFinalize(params) {\n  const {\n    operation,\n    arg,\n    setup,\n    autoAttachmentEnabled,\n    sendEvents,\n    debug,\n    options,\n    eventShipper,\n    traceShipper\n  } = params;\n  return async (result, error) => {\n    var _a, _b, _c, _d;\n    const usage = extractUsageMetrics(result);\n    const model = extractModel(result);\n    const finishReason = extractFinishReason(result);\n    const keepEventPending = shouldKeepEventPending({\n      finishReason,\n      error,\n      canKeepEventPending: setup.canKeepEventPending\n    });\n    const inputAttachments = autoAttachmentEnabled ? extractInputAttachmentsFromArgs(arg) : void 0;\n    const outputAttachments = autoAttachmentEnabled ? await extractOutputAttachmentsFromResult(result) : void 0;\n    const baseMessages = coerceMessagesFromArgs(arg);\n    const responseMessages = extractResponseMessages(result);\n    const allMessages = [...baseMessages, ...responseMessages];\n    const outputText = extractTextOutput(result);\n    const outputObjectJson = extractObjectOutput(result);\n    const defaultOutput = isObjectOperation(operation) ? outputObjectJson : outputText;\n    const defaultPatch = {\n      eventName: (_a = setup.ctx.eventName) != null ? _a : operation,\n      input: (_b = lastUserMessageTextFromArgs(arg)) != null ? _b : extractInputFromArgs(arg),\n      output: defaultOutput,\n      model,\n      properties: setup.ctx.properties,\n      attachments: mergeAttachments(setup.ctx.attachments, inputAttachments, outputAttachments)\n    };\n    const built = await maybeBuildEvent(options.buildEvent, allMessages);\n    const patch = mergeBuildEventPatch(defaultPatch, built);\n    const output = patch.output;\n    const finalModel = (_c = patch.model) != null ? _c : model;\n    if (setup.rootSpan) {\n      const spanEndTimeUnixNano = nowUnixNanoString();\n      const syntheticToolCallCount = emitTranscriptToolCallSpans({\n        baseMessages,\n        responseMessages,\n        rootSpan: setup.rootSpan,\n        eventId: setup.eventId,\n        telemetry: setup.telemetry,\n        toolCalls: setup.toolCalls,\n        traceShipper,\n        endTimeUnixNano: spanEndTimeUnixNano,\n        keepEventPending\n      });\n      const providerMetadata = isRecord(result) ? result[\"providerMetadata\"] : void 0;\n      const resultToolCalls = isRecord(result) && Array.isArray(result[\"toolCalls\"]) ? safeJsonWithUint8(result[\"toolCalls\"]) : setup.toolCalls.length ? safeJsonWithUint8(setup.toolCalls) : void 0;\n      traceShipper.endSpan(setup.rootSpan, {\n        attributes: [\n          ...((_d = setup.telemetry) == null ? void 0 : _d.recordOutputs) === false ? [] : [\n            attrString(\"ai.response.finishReason\", finishReason),\n            isObjectOperation(operation) ? attrString(\"ai.response.object\", output) : attrString(\"ai.response.text\", output),\n            attrString(\"ai.response.toolCalls\", resultToolCalls),\n            attrString(\"ai.response.providerMetadata\", safeJsonWithUint8(providerMetadata))\n          ],\n          attrInt(\"ai.usage.promptTokens\", usage == null ? void 0 : usage.inputTokens),\n          attrInt(\"ai.usage.completionTokens\", usage == null ? void 0 : usage.outputTokens),\n          attrInt(\"ai.usage.inputTokens\", usage == null ? void 0 : usage.inputTokens),\n          attrInt(\"ai.usage.outputTokens\", usage == null ? void 0 : usage.outputTokens),\n          attrInt(\"ai.usage.totalTokens\", usage == null ? void 0 : usage.totalTokens),\n          attrInt(\"ai.usage.reasoningTokens\", usage == null ? void 0 : usage.reasoningTokens),\n          attrInt(\"ai.usage.cachedInputTokens\", usage == null ? void 0 : usage.cachedInputTokens),\n          attrInt(\"ai.toolCall.count\", setup.toolCalls.length + syntheticToolCallCount),\n          ...error ? [attrString(\"error.message\", error instanceof Error ? error.message : String(error))] : []\n        ],\n        error,\n        endTimeUnixNano: spanEndTimeUnixNano\n      });\n    }\n    if (sendEvents) {\n      void eventShipper.patch(setup.eventId, {\n        eventName: patch.eventName,\n        userId: setup.ctx.userId,\n        convoId: setup.ctx.convoId,\n        input: patch.input,\n        output,\n        model: finalModel,\n        properties: patch.properties,\n        attachments: patch.attachments,\n        isPending: keepEventPending\n      }).catch((err) => {\n        if (debug) {\n          console.warn(\n            `[raindrop-ai/ai-sdk] event patch failed: ${err instanceof Error ? err.message : err}`\n          );\n        }\n      });\n    }\n  };\n}\nfunction hasToolResult(toolCall) {\n  return toolCall.result !== void 0 || toolCall.status === \"ERROR\";\n}\nfunction getExecutedToolCallKeys(toolCalls) {\n  return new Set(\n    toolCalls.map((tc) => buildToolCallMatchKey({ toolCallId: tc.id, toolName: tc.name, input: tc.args })).filter((key) => typeof key === \"string\" && key.length > 0)\n  );\n}\nfunction getResolvedToolSpans(messages, executedKeys) {\n  return new Map(\n    extractToolSpansFromMessages(messages).filter((tc) => hasToolResult(tc) && !executedKeys.has(tc.key)).map((tc) => [tc.key, tc])\n  );\n}\nfunction startToolSpan(toolCall, rootSpan, ctx, startTimeUnixNano) {\n  var _a, _b, _c;\n  const { operationName, resourceName } = opName(\"ai.toolCall\", (_a = ctx.telemetry) == null ? void 0 : _a.functionId);\n  return ctx.traceShipper.startSpan({\n    name: \"ai.toolCall\",\n    parent: { traceIdB64: rootSpan.ids.traceIdB64, spanIdB64: rootSpan.ids.spanIdB64 },\n    eventId: ctx.eventId,\n    operationId: \"ai.toolCall\",\n    attributes: [\n      attrString(\"operation.name\", operationName),\n      attrString(\"resource.name\", resourceName),\n      attrString(\"ai.telemetry.functionId\", (_b = ctx.telemetry) == null ? void 0 : _b.functionId),\n      attrString(\"ai.toolCall.name\", toolCall.toolName),\n      attrString(\"ai.toolCall.id\", toolCall.toolCallId),\n      ...((_c = ctx.telemetry) == null ? void 0 : _c.recordInputs) === false ? [] : [attrString(\"ai.toolCall.args\", safeJsonWithUint8(toolCall.input))]\n    ],\n    startTimeUnixNano\n  });\n}\nfunction finishToolSpan(toolCall, span, ctx, endTimeUnixNano) {\n  var _a, _b, _c;\n  const endAttributes = toolCall.status === \"ERROR\" ? [attrString(\"error.message\", (_a = toolCall.errorMessage) != null ? _a : \"Tool call failed\")] : ((_b = ctx.telemetry) == null ? void 0 : _b.recordOutputs) === false ? [] : [attrString(\"ai.toolCall.result\", safeJsonWithUint8(toolCall.result))];\n  ctx.traceShipper.endSpan(span, {\n    attributes: endAttributes,\n    ...toolCall.status === \"ERROR\" ? { error: new Error((_c = toolCall.errorMessage) != null ? _c : \"Tool call failed\") } : {},\n    endTimeUnixNano\n  });\n}\nfunction emitToolSpan(toolCall, rootSpan, ctx, timeUnixNano) {\n  const span = startToolSpan(toolCall, rootSpan, ctx, timeUnixNano);\n  finishToolSpan(toolCall, span, ctx, timeUnixNano);\n}\nfunction emitTranscriptToolCallSpans(params) {\n  const store = PendingToolSpanStore.for(params.traceShipper, params.eventId);\n  const responseToolSpans = extractToolSpansFromMessages(params.responseMessages);\n  if (responseToolSpans.length === 0 && params.baseMessages.length === 0) {\n    if (!params.keepEventPending) {\n      store.closeAll(params.traceShipper);\n    }\n    store.cleanup(params.traceShipper, params.eventId);\n    return 0;\n  }\n  const ctx = {\n    eventId: params.eventId,\n    telemetry: params.telemetry,\n    traceShipper: params.traceShipper\n  };\n  const executedKeys = getExecutedToolCallKeys(params.toolCalls);\n  const resolvedSpans = getResolvedToolSpans(\n    [...params.baseMessages, ...params.responseMessages],\n    executedKeys\n  );\n  store.resolve(resolvedSpans, ctx);\n  let syntheticToolCallCount = 0;\n  for (const toolCall of responseToolSpans) {\n    if (executedKeys.has(toolCall.key)) continue;\n    executedKeys.add(toolCall.key);\n    syntheticToolCallCount += 1;\n    if (hasToolResult(toolCall) || !params.keepEventPending) {\n      emitToolSpan(toolCall, params.rootSpan, ctx, params.endTimeUnixNano);\n    } else {\n      store.remember(toolCall, params.rootSpan, ctx, params.endTimeUnixNano);\n    }\n  }\n  if (!params.keepEventPending) {\n    store.closeAll(params.traceShipper);\n  }\n  store.cleanup(params.traceShipper, params.eventId);\n  return syntheticToolCallCount;\n}\nfunction executeStreamingOperation(params) {\n  const {\n    operation,\n    arg,\n    callArgs,\n    aiSDK,\n    original,\n    deps,\n    sendEvents,\n    sendTraces,\n    selfDiagnostics,\n    autoAttachmentEnabled,\n    debug\n  } = params;\n  const setup = setupOperation({\n    operation,\n    arg,\n    inherited: getCurrentParentSpanContextSync(),\n    aiSDK,\n    options: deps.options,\n    eventShipper: deps.eventShipper,\n    traceShipper: deps.traceShipper,\n    debug,\n    selfDiagnostics,\n    sendTraces\n  });\n  const finalize = createFinalize({\n    operation,\n    arg,\n    setup,\n    autoAttachmentEnabled,\n    sendEvents,\n    debug,\n    options: deps.options,\n    eventShipper: deps.eventShipper,\n    traceShipper: deps.traceShipper\n  });\n  const argWithOnFinish = wrapOnFinish(setup.wrappedArgs, async (result) => {\n    await safeFinalize(finalize, debug, result);\n  });\n  const callOriginal = (...args) => {\n    return original.call(aiSDK, ...args);\n  };\n  try {\n    const result = runWithRootContextSync(setup.rootSpan, setup.eventId, () => {\n      const nextArgs = [...callArgs];\n      nextArgs[0] = argWithOnFinish;\n      return callOriginal(...nextArgs);\n    });\n    if (operation === \"streamObject\") {\n      teeStreamObjectBaseStream(result);\n    }\n    return result;\n  } catch (error) {\n    void safeFinalize(finalize, debug, void 0, error);\n    throw error;\n  }\n}\nasync function executeNonStreamingOperation(params) {\n  const {\n    operation,\n    arg,\n    callArgs,\n    aiSDK,\n    original,\n    deps,\n    sendEvents,\n    sendTraces,\n    selfDiagnostics,\n    autoAttachmentEnabled,\n    debug\n  } = params;\n  const inherited = await getCurrentParentSpanContext();\n  const setup = setupOperation({\n    operation,\n    arg,\n    inherited,\n    aiSDK,\n    options: deps.options,\n    eventShipper: deps.eventShipper,\n    traceShipper: deps.traceShipper,\n    debug,\n    selfDiagnostics,\n    sendTraces\n  });\n  const finalize = createFinalize({\n    operation,\n    arg,\n    setup,\n    autoAttachmentEnabled,\n    sendEvents,\n    debug,\n    options: deps.options,\n    eventShipper: deps.eventShipper,\n    traceShipper: deps.traceShipper\n  });\n  const callOriginal = async (...args) => {\n    return await original.call(aiSDK, ...args);\n  };\n  try {\n    const result = await runWithRootContextAsync(setup.rootSpan, setup.eventId, async () => {\n      const nextArgs = [...callArgs];\n      nextArgs[0] = setup.wrappedArgs;\n      return await callOriginal(...nextArgs);\n    });\n    await safeFinalize(finalize, debug, result);\n    return result;\n  } catch (error) {\n    await safeFinalize(finalize, debug, void 0, error);\n    throw error;\n  }\n}\nfunction wrapAISDK(aiSDK, deps) {\n  var _a, _b, _c, _d;\n  const debug = deps.eventShipper.isDebugEnabled() || deps.traceShipper.isDebugEnabled();\n  if (deps.options.nativeTelemetry === true) {\n    if (!hasStructuredTelemetryEvents(aiSDK)) {\n      throw new Error(\n        \"[raindrop-ai/ai-sdk] nativeTelemetry requires AI SDK v7+. The AI SDK module passed to wrap() does not support structured telemetry events. Remove nativeTelemetry or upgrade to AI SDK v7.\"\n      );\n    }\n  }\n  const useNative = deps.options.nativeTelemetry === true;\n  if (useNative) {\n    const wrapTimeCtx = resolveContext(deps.options.context, { operation: \"wrap\", args: void 0 });\n    const integration = new RaindropTelemetryIntegration({\n      traceShipper: deps.traceShipper,\n      eventShipper: deps.eventShipper,\n      sendTraces: ((_a = deps.options.send) == null ? void 0 : _a.traces) !== false,\n      sendEvents: ((_b = deps.options.send) == null ? void 0 : _b.events) !== false,\n      debug,\n      context: {\n        userId: wrapTimeCtx.userId,\n        eventId: wrapTimeCtx.eventId,\n        eventName: wrapTimeCtx.eventName,\n        convoId: wrapTimeCtx.convoId,\n        properties: wrapTimeCtx.properties\n      }\n    });\n    const registerFn = aiSDK[\"registerTelemetryIntegration\"];\n    if (isFunction(registerFn)) {\n      registerFn(integration);\n    }\n    if (debug) {\n      console.log(\"[raindrop-ai/ai-sdk] nativeTelemetry: registered RaindropTelemetryIntegration (no Proxy)\");\n    }\n    const selfDiagnostics2 = normalizeSelfDiagnosticsConfig(deps.options.selfDiagnostics);\n    if (selfDiagnostics2) {\n      const textOps = /* @__PURE__ */ new Set([\"generateText\", \"streamText\"]);\n      const jsonSchemaFactory = resolveJsonSchemaFactory(aiSDK);\n      const proxyTarget2 = isModuleNamespace(aiSDK) ? Object.setPrototypeOf({}, aiSDK) : aiSDK;\n      return new Proxy(proxyTarget2, {\n        get(target, prop, receiver) {\n          const original = Reflect.get(target, prop, receiver);\n          if (typeof prop !== \"string\" || !textOps.has(prop) || !isFunction(original)) {\n            return original;\n          }\n          return (...callArgs) => {\n            var _a2;\n            const arg = callArgs[0];\n            if (!isRecord(arg)) return original.call(aiSDK, ...callArgs);\n            const telemetry = extractExperimentalTelemetry(arg);\n            const callMeta = (telemetry == null ? void 0 : telemetry.metadata) ? extractRaindropMetadata(telemetry.metadata) : {};\n            const perCallEventIdExplicit = (_a2 = callMeta.eventId) != null ? _a2 : wrapTimeCtx.eventId;\n            const perCallEventId = perCallEventIdExplicit != null ? perCallEventIdExplicit : randomUUID();\n            const perCallEventIdGenerated = !perCallEventIdExplicit;\n            const perCallCtx = {\n              eventId: perCallEventId,\n              context: wrapTimeCtx,\n              telemetry,\n              sendTraces: false,\n              debug,\n              eventShipper: deps.eventShipper,\n              traceShipper: deps.traceShipper,\n              rootParentForChildren: void 0,\n              jsonSchemaFactory,\n              selfDiagnostics: selfDiagnostics2,\n              aiSDKVersion: \"7\"\n            };\n            const tools = isRecord(arg[\"tools\"]) ? { ...arg[\"tools\"] } : {};\n            const toolName = selfDiagnostics2.toolName;\n            if (!(toolName in tools)) {\n              const reportTool = createSelfDiagnosticsTool(perCallCtx);\n              if (reportTool) tools[toolName] = reportTool;\n            }\n            const existingTelemetry = isRecord(arg[\"experimental_telemetry\"]) ? arg[\"experimental_telemetry\"] : {};\n            const existingMetadata = isRecord(existingTelemetry[\"metadata\"]) ? existingTelemetry[\"metadata\"] : {};\n            const mergedMetadata = existingMetadata[\"raindrop.eventId\"] ? existingMetadata : {\n              ...existingMetadata,\n              \"raindrop.eventId\": perCallEventId,\n              ...perCallEventIdGenerated ? { \"raindrop.internal.eventIdGenerated\": \"true\" } : {}\n            };\n            callArgs[0] = {\n              ...arg,\n              tools,\n              experimental_telemetry: {\n                ...existingTelemetry,\n                metadata: mergedMetadata\n              }\n            };\n            return original.call(aiSDK, ...callArgs);\n          };\n        }\n      });\n    }\n    return aiSDK;\n  }\n  const instrumentedOps = /* @__PURE__ */ new Set([\n    \"generateText\",\n    \"streamText\",\n    \"generateObject\",\n    \"streamObject\"\n  ]);\n  const agentClasses = /* @__PURE__ */ new Set([\"Agent\", \"Experimental_Agent\", \"ToolLoopAgent\"]);\n  const sendEvents = ((_c = deps.options.send) == null ? void 0 : _c.events) !== false;\n  const sendTraces = ((_d = deps.options.send) == null ? void 0 : _d.traces) !== false;\n  const autoAttachmentEnabled = deps.options.autoAttachment !== false;\n  const selfDiagnostics = normalizeSelfDiagnosticsConfig(deps.options.selfDiagnostics);\n  const proxyTarget = isModuleNamespace(aiSDK) ? Object.setPrototypeOf({}, aiSDK) : aiSDK;\n  return new Proxy(proxyTarget, {\n    get(target, prop, receiver) {\n      const original = Reflect.get(target, prop, receiver);\n      if (typeof prop === \"string\" && agentClasses.has(prop) && isAgentClass(original)) {\n        if (debug) console.log(`[raindrop-ai/ai-sdk] Wrapping Agent class: ${prop}`);\n        return wrapAgentClass(original, aiSDK, deps, debug, selfDiagnostics);\n      }\n      if (typeof prop !== \"string\" || !instrumentedOps.has(prop) || !isFunction(original)) {\n        return original;\n      }\n      return (...callArgs) => {\n        const operation = prop;\n        const arg = callArgs[0];\n        if (operation === \"streamText\" || operation === \"streamObject\") {\n          return executeStreamingOperation({\n            operation,\n            arg,\n            callArgs,\n            aiSDK,\n            original,\n            deps,\n            sendEvents,\n            sendTraces,\n            selfDiagnostics,\n            autoAttachmentEnabled,\n            debug\n          });\n        }\n        return executeNonStreamingOperation({\n          operation,\n          arg,\n          callArgs,\n          aiSDK,\n          original,\n          deps,\n          sendEvents,\n          sendTraces,\n          selfDiagnostics,\n          autoAttachmentEnabled,\n          debug\n        });\n      };\n    }\n  });\n}\nfunction wrapAgentClass(AgentClass, aiSDK, deps, debug, selfDiagnostics) {\n  return new Proxy(AgentClass, {\n    construct(target, args, newTarget) {\n      const instance = Reflect.construct(target, args, newTarget);\n      const agentSettings = args[0];\n      const className = (newTarget == null ? void 0 : newTarget.name) || target.name || \"Agent\";\n      if (debug) console.log(`[raindrop-ai/ai-sdk] Creating wrapped ${className} instance`);\n      return new Proxy(instance, {\n        get(instanceTarget, prop, instanceReceiver) {\n          const original = Reflect.get(instanceTarget, prop, instanceReceiver);\n          if (prop === \"generate\" && isFunction(original)) {\n            if (debug) console.log(`[raindrop-ai/ai-sdk] Wrapping ${className}.generate method`);\n            return wrapAgentGenerate(\n              original,\n              instanceTarget,\n              agentSettings,\n              className,\n              aiSDK,\n              deps,\n              debug,\n              selfDiagnostics\n            );\n          }\n          if (prop === \"stream\" && isFunction(original)) {\n            if (debug) console.log(`[raindrop-ai/ai-sdk] Wrapping ${className}.stream method`);\n            return wrapAgentStream(\n              original,\n              instanceTarget,\n              agentSettings,\n              className,\n              aiSDK,\n              deps,\n              debug,\n              selfDiagnostics\n            );\n          }\n          return original;\n        }\n      });\n    }\n  });\n}\nfunction wrapAgentGenerate(generate, instance, agentSettings, className, aiSDK, deps, debug, selfDiagnostics) {\n  var _a, _b;\n  const sendEvents = ((_a = deps.options.send) == null ? void 0 : _a.events) !== false;\n  const sendTraces = ((_b = deps.options.send) == null ? void 0 : _b.traces) !== false;\n  const autoAttachmentEnabled = deps.options.autoAttachment !== false;\n  return async (...callArgs) => {\n    var _a2, _b2, _c, _d;\n    const callParams = callArgs[0];\n    const mergedArgs = { ...agentSettings, ...callParams };\n    const operation = `${className}.generate`;\n    const wrapTimeCtx = resolveContext(deps.options.context, { operation, args: mergedArgs });\n    const telemetry = extractExperimentalTelemetry(mergedArgs);\n    const callTimeCtx = extractRaindropCallOptions(mergedArgs);\n    const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);\n    if (!mergedCtx.userId) warnMissingUserIdOnce();\n    const inherited = await getCurrentParentSpanContext();\n    const eventId = (_c = (_b2 = (_a2 = callTimeCtx.eventId) != null ? _a2 : mergedCtx.eventId) != null ? _b2 : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();\n    const ctx = { ...mergedCtx, eventId };\n    const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;\n    const outerOperationId = `ai.${operation}`;\n    const { operationName, resourceName } = opName(outerOperationId, telemetry == null ? void 0 : telemetry.functionId);\n    const modelInfoFromArgs = extractModelInfo(mergedArgs[\"model\"]);\n    const rootSpan = sendTraces ? deps.traceShipper.startSpan({\n      name: outerOperationId,\n      parent: inheritedParent,\n      eventId,\n      operationId: outerOperationId,\n      attributes: [\n        attrString(\"operation.name\", operationName),\n        attrString(\"resource.name\", resourceName),\n        attrString(\"ai.telemetry.functionId\", telemetry == null ? void 0 : telemetry.functionId),\n        attrString(\"ai.model.provider\", modelInfoFromArgs.provider),\n        attrString(\"ai.model.id\", modelInfoFromArgs.modelId),\n        attrString(\"ai.telemetry.metadata.raindrop.eventId\", eventId),\n        attrString(\"ai.telemetry.metadata.raindrop.eventName\", ctx.eventName),\n        attrString(\"ai.telemetry.metadata.raindrop.ai.userId\", ctx.userId),\n        attrString(\"ai.telemetry.metadata.raindrop.convoId\", ctx.convoId),\n        ...attrsFromTelemetryMetadata(telemetry == null ? void 0 : telemetry.metadata),\n        ...attrsFromHeaders(mergedArgs[\"headers\"]),\n        ...attrsFromSettings(mergedArgs),\n        ...(telemetry == null ? void 0 : telemetry.recordInputs) === false ? [] : [\n          attrString(\n            \"ai.prompt\",\n            safeJsonWithUint8(normalizePromptAttr({ system: (_d = mergedArgs[\"system\"]) != null ? _d : mergedArgs[\"instructions\"], prompt: mergedArgs[\"prompt\"], messages: mergedArgs[\"messages\"] }))\n          )\n        ]\n      ]\n    }) : void 0;\n    const rootParentForChildren = rootSpan ? { traceIdB64: rootSpan.ids.traceIdB64, spanIdB64: rootSpan.ids.spanIdB64 } : inheritedParent;\n    const wrapCtx = {\n      eventId,\n      context: ctx,\n      telemetry,\n      sendTraces,\n      debug,\n      eventShipper: deps.eventShipper,\n      traceShipper: deps.traceShipper,\n      rootParentForChildren,\n      jsonSchemaFactory: resolveJsonSchemaFactory(aiSDK),\n      selfDiagnostics,\n      aiSDKVersion: detectAISDKVersion(aiSDK)\n    };\n    const toolCalls = [];\n    const mergedArgsWithWrappedTools = wrapTools(mergedArgs, wrapCtx, toolCalls);\n    const mergedArgsWithWrappedModel = wrapModel(\n      mergedArgsWithWrappedTools,\n      aiSDK,\n      outerOperationId,\n      wrapCtx\n    );\n    const callParamsWithWrappedToolsAndModel = mergedArgsWithWrappedModel != null ? mergedArgsWithWrappedModel : {};\n    const finalize = async (result, error) => {\n      var _a3, _b3, _c2;\n      const usage = extractUsageMetrics(result);\n      const model = extractModel(result);\n      const inputAttachments = autoAttachmentEnabled ? extractInputAttachmentsFromArgs(mergedArgs) : void 0;\n      const outputAttachments = autoAttachmentEnabled ? await extractOutputAttachmentsFromResult(result) : void 0;\n      const baseMessages = coerceMessagesFromArgs(mergedArgs);\n      const responseMessages = extractResponseMessages(result);\n      const allMessages = [...baseMessages, ...responseMessages];\n      const outputText = extractTextOutput(result);\n      const defaultPatch = {\n        eventName: (_a3 = ctx.eventName) != null ? _a3 : operation,\n        input: (_b3 = lastUserMessageTextFromArgs(mergedArgs)) != null ? _b3 : extractInputFromArgs(mergedArgs),\n        output: outputText,\n        model,\n        properties: ctx.properties,\n        attachments: mergeAttachments(ctx.attachments, inputAttachments, outputAttachments)\n      };\n      const built = await maybeBuildEvent(deps.options.buildEvent, allMessages);\n      const patch = mergeBuildEventPatch(defaultPatch, built);\n      const output = patch.output;\n      const finalModel = (_c2 = patch.model) != null ? _c2 : model;\n      if (rootSpan) {\n        const spanEndTimeUnixNano = nowUnixNanoString();\n        const syntheticToolCallCount = emitTranscriptToolCallSpans({\n          baseMessages,\n          responseMessages,\n          rootSpan,\n          eventId,\n          telemetry,\n          toolCalls,\n          traceShipper: deps.traceShipper,\n          endTimeUnixNano: spanEndTimeUnixNano,\n          keepEventPending: false\n        });\n        const finishReason = extractFinishReason(result);\n        const providerMetadata = isRecord(result) ? result[\"providerMetadata\"] : void 0;\n        const resultToolCalls = isRecord(result) && Array.isArray(result[\"toolCalls\"]) ? safeJsonWithUint8(result[\"toolCalls\"]) : toolCalls.length ? safeJsonWithUint8(toolCalls) : void 0;\n        deps.traceShipper.endSpan(rootSpan, {\n          attributes: [\n            ...(telemetry == null ? void 0 : telemetry.recordOutputs) === false ? [] : [\n              attrString(\"ai.response.finishReason\", finishReason),\n              attrString(\"ai.response.text\", output),\n              attrString(\"ai.response.toolCalls\", resultToolCalls),\n              attrString(\"ai.response.providerMetadata\", safeJsonWithUint8(providerMetadata))\n            ],\n            attrInt(\"ai.usage.promptTokens\", usage == null ? void 0 : usage.inputTokens),\n            attrInt(\"ai.usage.completionTokens\", usage == null ? void 0 : usage.outputTokens),\n            attrInt(\"ai.usage.inputTokens\", usage == null ? void 0 : usage.inputTokens),\n            attrInt(\"ai.usage.outputTokens\", usage == null ? void 0 : usage.outputTokens),\n            attrInt(\"ai.usage.totalTokens\", usage == null ? void 0 : usage.totalTokens),\n            attrInt(\"ai.usage.reasoningTokens\", usage == null ? void 0 : usage.reasoningTokens),\n            attrInt(\"ai.usage.cachedInputTokens\", usage == null ? void 0 : usage.cachedInputTokens),\n            attrInt(\"ai.toolCall.count\", toolCalls.length + syntheticToolCallCount),\n            ...error ? [\n              attrString(\n                \"error.message\",\n                error instanceof Error ? error.message : String(error)\n              )\n            ] : []\n          ],\n          error,\n          endTimeUnixNano: spanEndTimeUnixNano\n        });\n      }\n      if (sendEvents) {\n        if (debug) {\n          console.log(`[raindrop-ai/ai-sdk] Agent ${operation} shipping event:`, {\n            eventId,\n            eventName: patch.eventName,\n            userId: ctx.userId,\n            hasOutput: !!output\n          });\n        }\n        void deps.eventShipper.patch(eventId, {\n          eventName: patch.eventName,\n          userId: ctx.userId,\n          convoId: ctx.convoId,\n          input: patch.input,\n          output,\n          model: finalModel,\n          properties: patch.properties,\n          attachments: patch.attachments,\n          isPending: false\n        }).catch((err) => {\n          if (debug)\n            console.warn(\n              `[raindrop-ai/ai-sdk] event patch failed: ${err instanceof Error ? err.message : err}`\n            );\n        });\n      } else if (debug) {\n        console.log(`[raindrop-ai/ai-sdk] Agent ${operation} sendEvents=false, skipping event`);\n      }\n    };\n    const runWithContext = async (fn) => {\n      if (!rootSpan) return await fn();\n      return await runWithParentSpanContext(\n        { traceIdB64: rootSpan.ids.traceIdB64, spanIdB64: rootSpan.ids.spanIdB64, eventId },\n        fn\n      );\n    };\n    if (debug) {\n      console.log(`[raindrop-ai/ai-sdk] Agent ${operation} starting with context:`, {\n        userId: ctx.userId,\n        eventId,\n        eventName: ctx.eventName\n      });\n    }\n    try {\n      const result = await runWithContext(async () => {\n        return await generate.call(instance, callParamsWithWrappedToolsAndModel);\n      });\n      if (debug) {\n        console.log(`[raindrop-ai/ai-sdk] Agent ${operation} completed, finalizing...`);\n      }\n      try {\n        await finalize(result);\n      } catch (err) {\n        if (debug)\n          console.warn(\n            `[raindrop-ai/ai-sdk] finalize failed: ${err instanceof Error ? err.message : err}`\n          );\n      }\n      return result;\n    } catch (error) {\n      try {\n        await finalize(void 0, error);\n      } catch (err) {\n        if (debug)\n          console.warn(\n            `[raindrop-ai/ai-sdk] finalize failed: ${err instanceof Error ? err.message : err}`\n          );\n      }\n      throw error;\n    }\n  };\n}\nfunction wrapAgentStream(stream, instance, agentSettings, className, aiSDK, deps, debug, selfDiagnostics) {\n  var _a, _b;\n  const sendEvents = ((_a = deps.options.send) == null ? void 0 : _a.events) !== false;\n  const sendTraces = ((_b = deps.options.send) == null ? void 0 : _b.traces) !== false;\n  const autoAttachmentEnabled = deps.options.autoAttachment !== false;\n  return async (...callArgs) => {\n    var _a2, _b2, _c, _d;\n    const callParams = callArgs[0];\n    const mergedArgs = { ...agentSettings, ...callParams };\n    const operation = `${className}.stream`;\n    const wrapTimeCtx = resolveContext(deps.options.context, { operation, args: mergedArgs });\n    const telemetry = extractExperimentalTelemetry(mergedArgs);\n    const callTimeCtx = extractRaindropCallOptions(mergedArgs);\n    const mergedCtx = mergeContexts(wrapTimeCtx, callTimeCtx);\n    if (!mergedCtx.userId) warnMissingUserIdOnce();\n    const inherited = await getCurrentParentSpanContext();\n    const eventId = (_c = (_b2 = (_a2 = callTimeCtx.eventId) != null ? _a2 : mergedCtx.eventId) != null ? _b2 : inherited == null ? void 0 : inherited.eventId) != null ? _c : randomUUID();\n    const ctx = { ...mergedCtx, eventId };\n    const inheritedParent = inherited && inherited.eventId === eventId ? { traceIdB64: inherited.traceIdB64, spanIdB64: inherited.spanIdB64 } : void 0;\n    const outerOperationId = `ai.${operation}`;\n    const { operationName, resourceName } = opName(outerOperationId, telemetry == null ? void 0 : telemetry.functionId);\n    const modelInfoFromArgs = extractModelInfo(mergedArgs[\"model\"]);\n    const rootSpan = sendTraces ? deps.traceShipper.startSpan({\n      name: outerOperationId,\n      parent: inheritedParent,\n      eventId,\n      operationId: outerOperationId,\n      attributes: [\n        attrString(\"operation.name\", operationName),\n        attrString(\"resource.name\", resourceName),\n        attrString(\"ai.telemetry.functionId\", telemetry == null ? void 0 : telemetry.functionId),\n        attrString(\"ai.model.provider\", modelInfoFromArgs.provider),\n        attrString(\"ai.model.id\", modelInfoFromArgs.modelId),\n        attrString(\"ai.telemetry.metadata.raindrop.eventId\", eventId),\n        attrString(\"ai.telemetry.metadata.raindrop.eventName\", ctx.eventName),\n        attrString(\"ai.telemetry.metadata.raindrop.ai.userId\", ctx.userId),\n        attrString(\"ai.telemetry.metadata.raindrop.convoId\", ctx.convoId),\n        ...attrsFromTelemetryMetadata(telemetry == null ? void 0 : telemetry.metadata),\n        ...attrsFromHeaders(mergedArgs[\"headers\"]),\n        ...attrsFromSettings(mergedArgs),\n        ...(telemetry == null ? void 0 : telemetry.recordInputs) === false ? [] : [\n          attrString(\n            \"ai.prompt\",\n            safeJsonWithUint8(normalizePromptAttr({ system: (_d = mergedArgs[\"system\"]) != null ? _d : mergedArgs[\"instructions\"], prompt: mergedArgs[\"prompt\"], messages: mergedArgs[\"messages\"] }))\n          )\n        ]\n      ]\n    }) : void 0;\n    const rootParentForChildren = rootSpan ? { traceIdB64: rootSpan.ids.traceIdB64, spanIdB64: rootSpan.ids.spanIdB64 } : inheritedParent;\n    const wrapCtx = {\n      eventId,\n      context: ctx,\n      telemetry,\n      sendTraces,\n      debug,\n      eventShipper: deps.eventShipper,\n      traceShipper: deps.traceShipper,\n      rootParentForChildren,\n      jsonSchemaFactory: resolveJsonSchemaFactory(aiSDK),\n      selfDiagnostics,\n      aiSDKVersion: detectAISDKVersion(aiSDK)\n    };\n    const toolCalls = [];\n    const mergedArgsWithWrappedTools = wrapTools(mergedArgs, wrapCtx, toolCalls);\n    const mergedArgsWithWrappedModel = wrapModel(\n      mergedArgsWithWrappedTools,\n      aiSDK,\n      outerOperationId,\n      wrapCtx\n    );\n    const callParamsWithWrappedToolsAndModel = mergedArgsWithWrappedModel != null ? mergedArgsWithWrappedModel : {};\n    const finalize = async (result, error) => {\n      var _a3, _b3, _c2;\n      const usage = extractUsageMetrics(result);\n      const model = extractModel(result);\n      const inputAttachments = autoAttachmentEnabled ? extractInputAttachmentsFromArgs(mergedArgs) : void 0;\n      const outputAttachments = autoAttachmentEnabled ? await extractOutputAttachmentsFromResult(result) : void 0;\n      const baseMessages = coerceMessagesFromArgs(mergedArgs);\n      const responseMessages = extractResponseMessages(result);\n      const allMessages = [...baseMessages, ...responseMessages];\n      const outputText = extractTextOutput(result);\n      const defaultPatch = {\n        eventName: (_a3 = ctx.eventName) != null ? _a3 : operation,\n        input: (_b3 = lastUserMessageTextFromArgs(mergedArgs)) != null ? _b3 : extractInputFromArgs(mergedArgs),\n        output: outputText,\n        model,\n        properties: ctx.properties,\n        attachments: mergeAttachments(ctx.attachments, inputAttachments, outputAttachments)\n      };\n      const built = await maybeBuildEvent(deps.options.buildEvent, allMessages);\n      const patch = mergeBuildEventPatch(defaultPatch, built);\n      const output = patch.output;\n      const finalModel = (_c2 = patch.model) != null ? _c2 : model;\n      if (rootSpan) {\n        const spanEndTimeUnixNano = nowUnixNanoString();\n        const syntheticToolCallCount = emitTranscriptToolCallSpans({\n          baseMessages,\n          responseMessages,\n          rootSpan,\n          eventId,\n          telemetry,\n          toolCalls,\n          traceShipper: deps.traceShipper,\n          endTimeUnixNano: spanEndTimeUnixNano,\n          keepEventPending: false\n        });\n        const finishReason = extractFinishReason(result);\n        const providerMetadata = isRecord(result) ? result[\"providerMetadata\"] : void 0;\n        const resultToolCalls = isRecord(result) && Array.isArray(result[\"toolCalls\"]) ? safeJsonWithUint8(result[\"toolCalls\"]) : toolCalls.length ? safeJsonWithUint8(toolCalls) : void 0;\n        deps.traceShipper.endSpan(rootSpan, {\n          attributes: [\n            ...(telemetry == null ? void 0 : telemetry.recordOutputs) === false ? [] : [\n              attrString(\"ai.response.finishReason\", finishReason),\n              attrString(\"ai.response.text\", output),\n              attrString(\"ai.response.toolCalls\", resultToolCalls),\n              attrString(\"ai.response.providerMetadata\", safeJsonWithUint8(providerMetadata))\n            ],\n            attrInt(\"ai.usage.promptTokens\", usage == null ? void 0 : usage.inputTokens),\n            attrInt(\"ai.usage.completionTokens\", usage == null ? void 0 : usage.outputTokens),\n            attrInt(\"ai.usage.inputTokens\", usage == null ? void 0 : usage.inputTokens),\n            attrInt(\"ai.usage.outputTokens\", usage == null ? void 0 : usage.outputTokens),\n            attrInt(\"ai.usage.totalTokens\", usage == null ? void 0 : usage.totalTokens),\n            attrInt(\"ai.usage.reasoningTokens\", usage == null ? void 0 : usage.reasoningTokens),\n            attrInt(\"ai.usage.cachedInputTokens\", usage == null ? void 0 : usage.cachedInputTokens),\n            attrInt(\"ai.toolCall.count\", toolCalls.length + syntheticToolCallCount),\n            ...error ? [\n              attrString(\n                \"error.message\",\n                error instanceof Error ? error.message : String(error)\n              )\n            ] : []\n          ],\n          error,\n          endTimeUnixNano: spanEndTimeUnixNano\n        });\n      }\n      if (sendEvents) {\n        if (debug) {\n          console.log(`[raindrop-ai/ai-sdk] Agent ${operation} shipping event:`, {\n            eventId,\n            eventName: patch.eventName,\n            userId: ctx.userId,\n            hasOutput: !!output\n          });\n        }\n        void deps.eventShipper.patch(eventId, {\n          eventName: patch.eventName,\n          userId: ctx.userId,\n          convoId: ctx.convoId,\n          input: patch.input,\n          output,\n          model: finalModel,\n          properties: patch.properties,\n          attachments: patch.attachments,\n          isPending: false\n        }).catch((err) => {\n          if (debug)\n            console.warn(\n              `[raindrop-ai/ai-sdk] event patch failed: ${err instanceof Error ? err.message : err}`\n            );\n        });\n      } else if (debug) {\n        console.log(`[raindrop-ai/ai-sdk] Agent ${operation} sendEvents=false, skipping event`);\n      }\n    };\n    const runWithContext = async (fn) => {\n      if (!rootSpan) return await fn();\n      return await runWithParentSpanContext(\n        { traceIdB64: rootSpan.ids.traceIdB64, spanIdB64: rootSpan.ids.spanIdB64, eventId },\n        fn\n      );\n    };\n    if (debug) {\n      console.log(`[raindrop-ai/ai-sdk] Agent ${operation} starting with context:`, {\n        userId: ctx.userId,\n        eventId,\n        eventName: ctx.eventName\n      });\n    }\n    const callParamsWithOnFinish = wrapOnFinish(\n      callParamsWithWrappedToolsAndModel != null ? callParamsWithWrappedToolsAndModel : {},\n      async (result) => {\n        if (debug) {\n          console.log(`[raindrop-ai/ai-sdk] Agent ${operation} onFinish callback, finalizing...`);\n        }\n        try {\n          await finalize(result);\n        } catch (err) {\n          if (debug)\n            console.warn(\n              `[raindrop-ai/ai-sdk] finalize failed: ${err instanceof Error ? err.message : err}`\n            );\n        }\n      }\n    );\n    try {\n      const result = await runWithContext(async () => {\n        return await stream.call(instance, callParamsWithOnFinish);\n      });\n      return result;\n    } catch (error) {\n      try {\n        await finalize(void 0, error);\n      } catch (err) {\n        if (debug)\n          console.warn(\n            `[raindrop-ai/ai-sdk] finalize failed: ${err instanceof Error ? err.message : err}`\n          );\n      }\n      throw error;\n    }\n  };\n}\nfunction wrapTools(args, ctx, toolCalls) {\n  if (!isRecord(args)) return args;\n  const tools = isRecord(args[\"tools\"]) ? { ...args[\"tools\"] } : {};\n  if (ctx.selfDiagnostics) {\n    const reportToolName = ctx.selfDiagnostics.toolName;\n    if (!(reportToolName in tools)) {\n      const reportTool = createSelfDiagnosticsTool(ctx);\n      if (reportTool !== void 0) {\n        tools[reportToolName] = reportTool;\n      }\n    } else if (ctx.debug) {\n      console.warn(\n        `[raindrop-ai/ai-sdk] selfDiagnostics skipped: tool name collision for \"${reportToolName}\"`\n      );\n    }\n  }\n  if (Object.keys(tools).length === 0) return args;\n  const wrapped = {};\n  for (const [name, tool] of Object.entries(tools)) {\n    wrapped[name] = wrapToolExecute(name, tool, ctx, toolCalls);\n  }\n  return { ...args, tools: wrapped };\n}\nfunction wrapToolExecute(name, tool, ctx, toolCalls) {\n  var _a;\n  if (!isRecord(tool) || !isFunction(tool[\"execute\"])) return tool;\n  const originalExecute = tool[\"execute\"];\n  const { operationName, resourceName } = opName(\"ai.toolCall\", (_a = ctx.telemetry) == null ? void 0 : _a.functionId);\n  const createToolSpan = (toolCallId, toolArgs, parent) => {\n    var _a2, _b;\n    if (!ctx.sendTraces || !parent) return void 0;\n    return ctx.traceShipper.startSpan({\n      name: \"ai.toolCall\",\n      parent,\n      eventId: ctx.eventId,\n      operationId: \"ai.toolCall\",\n      attributes: [\n        attrString(\"operation.name\", operationName),\n        attrString(\"resource.name\", resourceName),\n        attrString(\"ai.telemetry.functionId\", (_a2 = ctx.telemetry) == null ? void 0 : _a2.functionId),\n        attrString(\"ai.toolCall.name\", name),\n        attrString(\"ai.toolCall.id\", toolCallId),\n        ...((_b = ctx.telemetry) == null ? void 0 : _b.recordInputs) === false ? [] : [attrString(\"ai.toolCall.args\", safeJsonWithUint8(toolArgs))]\n      ]\n    });\n  };\n  const endToolSpan = (span, result, error) => {\n    var _a2;\n    if (!span) return;\n    if (error) {\n      ctx.traceShipper.endSpan(span, {\n        attributes: [\n          attrString(\"error.message\", error instanceof Error ? error.message : String(error))\n        ],\n        error\n      });\n    } else {\n      ctx.traceShipper.endSpan(span, {\n        attributes: ((_a2 = ctx.telemetry) == null ? void 0 : _a2.recordOutputs) === false ? [] : [attrString(\"ai.toolCall.result\", safeJsonWithUint8(result))]\n      });\n    }\n  };\n  const sendToolLiveEvent = (parent, type, metadata) => {\n    if (!localDebuggerEnabled() || !parent) return;\n    sendLocalDebuggerLiveEvent({\n      traceId: parent.traceIdB64,\n      type,\n      content: name,\n      metadata: {\n        ...getLocalDebuggerMetadata({\n          ...ctx.context,\n          eventId: ctx.eventId\n        }),\n        ...metadata\n      }\n    });\n  };\n  const createContextSpan = (span) => ({\n    traceIdB64: span.ids.traceIdB64,\n    spanIdB64: span.ids.spanIdB64,\n    eventId: ctx.eventId\n  });\n  const wrappedExecute = function(...execArgs) {\n    const toolArgs = execArgs[0];\n    const execOptions = execArgs.length > 1 ? execArgs[1] : void 0;\n    const toolCallId = isRecord(execOptions) && typeof execOptions[\"toolCallId\"] === \"string\" ? execOptions[\"toolCallId\"] : randomUUID();\n    const result = originalExecute.apply(this, execArgs);\n    if (isAsyncIterable(result)) {\n      return (async function* () {\n        const parentCtx = await getCurrentParentSpanContext();\n        const parent = parentCtx && parentCtx.eventId === ctx.eventId ? { traceIdB64: parentCtx.traceIdB64, spanIdB64: parentCtx.spanIdB64 } : ctx.rootParentForChildren;\n        const toolSpan = createToolSpan(toolCallId, toolArgs, parent);\n        sendToolLiveEvent(parent, \"tool_start\", { args: toolArgs });\n        try {\n          let lastValue;\n          const iterator = result[Symbol.asyncIterator]();\n          const wrappedIterable = toolSpan ? asyncGeneratorWithCurrent(\n            createContextSpan(toolSpan),\n            iterator\n          ) : {\n            [Symbol.asyncIterator]: () => iterator\n          };\n          for await (const value of wrappedIterable) {\n            lastValue = value;\n            yield value;\n          }\n          toolCalls.push({ id: toolCallId, name, args: toolArgs, result: lastValue, status: \"OK\" });\n          endToolSpan(toolSpan, lastValue);\n          sendToolLiveEvent(parent, \"tool_result\", { result: lastValue });\n        } catch (error) {\n          toolCalls.push({ id: toolCallId, name, args: toolArgs, status: \"ERROR\" });\n          endToolSpan(toolSpan, void 0, error);\n          sendToolLiveEvent(parent, \"tool_result\", {\n            error: error instanceof Error ? error.message : String(error)\n          });\n          throw error;\n        }\n      })();\n    }\n    return (async () => {\n      const parentCtx = await getCurrentParentSpanContext();\n      const parent = parentCtx && parentCtx.eventId === ctx.eventId ? { traceIdB64: parentCtx.traceIdB64, spanIdB64: parentCtx.spanIdB64 } : ctx.rootParentForChildren;\n      const toolSpan = createToolSpan(toolCallId, toolArgs, parent);\n      sendToolLiveEvent(parent, \"tool_start\", { args: toolArgs });\n      const run = async () => {\n        try {\n          const awaitedResult = await result;\n          toolCalls.push({\n            id: toolCallId,\n            name,\n            args: toolArgs,\n            result: awaitedResult,\n            status: \"OK\"\n          });\n          endToolSpan(toolSpan, awaitedResult);\n          sendToolLiveEvent(parent, \"tool_result\", { result: awaitedResult });\n          return awaitedResult;\n        } catch (error) {\n          toolCalls.push({ id: toolCallId, name, args: toolArgs, status: \"ERROR\" });\n          endToolSpan(toolSpan, void 0, error);\n          sendToolLiveEvent(parent, \"tool_result\", {\n            error: error instanceof Error ? error.message : String(error)\n          });\n          throw error;\n        }\n      };\n      if (!toolSpan) return await run();\n      return await runWithParentSpanContext(\n        {\n          traceIdB64: toolSpan.ids.traceIdB64,\n          spanIdB64: toolSpan.ids.spanIdB64,\n          eventId: ctx.eventId\n        },\n        run\n      );\n    })();\n  };\n  return { ...tool, execute: wrappedExecute };\n}\nfunction wrapModel(args, aiSDK, outerOperationId, ctx) {\n  if (!isRecord(args) || !(\"model\" in args)) return args;\n  let model = args[\"model\"];\n  if (typeof model === \"string\") {\n    const maybeProvider = globalThis.AI_SDK_DEFAULT_PROVIDER;\n    const gateway = isRecord(aiSDK) ? aiSDK[\"gateway\"] : void 0;\n    const provider = maybeProvider != null ? maybeProvider : gateway;\n    if (isRecord(provider) && isFunction(provider[\"languageModel\"])) {\n      try {\n        model = provider[\"languageModel\"](model);\n      } catch (e) {\n      }\n    }\n  }\n  if (!isRecord(model)) return args;\n  const modelInfo = extractModelInfo(model);\n  const doGenerateOpId = `${outerOperationId}.doGenerate`;\n  const doStreamOpId = `${outerOperationId}.doStream`;\n  const wrappedModel = new Proxy(model, {\n    get(target, prop, receiver) {\n      const original = Reflect.get(target, prop, receiver);\n      if (prop === \"doGenerate\" && isFunction(original)) {\n        return async (...callArgs) => {\n          var _a, _b;\n          const options = callArgs[0];\n          const parentCtx = await getCurrentParentSpanContext();\n          const parent = parentCtx && parentCtx.eventId === ctx.eventId ? { traceIdB64: parentCtx.traceIdB64, spanIdB64: parentCtx.spanIdB64 } : ctx.rootParentForChildren;\n          const span = ctx.sendTraces && parent ? startDoGenerateSpan(doGenerateOpId, options, modelInfo, parent, ctx) : void 0;\n          try {\n            const result = await original.apply(target, callArgs);\n            if (span) endDoGenerateSpan(span, result, modelInfo, ctx);\n            if (localDebuggerEnabled() && ctx.rootParentForChildren && isRecord(result)) {\n              const traceId = ctx.rootParentForChildren.traceIdB64;\n              const liveMeta = getLocalDebuggerMetadata({ ...ctx.context, eventId: ctx.eventId });\n              const content = result[\"content\"];\n              if (Array.isArray(content)) {\n                for (const part of content) {\n                  if (isRecord(part)) {\n                    if ((part[\"type\"] === \"reasoning\" || part[\"type\"] === \"thinking\") && typeof ((_a = part[\"text\"]) != null ? _a : part[\"thinking\"]) === \"string\") {\n                      sendLocalDebuggerLiveEvent({ traceId, type: \"reasoning_delta\", content: (_b = part[\"text\"]) != null ? _b : part[\"thinking\"], metadata: liveMeta });\n                    } else if (part[\"type\"] === \"text\" && typeof part[\"text\"] === \"string\") {\n                      sendLocalDebuggerLiveEvent({ traceId, type: \"text_delta\", content: part[\"text\"], metadata: liveMeta });\n                    }\n                  }\n                }\n              }\n            }\n            return result;\n          } catch (error) {\n            if (span)\n              ctx.traceShipper.endSpan(span, {\n                attributes: [\n                  attrString(\n                    \"error.message\",\n                    error instanceof Error ? error.message : String(error)\n                  )\n                ],\n                error\n              });\n            throw error;\n          }\n        };\n      }\n      if (prop === \"doStream\" && isFunction(original)) {\n        return async (...callArgs) => {\n          const options = callArgs[0];\n          const parentCtx = await getCurrentParentSpanContext();\n          const parent = parentCtx && parentCtx.eventId === ctx.eventId ? { traceIdB64: parentCtx.traceIdB64, spanIdB64: parentCtx.spanIdB64 } : ctx.rootParentForChildren;\n          const span = ctx.sendTraces && parent ? startDoStreamSpan(doStreamOpId, options, modelInfo, parent, ctx) : void 0;\n          const startMs = Date.now();\n          let firstChunkMs;\n          let finishMs;\n          let finishReason;\n          let responseId;\n          let responseModelId;\n          let responseTimestampIso;\n          let providerMetadata;\n          let usage;\n          let activeText = \"\";\n          const toolCallsLocal = [];\n          let result;\n          try {\n            result = await original.apply(target, callArgs);\n          } catch (error) {\n            if (span)\n              ctx.traceShipper.endSpan(span, {\n                attributes: [\n                  attrString(\n                    \"error.message\",\n                    error instanceof Error ? error.message : String(error)\n                  )\n                ],\n                error\n              });\n            throw error;\n          }\n          const stream = isRecord(result) ? result[\"stream\"] : void 0;\n          const RS = globalThis.ReadableStream;\n          if (!RS || !(stream instanceof RS)) {\n            if (span) ctx.traceShipper.endSpan(span);\n            return result;\n          }\n          const reader = stream.getReader();\n          let ended = false;\n          const endSpan = (error) => {\n            var _a;\n            if (ended || !span) return;\n            ended = true;\n            const msToFirstChunk = firstChunkMs !== void 0 ? firstChunkMs - startMs : void 0;\n            const msToFinish = finishMs !== void 0 ? finishMs - startMs : void 0;\n            const inputTokens = extractNestedTokens(usage, \"inputTokens\");\n            const outputTokens = extractNestedTokens(usage, \"outputTokens\");\n            const avgOutTokensPerSecond = msToFinish && outputTokens !== void 0 && msToFinish > 0 ? 1e3 * outputTokens / msToFinish : void 0;\n            ctx.traceShipper.endSpan(span, {\n              attributes: [\n                ...((_a = ctx.telemetry) == null ? void 0 : _a.recordOutputs) === false ? [] : [\n                  attrString(\"ai.response.finishReason\", finishReason),\n                  attrString(\"ai.response.text\", activeText.length ? activeText : void 0),\n                  attrString(\n                    \"ai.response.toolCalls\",\n                    safeJsonWithUint8(toolCallsLocal.length ? toolCallsLocal : void 0)\n                  ),\n                  attrString(\"ai.response.id\", responseId),\n                  attrString(\"ai.response.model\", responseModelId),\n                  attrString(\"ai.response.timestamp\", responseTimestampIso),\n                  attrString(\n                    \"ai.response.providerMetadata\",\n                    safeJsonWithUint8(providerMetadata)\n                  )\n                ],\n                attrInt(\"ai.usage.inputTokens\", inputTokens),\n                attrInt(\"ai.usage.outputTokens\", outputTokens),\n                ...finishReason ? [attrStringArray(\"gen_ai.response.finish_reasons\", [finishReason])] : [],\n                attrString(\"gen_ai.response.id\", responseId),\n                attrString(\"gen_ai.response.model\", responseModelId),\n                attrInt(\"gen_ai.usage.input_tokens\", inputTokens),\n                attrInt(\"gen_ai.usage.output_tokens\", outputTokens),\n                ...msToFirstChunk !== void 0 ? [attrInt(\"ai.stream.msToFirstChunk\", msToFirstChunk)] : [],\n                ...msToFinish !== void 0 ? [attrInt(\"ai.stream.msToFinish\", msToFinish)] : [],\n                ...avgOutTokensPerSecond !== void 0 ? [attrDouble(\"ai.stream.avgOutputTokensPerSecond\", avgOutTokensPerSecond)] : [],\n                ...error ? [\n                  attrString(\n                    \"error.message\",\n                    error instanceof Error ? error.message : String(error)\n                  )\n                ] : []\n              ],\n              error\n            });\n          };\n          const wrappedStream = new RS({\n            async pull(controller) {\n              try {\n                const { done, value } = await reader.read();\n                if (done) {\n                  finishMs = Date.now();\n                  endSpan();\n                  controller.close();\n                  return;\n                }\n                if (firstChunkMs === void 0) firstChunkMs = Date.now();\n                if (isRecord(value)) {\n                  const type = value[\"type\"];\n                  if (type === \"text-delta\") {\n                    let textDelta;\n                    if (typeof value[\"delta\"] === \"string\") {\n                      textDelta = value[\"delta\"];\n                    } else if (typeof value[\"textDelta\"] === \"string\") {\n                      textDelta = value[\"textDelta\"];\n                    }\n                    if (typeof textDelta === \"string\") activeText += textDelta;\n                  }\n                  if (type === \"finish\") finishReason = extractFinishReason(value);\n                  if (type === \"tool-call\") toolCallsLocal.push(value);\n                  if (\"response\" in value && isRecord(value[\"response\"])) {\n                    const response = value[\"response\"];\n                    if (typeof response[\"id\"] === \"string\") responseId = response[\"id\"];\n                    if (typeof response[\"modelId\"] === \"string\")\n                      responseModelId = response[\"modelId\"];\n                    if (response[\"timestamp\"] instanceof Date)\n                      responseTimestampIso = response[\"timestamp\"].toISOString();\n                    else if (typeof response[\"timestamp\"] === \"string\")\n                      responseTimestampIso = response[\"timestamp\"];\n                  }\n                  if (\"usage\" in value) usage = value[\"usage\"];\n                  if (\"providerMetadata\" in value) providerMetadata = value[\"providerMetadata\"];\n                  if (localDebuggerEnabled() && ctx.rootParentForChildren) {\n                    const traceId = ctx.rootParentForChildren.traceIdB64;\n                    const liveMeta = getLocalDebuggerMetadata({ ...ctx.context, eventId: ctx.eventId });\n                    if (type === \"text-delta\") {\n                      const text = typeof value[\"delta\"] === \"string\" ? value[\"delta\"] : typeof value[\"textDelta\"] === \"string\" ? value[\"textDelta\"] : typeof value[\"text\"] === \"string\" ? value[\"text\"] : void 0;\n                      if (typeof text === \"string\" && text) sendLocalDebuggerLiveEvent({ traceId, type: \"text_delta\", content: text, metadata: liveMeta });\n                    } else if (type === \"reasoning\" || type === \"reasoning-delta\") {\n                      const text = typeof value[\"delta\"] === \"string\" ? value[\"delta\"] : typeof value[\"text\"] === \"string\" ? value[\"text\"] : typeof value[\"thinking\"] === \"string\" ? value[\"thinking\"] : void 0;\n                      if (typeof text === \"string\" && text) sendLocalDebuggerLiveEvent({ traceId, type: \"reasoning_delta\", content: text, metadata: liveMeta });\n                    } else if (type === \"tool-call\") {\n                      const toolName = typeof value[\"toolName\"] === \"string\" ? value[\"toolName\"] : \"tool\";\n                      sendLocalDebuggerLiveEvent({ traceId, type: \"tool_start\", content: toolName, metadata: { ...liveMeta, args: value[\"args\"] } });\n                    } else if (type === \"tool-result\") {\n                      const toolName = typeof value[\"toolName\"] === \"string\" ? value[\"toolName\"] : \"tool\";\n                      sendLocalDebuggerLiveEvent({ traceId, type: \"tool_result\", content: toolName, metadata: { ...liveMeta, result: value[\"result\"] } });\n                    }\n                  }\n                }\n                controller.enqueue(value);\n              } catch (error) {\n                endSpan(error);\n                controller.error(error);\n              }\n            },\n            cancel(reason) {\n              void reader.cancel(reason);\n              endSpan(reason);\n            }\n          });\n          return { ...result, stream: wrappedStream };\n        };\n      }\n      return original;\n    }\n  });\n  return { ...args, model: wrappedModel };\n}\nfunction startDoGenerateSpan(operationId, options, modelInfo, parent, ctx) {\n  var _a, _b, _c;\n  const { operationName, resourceName } = opName(operationId, (_a = ctx.telemetry) == null ? void 0 : _a.functionId);\n  const tools = isRecord(options) ? options[\"tools\"] : void 0;\n  const toolsJson = Array.isArray(tools) && tools.length ? tools.map((tool) => safeJsonWithUint8(tool)).filter((json) => typeof json === \"string\" && json.length > 0) : void 0;\n  const toolChoiceJson = isRecord(options) ? safeJsonWithUint8(options[\"toolChoice\"]) : void 0;\n  const promptJson = isRecord(options) ? safeJsonWithUint8(options[\"prompt\"]) : safeJsonWithUint8(options);\n  return ctx.traceShipper.startSpan({\n    name: operationId,\n    parent,\n    eventId: ctx.eventId,\n    operationId,\n    attributes: [\n      attrString(\"operation.name\", operationName),\n      attrString(\"resource.name\", resourceName),\n      attrString(\"ai.telemetry.functionId\", (_b = ctx.telemetry) == null ? void 0 : _b.functionId),\n      attrString(\"ai.model.provider\", modelInfo.provider),\n      attrString(\"ai.model.id\", modelInfo.modelId),\n      ...((_c = ctx.telemetry) == null ? void 0 : _c.recordInputs) === false ? [] : [\n        attrString(\"ai.prompt.messages\", promptJson),\n        attrStringArray(\"ai.prompt.tools\", toolsJson),\n        attrString(\"ai.prompt.toolChoice\", toolChoiceJson)\n      ],\n      attrString(\"gen_ai.system\", modelInfo.provider),\n      attrString(\"gen_ai.request.model\", modelInfo.modelId),\n      ...attrsFromGenAiRequest(options)\n    ]\n  });\n}\nfunction endDoGenerateSpan(span, result, modelInfo, ctx) {\n  var _a;\n  const finishReason = extractFinishReason(result);\n  const content = isRecord(result) ? result[\"content\"] : void 0;\n  const response = isRecord(result) ? result[\"response\"] : void 0;\n  const usage = isRecord(result) ? result[\"usage\"] : void 0;\n  const providerMetadata = isRecord(result) ? result[\"providerMetadata\"] : void 0;\n  let responseId;\n  if (isRecord(response) && typeof response[\"id\"] === \"string\") {\n    responseId = response[\"id\"];\n  } else {\n    responseId = randomUUID();\n  }\n  let responseModelId;\n  if (isRecord(response) && typeof response[\"modelId\"] === \"string\") {\n    responseModelId = response[\"modelId\"];\n  } else {\n    responseModelId = modelInfo.modelId;\n  }\n  let responseTimestampIso;\n  if (isRecord(response) && response[\"timestamp\"] instanceof Date) {\n    responseTimestampIso = response[\"timestamp\"].toISOString();\n  } else if (isRecord(response) && typeof response[\"timestamp\"] === \"string\") {\n    responseTimestampIso = response[\"timestamp\"];\n  } else {\n    responseTimestampIso = (/* @__PURE__ */ new Date()).toISOString();\n  }\n  const inputTokens = extractNestedTokens(usage, \"inputTokens\");\n  const outputTokens = extractNestedTokens(usage, \"outputTokens\");\n  ctx.traceShipper.endSpan(span, {\n    attributes: [\n      ...((_a = ctx.telemetry) == null ? void 0 : _a.recordOutputs) === false ? [] : [\n        attrString(\"ai.response.finishReason\", finishReason),\n        attrString(\"ai.response.text\", extractTextFromLmContent(content)),\n        attrString(\n          \"ai.response.toolCalls\",\n          safeJsonWithUint8(extractToolCallsFromLmContent(content))\n        ),\n        attrString(\"ai.response.id\", responseId),\n        attrString(\"ai.response.model\", responseModelId),\n        attrString(\"ai.response.timestamp\", responseTimestampIso),\n        attrString(\"ai.response.providerMetadata\", safeJsonWithUint8(providerMetadata))\n      ],\n      attrInt(\"ai.usage.promptTokens\", inputTokens),\n      attrInt(\"ai.usage.completionTokens\", outputTokens),\n      ...finishReason ? [attrStringArray(\"gen_ai.response.finish_reasons\", [finishReason])] : [],\n      attrString(\"gen_ai.response.id\", responseId),\n      attrString(\"gen_ai.response.model\", responseModelId),\n      attrInt(\"gen_ai.usage.input_tokens\", inputTokens),\n      attrInt(\"gen_ai.usage.output_tokens\", outputTokens)\n    ]\n  });\n}\nfunction startDoStreamSpan(operationId, options, modelInfo, parent, ctx) {\n  var _a, _b, _c;\n  const { operationName, resourceName } = opName(operationId, (_a = ctx.telemetry) == null ? void 0 : _a.functionId);\n  const tools = isRecord(options) ? options[\"tools\"] : void 0;\n  const toolsJson = Array.isArray(tools) && tools.length ? tools.map((tool) => safeJsonWithUint8(tool)).filter((json) => typeof json === \"string\" && json.length > 0) : void 0;\n  const toolChoiceJson = isRecord(options) ? safeJsonWithUint8(options[\"toolChoice\"]) : void 0;\n  const promptJson = isRecord(options) ? safeJsonWithUint8(options[\"prompt\"]) : safeJsonWithUint8(options);\n  return ctx.traceShipper.startSpan({\n    name: operationId,\n    parent,\n    eventId: ctx.eventId,\n    operationId,\n    attributes: [\n      attrString(\"operation.name\", operationName),\n      attrString(\"resource.name\", resourceName),\n      attrString(\"ai.telemetry.functionId\", (_b = ctx.telemetry) == null ? void 0 : _b.functionId),\n      attrString(\"ai.model.provider\", modelInfo.provider),\n      attrString(\"ai.model.id\", modelInfo.modelId),\n      ...((_c = ctx.telemetry) == null ? void 0 : _c.recordInputs) === false ? [] : [\n        attrString(\"ai.prompt.messages\", promptJson),\n        attrStringArray(\"ai.prompt.tools\", toolsJson),\n        attrString(\"ai.prompt.toolChoice\", toolChoiceJson)\n      ],\n      attrString(\"gen_ai.system\", modelInfo.provider),\n      attrString(\"gen_ai.request.model\", modelInfo.modelId),\n      ...attrsFromGenAiRequest(options)\n    ]\n  });\n}\nfunction resolveContext(context, info) {\n  if (context === void 0) return {};\n  return typeof context === \"function\" ? context(info) : context;\n}\nfunction wrapOnFinish(args, onFinish) {\n  if (!isRecord(args)) return args;\n  const existing = args[\"onFinish\"];\n  if (existing === void 0) {\n    return { ...args, onFinish: async (result) => onFinish(result) };\n  }\n  if (!isFunction(existing)) return args;\n  return {\n    ...args,\n    onFinish: async (result) => {\n      let userError;\n      try {\n        const maybePromise = existing(result);\n        if (maybePromise && typeof maybePromise.then === \"function\") {\n          await maybePromise;\n        }\n      } catch (error) {\n        userError = error;\n      }\n      await onFinish(result);\n      if (userError !== void 0) {\n        throw userError;\n      }\n    }\n  };\n}\nasync function maybeBuildEvent(buildEvent, messages) {\n  if (!buildEvent) return void 0;\n  try {\n    const r = buildEvent(messages);\n    return r && typeof r === \"object\" ? r : void 0;\n  } catch (e) {\n    return void 0;\n  }\n}\nfunction mergeBuildEventPatch(defaults, override) {\n  var _a, _b, _c, _d, _e, _f, _g, _h;\n  if (!override) return defaults;\n  return {\n    eventName: (_a = override.eventName) != null ? _a : defaults.eventName,\n    input: (_b = override.input) != null ? _b : defaults.input,\n    output: (_c = override.output) != null ? _c : defaults.output,\n    model: (_d = override.model) != null ? _d : defaults.model,\n    properties: override.properties !== void 0 ? { ...(_e = defaults.properties) != null ? _e : {}, ...(_f = override.properties) != null ? _f : {} } : defaults.properties,\n    attachments: override.attachments !== void 0 ? [...(_g = defaults.attachments) != null ? _g : [], ...(_h = override.attachments) != null ? _h : []] : defaults.attachments\n  };\n}\nfunction mergeAttachments(...groups) {\n  const merged = [];\n  for (const group of groups) {\n    if (group == null ? void 0 : group.length) merged.push(...group);\n  }\n  return merged.length ? merged : void 0;\n}\nfunction extractNestedTokens(usage, key) {\n  if (!isRecord(usage)) return void 0;\n  const val = usage[key];\n  if (typeof val === \"number\") return val;\n  if (isRecord(val) && typeof val[\"total\"] === \"number\") return val[\"total\"];\n  return void 0;\n}\n\n// src/index.ts\nfunction eventMetadata(options) {\n  const result = {};\n  if (options.eventId) {\n    result[\"raindrop.eventId\"] = options.eventId;\n  } else {\n    result[\"raindrop.eventId\"] = randomUUID();\n    result[\"raindrop.internal.eventIdGenerated\"] = \"true\";\n  }\n  if (options.userId) result[\"raindrop.userId\"] = options.userId;\n  if (options.convoId) result[\"raindrop.convoId\"] = options.convoId;\n  if (options.eventName) result[\"raindrop.eventName\"] = options.eventName;\n  if (options.properties) result[\"raindrop.properties\"] = JSON.stringify(options.properties);\n  return result;\n}\nfunction deriveChatTurnMessageId(request) {\n  const messages = Array.isArray(request.messages) ? request.messages : [];\n  for (let i = messages.length - 1; i >= 0; i--) {\n    const message = messages[i];\n    if ((message == null ? void 0 : message.role) === \"user\" && typeof message.id === \"string\" && message.id.length > 0) {\n      return message.id;\n    }\n  }\n  if (typeof request.messageId === \"string\" && request.messageId.length > 0) {\n    return request.messageId;\n  }\n  return void 0;\n}\nfunction eventMetadataFromChatRequest(options) {\n  var _a, _b;\n  const { request, ...rest } = options;\n  const convoId = (_a = rest.convoId) != null ? _a : typeof request.id === \"string\" && request.id.length > 0 ? request.id : void 0;\n  const turnMessageId = deriveChatTurnMessageId(request);\n  const eventId = (_b = rest.eventId) != null ? _b : turnMessageId ? convoId ? `chat:${convoId}:${turnMessageId}` : `chat:${turnMessageId}` : void 0;\n  return eventMetadata({\n    ...rest,\n    ...convoId ? { convoId } : {},\n    ...eventId ? { eventId } : {}\n  });\n}\nfunction stringify(v) {\n  if (typeof v === \"string\") return v;\n  return JSON.stringify(v);\n}\nfunction userAttrsToOtlp(attrs) {\n  if (!attrs) return [];\n  return Object.entries(attrs).map(([key, value]) => attrString(key, value));\n}\nfunction envDebugEnabled() {\n  var _a;\n  if (typeof process === \"undefined\") return false;\n  const flag = (_a = process.env) == null ? void 0 : _a.RAINDROP_AI_DEBUG;\n  return flag === \"1\" || flag === \"true\";\n}\nfunction createRaindropAISDK(opts) {\n  var _a, _b, _c, _d, _e, _f, _g, _h, _i;\n  const writeKey = opts.writeKey;\n  const eventsRequested = ((_a = opts.events) == null ? void 0 : _a.enabled) !== false;\n  const tracesRequested = ((_b = opts.traces) == null ? void 0 : _b.enabled) !== false;\n  const eventsEnabled = eventsRequested && !!writeKey;\n  const tracesEnabled = tracesRequested && !!writeKey;\n  const envDebug = envDebugEnabled();\n  if (!writeKey && (eventsRequested || tracesRequested)) {\n    console.warn(\n      \"[raindrop-ai/ai-sdk] writeKey not provided; telemetry shipping is disabled\"\n    );\n  }\n  const eventShipper = new EventShipper2({\n    writeKey,\n    endpoint: opts.endpoint,\n    enabled: eventsEnabled,\n    debug: ((_c = opts.events) == null ? void 0 : _c.debug) === true || envDebug,\n    partialFlushMs: (_d = opts.events) == null ? void 0 : _d.partialFlushMs\n  });\n  const traceShipper = new TraceShipper2({\n    writeKey,\n    endpoint: opts.endpoint,\n    enabled: tracesEnabled,\n    debug: ((_e = opts.traces) == null ? void 0 : _e.debug) === true || envDebug,\n    debugSpans: ((_f = opts.traces) == null ? void 0 : _f.debugSpans) === true || envDebug,\n    flushIntervalMs: (_g = opts.traces) == null ? void 0 : _g.flushIntervalMs,\n    maxBatchSize: (_h = opts.traces) == null ? void 0 : _h.maxBatchSize,\n    maxQueueSize: (_i = opts.traces) == null ? void 0 : _i.maxQueueSize\n  });\n  return {\n    wrap(aiSDK, options) {\n      return wrapAISDK(aiSDK, {\n        options: options != null ? options : {},\n        eventShipper,\n        traceShipper\n      });\n    },\n    createTelemetryIntegration(context) {\n      return new RaindropTelemetryIntegration({\n        traceShipper,\n        eventShipper,\n        sendTraces: tracesEnabled,\n        sendEvents: eventsEnabled,\n        debug: envDebug,\n        context\n      });\n    },\n    events: {\n      async patch(eventId, patch) {\n        await eventShipper.patch(eventId, patch);\n      },\n      async addAttachments(eventId, attachments) {\n        await eventShipper.patch(eventId, { attachments });\n      },\n      async setProperties(eventId, properties) {\n        await eventShipper.patch(eventId, { properties });\n      },\n      async finish(eventId, patch) {\n        await eventShipper.finish(eventId, patch);\n      }\n    },\n    traces: /* @__PURE__ */ (() => {\n      const openSpans = /* @__PURE__ */ new Map();\n      function toTraceSpan(internal) {\n        return { traceId: internal.ids.traceIdB64, spanId: internal.ids.spanIdB64 };\n      }\n      return {\n        startSpan(args) {\n          const parent = args.parent ? { traceIdB64: args.parent.traceId, spanIdB64: args.parent.spanId } : void 0;\n          const attrs = userAttrsToOtlp(args.attributes);\n          if (args.operationId === \"ai.toolCall\") {\n            attrs.push(attrString(\"ai.toolCall.name\", args.name));\n          }\n          const internal = traceShipper.startSpan({\n            name: args.name,\n            eventId: args.eventId,\n            parent,\n            operationId: args.operationId,\n            attributes: attrs\n          });\n          const handle = toTraceSpan(internal);\n          openSpans.set(handle.spanId, internal);\n          return handle;\n        },\n        endSpan(span, extra) {\n          const internal = openSpans.get(span.spanId);\n          if (!internal) return;\n          openSpans.delete(span.spanId);\n          const errorValue = extra == null ? void 0 : extra.error;\n          const error = errorValue instanceof Error ? errorValue : typeof errorValue === \"string\" ? new Error(errorValue) : void 0;\n          traceShipper.endSpan(internal, {\n            attributes: userAttrsToOtlp(extra == null ? void 0 : extra.attributes),\n            error\n          });\n        },\n        createSpan(args) {\n          var _a2;\n          const parent = args.parent ? { traceIdB64: args.parent.traceId, spanIdB64: args.parent.spanId } : void 0;\n          const startMs = (_a2 = args.startTime) != null ? _a2 : Date.now() - args.durationMs;\n          const startAttrs = [...userAttrsToOtlp(args.attributes)];\n          if (args.operationId === \"ai.toolCall\") {\n            startAttrs.push(attrString(\"ai.toolCall.name\", args.name));\n          }\n          if (args.input !== void 0) startAttrs.push(attrString(\"traceloop.entity.input\", stringify(args.input)));\n          if (args.operationId === \"ai.toolCall\" && args.input !== void 0) {\n            startAttrs.push(attrString(\"ai.toolCall.args\", stringify(args.input)));\n          }\n          const internal = traceShipper.startSpan({\n            name: args.name,\n            eventId: args.eventId,\n            parent,\n            operationId: args.operationId,\n            attributes: startAttrs,\n            startTimeUnixNano: unixMsToNanoString(startMs)\n          });\n          const endAttrs = [];\n          if (args.output !== void 0) endAttrs.push(attrString(\"traceloop.entity.output\", stringify(args.output)));\n          if (args.operationId === \"ai.toolCall\" && args.output !== void 0) {\n            endAttrs.push(attrString(\"ai.toolCall.result\", stringify(args.output)));\n          }\n          const errorValue = args.error;\n          const error = errorValue instanceof Error ? errorValue : typeof errorValue === \"string\" ? new Error(errorValue) : void 0;\n          traceShipper.endSpan(internal, {\n            attributes: endAttrs,\n            error,\n            endTimeUnixNano: unixMsToNanoString(startMs + args.durationMs)\n          });\n          return toTraceSpan(internal);\n        }\n      };\n    })(),\n    users: {\n      async identify(users) {\n        await eventShipper.identify(users);\n      }\n    },\n    signals: {\n      async track(signal) {\n        await eventShipper.trackSignal(signal);\n      }\n    },\n    async flush() {\n      await Promise.all([eventShipper.flush(), traceShipper.flush()]);\n    },\n    async shutdown() {\n      await Promise.all([eventShipper.shutdown(), traceShipper.shutdown()]);\n    }\n  };\n}\n\nexport { RaindropTelemetryIntegration, _resetWarnedMissingUserId, createRaindropAISDK, currentSpan, eventMetadata, eventMetadataFromChatRequest, getContextManager, withCurrent };\n", "import { assertNever, getLogger } from \"@framerjs/shared\"\nimport {\n\tcreateRaindropAISDK,\n\teventMetadata,\n\ttype AISDKMessage,\n\ttype BuildEventPatch,\n\ttype SelfDiagnosticsOptions,\n\ttype StartSpanArgs,\n\ttype TraceSpan,\n} from \"@raindrop-ai/ai-sdk/browser\"\nimport * as ai from \"ai\"\nimport type { ModelMessage } from \"ai\"\n\nconst RAINDROP_WRITE_KEY = \"f3caaa9a-c20f-4bae-8371-4c4396baa6ce\"\nconst enableRaindropDebugSpans = false\nconst log = getLogger(\"ai:agents:tracking\")\n\n/**\n * Tool name for the Raindrop self-diagnostics reporting tool injected by the SDK.\n * Mirrors the SDK's default; we set it explicitly so we can recognize and filter\n * the tool calls and results out of the agent's UI/history pipeline.\n */\nexport const RAINDROP_SELF_DIAGNOSTICS_TOOL_NAME = \"__raindrop_report\"\n\nconst enabledSelfDiagnostics: SelfDiagnosticsOptions = {\n\tenabled: true,\n\ttoolName: RAINDROP_SELF_DIAGNOSTICS_TOOL_NAME,\n}\n\nfunction isRaindropSelfDiagnosticsPart(part: { type: string }): boolean {\n\treturn \"toolName\" in part && part.toolName === RAINDROP_SELF_DIAGNOSTICS_TOOL_NAME\n}\n\nexport function filterRaindropSelfDiagnosticsMessages(messages: readonly ModelMessage[]): ModelMessage[] {\n\tconst filteredMessages: ModelMessage[] = []\n\n\tfor (const message of messages) {\n\t\tswitch (message.role) {\n\t\t\tcase \"assistant\": {\n\t\t\t\tif (!Array.isArray(message.content)) {\n\t\t\t\t\tfilteredMessages.push(message)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\n\t\t\t\tconst content = message.content.filter(part => !isRaindropSelfDiagnosticsPart(part))\n\t\t\t\tif (content.length > 0) filteredMessages.push({ ...message, content })\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"tool\": {\n\t\t\t\tconst content = message.content.filter(part => !isRaindropSelfDiagnosticsPart(part))\n\t\t\t\tif (content.length > 0) filteredMessages.push({ ...message, content })\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase \"system\":\n\t\t\tcase \"user\":\n\t\t\t\tfilteredMessages.push(message)\n\t\t\t\tbreak\n\t\t\tdefault:\n\t\t\t\tassertNever(message)\n\t\t}\n\t}\n\n\treturn filteredMessages\n}\n\nfunction normalizeEventText(text: string | undefined): string | undefined {\n\tif (!text) return undefined\n\n\tconst normalized = text.replace(/\\s+/gu, \" \").trim()\n\treturn normalized.length > 0 ? normalized : undefined\n}\n\nfunction getWrappedTagName(text: string): string | undefined {\n\tconst trimmedText = text.trim()\n\tif (!trimmedText.startsWith(\"<\") || trimmedText.startsWith(\"</\")) return undefined\n\n\tconst openingTagEnd = trimmedText.indexOf(\">\")\n\tif (openingTagEnd <= 1) return undefined\n\n\tconst openingTagBody = trimmedText.slice(1, openingTagEnd)\n\tconst firstSpaceIndex = openingTagBody.indexOf(\" \")\n\tconst tagName = firstSpaceIndex === -1 ? openingTagBody : openingTagBody.slice(0, firstSpaceIndex)\n\tif (!/^[a-z-]+$/u.test(tagName)) return undefined\n\tif (!trimmedText.endsWith(`</${tagName}>`)) return undefined\n\treturn tagName\n}\n\nfunction isAgentMetadataText(text: string): boolean {\n\treturn getWrappedTagName(text) !== undefined\n}\n\nfunction getTextParts(message: AISDKMessage | undefined): string[] {\n\tconst content = message?.content\n\tif (typeof content === \"string\") return [content]\n\tif (!Array.isArray(content)) return []\n\n\tconst textParts: string[] = []\n\tfor (const part of content) {\n\t\tif (!part || typeof part !== \"object\") continue\n\t\tif (!(\"type\" in part) || part.type !== \"text\") continue\n\t\tif (!(\"text\" in part) || typeof part.text !== \"string\") continue\n\t\ttextParts.push(part.text)\n\t}\n\n\treturn textParts\n}\n\nfunction extractUserEventPayload(message: AISDKMessage | undefined): Pick<BuildEventPatch, \"input\"> {\n\tconst visibleTextParts: string[] = []\n\n\tfor (const textPart of getTextParts(message)) {\n\t\tif (isAgentMetadataText(textPart)) continue\n\t\tvisibleTextParts.push(textPart)\n\t}\n\n\treturn {\n\t\tinput: normalizeEventText(visibleTextParts.join(\"\\n\\n\")),\n\t}\n}\n\nfunction findLastMessage(messages: readonly AISDKMessage[], role: AISDKMessage[\"role\"]): AISDKMessage | undefined {\n\tfor (let i = messages.length - 1; i >= 0; i--) {\n\t\tconst message = messages[i]\n\t\tif (message?.role === role) return message\n\t}\n}\n\nexport function buildRaindropEvent(messages: AISDKMessage[]): BuildEventPatch | undefined {\n\tconst lastUserMessage = findLastMessage(messages, \"user\")\n\tconst { input } = extractUserEventPayload(lastUserMessage)\n\n\tif (!input) return undefined\n\n\treturn { input }\n}\n\nexport const raindrop = createRaindropAISDK({\n\twriteKey: RAINDROP_WRITE_KEY,\n\t// when undefined defaults to production Raindrop endpoint\n\tendpoint: process.env.RAINDROP_LOCAL_DEBUGGER,\n\ttraces: {\n\t\tdebugSpans: enableRaindropDebugSpans,\n\t},\n})\n\n// Use the full wrapper only for isolated subcalls where Raindrop can safely ingest the raw\n// AI SDK messages. This keeps buildEvent-based event shaping available for those paths.\nexport const raindropAI = raindrop.wrap(ai, {\n\tcontext: {},\n\tbuildEvent: buildRaindropEvent,\n})\n\n// Main agent stream uses manual event lifecycle via AgentInteraction. Keep SDK auto-tracing,\n// but disable SDK event writes so raw assistant DSL output/properties cannot clobber curated data.\nconst raindropTracesOnlyAI = raindrop.wrap(ai, {\n\tcontext: {},\n\tsend: {\n\t\tevents: false,\n\t\ttraces: true,\n\t},\n})\n\nconst raindropTracesOnlyAIWithSelfDiagnostics = raindrop.wrap(ai, {\n\tcontext: {},\n\tsend: {\n\t\tevents: false,\n\t\ttraces: true,\n\t},\n\tselfDiagnostics: enabledSelfDiagnostics,\n})\n\nexport function getRaindropTracesOnlyAI({ selfDiagnostics }: { selfDiagnostics: boolean }) {\n\treturn selfDiagnostics ? raindropTracesOnlyAIWithSelfDiagnostics : raindropTracesOnlyAI\n}\n\nexport type RaindropTraceSpan = TraceSpan\ntype EndSpanArgs = Parameters<typeof raindrop.traces.endSpan>[1]\n\nexport function startRaindropTraceSpan(\n\targs: Omit<StartSpanArgs, \"eventId\"> & { eventId?: string },\n): RaindropTraceSpan | undefined {\n\tconst eventId = args.eventId\n\tif (!eventId) return undefined\n\ttry {\n\t\treturn raindrop.traces.startSpan({ ...args, eventId })\n\t} catch (error) {\n\t\tlog.error(\"Error starting Raindrop trace span\", eventId, error)\n\t\treturn undefined\n\t}\n}\n\nexport function endRaindropTraceSpan(span: RaindropTraceSpan | undefined, extra?: EndSpanArgs): void {\n\tif (!span) return\n\ttry {\n\t\traindrop.traces.endSpan(span, extra)\n\t} catch (error) {\n\t\tlog.error(\"Error ending Raindrop trace span\", span, error)\n\t}\n}\n\nexport function createRaindropEventMetadata(\n\tinput: Parameters<typeof eventMetadata>[0],\n): ReturnType<typeof eventMetadata> {\n\treturn eventMetadata(input)\n}\n", "function stringifyUnknownError(error: unknown): string | undefined {\n\tif (error === undefined) return undefined\n\tif (typeof error === \"string\") return error\n\n\ttry {\n\t\treturn JSON.stringify(error)\n\t} catch {\n\t\treturn String(error)\n\t}\n}\n\nfunction formatErrorBase(error: Error): string {\n\tif (error.message.length === 0) return error.name\n\tif (error.name.length === 0 || error.name === \"Error\") return error.message\n\treturn `${error.name}: ${error.message}`\n}\n\nexport function formatRaindropError(error: unknown): string | undefined {\n\tif (error instanceof Error) {\n\t\tconst parts = [formatErrorBase(error)]\n\t\tconst cause = formatRaindropError(error.cause)\n\t\tif (cause) {\n\t\t\t// Wrapper errors from SDK/providers are often just `Error`; the cause is the useful part.\n\t\t\tparts.push(`Caused by: ${cause}`)\n\t\t}\n\t\treturn parts.join(\"\\n\")\n\t}\n\n\treturn stringifyUnknownError(error)\n}\n", "import type { ToolExecutionOptions } from \"ai\"\nimport type { Command, CommandType } from \"../agents/dsl.ts\"\nimport {\n\tgetBlockingTaskCompletedMessage,\n\tgetBlockingTaskStartMessage,\n\tgetDSLCommandCompletedMessage,\n\tgetDSLCommandStartMessage,\n} from \"../agents/statusMessages.ts\"\nimport { endRaindropTraceSpan, startRaindropTraceSpan, type RaindropTraceSpan } from \"./client.ts\"\nimport { formatRaindropError } from \"./error.ts\"\n\nexport interface TraceDisplayMessages {\n\tstart: string\n\tcompleted?: string\n}\n\nexport interface ToolTraceContext {\n\teventId: string\n\tparent: RaindropTraceSpan | undefined\n}\n\nexport type ReadProjectTraceContext = ToolTraceContext\n\nexport interface ToolTracingOptions<Input, Output> {\n\tgetTraceContext: () => ToolTraceContext | undefined\n\tgetSpanName?: (input: Input, options: ToolExecutionOptions) => string\n\tgetTraceInput?: (input: Input) => unknown\n\tgetTraceOutput?: (output: Output) => unknown\n}\n\nexport interface ToolTraceExecutionContext<Input> {\n\tspan: RaindropTraceSpan | undefined\n\tstartedAt: number\n\ttraceInput: unknown\n\tnestedTraceContext: ToolTraceContext | undefined\n\tinput: Input\n}\n\nfunction stringifyTraceValue(value: unknown): string | undefined {\n\tif (value === undefined) return undefined\n\ttry {\n\t\treturn JSON.stringify(value)\n\t} catch {\n\t\treturn undefined\n\t}\n}\n\nexport function createToolTraceExecutionContext<Input, Output>(options: {\n\tinput: Input\n\ttoolOptions: ToolExecutionOptions\n\ttracing: ToolTracingOptions<Input, Output> | undefined\n\ttoolName: string | undefined\n}): ToolTraceExecutionContext<Input> | undefined {\n\tconst { input, toolOptions, tracing, toolName } = options\n\tif (!tracing) return undefined\n\n\tconst traceContext = tracing.getTraceContext()\n\tif (!traceContext?.eventId) return undefined\n\n\tconst traceInput = tracing.getTraceInput?.(input)\n\tconst traceInputText = stringifyTraceValue(traceInput)\n\tconst span = startRaindropTraceSpan({\n\t\tname: tracing.getSpanName?.(input, toolOptions) ?? toolName ?? \"tool\",\n\t\teventId: traceContext.eventId,\n\t\tparent: traceContext.parent,\n\t\toperationId: \"ai.toolCall\",\n\t\tattributes: {\n\t\t\t\"ai.toolCall.id\": toolOptions.toolCallId,\n\t\t\t...(traceInputText === undefined ? {} : { \"traceloop.entity.input\": traceInputText }),\n\t\t},\n\t})\n\n\treturn {\n\t\tinput,\n\t\tspan,\n\t\tstartedAt: performance.now(),\n\t\ttraceInput,\n\t\tnestedTraceContext: { eventId: traceContext.eventId, parent: span ?? traceContext.parent },\n\t}\n}\n\nexport function endToolTraceSuccess<Input, Output>(\n\ttraceContext: ToolTraceExecutionContext<Input> | undefined,\n\ttracing: ToolTracingOptions<Input, Output> | undefined,\n\tresult: Output,\n): void {\n\tif (!traceContext) return\n\tconst output = tracing?.getTraceOutput?.(result)\n\tconst outputText = stringifyTraceValue(output)\n\tendRaindropTraceSpan(traceContext.span, {\n\t\tattributes: {\n\t\t\tduration_ms: String(Math.round(performance.now() - traceContext.startedAt)),\n\t\t\t...(outputText === undefined ? {} : { \"traceloop.entity.output\": outputText }),\n\t\t},\n\t})\n}\n\nexport function endToolTraceError<Input>(\n\ttraceContext: ToolTraceExecutionContext<Input> | undefined,\n\terror: unknown,\n): void {\n\tif (!traceContext) return\n\tconst traceInputText = stringifyTraceValue(traceContext.traceInput)\n\tconst errorMessage = formatRaindropError(error) ?? \"tool failed\"\n\tendRaindropTraceSpan(traceContext.span, {\n\t\terror: errorMessage,\n\t\tattributes: {\n\t\t\tduration_ms: String(Math.round(performance.now() - traceContext.startedAt)),\n\t\t\t...(traceInputText === undefined ? {} : { \"traceloop.entity.input\": traceInputText }),\n\t\t\t\"traceloop.entity.output\": errorMessage,\n\t\t},\n\t})\n}\n\ninterface DSLTraceGroupState {\n\tspan: RaindropTraceSpan\n\tcommandCount: number\n\tcommandTypes: CommandType[]\n\tcommandInputs: string[]\n}\n\ninterface DSLTraceState {\n\tspan: RaindropTraceSpan\n\teventId: string\n\tcommandCount: number\n\tgroupCount: number\n\tcommandInputs: string[]\n\tcurrentGroup: DSLTraceGroupState | undefined\n}\n\ninterface DSLCommandTrace {\n\tspan: RaindropTraceSpan\n}\n\ninterface DesignPlanTraceState {\n\tspan: RaindropTraceSpan\n\tinput: string[]\n}\n\nfunction createDSLTraceGroupName(first: CommandType): string {\n\treturn `${first} sequence`\n}\n\nfunction getDSLCommandTraceDisplayAttributes(command: Command): Record<string, string> {\n\treturn {\n\t\tharness_display_start: getDSLCommandStartMessage(command),\n\t\tharness_display_completed: getDSLCommandCompletedMessage(command),\n\t}\n}\n\nfunction joinDSLInput(commands: readonly string[]): string {\n\treturn commands.join(\"\\n\")\n}\n\nexport interface AgentStreamTracer {\n\treadonly raindropEventId: string | undefined\n\tgetRootTraceParent(): RaindropTraceSpan | undefined\n\tcloseCurrentDSLTraceGroupIfComplete(): void\n\topenDSLCommandTrace(command: Command): DSLCommandTrace | undefined\n\tcloseDSLCommandTrace(\n\t\tcommandTrace: DSLCommandTrace | undefined,\n\t\tpayload: { input: string; output?: string; error?: string },\n\t): void\n\taddDesignPlanTraceToken(token: string): void\n\tcloseDesignPlanTrace(): void\n\tendStep(): void\n\tendRootSuccess(): void\n\tendRootCancelled(reason: \"user-stopped\" | \"queue-interrupted\"): void\n\tendRootFailure(error?: unknown): void\n}\n\nexport function createAgentStreamTracer(raindropEventId: string | undefined): AgentStreamTracer {\n\tlet currentDSLTraceState: DSLTraceState | undefined = undefined\n\tlet currentDesignPlanTraceState: DesignPlanTraceState | undefined = undefined\n\tlet rootTraceSpan: RaindropTraceSpan | undefined = undefined\n\n\tfunction getRootTraceParent(): RaindropTraceSpan | undefined {\n\t\tif (!raindropEventId) return undefined\n\t\trootTraceSpan ??= startRaindropTraceSpan({\n\t\t\tname: \"ai.streamText\",\n\t\t\teventId: raindropEventId,\n\t\t\toperationId: \"ai.streamText\",\n\t\t})\n\t\treturn rootTraceSpan\n\t}\n\n\tfunction openDSLTraceState() {\n\t\tif (!raindropEventId) {\n\t\t\tcurrentDSLTraceState = undefined\n\t\t\treturn\n\t\t}\n\n\t\tconst span = startRaindropTraceSpan({\n\t\t\tname: \"DSL\",\n\t\t\teventId: raindropEventId,\n\t\t\tparent: getRootTraceParent(),\n\t\t\t// Raindrop surfaces traceloop input/output primarily on known AI operation ids.\n\t\t\t// Keep the human-readable span name as \"DSL\", but use ai.toolCall so input is visible.\n\t\t\toperationId: \"ai.toolCall\",\n\t\t\tattributes: {\n\t\t\t\tdsl_operation_id: \"dsl\",\n\t\t\t},\n\t\t})\n\t\tif (!span) {\n\t\t\tcurrentDSLTraceState = undefined\n\t\t\treturn\n\t\t}\n\n\t\tcurrentDSLTraceState = {\n\t\t\tspan,\n\t\t\teventId: raindropEventId,\n\t\t\tcommandCount: 0,\n\t\t\tgroupCount: 0,\n\t\t\tcommandInputs: [],\n\t\t\tcurrentGroup: undefined,\n\t\t}\n\t}\n\n\tfunction closeCurrentDSLTraceGroup() {\n\t\tconst dslTraceState = currentDSLTraceState\n\t\tconst currentGroup = dslTraceState?.currentGroup\n\t\tif (!dslTraceState || !currentGroup) return\n\n\t\tendRaindropTraceSpan(currentGroup.span, {\n\t\t\tattributes: {\n\t\t\t\tcommand_count: String(currentGroup.commandCount),\n\t\t\t\tcommand_types: currentGroup.commandTypes.join(\",\"),\n\t\t\t\tsecond_command_type: currentGroup.commandTypes[1] ?? \"\",\n\t\t\t\t\"traceloop.entity.input\": joinDSLInput(currentGroup.commandInputs),\n\t\t\t},\n\t\t})\n\t\tdslTraceState.currentGroup = undefined\n\t}\n\n\tfunction closeCurrentDSLTraceGroupIfComplete() {\n\t\tconst currentGroup = currentDSLTraceState?.currentGroup\n\t\tif (!currentGroup || currentGroup.commandCount < 2) return\n\t\tcloseCurrentDSLTraceGroup()\n\t}\n\n\tfunction openDSLCommandTrace(command: Command) {\n\t\tif (!currentDSLTraceState) {\n\t\t\topenDSLTraceState()\n\t\t}\n\n\t\tconst dslTraceState = currentDSLTraceState\n\t\tif (!dslTraceState) return undefined\n\n\t\tif (!dslTraceState.currentGroup || dslTraceState.currentGroup.commandCount >= 2) {\n\t\t\tcloseCurrentDSLTraceGroup()\n\t\t\tconst groupSpan = startRaindropTraceSpan({\n\t\t\t\tname: createDSLTraceGroupName(command.type),\n\t\t\t\teventId: dslTraceState.eventId,\n\t\t\t\tparent: dslTraceState.span,\n\t\t\t\t// See note above: use a known operation id for Raindrop input rendering.\n\t\t\t\toperationId: \"ai.toolCall\",\n\t\t\t\tattributes: {\n\t\t\t\t\tdsl_operation_id: \"dsl.sequence\",\n\t\t\t\t\tfirst_command_type: command.type,\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!groupSpan) {\n\t\t\t\treturn undefined\n\t\t\t}\n\t\t\tdslTraceState.currentGroup = {\n\t\t\t\tspan: groupSpan,\n\t\t\t\tcommandCount: 0,\n\t\t\t\tcommandTypes: [],\n\t\t\t\tcommandInputs: [],\n\t\t\t}\n\t\t\tdslTraceState.groupCount++\n\t\t}\n\n\t\tconst currentGroup = dslTraceState.currentGroup\n\t\tif (!currentGroup) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tconst commandIndex = currentGroup.commandCount\n\t\tconst commandSpan = startRaindropTraceSpan({\n\t\t\tname: `command: ${command.type}`,\n\t\t\teventId: dslTraceState.eventId,\n\t\t\tparent: currentGroup.span,\n\t\t\toperationId: \"ai.toolCall\",\n\t\t\tattributes: {\n\t\t\t\tdsl_group_index: String(commandIndex),\n\t\t\t\t...getDSLCommandTraceDisplayAttributes(command),\n\t\t\t},\n\t\t})\n\t\tif (!commandSpan) {\n\t\t\treturn undefined\n\t\t}\n\n\t\tcurrentGroup.commandCount++\n\t\tcurrentGroup.commandTypes.push(command.type)\n\t\tdslTraceState.commandCount++\n\n\t\treturn {\n\t\t\tspan: commandSpan,\n\t\t}\n\t}\n\n\tfunction closeDSLCommandTrace(\n\t\tcommandTrace: DSLCommandTrace | undefined,\n\t\t{\n\t\t\tinput,\n\t\t\toutput,\n\t\t\terror,\n\t\t}: {\n\t\t\tinput: string\n\t\t\toutput?: string\n\t\t\terror?: string\n\t\t},\n\t) {\n\t\tconst errorOutput = error === undefined ? undefined : error\n\t\tendRaindropTraceSpan(commandTrace?.span, {\n\t\t\terror,\n\t\t\tattributes: {\n\t\t\t\t\"traceloop.entity.input\": input,\n\t\t\t\t\"traceloop.entity.output\": output ?? errorOutput ?? \"\",\n\t\t\t},\n\t\t})\n\t\tconst dslTraceState = currentDSLTraceState\n\t\tconst currentGroup = dslTraceState?.currentGroup\n\t\tif (!dslTraceState || !currentGroup) return\n\t\tdslTraceState.commandInputs.push(input)\n\t\tcurrentGroup.commandInputs.push(input)\n\t}\n\n\tfunction addDesignPlanTraceToken(token: string) {\n\t\tif (!raindropEventId || token.length === 0) return\n\n\t\tif (!currentDesignPlanTraceState) {\n\t\t\tconst span = startRaindropTraceSpan({\n\t\t\t\tname: \"Design Plan\",\n\t\t\t\teventId: raindropEventId,\n\t\t\t\tparent: getRootTraceParent(),\n\t\t\t\toperationId: \"ai.toolCall\",\n\t\t\t\tattributes: {\n\t\t\t\t\tharness_display_start: getBlockingTaskStartMessage(\"deprecated-design-plan\"),\n\t\t\t\t},\n\t\t\t})\n\t\t\tif (!span) return\n\t\t\tcurrentDesignPlanTraceState = {\n\t\t\t\tspan,\n\t\t\t\tinput: [],\n\t\t\t}\n\t\t}\n\n\t\tcurrentDesignPlanTraceState.input.push(token)\n\t}\n\n\tfunction closeDesignPlanTrace(): void {\n\t\tconst state = currentDesignPlanTraceState\n\t\tif (!state) return\n\n\t\tendRaindropTraceSpan(state.span, {\n\t\t\tattributes: {\n\t\t\t\tharness_display_completed: getBlockingTaskCompletedMessage(\"deprecated-design-plan\"),\n\t\t\t\t\"traceloop.entity.input\": state.input.join(\"\"),\n\t\t\t},\n\t\t})\n\t\tcurrentDesignPlanTraceState = undefined\n\t}\n\n\tfunction closeCurrentDSLTraceState(): void {\n\t\tif (!currentDSLTraceState) return\n\n\t\tcloseCurrentDSLTraceGroup()\n\t\tendRaindropTraceSpan(currentDSLTraceState.span, {\n\t\t\tattributes: {\n\t\t\t\tcommand_count: String(currentDSLTraceState.commandCount),\n\t\t\t\tgroup_count: String(currentDSLTraceState.groupCount),\n\t\t\t\t\"traceloop.entity.input\": joinDSLInput(currentDSLTraceState.commandInputs),\n\t\t\t},\n\t\t})\n\t\tcurrentDSLTraceState = undefined\n\t}\n\n\tfunction endStep() {\n\t\tcloseCurrentDSLTraceState()\n\t\tcloseDesignPlanTrace()\n\t}\n\n\tfunction endRootSuccess() {\n\t\tcloseCurrentDSLTraceState()\n\t\tcloseDesignPlanTrace()\n\t\tendRaindropTraceSpan(rootTraceSpan, {\n\t\t\tattributes: {\n\t\t\t\tfinish_reason: \"completed\",\n\t\t\t},\n\t\t})\n\t\trootTraceSpan = undefined\n\t}\n\n\tfunction endRootCancelled(reason: \"user-stopped\" | \"queue-interrupted\") {\n\t\tcloseCurrentDSLTraceState()\n\t\tcloseDesignPlanTrace()\n\t\tendRaindropTraceSpan(rootTraceSpan, {\n\t\t\tattributes: {\n\t\t\t\tfinish_reason: \"cancelled\",\n\t\t\t\taborted_reason: reason,\n\t\t\t},\n\t\t})\n\t\trootTraceSpan = undefined\n\t}\n\n\tfunction endRootFailure(error?: unknown) {\n\t\tcloseCurrentDSLTraceState()\n\t\tcloseDesignPlanTrace()\n\t\tconst errorMessage = formatRaindropError(error) ?? \"stream failed\"\n\t\tendRaindropTraceSpan(rootTraceSpan, {\n\t\t\terror: errorMessage,\n\t\t\tattributes: {\n\t\t\t\tfinish_reason: \"error\",\n\t\t\t},\n\t\t})\n\t\trootTraceSpan = undefined\n\t}\n\n\treturn {\n\t\traindropEventId,\n\t\tgetRootTraceParent,\n\t\tcloseCurrentDSLTraceGroupIfComplete,\n\t\topenDSLCommandTrace,\n\t\tcloseDSLCommandTrace,\n\t\taddDesignPlanTraceToken,\n\t\tcloseDesignPlanTrace,\n\t\tendStep,\n\t\tendRootSuccess,\n\t\tendRootCancelled,\n\t\tendRootFailure,\n\t}\n}\n\nexport async function traceReadProjectQueryExecution<TResult>(options: {\n\tqueryType: string\n\tquery: unknown\n\ttraceEventId: string | undefined\n\ttraceParent: RaindropTraceSpan | undefined\n\tdisplayMessages: TraceDisplayMessages | undefined\n\tgetTraceOutput?: (result: TResult) => unknown\n\texecute: (nestedTrace: ReadProjectTraceContext | undefined) => Promise<TResult>\n}): Promise<TResult> {\n\tconst { queryType, query, traceEventId, traceParent, displayMessages, getTraceOutput, execute } = options\n\tif (!traceEventId) {\n\t\treturn execute(undefined)\n\t}\n\n\tconst startedAt = Date.now()\n\n\tconst queryTraceSpan = startRaindropTraceSpan({\n\t\tname: `query: ${queryType}`,\n\t\teventId: traceEventId,\n\t\tparent: traceParent,\n\t\toperationId: \"ai.toolCall\",\n\t\tattributes: {\n\t\t\tharness_display_start: displayMessages?.start ?? \"\",\n\t\t\t\"traceloop.entity.input\": JSON.stringify(query),\n\t\t},\n\t})\n\n\tconst nestedTrace = traceEventId && queryTraceSpan ? { eventId: traceEventId, parent: queryTraceSpan } : undefined\n\n\ttry {\n\t\tconst result = await execute(nestedTrace)\n\t\tconst traceOutput = getTraceOutput?.(result) ?? result\n\t\tconst attributes: Record<string, string> = {\n\t\t\tharness_display_completed: displayMessages?.completed ?? \"\",\n\t\t\tduration_ms: String(Date.now() - startedAt),\n\t\t}\n\t\tif (queryTraceSpan) {\n\t\t\tattributes[\"traceloop.entity.output\"] = JSON.stringify(traceOutput)\n\t\t}\n\n\t\tendRaindropTraceSpan(queryTraceSpan, {\n\t\t\tattributes,\n\t\t})\n\t\treturn result\n\t} catch (error) {\n\t\tconst errorMessage = formatRaindropError(error) ?? \"query failed\"\n\t\tendRaindropTraceSpan(queryTraceSpan, {\n\t\t\terror: errorMessage,\n\t\t\tattributes: {\n\t\t\t\tharness_display_completed: displayMessages?.completed ?? \"\",\n\t\t\t\tduration_ms: String(Date.now() - startedAt),\n\t\t\t\t\"traceloop.entity.output\": errorMessage,\n\t\t\t},\n\t\t})\n\t\tthrow error\n\t}\n}\n", "import { tool, type Tool, type ToolExecutionOptions } from \"ai\"\nimport {\n\tcreateToolTraceExecutionContext,\n\tendToolTraceError,\n\tendToolTraceSuccess,\n\ttype ToolTraceExecutionContext,\n\ttype ToolTracingOptions,\n} from \"app/ai/raindrop/agentStreamTrace.ts\"\nimport { isFunction, isObject } from \"utils/typeChecks.ts\"\nimport type { ChatPart, ChatPartUpdater, EmitChatPart } from \"../../types.ts\"\n\ntype ExecutableTool<INPUT, OUTPUT> = Tool<INPUT, OUTPUT> & {\n\texecute: (\n\t\tinput: INPUT,\n\t\toptions: ToolExecutionOptions & { traceExecutionContext: ToolTraceExecutionContext<INPUT> | undefined },\n\t) => AsyncIterable<OUTPUT> | PromiseLike<OUTPUT> | OUTPUT\n}\ntype InputDeltaOptions = ToolExecutionOptions & { inputTextDelta: string }\n\ninterface CreateUIConnectedToolOptions<Input, Output, P extends ChatPart> {\n\tsynchronize: () => Promise<void>\n\tonPart: EmitChatPart | undefined\n\tonStart?: (input: Input) => P | undefined\n\t/**\n\t * Returns a transient placeholder part shown before input is fully parsed. It must be a (possibly\n\t * partial) `P`; `onStart` later replaces it with the fully-populated part once input is available.\n\t */\n\tonFirstInputDelta?: (options: InputDeltaOptions) => P | undefined\n\tonComplete?: (part: P, result: Output, input: Input, timestamp: number) => P\n\ttoolName?: string\n\ttracing?: ToolTracingOptions<Input, Output>\n\tonExecutionComplete?: (context: ToolTraceExecutionContext<Input> | undefined, result: Output, input: Input) => void\n\tonExecutionError?: (context: ToolTraceExecutionContext<Input> | undefined, error: unknown, input: Input) => void\n}\n\nfunction isAsyncIterable<T>(value: unknown): value is AsyncIterable<T> {\n\treturn isObject(value) && Symbol.asyncIterator in value && isFunction(value[Symbol.asyncIterator])\n}\n\n// Note: In the future we could connect the async iterable to the chat UI as well if it can return\n// parts that should be user visible.\nfunction maybeWrapAsyncIterable<Output>(\n\tsource: AsyncIterable<Output> | PromiseLike<Output> | Output,\n\tonComplete: (result: Output) => Output,\n\tonError: (error: unknown) => void,\n\tonFinally: () => void,\n): AsyncIterable<Output> | Promise<Output> {\n\tif (!isAsyncIterable<Output>(source)) {\n\t\treturn Promise.resolve(source)\n\t\t\t.then(onComplete)\n\t\t\t.catch(error => {\n\t\t\t\tonError(error)\n\t\t\t\tthrow error\n\t\t\t})\n\t\t\t.finally(onFinally)\n\t}\n\treturn (async function* () {\n\t\tlet lastResult: { value: Output } | undefined\n\t\ttry {\n\t\t\tfor await (const result of source) {\n\t\t\t\tlastResult = { value: result }\n\t\t\t\tyield result\n\t\t\t}\n\n\t\t\tif (lastResult) onComplete(lastResult.value)\n\t\t} catch (error) {\n\t\t\tonError(error)\n\t\t\tthrow error\n\t\t} finally {\n\t\t\tonFinally()\n\t\t}\n\t})()\n}\n\nfunction defaultOnCompleteUpdater<P extends ChatPart>(\n\tpart: P,\n\t_result: unknown,\n\t_input: unknown,\n\tcompletedAt: number,\n): P {\n\t// By default, just set the completedAt timestamp.\n\tif (supportsCompletedAt(part)) {\n\t\treturn addCompletedAt(part, completedAt)\n\t}\n\n\treturn part\n}\n\nexport function supportsCompletedAt<P extends ChatPart>(\n\tpart: P,\n): part is Extract<P, { type: \"blocking-task\" | \"scripting\" }> {\n\treturn part.type === \"blocking-task\" || part.type === \"scripting\"\n}\n\nexport function addCompletedAt<T extends Extract<ChatPart, { type: \"blocking-task\" | \"scripting\" }>>(\n\tpart: T,\n\tcompletedAt: number,\n): T {\n\treturn { ...part, completedAt }\n}\n\nconst key = \"traceExecutionContext\"\nexport function hasTraceExecutionContext(\n\toptions: ToolExecutionOptions,\n): options is ToolExecutionOptions & { traceExecutionContext: ToolTraceExecutionContext<unknown> | undefined } {\n\treturn key in options\n}\n\n/**\n * Create a Tool definition for the AI SDK that automatically\n * - Updates the chat UI\n * - Synchronizes the tool execution with the parser\n */\nexport function createUIConnectedTool<INPUT, OUTPUT, P extends ChatPart = ChatPart>(\n\tt: ExecutableTool<INPUT, OUTPUT>,\n\toptions: CreateUIConnectedToolOptions<INPUT, OUTPUT, P>,\n): Tool<INPUT, OUTPUT> {\n\tconst {\n\t\tsynchronize,\n\t\tonPart,\n\t\tonStart,\n\t\tonFirstInputDelta,\n\t\tonComplete = defaultOnCompleteUpdater,\n\t\ttoolName,\n\t\ttracing,\n\t\tonExecutionComplete,\n\t\tonExecutionError,\n\t} = options\n\tconst updaterByCallId = new Map<string, ChatPartUpdater<P> | undefined>()\n\n\tfunction completePart(toolCallId: string, input: INPUT, result: OUTPUT) {\n\t\tconst updater = updaterByCallId.get(toolCallId)\n\t\tupdater?.((current, timestamp) => onComplete(current, result, input, timestamp))\n\t}\n\n\tconst execute = async (input: INPUT, options: ToolExecutionOptions) => {\n\t\tawait synchronize()\n\n\t\tconst part = onStart?.(input)\n\t\tif (part) {\n\t\t\tconst existingUpdater = updaterByCallId.get(options.toolCallId)\n\t\t\tif (existingUpdater) {\n\t\t\t\t// A part was already emitted (e.g. by onFirstInputDelta, before the input was available).\n\t\t\t\t// Merge the input-derived onStart fields into it instead of emitting a duplicate.\n\t\t\t\texistingUpdater(() => part)\n\t\t\t} else {\n\t\t\t\tconst updater = onPart?.(part)\n\t\t\t\tupdaterByCallId.set(options.toolCallId, updater?.ui)\n\t\t\t}\n\t\t}\n\n\t\tconst traceExecutionContext = createToolTraceExecutionContext({ input, toolOptions: options, tracing, toolName })\n\n\t\tconst execution = (() => {\n\t\t\ttry {\n\t\t\t\treturn t.execute(input, { ...options, traceExecutionContext })\n\t\t\t} catch (error) {\n\t\t\t\tendToolTraceError(traceExecutionContext, error)\n\t\t\t\tonExecutionError?.(traceExecutionContext, error, input)\n\t\t\t\tupdaterByCallId.delete(options.toolCallId)\n\t\t\t\tthrow error\n\t\t\t}\n\t\t})()\n\n\t\treturn maybeWrapAsyncIterable(\n\t\t\texecution,\n\t\t\t(result: OUTPUT): OUTPUT => {\n\t\t\t\tendToolTraceSuccess(traceExecutionContext, tracing, result)\n\t\t\t\tonExecutionComplete?.(traceExecutionContext, result, input)\n\t\t\t\tcompletePart(options.toolCallId, input, result)\n\t\t\t\treturn result\n\t\t\t},\n\t\t\terror => {\n\t\t\t\tendToolTraceError(traceExecutionContext, error)\n\t\t\t\tonExecutionError?.(traceExecutionContext, error, input)\n\t\t\t},\n\t\t\t() => {\n\t\t\t\tupdaterByCallId.delete(options.toolCallId)\n\t\t\t},\n\t\t)\n\t}\n\n\t// The first input delta is the earliest point where tool arguments are streaming. Emitting UI\n\t// here (after `synchronize`) lets pending prose flush first, instead of waiting for execution.\n\tconst onInputDelta = async (opts: InputDeltaOptions) => {\n\t\tif (!updaterByCallId.has(opts.toolCallId) && onFirstInputDelta) {\n\t\t\tconst part = onFirstInputDelta(opts)\n\t\t\tif (part) {\n\t\t\t\tawait synchronize()\n\t\t\t\tupdaterByCallId.set(opts.toolCallId, onPart?.(part)?.ui)\n\t\t\t}\n\t\t}\n\t\tawait t.onInputDelta?.(opts)\n\t}\n\n\treturn tool<INPUT, OUTPUT>({ ...t, onInputDelta, execute })\n}\n", "import { tool } from \"ai\"\nimport type { ToolTraceContext } from \"app/ai/raindrop/agentStreamTrace.ts\"\nimport { deepClone } from \"utils/deepClone.ts\"\nimport { z } from \"zod/v4\"\nimport type { AgentContext } from \"../context/AgentContext.ts\"\nimport { CHECKLIST_COMPLETE_TASK_TOOL_NAME, CHECKLIST_CREATE_TOOL_NAME } from \"./toolNames.ts\"\nimport { createUIConnectedTool } from \"./transformers/createUIConnectedTool.ts\"\n\nexport interface ChecklistTask {\n\tid: string\n\ttitle: string\n\tdescription?: string\n\tdependsOn?: string[]\n}\n\nexport interface ChecklistCreateInput {\n\ttasks: ChecklistTask[]\n}\n\nexport interface ChecklistCompleteTaskInput {\n\ttaskId: string\n}\n\nexport interface ChecklistState {\n\ttasks: ChecklistTask[]\n\tcompletedTaskIds: Set<string>\n}\n\nexport interface ChecklistRuntimeState {\n\treadonly tasks: readonly ChecklistTask[]\n\treadonly completedTaskIds: readonly string[]\n}\n\nexport interface ChecklistStore {\n\tstate: ChecklistState\n\tcreate: () => void\n\trestore: (runtimeState: ChecklistRuntimeState | undefined) => void\n\tgetRuntimeState: () => ChecklistRuntimeState | undefined\n}\n\ninterface ChecklistProgressResponse {\n\tcompletedTaskIds: string[]\n\tremainingTaskIds: string[]\n\tavailableTaskIds: string[]\n\tnextTaskId: string | null\n\terror?: string\n\tchecklistUnchanged?: true\n}\n\nexport interface ChecklistCreateResponse extends ChecklistProgressResponse {\n\ttasks: ChecklistTask[]\n}\n\nexport interface ChecklistCompleteTaskResponse extends ChecklistProgressResponse {\n\tcompletedTaskId?: string\n}\n\nconst checklistTaskSchema: z.ZodType<ChecklistTask> = z.object({\n\tid: z.string().describe(\"Short slug id, e.g. opening, nav-base, responsive-pass.\"),\n\ttitle: z\n\t\t.string()\n\t\t.describe(\"Very short task title for internal tracking, e.g. Nav base, Carousel interactions, Responsive pass.\"),\n\tdescription: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Optional task-local note with the exact scope, constraints, and non-goals for this task.\"),\n\tdependsOn: z\n\t\t.array(z.string())\n\t\t.optional()\n\t\t.describe(\"Task ids that must be completed first. Use only for true constraints, not preferred ordering.\"),\n})\n\nconst ChecklistCreateInputSchema: z.ZodType<ChecklistCreateInput> = z.object({\n\ttasks: z\n\t\t.array(checklistTaskSchema)\n\t\t.describe(\n\t\t\t\"Small focused tasks, usually split by analysis need, visible section, component, breakpoint, or variant.\",\n\t\t),\n})\n\nconst ChecklistCompleteTaskInputSchema: z.ZodType<ChecklistCompleteTaskInput> = z.object({\n\ttaskId: z.string().describe(\"The id of the completed task from the current checklist.\"),\n})\n\nconst checklistCreateDescription =\n\t\"Create a private checklist with dependencies to split large work into smaller focused chunks.\" as const\n\nconst checklistCompleteTaskDescription =\n\t\"Mark one task from the current private checklist complete before moving to another task.\" as const\n\nexport function createChecklistState(): ChecklistState {\n\treturn {\n\t\ttasks: [],\n\t\tcompletedTaskIds: new Set(),\n\t}\n}\n\nfunction cloneRuntimeTask(task: ChecklistTask): ChecklistTask {\n\treturn deepClone(task)\n}\n\nexport function cloneChecklistRuntimeState(\n\tstate: ChecklistRuntimeState | undefined,\n): ChecklistRuntimeState | undefined {\n\tif (!state) return\n\treturn {\n\t\ttasks: state.tasks.map(cloneRuntimeTask),\n\t\tcompletedTaskIds: [...state.completedTaskIds],\n\t}\n}\n\nfunction getChecklistRuntimeState(state: ChecklistState): ChecklistRuntimeState | undefined {\n\tif (state.tasks.length === 0) return\n\treturn {\n\t\ttasks: state.tasks.map(cloneRuntimeTask),\n\t\tcompletedTaskIds: getCompletedTaskIds(state),\n\t}\n}\n\nfunction createChecklistStateFromRuntime(runtimeState: ChecklistRuntimeState | undefined): ChecklistState {\n\tif (!runtimeState) return createChecklistState()\n\tconst tasks = runtimeState.tasks.map(normalizeTask)\n\tif (validateTaskGraph(tasks)) return createChecklistState()\n\n\tconst taskIds = new Set(tasks.map(task => task.id))\n\tconst completedTaskIds = new Set(runtimeState.completedTaskIds.filter(taskId => taskIds.has(taskId)))\n\treturn { tasks, completedTaskIds }\n}\n\nexport function createChecklistStore(): ChecklistStore {\n\tlet state = createChecklistState()\n\treturn {\n\t\tget state() {\n\t\t\treturn state\n\t\t},\n\t\tset state(nextState) {\n\t\t\tstate = nextState\n\t\t},\n\t\tcreate() {\n\t\t\tstate = createChecklistState()\n\t\t},\n\t\trestore(runtimeState) {\n\t\t\tstate = createChecklistStateFromRuntime(runtimeState)\n\t\t},\n\t\tgetRuntimeState() {\n\t\t\treturn getChecklistRuntimeState(state)\n\t\t},\n\t}\n}\n\nfunction normalizeTask(task: ChecklistTask): ChecklistTask {\n\tconst id = task.id.trim()\n\tconst title = task.title.trim()\n\tconst description = task.description?.trim()\n\tconst dependsOn = task.dependsOn?.map(dependency => dependency.trim())\n\treturn {\n\t\tid,\n\t\ttitle,\n\t\t...(description ? { description } : {}),\n\t\t...(dependsOn && dependsOn.length > 0 ? { dependsOn } : {}),\n\t}\n}\n\nfunction getCompletedTaskIds(state: ChecklistState): string[] {\n\treturn state.tasks.reduce<string[]>((completedTaskIds, task) => {\n\t\tif (state.completedTaskIds.has(task.id)) completedTaskIds.push(task.id)\n\t\treturn completedTaskIds\n\t}, [])\n}\n\nfunction toProgressResponse(state: ChecklistState, error?: string): ChecklistProgressResponse {\n\tconst completedTaskIds: string[] = []\n\tconst remainingTaskIds: string[] = []\n\tconst availableTaskIds: string[] = []\n\tfor (const task of state.tasks) {\n\t\tif (state.completedTaskIds.has(task.id)) {\n\t\t\tcompletedTaskIds.push(task.id)\n\t\t\tcontinue\n\t\t}\n\t\tremainingTaskIds.push(task.id)\n\t\tif (areDependenciesComplete(state, task)) availableTaskIds.push(task.id)\n\t}\n\n\treturn {\n\t\tcompletedTaskIds,\n\t\tremainingTaskIds,\n\t\tavailableTaskIds,\n\t\tnextTaskId: availableTaskIds[0] ?? null,\n\t\t...(error ? { error } : {}),\n\t}\n}\n\nfunction toChecklistCreateResponse(state: ChecklistState, error?: string): ChecklistCreateResponse {\n\treturn {\n\t\ttasks: state.tasks,\n\t\t...toProgressResponse(state, error),\n\t}\n}\n\nfunction toRejectedChecklistCreateResponse(error: string): ChecklistCreateResponse {\n\treturn {\n\t\ttasks: [],\n\t\tcompletedTaskIds: [],\n\t\tremainingTaskIds: [],\n\t\tavailableTaskIds: [],\n\t\tnextTaskId: null,\n\t\terror,\n\t\tchecklistUnchanged: true,\n\t}\n}\n\nfunction areDependenciesComplete(state: ChecklistState, task: ChecklistTask): boolean {\n\treturn task.dependsOn?.every(taskId => state.completedTaskIds.has(taskId)) ?? true\n}\n\nfunction validateTaskGraph(tasks: readonly ChecklistTask[]): string | undefined {\n\tif (tasks.length === 0) return \"A checklist requires at least one task.\"\n\n\tconst taskIds = new Set<string>()\n\tfor (const task of tasks) {\n\t\tif (!task.id) return \"Every task needs a non-empty id.\"\n\t\tif (!task.title) return `Task ${task.id} needs a non-empty title.`\n\t\tif (taskIds.has(task.id)) return `Task ids must be unique. Duplicate id: ${task.id}.`\n\t\ttaskIds.add(task.id)\n\t}\n\n\tfor (const task of tasks) {\n\t\tfor (const dependencyId of task.dependsOn ?? []) {\n\t\t\tif (dependencyId === task.id) return `Task ${task.id} cannot depend on itself.`\n\t\t\tif (!taskIds.has(dependencyId)) return `Task ${task.id} depends on an unknown task: ${dependencyId}.`\n\t\t}\n\t}\n\n\tconst cycle = findTaskCycle(tasks)\n\tif (cycle) return `Task dependencies cannot contain cycles: ${cycle.join(\" -> \")}.`\n}\n\nfunction findTaskCycle(tasks: readonly ChecklistTask[]): string[] | undefined {\n\tconst tasksById = new Map(tasks.map(task => [task.id, task]))\n\tconst states = new Map<string, \"visiting\" | \"visited\">()\n\n\tfunction visit(taskId: string, path: string[]): string[] | undefined {\n\t\tconst state = states.get(taskId)\n\t\tif (state === \"visited\") return undefined\n\t\tif (state === \"visiting\") {\n\t\t\tconst cycleStart = path.indexOf(taskId)\n\t\t\treturn path.slice(cycleStart)\n\t\t}\n\n\t\tconst task = tasksById.get(taskId)\n\t\tif (!task) return undefined\n\n\t\tstates.set(taskId, \"visiting\")\n\t\tfor (const dependencyId of task.dependsOn ?? []) {\n\t\t\tconst cycle = visit(dependencyId, path.concat(dependencyId))\n\t\t\tif (cycle) return cycle\n\t\t}\n\t\tstates.set(taskId, \"visited\")\n\t\treturn undefined\n\t}\n\n\tfor (const task of tasks) {\n\t\tconst cycle = visit(task.id, [task.id])\n\t\tif (cycle) return cycle\n\t}\n\treturn undefined\n}\n\nfunction createChecklist(store: ChecklistStore, input: ChecklistCreateInput): ChecklistCreateResponse {\n\tconst tasks = input.tasks.map(normalizeTask)\n\tconst error = validateTaskGraph(tasks)\n\tif (error) return toRejectedChecklistCreateResponse(error)\n\n\tstore.state = { tasks, completedTaskIds: new Set() }\n\treturn toChecklistCreateResponse(store.state)\n}\n\nfunction completeChecklistTask(\n\tstate: ChecklistState,\n\tinput: ChecklistCompleteTaskInput,\n): ChecklistCompleteTaskResponse {\n\tconst taskId = input.taskId.trim()\n\tif (state.tasks.length === 0) return toProgressResponse(state, \"Create a checklist before completing tasks.\")\n\tif (!taskId) return toProgressResponse(state, \"taskId must be non-empty.\")\n\n\tconst task = state.tasks.find(candidate => candidate.id === taskId)\n\tif (!task) return toProgressResponse(state, `Unknown task: ${taskId}.`)\n\tif (state.completedTaskIds.has(taskId)) {\n\t\treturn toProgressResponse(state, `Task is already complete: ${taskId}.`)\n\t}\n\n\tconst incompleteDependencies = (task.dependsOn ?? []).filter(\n\t\tdependencyId => !state.completedTaskIds.has(dependencyId),\n\t)\n\tif (incompleteDependencies.length > 0) {\n\t\treturn toProgressResponse(\n\t\t\tstate,\n\t\t\t`Task ${taskId} cannot be completed before its dependencies: ${incompleteDependencies.join(\", \")}.`,\n\t\t)\n\t}\n\n\tstate.completedTaskIds.add(taskId)\n\treturn { completedTaskId: taskId, ...toProgressResponse(state) }\n}\n\nexport function createChecklistCreateTool(\n\tctx: AgentContext,\n\tsynchronize: () => Promise<void>,\n\t{\n\t\ttraceContextProvider,\n\t\tabortSignal,\n\t}: {\n\t\ttraceContextProvider?: () => ToolTraceContext | undefined\n\t\tabortSignal?: AbortSignal\n\t} = {},\n) {\n\treturn createUIConnectedTool(\n\t\t{\n\t\t\tdescription: checklistCreateDescription,\n\t\t\tinputSchema: ChecklistCreateInputSchema,\n\t\t\texecute: input => {\n\t\t\t\tif (abortSignal?.aborted) return toChecklistCreateResponse(ctx.checklist.state, \"Aborted.\")\n\t\t\t\treturn createChecklist(ctx.checklist, input)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tsynchronize,\n\t\t\tonPart: undefined,\n\t\t\ttoolName: CHECKLIST_CREATE_TOOL_NAME,\n\t\t\ttracing: {\n\t\t\t\tgetTraceContext: () => traceContextProvider?.(),\n\t\t\t\tgetTraceInput: input => input,\n\t\t\t\tgetTraceOutput: output => output,\n\t\t\t},\n\t\t},\n\t)\n}\n\nexport function createChecklistCompleteTaskTool(\n\tctx: AgentContext,\n\tsynchronize: () => Promise<void>,\n\t{\n\t\ttraceContextProvider,\n\t\tabortSignal,\n\t}: {\n\t\ttraceContextProvider?: () => ToolTraceContext | undefined\n\t\tabortSignal?: AbortSignal\n\t} = {},\n) {\n\treturn createUIConnectedTool(\n\t\t{\n\t\t\tdescription: checklistCompleteTaskDescription,\n\t\t\tinputSchema: ChecklistCompleteTaskInputSchema,\n\t\t\texecute: input => {\n\t\t\t\tif (abortSignal?.aborted) return toProgressResponse(ctx.checklist.state, \"Aborted.\")\n\t\t\t\treturn completeChecklistTask(ctx.checklist.state, input)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tsynchronize,\n\t\t\tonPart: undefined,\n\t\t\ttoolName: CHECKLIST_COMPLETE_TASK_TOOL_NAME,\n\t\t\ttracing: {\n\t\t\t\tgetTraceContext: () => traceContextProvider?.(),\n\t\t\t\tgetTraceInput: input => input,\n\t\t\t\tgetTraceOutput: output => output,\n\t\t\t},\n\t\t},\n\t)\n}\n\n/** Used by the Agent evals. */\nexport function createChecklistCreateToolDefinition() {\n\treturn tool({\n\t\tdescription: checklistCreateDescription,\n\t\tinputSchema: ChecklistCreateInputSchema,\n\t})\n}\n\n/** Used by the Agent evals. */\nexport function createChecklistCompleteTaskToolDefinition() {\n\treturn tool({\n\t\tdescription: checklistCompleteTaskDescription,\n\t\tinputSchema: ChecklistCompleteTaskInputSchema,\n\t})\n}\n\nexport const testing = {\n\tcompleteChecklistTask,\n\tcreateChecklist,\n\tcreateChecklistState,\n\tcreateChecklistStore,\n\tgetChecklistRuntimeState,\n\tvalidateTaskGraph,\n}\n", "import type { LocalModuleId } from \"@framerjs/shared\"\nimport type { ScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { isSmartComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport { join } from \"utils/join.ts\"\nimport { ComponentNodeClass } from \"../dsl.ts\"\nimport { getNameValue } from \"../traits/name.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\n\nfunction getScopeType(scope: ScopeNode): string {\n\treturn isSmartComponentNode(scope) ? ComponentNodeClass : scope.__class\n}\n\nexport interface ActiveCodeFile {\n\tid: LocalModuleId\n\tpath: string\n\tcomponentNames: readonly string[]\n}\n\ntype ActiveViewContext = { type: \"scope\"; scope: ScopeNode } | { type: \"codeFile\"; codeFile: ActiveCodeFile }\n\nfunction isActiveCodeFile(view: ActiveViewContext): view is { type: \"codeFile\"; codeFile: ActiveCodeFile } {\n\treturn view.type === \"codeFile\"\n}\n\n/**\n * Creates a message with additional context that may be relevant to the agent. Sent once at the\n * start of the conversation.\n */\nexport function createAdditionalContextMessage(userName: string | undefined): string | undefined {\n\tif (!userName) return\n\n\tconst currentDate = new Date().toLocaleDateString(undefined, {\n\t\tyear: \"numeric\",\n\t\tmonth: \"long\",\n\t\tday: \"numeric\",\n\t})\n\n\treturn join.lines(\n\t\t`<${metadataTags.additionalContext}>`,\n\t\tJSON.stringify({ userName, currentDate }),\n\t\t`</${metadataTags.additionalContext}>`,\n\t)\n}\n\n/**\n * Creates a context message for the user's active view (canvas scope or code file).\n * Re-sent each turn when the active view changes so the agent always has fresh info.\n */\nexport function createActiveViewContextMessage(treeStore: TreeStore, view: ActiveViewContext): string {\n\tif (isActiveCodeFile(view)) {\n\t\treturn join.lines(\n\t\t\t`<${metadataTags.additionalContext}>`,\n\t\t\tJSON.stringify({\n\t\t\t\tscope: {\n\t\t\t\t\tid: view.codeFile.id,\n\t\t\t\t\ttype: \"CodeFile\",\n\t\t\t\t\tname: view.codeFile.componentNames[0] ?? view.codeFile.path,\n\t\t\t\t\tpath: view.codeFile.path,\n\t\t\t\t\tcomponents: view.codeFile.componentNames,\n\t\t\t\t\tcontext:\n\t\t\t\t\t\t'This is the code file the user is currently viewing in the code editor. Treat references like \"this\", \"it\", \"this component\", and \"here\" as this code file unless the user clearly points elsewhere.',\n\t\t\t\t},\n\t\t\t}),\n\t\t\t`</${metadataTags.additionalContext}>`,\n\t\t)\n\t}\n\n\tconst tree = treeStore.getDataTreeOrPartialTree()\n\tconst scopeType = getScopeType(view.scope)\n\tconst scopeName = getNameValue(tree, view.scope)\n\n\treturn join.lines(\n\t\t`<${metadataTags.additionalContext}>`,\n\t\tJSON.stringify({\n\t\t\tscope: {\n\t\t\t\tid: view.scope.id,\n\t\t\t\ttype: scopeType,\n\t\t\t\tname: scopeName,\n\t\t\t\tcontext:\n\t\t\t\t\t'This is the page or component the user is currently viewing. Treat references like \"here\", \"this page\", and \"current page\" as this scope unless the user clearly points elsewhere.',\n\t\t\t},\n\t\t}),\n\t\t`</${metadataTags.additionalContext}>`,\n\t)\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { assert, type ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { CmsTagSegment } from \"app/agent/editor/agentInputSchema.ts\"\nimport type {\n\tCanvasNode,\n\tCanvasTree,\n\tCollectionNode,\n\tNodeID,\n\tCollectionItemNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport {\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport {\n\ttype VariableOrDivider,\n\tcontrolDescriptionFromVariable,\n\tisVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport type { ControlProps } from \"document/models/controlProps/ControlProp.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport type { ControlDescription } from \"library/render/types/PropertyControls.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { getCollectionIdForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { join } from \"utils/join.ts\"\nimport { slugifyPathVariable } from \"utils/pathVariables.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { serializeCollectionsForAgent } from \"../tools/collectionSchema.ts\"\nimport type { AgentContext } from \"./AgentContext.ts\"\nimport { type ControlsHandle, getControlsHandle } from \"./controlDefinitions.ts\"\nimport { type DynamicValues, getCollectionItemIdVariableLlmId, variableTypeToControlType } from \"./dynamicValues.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\nimport { hydrateAndSerializeRichText } from \"./richtext/serialize.ts\"\nimport { createCollectionItemControlPropHandle } from \"./richtext/targets.ts\"\n\ninterface CollectionEntry {\n\tcontrols: ControlsHandle\n\tvariables: readonly VariableOrDivider[]\n}\n\nexport interface CmsSelectionGroupByCollection {\n\treadonly collectionId: NodeID\n\treadonly collectionItemIds: readonly NodeID[]\n}\n\ninterface CollectionItemForPrompt {\n\tid: NodeID\n\tcollection: string | undefined\n\tdata: Record<string, unknown>\n}\n\nconst CMS_SELECTION_ITEM_THRESHOLD = 10\n\nexport class Collections {\n\tprivate readonly llmVariableIdsByCollectionId = new Map<NodeID, Map<string, string>>()\n\n\tconstructor(\n\t\tprivate readonly treeStore?: TreeStore,\n\t\tprivate readonly componentLoader?: AnyComponentLoader,\n\t\tprivate readonly dynamicValues?: DynamicValues,\n\t) {}\n\n\tstatic async fromTree(\n\t\ttreeStore: TreeStore,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdynamicValues: DynamicValues,\n\t): Promise<Collections> {\n\t\tconst collections = new Collections(treeStore, componentLoader, dynamicValues)\n\t\tconst contentManagementNode = await getContentManagementNode(treeStore.tree)?.load()\n\t\tfor (const collection of contentManagementNode?.children ?? []) {\n\t\t\tcollections.registerVariables(collection.id)\n\t\t}\n\t\treturn collections\n\t}\n\n\tforId(id: NodeID): CollectionEntry | undefined {\n\t\tconst tree = this.treeStore?.tree\n\t\tif (!tree || !this.componentLoader) return undefined\n\t\tconst node = tree.getNodeWithTrait(id, isCollectionNode)\n\t\tif (!node) return undefined\n\t\treturn toEntry(tree, this.componentLoader, node.variables, this.llmVariableIdsByCollectionId.get(id))\n\t}\n\n\tcollectionIdFromName(name: string | undefined): NodeID | undefined {\n\t\tif (!name) return undefined\n\n\t\tassert(this.treeStore, \"Must have a tree\")\n\t\tconst contentManagementNode = getContentManagementNode(this.treeStore.tree)?.loaded\n\n\t\tif (!contentManagementNode) return undefined\n\n\t\treturn contentManagementNode.children.find(collection => collection.resolveValue(\"name\") === name)?.id\n\t}\n\n\tcollectionNameFromInstanceIdentifier(identifier: ModuleExportIdentifierString | undefined): string | undefined {\n\t\tif (!identifier) return undefined\n\n\t\tconst collectionId = getCollectionIdForIdentifier(identifier)\n\t\tif (!collectionId) return undefined\n\n\t\tconst node = this.treeStore?.tree?.getNodeWithTrait(collectionId, isCollectionNode)\n\t\tif (!node) return undefined\n\n\t\tconst name = node.resolveValue(\"name\")\n\t\tassert(name, \"Collection must have a name\")\n\n\t\treturn name\n\t}\n\n\t*collectionsForCanvasSelection(\n\t\tselectedNodes: readonly CanvasNode[],\n\t): Generator<{ collectionId: NodeID; node: CollectionNode }> {\n\t\tconst seen = new Set<NodeID>()\n\t\tconst tree = this.treeStore?.tree\n\n\t\tconst getCollectionForNode = (canvasNode: CanvasNode) => {\n\t\t\tif (!hasCollectionDataSource(canvasNode)) return\n\t\t\tconst collectionId = getCollectionIdForIdentifier(canvasNode.dataIdentifier)\n\t\t\tif (!collectionId || seen.has(collectionId)) return\n\t\t\tseen.add(collectionId)\n\n\t\t\tconst collectionNode = tree?.getNodeWithTrait(collectionId, isCollectionNode)\n\t\t\tif (!collectionNode) return\n\n\t\t\treturn { collectionId, node: collectionNode }\n\t\t}\n\n\t\tfor (const node of selectedNodes) {\n\t\t\tconst collection = getCollectionForNode(node)\n\t\t\tif (collection) yield collection\n\t\t\tfor (const ancestor of node.ancestors()) {\n\t\t\t\tconst ancestorCollection = getCollectionForNode(ancestor)\n\t\t\t\tif (ancestorCollection) yield ancestorCollection\n\t\t\t}\n\t\t}\n\t}\n\n\tasync selectedCollectionsPromptMessage(\n\t\tselectedCanvasNodes: readonly CanvasNode[],\n\t\tcmsSelectionGroupsByCollection: readonly CmsSelectionGroupByCollection[],\n\t\tctx: AgentContext,\n\t): Promise<string | undefined> {\n\t\tconst tree = this.treeStore?.tree\n\t\tassert(tree, \"selectedCollectionsPromptMessage needs a tree\")\n\n\t\tconst collectionNodesById = new Map<NodeID, CollectionNode>()\n\n\t\tfor (const { collectionId, node } of this.collectionsForCanvasSelection(selectedCanvasNodes)) {\n\t\t\tcollectionNodesById.set(collectionId, node)\n\t\t}\n\n\t\tfor (const cmsSelectionGroup of cmsSelectionGroupsByCollection) {\n\t\t\tconst collectionNode = tree.getNodeWithTrait(cmsSelectionGroup.collectionId, isCollectionNode)\n\t\t\tif (!collectionNode) continue\n\t\t\tcollectionNodesById.set(cmsSelectionGroup.collectionId, collectionNode)\n\t\t}\n\t\tif (collectionNodesById.size === 0) return undefined\n\n\t\tconst entries = await serializeCollectionsForAgent(tree, [...collectionNodesById.values()], ctx)\n\n\t\treturn join.lines(`<${metadataTags.collections}>`, JSON.stringify(entries), `</${metadataTags.collections}>`)\n\t}\n\n\tasync cmsSelectionCollectionItemsForPrompt(\n\t\tcmsSelectionGroupsByCollection: readonly CmsSelectionGroupByCollection[],\n\t\tctx: AgentContext,\n\t): Promise<CollectionItemForPrompt[]> {\n\t\tconst tree = this.treeStore?.tree\n\t\tif (!tree || !this.componentLoader) return []\n\n\t\tconst collectionItemsForPrompt: CollectionItemForPrompt[] = []\n\t\tfor (const cmsSelectionGroup of cmsSelectionGroupsByCollection) {\n\t\t\tconst collectionNode = tree.getNodeWithTrait(cmsSelectionGroup.collectionId, isCollectionNode)\n\t\t\tif (!collectionNode) continue\n\n\t\t\tconst collectionEntry = toEntry(\n\t\t\t\ttree,\n\t\t\t\tthis.componentLoader,\n\t\t\t\tcollectionNode.variables,\n\t\t\t\tthis.llmVariableIdsByCollectionId.get(cmsSelectionGroup.collectionId),\n\t\t\t)\n\n\t\t\tfor (const itemId of cmsSelectionGroup.collectionItemIds) {\n\t\t\t\tif (tree.getParent(itemId)?.id !== collectionNode.id) continue\n\t\t\t\tconst itemNode = tree.getNode(itemId)\n\t\t\t\tif (!itemNode || !isCollectionItemNode(itemNode)) continue\n\n\t\t\t\tcollectionItemsForPrompt.push({\n\t\t\t\t\tid: itemNode.id,\n\t\t\t\t\tcollection: collectionNode.resolveValue(\"name\") ?? undefined,\n\t\t\t\t\tdata: await serializeControlPropsForAgent(\n\t\t\t\t\t\tcollectionEntry.controls,\n\t\t\t\t\t\titemNode.getControlProps(),\n\t\t\t\t\t\titemNode,\n\t\t\t\t\t\tctx,\n\t\t\t\t\t),\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturn collectionItemsForPrompt\n\t}\n\n\tasync buildContextPromptMessages(\n\t\tselectedCanvasNodes: readonly CanvasNode[],\n\t\tcmsSelectionGroupsByCollection: readonly CmsSelectionGroupByCollection[],\n\t\tctx: AgentContext,\n\t): Promise<string[]> {\n\t\tconst messages: string[] = []\n\n\t\tconst collectionsPromptMessage = await this.selectedCollectionsPromptMessage(\n\t\t\tselectedCanvasNodes,\n\t\t\tcmsSelectionGroupsByCollection,\n\t\t\tctx,\n\t\t)\n\t\tif (collectionsPromptMessage) {\n\t\t\tmessages.push(collectionsPromptMessage)\n\t\t}\n\n\t\tconst cmsSelectedItems = shouldEmbedCmsSelectionCollectionItems(cmsSelectionGroupsByCollection)\n\t\t\t? await this.cmsSelectionCollectionItemsForPrompt(cmsSelectionGroupsByCollection, ctx)\n\t\t\t: []\n\t\tconst scopeItem = await this.scopeCollectionItemForPrompt(ctx)\n\n\t\tconst itemsToEmbed: CollectionItemForPrompt[] = []\n\t\tif (scopeItem) itemsToEmbed.push(scopeItem)\n\t\tfor (const item of cmsSelectedItems) {\n\t\t\tif (item.id === scopeItem?.id) continue\n\t\t\titemsToEmbed.push(item)\n\t\t}\n\n\t\tconst tag = metadataTags.collectionItem\n\t\tfor (const item of itemsToEmbed) {\n\t\t\tmessages.push(join.lines(`<${tag}>`, JSON.stringify(item), `</${tag}>`))\n\t\t}\n\n\t\treturn messages\n\t}\n\n\tasync scopeCollectionItemForPrompt(ctx: AgentContext): Promise<CollectionItemForPrompt | undefined> {\n\t\tconst scopeCollectionItem = this.getScopeCollectionItem(ctx)\n\t\tif (!scopeCollectionItem) return undefined\n\n\t\tconst { collectionId, collectionNode, itemNode } = scopeCollectionItem\n\n\t\tconst tree = this.treeStore?.tree\n\t\tif (!tree || !this.componentLoader) return undefined\n\n\t\tconst collectionEntry = toEntry(\n\t\t\ttree,\n\t\t\tthis.componentLoader,\n\t\t\tcollectionNode.variables,\n\t\t\tthis.llmVariableIdsByCollectionId.get(collectionId),\n\t\t)\n\n\t\treturn {\n\t\t\tid: itemNode.id,\n\t\t\tcollection: collectionNode.resolveValue(\"name\") ?? undefined,\n\t\t\tdata: await serializeControlPropsForAgent(collectionEntry.controls, itemNode.getControlProps(), itemNode, ctx),\n\t\t}\n\t}\n\n\tcollectionContextVersionKey(cmsSelectionGroupsByCollection: readonly CmsSelectionGroupByCollection[]): string {\n\t\t// TODO this accounts only for changes in selection, not for changes in the collection items themselves\n\t\t// so might be improved\n\t\treturn JSON.stringify({\n\t\t\tcmsSelectionGroupsByCollection,\n\t\t\tembedCmsSelectionCollectionItems: shouldEmbedCmsSelectionCollectionItems(cmsSelectionGroupsByCollection),\n\t\t})\n\t}\n\n\tremove(id: NodeID) {\n\t\tthis.llmVariableIdsByCollectionId.delete(id)\n\t}\n\n\tupsertVariable(collectionId: NodeID, variable: VariableOrDivider, llmVariableId?: string) {\n\t\tif (!variableTypeToControlType(variable.type)) return\n\n\t\tconst controlName = slugifyPathVariable(variable.name)\n\t\tif (llmVariableId && llmVariableId !== controlName) {\n\t\t\tlet aliases = this.llmVariableIdsByCollectionId.get(collectionId)\n\t\t\tif (!aliases) {\n\t\t\t\taliases = new Map()\n\t\t\t\tthis.llmVariableIdsByCollectionId.set(collectionId, aliases)\n\t\t\t}\n\t\t\taliases.set(llmVariableId, variable.id)\n\t\t}\n\t}\n\n\tregisterVariables(collectionId: NodeID): void {\n\t\tassert(this.dynamicValues, \"Missing DynamicValues from context\")\n\n\t\tconst entry = this.forId(collectionId)\n\t\tif (!entry) return\n\n\t\tfor (const variable of entry.variables) {\n\t\t\tif (!variableTypeToControlType(variable.type)) continue\n\t\t\tthis.dynamicValues.add(collectionId, variable.id, variable)\n\t\t}\n\n\t\tconst itemIdLlmId = getCollectionItemIdVariableLlmId(collectionId)\n\t\tthis.dynamicValues.add(collectionId, itemIdLlmId, {\n\t\t\ttype: ControlType.String,\n\t\t\tid: itemIdLlmId,\n\t\t\tname: \"id\",\n\t\t\tinitialValue: \"\",\n\t\t})\n\t}\n\n\tremoveVariable(collectionId: NodeID, variableId: string) {\n\t\tconst aliases = this.llmVariableIdsByCollectionId.get(collectionId)\n\t\tif (!aliases) return\n\n\t\tfor (const [alias, id] of aliases) {\n\t\t\tif (id === variableId) {\n\t\t\t\taliases.delete(alias)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tgroupCmsSelectionsByCollection(cmsSelections: readonly CmsTagSegment[]): CmsSelectionGroupByCollection[] {\n\t\tconst collectionItemIdsByCollectionId = new Map<NodeID, Set<NodeID>>()\n\n\t\tfor (const cmsSelection of cmsSelections) {\n\t\t\tif (!cmsSelection.collectionId) continue\n\n\t\t\tlet collectionItemIds = collectionItemIdsByCollectionId.get(cmsSelection.collectionId)\n\t\t\tif (!collectionItemIds) {\n\t\t\t\tcollectionItemIds = new Set()\n\t\t\t\tcollectionItemIdsByCollectionId.set(cmsSelection.collectionId, collectionItemIds)\n\t\t\t}\n\t\t\tconst collectionItemIdsForSelection = cmsSelection.type === \"cmsSelection\" ? cmsSelection.collectionItemIds : []\n\t\t\tfor (const itemId of collectionItemIdsForSelection) {\n\t\t\t\tcollectionItemIds.add(itemId)\n\t\t\t}\n\t\t}\n\n\t\treturn [...collectionItemIdsByCollectionId.entries()].map(([collectionId, collectionItemIds]) => ({\n\t\t\tcollectionId,\n\t\t\tcollectionItemIds: [...collectionItemIds],\n\t\t}))\n\t}\n\n\tprivate getScopeCollectionItem(ctx: AgentContext):\n\t\t| {\n\t\t\t\tcollectionId: NodeID\n\t\t\t\tcollectionNode: CollectionNode\n\t\t\t\titemNode: CollectionItemNode\n\t\t  }\n\t\t| undefined {\n\t\tif (!isWebPageNode(ctx.scopeNode) || !ctx.scopeNode.dataIdentifier) return undefined\n\n\t\tconst collectionId = getCollectionIdForIdentifier(ctx.scopeNode.dataIdentifier)\n\t\tif (!collectionId) return undefined\n\n\t\tconst collectionNode = this.treeStore?.tree?.getNodeWithTrait(collectionId, isCollectionNode)\n\t\tif (!collectionNode) return undefined\n\n\t\tconst openedItemId =\n\t\t\tctx.hooks.getEngine()?.stores.scopeStore.getSelectedCollectionItemForWebPage(ctx.scopeNode) ??\n\t\t\tcollectionNode.getUnsortedChildren()[0]?.id\n\t\tif (!openedItemId) return undefined\n\n\t\tconst itemNode = this.treeStore?.tree?.getNode(openedItemId)\n\t\tif (!itemNode || !isCollectionItemNode(itemNode)) return undefined\n\n\t\treturn { collectionId, collectionNode, itemNode }\n\t}\n}\n\nfunction shouldEmbedCmsSelectionCollectionItems(\n\tcmsSelectionGroupsByCollection: readonly CmsSelectionGroupByCollection[],\n): boolean {\n\tconst uniqueItemIds = new Set<NodeID>()\n\tfor (const selectionGroup of cmsSelectionGroupsByCollection) {\n\t\tfor (const itemId of selectionGroup.collectionItemIds) {\n\t\t\tuniqueItemIds.add(itemId)\n\t\t\tif (uniqueItemIds.size > CMS_SELECTION_ITEM_THRESHOLD) return false\n\t\t}\n\t}\n\treturn true\n}\n\nfunction toEntry(\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tvariables: readonly VariableOrDivider[],\n\tllmVariableIdsByCollectionId?: Map<string, string>,\n): CollectionEntry {\n\tconst controlPropKeysByControlName = new Map<string, string>()\n\tconst controlPropNamesByKeys = new Map<string, string>()\n\tconst properties: Record<string, ControlDescription | undefined> = {}\n\n\tfor (const variable of variables) {\n\t\tif (!isVariableDefinition(variable)) continue\n\t\tconst description = controlDescriptionFromVariable(tree, componentLoader, variable, ScopeType.ContentManagement)\n\t\tif (!description) continue\n\n\t\t// Control names should be unique, as they are deduplicated with `uniqueName`\n\t\t// However, it's possible that two different collection names would normalize to the same value.\n\t\t// (e.g. `Blog Posts` and `Blog_Posts`). We don't deem it worth it to handle this edge case.\n\t\tconst controlName = slugifyPathVariable(variable.name)\n\t\tcontrolPropKeysByControlName.set(controlName, variable.id)\n\t\tcontrolPropNamesByKeys.set(variable.id, controlName)\n\t\tproperties[variable.id] = description\n\t}\n\n\tif (llmVariableIdsByCollectionId) {\n\t\tfor (const [alias, variableId] of llmVariableIdsByCollectionId) {\n\t\t\tcontrolPropKeysByControlName.set(alias, variableId)\n\t\t}\n\t}\n\n\treturn {\n\t\tcontrols: getControlsHandle(\n\t\t\t{\n\t\t\t\tcontrolPropKeysByControlName,\n\t\t\t\tcontrolPropNamesByKeys,\n\t\t\t},\n\t\t\tproperties,\n\t\t),\n\t\tvariables,\n\t}\n}\n\nasync function serializeControlPropsForAgent(\n\tcontrols: ControlsHandle,\n\tcontrolProps: ControlProps,\n\titemNode: CollectionItemNode,\n\tctx: AgentContext,\n): Promise<Record<string, unknown>> {\n\tconst data: Record<string, unknown> = {}\n\n\tfor (const [variableId, controlProp] of Object.entries(controlProps)) {\n\t\tconst readableName = controls.getControlTitle(variableId)\n\t\tif (!readableName || !controlProp) continue\n\n\t\tif (controlProp.type === ControlType.RichText && isString(controlProp.value)) {\n\t\t\tconst handle = createCollectionItemControlPropHandle(itemNode, variableId)\n\t\t\tdata[readableName] = await hydrateAndSerializeRichText(handle, ctx)\n\t\t} else {\n\t\t\tdata[readableName] = controlProp.value\n\t\t}\n\t}\n\n\treturn data\n}\n", "import {\n\tisEditorComponentLoader,\n\ttype AnyComponentLoader,\n\ttype VerifiedControlDescription,\n} from \"@framerjs/framer-runtime\"\nimport { hasDefaultAssetReference, hasVekterDefault, isDefaultResponsiveImage } from \"@framerjs/framer-runtime/sandbox\"\nimport {\n\tasGlobalId,\n\tassert,\n\tassertNever,\n\tgetLogger,\n\tinvertMap,\n\tisExternalModuleIdentifier,\n\tisModuleExportIdentifier,\n\ttype LocalModuleIdentifier,\n\ttype ModuleExportIdentifierString,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { waitForLoadingComponentsWithTimeout } from \"code-generation/utils/waitForLoadingComponentsWithTimeout.ts\"\nimport type { AnyScopeNode, CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { cssCursors } from \"document/models/CanvasTree/traits/WithCursor.ts\"\nimport {\n\tcontrolDescriptionFromVariable,\n\ttype VariableControlDescription,\n\ttype VariableDefinition,\n\ttype WithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\ttype PrefixedControlPropKey,\n\tremoveControlPropKeyPrefix,\n\tisPrefixedControlPropKey,\n\tprefixControlPropKey,\n} from \"document/models/controlProps/controlPropKey.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport type { ScopeType } from \"document/utils/scopeType.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { type ControlDescription, ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport { toEventHandlerAttributeKey } from \"../eventHandlerKeys.ts\"\nimport { assetReferenceToURL, nullString } from \"../traits/helpers.ts\"\nimport { linkHrefDescription } from \"../traits/link.ts\"\nimport {\n\tboxShadowDescription,\n\tcolorDescription,\n\tpercentageDescription,\n\tpixelShorthandDescription,\n} from \"../traits/traitDescriptions.ts\"\nimport type { ComponentControl, EventHandlerControl } from \"./componentDefinition.ts\"\nimport type { BaseControlsDefinition } from \"./controlDefinitions.ts\"\nimport { buildControlDefinitionMappings, createUniqueControlName, getControlsHandle } from \"./controlDefinitions.ts\"\nimport type { DeferredOps } from \"./deferred.ts\"\nimport type { VectorSets } from \"./vectors.ts\"\n\nconst log = getLogger(\"ai:agents:moduleDefinitions\")\n\nexport type ModuleName = string\n\nexport interface ModuleControlsDefinition extends BaseControlsDefinition<ComponentControl> {\n\tsent?: boolean\n\tproperties: Record<string, ControlDescription | undefined>\n}\n\ninterface ForIdentifierOptions {\n\tdeferUntilLoaded?: boolean\n}\n\ninterface AsyncForIdentifierOptions {\n\twaitUntilLoaded?: boolean\n}\n\nexport interface ModuleDefinitionsJSON {\n\tdefinitions: Record<ModuleName, ModuleControlsDefinitionJSON>\n\tnamesByIdentifier: Record<ModuleExportIdentifierString, ModuleName>\n\tpropertiesByIdentifier: Record<ModuleExportIdentifierString, Record<string, ControlDescription | undefined>>\n}\n\ninterface ModuleControlsDefinitionJSON {\n\tcontrols: Record<string, ComponentControl | undefined>\n\tcontrolPropKeysByControlName: Record<string, string>\n}\n\nfunction isEventHandlerComponentControl(control: ComponentControl | undefined): control is EventHandlerControl {\n\treturn control?.type === ControlType.EventHandler\n}\n\nexport function addModuleName(\n\tnamesByIdentifier: Map<ModuleExportIdentifierString, ModuleName>,\n\tnames: Set<ModuleName>,\n\tidentifier: ModuleExportIdentifierString,\n\tname: ModuleName | undefined,\n): void {\n\tif (namesByIdentifier.has(identifier)) return\n\n\tconst moduleName = uniqueName(name || Dictionary.Component, names)\n\tnames.add(moduleName)\n\tnamesByIdentifier.set(identifier, moduleName)\n}\n\n// @TODO: Can the name be generated?\nexport function getNodeName(node: { name?: unknown }): ModuleName | undefined {\n\treturn typeof node.name === \"string\" && node.name ? node.name : undefined\n}\n\nfunction remapDefaultVariant(\n\toptions: (string | number | boolean | null)[],\n\toptionTitles: string[] | undefined,\n\tdefaultValue: string | number | boolean | null | undefined,\n) {\n\tif (!optionTitles) return defaultValue\n\n\tfor (let index = 0; index < options.length; index++) {\n\t\tconst element = options[index]\n\t\tif (!element) continue\n\t\tif (element === defaultValue) return optionTitles[index]\n\t}\n\n\treturn defaultValue\n}\n\nfunction getResponsiveImageDefaultValue(\n\tcontrol: Extract<VerifiedControlDescription, { type: ControlType.ResponsiveImage | ControlType.Image }>,\n): string | undefined {\n\tif (hasVekterDefault(control) && isDefaultResponsiveImage(control.__vekterDefault)) {\n\t\treturn assetReferenceToURL(control.__vekterDefault.assetReference)\n\t}\n\n\tif (hasDefaultAssetReference(control)) {\n\t\treturn assetReferenceToURL(control.__defaultAssetReference)\n\t}\n}\n\nfunction createIconComponentControl(\n\tsetModuleId: string,\n\tdefaultIdentifier: ModuleExportIdentifierString | undefined,\n\tvectorSets: VectorSets,\n\tid?: VariableDefinition[\"id\"],\n): ComponentControl | undefined {\n\tconst set = vectorSets.forModuleId(asGlobalId(setModuleId))\n\tif (!set) return\n\n\treturn {\n\t\ttype: \"icon\",\n\t\tset: set.name,\n\t\tdefaultValue: defaultIdentifier ? set.getName(defaultIdentifier) : undefined,\n\t\tid,\n\t}\n}\n\nfunction createModuleControlDefinition(\n\tprefixedTitle: PrefixedControlPropKey<string>,\n\tcontrol: VerifiedControlDescription,\n\tvectorSets: VectorSets,\n): ComponentControl | undefined {\n\tconst controlName = removeControlPropKeyPrefix(prefixedTitle)\n\n\tswitch (control.type) {\n\t\tcase ControlType.VectorSetItem: {\n\t\t\tconst defaultIdentifier = control.defaultValue?.identifier\n\t\t\treturn createIconComponentControl(\n\t\t\t\tcontrol.setModuleId,\n\t\t\t\tisModuleExportIdentifier(defaultIdentifier) ? defaultIdentifier : undefined,\n\t\t\t\tvectorSets,\n\t\t\t)\n\t\t}\n\t\tcase ControlType.Enum: {\n\t\t\treturn prefixedTitle === prefixControlPropKey(\"variant\")\n\t\t\t\t? {\n\t\t\t\t\t\ttype: ControlType.Enum,\n\t\t\t\t\t\toptions: control.optionTitles ?? control.options,\n\t\t\t\t\t\tdefaultValue: remapDefaultVariant(control.options, control.optionTitles, control.defaultValue),\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\ttype: ControlType.Enum,\n\t\t\t\t\t\toptions: control.options,\n\t\t\t\t\t\tdefaultValue: control.defaultValue,\n\t\t\t\t\t}\n\t\t}\n\t\tcase ControlType.Boolean:\n\t\tcase ControlType.String:\n\t\tcase ControlType.RichText:\n\t\tcase ControlType.Date:\n\t\tcase ControlType.TrackingId:\n\t\t\treturn { type: control.type, defaultValue: control.defaultValue }\n\t\tcase ControlType.EventHandler:\n\t\t\treturn { type: control.type, eventKey: toEventHandlerAttributeKey(controlName) }\n\t\tcase ControlType.Color:\n\t\t\treturn {\n\t\t\t\ttype: colorDescription,\n\t\t\t\tdefaultValue: control.defaultValue,\n\t\t\t}\n\t\tcase ControlType.Gap:\n\t\t\treturn {\n\t\t\t\ttype: \"number | ${number}px | ${number}px ${number}px\",\n\t\t\t\tdefaultValue: control.defaultValue,\n\t\t\t}\n\t\tcase ControlType.Padding:\n\t\t\treturn {\n\t\t\t\ttype: pixelShorthandDescription,\n\t\t\t\tdefaultValue: control.defaultValue,\n\t\t\t}\n\t\tcase ControlType.Number:\n\t\t\treturn { type: \"number\", defaultValue: control.defaultValue }\n\t\tcase ControlType.BorderRadius:\n\t\t\treturn {\n\t\t\t\ttype: `${pixelShorthandDescription} | ${percentageDescription}`,\n\t\t\t\tdefaultValue: control.defaultValue,\n\t\t\t}\n\t\tcase ControlType.Cursor:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Cursor,\n\t\t\t\toptions: cssCursors,\n\t\t\t\tdefaultValue: control.defaultValue,\n\t\t\t}\n\t\tcase ControlType.Image:\n\t\tcase ControlType.ResponsiveImage: {\n\t\t\t// Normalize deprecated image controls so the agent sees a single image control shape.\n\t\t\tconst defaultValue = getResponsiveImageDefaultValue(control)\n\t\t\treturn {\n\t\t\t\ttype: ControlType.ResponsiveImage,\n\t\t\t\t...(defaultValue && { defaultValue }),\n\t\t\t}\n\t\t}\n\t\tcase ControlType.Slot:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.Slot,\n\t\t\t\tmaxCount: control.maxCount,\n\t\t\t}\n\t\tcase ControlType.Link:\n\t\t\treturn {\n\t\t\t\ttype: linkHrefDescription,\n\t\t\t\tdefaultValue: control.defaultValue,\n\t\t\t}\n\t\tcase ControlType.FusedNumber:\n\t\t\treturn isNumber(control.defaultValue)\n\t\t\t\t? {\n\t\t\t\t\t\ttype: pixelShorthandDescription,\n\t\t\t\t\t\tdefaultValue: control.defaultValue,\n\t\t\t\t\t}\n\t\t\t\t: {\n\t\t\t\t\t\ttype: pixelShorthandDescription,\n\t\t\t\t\t}\n\t\tcase ControlType.Border:\n\t\t\treturn {\n\t\t\t\ttype: `${nullString} | \\${number} \\${solid | dashed | dotted | double} \\${${colorDescription}}`,\n\t\t\t}\n\t\tcase ControlType.BoxShadow:\n\t\t\treturn {\n\t\t\t\ttype: `${boxShadowDescription}[]`,\n\t\t\t}\n\t\tcase ControlType.Font:\n\t\t\treturn {\n\t\t\t\ttype: 'fontSelector | { fontSelector: string; fontSize?: number | \"${number}px\" | \"${number}rem\"; lineHeight?: [number, \"px\" | \"em\" | \"%\"]; letterSpacing?: number | [number, \"px\" | \"em\"]; openTypeFontFeatures?: string[]; variationAxes?: Record<string, number> }',\n\t\t\t}\n\t\tcase ControlType.File:\n\t\t\treturn {\n\t\t\t\ttype: ControlType.File,\n\t\t\t\tallowedFileTypes: control.allowedFileTypes,\n\t\t\t}\n\t\tcase ControlType.ChangeHandler:\n\t\tcase ControlType.LinkRelValues:\n\t\tcase ControlType.PageScope:\n\t\tcase ControlType.Object:\n\t\tcase ControlType.CollectionReference:\n\t\tcase ControlType.MultiCollectionReference:\n\t\tcase ControlType.CustomCursor:\n\t\tcase ControlType.Transition:\n\t\tcase ControlType.ScrollSectionRef:\n\t\tcase ControlType.Array:\n\t\tcase ControlType.Location:\n\t\t\treturn undefined\n\t\tdefault:\n\t\t\tassertNever(control)\n\t}\n}\n\nexport function buildModuleControlDefinitions(\n\tproperties: Record<string, VerifiedControlDescription | undefined>,\n\tvectorSets: VectorSets,\n\tmapControl: (\n\t\tmoduleControl: ComponentControl | undefined,\n\t\tprefixedTitle: PrefixedControlPropKey<string>,\n\t\tcontrol: VerifiedControlDescription,\n\t\tcontrolKey: string,\n\t) => ComponentControl | undefined = control => control,\n): ModuleControlsDefinition {\n\tconst controls: Record<PrefixedControlPropKey<string>, ComponentControl | undefined> = {}\n\tconst { controlPropKeysByControlName, controlPropNamesByKeys } = buildControlDefinitionMappings(properties)\n\n\tfor (const [controlTitle, controlKey] of controlPropKeysByControlName) {\n\t\tconst control = properties[controlKey]\n\t\tif (!control) continue\n\t\tconst prefixedTitle = prefixControlPropKey(controlTitle)\n\t\tconst moduleControl = createModuleControlDefinition(prefixedTitle, control, vectorSets)\n\t\tcontrols[prefixedTitle] = mapControl(moduleControl, prefixedTitle, control, controlKey)\n\t}\n\n\tconst definition = {\n\t\tcontrolPropKeysByControlName,\n\t\tcontrolPropNamesByKeys,\n\t\tcontrols,\n\t\tproperties,\n\t}\n\tsyncEventHandlerMetadata(definition)\n\treturn definition\n}\n\nasync function loadVectorSetsForControls(\n\tproperties: Record<string, VerifiedControlDescription | undefined>,\n\tvectorSets: VectorSets,\n): Promise<void> {\n\tfor (const controlKey in properties) {\n\t\tconst control = properties[controlKey]\n\t\tif (!control || control.type !== ControlType.VectorSetItem) continue\n\t\tawait vectorSets.async.forModuleId(asGlobalId(control.setModuleId))\n\t}\n}\n\nfunction syncEventHandlerMetadata(definition: ModuleControlsDefinition): void {\n\tconst usedKeys = new Set<string>()\n\n\tfor (const [prefixedControlName, control] of Object.entries(definition.controls)) {\n\t\tif (!isPrefixedControlPropKey(prefixedControlName)) continue\n\t\tif (!isEventHandlerComponentControl(control)) continue\n\n\t\tconst controlName = removeControlPropKeyPrefix(prefixedControlName)\n\t\tconst baseKey = toEventHandlerAttributeKey(controlName)\n\n\t\tlet eventKey = baseKey\n\t\tlet count = 2\n\t\twhile (usedKeys.has(eventKey)) {\n\t\t\teventKey = `${baseKey}${count}`\n\t\t\tcount++\n\t\t}\n\n\t\tusedKeys.add(eventKey)\n\t\tcontrol.eventKey = eventKey\n\t}\n}\n\nfunction getAgentVariableControlType(\n\ttype: VariableControlDescription[\"type\"],\n): VariableControlDescription[\"type\"] | ControlType.ResponsiveImage {\n\treturn type === ControlType.Image ? ControlType.ResponsiveImage : type\n}\n\nfunction createAgentControl(\n\tpropertyControl: VariableControlDescription,\n\tvectorSets: VectorSets,\n\tid: VariableDefinition[\"id\"],\n): ComponentControl | undefined {\n\tif (propertyControl.type === ControlType.VectorSetItem) {\n\t\tconst defaultIdentifier = propertyControl.defaultValue?.identifier\n\t\treturn createIconComponentControl(\n\t\t\tpropertyControl.setModuleId,\n\t\t\tisModuleExportIdentifier(defaultIdentifier) ? defaultIdentifier : undefined,\n\t\t\tvectorSets,\n\t\t\tid,\n\t\t)\n\t}\n\n\tif (propertyControl.type === ControlType.File) {\n\t\treturn {\n\t\t\ttype: ControlType.File,\n\t\t\tallowedFileTypes: propertyControl.allowedFileTypes,\n\t\t\tid,\n\t\t}\n\t}\n\n\treturn {\n\t\ttype:\n\t\t\tpropertyControl.type === ControlType.Color ? colorDescription : getAgentVariableControlType(propertyControl.type),\n\t\tid,\n\t}\n}\n\nexport function serializeVariableControl(\n\tvariable: VariableDefinition,\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n\tscopeType: ScopeType,\n): VariableControlDescription | undefined {\n\tconst propertyControl = controlDescriptionFromVariable(tree, componentLoader, variable, scopeType)\n\treturn propertyControl ?? undefined\n}\n\nfunction omitRecordKeys<T>(record: Record<string, T> | undefined, keysToOmit: ReadonlySet<string>): Record<string, T> {\n\tif (!record) return {}\n\n\tconst nextRecord: Record<string, T> = {}\n\n\tfor (const [key, value] of Object.entries(record)) {\n\t\tif (keysToOmit.has(key)) continue\n\t\tnextRecord[key] = value\n\t}\n\n\treturn nextRecord\n}\n\nexport function registerVariableControl(\n\tdefinition: ModuleControlsDefinition,\n\tvariable: VariableDefinition,\n\tpropertyControl: VariableControlDescription,\n\tvectorSets: VectorSets,\n\tllmId?: string,\n): void {\n\tconst agentControl = createAgentControl(propertyControl, vectorSets, variable.id)\n\tif (!agentControl) return\n\n\tunregisterVariableControl(definition, variable.id)\n\n\tconst controlName = createUniqueControlName(\n\t\tvariable.name,\n\t\tvariable.id,\n\t\tnew Set(definition.controlPropKeysByControlName.keys()),\n\t)\n\n\tdefinition.controls[prefixControlPropKey(controlName)] = agentControl\n\tdefinition.controlPropKeysByControlName.set(controlName, variable.id)\n\tdefinition.controlPropNamesByKeys.set(variable.id, controlName)\n\tsyncEventHandlerMetadata(definition)\n\n\tif (llmId && llmId !== controlName) {\n\t\tdefinition.controlPropKeysByControlName.set(llmId, variable.id)\n\t}\n\n\tdefinition.properties[variable.id] = propertyControl\n}\n\nexport function unregisterVariableControl(definition: ModuleControlsDefinition, variableId: string): void {\n\tconst controlName = definition.controlPropNamesByKeys.get(variableId)\n\tif (!controlName) return\n\n\tdefinition.controls = omitRecordKeys(definition.controls, new Set([prefixControlPropKey(controlName), controlName]))\n\n\tfor (const [alias, id] of definition.controlPropKeysByControlName) {\n\t\tif (id !== variableId) continue\n\t\tdefinition.controlPropKeysByControlName.delete(alias)\n\t}\n\n\tdefinition.controlPropNamesByKeys.delete(variableId)\n\tdefinition.properties = omitRecordKeys(definition.properties, new Set([variableId]))\n\tsyncEventHandlerMetadata(definition)\n}\n\n/**\n * Base class for module-identifier registries that cache control definitions and provide different\n * APIs for lookups.\n *\n * Subclasses ({@link import(\"./components.ts\").Components Components},\n * {@link import(\"./layoutTemplates.ts\").LayoutTemplates LayoutTemplates}) add domain-specific\n * features on top.\n */\nexport class ModuleDefinitions {\n\tprotected readonly pendingDefinitions = new Map<\n\t\tModuleExportIdentifierString,\n\t\tPromise<ModuleControlsDefinition | undefined>\n\t>()\n\n\tconstructor(\n\t\tprotected readonly definitions: Map<ModuleName, ModuleControlsDefinition>,\n\t\tprotected readonly namesByIdentifier: Map<ModuleExportIdentifierString, ModuleName>,\n\t\tprotected readonly identifiersByName: Map<ModuleName, ModuleExportIdentifierString>,\n\t\tprotected readonly treeStore: TreeStore,\n\t\tprotected readonly vectorSets: VectorSets,\n\t\tprotected readonly deferred: DeferredOps,\n\t\tprotected readonly propertiesByIdentifier: Map<\n\t\t\tModuleExportIdentifierString,\n\t\t\tRecord<string, ControlDescription | undefined>\n\t\t> = new Map(),\n\t\tprotected readonly componentLoader?: AnyComponentLoader,\n\t\tprotected readonly modulesStore?: ModulesStore,\n\t\tprotected readonly waitForDefinitions: boolean = true,\n\t) {}\n\n\tgetPropertiesForIdentifier(\n\t\tidentifier: ModuleExportIdentifierString,\n\t): Record<string, ControlDescription | undefined> | undefined {\n\t\treturn this.propertiesByIdentifier.get(identifier)\n\t}\n\n\ttoJSON(): ModuleDefinitionsJSON {\n\t\tconst definitions: Record<ModuleName, ModuleControlsDefinitionJSON> = {}\n\t\tfor (const [name, def] of this.definitions) {\n\t\t\tconst controlPropKeysByControlName: Record<string, string> = {}\n\t\t\tfor (const [controlName, controlKey] of def.controlPropKeysByControlName) {\n\t\t\t\tcontrolPropKeysByControlName[controlName] = controlKey\n\t\t\t}\n\t\t\tdefinitions[name] = {\n\t\t\t\tcontrols: def.controls,\n\t\t\t\tcontrolPropKeysByControlName,\n\t\t\t}\n\t\t}\n\n\t\tconst namesByIdentifier: Record<ModuleExportIdentifierString, ModuleName> = {}\n\t\tfor (const [identifier, name] of this.namesByIdentifier) {\n\t\t\tnamesByIdentifier[identifier] = name\n\t\t}\n\n\t\tconst propertiesByIdentifier: ModuleDefinitionsJSON[\"propertiesByIdentifier\"] = {}\n\t\tfor (const [identifier, properties] of this.propertiesByIdentifier) {\n\t\t\tpropertiesByIdentifier[identifier] = properties\n\t\t}\n\n\t\treturn { definitions, namesByIdentifier, propertiesByIdentifier }\n\t}\n\n\tstatic deserializeJSON(json: ModuleDefinitionsJSON): {\n\t\tdefinitions: Map<ModuleName, ModuleControlsDefinition>\n\t\tnamesByIdentifier: Map<ModuleExportIdentifierString, ModuleName>\n\t\tidentifiersByName: Map<ModuleName, ModuleExportIdentifierString>\n\t\tpropertiesByIdentifier: Map<ModuleExportIdentifierString, Record<string, ControlDescription | undefined>>\n\t} {\n\t\tconst definitions = new Map<ModuleName, ModuleControlsDefinition>()\n\t\tfor (const [name, def] of Object.entries(json.definitions)) {\n\t\t\tconst controlPropKeysByControlName = new Map<string, string>()\n\t\t\tfor (const [controlName, controlKey] of Object.entries(def.controlPropKeysByControlName)) {\n\t\t\t\tcontrolPropKeysByControlName.set(controlName, controlKey)\n\t\t\t}\n\t\t\tdefinitions.set(name, {\n\t\t\t\tcontrols: def.controls,\n\t\t\t\tcontrolPropKeysByControlName,\n\t\t\t\tcontrolPropNamesByKeys: invertMap(controlPropKeysByControlName),\n\t\t\t\tproperties: {},\n\t\t\t})\n\t\t}\n\n\t\tconst namesByIdentifier = new Map<ModuleExportIdentifierString, ModuleName>()\n\t\tfor (const [identifier, name] of Object.entries(json.namesByIdentifier)) {\n\t\t\tif (!isModuleExportIdentifier(identifier)) continue\n\t\t\tnamesByIdentifier.set(identifier, name)\n\t\t}\n\n\t\tconst identifiersByName = invertMap(namesByIdentifier)\n\n\t\tconst propertiesByIdentifier = new Map<\n\t\t\tModuleExportIdentifierString,\n\t\t\tRecord<string, ControlDescription | undefined>\n\t\t>()\n\t\tfor (const [identifier, properties] of Object.entries(json.propertiesByIdentifier)) {\n\t\t\tif (!isModuleExportIdentifier(identifier)) continue\n\t\t\tpropertiesByIdentifier.set(identifier, properties)\n\t\t}\n\n\t\tfor (const [identifier, name] of namesByIdentifier) {\n\t\t\tconst definition = definitions.get(name)\n\t\t\tif (!definition) continue\n\t\t\tdefinition.properties = propertiesByIdentifier.get(identifier) ?? {}\n\t\t}\n\n\t\treturn { definitions, namesByIdentifier, identifiersByName, propertiesByIdentifier }\n\t}\n\n\tforIdentifier(identifier: ModuleExportIdentifierString, options?: ForIdentifierOptions) {\n\t\tconst vector = this.vectorSets.forInstanceIdentifier(identifier)\n\t\tif (vector) return vector\n\n\t\tconst name = this.namesByIdentifier.get(identifier)\n\t\tif (!name) return\n\n\t\tconst definition = this.definitions.get(name)\n\t\tif (!definition) {\n\t\t\tif (!options?.deferUntilLoaded) return\n\t\t\tif (!this.componentLoader?.componentForIdentifier(identifier) && !this.pendingDefinitions.has(identifier)) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.deferred.deferUntil(() => this.loadDefinition(identifier), `Module definition for \"${name}\" is not loaded`)\n\t\t}\n\n\t\treturn {\n\t\t\tname,\n\t\t\tcontrols: getControlsHandle(definition, this.propertiesByIdentifier.get(identifier)),\n\t\t}\n\t}\n\n\tgetNameForIdentifier(identifier: ModuleExportIdentifierString): ModuleName | undefined {\n\t\treturn this.namesByIdentifier.get(identifier)\n\t}\n\n\tasync = {\n\t\tforIdentifier: async (identifier: ModuleExportIdentifierString, options?: AsyncForIdentifierOptions) => {\n\t\t\tconst name = this.namesByIdentifier.get(identifier)\n\t\t\tif (!name) return\n\n\t\t\tawait (options?.waitUntilLoaded ? this.waitForDefinition(identifier) : this.ensureDefinition(identifier))\n\t\t\treturn this.forIdentifier(identifier)\n\t\t},\n\t}\n\n\tgetIdentifierByName(name: ModuleName): ModuleExportIdentifierString | undefined {\n\t\treturn this.identifiersByName.get(name)\n\t}\n\n\tadd(name: ModuleName, identifier: ModuleExportIdentifierString) {\n\t\tthis.identifiersByName.set(name, identifier)\n\t\tthis.namesByIdentifier.set(identifier, name)\n\t}\n\n\tremove(identifier: ModuleExportIdentifierString) {\n\t\tconst name = this.namesByIdentifier.get(identifier)\n\t\tif (name) {\n\t\t\tthis.identifiersByName.delete(name)\n\t\t\tthis.definitions.delete(name)\n\t\t}\n\t\tthis.namesByIdentifier.delete(identifier)\n\t\tthis.propertiesByIdentifier.delete(identifier)\n\t}\n\n\tasync upsertVariable(identifier: ModuleExportIdentifierString, variable: VariableDefinition, llmId?: string) {\n\t\tconst name = this.namesByIdentifier.get(identifier)\n\t\tif (!name) return\n\n\t\tconst definition = await this.ensureDefinition(identifier)\n\t\tif (!definition) return\n\n\t\tawait this.registerVariableControl(definition, identifier, variable, llmId)\n\t}\n\n\tremoveVariable(identifier: ModuleExportIdentifierString, variableId: string) {\n\t\tconst name = this.namesByIdentifier.get(identifier)\n\t\tif (!name) return\n\n\t\tconst definition = this.definitions.get(name)\n\t\tif (!definition) return\n\n\t\tthis.unregisterVariableControl(definition, variableId)\n\n\t\tthis.propertiesByIdentifier.set(\n\t\t\tidentifier,\n\t\t\tomitRecordKeys(this.propertiesByIdentifier.get(identifier), new Set([variableId])),\n\t\t)\n\t}\n\n\tprotected async registerVariableControl(\n\t\tdefinition: ModuleControlsDefinition,\n\t\tidentifier: ModuleExportIdentifierString,\n\t\tvariable: VariableDefinition,\n\t\tllmId?: string,\n\t): Promise<void> {\n\t\tassert(this.componentLoader, \"Component loader is required when upserting variables\")\n\n\t\tconst propertyControl = serializeVariableControl(\n\t\t\tvariable,\n\t\t\tthis.treeStore.tree,\n\t\t\tthis.componentLoader,\n\t\t\tthis.variableScopeType,\n\t\t)\n\t\tif (!propertyControl) return\n\n\t\tif (propertyControl.type === ControlType.VectorSetItem) {\n\t\t\tawait this.vectorSets.async.forModuleId(asGlobalId(propertyControl.setModuleId))\n\t\t}\n\n\t\tregisterVariableControl(definition, variable, propertyControl, this.vectorSets, llmId)\n\t\tthis.propertiesByIdentifier.set(identifier, definition.properties)\n\t}\n\n\tprotected unregisterVariableControl(definition: ModuleControlsDefinition, variableId: string): void {\n\t\tunregisterVariableControl(definition, variableId)\n\t}\n\n\tprotected get variableScopeType(): ScopeType {\n\t\tthrow new Error(\"Subclass must override variableScopeType\")\n\t}\n\n\tprotected getScope(_localModuleIdentifier: LocalModuleIdentifier): (AnyScopeNode & WithVariables) | null {\n\t\tthrow new Error(\"Subclass must override getNode\")\n\t}\n\n\tprotected async hydrateVariables(\n\t\tidentifier: ModuleExportIdentifierString,\n\t\tdefinition: ModuleControlsDefinition,\n\t): Promise<void> {\n\t\tconst parsed = parseModuleIdentifier(identifier)\n\t\tif (!parsed || isExternalModuleIdentifier(parsed)) return\n\n\t\tconst node = this.getScope(parsed)\n\t\tif (!node) return\n\n\t\tfor (const variable of node.variables) {\n\t\t\tif (variable.type === \"divider\") continue\n\t\t\tawait this.registerVariableControl(definition, identifier, variable)\n\t\t}\n\t}\n\n\tprotected loadDefinition(identifier: ModuleExportIdentifierString): Promise<ModuleControlsDefinition | undefined> {\n\t\tconst existingPromise = this.pendingDefinitions.get(identifier)\n\t\tif (existingPromise) return existingPromise\n\n\t\tconst promise = this.ensureDefinition(identifier).finally(() => {\n\t\t\tif (this.pendingDefinitions.get(identifier) === promise) {\n\t\t\t\tthis.pendingDefinitions.delete(identifier)\n\t\t\t}\n\t\t})\n\n\t\tthis.pendingDefinitions.set(identifier, promise)\n\n\t\treturn promise\n\t}\n\n\tprotected async waitForDefinition(\n\t\tidentifier: ModuleExportIdentifierString,\n\t): Promise<ModuleControlsDefinition | undefined> {\n\t\tconst existingName = this.namesByIdentifier.get(identifier)\n\t\tif (!existingName) return\n\n\t\tconst existingDefinition = this.definitions.get(existingName)\n\t\tif (existingDefinition) return existingDefinition\n\n\t\tconst pendingDefinition = this.pendingDefinitions.get(identifier)\n\t\tif (pendingDefinition) return pendingDefinition\n\n\t\tconst availableDefinition = await this.ensureDefinition(identifier)\n\t\tif (availableDefinition) return availableDefinition\n\n\t\tif (!this.waitForDefinitions) return\n\n\t\tif (this.componentLoader?.componentForIdentifier(identifier)) {\n\t\t\treturn this.ensureDefinition(identifier)\n\t\t}\n\n\t\tif (!this.componentLoader || !this.modulesStore || !isEditorComponentLoader(this.componentLoader)) return\n\n\t\ttry {\n\t\t\tawait waitForLoadingComponentsWithTimeout(this.componentLoader, [identifier], this.modulesStore)\n\t\t} catch (error) {\n\t\t\tlog.warn(\n\t\t\t\t\"waitForLoadingComponentsWithTimeout failed for definition lookup; returning undefined\",\n\t\t\t\tidentifier,\n\t\t\t\terror,\n\t\t\t)\n\t\t\treturn\n\t\t}\n\t\treturn this.ensureDefinition(identifier)\n\t}\n\n\tprotected async ensureDefinition(\n\t\tidentifier: ModuleExportIdentifierString,\n\t): Promise<ModuleControlsDefinition | undefined> {\n\t\tconst existingName = this.namesByIdentifier.get(identifier)\n\t\tif (!existingName) return\n\n\t\tconst existingDefinition = this.definitions.get(existingName)\n\t\tif (existingDefinition) return existingDefinition\n\n\t\tconst info = this.componentLoader?.componentForIdentifier(identifier)\n\t\tif (!info) return\n\n\t\tawait loadVectorSetsForControls(info.properties, this.vectorSets)\n\t\tconst controlsDefinition = buildModuleControlDefinitions(info.properties, this.vectorSets)\n\n\t\tthis.definitions.set(existingName, controlsDefinition)\n\t\tthis.propertiesByIdentifier.set(identifier, {\n\t\t\t...info.properties,\n\t\t\t...this.propertiesByIdentifier.get(identifier),\n\t\t})\n\t\tcontrolsDefinition.properties = this.propertiesByIdentifier.get(identifier) ?? controlsDefinition.properties\n\n\t\tawait this.hydrateVariables(identifier, controlsDefinition)\n\n\t\treturn controlsDefinition\n\t}\n\n\tstatic buildNameMappings(\n\t\tidentifiers: Set<ModuleExportIdentifierString>,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\texistingNamesByIdentifier?: Map<ModuleExportIdentifierString, ModuleName>,\n\t) {\n\t\tconst namesByIdentifier = new Map<ModuleExportIdentifierString, ModuleName>()\n\t\tconst names = new Set<string>()\n\n\t\tfor (const setIdentifier of identifiers) {\n\t\t\tconst identifier = parseModuleIdentifier(setIdentifier)\n\t\t\tif (!identifier) continue\n\t\t\tconst info = componentLoader.componentForIdentifier(identifier.value)\n\t\t\tif (!info) continue\n\n\t\t\tconst moduleName = uniqueName(info.name ?? Dictionary.Component, names)\n\t\t\tnames.add(moduleName)\n\t\t\tnamesByIdentifier.set(identifier.value, moduleName)\n\t\t}\n\t\tfor (const [identifier, name] of existingNamesByIdentifier ?? []) {\n\t\t\tif (!identifiers.has(identifier)) continue\n\t\t\taddModuleName(namesByIdentifier, names, identifier, name)\n\t\t}\n\n\t\tconst identifiersByName = invertMap(namesByIdentifier)\n\n\t\treturn { namesByIdentifier, identifiersByName, names }\n\t}\n}\n", "import { isEditorComponentLoader, type AnyComponentLoader, type ComponentLoader } from \"@framerjs/framer-runtime\"\nimport {\n\tassert,\n\tdelay,\n\tModuleType,\n\tasGlobalId,\n\tassertNever,\n\tgetLogger,\n\tisModuleExportIdentifier,\n\tisExternalModuleIdentifier,\n\ttype ExternalModuleExportIdentifier,\n\ttype ModuleExportIdentifierString,\n\tparseModuleIdentifier,\n\tisLocalModuleIdentifier,\n\ttype GlobalModuleId,\n\temptyArray,\n\ttype LocalModuleId,\n} from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { waitForLoadingComponentsWithTimeout } from \"code-generation/utils/waitForLoadingComponentsWithTimeout.ts\"\nimport { getCreativeItems } from \"document/components/chrome/insertSidebar/dataSources/items/creativeItems.ts\"\nimport { getFormItems } from \"document/components/chrome/insertSidebar/dataSources/items/formItems.ts\"\nimport { getInteractiveItems } from \"document/components/chrome/insertSidebar/dataSources/items/interactiveItems.ts\"\nimport { getMediaItems } from \"document/components/chrome/insertSidebar/dataSources/items/mediaItems.ts\"\nimport { socialItems } from \"document/components/chrome/insertSidebar/dataSources/items/socialItems.ts\"\nimport { getUtilityItems } from \"document/components/chrome/insertSidebar/dataSources/items/utilityItems.ts\"\nimport {\n\ttype DataSourceItem,\n\ttype DataSourceItemModuleURL,\n\tgetModuleIdentifierForItem,\n\thasGenerateNodes,\n\thasModuleURL,\n\tisDataSourceSection,\n\tnormalizeModuleURLItemForCurrentEnvironment,\n} from \"document/components/chrome/insertSidebar/types.ts\"\nimport type { NodeID, SmartComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport { ExternalModulesListNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport { isLocalModuleNode } from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport {\n\tisExternalModuleNode,\n\tisLayoutTemplateNode,\n\tisSmartComponentNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VariableDefinition, VariableControlDescription } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { prefixControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { getComponentPresetControlKeys } from \"document/models/controlProps/filterComponentPresetControls.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { type ControlDescription, ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isEditableModuleEntry, type ModuleEntry } from \"modules/ModulesStorage.ts\"\nimport { join } from \"utils/join.ts\"\nimport { getLookupQueryForModuleComponent } from \"utils/moduleComponents.ts\"\nimport type { TreeResolver } from \"../TreeResolver.ts\"\nimport type { ComponentControl, ComponentDefinitionResult } from \"./componentDefinition.ts\"\nimport { getControlsHandle } from \"./controlDefinitions.ts\"\nimport type { DeferredOps } from \"./deferred.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\nimport {\n\tbuildModuleControlDefinitions,\n\tregisterVariableControl,\n\tserializeVariableControl,\n\ttype ModuleControlsDefinition,\n\tunregisterVariableControl,\n} from \"./moduleDefinitions.ts\"\nimport type { VectorSets } from \"./vectors.ts\"\n\nconst log = getLogger(\"ai:agents:components\")\n\nexport const CURRENT_PROJECT_CODE_COMPONENTS_SECTION_NAME = \"Current Project Code Files and Code Components\" as const\nconst EXTERNAL_MODULE_PRELOAD_TIMEOUT_MS = 5_000\n\nconst enum PreloadResult {\n\tCompleted = \"completed\",\n\tFailed = \"failed\",\n\tTimedOut = \"timedOut\",\n}\n\ntype InsertComponentMapItem = DataSourceItem & DataSourceItemModuleURL\n\ninterface InsertComponentItem {\n\tname: string\n\tkeywords: string | null\n\tidentifier: ModuleExportIdentifierString\n}\n\ntype ExportSpecifier = string\ntype ComponentId = string | NodeID | GlobalModuleId\ntype CodeFilePath = string\n\ntype ControlsDefinition = ModuleControlsDefinition\n\nconst defaultExportSpecifier: ExportSpecifier = \"default\"\n\ninterface ComponentsOptions {\n\twaitForDefinitions?: boolean\n\texternalModulePreloadTimeoutMs?: number\n}\n\nexport type ComponentsJSON = JSON<State>\n\n// Convert the canonical class state interface to a JSON representation.\ntype JSON<T> =\n\tT extends Map<infer Key extends string, infer Value>\n\t\t? Record<Key, JSON<Value>>\n\t\t: T extends object\n\t\t\t? {\n\t\t\t\t\t[Key in keyof T]: T[Key] extends Map<infer MapKey extends string, infer MapValue>\n\t\t\t\t\t\t? Record<MapKey, JSON<MapValue>>\n\t\t\t\t\t\t: T[Key]\n\t\t\t\t}\n\t\t\t: T\n\nfunction getLocalCodeComponentIdentifiers(\n\tmodulesStore: ModulesStore,\n\tcomponentLoader: ComponentLoader,\n): Set<ModuleExportIdentifierString> {\n\tconst identifiers = new Set<ModuleExportIdentifierString>()\n\n\tfor (const definition of componentLoader.getAllLocalModules()) {\n\t\tif (definition.type !== \"component\") continue\n\n\t\tconst parsedIdentifier = parseModuleIdentifier(definition.identifier)\n\t\tif (!isLocalModuleIdentifier(parsedIdentifier) || !isModuleExportIdentifier(parsedIdentifier)) continue\n\t\tif (parsedIdentifier.type !== ModuleType.Code) continue\n\n\t\tconst moduleEntry = modulesStore.getModuleEntryByLocalId(parsedIdentifier.localId)\n\t\tif (!isEditableModuleEntry(moduleEntry) || moduleEntry.type !== ModuleType.Code) continue\n\n\t\tidentifiers.add(parsedIdentifier.value)\n\t}\n\n\treturn identifiers\n}\n\nasync function preloadExternalModuleForAgent(\n\tmodulesStore: ModulesStore,\n\tidentifier: ExternalModuleExportIdentifier,\n\ttimeoutMs: number,\n): Promise<ModuleExportIdentifierString | undefined> {\n\tconst preload = modulesStore\n\t\t.preloadExternalModules([identifier])\n\t\t.then(() => PreloadResult.Completed)\n\t\t.catch(error => {\n\t\t\tlog.warn(\"Failed to preload external component module for agent context\", identifier.value, error)\n\t\t\treturn PreloadResult.Failed\n\t\t})\n\n\tconst result = await Promise.race([preload, delay(timeoutMs).then(() => PreloadResult.TimedOut)])\n\tif (result === PreloadResult.Completed) return\n\n\tif (result === PreloadResult.TimedOut) {\n\t\tlog.warn(\"Timed out preloading external component module for agent context\", identifier.value, timeoutMs)\n\t}\n\n\treturn identifier.value\n}\n\n/**\n * Preloads external modules needed for agent component context without letting stale project module\n * metadata block context creation.\n */\nasync function preloadExternalModulesForAgent(\n\tmodulesStore: ModulesStore,\n\tmodulesToPreload: ExternalModuleExportIdentifier[],\n\ttimeoutMs: number,\n): Promise<Set<ModuleExportIdentifierString>> {\n\tconst failedIdentifiers = new Set<ModuleExportIdentifierString>()\n\tconst preloadPromises: Promise<ModuleExportIdentifierString | undefined>[] = []\n\tfor (const identifier of modulesToPreload) {\n\t\tpreloadPromises.push(preloadExternalModuleForAgent(modulesStore, identifier, timeoutMs))\n\t}\n\n\tconst results = await Promise.all(preloadPromises)\n\tfor (const failedIdentifier of results) {\n\t\tif (failedIdentifier) {\n\t\t\tfailedIdentifiers.add(failedIdentifier)\n\t\t}\n\t}\n\n\treturn failedIdentifiers\n}\n\nfunction withPresetOnlyMetadata(\n\tcontrol: ComponentControl | undefined,\n\tonlyPresets: boolean,\n): ComponentControl | undefined {\n\tif (!control || !onlyPresets) return control\n\treturn { ...control, onlyPresets: true }\n}\n\n/**\n * Construct a unique identifier that looks like a TypeSlashName, but does not introduce an extension, which would break expectations elsewhere by including \".\"\n */\nexport function getLocalCodeComponentId(identifier: ModuleExportIdentifierString): string | undefined {\n\tconst parsed = parseModuleIdentifier(identifier)\n\tif (!parsed || !isLocalModuleIdentifier(parsed) || !isModuleExportIdentifier(parsed)) return\n\tif (parsed.type !== ModuleType.Code) return\n\treturn `${parsed.type}/${parsed.localIdName}:${parsed.exportSpecifier}`\n}\n\ntype Definition = ModuleControlsDefinition\n\nexport interface State {\n\tdefinitions: Map<ModuleExportIdentifierString, Definition>\n}\n\ninterface ForIdentifierOptions {\n\tdeferUntilLoaded?: boolean\n\tdeferMessage?: string\n}\n\nfunction shouldWaitForDefinitions(options?: ComponentsOptions): boolean {\n\treturn options?.waitForDefinitions ?? true\n}\n\nexport class Components {\n\tstatic readonly metadataTag = metadataTags.availableComponents\n\tstatic readonly definitionTag = metadataTags.componentDefinition\n\n\tprivate readonly pendingDefinitions = new Map<ModuleExportIdentifierString, Promise<ControlsDefinition | undefined>>()\n\tprivate readonly sentDefinitions = new Set<ModuleExportIdentifierString>()\n\n\t/** Prefer the static factory methods over direct construction. */\n\tconstructor(\n\t\tprivate readonly treeResolver: TreeResolver,\n\t\tprivate readonly treeStore: TreeStore,\n\t\tprivate readonly vectorSets: VectorSets,\n\t\tprivate readonly deferred: DeferredOps,\n\t\tprivate readonly componentLoader?: AnyComponentLoader,\n\t\tprivate readonly modulesStore?: ModulesStore,\n\t\tprivate readonly definitions: State[\"definitions\"] = new Map(),\n\t\tprivate readonly waitForDefinitions: boolean = true,\n\t\tprivate readonly insertComponents: Map<GlobalModuleId, InsertComponentItem> = buildInsertComponentMap(),\n\t\tprivate readonly identifiers: Set<ModuleExportIdentifierString> = new Set(),\n\t) {}\n\n\tgetPropertiesForIdentifier(\n\t\tidentifier: ModuleExportIdentifierString,\n\t): Record<string, ControlDescription | undefined> | undefined {\n\t\treturn this.definitions.get(this.getCanonicalIdentifier(identifier))?.properties\n\t}\n\n\t// Components can be deserialized or built for examples without its own loader,\n\t// while callers may still have the active AgentContext loader. Accept an override\n\t// so stale external identifier resolution stays centralized here.\n\tgetReactComponentForIdentifier(\n\t\tidentifier: ModuleExportIdentifierString,\n\t\tcomponentLoader: AnyComponentLoader | undefined = this.componentLoader,\n\t) {\n\t\tif (!componentLoader) return\n\n\t\tconst currentIdentifier = this.getCanonicalIdentifier(identifier)\n\t\treturn (\n\t\t\tcomponentLoader.reactComponentForIdentifier(currentIdentifier) ??\n\t\t\t(currentIdentifier === identifier ? undefined : componentLoader.reactComponentForIdentifier(identifier))\n\t\t)\n\t}\n\n\ttoJSON(): JSON<State> {\n\t\tconst definitions: JSON<State[\"definitions\"]> = {}\n\t\tfor (const [identifier, definition] of this.definitions) {\n\t\t\tdefinitions[identifier] = componentDefinitionToJSON(definition)\n\t\t}\n\n\t\treturn { definitions }\n\t}\n\n\tstatic fromJSON(\n\t\tjson: JSON<State>,\n\t\ttreeResolver: TreeResolver,\n\t\ttreeStore: TreeStore,\n\t\tvectorSets: VectorSets,\n\t\tdeferred: DeferredOps,\n\t\tcomponentLoader?: AnyComponentLoader,\n\t\tmodulesStore?: ModulesStore,\n\t\toptions?: ComponentsOptions,\n\t): Components {\n\t\tconst definitions = new Map<ModuleExportIdentifierString, Definition>()\n\t\tfor (const [identifier, definition] of Object.entries(json.definitions)) {\n\t\t\tif (!isModuleExportIdentifier(identifier)) continue\n\t\t\tdefinitions.set(identifier, componentDefinitionFromJSON(definition))\n\t\t}\n\n\t\treturn new Components(\n\t\t\ttreeResolver,\n\t\t\ttreeStore,\n\t\t\tvectorSets,\n\t\t\tdeferred,\n\t\t\tcomponentLoader,\n\t\t\tmodulesStore,\n\t\t\tdefinitions,\n\t\t\tshouldWaitForDefinitions(options),\n\t\t)\n\t}\n\n\tforIdentifier(identifier: ModuleExportIdentifierString, options?: ForIdentifierOptions) {\n\t\t// Defer vector identifiers to the dedicated resolver.\n\t\tconst vector = this.vectorSets.forInstanceIdentifier(identifier)\n\t\tif (vector) return vector\n\n\t\tconst canonicalIdentifier = this.getCanonicalIdentifier(identifier)\n\n\t\tconst definition = this.ensureDefinition(canonicalIdentifier)\n\t\tconst id = this.getIdForModuleIdentifier(canonicalIdentifier)\n\t\tconst displayName = this.getDisplayName(canonicalIdentifier)\n\n\t\tif (!definition) {\n\t\t\tif (!options?.deferUntilLoaded) return\n\t\t\tif (\n\t\t\t\t!this.componentLoader?.componentForIdentifier(canonicalIdentifier) &&\n\t\t\t\t!this.pendingDefinitions.has(identifier)\n\t\t\t) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tthis.deferred.deferUntil(\n\t\t\t\t() => this.loadDefinition(canonicalIdentifier),\n\t\t\t\toptions?.deferMessage ?? `Component definition for \"${id}\" is not loaded`,\n\t\t\t)\n\t\t}\n\n\t\tif (!definition) return\n\n\t\treturn {\n\t\t\tid,\n\t\t\tname: displayName,\n\t\t\tcontrols: getControlsHandle(definition, definition.properties),\n\t\t\tproperties: definition.properties,\n\t\t}\n\t}\n\n\t/**\n\t * Given an external module identifier, return the canonical module identifier from the tree,\n\t * otherwise pass through the identifier.\n\t */\n\tprivate getCanonicalIdentifier(identifier: ModuleExportIdentifierString): ModuleExportIdentifierString {\n\t\tconst parsedIdentifier = parseModuleIdentifier(identifier)\n\t\tif (\n\t\t\t!parsedIdentifier ||\n\t\t\t!isExternalModuleIdentifier(parsedIdentifier) ||\n\t\t\t!isModuleExportIdentifier(parsedIdentifier)\n\t\t) {\n\t\t\treturn identifier\n\t\t}\n\n\t\tconst externalModuleNode = this.treeStore.tree.getNodeWithTrait(parsedIdentifier.moduleId, isExternalModuleNode)\n\t\tconst currentIdentifier = externalModuleNode?.codeComponentIdentifier\n\t\treturn isModuleExportIdentifier(currentIdentifier) ? currentIdentifier : identifier\n\t}\n\n\t/**\n\t * Given a ModuleExportIdentifierString, returns the display name of the component.\n\t */\n\tgetDisplayName(identifier: ModuleExportIdentifierString): string {\n\t\tconst canonicalIdentifier = this.getCanonicalIdentifier(identifier)\n\n\t\tconst parsed = parseModuleIdentifier(canonicalIdentifier)\n\t\tassert(parsed && isModuleExportIdentifier(parsed), \"Invalid module identifier\")\n\n\t\t// Querying the tree instead of the component loader. The tree is up-to-date\n\t\t// as soon as the model touches it, versus the component loader having to wait\n\t\t// for codegen\n\t\tif (isLocalModuleIdentifier(parsed) && parsed.type === ModuleType.Canvas) {\n\t\t\tconst node = this.treeStore.tree.getNodeWithTrait(parsed.localIdName, isSmartComponentNode)\n\t\t\tconst name = node?.resolveValue(\"name\")\n\t\t\tif (name) return name\n\t\t}\n\n\t\t// Querying the tree instead of the component loader. When a project has an external component,\n\t\t// but that component isn\u2019t used on the current page, the component loader will only evaluate\n\t\t// the component lazily. In practice, this means the component loader might not have the name\n\t\t// for the external component for a minute after project load.\n\t\tif (isExternalModuleIdentifier(parsed)) {\n\t\t\tconst externalModuleNode = this.treeStore.tree.getNodeWithTrait(parsed.moduleId, isExternalModuleNode)\n\t\t\tconst name = externalModuleNode?.getName()\n\t\t\tif (name) return name\n\t\t}\n\n\t\treturn this.componentLoader?.componentForIdentifier(canonicalIdentifier)?.name ?? Dictionary.Component\n\t}\n\n\t/**\n\t * Given a model component=\"<id>\", return the actual module identifier for the component.\n\t * Resolves llm or tree ids to the actual module identifier via the resolver.\n\t * Resolves external global ids to the canonical tree identifier.\n\t * Resolves local code component ids to the local module identifier.\n\t * Resolves insert sidebar global ids to the insert sidebar component identifier.\n\t */\n\tgetModuleIdentifierForId(id: ComponentId): ModuleExportIdentifierString | null {\n\t\tconst node = this.treeResolver.get(id)\n\t\tif (isSmartComponentNode(node) || isLayoutTemplateNode(node)) return node.instanceIdentifier\n\t\tif (isExternalModuleNode(node)) return node.codeComponentIdentifier\n\t\tif (isLocalModuleNode(node) && node.save.type === ModuleType.Code) {\n\t\t\tconst parsed = parseModuleIdentifier(`local-module:${node.id}:${defaultExportSpecifier}`)\n\t\t\treturn isModuleExportIdentifier(parsed) ? parsed.value : null\n\t\t}\n\n\t\t// If we have a node, but it's not the above, we have a problem, the model shouldn't have access.\n\t\tif (node) return null\n\n\t\t// Insert Sidebar Components...\n\t\tconst insertComponent = this.insertComponents.get(asGlobalId(id))\n\t\tif (insertComponent) return insertComponent.identifier\n\n\t\tconst localCodeIdentifier = this.getLocalCodeComponentIdentifierForId(id)\n\t\tif (localCodeIdentifier) return localCodeIdentifier\n\n\t\treturn null\n\t}\n\n\tprivate getLocalCodeComponentIdentifierForId(id: ComponentId): ModuleExportIdentifierString | undefined {\n\t\tconst parsed = parseModuleIdentifier(`local-module:${id}`)\n\t\tif (!parsed || !isLocalModuleIdentifier(parsed) || !isModuleExportIdentifier(parsed)) return\n\t\tif (parsed.type !== ModuleType.Code) return\n\n\t\tif (this.identifiers.has(parsed.value) || this.definitions.has(parsed.value)) return parsed.value\n\n\t\tconst localModuleNode = this.treeResolver.get(parsed.localId)\n\t\tif (!isLocalModuleNode(localModuleNode) || localModuleNode.save.type !== ModuleType.Code) return\n\n\t\treturn parsed.value\n\t}\n\n\t/**\n\t * Given a module identifier, return the id that the model will use to reference the component.\n\t */\n\tgetIdForModuleIdentifier(identifier: ModuleExportIdentifierString): ComponentId | undefined {\n\t\tconst canonicalIdentifier = this.getCanonicalIdentifier(identifier)\n\t\tconst parsed = parseModuleIdentifier(canonicalIdentifier)\n\t\tif (!parsed || !isModuleExportIdentifier(parsed)) return\n\t\tif (isExternalModuleIdentifier(parsed)) return parsed.moduleId\n\t\tif (isLocalModuleIdentifier(parsed) && parsed.type === ModuleType.Canvas) return parsed.localIdName\n\t\tif (isLocalModuleIdentifier(parsed) && parsed.type === ModuleType.Code) {\n\t\t\treturn getLocalCodeComponentId(canonicalIdentifier)\n\t\t}\n\t\t// Any other types are unsupported.\n\t}\n\n\tasync = {\n\t\tensureDefinition: async (identifier: ModuleExportIdentifierString): Promise<ControlsDefinition | undefined> => {\n\t\t\tconst canonicalIdentifier = this.getCanonicalIdentifier(identifier)\n\n\t\t\t// If we are already loading the definition, return the pending promise.\n\t\t\tconst pendingDefinition = this.pendingDefinitions.get(canonicalIdentifier)\n\t\t\tif (pendingDefinition) return pendingDefinition\n\n\t\t\tconst existingDefinition = this.definitions.get(canonicalIdentifier)\n\t\t\tconst parsedIdentifier = parseModuleIdentifier(canonicalIdentifier)\n\t\t\tif (\n\t\t\t\tparsedIdentifier &&\n\t\t\t\tisLocalModuleIdentifier(parsedIdentifier) &&\n\t\t\t\tparsedIdentifier.type === ModuleType.Canvas\n\t\t\t) {\n\t\t\t\t// Preload dependent Smart Components and their Vector controls.\n\t\t\t\tconst componentNode = this.treeStore.tree.getNodeWithTrait(parsedIdentifier.localIdName, isSmartComponentNode)\n\t\t\t\tfor (const variable of componentNode?.variables ?? emptyArray()) {\n\t\t\t\t\tif (variable.type === ControlType.VectorSetItem) await this.vectorSets.async.forModuleId(variable.setModuleId)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// If we don't have a component loader, we have to wait for the component definitions to be loaded.\n\t\t\tif (!this.componentLoader?.componentForIdentifier(canonicalIdentifier)) {\n\t\t\t\tif (!this.componentLoader || !this.modulesStore || !isEditorComponentLoader(this.componentLoader)) {\n\t\t\t\t\treturn existingDefinition\n\t\t\t\t}\n\t\t\t\t// If we are impatient, we early return.\n\t\t\t\tif (!this.waitForDefinitions) return existingDefinition\n\n\t\t\t\t// If we are loading an external module and there is no definition, we need to preload it.\n\t\t\t\tif (isExternalModuleIdentifier(parsedIdentifier)) {\n\t\t\t\t\tconst failedIdentifier = await preloadExternalModuleForAgent(\n\t\t\t\t\t\tthis.modulesStore,\n\t\t\t\t\t\tparsedIdentifier,\n\t\t\t\t\t\tEXTERNAL_MODULE_PRELOAD_TIMEOUT_MS,\n\t\t\t\t\t)\n\t\t\t\t\tif (failedIdentifier) return existingDefinition\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait waitForLoadingComponentsWithTimeout(this.componentLoader, [canonicalIdentifier], this.modulesStore)\n\t\t\t\t} catch (error) {\n\t\t\t\t\tlog.warn(\"async.ensureDefinition failed for definition lookup\", canonicalIdentifier, error)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// We expect to now have a definition in the loader, if we don't, we have to return.\n\t\t\tconst definition = this.componentLoader?.componentForIdentifier(canonicalIdentifier)\n\t\t\tif (!definition) return existingDefinition\n\n\t\t\t// If we have a definition in the loader, we need to prepare the controls by resolving any\n\t\t\t// vector sets we discover. We do this up-front so that we can keep other methods synchronous.\n\t\t\tfor (const controlKey in definition.properties) {\n\t\t\t\tconst control = definition.properties[controlKey]\n\t\t\t\tif (!control || control.type !== ControlType.VectorSetItem) continue\n\t\t\t\tawait this.vectorSets.async.forModuleId(asGlobalId(control.setModuleId))\n\t\t\t}\n\n\t\t\t// Finally, generate and return the definition.\n\t\t\treturn this.ensureDefinition(canonicalIdentifier)\n\t\t},\n\t\tforIdentifier: (identifier: ModuleExportIdentifierString): Promise<ReturnType<typeof this.forIdentifier>> => {\n\t\t\treturn this.async.ensureDefinition(identifier).then(() => this.forIdentifier(identifier))\n\t\t},\n\t}\n\n\tasync removeDefinitions(identifiers: readonly ModuleExportIdentifierString[]): Promise<void> {\n\t\tconst pendingDefinitions = identifiers\n\t\t\t.map(identifier => this.pendingDefinitions.get(identifier))\n\t\t\t.filter(i => i !== undefined)\n\t\tif (pendingDefinitions.length > 0) {\n\t\t\tawait Promise.all(pendingDefinitions)\n\t\t}\n\n\t\tfor (const identifier of identifiers) {\n\t\t\tthis.definitions.delete(identifier)\n\t\t\tthis.pendingDefinitions.delete(identifier)\n\t\t\tthis.identifiers.delete(identifier)\n\t\t\tthis.sentDefinitions.delete(identifier)\n\t\t}\n\t}\n\n\tasync ensureIdentifier(identifier: ModuleExportIdentifierString): Promise<ModuleExportIdentifierString | undefined> {\n\t\tconst canonicalIdentifier = this.getCanonicalIdentifier(identifier)\n\t\tif (this.definitions.has(canonicalIdentifier)) return canonicalIdentifier\n\n\t\tconst parsed = parseModuleIdentifier(canonicalIdentifier)\n\t\tif (!parsed || !isModuleExportIdentifier(parsed)) return\n\n\t\t// To unblock tests that mock the component loader but don't mock the modules store, we fallback.\n\t\t// TODO: Fix tests to not do this to avoid production forks for test behaviour.\n\t\tif (!this.modulesStore && this.identifiers.has(canonicalIdentifier)) {\n\t\t\tawait this.async.ensureDefinition(canonicalIdentifier)\n\t\t\tif (this.definitions.has(canonicalIdentifier)) return canonicalIdentifier\n\t\t}\n\n\t\tif (isExternalModuleIdentifier(parsed)) {\n\t\t\tassert(this.modulesStore, \"ModulesStore is required for inserting external component presets\")\n\t\t\tawait this.modulesStore.addExternalModulesToProject([parsed], {\n\t\t\t\tonTreeUpdate: noop,\n\t\t\t})\n\t\t}\n\n\t\tif (this.waitForDefinitions) {\n\t\t\tassert(this.componentLoader, \"ComponentLoader is required for loading component definitions\")\n\t\t\tassert(isEditorComponentLoader(this.componentLoader), \"Agent should be running in the editor environment\")\n\t\t\tassert(this.modulesStore, \"ModulesStore is required for loading component definitions\")\n\t\t\tawait waitForLoadingComponentsWithTimeout(this.componentLoader, [canonicalIdentifier], this.modulesStore)\n\t\t}\n\n\t\treturn identifier\n\t}\n\n\t/**\n\t * Resolve an insert sidebar component to a module identifier, adding it to the project\n\t * if not already present. Similar to how VectorSets.insert() and Shaders.insert() work.\n\t */\n\tasync insert(id: ComponentId): Promise<ModuleExportIdentifierString | undefined> {\n\t\tconst identifier = this.getModuleIdentifierForId(id)\n\t\tif (!identifier) return\n\n\t\tif (isSmartComponentNode(this.treeResolver.get(id))) {\n\t\t\tawait this.async.ensureDefinition(identifier)\n\t\t\treturn identifier\n\t\t}\n\n\t\tconst definition = this.definitions.get(identifier)\n\t\tif (definition) return identifier\n\n\t\treturn this.waitForDefinitions ? this.ensureIdentifier(identifier) : identifier\n\t}\n\n\tasync upsertVariable(identifier: ModuleExportIdentifierString, variable: VariableDefinition, llmId?: string) {\n\t\tconst definition = await this.async.ensureDefinition(identifier)\n\t\tif (!definition) return\n\n\t\tconst propertyControl = this.getVariableControl(variable)\n\t\tif (!propertyControl) return\n\n\t\tif (propertyControl.type === ControlType.VectorSetItem) {\n\t\t\tawait this.vectorSets.async.forModuleId(asGlobalId(propertyControl.setModuleId))\n\t\t}\n\n\t\tregisterVariableControl(definition, variable, propertyControl, this.vectorSets, llmId)\n\t}\n\n\tprivate getVariableControl(variable: VariableDefinition): VariableControlDescription | undefined {\n\t\tassert(this.componentLoader, \"Component loader is required when upserting variables\")\n\n\t\treturn serializeVariableControl(variable, this.treeStore.tree, this.componentLoader, ScopeType.SmartComponent)\n\t}\n\n\tprivate hydrateSmartComponentVariables(\n\t\tidentifier: ModuleExportIdentifierString,\n\t\tdefinition: ControlsDefinition,\n\t): void {\n\t\tconst parsed = parseModuleIdentifier(identifier)\n\t\tif (!parsed || isExternalModuleIdentifier(parsed) || parsed.type !== ModuleType.Canvas) return\n\n\t\tconst node = this.treeStore.tree.getNodeWithTrait(parsed.localIdName, isSmartComponentNode)\n\t\tif (!node) return\n\n\t\tfor (const variable of node.variables) {\n\t\t\tconst propertyControl = this.getVariableControl(variable)\n\t\t\tif (!propertyControl) continue\n\t\t\tregisterVariableControl(definition, variable, propertyControl, this.vectorSets)\n\t\t}\n\t}\n\n\tprivate hydrateSmartComponentVariants(\n\t\tidentifier: ModuleExportIdentifierString,\n\t\tdefinition: ControlsDefinition,\n\t): void {\n\t\tconst parsed = parseModuleIdentifier(identifier)\n\t\tif (!parsed || isExternalModuleIdentifier(parsed) || parsed.type !== ModuleType.Canvas) return\n\n\t\tconst node = this.treeStore.tree.getNodeWithTrait(parsed.localIdName, isSmartComponentNode)\n\t\tif (!node?.isLoaded()) return\n\n\t\tconst options: string[] = []\n\t\tfor (const variant of node.getTopLevelVariants()) {\n\t\t\toptions.push(variant.resolveValue(\"name\") ?? variant.id)\n\t\t}\n\n\t\tdefinition.controls[prefixControlPropKey(\"variant\")] = {\n\t\t\ttype: ControlType.Enum,\n\t\t\toptions,\n\t\t\tid: \"variant\",\n\t\t}\n\t\tdefinition.controlPropKeysByControlName.set(\"variant\", \"variant\")\n\t\tdefinition.controlPropNamesByKeys.set(\"variant\", \"variant\")\n\t\tdefinition.properties.variant = { type: ControlType.Enum, options }\n\t}\n\n\tprivate preserveExistingVariableControls(\n\t\texistingDefinition: ControlsDefinition | undefined,\n\t\tnextDefinition: ControlsDefinition,\n\t): void {\n\t\tif (!existingDefinition) return\n\n\t\tfor (const [variableId, controlName] of existingDefinition.controlPropNamesByKeys) {\n\t\t\tconst control = existingDefinition.controls[prefixControlPropKey(controlName)]\n\t\t\tconst property = existingDefinition.properties[variableId]\n\t\t\tif (!control || !property) continue\n\t\t\tif (control.id !== variableId) continue\n\n\t\t\tnextDefinition.controls[prefixControlPropKey(controlName)] = control\n\t\t\tnextDefinition.controlPropNamesByKeys.set(variableId, controlName)\n\t\t\tnextDefinition.properties[variableId] = property\n\n\t\t\tfor (const [alias, id] of existingDefinition.controlPropKeysByControlName) {\n\t\t\t\tif (id === variableId) nextDefinition.controlPropKeysByControlName.set(alias, id)\n\t\t\t}\n\t\t}\n\t}\n\n\tasync updateVariants(smartComponentNode: SmartComponentNode) {\n\t\tconst identifier = smartComponentNode.instanceIdentifier\n\t\tconst definition = this.ensureDefinition(identifier)\n\t\tif (!definition) return\n\n\t\tthis.hydrateSmartComponentVariants(identifier, definition)\n\t}\n\n\tremoveVariable(identifier: ModuleExportIdentifierString, variableId: string) {\n\t\tconst definition = this.definitions.get(identifier)\n\t\tif (!definition) return\n\n\t\tunregisterVariableControl(definition, variableId)\n\t}\n\n\tprompt() {\n\t\tconst { canvas, code, external } = this.componentEntries()\n\n\t\treturn join.lines(\n\t\t\t`<${Components.metadataTag}>`,\n\t\t\t`Each entry has \"id\" (stable component reference for component=\"...\" and componentPreset.<id>) and \"displayName\" (human label).`,\n\t\t\t`### Current Project Components`,\n\t\t\tJSON.stringify(canvas),\n\t\t\t`### ${CURRENT_PROJECT_CODE_COMPONENTS_SECTION_NAME}`,\n\t\t\tJSON.stringify(code),\n\t\t\t`### Current Project External Components`,\n\t\t\tJSON.stringify(external),\n\t\t\t`### Additionally Available Components`,\n\t\t\tJSON.stringify(\n\t\t\t\tArray.from(this.insertComponents, ([id, item]) => ({\n\t\t\t\t\tid,\n\t\t\t\t\tdisplayName: item.name,\n\t\t\t\t\tkeywords: item.keywords,\n\t\t\t\t})),\n\t\t\t),\n\t\t\t`</${Components.metadataTag}>`,\n\t\t)\n\t}\n\n\t/** Returns component entries grouped by type, each with a stable ID for DSL references. */\n\tcomponentEntries() {\n\t\tconst canvasEntries: { id: string; displayName: string }[] = []\n\t\tconst codeFiles: Record<CodeFilePath, { id: string; displayName: string }[]> = {}\n\t\tconst externalEntries: { id: string; displayName: string }[] = []\n\n\t\tassert(this.modulesStore, \"Modules store is required for collecting component names\")\n\t\tconst moduleEntriesByLocalId = new Map<LocalModuleId, ModuleEntry>()\n\t\tfor (const moduleEntry of this.modulesStore.localModules.values()) {\n\t\t\tif (moduleEntry.type !== ModuleType.Code) continue\n\t\t\tconst path = moduleEntry.name\n\t\t\t// Define all code files in the map. We want the map to contain all code files even\n\t\t\t// if they don\u2019t contain any components, so that the model is still able to edit them.\n\t\t\tcodeFiles[path] = []\n\n\t\t\t// Also store the module entry by local ID for a quick lookup\n\t\t\tmoduleEntriesByLocalId.set(moduleEntry.localId, moduleEntry)\n\t\t}\n\n\t\tfor (const identifier of this.componentEntryIdentifiers()) {\n\t\t\tif (!this.hasComponentEntryMetadata(identifier)) continue\n\n\t\t\tconst parsedIdentifier = parseModuleIdentifier(identifier)\n\t\t\tif (!parsedIdentifier) continue\n\t\t\tconst id = this.getIdForModuleIdentifier(identifier)\n\t\t\tif (!id) continue\n\t\t\tconst displayName = this.getDisplayName(identifier)\n\n\t\t\tswitch (parsedIdentifier.kind) {\n\t\t\t\tcase \"localModuleExport\":\n\t\t\t\t\tif (parsedIdentifier.type === ModuleType.Code) {\n\t\t\t\t\t\tconst path = moduleEntriesByLocalId.get(parsedIdentifier.localId)?.name\n\t\t\t\t\t\tassert(path, \"A component found in component context must have an associated file\")\n\n\t\t\t\t\t\tconst codeFileComponents = codeFiles[path]\n\t\t\t\t\t\tassert(codeFileComponents, \"The code file must have been initialized earlier\")\n\n\t\t\t\t\t\tcodeFileComponents.push({ id, displayName })\n\t\t\t\t\t} else if (parsedIdentifier.type === ModuleType.Canvas) {\n\t\t\t\t\t\tcanvasEntries.push({ id, displayName })\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\tcase \"externalModuleExport\":\n\t\t\t\t\texternalEntries.push({ id, displayName })\n\t\t\t\t\tcontinue\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(parsedIdentifier, \"Unknown module type\")\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcanvas: canvasEntries,\n\t\t\tcode: codeFiles,\n\t\t\texternal: externalEntries,\n\t\t} as const\n\t}\n\n\tprivate *componentEntryIdentifiers(): IterableIterator<ModuleExportIdentifierString> {\n\t\tfor (const identifier of this.identifiers) {\n\t\t\tyield identifier\n\t\t}\n\n\t\tfor (const identifier of this.definitions.keys()) {\n\t\t\tif (this.identifiers.has(identifier)) continue\n\t\t\tyield identifier\n\t\t}\n\t}\n\n\tprivate hasComponentEntryMetadata(identifier: ModuleExportIdentifierString): boolean {\n\t\tconst canonicalIdentifier = this.getCanonicalIdentifier(identifier)\n\t\tif (this.definitions.has(canonicalIdentifier)) return true\n\t\treturn Boolean(this.componentLoader?.componentForIdentifier(canonicalIdentifier))\n\t}\n\n\tcomponentDefinitionsFromSelectionPrompt(): string[] {\n\t\tconst messages: string[] = []\n\n\t\tfor (const identifier of this.definitions.keys()) {\n\t\t\tconst definition = this.ensureDefinition(identifier)\n\t\t\tif (!definition || this.sentDefinitions.has(identifier)) continue\n\n\t\t\tconst id = this.getIdForModuleIdentifier(identifier)\n\t\t\tif (!id) continue\n\n\t\t\tthis.sentDefinitions.add(identifier)\n\n\t\t\tmessages.push(\n\t\t\t\tjoin.lines(\n\t\t\t\t\t`<${Components.definitionTag} id=\"${id}\" displayName=\"${this.getDisplayName(identifier)}\">`,\n\t\t\t\t\tJSON.stringify({ controls: definition.controls }),\n\t\t\t\t\t`</${Components.definitionTag}>`,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\treturn messages\n\t}\n\n\t/**\n\t * Given a Component ID, return the component definition with the display name.\n\t */\n\tasync definitionForId(id: string): Promise<ComponentDefinitionResult | undefined> {\n\t\tconst identifier = this.getModuleIdentifierForId(id)\n\t\tif (!identifier) return\n\n\t\tconst definition = await this.async.ensureDefinition(identifier)\n\t\tif (!definition) return\n\n\t\tthis.sentDefinitions.add(identifier)\n\n\t\treturn {\n\t\t\tid,\n\t\t\tdisplayName: this.getDisplayName(identifier),\n\t\t\tcontrols: definition.controls,\n\t\t}\n\t}\n\n\tprivate loadDefinition(identifier: ModuleExportIdentifierString): Promise<ControlsDefinition | undefined> {\n\t\tconst existingPromise = this.pendingDefinitions.get(identifier)\n\t\tif (existingPromise) return existingPromise\n\n\t\tconst promise = this.async.ensureDefinition(identifier).finally(() => {\n\t\t\tif (this.pendingDefinitions.get(identifier) === promise) this.pendingDefinitions.delete(identifier)\n\t\t})\n\n\t\tthis.pendingDefinitions.set(identifier, promise)\n\n\t\treturn promise\n\t}\n\n\tprivate ensureDefinition(identifier: ModuleExportIdentifierString): ControlsDefinition | undefined {\n\t\tconst canonicalIdentifier = this.getCanonicalIdentifier(identifier)\n\t\tconst existingDefinition = this.definitions.get(canonicalIdentifier)\n\n\t\tconst info = this.componentLoader?.componentForIdentifier(canonicalIdentifier)\n\t\tif (!info) return existingDefinition\n\n\t\tconst presetControlKeys = getComponentPresetControlKeys(info)\n\n\t\tconst properties = { ...info.properties }\n\t\tconst controlsDefinition = buildModuleControlDefinitions(\n\t\t\tproperties,\n\t\t\tthis.vectorSets,\n\t\t\t(control, _prefixedTitle, _source, controlKey) =>\n\t\t\t\twithPresetOnlyMetadata(control, presetControlKeys.has(controlKey)),\n\t\t)\n\n\t\tthis.hydrateSmartComponentVariables(canonicalIdentifier, controlsDefinition)\n\t\tthis.hydrateSmartComponentVariants(canonicalIdentifier, controlsDefinition)\n\t\tthis.preserveExistingVariableControls(existingDefinition, controlsDefinition)\n\n\t\tif (existingDefinition && !componentDefinitionsEqual(existingDefinition, controlsDefinition)) {\n\t\t\tthis.sentDefinitions.delete(canonicalIdentifier)\n\t\t}\n\n\t\tthis.definitions.set(canonicalIdentifier, controlsDefinition)\n\n\t\treturn controlsDefinition\n\t}\n\n\tstatic async fromTree(\n\t\ttreeResolver: TreeResolver,\n\t\ttreeStore: TreeStore,\n\t\tmodulesStore: ModulesStore,\n\t\tvectorSets: VectorSets,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdeferred: DeferredOps,\n\t\toptions?: ComponentsOptions,\n\t) {\n\t\tconst identifiers = new Set<ModuleExportIdentifierString>()\n\n\t\tfor (const child of treeStore.tree.root.children) {\n\t\t\tif (isSmartComponentNode(child)) {\n\t\t\t\tidentifiers.add(child.instanceIdentifier)\n\t\t\t}\n\t\t}\n\n\t\tconst externalModules = ExternalModulesListNode.getModuleNodes(treeStore.tree)\n\t\tconst modulesToPreload: ExternalModuleExportIdentifier[] = []\n\n\t\tfor (const child of externalModules) {\n\t\t\tif (child.type !== ModuleType.Canvas && child.type !== ModuleType.Code) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst codeComponentIdentifier: string | undefined = child.codeComponentIdentifier\n\t\t\tconst parsedIdentifier = parseModuleIdentifier(codeComponentIdentifier)\n\t\t\tif (!parsedIdentifier || !isModuleExportIdentifier(parsedIdentifier)) continue\n\n\t\t\tidentifiers.add(parsedIdentifier.value)\n\n\t\t\t// The component instance may not be evaluated yet, so we need to preload the external\n\t\t\t// module to ensure we can extract the component definition.\n\t\t\tif (parsedIdentifier.kind === \"externalModuleExport\") {\n\t\t\t\tmodulesToPreload.push(parsedIdentifier)\n\t\t\t}\n\t\t}\n\n\t\tconst failedPreloadIdentifiers = await preloadExternalModulesForAgent(\n\t\t\tmodulesStore,\n\t\t\tmodulesToPreload,\n\t\t\toptions?.externalModulePreloadTimeoutMs ?? EXTERNAL_MODULE_PRELOAD_TIMEOUT_MS,\n\t\t)\n\t\tfor (const failedIdentifier of failedPreloadIdentifiers) identifiers.delete(failedIdentifier)\n\n\t\tassert(isEditorComponentLoader(componentLoader), \"Agent should be running in the editor environment\")\n\t\tfor (const identifier of getLocalCodeComponentIdentifiers(modulesStore, componentLoader)) {\n\t\t\tidentifiers.add(identifier)\n\t\t}\n\t\tif (shouldWaitForDefinitions(options)) {\n\t\t\tconst identifiersToWaitFor: ModuleExportIdentifierString[] = []\n\t\t\tfor (const identifier of identifiers) {\n\t\t\t\tif (failedPreloadIdentifiers.has(identifier)) continue\n\t\t\t\tidentifiersToWaitFor.push(identifier)\n\t\t\t}\n\t\t\t// Tolerate unresolved modules \u2014 downstream `componentForIdentifier`\n\t\t\t// checks gracefully skip identifiers without a definition. Throwing\n\t\t\t// here aborted the entire agent context (e.g. readProjectForAgent,\n\t\t\t// applyAgentChanges) for projects that reference any single broken\n\t\t\t// external module.\n\t\t\ttry {\n\t\t\t\tawait waitForLoadingComponentsWithTimeout(componentLoader, identifiersToWaitFor, modulesStore)\n\t\t\t} catch (error) {\n\t\t\t\tlog.warn(\"waitForLoadingComponentsWithTimeout failed; continuing with partial component context\", error)\n\t\t\t}\n\t\t}\n\n\t\treturn Components.fromIdentifiers(\n\t\t\tidentifiers,\n\t\t\ttreeResolver,\n\t\t\ttreeStore,\n\t\t\tvectorSets,\n\t\t\tcomponentLoader,\n\t\t\tdeferred,\n\t\t\tmodulesStore,\n\t\t\toptions,\n\t\t)\n\t}\n\n\tstatic async fromIdentifiers(\n\t\tidentifiers: Set<ModuleExportIdentifierString>,\n\t\ttreeResolver: TreeResolver,\n\t\ttreeStore: TreeStore,\n\t\tvectorSets: VectorSets,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tdeferred: DeferredOps,\n\t\tmodulesStore?: ModulesStore,\n\t\toptions: ComponentsOptions = {},\n\t) {\n\t\tconst definitions = new Map<ModuleExportIdentifierString, Definition>()\n\t\tconst insertComponents = modulesStore\n\t\t\t? await buildInsertComponentMapDedupingProjectModules(identifiers, modulesStore)\n\t\t\t: buildInsertComponentMap()\n\t\tconst components = new Components(\n\t\t\ttreeResolver,\n\t\t\ttreeStore,\n\t\t\tvectorSets,\n\t\t\tdeferred,\n\t\t\tcomponentLoader,\n\t\t\tmodulesStore,\n\t\t\tdefinitions,\n\t\t\tshouldWaitForDefinitions(options),\n\t\t\tinsertComponents,\n\t\t\tnew Set(identifiers),\n\t\t)\n\n\t\treturn components\n\t}\n}\n\nfunction mapToRecord<Value>(map: ReadonlyMap<string, Value>): Record<string, Value> {\n\tconst record: Record<string, Value> = {}\n\tfor (const [key, value] of map) {\n\t\trecord[key] = value\n\t}\n\n\treturn record\n}\n\nfunction recordToMap<Value>(record: Record<string, Value>): Map<string, Value> {\n\tconst map = new Map<string, Value>()\n\tfor (const [key, value] of Object.entries(record)) {\n\t\tmap.set(key, value)\n\t}\n\n\treturn map\n}\n\nfunction componentDefinitionToJSON(definition: Definition): JSON<Definition> {\n\treturn {\n\t\t...definition,\n\t\tcontrolPropKeysByControlName: mapToRecord(definition.controlPropKeysByControlName),\n\t\tcontrolPropNamesByKeys: mapToRecord(definition.controlPropNamesByKeys),\n\t}\n}\n\nfunction componentDefinitionsEqual(left: Definition, right: Definition): boolean {\n\treturn JSON.stringify(componentDefinitionToJSON(left)) === JSON.stringify(componentDefinitionToJSON(right))\n}\n\nfunction componentDefinitionFromJSON(definition: JSON<Definition>): Definition {\n\treturn {\n\t\t...definition,\n\t\tcontrolPropKeysByControlName: recordToMap(definition.controlPropKeysByControlName),\n\t\tcontrolPropNamesByKeys: recordToMap(definition.controlPropNamesByKeys),\n\t}\n}\n\nfunction getInsertSidebarSources() {\n\t// Build all sources regardless of experiment\n\treturn [\n\t\tgetInteractiveItems(false),\n\t\tgetMediaItems(false),\n\t\tgetFormItems(false),\n\t\tsocialItems,\n\t\tgetUtilityItems(false),\n\t\tgetCreativeItems(false),\n\t] as const\n}\n\nexport function collectInsertSidebarModuleItems(\n\tnormalizeForCurrentEnvironment: boolean = true,\n): InsertComponentMapItem[] {\n\tconst items: InsertComponentMapItem[] = []\n\n\tfor (const source of getInsertSidebarSources()) {\n\t\tfor (const entry of source) {\n\t\t\tif (isDataSourceSection(entry)) {\n\t\t\t\tfor (const item of entry.items) {\n\t\t\t\t\tif (hasGenerateNodes(item) || !hasModuleURL(item)) continue\n\t\t\t\t\titems.push(item)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (hasGenerateNodes(entry) || !hasModuleURL(entry)) continue\n\t\t\t\titems.push(entry)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn items.map(item => (normalizeForCurrentEnvironment ? normalizeModuleURLItemForCurrentEnvironment(item) : item))\n}\n\n/**\n * Create a Map of GlobalModuleId to { name, keywords } for all items in the insert sidebar.\n */\nfunction buildInsertComponentMap(\n\titems: readonly InsertComponentMapItem[] = collectInsertSidebarModuleItems(),\n\trawItems: readonly InsertComponentMapItem[] = collectInsertSidebarModuleItems(false),\n): Map<GlobalModuleId, InsertComponentItem> {\n\tassert(items.length === rawItems.length, \"Insert component items must stay aligned\")\n\tconst result = new Map<GlobalModuleId, InsertComponentItem>()\n\n\tfor (let index = 0; index < items.length; index++) {\n\t\tconst item = items[index]\n\t\tconst rawItem = rawItems[index]\n\t\tassert(item && rawItem, \"Insert component items must stay aligned\")\n\n\t\tconst identifier = getModuleIdentifierForItem(item)\n\t\tif (!identifier) continue\n\n\t\tresult.set(identifier.moduleId, { name: item.title, keywords: item.keywords, identifier: identifier.value })\n\t}\n\n\treturn result\n}\n\nasync function buildInsertComponentMapDedupingProjectModules(\n\tidentifiers: Iterable<ModuleExportIdentifierString>,\n\tmodulesStore: ModulesStore,\n): Promise<Map<GlobalModuleId, InsertComponentItem>> {\n\tconst projectModuleIds = getProjectExternalModuleIds(identifiers)\n\tconst items = collectInsertSidebarModuleItems()\n\tconst rawItems = collectInsertSidebarModuleItems(false)\n\n\tconst itemsNeedingLookup: {\n\t\titem: InsertComponentMapItem\n\t\trawItem: InsertComponentMapItem\n\t}[] = []\n\tconst filteredItems: InsertComponentMapItem[] = []\n\tconst filteredRawItems: InsertComponentMapItem[] = []\n\n\tfor (let index = 0; index < items.length; index++) {\n\t\tconst item = items[index]\n\t\tconst rawItem = rawItems[index]\n\t\tassert(item && rawItem, \"Insert component items must stay aligned\")\n\n\t\tconst moduleId = item.module?.id ? asGlobalId(item.module.id) : undefined\n\t\tif (moduleId) {\n\t\t\tif (projectModuleIds.has(moduleId)) continue\n\t\t\tfilteredItems.push(item)\n\t\t\tfilteredRawItems.push(rawItem)\n\t\t\tcontinue\n\t\t}\n\n\t\titemsNeedingLookup.push({ item, rawItem })\n\t}\n\n\tif (itemsNeedingLookup.length === 0) {\n\t\treturn buildInsertComponentMap(filteredItems, filteredRawItems)\n\t}\n\n\ttry {\n\t\tconst { modules } = await modulesStore.lookUpModules(\n\t\t\titemsNeedingLookup.map(({ rawItem }) => getLookupQueryForModuleComponent(rawItem)),\n\t\t)\n\t\tif (modules.length !== itemsNeedingLookup.length) {\n\t\t\treturn buildInsertComponentMap(items, rawItems)\n\t\t}\n\n\t\titemsNeedingLookup.forEach(({ item }, index) => {\n\t\t\tconst module = modules[index]\n\t\t\tconst rawItem = itemsNeedingLookup[index]?.rawItem\n\t\t\tassert(rawItem, \"Insert component items must stay aligned\")\n\t\t\tif (!module) {\n\t\t\t\tfilteredItems.push(item)\n\t\t\t\tfilteredRawItems.push(rawItem)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (projectModuleIds.has(asGlobalId(module.id))) return\n\t\t\tfilteredItems.push({ ...item, module })\n\t\t\tfilteredRawItems.push(rawItem)\n\t\t})\n\t} catch (error) {\n\t\tlog.warn(\"Failed to look up insert component modules for project dedupe\", error)\n\t\treturn buildInsertComponentMap(items, rawItems)\n\t}\n\n\treturn buildInsertComponentMap(filteredItems, filteredRawItems)\n}\n\nfunction getProjectExternalModuleIds(identifiers: Iterable<ModuleExportIdentifierString>): Set<GlobalModuleId> {\n\tconst moduleIds = new Set<GlobalModuleId>()\n\tfor (const identifier of identifiers) {\n\t\tconst parsedIdentifier = parseModuleIdentifier(identifier)\n\t\tif (!parsedIdentifier || !isModuleExportIdentifier(parsedIdentifier)) continue\n\t\tif (!isExternalModuleIdentifier(parsedIdentifier)) continue\n\t\tmoduleIds.add(parsedIdentifier.moduleId)\n\t}\n\n\treturn moduleIds\n}\n", "{\"Analytics\":{\"id\":\"AnalyticsGuide1\",\"name\":\"Analytics\",\"template\":\"# Analytics\\n\\n`api.analytics.query(sql, { from, to })` takes ClickHouse-flavored SQL plus a `{ from, to }` range of `Date` objects and returns an array of row objects. `to` is optional and defaults to now. The runtime applies the `timestamp` filter from the range \u2014 do not filter on `timestamp` in the SQL.\\n\\n## Table: `events_v2`\\n\\n- `timestamp` (DateTime64) \u2014 event time, UTC\\n- `eventType` \u2014 one of:\\n  - `pageview` \u2014 page view\\n  - `click` \u2014 link/button click\\n  - `form_submit` \u2014 form submission\\n  - `trigger_invoke` \u2014 automatic/programmatic trigger (not a direct user interaction). Exclude these when computing engagement metrics like bounce rate.\\n  - `custom` \u2014 custom event from the tracking API\\n- `pathname` (string) \u2014 URL path\\n- `routePath` (string) \u2014 internal route, not for public display. Only use it to detect 404s: a 404 pageview has `routePath IN ('/404', '/404/', '/404.html')`.\\n- `hostname` (string)\\n- `href` (string) \u2014 on `click` events: the URL of the link or button target.\\n- `trackingId` (string) \u2014 optional user-defined identifier on non-`pageview` events (e.g. a button name).\\n- `referrer` (string) \u2014 normalized referrer (host + path, trailing slash trimmed; same-site referrers wiped to empty). Use this for aggregation.\\n- `originalReferrer` (string) \u2014 raw referrer URL with protocol and query intact. Use this when you need to display or link to the source.\\n- `device`, `browser`, `os`, `locale`, `framerLocale`, `countryCode` (strings)\\n- `dailyVisitorIdHash` (uint64) \u2014 use with `uniq()` for unique-visitor counts\\n- `utmSource`, `utmMedium`, `utmCampaign`, `utmTerm`, `utmContent` (strings)\\n\\n`referrer`, `originalReferrer`, and the `utm*` fields are typically only populated on the visitor's first pageview of a session \u2014 subsequent pageviews carry empty strings. Non-pageview events (`click`, `form_submit`, `trigger_invoke`, `custom`) inherit these fields from the originating pageview, so you can attribute interactions to a referrer or campaign without joining.\\n\\n## Rules\\n\\n- Pass the time range as `from`/`to` `Date` objects, never in SQL. Omit `to` for \\\"up to now\\\".\\n- Aggregate in SQL (`count()`, `uniq()`, `countIf()`, `GROUP BY`) with `LIMIT`. Never `SELECT *`.\\n- Project only the columns you need.\\n- Combine related metrics into one query with `WITH` instead of running multiple `api.analytics.query` calls.\\n- Return row sets via `api.paginate(rows)` when they exceed a few dozen entries.\\n- Always `return` a value from the script.\\n\\n## Examples\\n\\n### Top pages, last 30 days\\n\\nThe canonical breakdown shape \u2014 `GROUP BY` + `ORDER BY` + `LIMIT`, then paginate. Swap `pathname` for `device`, `countryCode`, `utmSource`, etc. for other breakdowns.\\n\\n```js\\nconst from = new Date(Date.now() - 30 * 86400000)\\nconst rows = await api.analytics.query(\\n    `SELECT pathname,\\n            count() AS pageviews,\\n            uniq(dailyVisitorIdHash) AS visitors\\n     FROM events_v2\\n     WHERE eventType = 'pageview'\\n     GROUP BY pathname\\n     ORDER BY pageviews DESC\\n     LIMIT 100`,\\n    { from },\\n)\\nreturn api.paginate(rows)\\n```\\n\\n### Top referrers (with a representative URL)\\n\\nGroup by the normalized `referrer` for clean aggregation; pull a representative `originalReferrer` with `any()` so you can display or link to the source. Pass an explicit `to` to query a fixed historical window instead of \\\"up to now\\\".\\n\\n```js\\nconst from = new Date(\\\"2026-03-01T00:00:00Z\\\")\\nconst to = new Date(\\\"2026-04-01T00:00:00Z\\\")\\nconst rows = await api.analytics.query(\\n    `SELECT referrer,\\n            any(originalReferrer) AS exampleUrl,\\n            count() AS pageviews\\n     FROM events_v2\\n     WHERE eventType = 'pageview'\\n       AND referrer != ''\\n     GROUP BY referrer\\n     ORDER BY pageviews DESC\\n     LIMIT 50`,\\n    { from, to },\\n)\\nreturn api.paginate(rows)\\n```\\n\\n### Site KPIs in one query via WITH\\n\\nUse a `WITH` clause to define a shared filtered view, then compute multiple metrics in a single pass \u2014 including session-derived metrics like session count and average session duration (a session is a contiguous run of events from the same visitor with no >30-minute gap).\\n\\n```js\\nconst from = new Date(Date.now() - 7 * 86400000)\\nconst [row] = await api.analytics.query(\\n    `WITH\\n        recent AS (\\n            SELECT dailyVisitorIdHash, eventType, timestamp,\\n                   lagInFrame(timestamp) OVER w AS prevTs\\n            FROM events_v2\\n            WINDOW w AS (PARTITION BY dailyVisitorIdHash ORDER BY timestamp)\\n        ),\\n        tagged AS (\\n            SELECT *,\\n                   if(prevTs = toDateTime64(0, 3) OR dateDiff('second', prevTs, timestamp) > 1800, 1, 0) AS isSessionStart\\n            FROM recent\\n        ),\\n        sessions AS (\\n            SELECT dailyVisitorIdHash,\\n                   sum(isSessionStart) OVER (PARTITION BY dailyVisitorIdHash ORDER BY timestamp) AS sessionId,\\n                   timestamp\\n            FROM tagged\\n        ),\\n        sessionDurations AS (\\n            SELECT dateDiff('second', min(timestamp), max(timestamp)) AS durationSeconds\\n            FROM sessions\\n            GROUP BY dailyVisitorIdHash, sessionId\\n        )\\n    SELECT\\n        (SELECT uniq(dailyVisitorIdHash) FROM recent) AS visitors,\\n        (SELECT countIf(eventType = 'pageview') FROM recent) AS pageviews,\\n        (SELECT countIf(eventType = 'click') FROM recent) AS clicks,\\n        (SELECT countIf(eventType = 'form_submit') FROM recent) AS formSubmits,\\n        (SELECT count() FROM sessionDurations) AS sessions,\\n        (SELECT avg(durationSeconds) FROM sessionDurations) AS avgSessionDurationSeconds`,\\n    { from },\\n)\\nreturn row\\n```\\n\\n### Bounce rate, last 7 days\\n\\nA bounce is a session with a single event. Detect session starts and ends with lead/lag window functions over a 30-minute gap, then `avg(isSessionStart AND isSessionEnd)` over session-start rows gives the bounce rate. Exclude `trigger_invoke` so automatic triggers don't artificially turn single-event sessions into multi-event ones.\\n\\n```js\\nconst from = new Date(Date.now() - 7 * 86400000)\\nconst [row] = await api.analytics.query(\\n    `WITH edges AS (\\n        SELECT\\n            if(lagInFrame(timestamp) OVER w = toDateTime64(0, 3) OR\\n               dateDiff('second', lagInFrame(timestamp) OVER w, timestamp) > 1800, 1, 0) AS isSessionStart,\\n            if(leadInFrame(timestamp) OVER w = toDateTime64(0, 3) OR\\n               dateDiff('second', timestamp, leadInFrame(timestamp) OVER w) > 1800, 1, 0) AS isSessionEnd\\n        FROM events_v2\\n        WHERE eventType != 'trigger_invoke'\\n        WINDOW w AS (\\n            PARTITION BY dailyVisitorIdHash\\n            ORDER BY timestamp\\n            ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING\\n        )\\n    )\\n    SELECT avg(isSessionStart AND isSessionEnd) AS bounceRate\\n    FROM edges\\n    WHERE isSessionStart`,\\n    { from },\\n)\\nreturn row\\n```\\n\\n### Top 404 pages, last 30 days\\n\\nDetect 404s via `routePath`, then report the `pathname` the visitor actually requested.\\n\\n```js\\nconst from = new Date(Date.now() - 30 * 86400000)\\nconst rows = await api.analytics.query(\\n    `SELECT pathname,\\n            count() AS hits,\\n            uniq(dailyVisitorIdHash) AS visitors\\n     FROM events_v2\\n     WHERE eventType = 'pageview'\\n       AND routePath IN ('/404', '/404/', '/404.html')\\n     GROUP BY pathname\\n     ORDER BY hits DESC\\n     LIMIT 100`,\\n    { from },\\n)\\nreturn api.paginate(rows)\\n```\\n\",\"projectId\":\"AnalyticsGuideProj\"},\"Buttons\":{\"id\":\"GTFSgYv4R\",\"name\":\"Buttons\",\"template\":\"# Buttons\\n\\nButtons in Framer are made using Stacks, with the Width and Height properties often set to Fit Content. Buttons can have text, text with icon, or be icon-only.\\n\\n---\\n\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Button\\\",\\\"id\\\":\\\"bjr3m6ATZ\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgba(255,255,255,1)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px 12px 10px 12px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"45.05%\\\",\\\"centerAnchorY\\\":\\\"17.82%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"S_eVMi59p\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(0, 0, 0)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:S_eVMi59p:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:S_eVMi59p:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Get started\\\"}}]}]}]}]\\n```\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Button\\\",\\\"id\\\":\\\"Gi8UfiMpo\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.08)\\\",\\\"fill\\\":\\\"linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.1) 100%)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px 12px 10px 12px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"135px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"45.05%\\\",\\\"centerAnchorY\\\":\\\"17.82%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"YCjzhoIV3\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:YCjzhoIV3:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:YCjzhoIV3:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Learn more\\\"}}]}]},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"FYRtjjMJC\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Chevron Right\\\",\\\"attributes\\\":{\\\"$control__width\\\":\\\"3\\\",\\\"$control__color\\\":\\\"rgb(255, 255, 255)\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"12px\\\",\\\"height\\\":\\\"16px\\\"}}]}]\\n```\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Button\\\",\\\"id\\\":\\\"KPumAcJ8K\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.08)\\\",\\\"fill\\\":\\\"linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.1) 100%)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"135px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"45.05%\\\",\\\"centerAnchorY\\\":\\\"17.82%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"40px\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"P8Xqou6Wh\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Arrow Down\\\",\\\"attributes\\\":{\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(255, 255, 255)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"12px\\\"}}]}]\\n```\\n\\n---\\n\\n## Buttons with Links\\n\\nWhen applying links to (call-to-action) buttons, apply the link to the parent Stack, not the text layer (label) within.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Button\\\",\\\"id\\\":\\\"Wz2KenoFS\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgba(255,255,255,1)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px 12px 10px 12px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"45.05%\\\",\\\"centerAnchorY\\\":\\\"17.82%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"BEU_7a8WU\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(0, 0, 0)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:BEU_7a8WU:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:BEU_7a8WU:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Get started\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n## Active states\\n\\nHover and Pressed can be done using Effects. Use scale sparingly, and only on small elements.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Button\\\",\\\"id\\\":\\\"rv6HajQHo\\\",\\\"attributes\\\":{\\\"cursor\\\":\\\"pointer\\\",\\\"fill\\\":\\\"rgba(255,255,255,1)\\\",\\\"hoverEffect\\\":{\\\"opacity\\\":0.5,\\\"x\\\":\\\"0px\\\",\\\"y\\\":\\\"0px\\\",\\\"scale\\\":1,\\\"skewX\\\":\\\"0deg\\\",\\\"skewY\\\":\\\"0deg\\\",\\\"transition\\\":\\\"spring-duration 0.4s 0.2 0s\\\",\\\"rotate\\\":\\\"0deg\\\"},\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px 12px 10px 12px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"45.05%\\\",\\\"centerAnchorY\\\":\\\"17.82%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"TNT1BAsHS\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(0, 0, 0)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:TNT1BAsHS:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:TNT1BAsHS:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Hover me\\\"}}]}]}]}]\\n```\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Button\\\",\\\"id\\\":\\\"Q2NgNDzm7\\\",\\\"attributes\\\":{\\\"cursor\\\":\\\"pointer\\\",\\\"fill\\\":\\\"rgba(255,255,255,1)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px 12px 10px 12px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"45.05%\\\",\\\"centerAnchorY\\\":\\\"17.82%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"tapEffect\\\":{\\\"opacity\\\":1,\\\"x\\\":\\\"0px\\\",\\\"y\\\":\\\"0px\\\",\\\"scale\\\":0.9,\\\"skewX\\\":\\\"0deg\\\",\\\"skewY\\\":\\\"0deg\\\",\\\"transition\\\":\\\"spring-duration 0.4s 0.2 0s\\\",\\\"rotate\\\":\\\"0deg\\\"}},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"waLQFjA3Z\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(0, 0, 0)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:waLQFjA3Z:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:waLQFjA3Z:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Press me\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n## Components\\n\\nSometimes buttons need to contain multiple variants or require more complex hover/pressed states. For Button Components, it is key that we make the Link property a Variable within, so we can assign the Link property on the Button Instances, making sure each Button can have its own link.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Button Group\\\",\\\"id\\\":\\\"MOYw6OaHM\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"hidden\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"11.58%\\\",\\\"centerAnchorY\\\":\\\"75.75%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"ahITUye6z\\\",\\\"component\\\":\\\"vCz2HuwlY\\\",\\\"$componentDisplayName\\\":\\\"Button\\\",\\\"attributes\\\":{\\\"$control__title\\\":\\\"Get started\\\",\\\"$control__variant\\\":\\\"Primary\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"35px\\\"}},{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"PjrnqVR0H\\\",\\\"component\\\":\\\"vCz2HuwlY\\\",\\\"$componentDisplayName\\\":\\\"Button\\\",\\\"attributes\\\":{\\\"$control__title\\\":\\\"Watch video\\\",\\\"$control__variant\\\":\\\"Secondary\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"35px\\\"}}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"ComponentNode\\\",\\\"id\\\":\\\"vCz2HuwlY\\\",\\\"name\\\":\\\"Button\\\",\\\"variables\\\":[{\\\"key\\\":\\\"$control__title\\\",\\\"id\\\":\\\"THxExqlo_\\\",\\\"name\\\":\\\"Title\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\",\\\"initialValue\\\":\\\"Get started\\\"},{\\\"set\\\":\\\"Mage\\\",\\\"initialValue\\\":\\\"Compass\\\",\\\"key\\\":\\\"$control__icon\\\",\\\"id\\\":\\\"eUxN4Da_p\\\",\\\"name\\\":\\\"Icon\\\",\\\"node\\\":\\\"IconVariable\\\",\\\"type\\\":\\\"icon\\\"},{\\\"key\\\":\\\"$control__link\\\",\\\"id\\\":\\\"ELV9HeCyL\\\",\\\"name\\\":\\\"Link\\\",\\\"node\\\":\\\"LinkVariable\\\",\\\"type\\\":\\\"link\\\"}],\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Primary\\\",\\\"id\\\":\\\"kfJCpI0PO\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgba(255,255,255,1)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"link\\\":{\\\"href\\\":\\\"var(--variable-ELV9HeCyL)\\\"},\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px 12px 10px 6px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"45.05%\\\",\\\"centerAnchorY\\\":\\\"17.82%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"35px\\\",\\\"transition\\\":\\\"spring-duration 0.4s 0.2 0s\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"ecMkwzwHT\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"var(--variable-eUxN4Da_p)\\\",\\\"attributes\\\":{\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(0, 0, 0)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"16px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"CLW5WBdYq\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-THxExqlo_)\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(0, 0, 0)\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Secondary\\\",\\\"id\\\":\\\"dZlGLqxGj\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.08)\\\",\\\"fill\\\":\\\"linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.1) 100%)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"link\\\":{\\\"href\\\":\\\"var(--variable-ELV9HeCyL)\\\"},\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px 12px 10px 6px\\\",\\\"left\\\":\\\"202.5px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"45.05%\\\",\\\"centerAnchorY\\\":\\\"17.82%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"35px\\\"}}]}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"CMS Collection Lists\":{\"id\":\"Usk4QEJ61\",\"name\":\"CMS Collection Lists\",\"template\":\"```context\\n{\\\"type\\\":\\\"WebPageNode\\\",\\\"variables\\\":[{\\\"key\\\":\\\"$control__title\\\",\\\"id\\\":\\\"WMPkUsfHh\\\",\\\"name\\\":\\\"Title\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\",\\\"queryParam\\\":\\\"title\\\"},{\\\"key\\\":\\\"$control__category\\\",\\\"id\\\":\\\"IqUiHHMdZ\\\",\\\"name\\\":\\\"Category\\\",\\\"node\\\":\\\"CollectionReferenceVariable\\\",\\\"type\\\":\\\"single\\\",\\\"collection\\\":\\\"Categories\\\",\\\"queryParam\\\":\\\"category\\\"},{\\\"key\\\":\\\"$control__sponsoredOptional\\\",\\\"id\\\":\\\"knso73jnG\\\",\\\"name\\\":\\\"Sponsored (Optional)\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"boolean\\\",\\\"queryParam\\\":\\\"sponsored-(optional)\\\"},{\\\"key\\\":\\\"$control__categories\\\",\\\"id\\\":\\\"dzAb4G38k\\\",\\\"name\\\":\\\"Categories\\\",\\\"node\\\":\\\"CollectionReferenceVariable\\\",\\\"type\\\":\\\"multi\\\",\\\"collection\\\":\\\"Categories\\\",\\\"queryParam\\\":\\\"categories\\\"},{\\\"key\\\":\\\"$control__sponsored\\\",\\\"id\\\":\\\"lWpMlx0He\\\",\\\"name\\\":\\\"Sponsored\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"boolean\\\",\\\"initialValue\\\":false,\\\"queryParam\\\":\\\"sponsored\\\"}]}\\n```\\n# CMS Collection Lists\\n\\nFor pages and sections that are primarily content-driven, such as a list of blog posts, articles, updates or a changelog, personal resumes, documentation, and more, use of the Framer CMS is preferred. Framer can then render a Collection List on the page, which can be customized using Fields from the Collection List and Styles, while keeping the content editable inside the CMS (Content Management System). Each item in such a list then links to a Detail Page with the full content, like a blog post or article.\\n\\n---\\n\\n## Content List\\n\\nA collection list can be rendered similar to an image list, with a thumbnail image, title, and date. Using conditions, we can render a line that only appears in between list items, so after the first item and above the last. Critically, all content must always be placed within the Repeated Item, so that we may assign variables (fields) like Content, Date, and Images.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"JT8G3K9rL\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"0px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"258%\\\",\\\"constraintsLocked\\\":false,\\\"collectionList\\\":{\\\"collection\\\":\\\"Posts\\\",\\\"repeatedDescendantId\\\":\\\"N3nn9c2vX\\\",\\\"limit\\\":\\\"10\\\"},\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"dKhAccar9\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Line\\\",\\\"id\\\":\\\"K52079H3u\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(34, 34, 34)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\",\\\"visible\\\":{\\\"from\\\":\\\"var(--variable-m4Zd_Pcp9-item-index)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":1},{\\\"name\\\":\\\"negate\\\"}]},\\\"zIndex\\\":\\\"1\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"ppMtOtje4\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"QLKgiZYLp\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"var(--variable-Oafv3y8lc)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"5px\\\",\\\"width\\\":\\\"30px\\\",\\\"height\\\":\\\"30px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"aU7pyWKUo\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n## Collection References\\n\\nFields in collections can reference other collections, which is useful for things like categories or authors.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"tPy8Ae7FV\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"20px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"483%\\\",\\\"constraintsLocked\\\":false,\\\"collectionList\\\":{\\\"collection\\\":\\\"Posts\\\",\\\"repeatedDescendantId\\\":\\\"CHWU63NrU\\\",\\\"limit\\\":\\\"10\\\"},\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"Bd_wOU1Wq\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"uaZj39yXy\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"yO7uale6L\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"var(--variable-Oafv3y8lc)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"50px\\\",\\\"height\\\":\\\"40px\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"thk5Z026M\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"m6F8SNpxb\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"lokjGY2sj\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"5px\\\",\\\"position\\\":\\\"relative\\\",\\\"collectionList\\\":{\\\"collection\\\":\\\"Categories\\\",\\\"repeatedDescendantId\\\":\\\"C3MrPa01M\\\",\\\"filters\\\":[{\\\"variableId\\\":\\\"id\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"isIncludedIn\\\",\\\"value\\\":\\\"var(--variable-XBpxg9OhV)\\\"}]}],\\\"filtersOperator\\\":\\\"and\\\"},\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"C3MrPa01M\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"X0kbuWIol\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":20,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"4px 6px 4px 6px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"40px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"Title\\\",\\\"id\\\":\\\"E0Vewd3ma\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-labFROrHZ)\\\",\\\"fontSize\\\":\\\"0.7rem\\\",\\\"letterSpacing\\\":\\\"0.03em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textTransform\\\":\\\"uppercase\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(85, 85, 85)\\\"}}]}]}]}]}]}]\\n```\\n\\n---\\n\\n## Featured Posts\\n\\nThe best way to set up a Featured article, post, or item is to use two Collection Lists. By setting the \u201CLimit to\u201D and \u201CStart Offset\u201D properties on each, you can design featured posts or items with unique layouts, styles, and typographic treatments. Critically, the Featured collection list has \u201CLimit to\u201D set to 1, while the second collection list has \u201CStart at\u201D set to 1 and \u201CLimit to\u201D to 10.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Posts\\\",\\\"id\\\":\\\"qgkL8WQ1L\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"84.46%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Featured\\\",\\\"id\\\":\\\"YbB6RPH8e\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"collectionList\\\":{\\\"collection\\\":\\\"Posts\\\",\\\"repeatedDescendantId\\\":\\\"paeO71cch\\\",\\\"limit\\\":\\\"1\\\"},\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"krIpgEwTU\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"Oe1Qt0yz6\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"T6orTT0xJ\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"var(--variable-Oafv3y8lc)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"fit-image\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"e_zp6xR5O\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"WG5IEZ50x\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"cE0nGy7QV\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-OrSLDVjbK)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"toDateString\\\",\\\"format\\\":\\\"month-year\\\",\\\"dateStyle\\\":\\\"medium\\\"}]},\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"xjRKCo_3C\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"collectionList\\\":{\\\"collection\\\":\\\"Posts\\\",\\\"repeatedDescendantId\\\":\\\"w3IT5HB78\\\",\\\"limit\\\":\\\"10\\\",\\\"offset\\\":\\\"1\\\"},\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"REUc0eeY3\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Line\\\",\\\"id\\\":\\\"g9MPe6uJS\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(34, 34, 34)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\",\\\"visible\\\":{\\\"from\\\":\\\"var(--variable-bW7vqDv41-item-index)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":1},{\\\"name\\\":\\\"negate\\\"}]},\\\"zIndex\\\":\\\"1\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"Ko1oDT_j5\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"pjEONbGnF\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"var(--variable-Oafv3y8lc)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"5px\\\",\\\"width\\\":\\\"30px\\\",\\\"height\\\":\\\"30px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"bWQB_cKcS\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]}]}]}]\\n```\\n\\n---\\n\\n## Item Index and Visible Items\\n\\nInside Collection Lists, the special \\\"Item Index\\\" and \\\"Visible Items\\\" variables are available.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"ivW9m_rqt\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"0px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"43.07%\\\",\\\"constraintsLocked\\\":false,\\\"collectionList\\\":{\\\"collection\\\":\\\"Posts\\\",\\\"repeatedDescendantId\\\":\\\"N3nn9c2vX\\\",\\\"limit\\\":\\\"10\\\"},\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"YRx7dCgng\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Line\\\",\\\"id\\\":\\\"ilAAsYu6e\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(34, 34, 34)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\",\\\"visible\\\":{\\\"from\\\":\\\"var(--variable-m4Zd_Pcp9-item-index)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":1},{\\\"name\\\":\\\"negate\\\"}]},\\\"zIndex\\\":\\\"1\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"q1tw1xy98\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"cnHqcRtOT\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"rgb(36, 35, 35)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"5px\\\",\\\"width\\\":\\\"30px\\\",\\\"height\\\":\\\"30px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"K_6n3PIjU\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-ivW9m_rqt-item-index)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"toString\\\"}]},\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"0.8rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(130, 130, 130)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"\\\",\\\"id\\\":\\\"ooTOF95Zb\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"0.8rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(130, 130, 130)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ooTOF95Zb:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ooTOF95Zb:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"/\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"sJPLr9vfe\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-ivW9m_rqt-item-count)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"toString\\\"}]},\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"0.8rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(130, 130, 130)\\\"}}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ul6AFGJoK\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n## Dynamically Filterable Lists\\n\\nTo let visitors filter Collection Lists interactively, use Page Variables bound to both an UI control and the Collection List filters.\\n### Native UI controls\\n\\nFramer provides:\\n\\n- `FormPlainTextInputNode` for string, number and date variables\\n- `FormSelectNode` for boolean and collection reference variables\\n- `FormBooleanInputNode` for boolean or multi-collection-reference variables\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"dbGYnGD4s\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"12px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"19.2px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"91.97%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"tXwrmTr5D\\\",\\\"attributes\\\":{\\\"htmlTag\\\":\\\"label\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":8,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"180px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"EJT9S8gjM\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"12px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:EJT9S8gjM:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:EJT9S8gjM:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"FormPlainTextInputNode\\\",\\\"id\\\":\\\"sRuoF7vs2\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(136, 136, 136, 0.1)\\\",\\\"fill\\\":\\\"rgba(187, 187, 187, 0.15)\\\",\\\"formInputValue\\\":\\\"\\\",\\\"formInputFocusedBorderColor\\\":\\\"rgba(0, 153, 255, 1)\\\",\\\"formInputFocusedBorderWidth\\\":1,\\\"formInputFocusedBorderTop\\\":1,\\\"formInputFocusedBorderRight\\\":1,\\\"formInputFocusedBorderBottom\\\":1,\\\"formInputFocusedBorderLeft\\\":1,\\\"formInputFocusedBorderPerSide\\\":false,\\\"formInputFocusedBorderStyle\\\":\\\"solid\\\",\\\"formInputIconImage\\\":\\\"data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 width=%2216%22 height=%2216%22 fill=%22none%22><path d=%22M7 2.5a5 5 0 0 1 4.13 7.82l2.03 2.03a.75.75 0 0 1-1.06 1.06l-2-2A5 5 0 1 1 7 2.5Zm-3.5 5a3.5 3.5 0 1 0 7 0 3.5 3.5 0 0 0-7 0Z%22 fill=%22%23999%22/></svg>\\\",\\\"formInputIconColor\\\":\\\"rgba(153, 153, 153, 1)\\\",\\\"formInputPlaceholder\\\":\\\"Search\u2026\\\",\\\"formInputPlaceholderColor\\\":\\\"rgba(153, 153, 153, 1)\\\",\\\"formTextInputType\\\":\\\"text\\\",\\\"padding\\\":\\\"12px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textColor\\\":\\\"#222\\\",\\\"variableBinding\\\":\\\"var(--variable-WMPkUsfHh)\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"DYr3hzIQ4\\\",\\\"attributes\\\":{\\\"htmlTag\\\":\\\"label\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":8,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"180px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Nltf350EM\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"12px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Nltf350EM:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Nltf350EM:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Categories\\\"}}]}]},{\\\"type\\\":\\\"FormSelectNode\\\",\\\"id\\\":\\\"eIRxZ79bQ\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(136, 136, 136, 0.1)\\\",\\\"fill\\\":\\\"rgba(187, 187, 187, 0.15)\\\",\\\"formInputFocusedBorderColor\\\":\\\"rgba(0, 153, 255, 1)\\\",\\\"formInputFocusedBorderWidth\\\":1,\\\"formInputFocusedBorderTop\\\":1,\\\"formInputFocusedBorderRight\\\":1,\\\"formInputFocusedBorderBottom\\\":1,\\\"formInputFocusedBorderLeft\\\":1,\\\"formInputFocusedBorderPerSide\\\":false,\\\"formInputFocusedBorderStyle\\\":\\\"solid\\\",\\\"formInputIconColor\\\":\\\"rgba(153, 153, 153, 1)\\\",\\\"padding\\\":\\\"12px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\",\\\"variableBinding\\\":\\\"var(--variable-IqUiHHMdZ)\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"s4izlwdgE\\\",\\\"attributes\\\":{\\\"htmlTag\\\":\\\"label\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FormBooleanInputNode\\\",\\\"id\\\":\\\"o8YWOI9HS\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"border\\\":\\\"1px solid rgba(136, 136, 136, 0.2)\\\",\\\"fill\\\":\\\"rgba(187, 187, 187, 0.2)\\\",\\\"formBooleanInputType\\\":\\\"checkbox\\\",\\\"formBooleanInputValue\\\":\\\"false\\\",\\\"formInputCheckedFill\\\":\\\"rgba(0, 153, 255, 1)\\\",\\\"formInputFocusedBorderColor\\\":\\\"rgba(0, 153, 255, 1)\\\",\\\"formInputFocusedBorderWidth\\\":1,\\\"formInputFocusedBorderTop\\\":1,\\\"formInputFocusedBorderRight\\\":1,\\\"formInputFocusedBorderBottom\\\":1,\\\"formInputFocusedBorderLeft\\\":1,\\\"formInputFocusedBorderPerSide\\\":false,\\\"formInputFocusedBorderStyle\\\":\\\"solid\\\",\\\"formInputIconColor\\\":\\\"rgba(255, 255, 255, 1)\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"4px\\\",\\\"width\\\":\\\"16px\\\",\\\"height\\\":\\\"16px\\\",\\\"variableBinding\\\":\\\"var(--variable-knso73jnG)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"wKzSoFr96\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"12px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:wKzSoFr96:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:wKzSoFr96:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Sponsored\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"IQyTWXtG_\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"collectionList\\\":{\\\"collection\\\":\\\"Posts\\\",\\\"repeatedDescendantId\\\":\\\"onWhQGmcx\\\",\\\"filters\\\":[{\\\"variableId\\\":\\\"FCNm6xWAB\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"contains\\\",\\\"value\\\":\\\"var(--variable-WMPkUsfHh)\\\"}]},{\\\"variableId\\\":\\\"XBpxg9OhV\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"contains\\\",\\\"value\\\":\\\"var(--variable-IqUiHHMdZ)\\\"}]},{\\\"variableId\\\":\\\"OaE50ssdy\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":\\\"var(--variable-knso73jnG)\\\"}]}],\\\"filtersOperator\\\":\\\"and\\\"},\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"UiSQzTDGb\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Line\\\",\\\"id\\\":\\\"s4YCJfgEk\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(34, 34, 34)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\",\\\"visible\\\":{\\\"from\\\":\\\"var(--variable-uDqnrHjIO-item-index)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":1},{\\\"name\\\":\\\"negate\\\"}]},\\\"zIndex\\\":\\\"1\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"zTHKflJW4\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"fJKNArn9J\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"var(--variable-Oafv3y8lc)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"5px\\\",\\\"width\\\":\\\"30px\\\",\\\"height\\\":\\\"30px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"rOkNOqiGo\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"QFdtrONg9\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-OrSLDVjbK)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"toDateString\\\",\\\"format\\\":\\\"month-year\\\",\\\"dateStyle\\\":\\\"medium\\\"}]},\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\"}}]}]}]}]}]\\n```\\n### Custom UI controls\\n\\nFor other type of use cases not covered by Framer\u2019s native UI controls, the Set Variable Value interaction can be attached to any button to update the value of a variable.\\n\\nCritically, these buttons are components with Default and Active variants, so the selected option can be visually distinguished. The active variant is derived from the filter variable via a computed value.\\n\\nThe buttons also accept a Click variable, which receives a Set Variable interaction.\\n\\nHere\u2019s an interface using Tabs:\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"vqgoVf1sN\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"12px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"91.97%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"obiOht717\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":8,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"100%\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ZVIEDrgof\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"12px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ZVIEDrgof:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ZVIEDrgof:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Categories\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"e__r0q4pH\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":true,\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"collectionList\\\":{\\\"collection\\\":\\\"Categories\\\",\\\"repeatedDescendantId\\\":\\\"pfh5kkpVd\\\"},\\\"width\\\":\\\"100%\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"vVoyc2BBn\\\",\\\"component\\\":\\\"Ebb5hRFsg\\\",\\\"$componentDisplayName\\\":\\\"Tab\\\",\\\"attributes\\\":{\\\"onClick\\\":[{\\\"action\\\":\\\"SET_VARIABLE_VALUE\\\",\\\"controls\\\":{\\\"variable\\\":\\\"var(--variable-IqUiHHMdZ)\\\",\\\"value\\\":\\\"null\\\"}}],\\\"$control__title\\\":\\\"All\\\",\\\"$control__variant\\\":{\\\"from\\\":\\\"var(--variable-IqUiHHMdZ)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"isSet\\\"},{\\\"name\\\":\\\"convertFromBoolean\\\",\\\"outputType\\\":\\\"enum\\\",\\\"truthy\\\":\\\"jWJki8loe\\\",\\\"falsy\\\":\\\"gfTasTgSN\\\"}]},\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"}},{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"pfh5kkpVd\\\",\\\"component\\\":\\\"Ebb5hRFsg\\\",\\\"$componentDisplayName\\\":\\\"Tab\\\",\\\"attributes\\\":{\\\"onClick\\\":[{\\\"action\\\":\\\"SET_VARIABLE_VALUE\\\",\\\"controls\\\":{\\\"variable\\\":\\\"var(--variable-IqUiHHMdZ)\\\",\\\"value\\\":\\\"var(--variable-SB1KXCNan-id)\\\"}}],\\\"$control__title\\\":\\\"var(--variable-labFROrHZ)\\\",\\\"$control__variant\\\":{\\\"from\\\":\\\"var(--variable-IqUiHHMdZ)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":\\\"var(--variable-SB1KXCNan-id)\\\"},{\\\"name\\\":\\\"convertFromBoolean\\\",\\\"outputType\\\":\\\"enum\\\",\\\"truthy\\\":\\\"gfTasTgSN\\\",\\\"falsy\\\":\\\"jWJki8loe\\\"}]},\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"UI40v9EwD\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"collectionList\\\":{\\\"collection\\\":\\\"Posts\\\",\\\"repeatedDescendantId\\\":\\\"kVVEdBHCA\\\",\\\"filters\\\":[{\\\"variableId\\\":\\\"XBpxg9OhV\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"contains\\\",\\\"value\\\":\\\"var(--variable-IqUiHHMdZ)\\\"}]}],\\\"filtersOperator\\\":\\\"and\\\"},\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"hR6Ym2VFb\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Line\\\",\\\"id\\\":\\\"VatDSQX1w\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(34, 34, 34)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\",\\\"visible\\\":{\\\"from\\\":\\\"var(--variable-NiBJETx1I-item-index)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":1},{\\\"name\\\":\\\"negate\\\"}]},\\\"zIndex\\\":\\\"1\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"kcUekwLnm\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"Y4nnMeRGe\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"var(--variable-Oafv3y8lc)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"5px\\\",\\\"width\\\":\\\"30px\\\",\\\"height\\\":\\\"30px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"h3WQmA_nt\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]}]}]}]\\n```\\nHere's an interface using Toggles, allowing multiple categories selected at once:\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"z_tPeWgV6\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"12px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"91.97%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"lxvoctMlb\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":8,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"100%\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"gLSaiomux\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"12px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:gLSaiomux:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:gLSaiomux:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Categories\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"Ca9YiwG_E\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":true,\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"collectionList\\\":{\\\"collection\\\":\\\"Categories\\\",\\\"repeatedDescendantId\\\":\\\"P_ULjqHS_\\\"},\\\"width\\\":\\\"100%\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"P_ULjqHS_\\\",\\\"component\\\":\\\"Ebb5hRFsg\\\",\\\"$componentDisplayName\\\":\\\"Tab\\\",\\\"attributes\\\":{\\\"$control__title\\\":\\\"var(--variable-labFROrHZ)\\\",\\\"$control__variant\\\":{\\\"from\\\":\\\"var(--variable-dzAb4G38k)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"contains\\\",\\\"value\\\":\\\"var(--variable-SB1KXCNan-id)\\\"},{\\\"name\\\":\\\"convertFromBoolean\\\",\\\"outputType\\\":\\\"enum\\\",\\\"truthy\\\":\\\"gfTasTgSN\\\",\\\"falsy\\\":\\\"jWJki8loe\\\"}]},\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"S99OVYRs5\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"collectionList\\\":{\\\"collection\\\":\\\"Posts\\\",\\\"repeatedDescendantId\\\":\\\"Yemg0qhjP\\\",\\\"filters\\\":[{\\\"variableId\\\":\\\"XBpxg9OhV\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"containsAll\\\",\\\"value\\\":\\\"var(--variable-dzAb4G38k)\\\"}]}],\\\"filtersOperator\\\":\\\"and\\\"},\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"sVzqwG3O8\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Line\\\",\\\"id\\\":\\\"wpy1Y42C7\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(34, 34, 34)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\",\\\"visible\\\":{\\\"from\\\":\\\"var(--variable-jJedMuadv-item-index)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":1},{\\\"name\\\":\\\"negate\\\"}]},\\\"zIndex\\\":\\\"1\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"npH_bHOM7\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"fQxk5m4xp\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"var(--variable-Oafv3y8lc)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"5px\\\",\\\"width\\\":\\\"30px\\\",\\\"height\\\":\\\"30px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"xORs7knYx\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]}]}]}]\\n```\\n### Optional vs Non-Optional Page Variables\\n\\nPage Variables without an initial value are Optional. Optional Variables are unset by default and don\u2019t activate the filters they\u2019re bound to:\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"xr7lUvfld\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"12px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"91.97%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"VYWgw6vBq\\\",\\\"attributes\\\":{\\\"htmlTag\\\":\\\"label\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FormBooleanInputNode\\\",\\\"id\\\":\\\"FxtW5kRj5\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"border\\\":\\\"1px solid rgba(136, 136, 136, 0.2)\\\",\\\"fill\\\":\\\"rgba(187, 187, 187, 0.2)\\\",\\\"formBooleanInputType\\\":\\\"checkbox\\\",\\\"formBooleanInputValue\\\":\\\"false\\\",\\\"formInputCheckedFill\\\":\\\"rgba(0, 153, 255, 1)\\\",\\\"formInputFocusedBorderColor\\\":\\\"rgba(0, 153, 255, 1)\\\",\\\"formInputFocusedBorderWidth\\\":1,\\\"formInputFocusedBorderTop\\\":1,\\\"formInputFocusedBorderRight\\\":1,\\\"formInputFocusedBorderBottom\\\":1,\\\"formInputFocusedBorderLeft\\\":1,\\\"formInputFocusedBorderPerSide\\\":false,\\\"formInputFocusedBorderStyle\\\":\\\"solid\\\",\\\"formInputIconColor\\\":\\\"rgba(255, 255, 255, 1)\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"4px\\\",\\\"width\\\":\\\"16px\\\",\\\"height\\\":\\\"16px\\\",\\\"variableBinding\\\":\\\"var(--variable-knso73jnG)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"OejXwxBhR\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"12px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:OejXwxBhR:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:OejXwxBhR:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Sponsored\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"Gy4ocXyv8\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"collectionList\\\":{\\\"collection\\\":\\\"Posts\\\",\\\"repeatedDescendantId\\\":\\\"B0JbeIu6x\\\",\\\"filters\\\":[{\\\"variableId\\\":\\\"OaE50ssdy\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":\\\"var(--variable-knso73jnG)\\\"}]}],\\\"filtersOperator\\\":\\\"and\\\"},\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"V66AdwAEt\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Line\\\",\\\"id\\\":\\\"tEGA1rM5O\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(34, 34, 34)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\",\\\"visible\\\":{\\\"from\\\":\\\"var(--variable-N__nkSkOH-item-index)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":1},{\\\"name\\\":\\\"negate\\\"}]},\\\"zIndex\\\":\\\"1\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"WwBMDmTQE\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"j37Rh0toX\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"var(--variable-Oafv3y8lc)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"5px\\\",\\\"width\\\":\\\"30px\\\",\\\"height\\\":\\\"30px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"XI_kFe7cr\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]}]}]}]\\n```\\nOn the other hand, Page Variables with an initial value are Non-Optional. They are always set, and the filters they're bound to are active:\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"woYHPLNBt\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"12px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"91.97%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"IKXk1g0O_\\\",\\\"attributes\\\":{\\\"htmlTag\\\":\\\"label\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FormBooleanInputNode\\\",\\\"id\\\":\\\"IFtKnTLsc\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"border\\\":\\\"1px solid rgba(136, 136, 136, 0.2)\\\",\\\"fill\\\":\\\"rgba(187, 187, 187, 0.2)\\\",\\\"formBooleanInputType\\\":\\\"checkbox\\\",\\\"formBooleanInputValue\\\":\\\"false\\\",\\\"formInputCheckedFill\\\":\\\"rgba(0, 153, 255, 1)\\\",\\\"formInputFocusedBorderColor\\\":\\\"rgba(0, 153, 255, 1)\\\",\\\"formInputFocusedBorderWidth\\\":1,\\\"formInputFocusedBorderTop\\\":1,\\\"formInputFocusedBorderRight\\\":1,\\\"formInputFocusedBorderBottom\\\":1,\\\"formInputFocusedBorderLeft\\\":1,\\\"formInputFocusedBorderPerSide\\\":false,\\\"formInputFocusedBorderStyle\\\":\\\"solid\\\",\\\"formInputIconColor\\\":\\\"rgba(255, 255, 255, 1)\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"4px\\\",\\\"width\\\":\\\"16px\\\",\\\"height\\\":\\\"16px\\\",\\\"variableBinding\\\":\\\"var(--variable-lWpMlx0He)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"JPYGkG5P7\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"12px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:JPYGkG5P7:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:JPYGkG5P7:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Sponsored\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"BCdBSFG63\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"collectionList\\\":{\\\"collection\\\":\\\"Posts\\\",\\\"repeatedDescendantId\\\":\\\"kJkHFOocd\\\",\\\"filters\\\":[{\\\"variableId\\\":\\\"OaE50ssdy\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":\\\"var(--variable-lWpMlx0He)\\\"}]}],\\\"filtersOperator\\\":\\\"and\\\"},\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"HKK0CfzyG\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Line\\\",\\\"id\\\":\\\"kkPqyOZL_\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(34, 34, 34)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\",\\\"visible\\\":{\\\"from\\\":\\\"var(--variable-jS06U1mKR-item-index)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"equals\\\",\\\"value\\\":1},{\\\"name\\\":\\\"negate\\\"}]},\\\"zIndex\\\":\\\"1\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"c3l5TlIG5\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"gbDc9GCt2\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"var(--variable-Oafv3y8lc)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"5px\\\",\\\"width\\\":\\\"30px\\\",\\\"height\\\":\\\"30px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"KVV8EsO9G\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]}]}]}]\\n```\\n### Resetting Variables\\n\\nWhen combining multiple filters, it can be useful to add a button to reset all variables to their initial state.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Button\\\",\\\"id\\\":\\\"RDLlcomPR\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"cursor\\\":\\\"pointer\\\",\\\"fill\\\":\\\"rgb(17, 17, 17)\\\",\\\"onTap\\\":[{\\\"action\\\":\\\"RESET_VARIABLE_VALUES\\\",\\\"controls\\\":{}}],\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px 12px 10px 12px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"45.05%\\\",\\\"centerAnchorY\\\":\\\"17.82%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"mnDPpfbSS\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:mnDPpfbSS:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:mnDPpfbSS:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Clear\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"CollectionNode\\\",\\\"id\\\":\\\"lkedkbtGW\\\",\\\"name\\\":\\\"Posts\\\",\\\"variables\\\":[{\\\"key\\\":\\\"$control__title\\\",\\\"id\\\":\\\"FCNm6xWAB\\\",\\\"name\\\":\\\"Title\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\"},{\\\"key\\\":\\\"$control__categories\\\",\\\"id\\\":\\\"XBpxg9OhV\\\",\\\"name\\\":\\\"Categories\\\",\\\"node\\\":\\\"CollectionReferenceVariable\\\",\\\"type\\\":\\\"multi\\\",\\\"collection\\\":\\\"Categories\\\"},{\\\"key\\\":\\\"$control__slug\\\",\\\"id\\\":\\\"z6DzBC62i\\\",\\\"name\\\":\\\"Slug\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\"},{\\\"key\\\":\\\"$control__date\\\",\\\"id\\\":\\\"OrSLDVjbK\\\",\\\"name\\\":\\\"Date\\\",\\\"node\\\":\\\"DateVariable\\\",\\\"type\\\":\\\"date\\\",\\\"displayTime\\\":false},{\\\"key\\\":\\\"$control__image\\\",\\\"id\\\":\\\"Oafv3y8lc\\\",\\\"name\\\":\\\"Image\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"image\\\"},{\\\"key\\\":\\\"$control__content\\\",\\\"id\\\":\\\"fj7_HQk3_\\\",\\\"name\\\":\\\"Content\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"richtext\\\"},{\\\"key\\\":\\\"$control__sponsored\\\",\\\"id\\\":\\\"OaE50ssdy\\\",\\\"name\\\":\\\"Sponsored\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"boolean\\\",\\\"initialValue\\\":true},{\\\"key\\\":\\\"$control__id\\\",\\\"id\\\":\\\"lkedkbtGW-id\\\",\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\"}],\\\"$itemCount\\\":5},{\\\"type\\\":\\\"CollectionItemNode\\\",\\\"id\\\":\\\"obQNKW4fj\\\",\\\"attributes\\\":{\\\"$control__title\\\":\\\"On Design\\\",\\\"$control__content\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h2\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Design Is an Act of Clarity\\\"}}]},{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:1\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:1:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Good design doesn\u2019t announce itself. It removes friction so quietly that the person experiencing it never thinks about it at all. Whether it\u2019s the weight of a well-bound book, the rhythm of a well-spaced page, or the pause before an animation resolves \u2014 every decision either earns trust or erodes it. Design is not decoration. It is the architecture of attention.\\\"}}]},{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:2\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:2:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"There\u2019s a persistent myth that more freedom produces better work. In practice, the opposite is often true. Constraints \u2014 a narrow typeface, a limited palette, a single viewport \u2014 force decisions. They make you choose what matters. The designer who thrives inside a tight brief isn\u2019t compromising; they\u2019re sharpening. Limitation is not the enemy of creativity. It is its engine.\\\"}}]},{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:3\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h3\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:3:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Form Follows Feeling\\\"}}]},{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:4\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:4:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Function is a floor, not a ceiling. A chair can be structurally sound and still feel cold. A typeface can be perfectly legible and still feel wrong for the moment. The subtler craft in design is emotional calibration \u2014 matching the feeling of a solution to the intention behind it. When form and feeling align, the work disappears into experience. That disappearance is the goal.\\\"}}]}],\\\"$control__image\\\":{\\\"src\\\":\\\"https://framerusercontent.com/images/KXZF3UtGGmLSIn3grTIjDSJ62Wg.png\\\",\\\"alt\\\":\\\"Placeholder\\\"},\\\"$control__date\\\":\\\"2026-10-20T00:00:00.000Z\\\",\\\"$control__categories\\\":\\\"[\\\\\\\"X4RoJSYdA\\\\\\\",\\\\\\\"ZDcf5szq0\\\\\\\"]\\\",\\\"$control__slug\\\":\\\"on-design\\\"}},{\\\"type\\\":\\\"CollectionNode\\\",\\\"id\\\":\\\"SB1KXCNan\\\",\\\"name\\\":\\\"Categories\\\",\\\"variables\\\":[{\\\"key\\\":\\\"$control__title\\\",\\\"id\\\":\\\"labFROrHZ\\\",\\\"name\\\":\\\"Title\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\"},{\\\"key\\\":\\\"$control__slug\\\",\\\"id\\\":\\\"AfhVs5d7a\\\",\\\"name\\\":\\\"Slug\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\"},{\\\"key\\\":\\\"$control__id\\\",\\\"id\\\":\\\"SB1KXCNan-id\\\",\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\"}],\\\"$itemCount\\\":4},{\\\"type\\\":\\\"CollectionItemNode\\\",\\\"id\\\":\\\"X4RoJSYdA\\\",\\\"attributes\\\":{\\\"$control__slug\\\":\\\"ai\\\",\\\"$control__title\\\":\\\"AI\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 1\\\",\\\"id\\\":\\\"Sfue7V1QW\\\",\\\"attributes\\\":{\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0.01em\\\",\\\"lineHeight\\\":\\\"1.1em\\\",\\\"paragraphSpacing\\\":\\\"0\\\"}},\\\"tag\\\":\\\"h1\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 2\\\",\\\"id\\\":\\\"VtZw0dhkQ\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"30px\\\",\\\"letterSpacing\\\":\\\"-0.02em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h2\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 3\\\",\\\"id\\\":\\\"UUInh0_rj\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h3\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Body\\\",\\\"id\\\":\\\"zzTwSIxIn\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(119, 119, 119)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.6em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}}}},{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}},{\\\"type\\\":\\\"InlineCodeStylePresetNode\\\",\\\"name\\\":\\\"Inline Code\\\",\\\"id\\\":\\\"kGO9eSkSI\\\",\\\"attributes\\\":{\\\"radius\\\":\\\"6px\\\",\\\"textBackgroundColor\\\":\\\"rgba(0, 0, 0, 0.1)\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"ComponentNode\\\",\\\"id\\\":\\\"Ebb5hRFsg\\\",\\\"name\\\":\\\"Tab\\\",\\\"variables\\\":[{\\\"key\\\":\\\"$control__title\\\",\\\"id\\\":\\\"mXpY5N3RA\\\",\\\"name\\\":\\\"Title\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\",\\\"initialValue\\\":\\\"Category\\\"},{\\\"key\\\":\\\"onClick\\\",\\\"id\\\":\\\"eAHGXWjyh\\\",\\\"name\\\":\\\"Click\\\",\\\"node\\\":\\\"EventHandlerVariable\\\",\\\"type\\\":\\\"eventhandler\\\"}],\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Default\\\",\\\"id\\\":\\\"jWJki8loe\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgba(187, 187, 187, 0.15)\\\",\\\"onTap\\\":[{\\\"action\\\":\\\"TRIGGER_EVENT\\\",\\\"controls\\\":{\\\"id\\\":\\\"var(--variable-eAHGXWjyh)\\\"}}],\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":10,\\\"padding\\\":\\\"0px 8px 0px 8px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"8px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"transition\\\":\\\"instant\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"Title\\\",\\\"id\\\":\\\"ciskRgvVv\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-mXpY5N3RA)\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"-0.02em\\\",\\\"lineHeight\\\":\\\"1.6em\\\",\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(136, 136, 136)\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Active\\\",\\\"id\\\":\\\"gfTasTgSN\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(34, 34, 34)\\\",\\\"onTap\\\":[{\\\"action\\\":\\\"TRIGGER_EVENT\\\",\\\"controls\\\":{\\\"id\\\":\\\"var(--variable-eAHGXWjyh)\\\"}}],\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":10,\\\"padding\\\":\\\"0px 8px 0px 8px\\\",\\\"left\\\":\\\"184px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"8px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"transition\\\":\\\"instant\\\"}}]}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"CMS Detail Pages\":{\"id\":\"IX5Khe5aI\",\"name\":\"CMS Detail Pages\",\"template\":\"# CMS Detail Pages\\n\\nCMS Detail Pages have text and images sourced from a CMS Collection, like a blog post with a Title, Date, Hero Image, and often contain Rich Text too. Critically, if no Text Styles exist, rich text content requires the creation of new Text Styles for tags like H1, H2, H3, and P. When writing content for CMS items like blog posts, write 2-3 paragraphs by default, and include a couple of sub-headers (H2, H3). When making a new Collection from scratch, make sure to populate all fields from ALL items in the Collection. These detail pages can link to Next and Previous items in the CMS Collection via a special type of link: Next and Previous. This will dynamically always link to the next or previous blog posts, for example.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Detail Page\\\",\\\"id\\\":\\\"m_iGzkrrV\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"40px 0px 40px 0px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"700px\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"K8qXUxFOo\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"gap\\\":\\\"5px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"600px\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"Title\\\",\\\"id\\\":\\\"PWRutuB26\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":600,\\\"text\\\":\\\"var(--variable-FCNm6xWAB)\\\",\\\"textAlignment\\\":\\\"center\\\",\\\"textStylePreset\\\":\\\"Heading 1\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"Date\\\",\\\"id\\\":\\\"iLYosH_yd\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":600,\\\"text\\\":{\\\"from\\\":\\\"var(--variable-OrSLDVjbK)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"toDateString\\\",\\\"dateStyle\\\":\\\"medium\\\",\\\"capitalize\\\":true}]},\\\"textAlignment\\\":\\\"center\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"textStylePreset\\\":\\\"Body\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Banner\\\",\\\"id\\\":\\\"an6uneP3n\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"var(--variable-Oafv3y8lc)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"24px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"400px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"Content\\\",\\\"id\\\":\\\"B5AJTL2Hn\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"paragraphSpacing\\\":32,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":600,\\\"text\\\":\\\"var(--variable-fj7_HQk3_)\\\",\\\"stylePresetHeading1\\\":\\\"Heading 1\\\",\\\"stylePresetHeading2\\\":\\\"Heading 2\\\",\\\"stylePresetHeading3\\\":\\\"Heading 3\\\",\\\"stylePresetParagraph\\\":\\\"Body\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"yysPWwRV6\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"600px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"Previous\\\",\\\"id\\\":\\\"ib1nBImpq\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textStylePreset\\\":\\\"Body\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Spacer\\\",\\\"id\\\":\\\"C4D3ydlpc\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"Next\\\",\\\"id\\\":\\\"p4GyEEmjV\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textStylePreset\\\":\\\"Body\\\"}}]}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"CollectionNode\\\",\\\"id\\\":\\\"lkedkbtGW\\\",\\\"name\\\":\\\"Posts\\\",\\\"variables\\\":[{\\\"key\\\":\\\"$control__title\\\",\\\"id\\\":\\\"FCNm6xWAB\\\",\\\"name\\\":\\\"Title\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\"},{\\\"key\\\":\\\"$control__categories\\\",\\\"id\\\":\\\"XBpxg9OhV\\\",\\\"name\\\":\\\"Categories\\\",\\\"node\\\":\\\"CollectionReferenceVariable\\\",\\\"type\\\":\\\"multi\\\"},{\\\"key\\\":\\\"$control__slug\\\",\\\"id\\\":\\\"z6DzBC62i\\\",\\\"name\\\":\\\"Slug\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\"},{\\\"key\\\":\\\"$control__date\\\",\\\"id\\\":\\\"OrSLDVjbK\\\",\\\"name\\\":\\\"Date\\\",\\\"node\\\":\\\"DateVariable\\\",\\\"type\\\":\\\"date\\\",\\\"displayTime\\\":false},{\\\"key\\\":\\\"$control__image\\\",\\\"id\\\":\\\"Oafv3y8lc\\\",\\\"name\\\":\\\"Image\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"image\\\"},{\\\"key\\\":\\\"$control__content\\\",\\\"id\\\":\\\"fj7_HQk3_\\\",\\\"name\\\":\\\"Content\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"richtext\\\"},{\\\"key\\\":\\\"$control__id\\\",\\\"id\\\":\\\"lkedkbtGW-id\\\",\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\"}],\\\"$itemCount\\\":5},{\\\"type\\\":\\\"CollectionItemNode\\\",\\\"id\\\":\\\"obQNKW4fj\\\",\\\"attributes\\\":{\\\"$control__title\\\":\\\"On Design\\\",\\\"$control__content\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h2\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Design Is an Act of Clarity\\\"}}]},{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:1\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:1:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Good design doesn\u2019t announce itself. It removes friction so quietly that the person experiencing it never thinks about it at all. Whether it\u2019s the weight of a well-bound book, the rhythm of a well-spaced page, or the pause before an animation resolves \u2014 every decision either earns trust or erodes it. Design is not decoration. It is the architecture of attention.\\\"}}]},{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:2\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:2:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"There\u2019s a persistent myth that more freedom produces better work. In practice, the opposite is often true. Constraints \u2014 a narrow typeface, a limited palette, a single viewport \u2014 force decisions. They make you choose what matters. The designer who thrives inside a tight brief isn\u2019t compromising; they\u2019re sharpening. Limitation is not the enemy of creativity. It is its engine.\\\"}}]},{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:3\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h3\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:3:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Form Follows Feeling\\\"}}]},{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:4\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:obQNKW4fj/fj7_HQk3_:4:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Function is a floor, not a ceiling. A chair can be structurally sound and still feel cold. A typeface can be perfectly legible and still feel wrong for the moment. The subtler craft in design is emotional calibration \u2014 matching the feeling of a solution to the intention behind it. When form and feeling align, the work disappears into experience. That disappearance is the goal.\\\"}}]}],\\\"$control__image\\\":{\\\"src\\\":\\\"https://framerusercontent.com/images/KXZF3UtGGmLSIn3grTIjDSJ62Wg.png\\\",\\\"alt\\\":\\\"Placeholder\\\"},\\\"$control__date\\\":\\\"2026-10-20T00:00:00.000Z\\\",\\\"$control__categories\\\":\\\"[\\\\\\\"X4RoJSYdA\\\\\\\",\\\\\\\"ZDcf5szq0\\\\\\\"]\\\",\\\"$control__slug\\\":\\\"on-design\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 1\\\",\\\"id\\\":\\\"Sfue7V1QW\\\",\\\"attributes\\\":{\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0.01em\\\",\\\"lineHeight\\\":\\\"1.1em\\\",\\\"paragraphSpacing\\\":\\\"0\\\"}},\\\"tag\\\":\\\"h1\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 2\\\",\\\"id\\\":\\\"VtZw0dhkQ\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"30px\\\",\\\"letterSpacing\\\":\\\"-0.02em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h2\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 3\\\",\\\"id\\\":\\\"UUInh0_rj\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h3\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Body\\\",\\\"id\\\":\\\"zzTwSIxIn\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(119, 119, 119)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.6em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}}}},{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}},{\\\"type\\\":\\\"InlineCodeStylePresetNode\\\",\\\"name\\\":\\\"Inline Code\\\",\\\"id\\\":\\\"kGO9eSkSI\\\",\\\"attributes\\\":{\\\"radius\\\":\\\"6px\\\",\\\"textBackgroundColor\\\":\\\"rgba(0, 0, 0, 0.1)\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Cards\":{\"id\":\"i85l8Z2an\",\"name\":\"Cards\",\"template\":\"# Cards\\n\\nCards are Stacks with content within.\\n\\n---\\n\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"H5n7RwXBf\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.08)\\\",\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"padding\\\":\\\"80px 20px 80px 20px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"31.92%\\\",\\\"centerAnchorY\\\":\\\"50%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"20px\\\",\\\"width\\\":\\\"300px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"VuTh87ZKI\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Coin A\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(61, 190, 255)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"32px\\\",\\\"height\\\":\\\"48px\\\",\\\"zIndex\\\":\\\"1\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card Text\\\",\\\"id\\\":\\\"Il8AOjHR9\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"D59CeUdGA\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":32,\\\"wght\\\":700},\\\"fontWeight\\\":700,\\\"fontSize\\\":\\\"24px\\\",\\\"letterSpacing\\\":\\\"-0.02em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:D59CeUdGA:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:D59CeUdGA:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Coins\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"iDSgKBgD2\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:iDSgKBgD2:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:iDSgKBgD2:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Track anything.\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card Button\\\",\\\"id\\\":\\\"f2GqQ15z_\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(61, 190, 255, 0.1)\\\",\\\"fill\\\":\\\"rgba(61, 190, 255, 0.1)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"8px 10px 8px 10px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"pixABJLQ4\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(61, 190, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:pixABJLQ4:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:pixABJLQ4:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Learn more\\\"}}]}]}]}]}]\\n```\\n\\n---\\n\\n# Row of Cards\\n\\nWhen placing cards in a single row, prefer giving them the same height. Because the contents within are never exactly the same, they would otherwise all have unique heights.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Grid\\\",\\\"id\\\":\\\"X4VEtE4Bs\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"40px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"64.26%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"200px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"yiHCZMO0H\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"k_jFE066M\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:k_jFE066M:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:k_jFE066M:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle copy that has a certain length\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"ZDzKDDgo4\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"gmmdJmmno\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"xARHNBD0k\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:xARHNBD0k:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:xARHNBD0k:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle copy that has a certain length, maybe longer\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"NSSCZEpXL\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"HLx0WXA6c\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"uefaRrwSv\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:uefaRrwSv:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:uefaRrwSv:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle copy\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"okuZMqKd_\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"}}]}]}]\\n```\\n\\n---\\n\\n## Pricing Cards\\n\\nPricing cards include more unique layouts with various font sizes, and critically always include a checklist of features, and a button at the bottom.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Pricing Card\\\",\\\"id\\\":\\\"htSe8GeRM\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"padding\\\":\\\"20px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"31.92%\\\",\\\"centerAnchorY\\\":\\\"50%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"30px\\\",\\\"width\\\":\\\"400px\\\",\\\"height\\\":\\\"480px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Badge\\\",\\\"id\\\":\\\"Xq8Pzxopw\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.05)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.08)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"8px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"6px 8px 6px 8px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"BuIwZVjoJ\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"13px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:BuIwZVjoJ:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:BuIwZVjoJ:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Pro\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Price\\\",\\\"id\\\":\\\"GK4ZkxjGy\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"end\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"AXhGAYIEo\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"40px\\\",\\\"letterSpacing\\\":\\\"-0.04em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:AXhGAYIEo:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:AXhGAYIEo:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"$20\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"DBi_0IYoy\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.6em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:DBi_0IYoy:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:DBi_0IYoy:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"/month\\\"}}]}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"NlNRKa8kL\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:NlNRKa8kL:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:NlNRKa8kL:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Perfect for growing professional sites.\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Divider\\\",\\\"id\\\":\\\"ZHOLDRWaQ\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgba(255, 255, 255, 0.1)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Checklist\\\",\\\"id\\\":\\\"pJg6VY1Ts\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Feature\\\",\\\"id\\\":\\\"VoUQV9gmK\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"giZavRxJf\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(102, 102, 102)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"19px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"idn6pQvgR\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:idn6pQvgR:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:idn6pQvgR:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Freeform canvas\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Feature\\\",\\\"id\\\":\\\"ESktmnaYk\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"aUfAN2OMk\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(102, 102, 102)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"19px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"aG0_Wi5Mr\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:aG0_Wi5Mr:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:aG0_Wi5Mr:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Instant publishing\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Feature\\\",\\\"id\\\":\\\"CdRNnTu8l\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"vpOuCvaIF\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(102, 102, 102)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"19px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"I4V6ubhlQ\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:I4V6ubhlQ:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:I4V6ubhlQ:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Content editing\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Feature\\\",\\\"id\\\":\\\"FXEdCMEos\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"nzy8AnQW0\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(102, 102, 102)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"19px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"UbGJ0Qizm\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:UbGJ0Qizm:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:UbGJ0Qizm:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Fast hosting\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Spacer\\\",\\\"id\\\":\\\"vWMosNSgQ\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"EOZJL4tLk\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.05)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.1)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"dvGmU274m\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:dvGmU274m:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:dvGmU274m:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Try for free\\\"}}]}]}]}]}]\\n```\\n\\n---\\n\\n## Image Cards\\n\\nCards can have images as their background fill, which then has its contents, like text and icons, placed on top.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Image Card\\\",\\\"id\\\":\\\"gLas3vBiz\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":0.79,\\\"fill\\\":\\\"https://framerusercontent.com/images/LoGWZxySRS5JXnAx6383aNqll0.png\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"end\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"padding\\\":\\\"20px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"31.92%\\\",\\\"centerAnchorY\\\":\\\"50%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"20px\\\",\\\"width\\\":\\\"374px\\\",\\\"height\\\":\\\"473px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"M4oM9QjFc\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:M4oM9QjFc:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:M4oM9QjFc:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"January\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Content\\\",\\\"id\\\":\\\"JOwbPpgdN\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"space-between\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"sAJqXlB_1\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":32,\\\"wght\\\":700},\\\"fontWeight\\\":700,\\\"fontSize\\\":\\\"32px\\\",\\\"letterSpacing\\\":\\\"-0.02em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:sAJqXlB_1:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:sAJqXlB_1:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Blue\\\"}}]}]},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"ZXlcfV55a\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Chevron Right\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(255, 255, 255)\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\",\\\"zIndex\\\":\\\"1\\\"}}]}]}]\\n```\\n\\n---\\n\\n## Card with asset\\n\\nWhen cards have assets as part of their contents, like images, their Radius value has to be concentric to the card Radius, taking the card Padding value into account too.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card with Asset\\\",\\\"id\\\":\\\"KXXKbSm7u\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"padding\\\":\\\"10px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"21.78%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"15px\\\",\\\"width\\\":\\\"313px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"ZIvBQR45O\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"pcRj90atK\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:pcRj90atK:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:pcRj90atK:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"From idea to production\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"dgsCTlvjY\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:dgsCTlvjY:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:dgsCTlvjY:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Designs translate directly into real shipped code.\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Asset\\\",\\\"id\\\":\\\"UsTaSMDhL\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"https://framerusercontent.com/images/35LTZ5o0pJbsEBA1bjPgADzf1U.png\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"5px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"fit-image\\\"}}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 1\\\",\\\"id\\\":\\\"Sfue7V1QW\\\",\\\"attributes\\\":{\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0.01em\\\",\\\"lineHeight\\\":\\\"1.1em\\\",\\\"paragraphSpacing\\\":\\\"0\\\"}},\\\"tag\\\":\\\"h1\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 2\\\",\\\"id\\\":\\\"VtZw0dhkQ\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"30px\\\",\\\"letterSpacing\\\":\\\"-0.02em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h2\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 3\\\",\\\"id\\\":\\\"UUInh0_rj\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h3\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Body\\\",\\\"id\\\":\\\"zzTwSIxIn\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(119, 119, 119)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.6em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}}}},{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}},{\\\"type\\\":\\\"InlineCodeStylePresetNode\\\",\\\"name\\\":\\\"Inline Code\\\",\\\"id\\\":\\\"kGO9eSkSI\\\",\\\"attributes\\\":{\\\"radius\\\":\\\"6px\\\",\\\"textBackgroundColor\\\":\\\"rgba(0, 0, 0, 0.1)\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Computed Values\":{\"id\":\"JRkaYYEsL\",\"name\":\"Computed Values\",\"template\":\"# Computed Values\\n\\nComputed Values let you derive the value of a node property from a variable by applying Transforms.\\n\\nHere are some examples on when and how to use Computed Values:\\n## Formatting a number\\n\\nThe `numberToString` transform allows customizing number formatting options with great flexibility:\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"whreX38x8\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":6,\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"19.6px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"89.48%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"jq0xlDVXS\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"kJ8cfc9F8\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"140px\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-Ei8djw7D_)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"numberToString\\\",\\\"grouping\\\":\\\"auto\\\",\\\"notation\\\":\\\"standard\\\",\\\"compactDisplay\\\":\\\"short\\\",\\\"style\\\":\\\"currency\\\",\\\"currency\\\":\\\"USD\\\",\\\"currencyDisplay\\\":\\\"symbol\\\",\\\"unit\\\":\\\"percent\\\",\\\"unitDisplay\\\":\\\"short\\\"}]},\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"bsvnYx4Yh\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:bsvnYx4Yh:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:bsvnYx4Yh:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Currency (USD)\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"yLL5McbUP\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"IcteOgJtQ\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"140px\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-Ei8djw7D_)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"numberToString\\\",\\\"grouping\\\":\\\"auto\\\",\\\"notation\\\":\\\"standard\\\",\\\"compactDisplay\\\":\\\"short\\\",\\\"style\\\":\\\"currency\\\",\\\"currency\\\":\\\"USD\\\",\\\"currencyDisplay\\\":\\\"symbol\\\",\\\"unit\\\":\\\"percent\\\",\\\"unitDisplay\\\":\\\"short\\\",\\\"maximumFractionDigits\\\":0}]},\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"o93MikcAG\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:o93MikcAG:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:o93MikcAG:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Currency (USD, no decimals)\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"jJJcz1cxU\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"iRchwvwLr\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"140px\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-Ei8djw7D_)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"numberToString\\\",\\\"locale\\\":\\\"de-DE\\\",\\\"grouping\\\":\\\"auto\\\",\\\"notation\\\":\\\"standard\\\",\\\"compactDisplay\\\":\\\"short\\\",\\\"style\\\":\\\"currency\\\",\\\"currency\\\":\\\"EUR\\\",\\\"currencyDisplay\\\":\\\"symbol\\\",\\\"unit\\\":\\\"percent\\\",\\\"unitDisplay\\\":\\\"short\\\"}]},\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"UIiSUzXyI\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:UIiSUzXyI:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:UIiSUzXyI:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Currency (EUR, locale overridden)\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"pbZD_ggVh\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"wsjpTY480\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"140px\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-Ei8djw7D_)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"numberToString\\\",\\\"grouping\\\":\\\"auto\\\",\\\"notation\\\":\\\"compact\\\",\\\"compactDisplay\\\":\\\"short\\\",\\\"style\\\":\\\"currency\\\",\\\"currency\\\":\\\"USD\\\",\\\"currencyDisplay\\\":\\\"code\\\",\\\"unit\\\":\\\"percent\\\",\\\"unitDisplay\\\":\\\"short\\\"}]},\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"D7oXEzjuY\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:D7oXEzjuY:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:D7oXEzjuY:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Currency (USD, code, compact)\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"oWOmGjOnJ\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"OmmyQc_I6\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"140px\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-Ei8djw7D_)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"numberToString\\\",\\\"grouping\\\":false,\\\"notation\\\":\\\"standard\\\",\\\"compactDisplay\\\":\\\"short\\\",\\\"style\\\":\\\"decimal\\\",\\\"currency\\\":\\\"USD\\\",\\\"currencyDisplay\\\":\\\"symbol\\\",\\\"unit\\\":\\\"percent\\\",\\\"unitDisplay\\\":\\\"short\\\"}]},\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"LYL7bX3uK\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:LYL7bX3uK:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:LYL7bX3uK:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Number (no grouping)\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"zQSjmmf3B\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"z0U4oFban\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"140px\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-Ei8djw7D_)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"numberToString\\\",\\\"grouping\\\":\\\"auto\\\",\\\"notation\\\":\\\"standard\\\",\\\"compactDisplay\\\":\\\"short\\\",\\\"style\\\":\\\"unit\\\",\\\"currency\\\":\\\"USD\\\",\\\"currencyDisplay\\\":\\\"symbol\\\",\\\"unit\\\":\\\"megabyte\\\",\\\"unitDisplay\\\":\\\"short\\\"}]},\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"qjVuOz8ad\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:qjVuOz8ad:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:qjVuOz8ad:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Unit (MB)\\\"}}]}]}]}]}]\\n```\\n## Comparing numbers\\n\\n`greaterThan`, `lessThan` and `equals` allow comparing numbers. The result can be bound to boolean properties, like `visible`:\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"iNSOPoDJk\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"16.95%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"vpV_jlQeQ\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"140px\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"visible\\\":{\\\"from\\\":\\\"var(--variable-Ei8djw7D_)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"lessThan\\\",\\\"value\\\":1500}]}},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:vpV_jlQeQ:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:vpV_jlQeQ:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Best Value!\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ndh5UPp9M\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ndh5UPp9M:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ndh5UPp9M:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Displayed only when Price is less than 1500\\\"}}]}]}]}]\\n```\\n## Displaying values as text\\n\\nOnly `string` variables can be bound to `text` properties. To bind variables of other types, you can use various transforms.\\n\\nThe transform's `outputType` must match the destination property's type (e.g. `string` for text, `color` for fill).\\n### Boolean to string\\n\\nUse `convertFromBoolean` to map truthy and falsy cases:\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"KQtGtHo70\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"16.95%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"mY1m0V37x\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"140px\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-apSyadMDN)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"convertFromBoolean\\\",\\\"outputType\\\":\\\"string\\\",\\\"truthy\\\":\\\"Editor's Choice\\\",\\\"falsy\\\":\\\"Standard Item\\\"}]},\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]\\n```\\n### Enum to option string\\n\\nUse `enumToDisplayName` to simply display the enum option.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"rUbZNU1vR\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"16.95%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"NUcYin7HD\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-XqZqd0XJq)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"enumToDisplayName\\\"}]},\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]\\n```\\n### Enum to custom string\\n\\nUse `convertFromEnum` to map enum options to custom strings.\uFFFC\uFFFC\\n\\nThe `default` property defines a string to use when no options match (for example, if a new Enum case is added)\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"NFtNvsiWu\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"87.57%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"tqnVttXLf\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":{\\\"from\\\":\\\"var(--variable-XqZqd0XJq)\\\",\\\"transforms\\\":[{\\\"name\\\":\\\"convertFromEnum\\\",\\\"cases\\\":[{\\\"from\\\":\\\"V_H1cGWgj\\\",\\\"to\\\":\\\"Currently Available!\\\"},{\\\"from\\\":\\\"WPTor7nap\\\",\\\"to\\\":\\\"Currently Unavailable\\\"},{\\\"from\\\":\\\"sdOhnylf7\\\",\\\"to\\\":\\\"Available for Pre-Orders!\\\"}],\\\"default\\\":\\\"Unknown Availability\\\",\\\"outputType\\\":\\\"string\\\"}]},\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"CollectionNode\\\",\\\"id\\\":\\\"PZXP8xPGM\\\",\\\"name\\\":\\\"Items\\\",\\\"variables\\\":[{\\\"key\\\":\\\"$control__title\\\",\\\"id\\\":\\\"B0Kt2r30S\\\",\\\"name\\\":\\\"Title\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\"},{\\\"key\\\":\\\"$control__price\\\",\\\"id\\\":\\\"Ei8djw7D_\\\",\\\"name\\\":\\\"Price\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"number\\\",\\\"initialValue\\\":0},{\\\"key\\\":\\\"$control__editor_s_choice\\\",\\\"id\\\":\\\"apSyadMDN\\\",\\\"name\\\":\\\"Editor's Choice\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"boolean\\\",\\\"initialValue\\\":true},{\\\"key\\\":\\\"$control__slug\\\",\\\"id\\\":\\\"OCFDSYDie\\\",\\\"name\\\":\\\"Slug\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\"},{\\\"key\\\":\\\"$control__content\\\",\\\"id\\\":\\\"jIKT_0DyJ\\\",\\\"name\\\":\\\"Content\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"richtext\\\"},{\\\"key\\\":\\\"$control__availability\\\",\\\"id\\\":\\\"XqZqd0XJq\\\",\\\"name\\\":\\\"Availability\\\",\\\"node\\\":\\\"OptionVariable\\\",\\\"type\\\":\\\"enum\\\",\\\"cases\\\":[\\\"In Stock\\\",\\\"Out of Stock\\\",\\\"Pre-Order\\\"],\\\"initialValue\\\":\\\"In Stock\\\"},{\\\"key\\\":\\\"$control__id\\\",\\\"id\\\":\\\"PZXP8xPGM-id\\\",\\\"name\\\":\\\"id\\\",\\\"type\\\":\\\"string\\\"}],\\\"$itemCount\\\":1},{\\\"type\\\":\\\"CollectionItemNode\\\",\\\"id\\\":\\\"kYl1BMeek\\\",\\\"attributes\\\":{\\\"$control__title\\\":\\\"Mobile Phone\\\",\\\"$control__price\\\":\\\"1499\\\",\\\"$control__slug\\\":\\\"mobile-phone\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 1\\\",\\\"id\\\":\\\"Sfue7V1QW\\\",\\\"attributes\\\":{\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0.01em\\\",\\\"lineHeight\\\":\\\"1.1em\\\",\\\"paragraphSpacing\\\":\\\"0\\\"}},\\\"tag\\\":\\\"h1\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 2\\\",\\\"id\\\":\\\"VtZw0dhkQ\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"30px\\\",\\\"letterSpacing\\\":\\\"-0.02em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h2\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 3\\\",\\\"id\\\":\\\"UUInh0_rj\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h3\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Body\\\",\\\"id\\\":\\\"zzTwSIxIn\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(119, 119, 119)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.6em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}}}},{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}},{\\\"type\\\":\\\"InlineCodeStylePresetNode\\\",\\\"name\\\":\\\"Inline Code\\\",\\\"id\\\":\\\"kGO9eSkSI\\\",\\\"attributes\\\":{\\\"radius\\\":\\\"6px\\\",\\\"textBackgroundColor\\\":\\\"rgba(0, 0, 0, 0.1)\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Cursors\":{\"id\":\"mO0emgIn5\",\"name\":\"Cursors\",\"template\":\"# Cursors\\n\\nTo customize cursors, prefer using custom cursors. Setting a custom cursor will normally hide the web cursor. A custom cursor should reference a component with variants, NOT a code component. Default to leaving Transition unset, but when users ask for a smoother or delayed follow, use Physics-based Spring transitions, not Time-based. A good default for Transition is Stiffness: 400, Damping: 40, Mass: 1. It is key that Cursor Components get a pressed \\\"Gesture Variant\\\", which makes it respond to clicks, like scaling it down while pressing. Setting custom cursors works best when applying to the Page or a parent layer of content that requires a Custom Cursor, like  a list of projects.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"With Custom Cursor\\\",\\\"id\\\":\\\"mjDBvPY5D\\\",\\\"attributes\\\":{\\\"customCursor\\\":{\\\"type\\\":\\\"ComponentNode\\\",\\\"variant\\\":\\\"Default\\\",\\\"componentNodeId\\\":\\\"idCwA_QuL\\\",\\\"follow\\\":false},\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"80px 40px 80px 40px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"10%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"}}]\\n```\\n\\n---\\n\\n## Cursor Variants\\n\\nCustom cursor components can have Variants. And nested layers can have Custom Cursor set to \\\"Set Variant\\\" which switches the Variant of the Cursor Component applied to its nearest ancestor with a Custom Cursor. For example, when hovering over a specific layer, we can switch to a Variant that grows (scales up) the Custom Cursor.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"With Custom Cursor\\\",\\\"id\\\":\\\"ydwxDloT5\\\",\\\"attributes\\\":{\\\"customCursor\\\":{\\\"type\\\":\\\"ComponentNode\\\",\\\"variant\\\":\\\"Default\\\",\\\"componentNodeId\\\":\\\"idCwA_QuL\\\",\\\"follow\\\":false},\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"80px 40px 80px 40px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"10%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"vTgUPHCHm\\\",\\\"attributes\\\":{\\\"customCursor\\\":{\\\"type\\\":\\\"ComponentNode-variant\\\",\\\"variant\\\":\\\"Grow\\\"},\\\"fill\\\":\\\"rgb(34, 34, 34)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"108px\\\",\\\"height\\\":\\\"108px\\\"}}]}]\\n```\\n\\n---\\n\\n## Follow Cursors\\n\\nCustom cursors can also be appended to the native web cursor, like displaying an icon or some text next to the real cursor. By default, position should be set to bottom, align to left, and offset to x: 10, y: 10. Adding a smooth transition here can help, as the icon will follow the cursor with some delay.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"With Custom Cursor\\\",\\\"id\\\":\\\"vxhZpqY8k\\\",\\\"attributes\\\":{\\\"customCursor\\\":{\\\"type\\\":\\\"ComponentNode\\\",\\\"variant\\\":\\\"Variant 1\\\",\\\"componentNodeId\\\":\\\"UIG53mBwc\\\",\\\"follow\\\":true,\\\"offsetX\\\":\\\"10px\\\",\\\"offsetY\\\":\\\"10px\\\",\\\"placement\\\":\\\"bottom\\\",\\\"alignment\\\":\\\"start\\\",\\\"transition\\\":\\\"spring-physics 400 40 1 0s\\\"},\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"80px 40px 80px 40px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"10%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"}}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"ComponentNode\\\",\\\"id\\\":\\\"idCwA_QuL\\\",\\\"name\\\":\\\"Cursor\\\",\\\"variables\\\":[{\\\"key\\\":\\\"$control__fill\\\",\\\"id\\\":\\\"fOORYJRsL\\\",\\\"name\\\":\\\"Fill\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"color\\\",\\\"initialValue\\\":\\\"rgb(255, 255, 255)\\\"}],\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Default\\\",\\\"id\\\":\\\"GtvE2KspX\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"layout\\\":\\\"null\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\",\\\"transition\\\":\\\"spring-duration 0.3s 0.2 0s\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"eyMgiZj1T\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"rgb(255, 255, 255)\\\",\\\"layout\\\":\\\"null\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"50%\\\",\\\"constraintsLocked\\\":true,\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"20px\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"h1T7qDjzb\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"layout\\\":\\\"null\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"120px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\",\\\"transition\\\":\\\"spring-duration 0.3s 0.2 0s\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Grow\\\",\\\"id\\\":\\\"phBNfR3lg\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"layout\\\":\\\"null\\\",\\\"left\\\":\\\"120px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\",\\\"transition\\\":\\\"spring-duration 0.3s 0.2 0s\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"lrPXULhVO\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"layout\\\":\\\"null\\\",\\\"left\\\":\\\"120px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"124px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\",\\\"transition\\\":\\\"spring-duration 0.3s 0.2 0s\\\"}}]},{\\\"type\\\":\\\"ComponentNode\\\",\\\"id\\\":\\\"UIG53mBwc\\\",\\\"name\\\":\\\"Follow Cursor\\\",\\\"variables\\\":[],\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Variant 1\\\",\\\"id\\\":\\\"cwVC7SE6x\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":20,\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\",\\\"transition\\\":\\\"spring-duration 0.4s 0.2 0s\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ScWUJU6EU\\\",\\\"attributes\\\":{\\\"inlineCodeStylePreset\\\":\\\"Inline Code\\\",\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"22px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ScWUJU6EU:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ScWUJU6EU:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"\uD83D\uDE0E\\\"}}]}]}]}]},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 1\\\",\\\"id\\\":\\\"Sfue7V1QW\\\",\\\"attributes\\\":{\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0.01em\\\",\\\"lineHeight\\\":\\\"1.1em\\\",\\\"paragraphSpacing\\\":\\\"0\\\"}},\\\"tag\\\":\\\"h1\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 2\\\",\\\"id\\\":\\\"VtZw0dhkQ\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"30px\\\",\\\"letterSpacing\\\":\\\"-0.02em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h2\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 3\\\",\\\"id\\\":\\\"UUInh0_rj\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h3\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Body\\\",\\\"id\\\":\\\"zzTwSIxIn\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(119, 119, 119)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.6em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}}}},{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}},{\\\"type\\\":\\\"InlineCodeStylePresetNode\\\",\\\"name\\\":\\\"Inline Code\\\",\\\"id\\\":\\\"kGO9eSkSI\\\",\\\"attributes\\\":{\\\"radius\\\":\\\"6px\\\",\\\"textBackgroundColor\\\":\\\"rgba(0, 0, 0, 0.1)\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Effects\":{\"id\":\"PkGfk68S5\",\"name\":\"Effects\",\"template\":\"# Effects\\n\\nEffects in Framer let people easily add interactions and animations to any layer, without having to use Components. Effects include Appear, Hover, Press, Loop, Drag, Scroll, and Text.\\n\\n---\\n\\n## Appear Effect\\n\\nAppear effects can be used to animate in layers when the page loads. It can achieve effects like fading in, scaling in, flipping, and sliding in. When giving appear effects unique delay values, we can design sequenced appear animations. For simple fade ins, easing curves with a time are preferred over spring curves.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"SV5bUCxXM\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"80px 40px 80px 40px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"10%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"hB_nsE5pF\\\",\\\"attributes\\\":{\\\"appearEffect\\\":{\\\"threshold\\\":0.5,\\\"trigger\\\":\\\"onMount\\\",\\\"enter\\\":{\\\"opacity\\\":0,\\\"x\\\":0,\\\"y\\\":0,\\\"scale\\\":1,\\\"rotate\\\":0,\\\"rotateX\\\":0,\\\"rotateY\\\":0,\\\"skewX\\\":0,\\\"skewY\\\":0,\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.4s 0s\\\",\\\"stagger\\\":\\\"0s\\\"}},\\\"fill\\\":\\\"rgb(0, 153, 255)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"80px\\\",\\\"height\\\":\\\"80px\\\"}}]}]\\n```\\n\\n---\\n\\n## Hover Effect\\n\\nElements like lists, cards, or anything with a defined surface can benefit from a subtle hover effect, like changing the element's background color on hover, or scale.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"List with Hover\\\",\\\"id\\\":\\\"Hp0Y4j9G7\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"34.38%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"480px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"IgbohODCs\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"OEFBFAsMK\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"hoverEffect\\\":{\\\"opacity\\\":1,\\\"x\\\":\\\"0px\\\",\\\"y\\\":\\\"0px\\\",\\\"scale\\\":1,\\\"skewX\\\":\\\"0deg\\\",\\\"skewY\\\":\\\"0deg\\\",\\\"backgroundColor\\\":\\\"rgba(255, 255, 255, 0.05)\\\",\\\"transition\\\":\\\"spring-duration 0.4s 0.2 0s\\\",\\\"rotate\\\":\\\"0deg\\\"},\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"padding\\\":\\\"15px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"15px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"M9eVp1vvr\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:M9eVp1vvr:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:M9eVp1vvr:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Designing for Momentum\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"dhM3hLgaR\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:dhM3hLgaR:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:dhM3hLgaR:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"June 12, 2026\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"blRh4A8J0\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"yg5VdKFVn\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"hoverEffect\\\":{\\\"opacity\\\":1,\\\"x\\\":\\\"0px\\\",\\\"y\\\":\\\"0px\\\",\\\"scale\\\":1,\\\"skewX\\\":\\\"0deg\\\",\\\"skewY\\\":\\\"0deg\\\",\\\"backgroundColor\\\":\\\"rgba(255, 255, 255, 0.05)\\\",\\\"transition\\\":\\\"spring-duration 0.4s 0.2 0s\\\",\\\"rotate\\\":\\\"0deg\\\"},\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"padding\\\":\\\"15px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"15px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"m3Uq5OJeF\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:m3Uq5OJeF:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:m3Uq5OJeF:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Visual Cleverness\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"QmO4iKXvR\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:QmO4iKXvR:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:QmO4iKXvR:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"May 20, 2026\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"yPkAkz3T4\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"oAlCzSUi_\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"hoverEffect\\\":{\\\"opacity\\\":1,\\\"x\\\":\\\"0px\\\",\\\"y\\\":\\\"0px\\\",\\\"scale\\\":1,\\\"skewX\\\":\\\"0deg\\\",\\\"skewY\\\":\\\"0deg\\\",\\\"backgroundColor\\\":\\\"rgba(255, 255, 255, 0.05)\\\",\\\"transition\\\":\\\"spring-duration 0.4s 0.2 0s\\\",\\\"rotate\\\":\\\"0deg\\\"},\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"padding\\\":\\\"15px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"15px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Zf00yL7Cq\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Zf00yL7Cq:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Zf00yL7Cq:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"On Design Constraints\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"FvAvsDx0z\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:FvAvsDx0z:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:FvAvsDx0z:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"March 5, 2026\\\"}}]}]}]}]}]}]\\n```\\n\\n---\\n\\n## Loop Effect\\n\\nThe loop effects can be used sparingly for subtle touches on things like logos and badges. These can be used to animate properties like rotation and offset in a loop. They can bring a nice animated detail to circular and rounded elements, like badges and logos and rounded icons in a circle.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"IhvAo5Kcx\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"34.38%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"200px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"fR5uJ0bY5\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"border\\\":\\\"1px solid rgb(255, 255, 255)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":20,\\\"loopEffect\\\":{\\\"repeatType\\\":\\\"loop\\\",\\\"repeatDelay\\\":\\\"0s\\\",\\\"pauseOffscreen\\\":true,\\\"opacity\\\":1,\\\"x\\\":0,\\\"y\\\":0,\\\"scale\\\":1,\\\"rotate\\\":360,\\\"rotateX\\\":0,\\\"rotateY\\\":0,\\\"skewX\\\":0,\\\"skewY\\\":0,\\\"transition\\\":\\\"tween 0,0,1,1 10s 0s\\\"},\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"50px\\\",\\\"width\\\":\\\"40px\\\",\\\"height\\\":\\\"32px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"bssT5jpVk\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Lens\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"1\\\",\\\"$control__color\\\":\\\"rgb(255, 255, 255)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"32px\\\",\\\"height\\\":\\\"32px\\\"}}]}]}]\\n```\\n\\n---\\n\\n## Drag Effect\\n\\nThe drag effect can be used to make things draggable on a page, or to make them temporarily draggable (with snap back set to yes) where elements return to their initial position. The momentum property, typically defaulting to No, specifies whether or not a layer can be flicked away with velocity taken into account. Critically, the parent layers of a draggable layer should have Overflow set to Visible, so the layer is not clipped by its parent.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"LnaSDBVa9\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"34.38%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"200px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"h0c4CWIaV\\\",\\\"attributes\\\":{\\\"cursor\\\":\\\"grab\\\",\\\"dragEffect\\\":{\\\"freeform\\\":true,\\\"snapBack\\\":false,\\\"momentum\\\":false,\\\"transition\\\":\\\"inertia 400 30\\\"},\\\"fill\\\":\\\"rgb(0, 153, 255)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"80px\\\",\\\"height\\\":\\\"80px\\\"}}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"FAQ\":{\"id\":\"LBxf0TClW\",\"name\":\"FAQ\",\"template\":\"# FAQ\\n\\nFAQ sections use Accordions that expand and collapse on click. Critically, the Question instances default to the Closed Variants, and Height is set to Fit Content.\\nThe text layers of the question and answer should have the Select property, under Styles, set to \\\"none\\\", as otherwise opening and closing the accordion item will cause accidental text selections.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Accordion\\\",\\\"id\\\":\\\"sLhkWXDBy\\\",\\\"attributes\\\":{\\\"flowEffect\\\":{\\\"transition\\\":\\\"spring-duration 0.3s 0.2 0s\\\"},\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px 5px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"42.5%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"400px\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"ZrvDX_AmH\\\",\\\"component\\\":\\\"HR2AgZbcJ\\\",\\\"$componentDisplayName\\\":\\\"FAQ/Question\\\",\\\"attributes\\\":{\\\"$control__question\\\":\\\"What do you do?\\\",\\\"$control__answer\\\":\\\"Daniela Dias is a designer based in Portugal. She loves turning ideas into simple, beautiful interfaces. Her work blends curiosity, precision, and a deep care for detail.\\\",\\\"$control__variant\\\":\\\"Closed\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"}},{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"eD7rgo0Oq\\\",\\\"component\\\":\\\"HR2AgZbcJ\\\",\\\"$componentDisplayName\\\":\\\"FAQ/Question\\\",\\\"attributes\\\":{\\\"$control__question\\\":\\\"Where are you based?\\\",\\\"$control__answer\\\":\\\"Daniela Dias is a designer based in Portugal. She loves turning ideas into simple, beautiful interfaces. Her work blends curiosity, precision, and a deep care for detail.\\\",\\\"$control__variant\\\":\\\"Closed\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"}},{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"oT6AV5Npx\\\",\\\"component\\\":\\\"HR2AgZbcJ\\\",\\\"$componentDisplayName\\\":\\\"FAQ/Question\\\",\\\"attributes\\\":{\\\"$control__question\\\":\\\"What\u2019s your favorite film?\\\",\\\"$control__answer\\\":\\\"Daniela Dias is a designer based in Portugal. She loves turning ideas into simple, beautiful interfaces. Her work blends curiosity, precision, and a deep care for detail.\\\",\\\"$control__variant\\\":\\\"Closed\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"}}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"ComponentNode\\\",\\\"id\\\":\\\"HR2AgZbcJ\\\",\\\"name\\\":\\\"Question\\\",\\\"variables\\\":[{\\\"key\\\":\\\"$control__question\\\",\\\"id\\\":\\\"J8MpBk9E2\\\",\\\"name\\\":\\\"Question\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\",\\\"initialValue\\\":\\\"Where are you based?\\\"},{\\\"key\\\":\\\"$control__answer\\\",\\\"id\\\":\\\"V28GPwUqe\\\",\\\"name\\\":\\\"Answer\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\",\\\"initialValue\\\":\\\"Daniela Dias is a designer based in Portugal. She loves turning ideas into simple, beautiful interfaces. Her work blends curiosity, precision, and a deep care for detail.\\\"}],\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Open\\\",\\\"id\\\":\\\"orLN4tHeI\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(17, 17, 17)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"5%\\\",\\\"centerAnchorY\\\":\\\"50%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"400px\\\",\\\"height\\\":\\\"auto\\\",\\\"transition\\\":\\\"spring-duration 0.3s 0.2 0s\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"W2M1sCAnG\\\",\\\"attributes\\\":{\\\"onTap\\\":[{\\\"action\\\":\\\"SET_VARIANT\\\",\\\"controls\\\":{\\\"variant\\\":\\\"AaVo6SQDI\\\"}}],\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"cWFO1ix2E\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"20px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RectangleShapeNode\\\",\\\"id\\\":\\\"UeX8NRwdJ\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"var(--token-cb399a41-16d3-4d34-9cef-8d4a95fade1a, rgb(102, 102, 102))\\\",\\\"radius\\\":\\\"10px\\\",\\\"rotation\\\":\\\"-90deg\\\"}},{\\\"type\\\":\\\"RectangleShapeNode\\\",\\\"id\\\":\\\"lWvSpfjUI\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"var(--token-cb399a41-16d3-4d34-9cef-8d4a95fade1a, rgb(102, 102, 102))\\\",\\\"radius\\\":\\\"10px\\\",\\\"rotation\\\":\\\"-180deg\\\",\\\"visible\\\":\\\"false\\\"}}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Qpnh7woE6\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-J8MpBk9E2)\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true,\\\"userSelect\\\":\\\"none\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"OpBOAkab6\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"0px 0px 0px 30px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"qO6hZN_G_\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-V28GPwUqe)\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":450},\\\"fontWeight\\\":450,\\\"fontSize\\\":\\\"1rem\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"ss01\\\":\\\"on\\\",\\\"ss03\\\":\\\"on\\\",\\\"ss08\\\":\\\"on\\\",\\\"tnum\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"textWrapBalance\\\":true,\\\"userSelect\\\":\\\"none\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Closed\\\",\\\"id\\\":\\\"AaVo6SQDI\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(17, 17, 17)\\\",\\\"onTap\\\":[{\\\"action\\\":\\\"SET_VARIANT\\\",\\\"controls\\\":{\\\"variant\\\":\\\"orLN4tHeI\\\"}}],\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"left\\\":\\\"500px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"5%\\\",\\\"centerAnchorY\\\":\\\"50%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"400px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"spring-duration 0.3s 0.2 0s\\\"}}]},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Body\\\",\\\"id\\\":\\\"zzTwSIxIn\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(119, 119, 119)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.6em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}}}},{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Forms\":{\"id\":\"ijHakbUM_\",\"name\":\"Forms\",\"template\":\"# Forms\\n\\nForms have labels, inputs, and submit buttons. Critically, the submit buttons are components with variants for loading, disabled, success, and error states of the form. They are often used for newsletter and input signup fields.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"WthVKBscn\\\",\\\"attributes\\\":{\\\"formSubmitButtonId\\\":\\\"xpv2DxyIB\\\",\\\"htmlTag\\\":\\\"form\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"left\\\":\\\"613px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"246px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"280px\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"b5110aU9Y\\\",\\\"attributes\\\":{\\\"htmlTag\\\":\\\"label\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FormPlainTextInputNode\\\",\\\"id\\\":\\\"SJ4nYmwVQ\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.08)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.1)\\\",\\\"formInputName\\\":\\\"Email\\\",\\\"formInputFocusedBorderColor\\\":\\\"rgba(255, 255, 255, 0.16)\\\",\\\"formInputFocusedBorderWidth\\\":1,\\\"formInputFocusedBorderTop\\\":1,\\\"formInputFocusedBorderRight\\\":1,\\\"formInputFocusedBorderBottom\\\":1,\\\"formInputFocusedBorderLeft\\\":1,\\\"formInputFocusedBorderPerSide\\\":false,\\\"formInputFocusedBorderStyle\\\":\\\"solid\\\",\\\"formInputPlaceholder\\\":\\\"jane@framer.com\\\",\\\"formInputPlaceholderColor\\\":\\\"rgba(153, 153, 153, 1)\\\",\\\"formTextInputType\\\":\\\"email\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"12px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]},{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"xpv2DxyIB\\\",\\\"name\\\":\\\"Submit Button\\\",\\\"component\\\":\\\"Ck3qqoVRI\\\",\\\"$componentDisplayName\\\":\\\"Submit Button\\\",\\\"attributes\\\":{\\\"$control__title\\\":\\\"Submit\\\",\\\"$control__variant\\\":\\\"Default\\\",\\\"$control__radius\\\":\\\"12px\\\",\\\"formButtonSuccessVariant\\\":\\\"vSfBfRUtu\\\",\\\"formButtonPendingVariant\\\":\\\"Uu6Cnz7UT\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"}}]}]\\n```\\n\\n---\\n\\n## Forms with Icon Button\\n\\nThe submit button does not have to have a text label. This form critically has an arrow right icon as the submit button, instead of a text label.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Form with Icon Button\\\",\\\"id\\\":\\\"KG5cGNpXk\\\",\\\"attributes\\\":{\\\"htmlTag\\\":\\\"label\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":10,\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"224px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"rDGYcEBqS\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(136, 136, 136)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:rDGYcEBqS:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:rDGYcEBqS:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Newsletter\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Input and Button\\\",\\\"id\\\":\\\"xGVxj5bKj\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FormPlainTextInputNode\\\",\\\"id\\\":\\\"XzpiEr8Xa\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.08)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.1)\\\",\\\"formInputName\\\":\\\"Email\\\",\\\"formInputFocusedBorderColor\\\":\\\"rgba(255, 255, 255, 0.16)\\\",\\\"formInputFocusedBorderWidth\\\":1,\\\"formInputFocusedBorderTop\\\":1,\\\"formInputFocusedBorderRight\\\":1,\\\"formInputFocusedBorderBottom\\\":1,\\\"formInputFocusedBorderLeft\\\":1,\\\"formInputFocusedBorderPerSide\\\":false,\\\"formInputFocusedBorderStyle\\\":\\\"solid\\\",\\\"formInputPlaceholder\\\":\\\"jane@framer.com\\\",\\\"formInputPlaceholderColor\\\":\\\"rgba(153, 153, 153, 1)\\\",\\\"formTextInputType\\\":\\\"email\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"12px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"ZLccgZ8S1\\\",\\\"component\\\":\\\"Ik98lrNUv\\\",\\\"$componentDisplayName\\\":\\\"Icon Button\\\",\\\"attributes\\\":{\\\"$control__variant\\\":\\\"Default\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"40px\\\",\\\"height\\\":\\\"40px\\\"}}]}]}]\\n```\\n\\n---\\n\\n## Forms with Multiple Inputs\\n\\nForms can have multiple labels, each with unique input types.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Form with Multiple Inputs\\\",\\\"id\\\":\\\"zmN4f_wKF\\\",\\\"attributes\\\":{\\\"formSubmitButtonId\\\":\\\"CVr09SISO\\\",\\\"htmlTag\\\":\\\"form\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":20,\\\"overflow\\\":\\\"hidden\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"280px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"UEoth_YLZ\\\",\\\"attributes\\\":{\\\"htmlTag\\\":\\\"label\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"cyA5IlvTe\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"12px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(136, 136, 136)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:cyA5IlvTe:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:cyA5IlvTe:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Name\\\"}}]}]},{\\\"type\\\":\\\"FormPlainTextInputNode\\\",\\\"id\\\":\\\"fTxXUZ0fy\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.08)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.1)\\\",\\\"formInputName\\\":\\\"Name\\\",\\\"formInputFocusedBorderColor\\\":\\\"rgba(255, 255, 255, 0.16)\\\",\\\"formInputFocusedBorderWidth\\\":1,\\\"formInputFocusedBorderTop\\\":1,\\\"formInputFocusedBorderRight\\\":1,\\\"formInputFocusedBorderBottom\\\":1,\\\"formInputFocusedBorderLeft\\\":1,\\\"formInputFocusedBorderPerSide\\\":false,\\\"formInputFocusedBorderStyle\\\":\\\"solid\\\",\\\"formInputPlaceholder\\\":\\\"Jane Smith\\\",\\\"formInputPlaceholderColor\\\":\\\"rgba(153, 153, 153, 1)\\\",\\\"formTextInputType\\\":\\\"text\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"12px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"aon_PNQWD\\\",\\\"attributes\\\":{\\\"htmlTag\\\":\\\"label\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"yRP6fq5gk\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"12px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(136, 136, 136)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:yRP6fq5gk:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:yRP6fq5gk:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Email\\\"}}]}]},{\\\"type\\\":\\\"FormPlainTextInputNode\\\",\\\"id\\\":\\\"f8qN8u0np\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.08)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.1)\\\",\\\"formInputName\\\":\\\"Email\\\",\\\"formInputFocusedBorderColor\\\":\\\"rgba(255, 255, 255, 0.16)\\\",\\\"formInputFocusedBorderWidth\\\":1,\\\"formInputFocusedBorderTop\\\":1,\\\"formInputFocusedBorderRight\\\":1,\\\"formInputFocusedBorderBottom\\\":1,\\\"formInputFocusedBorderLeft\\\":1,\\\"formInputFocusedBorderPerSide\\\":false,\\\"formInputFocusedBorderStyle\\\":\\\"solid\\\",\\\"formInputPlaceholder\\\":\\\"jane@framer.com\\\",\\\"formInputPlaceholderColor\\\":\\\"rgba(153, 153, 153, 1)\\\",\\\"formTextInputType\\\":\\\"email\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"12px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}}]},{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"GEcBiQ6Ke\\\",\\\"name\\\":\\\"Submit Button\\\",\\\"component\\\":\\\"Ck3qqoVRI\\\",\\\"$componentDisplayName\\\":\\\"Submit Button\\\",\\\"attributes\\\":{\\\"$control__title\\\":\\\"Submit\\\",\\\"$control__variant\\\":\\\"Default\\\",\\\"$control__radius\\\":\\\"12px\\\",\\\"formButtonSuccessVariant\\\":\\\"vSfBfRUtu\\\",\\\"formButtonPendingVariant\\\":\\\"Uu6Cnz7UT\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"}}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"ComponentNode\\\",\\\"id\\\":\\\"Ck3qqoVRI\\\",\\\"name\\\":\\\"Submit Button\\\",\\\"variables\\\":[{\\\"key\\\":\\\"$control__title\\\",\\\"id\\\":\\\"o0pSHrJtB\\\",\\\"name\\\":\\\"Title\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"string\\\",\\\"initialValue\\\":\\\"Submit\\\"},{\\\"key\\\":\\\"$control__radius\\\",\\\"id\\\":\\\"w7P1jJaP_\\\",\\\"name\\\":\\\"Radius\\\",\\\"node\\\":\\\"Variable\\\",\\\"type\\\":\\\"borderradius\\\",\\\"initialValue\\\":\\\"10px\\\"}],\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Default\\\",\\\"id\\\":\\\"TLOkxaskr\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(255, 255, 255)\\\",\\\"htmlTag\\\":\\\"button\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"13.33%\\\",\\\"centerAnchorY\\\":\\\"42.4%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"var(--variable-w7P1jJaP_)\\\",\\\"width\\\":\\\"240px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"rqTuOfulE\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"text\\\":\\\"var(--variable-o0pSHrJtB)\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(0, 0, 0)\\\",\\\"userSelect\\\":\\\"none\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Spinner\\\",\\\"id\\\":\\\"JpAuuygcj\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"layout\\\":\\\"null\\\",\\\"masks\\\":[{\\\"mask\\\":\\\"https://framerusercontent.com/images/pGiXYozQ3mE4cilNOItfe2L2fUA.svg\\\",\\\"maskMode\\\":\\\"alpha\\\"}],\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"20px\\\",\\\"visible\\\":\\\"false\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Conic\\\",\\\"id\\\":\\\"mr8oPpQ8Q\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"conic-gradient(from 0deg at 50% 50%, rgba(0, 0, 0, 0) 7.208614864864882deg, rgb(0, 0, 0) 342deg)\\\",\\\"layout\\\":\\\"null\\\",\\\"loopEffect\\\":{\\\"repeatType\\\":\\\"loop\\\",\\\"repeatDelay\\\":\\\"0s\\\",\\\"opacity\\\":1,\\\"x\\\":0,\\\"y\\\":0,\\\"scale\\\":1,\\\"rotate\\\":360,\\\"rotateX\\\":0,\\\"rotateY\\\":0,\\\"skewX\\\":0,\\\"skewY\\\":0,\\\"transition\\\":\\\"tween 0,0,1,1 1s 0s\\\"},\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"0px\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"0px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"50%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"20px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Rounding\\\",\\\"id\\\":\\\"NyXdniukr\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"null\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"5%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"1px\\\",\\\"width\\\":\\\"2px\\\",\\\"height\\\":\\\"2px\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Loading\\\",\\\"id\\\":\\\"Uu6Cnz7UT\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(255, 255, 255)\\\",\\\"htmlTag\\\":\\\"button\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"left\\\":\\\"340px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"13.33%\\\",\\\"centerAnchorY\\\":\\\"42.4%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"var(--variable-w7P1jJaP_)\\\",\\\"width\\\":\\\"240px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Disabled\\\",\\\"id\\\":\\\"tooojibzm\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(255, 255, 255)\\\",\\\"htmlTag\\\":\\\"button\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"opacity\\\":\\\"0.5\\\",\\\"left\\\":\\\"680px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"13.33%\\\",\\\"centerAnchorY\\\":\\\"42.4%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"var(--variable-w7P1jJaP_)\\\",\\\"width\\\":\\\"240px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Success\\\",\\\"id\\\":\\\"vSfBfRUtu\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(255, 255, 255)\\\",\\\"htmlTag\\\":\\\"button\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"left\\\":\\\"1020px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"13.33%\\\",\\\"centerAnchorY\\\":\\\"42.4%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"var(--variable-w7P1jJaP_)\\\",\\\"width\\\":\\\"240px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Error\\\",\\\"id\\\":\\\"ll8eBG0lR\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgba(255, 34, 68, 0.15)\\\",\\\"htmlTag\\\":\\\"button\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"left\\\":\\\"1360px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"13.33%\\\",\\\"centerAnchorY\\\":\\\"42.4%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"var(--variable-w7P1jJaP_)\\\",\\\"width\\\":\\\"240px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}]},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Body\\\",\\\"id\\\":\\\"zzTwSIxIn\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(119, 119, 119)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.6em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}}}},{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}},{\\\"type\\\":\\\"ComponentNode\\\",\\\"id\\\":\\\"Ik98lrNUv\\\",\\\"name\\\":\\\"Icon Button\\\",\\\"variables\\\":[],\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Default\\\",\\\"id\\\":\\\"Y6HSeg7MY\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.08)\\\",\\\"htmlTag\\\":\\\"button\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"13.33%\\\",\\\"centerAnchorY\\\":\\\"42.4%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"240px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Spinner\\\",\\\"id\\\":\\\"Xk9U5HITI\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"layout\\\":\\\"null\\\",\\\"masks\\\":[{\\\"mask\\\":\\\"https://framerusercontent.com/images/pGiXYozQ3mE4cilNOItfe2L2fUA.svg\\\",\\\"maskMode\\\":\\\"alpha\\\"}],\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"20px\\\",\\\"visible\\\":\\\"false\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Conic\\\",\\\"id\\\":\\\"gkTX2O_Zs\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"#4cf\\\",\\\"layout\\\":\\\"null\\\",\\\"loopEffect\\\":{\\\"repeatType\\\":\\\"loop\\\",\\\"repeatDelay\\\":\\\"0s\\\",\\\"opacity\\\":1,\\\"x\\\":0,\\\"y\\\":0,\\\"scale\\\":1,\\\"rotate\\\":360,\\\"rotateX\\\":0,\\\"rotateY\\\":0,\\\"skewX\\\":0,\\\"skewY\\\":0,\\\"transition\\\":\\\"tween 0,0,1,1 1s 0s\\\"},\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"0px\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"0px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"50%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"20px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Rounding\\\",\\\"id\\\":\\\"Y099AK8nm\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"rgb(255, 255, 255)\\\",\\\"layout\\\":\\\"null\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"5%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"1px\\\",\\\"width\\\":\\\"2px\\\",\\\"height\\\":\\\"2px\\\"}}]}]},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"GDJEBXQ6G\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Arrow Right\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(255, 255, 255)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Loading\\\",\\\"id\\\":\\\"NlQP_i7dB\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.08)\\\",\\\"htmlTag\\\":\\\"button\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"left\\\":\\\"340px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"13.33%\\\",\\\"centerAnchorY\\\":\\\"42.4%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"240px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Disabled\\\",\\\"id\\\":\\\"nsDAATonP\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.08)\\\",\\\"htmlTag\\\":\\\"button\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"opacity\\\":\\\"0.5\\\",\\\"left\\\":\\\"680px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"13.33%\\\",\\\"centerAnchorY\\\":\\\"42.4%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"240px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Success\\\",\\\"id\\\":\\\"MK5uNf18E\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.08)\\\",\\\"htmlTag\\\":\\\"button\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"left\\\":\\\"1020px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"13.33%\\\",\\\"centerAnchorY\\\":\\\"42.4%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"240px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Error\\\",\\\"id\\\":\\\"Gn58glkge\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"fill\\\":\\\"rgba(255, 34, 68, 0.15)\\\",\\\"htmlTag\\\":\\\"button\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"left\\\":\\\"1360px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"13.33%\\\",\\\"centerAnchorY\\\":\\\"42.4%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"240px\\\",\\\"height\\\":\\\"40px\\\",\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}]}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Grids\":{\"id\":\"jZVqtIJJD\",\"name\":\"Grids\",\"template\":\"# Grids\\n\\nGrids support any Column x Row configuration. Under their Advanced settings, there are Width and Height properties that influence grid cell behavior. Here, Width is best kept as \\\"Min\\\" Width and Height is best kept set to \\\"Fit Content\\\", unless making Bento Grids, or Single-Row Grids. These layers within Grids work best with \\\"Width\\\" set to \\\"Fill\\\" and \\\"Height\\\" set to either \\\"Fit\\\" or \\\"Fixed\\\".\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Grid\\\",\\\"id\\\":\\\"vhmsn1ZBt\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"grid\\\",\\\"gridAlignment\\\":\\\"center\\\",\\\"gridColumnCount\\\":2,\\\"gridColumnMinWidth\\\":\\\"50px\\\",\\\"gridRowCount\\\":2,\\\"gridRowHeightType\\\":\\\"fit\\\",\\\"gridRowHeight\\\":\\\"200px\\\",\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"40px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"64.26%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"zVcZTiShU\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemFillCellHeight\\\":false,\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"I8BtvJWkv\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ho8ZLuebl\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ho8ZLuebl:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ho8ZLuebl:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"yVf8SmgVl\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:yVf8SmgVl:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:yVf8SmgVl:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"Bu47rrGsv\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemFillCellHeight\\\":false,\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"juvlfcQVX\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"I492_fVQn\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:I492_fVQn:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:I492_fVQn:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"AfHWp7qUi\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:AfHWp7qUi:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:AfHWp7qUi:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"syyukubC5\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemFillCellHeight\\\":false,\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"XIagbGscd\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"i0MCA1hfP\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:i0MCA1hfP:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:i0MCA1hfP:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"JGOzxfw9g\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:JGOzxfw9g:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:JGOzxfw9g:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"blhwmYV2N\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemFillCellHeight\\\":false,\\\"gridItemColumnSpan\\\":\\\"1\\\",\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"bW_s00KNc\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"TUEcJ9Mew\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:TUEcJ9Mew:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:TUEcJ9Mew:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"tfnSjZR9W\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:tfnSjZR9W:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:tfnSjZR9W:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle\\\"}}]}]}]}]}]}]\\n```\\n\\n---\\n\\n## Masonry Grids\\n\\nGrids have a \\\"Masonry\\\" property, which results in a staggered, Pinterest-like grid where items fall in place like dry-stone walls. Critically, each cell should \\\"fill\\\" the width of the column, but have a unique height. Achieve this by either using Frames within with a fixed height that varies, Image layers set to \\\"Fit Image\\\", or Stacks set to height=\\\"auto\\\" sized based on the contents.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Grid\\\",\\\"id\\\":\\\"NdW87I_yh\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"grid\\\",\\\"gridMasonry\\\":\\\"true\\\",\\\"gridAlignment\\\":\\\"center\\\",\\\"gridColumnCount\\\":3,\\\"gridColumnMinWidth\\\":\\\"50px\\\",\\\"gridRowCount\\\":2,\\\"gridRowHeightType\\\":\\\"fit\\\",\\\"gridRowHeight\\\":\\\"200px\\\",\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"40px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"64.26%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"vYGOtSjkl\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"200px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"GJI5fIE2M\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ufa13VHpt\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ufa13VHpt:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ufa13VHpt:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"VsS4M1GGX\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:VsS4M1GGX:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:VsS4M1GGX:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"ISVpuOeTS\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemFillCellHeight\\\":false,\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"300px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"oDFleXkuB\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Ky3jmjbiX\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Ky3jmjbiX:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Ky3jmjbiX:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"tq5pxAJhl\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:tq5pxAJhl:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:tq5pxAJhl:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"zTq5Vit2H\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemFillCellHeight\\\":false,\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"150px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"Xbpp2BqBp\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Pq8lVZAcI\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Pq8lVZAcI:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Pq8lVZAcI:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"YlUdMMwR6\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:YlUdMMwR6:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:YlUdMMwR6:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"UsRTRm73F\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemFillCellHeight\\\":false,\\\"gridItemColumnSpan\\\":\\\"1\\\",\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"250px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"f52rlubc6\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"aMzcBXYjv\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:aMzcBXYjv:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:aMzcBXYjv:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"gVlZIhH_E\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:gVlZIhH_E:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:gVlZIhH_E:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"vwnxzUyF_\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemColumnSpan\\\":\\\"1\\\",\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"200px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"dAPnhUEgu\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Clm9Ifbp_\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Clm9Ifbp_:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Clm9Ifbp_:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"NHyVqibtv\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:NHyVqibtv:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:NHyVqibtv:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"Srgq0Mte2\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemColumnSpan\\\":\\\"1\\\",\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"200px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"Uh9OR_m1o\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"YcZxP6yhD\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:YcZxP6yhD:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:YcZxP6yhD:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"QJgIk7YGT\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:QJgIk7YGT:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:QJgIk7YGT:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Subtitle\\\"}}]}]}]}]}]}]\\n```\\n\\n---\\n\\n## Bento Grids\\n\\nBento grids mix cards with varying contents and adapt their height to content changes while still filling the available vertical space. The grid has Height set to Fit, and Cell Height under Advanced set to Fill. Some cards span 2 Rows, while others span 1 Row, creating the distinct bento layout. Critically this layout must result in a visually balanced grid where the entire grid is filled with cells, meaning the grid itself leaves no empty space.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Bento Grid\\\",\\\"id\\\":\\\"Mz_pvfs3m\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"grid\\\",\\\"gridAlignment\\\":\\\"center\\\",\\\"gridColumnCount\\\":3,\\\"gridColumnMinWidth\\\":\\\"50px\\\",\\\"gridRowCount\\\":2,\\\"gridRowHeightType\\\":\\\"auto\\\",\\\"gridRowHeight\\\":\\\"200px\\\",\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"40px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"64.26%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"MGtofkMBa\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemRowSpan\\\":\\\"2\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"snGViSZQD\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"FhtmJ63nO\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:FhtmJ63nO:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:FhtmJ63nO:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"One canvas\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"gaybTIghU\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:gaybTIghU:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:gaybTIghU:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Design, prototype, and ship in the same place.\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"yIkveUXvv\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"CLhLUjJhp\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"sWK7nPE3U\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:sWK7nPE3U:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:sWK7nPE3U:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"From idea to production\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"r0KYy40k5\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:r0KYy40k5:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:r0KYy40k5:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Designs translate directly into real shipped code\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"StclHrgG3\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemRowSpan\\\":\\\"2\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"tBxgKC9I_\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"UyU6PL7R_\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:UyU6PL7R_:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:UyU6PL7R_:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Build visually\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"gPfiRlVVj\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:gPfiRlVVj:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:gPfiRlVVj:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Precision when you need it. Speed when you don\u2019t.\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"YhprD0nrY\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemColumnSpan\\\":\\\"1\\\",\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"fMWOMTQLX\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"OGA4a5AsD\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:OGA4a5AsD:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:OGA4a5AsD:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Design anything\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"bqJ2uIoTK\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:bqJ2uIoTK:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:bqJ2uIoTK:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"From layout to logic, without switching tools\\\"}}]}]}]}]}]}]\\n```\\n\\n---\\n\\n## Bento Grids with Rows\\n\\nBento Grids can also have Rows that are staggered like brickwork. Each Row has 1 card that spans 2 Columns. Critically the card that spans 2 Columns alternates position on each Row.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Bento Grids with Rows\\\",\\\"id\\\":\\\"nMO3MqBxB\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"grid\\\",\\\"gridAlignment\\\":\\\"center\\\",\\\"gridColumnCount\\\":3,\\\"gridColumnMinWidth\\\":\\\"50px\\\",\\\"gridRowCount\\\":2,\\\"gridRowHeightType\\\":\\\"auto\\\",\\\"gridRowHeight\\\":\\\"200px\\\",\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"40px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"64.26%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"960px\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"xpsYJi8rp\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemColumnSpan\\\":\\\"2\\\",\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"TxuB8pOgt\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"a_G1KFANi\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:a_G1KFANi:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:a_G1KFANi:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"One canvas\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"f2vlyEF3b\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:f2vlyEF3b:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:f2vlyEF3b:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Design, prototype, and ship in the same place.\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"dgpWwNXER\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"IEuagu8Xa\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"xm55otbxK\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:xm55otbxK:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:xm55otbxK:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"From idea to production\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"EtjUIvYDF\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:EtjUIvYDF:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:EtjUIvYDF:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Designs translate directly into real shipped code\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"wCBW50R4z\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"cPTr1oiU0\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"KsZDSE_qe\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:KsZDSE_qe:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:KsZDSE_qe:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Build visually\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"BeKPWYexI\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:BeKPWYexI:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:BeKPWYexI:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Precision when you need it. Speed when you don\u2019t.\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"uESeaXRdO\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.06)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.03)\\\",\\\"gridItemColumnSpan\\\":\\\"2\\\",\\\"gridItemRowSpan\\\":\\\"1\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"MaR4gRByT\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"HCgyD3C_4\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:HCgyD3C_4:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:HCgyD3C_4:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Design anything\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"RNjtOhA8U\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.4em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:RNjtOhA8U:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:RNjtOhA8U:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"From layout to logic, without switching tools\\\"}}]}]}]}]}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Lists\":{\"id\":\"tUosHqQqj\",\"name\":\"Lists\",\"template\":\"# Lists\\n\\nLists are Stacks items, optionally with icons or images.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"List\\\",\\\"id\\\":\\\"IzvgED0B7\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 10px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"83.48%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"400px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"ONwOdHQTQ\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"l4jvhYhk_\\\",\\\"set\\\":\\\"Phosphor\\\",\\\"$control__icon\\\":\\\"Shapes\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__color\\\":\\\"rgb(0, 153, 255)\\\",\\\"$control__width\\\":\\\"2\\\",\\\"$control__alpha\\\":\\\"0.25\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Q6VrClg3O\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"24px\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"24px\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textVerticalAlignment\\\":\\\"center\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Q6VrClg3O:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Q6VrClg3O:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Freeform canvas.\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"B3mRNmt_9\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"fm9MLt5dM\\\",\\\"set\\\":\\\"Phosphor\\\",\\\"$control__icon\\\":\\\"Database\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__color\\\":\\\"rgb(0, 153, 255)\\\",\\\"$control__width\\\":\\\"2\\\",\\\"$control__alpha\\\":\\\"0.25\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"w0i_VUwQB\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"24px\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"24px\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textVerticalAlignment\\\":\\\"center\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:w0i_VUwQB:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:w0i_VUwQB:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Simple database.\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"q0LnolFb3\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"Joym6SGwg\\\",\\\"set\\\":\\\"Phosphor\\\",\\\"$control__icon\\\":\\\"Globe Simple\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__color\\\":\\\"rgb(0, 153, 255)\\\",\\\"$control__width\\\":\\\"2\\\",\\\"$control__alpha\\\":\\\"0.25\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Xu0uwSbNt\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"24px\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"24px\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textVerticalAlignment\\\":\\\"center\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Xu0uwSbNt:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Xu0uwSbNt:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Instant publishing.\\\"}}]}]}]}]}]\\n```\\n\\n---\\n\\n## Check List\\n\\nCheck lists critically use a single check or check mark icon for each list item.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"List\\\",\\\"id\\\":\\\"BufNH72O8\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px 10px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"83.48%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"400px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"s_lvd_EkR\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"NMRokMKtS\\\",\\\"set\\\":\\\"Phosphor\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__color\\\":\\\"rgb(0, 153, 255)\\\",\\\"$control__width\\\":\\\"2\\\",\\\"$control__alpha\\\":\\\"0.25\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"LPTJmJAIQ\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"24px\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"24px\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textVerticalAlignment\\\":\\\"center\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:LPTJmJAIQ:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:LPTJmJAIQ:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Feature 1\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"vl2onnY_o\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"XYgFvd_VE\\\",\\\"set\\\":\\\"Phosphor\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__color\\\":\\\"rgb(0, 153, 255)\\\",\\\"$control__width\\\":\\\"2\\\",\\\"$control__alpha\\\":\\\"0.25\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"LTRD9il6z\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"24px\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"24px\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textVerticalAlignment\\\":\\\"center\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:LTRD9il6z:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:LTRD9il6z:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Feature 2\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"NoeftPI7y\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"swC5bVu2V\\\",\\\"set\\\":\\\"Phosphor\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__color\\\":\\\"rgb(0, 153, 255)\\\",\\\"$control__width\\\":\\\"2\\\",\\\"$control__alpha\\\":\\\"0.25\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"WATJ_kIwq\\\",\\\"attributes\\\":{\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"24px\\\",\\\"textTruncation\\\":\\\"1\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"24px\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textVerticalAlignment\\\":\\\"center\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:WATJ_kIwq:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:WATJ_kIwq:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Feature 3\\\"}}]}]}]}]}]\\n```\\n\\n---\\n\\n## Footer List\\n\\nFooter lists are lists of text layers with links to other pages. Critically these often need more distance between their title and the list than between each list item.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Footer List\\\",\\\"id\\\":\\\"l1BT0PIb4\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"4.46%\\\",\\\"centerAnchorY\\\":\\\"50%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"224px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Title\\\",\\\"id\\\":\\\"pbegd4FmQ\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"0px 0px 5px 0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"CYUJRkX4X\\\",\\\"attributes\\\":{\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:CYUJRkX4X:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:CYUJRkX4X:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Product\\\"}}]}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"xcFAMWZus\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:xcFAMWZus:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:xcFAMWZus:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Features\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"QUfO3VCDJ\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:QUfO3VCDJ:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:QUfO3VCDJ:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Resources\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"qoCBxfCG3\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:qoCBxfCG3:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:qoCBxfCG3:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Gallery\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n## Image List\\n\\nLists with images are often used for blog posts, articles, and similar content. These critically have a title and date.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Image List\\\",\\\"id\\\":\\\"NNEDkmUDT\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"34.38%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"480px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"MdxuKm2oG\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"yqNyThG5z\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"https://framerusercontent.com/images/iePjwFmmdOppWQd5iQSbr8O4UQI.png\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"50px\\\",\\\"height\\\":\\\"40px\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Text\\\",\\\"id\\\":\\\"Gipkm7JzS\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ZHApukolO\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ZHApukolO:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ZHApukolO:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Designing for Momentum\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"l4X90z49E\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:l4X90z49E:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:l4X90z49E:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"June 12, 2026\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Divider\\\",\\\"id\\\":\\\"toeWKdCSY\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(255, 255, 255)\\\",\\\"layout\\\":\\\"null\\\",\\\"opacity\\\":\\\"0.08\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"fWK08rb_X\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"DTgLW_5Yv\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"https://framerusercontent.com/images/4QIgz1Ik6MLZ2dZZPIZesp4wugg.png\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"50px\\\",\\\"height\\\":\\\"40px\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"TKka01eJt\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"SvlZMzyEj\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:SvlZMzyEj:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:SvlZMzyEj:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Visual Cleverness\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"o_tnhcu95\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:o_tnhcu95:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:o_tnhcu95:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"May 20, 2026\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Divider\\\",\\\"id\\\":\\\"ZLyPaNW9S\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(255, 255, 255)\\\",\\\"layout\\\":\\\"null\\\",\\\"opacity\\\":\\\"0.08\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"S9QyOvbkw\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"LG6wmvlIy\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"fill\\\":\\\"https://framerusercontent.com/images/lk4lwfSeQMCxwTVOCqzwauSVvjQ.png\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"50px\\\",\\\"height\\\":\\\"40px\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"YRvXEZK9e\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"lACQ7l4BX\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"textWrapBalance\\\":true},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:lACQ7l4BX:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:lACQ7l4BX:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"On Design Constraints\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"JjOtAcPhH\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:JjOtAcPhH:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:JjOtAcPhH:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"March 5, 2026\\\"}}]}]}]}]}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Logos\":{\"id\":\"HI3c7AXLZ\",\"name\":\"Logos\",\"template\":\"# Logos\\n\\nFor logo clouds and logo strings, or logos in testimonials, use the Logos vector set. This vector set contains hundreds of the most popular company logos. Logo clouds are usually dim, subtle, and not big. Per logo, Height between 24-32 works best, with Width set to fit (auto). This is because not all logos have a 1:1 aspect ratio, and they still have to feel consistent in a layout design.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Logos\\\",\\\"id\\\":\\\"kE3sq3DUB\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"80px 40px 80px 40px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"10%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"KNyL21Hto\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":true,\\\"gap\\\":\\\"20px 30px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"zYNT6EB7t\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Framer\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"aNMyEcRkH\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Cursor\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"BDb883IyK\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Ibm\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"tSMTxTgaN\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Openai\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"dxzbsPQZP\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Adidas\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"sXy7xvX9N\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Nintendo\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"h8tk6dWsG\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Linear\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}}]}]}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Masks\":{\"id\":\"Xs8cyPg6V\",\"name\":\"Masks\",\"template\":\"# Masks\\n\\nMasks allow you to create a mask layer to place over a layer to partially or fully hide portions of the layer. Framer supports gradient masks and image masks. Gradient masks can gently fade out layers and images without having to rely on overlaying a gradient with a solid color on top. This makes the asset work on any background color, as the masked areas are transparent instead of having a solid color.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Image with Mask\\\",\\\"id\\\":\\\"F3Z_zXK1h\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"80px 40px 80px 40px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"10%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Image\\\",\\\"id\\\":\\\"Tm33DpGgP\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"https://framerusercontent.com/images/wXRKiJDFbDXH9TIMnNlvUgazk0.png\\\",\\\"layout\\\":\\\"null\\\",\\\"masks\\\":[{\\\"mask\\\":\\\"linear-gradient(235deg, rgba(0,0,0,0) 28.000000000000004%, rgb(0, 0, 0) 44%, rgb(0, 0, 0) 69%, rgba(0, 0, 0, 0) 83%)\\\"}],\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"600px\\\",\\\"height\\\":\\\"250px\\\"}}]}]\\n```\\n\\n---\\n\\n## Masks on Tickers\\n\\nTickers often have masks to fade out their contents, like a logo string ticker. Here, it is horizontally masked near its side, so each logo gently fades out and appears instead of having a harsh cut-off.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Logo String Ticker with Mask\\\",\\\"id\\\":\\\"VOX4v7C5x\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"40px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"80px 40px 80px 40px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"10%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"fbFKhQ6ZO\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px 30px\\\",\\\"masks\\\":[{\\\"mask\\\":\\\"linear-gradient(90deg, rgba(0,0,0,0) 0%, rgb(0, 0, 0) 9.852941176470589%, rgb(0, 0, 0) 90%, rgba(0, 0, 0, 0) 100%)\\\"}],\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"tickerEffect\\\":{\\\"velocity\\\":20,\\\"hoverModifier\\\":100,\\\"directionModifier\\\":\\\"default\\\",\\\"draggable\\\":\\\"false\\\"}},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"fbU8dCbzh\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Framer\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"UJKDN1_ND\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Cursor\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"HrOr8YZTY\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Ibm\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"keynnG3C0\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Openai\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"oswG77Uhh\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Adidas\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"hbT59pshF\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Nintendo\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"lvcIeS4uS\\\",\\\"set\\\":\\\"Logos\\\",\\\"$control__icon\\\":\\\"Linear\\\",\\\"attributes\\\":{\\\"$control__fill\\\":\\\"rgba(255, 255, 255, 0.3)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"24px\\\"}}]}]}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Navigations\":{\"id\":\"mtde37uwp\",\"name\":\"Navigations\",\"template\":\"# Navigations\\n\\nTop-bar navigations contain links in a row. These are often text-based links, with Link Styles applied. These should have a unique style for Hover and Current, like updating the color.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Topbar\\\",\\\"id\\\":\\\"RskEEOdw4\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"htmlTag\\\":\\\"nav\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"space-between\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"20px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"64px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"MvbxYmX5r\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:MvbxYmX5r:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:MvbxYmX5r:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Links\\\",\\\"id\\\":\\\"JnWGghsAQ\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"15px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"tv2V1No_O\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:tv2V1No_O:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:tv2V1No_O:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Features\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"n1nK4tuKx\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:n1nK4tuKx:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:n1nK4tuKx:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Discover\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"PrFJzbeo5\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:PrFJzbeo5:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:PrFJzbeo5:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Gallery\\\"}}]}]}]}]}]\\n```\\n\\n---\\n\\n## Navigation Components\\n\\nWhen a navigation has to expand or collapse on the phone breakpoint, a Component with Variants must be used - never resist creating a Component for a Navigation to implement a drawer.\\nOn this Phone Variant, a menu icon replaces the links and is the trigger of this expanding interaction.\\nThe group of links within the Phone and Phone Open Variants critically must not have any layout changes \u2014 layout changes will cause unwanted jumps or animations when switching Variants.\\nAlways ensure that the layers that open and close the Drawer are both positioned in the same spot in their own variants so that you can easily toggle back and forth between the Phone and Phone Open Variants.\\nAlways ensure that the contents of the Drawer are identical in each Open and Closed Variant so they appear to smoothly expand and collapse.\\nAlways use exact ids to toggle back and forth between the Open and Closed Variants.\\nCritically, a navigation component and its variants should always have a fill color.\\nReference the following example-json precisely.\\n```example-json\\n[{\\\"type\\\":\\\"ComponentInstanceNode\\\",\\\"id\\\":\\\"V9ao6_Quc\\\",\\\"component\\\":\\\"dwQYwlkEH\\\",\\\"$componentDisplayName\\\":\\\"Topbar 1\\\",\\\"attributes\\\":{\\\"$control__variant\\\":\\\"Phone\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"}}]\\n```\\n\\n---\\n\\n## Creating Navigations from Existing Layers\\n\\nWhenever the task requires creating a Navigation from an existing layer, use a tool to turn the source layers into a Navigation. This guarantees correctness to the original design.\\n\\n---\\n\\n## Sticky Navigations\\n\\nNavigations that should stick to the top while scrolling can be made Sticky by setting Position to Sticky. Critically for top bar navigations, the Top value should be set to 0 here, or have a nice offset if specified. Sticky without Top set does not work. These navigations should have a fill color, so on scroll, they overlap the contents of the page.\\n\\n---\\n\\n## Navigation with Smooth Scrolling Links\\n\\nA single-page website often has a navigation with links where each link points to a specific section on the same page, with Scroll set to Smooth, making the browser animate gently to the matching section. Critically, for this to work, the matching sections on the page have to have a Name defined in Scroll Section. Single pages can contain buttons (call-to-action buttons) that can point to a call-to-action section. It is critical these also point to the matching section. A page can have multiple links towards a single section.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"HGFFf8HaI\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"20px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"78.96%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Topbar\\\",\\\"id\\\":\\\"L9BY2MY9n\\\",\\\"attributes\\\":{\\\"borderStyle\\\":\\\"solid\\\",\\\"borderColor\\\":\\\"#222\\\",\\\"borderBottom\\\":\\\"1px\\\",\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"htmlTag\\\":\\\"nav\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"space-between\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"64px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"gBsOCFZuU\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:gBsOCFZuU:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:gBsOCFZuU:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Links\\\",\\\"id\\\":\\\"K483hBscu\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"15px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"BBgzr7mOR\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"smoothScroll\\\":true},\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:BBgzr7mOR:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:BBgzr7mOR:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Section A\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"qsm1JvEha\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"smoothScroll\\\":true},\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:qsm1JvEha:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:qsm1JvEha:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Section B\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Zhep_qHbf\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"smoothScroll\\\":true},\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Zhep_qHbf:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Zhep_qHbf:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Section C\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Section A\\\",\\\"id\\\":\\\"HR7EW0jB_\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":20,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"scrollTargetEnabled\\\":true,\\\"elementId\\\":\\\"section-a\\\",\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"600px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"Section Label\\\",\\\"id\\\":\\\"tTzYpUapE\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:tTzYpUapE:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:tTzYpUapE:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"section-a\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Section B\\\",\\\"id\\\":\\\"Obc2JYAkQ\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(17, 17, 17)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":20,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"scrollTargetEnabled\\\":true,\\\"elementId\\\":\\\"section-b\\\",\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"600px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"Section Label\\\",\\\"id\\\":\\\"dIEIwoYXC\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:dIEIwoYXC:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:dIEIwoYXC:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"section-b\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Section C\\\",\\\"id\\\":\\\"CSBSJhC_D\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":20,\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"scrollTargetEnabled\\\":true,\\\"elementId\\\":\\\"section-c\\\",\\\"width\\\":\\\"560px\\\",\\\"height\\\":\\\"600px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"name\\\":\\\"Section Label\\\",\\\"id\\\":\\\"C08wpqutw\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:C08wpqutw:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:C08wpqutw:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"section-c\\\"}}]}]}]}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}},{\\\"type\\\":\\\"ComponentNode\\\",\\\"id\\\":\\\"dwQYwlkEH\\\",\\\"name\\\":\\\"Topbar 1\\\",\\\"variables\\\":[],\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Desktop\\\",\\\"id\\\":\\\"xfIyMzFOQ\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"htmlTag\\\":\\\"nav\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"space-between\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"left\\\":\\\"29px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"19.75%\\\",\\\"centerAnchorY\\\":\\\"18.25%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1200px\\\",\\\"height\\\":\\\"64px\\\",\\\"transition\\\":\\\"spring-duration 0.3s 0.2 0s\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Logo, Menu\\\",\\\"id\\\":\\\"E5ABZnfsJ\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"emfo5qqL_\\\",\\\"set\\\":\\\"Lucide\\\",\\\"$control__icon\\\":\\\"Globe\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(255, 255, 255)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"32px\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Menu Icon\\\",\\\"id\\\":\\\"phAuMehYb\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\",\\\"visible\\\":\\\"false\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Bottom\\\",\\\"id\\\":\\\"YLBQQrXzb\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"#999\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"70.83%\\\",\\\"constraintsLocked\\\":true,\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"2px\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Top\\\",\\\"id\\\":\\\"gAVvyv72z\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"#999\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"29.17%\\\",\\\"constraintsLocked\\\":true,\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"2px\\\"}}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Links\\\",\\\"id\\\":\\\"MryBK0Hhl\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"15px\\\",\\\"padding\\\":\\\"20px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ZTDaRWref\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ZTDaRWref:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ZTDaRWref:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Features\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Mn65rqhHT\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Mn65rqhHT:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Mn65rqhHT:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Discover\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"CvV5eXRQS\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:CvV5eXRQS:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:CvV5eXRQS:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Gallery\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"GcdngYTcF\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(102, 102, 102)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:GcdngYTcF:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:GcdngYTcF:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Updates\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Bottom Line\\\",\\\"id\\\":\\\"BZstTbUxz\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgba(255, 255, 255, 0.08)\\\",\\\"layout\\\":\\\"null\\\",\\\"position\\\":\\\"absolute\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"0px\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"0px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"99.88%\\\",\\\"constraintsLocked\\\":true,\\\"width\\\":\\\"1200px\\\",\\\"height\\\":\\\"1px\\\"}}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Phone\\\",\\\"id\\\":\\\"WQYMmOHvF\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"htmlTag\\\":\\\"nav\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"space-between\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"overflow\\\":\\\"hidden\\\",\\\"left\\\":\\\"1329px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"19.75%\\\",\\\"centerAnchorY\\\":\\\"18.25%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"390px\\\",\\\"height\\\":\\\"64px\\\",\\\"transition\\\":\\\"spring-duration 0.3s 0.2 0s\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Phone Open\\\",\\\"id\\\":\\\"ibRzU_0RI\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"htmlTag\\\":\\\"nav\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"space-between\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":0,\\\"overflow\\\":\\\"auto\\\",\\\"overscroll\\\":\\\"contain\\\",\\\"left\\\":\\\"1819px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"19.75%\\\",\\\"centerAnchorY\\\":\\\"18.25%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"390px\\\",\\\"height\\\":\\\"auto\\\",\\\"maxHeight\\\":\\\"100vh\\\",\\\"transition\\\":\\\"spring-duration 0.3s 0.2 0s\\\"}}]}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Overlays\":{\"id\":\"mKN1qNvoe\",\"name\":\"Overlays\",\"template\":\"# Overlays\\n\\nThere are two distinct types of Overlays in Framer: Fixed and Relative. Fixed Overlays let you place layers relative to the viewport. Useful for things like modals and banners. Relative Overlays let you place layers relative to the trigger. Useful for things like dropdown menus and tooltips.\\n\\n---\\n\\n## Fixed Overlays\\n\\nFixed Overlays are often triggered by buttons. They have an optional Backdrop Fill, by default always make this dismissible. They can also have gentle Enter and Exit fading animations, and should have a Z Index set to >5 and <=10 ensure it appears on top of existing content. Layers within the Overlay can also get a nice appear effect, a card or modal animating in with properties Opacity: 0, Scale: 0.96 with Transition set to a Time Based Spring with Time: 0.2 and Bounce: 0.3. The Overlay (backdrop/fill) can have Enter and Exit animations too. Layers within an overlay can apply a \\\"Close Overlay\\\" interaction, useful for dismiss buttons or X icons in modals.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Fixed Overlay\\\",\\\"id\\\":\\\"zUT1ec4zv\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"25.92%\\\",\\\"centerAnchorY\\\":\\\"14.9%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"400px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Button\\\",\\\"id\\\":\\\"TYaDjlCkn\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgba(255,255,255,1)\\\",\\\"onTap\\\":[{\\\"action\\\":\\\"SHOW_OVERLAY\\\",\\\"controls\\\":{\\\"overlay\\\":\\\"RpH2jUAqk\\\"}}],\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px 12px 10px 12px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"CY3wMdm1Q\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(0, 0, 0)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:CY3wMdm1Q:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:CY3wMdm1Q:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Claim Discount\\\"}}]}]},{\\\"type\\\":\\\"FixedOverlayNode\\\",\\\"id\\\":\\\"RpH2jUAqk\\\",\\\"attributes\\\":{\\\"backdrop\\\":{\\\"fill\\\":\\\"rgba(0, 0, 0, 0.8)\\\",\\\"dismissible\\\":true}},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Card\\\",\\\"id\\\":\\\"TatAD315d\\\",\\\"attributes\\\":{\\\"appearEffect\\\":{\\\"threshold\\\":0.5,\\\"trigger\\\":\\\"onMount\\\",\\\"enter\\\":{\\\"opacity\\\":0,\\\"x\\\":0,\\\"y\\\":0,\\\"scale\\\":0.96,\\\"rotate\\\":0,\\\"rotateX\\\":0,\\\"rotateY\\\":0,\\\"skewX\\\":0,\\\"skewY\\\":0,\\\"transition\\\":\\\"spring-duration 0.2s 0.3 0s\\\",\\\"stagger\\\":\\\"0s\\\"}},\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"padding\\\":\\\"20px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"50%\\\",\\\"constraintsLocked\\\":false,\\\"radius\\\":\\\"30px\\\",\\\"width\\\":\\\"360px\\\",\\\"height\\\":\\\"400px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Badge\\\",\\\"id\\\":\\\"WUYJhIU9G\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.05)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.08)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"8px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"6px 8px 6px 8px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"maxWidth\\\":\\\"100%\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ovoKiLQG5\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"13px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ovoKiLQG5:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ovoKiLQG5:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Pro\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"b78q7C7VD\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"5px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"PfqC08FUR\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:PfqC08FUR:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:PfqC08FUR:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Today only\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"tSdGF2dA9\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:tSdGF2dA9:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:tSdGF2dA9:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Get 20% off.\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Divider\\\",\\\"id\\\":\\\"M9SSKsAdb\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgba(255, 255, 255, 0.1)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1px\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Checklist\\\",\\\"id\\\":\\\"Of7oXkMd1\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Feature\\\",\\\"id\\\":\\\"LhVlztUW2\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"RdbBgkaex\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(102, 102, 102)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"19px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"hWjRa70cU\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:hWjRa70cU:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:hWjRa70cU:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Freeform canvas\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Feature\\\",\\\"id\\\":\\\"kWjcq5ddO\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"VJZhci7SC\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(102, 102, 102)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"19px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"kkDqGNLWC\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:kkDqGNLWC:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:kkDqGNLWC:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Instant publishing\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Feature\\\",\\\"id\\\":\\\"Kqh1LfB28\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"zX6D3uCcp\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(102, 102, 102)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"19px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"vfcap_NU7\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:vfcap_NU7:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:vfcap_NU7:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Content editing\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Feature\\\",\\\"id\\\":\\\"nxxZrxzpW\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"mjJdrnGLq\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Check Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"2\\\",\\\"$control__color\\\":\\\"rgb(102, 102, 102)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"20px\\\",\\\"height\\\":\\\"19px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"q4rPV2yUg\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:q4rPV2yUg:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:q4rPV2yUg:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Fast hosting\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Spacer\\\",\\\"id\\\":\\\"siQ88LA2y\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"1fr\\\"}},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"RInjdsd3h\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.05)\\\",\\\"fill\\\":\\\"rgba(255, 255, 255, 0.1)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"10px\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"40px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"GF46YLczz\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:GF46YLczz:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:GF46YLczz:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Claim Discount\\\"}}]}]}]}]}]}]}]}]\\n```\\n\\n---\\n\\n## Relative Overlays\\n\\nRelative overlays can be menus and tooltips. Most often they are used for submenus in navigation bars. They appear on hover, and have smart features like accounting for mouse travel to keep menu open while navigating the cursor towards it. Relative overlay menus can have nice enter and exit animations too. Critically, triggers must always have a MouseEnter Event Variable assigned, and the instance must always have the 'Show On' property set.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Relative Overlay\\\",\\\"id\\\":\\\"DjIm22RLO\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"25.92%\\\",\\\"centerAnchorY\\\":\\\"14.9%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"400px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Button\\\",\\\"id\\\":\\\"d4oSqOvhe\\\",\\\"attributes\\\":{\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"cursor\\\":\\\"pointer\\\",\\\"fill\\\":\\\"rgb(17, 17, 17)\\\",\\\"onMouseEnter\\\":[{\\\"action\\\":\\\"SHOW_OVERLAY\\\",\\\"controls\\\":{\\\"overlay\\\":\\\"xINzxaAPE\\\"}}],\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"10px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px 12px 10px 12px\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"100px\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"dWdthlg7W\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:dWdthlg7W:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:dWdthlg7W:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Menu\\\"}}]}]},{\\\"type\\\":\\\"RelativeOverlayNode\\\",\\\"id\\\":\\\"xINzxaAPE\\\",\\\"attributes\\\":{\\\"appearEffect\\\":{\\\"trigger\\\":\\\"onMount\\\",\\\"enter\\\":{\\\"opacity\\\":0,\\\"x\\\":0,\\\"y\\\":0,\\\"scale\\\":0.97,\\\"rotate\\\":0,\\\"rotateX\\\":0,\\\"rotateY\\\":0,\\\"skewX\\\":0,\\\"skewY\\\":0,\\\"transition\\\":\\\"spring-duration 0.3s 0.3 0s\\\",\\\"stagger\\\":\\\"0s\\\"}},\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.1)\\\",\\\"fill\\\":\\\"rgb(17, 17, 17)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"radius\\\":\\\"20px\\\",\\\"floatingPlacement\\\":\\\"bottom\\\",\\\"floatingAlignment\\\":\\\"center\\\",\\\"floatingOffsetX\\\":\\\"0px\\\",\\\"floatingOffsetY\\\":\\\"10px\\\",\\\"floatingCollisionDetection\\\":true,\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Col\\\",\\\"id\\\":\\\"eNnnCcdmv\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"150px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Category\\\",\\\"id\\\":\\\"UuRjssxvr\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"hjTGx77lm\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:hjTGx77lm:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:hjTGx77lm:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Product\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"List\\\",\\\"id\\\":\\\"Hj_cNvLoU\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"BM3nJA968\\\",\\\"attributes\\\":{\\\"opacity\\\":\\\"0.8\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:BM3nJA968:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:BM3nJA968:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Design\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ympysw3vI\\\",\\\"attributes\\\":{\\\"opacity\\\":\\\"0.8\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ympysw3vI:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ympysw3vI:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Prototype\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"tif7PyD7b\\\",\\\"attributes\\\":{\\\"opacity\\\":\\\"0.8\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:tif7PyD7b:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:tif7PyD7b:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Content\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"t9z2XI2Mz\\\",\\\"attributes\\\":{\\\"opacity\\\":\\\"0.8\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:t9z2XI2Mz:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:t9z2XI2Mz:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Publish\\\"}}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Col\\\",\\\"id\\\":\\\"KuiF4GNHA\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"150px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Category\\\",\\\"id\\\":\\\"TTmLMW7Wg\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"HhJ8SNY_t\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:HhJ8SNY_t:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:HhJ8SNY_t:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Resources\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"List\\\",\\\"id\\\":\\\"adS347fKr\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Kbce3NiU2\\\",\\\"attributes\\\":{\\\"opacity\\\":\\\"0.8\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Kbce3NiU2:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Kbce3NiU2:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Blog\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"QRjC4TS7U\\\",\\\"attributes\\\":{\\\"opacity\\\":\\\"0.8\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:QRjC4TS7U:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:QRjC4TS7U:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"About\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"mslDbNU_E\\\",\\\"attributes\\\":{\\\"opacity\\\":\\\"0.8\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:mslDbNU_E:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:mslDbNU_E:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Company\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"MfaRLCPdb\\\",\\\"attributes\\\":{\\\"opacity\\\":\\\"0.8\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"14px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:MfaRLCPdb:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:MfaRLCPdb:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Careers\\\"}}]}]}]}]}]}]}]}]\\n```\\n\\n---\\n\\n## Navigation with Dropdown Menus\\n\\nNavigation items can also have triggers that open submenus, instead of being links themselves. These use Relative Overlays, and open when you hover a navigation item. These menus can have icons, or rows with separators, rows with sublines, or multi-column layouts. It\u2019s best to apply them to stacks around a text layer, not on the text layers themselves. This increases the hover target, and makes them easier to open.\\nIt's never acceptable to use Relative Overlays for dropdowns on Phone or Mobile breakpoints - always replace them with a Drawer interaction by making the entire navigation item a Component with Variants. See the \\\"Navigations\\\" Guide, and follow it precisely for Drawer implementations with Components.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Topbar with Menus\\\",\\\"id\\\":\\\"UjwTOqKNB\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"htmlTag\\\":\\\"nav\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"space-between\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"sticky\\\",\\\"positionStickyTop\\\":0,\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"760.5px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"26.53%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"C1N0Vrq2i\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"mDpBmd8Fh\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":20,\\\"wght\\\":600},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:mDpBmd8Fh:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:mDpBmd8Fh:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Title\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Links\\\",\\\"id\\\":\\\"FrmBc3iT4\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"0px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"B8vHbSJDc\\\",\\\"attributes\\\":{\\\"onMouseEnter\\\":[{\\\"action\\\":\\\"SHOW_OVERLAY\\\",\\\"controls\\\":{\\\"overlay\\\":\\\"IdJJk7h04\\\"}}],\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"FazcyLiTb\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:FazcyLiTb:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:FazcyLiTb:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Product\\\"}}]}]},{\\\"type\\\":\\\"RelativeOverlayNode\\\",\\\"id\\\":\\\"IdJJk7h04\\\",\\\"attributes\\\":{\\\"appearEffect\\\":{\\\"trigger\\\":\\\"onMount\\\",\\\"enter\\\":{\\\"opacity\\\":0,\\\"x\\\":0,\\\"y\\\":0,\\\"scale\\\":1,\\\"rotate\\\":0,\\\"rotateX\\\":0,\\\"rotateY\\\":0,\\\"skewX\\\":0,\\\"skewY\\\":0,\\\"transition\\\":\\\"spring-duration 0.4s 0.2 0s\\\",\\\"stagger\\\":\\\"0s\\\"}},\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.05)\\\",\\\"fill\\\":\\\"#111\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"15px\\\",\\\"radius\\\":\\\"20px\\\",\\\"floatingPlacement\\\":\\\"bottom\\\",\\\"floatingAlignment\\\":\\\"center\\\",\\\"floatingOffsetX\\\":\\\"0px\\\",\\\"floatingOffsetY\\\":\\\"10px\\\",\\\"floatingCollisionDetection\\\":true,\\\"width\\\":\\\"180px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Item\\\",\\\"id\\\":\\\"LSIJ9KflA\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":15,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"fBb4pDumn\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Preview Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"1.5\\\",\\\"$control__color\\\":\\\"rgb(153, 153, 153)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"UMzK7BxMv\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.3em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:UMzK7BxMv:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:UMzK7BxMv:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Design\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Item\\\",\\\"id\\\":\\\"LIhPQBxoy\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":15,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"jJ2Tb3Zdz\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Edit Pen\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"1.5\\\",\\\"$control__color\\\":\\\"rgb(153, 153, 153)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"MEcVYMeRe\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.3em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:MEcVYMeRe:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:MEcVYMeRe:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Content\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Item\\\",\\\"id\\\":\\\"J1bpE3zmz\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":15,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"XSrCygLvP\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Arrow Up Circle\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"1.5\\\",\\\"$control__color\\\":\\\"rgb(153, 153, 153)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"BSW5K6VSi\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.3em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:BSW5K6VSi:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:BSW5K6VSi:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Publish\\\"}}]}]}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"yPcrWth90\\\",\\\"attributes\\\":{\\\"onMouseEnter\\\":[{\\\"action\\\":\\\"SHOW_OVERLAY\\\",\\\"controls\\\":{\\\"overlay\\\":\\\"IfCuheZoW\\\"}}],\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"10px\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"aPCkEtSA4\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"auto\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":18,\\\"wght\\\":500},\\\"fontWeight\\\":500,\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"0px\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"center\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:aPCkEtSA4:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:aPCkEtSA4:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Resources\\\"}}]}]},{\\\"type\\\":\\\"RelativeOverlayNode\\\",\\\"id\\\":\\\"IfCuheZoW\\\",\\\"attributes\\\":{\\\"appearEffect\\\":{\\\"trigger\\\":\\\"onMount\\\",\\\"enter\\\":{\\\"opacity\\\":0,\\\"x\\\":0,\\\"y\\\":0,\\\"scale\\\":1,\\\"rotate\\\":0,\\\"rotateX\\\":0,\\\"rotateY\\\":0,\\\"skewX\\\":0,\\\"skewY\\\":0,\\\"transition\\\":\\\"spring-duration 0.4s 0.2 0s\\\",\\\"stagger\\\":\\\"0s\\\"}},\\\"border\\\":\\\"1px solid rgba(255, 255, 255, 0.05)\\\",\\\"fill\\\":\\\"#111\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"start\\\",\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"padding\\\":\\\"15px\\\",\\\"radius\\\":\\\"20px\\\",\\\"floatingPlacement\\\":\\\"bottom\\\",\\\"floatingAlignment\\\":\\\"center\\\",\\\"floatingOffsetX\\\":\\\"0px\\\",\\\"floatingOffsetY\\\":\\\"10px\\\",\\\"floatingCollisionDetection\\\":true,\\\"width\\\":\\\"180px\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Item\\\",\\\"id\\\":\\\"EfnOM3FtG\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":15,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"V9zMWrJB2\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Tag\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"1.5\\\",\\\"$control__color\\\":\\\"rgb(153, 153, 153)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"tuxr59yHg\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.3em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:tuxr59yHg:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:tuxr59yHg:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Blog\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Item\\\",\\\"id\\\":\\\"eODer4N_5\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":15,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"AYXQ5qRa6\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Users\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"1.5\\\",\\\"$control__color\\\":\\\"rgb(153, 153, 153)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Dgnle3Ljj\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.3em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Dgnle3Ljj:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Dgnle3Ljj:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Team\\\"}}]}]}]},{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Item\\\",\\\"id\\\":\\\"WkmC18uIc\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"start\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":15,\\\"overflow\\\":\\\"hidden\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"IconNode\\\",\\\"id\\\":\\\"UTrwOq1ZY\\\",\\\"set\\\":\\\"Mage\\\",\\\"$control__icon\\\":\\\"Attachment\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__width\\\":\\\"1.5\\\",\\\"$control__color\\\":\\\"rgb(153, 153, 153)\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"24px\\\",\\\"height\\\":\\\"24px\\\"}},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"avJphmod6\\\",\\\"attributes\\\":{\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"15px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.3em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"userSelect\\\":\\\"none\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:avJphmod6:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:avJphmod6:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Jobs\\\"}}]}]}]}]}]}]}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Shaders\":{\"id\":\"XsxgvTTMv\",\"name\":\"Shaders\",\"template\":\"# Shaders\\n\\nShaders are useful for things like logos with effects, or hero backgrounds. Framer supports different types of Shaders: Image, Logo, Gradient, and Effects. Gradient shaders can have multiple colors, so the background can match the aesthetic of the page. Gradient shaders work best when they have multiple colors with at least two unique hues. Critically, do not use more than 1 Shader of any type per page. Do not add Masks to shaders by default.\\n\\n---\\n\\n## Logo Shaders\\n\\nLogo Shaders let users upload a PNG or SVG and then render an animated gradient or glass effect within their logos or symbols. With properties like Contour and Bevel, Logo Shaders can add subtle depth. Critically, these should not be tiny: around 64px by 64px is a good minimum size, as much smaller it would start looking off.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"OKmH5O5Eg\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"horizontal\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":10,\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"16%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"400px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"ShaderNode\\\",\\\"id\\\":\\\"Qqiqs08Ss\\\",\\\"shader\\\":\\\"logo-gradient\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__angle\\\":\\\"20\\\",\\\"$control__bend\\\":\\\"0.56\\\",\\\"$control__colorBack\\\":\\\"#000000\\\",\\\"$control__colors\\\":[\\\"#000000\\\",\\\"#0051FF\\\",\\\"#0DAAFF\\\",\\\"#BDE4FF\\\"],\\\"$control__contour\\\":\\\"1\\\",\\\"$control__image\\\":\\\"data:framer/asset-reference,pJmZPMBMje78H03m7zBysifSFk.svg?originalFilename=F1.svg&width=32&height=48\\\",\\\"$control__motionMode\\\":\\\"0\\\",\\\"$control__scale\\\":\\\"1.2\\\",\\\"$control__seed\\\":\\\"6\\\",\\\"$control__speed\\\":\\\"0.6\\\",\\\"$control__turbAmp\\\":\\\"0.21\\\",\\\"$control__turbFreq\\\":\\\"1.15\\\",\\\"$control__turbIter\\\":\\\"7\\\",\\\"$control__waveFreq\\\":\\\"2.4\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"64px\\\",\\\"height\\\":\\\"48px\\\"}},{\\\"type\\\":\\\"ShaderNode\\\",\\\"id\\\":\\\"qEo_oO0i0\\\",\\\"shader\\\":\\\"logo-gradient\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__angle\\\":\\\"20\\\",\\\"$control__bend\\\":\\\"0.56\\\",\\\"$control__colorBack\\\":\\\"#000000\\\",\\\"$control__colors\\\":[\\\"rgb(0, 0, 26)\\\",\\\"rgb(41, 98, 255)\\\",\\\"rgb(64, 188, 255)\\\",\\\"rgb(255, 184, 181)\\\",\\\"rgb(255, 193, 79)\\\"],\\\"$control__contour\\\":\\\"1\\\",\\\"$control__image\\\":\\\"data:framer/asset-reference,qwN2FoyP9RslPA1iycPVid8p4A.svg?originalFilename=F2.svg&width=32&height=48\\\",\\\"$control__motionMode\\\":\\\"0\\\",\\\"$control__scale\\\":\\\"1.2\\\",\\\"$control__seed\\\":\\\"6\\\",\\\"$control__speed\\\":\\\"0.6\\\",\\\"$control__turbAmp\\\":\\\"0.21\\\",\\\"$control__turbFreq\\\":\\\"1.15\\\",\\\"$control__turbIter\\\":\\\"7\\\",\\\"$control__waveFreq\\\":\\\"2.4\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"64px\\\",\\\"height\\\":\\\"48px\\\"}},{\\\"type\\\":\\\"ShaderNode\\\",\\\"id\\\":\\\"b2clEUdZy\\\",\\\"shader\\\":\\\"logo-gradient\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"$control__angle\\\":\\\"0\\\",\\\"$control__bend\\\":\\\"0.56\\\",\\\"$control__colorBack\\\":\\\"#000000\\\",\\\"$control__colors\\\":[\\\"rgb(0, 1, 18)\\\",\\\"rgb(13, 0, 43)\\\",\\\"#6800C9\\\",\\\"rgb(255, 74, 74)\\\"],\\\"$control__contour\\\":\\\"1\\\",\\\"$control__image\\\":\\\"data:framer/asset-reference,3GvmQte0HHiywt5jJZWt3rxoXI.svg?originalFilename=F3.svg&width=32&height=48\\\",\\\"$control__motionMode\\\":\\\"0\\\",\\\"$control__scale\\\":\\\"1.2\\\",\\\"$control__seed\\\":\\\"6\\\",\\\"$control__speed\\\":\\\"0.6\\\",\\\"$control__turbAmp\\\":\\\"0.64\\\",\\\"$control__turbFreq\\\":\\\"1.15\\\",\\\"$control__turbIter\\\":\\\"5\\\",\\\"$control__waveFreq\\\":\\\"3.3\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"64px\\\",\\\"height\\\":\\\"48px\\\"}}]}]\\n```\\n\\n---\\n\\n## Image Shaders\\n\\nImage Shaders like Chromatic Aberration have an Image Property, which, when set, can apply a unique effect to the uploaded image, adding to or distorting or animating the image in unique ways.\\n```example-json\\n[{\\\"type\\\":\\\"ShaderNode\\\",\\\"id\\\":\\\"eoP78VKC3\\\",\\\"shader\\\":\\\"chromatic-aberration\\\",\\\"attributes\\\":{\\\"$control__mode\\\":\\\"3\\\",\\\"$control__pulse\\\":\\\"30\\\",\\\"$control__radius\\\":\\\"60\\\",\\\"$control__speed\\\":\\\"0\\\",\\\"$control__swirl\\\":\\\"10\\\",\\\"$control__swirlSpeed\\\":\\\"0.5\\\",\\\"$control__texture\\\":\\\"data:framer/asset-reference,8YqSiXvya6m9Z6ZOIzVXDo6rVaY.png?originalFilename=WFD+UP%402x.png&width=1600&height=900\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"400px\\\"}}]\\n```\\n\\n---\\n\\n## Gradient Shaders\\n\\nGradient shaders like Liquid Gradient let people pick their own colors. The most customizable gradient shader is the Liquid Gradient shader. The Speed value should be kept low, around 0.1. Scale should be kept below 1. Seed can be anything. Critically, only one shader should exist per page. Use the following example as a good default for properties, but make sure to customize colors and seed.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Gradient Background\\\",\\\"id\\\":\\\"DSAY9M11O\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"null\\\",\\\"overflow\\\":\\\"clip\\\",\\\"left\\\":\\\"148px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"7px\\\",\\\"centerAnchorX\\\":\\\"22.5%\\\",\\\"centerAnchorY\\\":\\\"95.48%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"500px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"ShaderNode\\\",\\\"id\\\":\\\"Ar0ikAMmf\\\",\\\"shader\\\":\\\"liquid-gradient\\\",\\\"attributes\\\":{\\\"$control__colors\\\":[\\\"#00001A\\\",\\\"#2962FF\\\",\\\"#40BCFF\\\",\\\"#FFB8B5\\\",\\\"#FFC14F\\\"],\\\"$control__contrast\\\":\\\"1.1\\\",\\\"$control__distBias\\\":\\\"0\\\",\\\"$control__dither\\\":\\\"0.05\\\",\\\"$control__ditherMode\\\":\\\"0\\\",\\\"$control__exposure\\\":\\\"1.1\\\",\\\"$control__jellify\\\":\\\"false\\\",\\\"$control__loop\\\":\\\"0\\\",\\\"$control__saturation\\\":\\\"1\\\",\\\"$control__scale\\\":\\\"0.58\\\",\\\"$control__seed\\\":\\\"71\\\",\\\"$control__speed\\\":\\\"0.1\\\",\\\"$control__turbAmp\\\":\\\"0.6\\\",\\\"$control__turbFreq\\\":\\\"1.13\\\",\\\"$control__turbIter\\\":\\\"8\\\",\\\"$control__waveFreq\\\":\\\"3.8\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"0px\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"0px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"66.67%\\\",\\\"constraintsLocked\\\":true,\\\"width\\\":\\\"760px\\\",\\\"height\\\":\\\"400px\\\"}}]}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Spinners\":{\"id\":\"ZqZ_XlpZr\",\"name\":\"Spinners\",\"template\":\"# Spinners\\n\\nSpinners can be single layers with the following combination: a border with a solid color, a mask with a conic gradient, and a loop effect that only sets rotation. Spinners should always have a 1:1 aspect ratio of width and height.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Logos\\\",\\\"id\\\":\\\"x8K4_yZM2\\\",\\\"attributes\\\":{\\\"fill\\\":\\\"rgb(0, 0, 0)\\\",\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"overflow\\\":\\\"hidden\\\",\\\"padding\\\":\\\"20px\\\",\\\"left\\\":\\\"0px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"10%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"200px\\\"},\\\"children\\\":[{\\\"type\\\":\\\"FrameNode\\\",\\\"id\\\":\\\"qL6vR4TVs\\\",\\\"attributes\\\":{\\\"aspectRatio\\\":1,\\\"border\\\":\\\"3px solid rgb(255, 255, 255)\\\",\\\"layout\\\":\\\"null\\\",\\\"loopEffect\\\":{\\\"repeatType\\\":\\\"loop\\\",\\\"repeatDelay\\\":\\\"0s\\\",\\\"pauseOffscreen\\\":true,\\\"opacity\\\":1,\\\"x\\\":0,\\\"y\\\":0,\\\"scale\\\":1,\\\"rotate\\\":360,\\\"rotateX\\\":0,\\\"rotateY\\\":0,\\\"skewX\\\":0,\\\"skewY\\\":0,\\\"transition\\\":\\\"tween 0,0,1,1 0.6s 0s\\\"},\\\"masks\\\":[{\\\"mask\\\":\\\"conic-gradient(from 0deg at 50% 50%, rgba(0,0,0,0) 0deg, rgba(0,0,0,1) 360deg)\\\"}],\\\"overflow\\\":\\\"clip\\\",\\\"position\\\":\\\"relative\\\",\\\"radius\\\":\\\"500px\\\",\\\"width\\\":\\\"30px\\\",\\\"height\\\":\\\"30px\\\"}}]}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"},\"Typography\":{\"id\":\"McFvIr_N3\",\"name\":\"Typography\",\"template\":\"# Typography\\n\\nFramer supports many font families, and supports variable fonts and opentype features. When people ask for a specific vibe, theme, or feel, via keywords like \\\"business\\\", \\\"calm\\\", \\\"fancy\\\", \\\"cute\\\", \\\"artistic\\\", \\\"vintage\\\", \\\"playful\\\", \\\"loud\\\", \\\"sophisticated\\\", \\\"futuristic\\\", \\\"active\\\", \\\"stiff\\\", \\\"innovative\\\", \\\"happy\\\", \\\"childlike\\\", \\\"rugged\\\", \\\"excited\\\", look up matching fonts. When a user prompt does not specify any vibe or theme, like \\\"make a landing page about XYZ\\\", then we default to the fonts below.\\n```example-json\\n[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"DuK3f_Zle\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0.5px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"2.36%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:DuK3f_Zle:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:DuK3f_Zle:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Inter, a neutral sans-serif great for body copy with variable and opentype support\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ceHF61IlU\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"44.5px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"11%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ceHF61IlU:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ceHF61IlU:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Google Sans Flex, a flexible sans-serif great for body copy with variable and opentype support\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"nvQr4vSFk\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"88.5px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"19.65%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:nvQr4vSFk:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:nvQr4vSFk:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Instrument Sans, a geometric sans-serif great for headings with variable and opentype support.\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"jO2goJTtn\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"132.5px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"28.29%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:jO2goJTtn:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:jO2goJTtn:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Apfel Grotezk, a geometric sans-serif font great for body copy with opentype support.\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"zOk8w0pPZ\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"176.5px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"36.94%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:zOk8w0pPZ:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:zOk8w0pPZ:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Geist, a warm sans-serif great for body copy with variable and opentype support\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"jYC1IB3Tg\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"45.58%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:jYC1IB3Tg:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:jYC1IB3Tg:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Geist Mono, a mono-spaced font with variable and opentype support\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Z4NqvF6gS\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"54.22%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Z4NqvF6gS:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Z4NqvF6gS:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Instrument Serif, an elegant serif font great for headings with opentype support.\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"zaVilrjmX\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"176.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"62.87%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:zaVilrjmX:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:zaVilrjmX:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"EB Garamond, an elegant serif font with variable and opentype support. Works best at regular weights.\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"jHeAmRpmx\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"132.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"71.51%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"wght\\\":400,\\\"opsz\\\":18,\\\"GRAD\\\":0,\\\"SPAC\\\":0},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:jHeAmRpmx:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:jHeAmRpmx:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Elstob, a warm old-style serif font great for headings with variable and opentype support.\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"oioiySggj\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"88.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"80.16%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:oioiySggj:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:oioiySggj:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Crimson Text, an elegant serif font great for body copy with opentype support.\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"LSUa0dBpY\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"44.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"88.8%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:LSUa0dBpY:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:LSUa0dBpY:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Cardo, a legible serif font great for body copy.\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"l2QMNzJ3s\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"0.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"97.45%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:l2QMNzJ3s:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:l2QMNzJ3s:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Radley, a friendly serif font great for body copy.\\\"}}]}]}]\\n```\\n\\n---\\n\\n## Typographic details\\n\\nAdding typographic details using inline rich text styling to highlight parts of a sentence or heading is a way to add lovely details to a design and to call-out specific parts, such as places or people, or parts of a sentence that require more emphasis. Such inline styles can be color, italics, weights, variable properties, and decoration styles like underline.\\nAdding typographic details helps.\\n\\n---\\n\\n## Fit text\\n\\nText layers can have Size set to Fit at 100%. This makes them stretch edge to edge. This only works well with a single word, preferably a short one. Use sparingly. Critically, the Width of the Text layer has to set to 100% or Fill, and Height has to be set to Fit. When using Fit text, also set its Overflow to Visible, ensuring the big heading is not clipped by its line height.\\n```example-json\\n[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"r8YBzw7xQ\\\",\\\"attributes\\\":{\\\"left\\\":\\\"536px\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"81px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"0%\\\",\\\"centerAnchorY\\\":\\\"0%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"auto-fit(100%)\\\",\\\"letterSpacing\\\":\\\"-0.05em\\\",\\\"lineHeight\\\":\\\"1em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:r8YBzw7xQ:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"p\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:r8YBzw7xQ:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"CONTOUR\\\"}}]}]}]\\n```\\n\\n---\\n\\n## Pairing fonts\\n\\nNot all fonts pair well. While designs can also use a single font or single type of font, when pairing, often works well to pair a sans-serif with a serif font. It also helps to use different type treatments, like an uppercased and smaller sans-serif above a larger serif font.\\n```example-json\\n[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"irCAOTjlb\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"6.67%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"10px\\\",\\\"letterSpacing\\\":\\\"0.2em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textTransform\\\":\\\"uppercase\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:irCAOTjlb:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:irCAOTjlb:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"COMING SOON TO FRAMER\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"vuveASBfi\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"0.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"67.78%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"-0.03em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:vuveASBfi:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:vuveASBfi:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"A \\\"}},{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:vuveASBfi:0:1\\\",\\\"attributes\\\":{\\\"text\\\":\\\"new way\\\"}},{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:vuveASBfi:0:2\\\",\\\"attributes\\\":{\\\"text\\\":\\\" to design.\\\"}}]}]}]\\n```\\n```example-json\\n[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"vNbbrA6h3\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"6.67%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"10px\\\",\\\"letterSpacing\\\":\\\"0.2em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textTransform\\\":\\\"uppercase\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:vNbbrA6h3:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:vNbbrA6h3:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"COMING SOON TO FRAMER\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ontiYPUak\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"0.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"67.78%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ontiYPUak:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ontiYPUak:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"A \\\"}},{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ontiYPUak:0:1\\\",\\\"attributes\\\":{\\\"text\\\":\\\"new way\\\"}},{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ontiYPUak:0:2\\\",\\\"attributes\\\":{\\\"text\\\":\\\" to design.\\\"}}]}]}]\\n```\\n```example-json\\n[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"GF6HCw6Oy\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"opacity\\\":\\\"0.5\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"0px\\\",\\\"bottom\\\":\\\"null\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"6.67%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"20px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:GF6HCw6Oy:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:GF6HCw6Oy:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Coming Soon\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"Wk7xiVl8n\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"0.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"67.78%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"-0.01em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:Wk7xiVl8n:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:Wk7xiVl8n:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"A new way to design.\\\"}}]}]}]\\n```\\n\\n---\\n\\n## Variable Properties\\n\\nSome fonts, like Google Sans Flex, are extremely customizable via their variable properties. Fonts like these can render in different styles that can completely change their look and feel: they can appear wide and extended, for headings, and rounded, too.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Variable Properties\\\",\\\"id\\\":\\\"yYRlcli4s\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"padding\\\":\\\"20px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"19.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"93.59%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"f2BxDXIpY\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":48,\\\"wdth\\\":100,\\\"wght\\\":400,\\\"GRAD\\\":0,\\\"ROND\\\":0,\\\"slnt\\\":0},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:f2BxDXIpY:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:f2BxDXIpY:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Default Google Sans Flex\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"KXixQHFFH\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":48,\\\"wdth\\\":150,\\\"wght\\\":600,\\\"GRAD\\\":50,\\\"ROND\\\":0,\\\"slnt\\\":0},\\\"fontWeight\\\":600,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:KXixQHFFH:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:KXixQHFFH:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Wide Google Sans Flex\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"ZkMsLAENu\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":48,\\\"wdth\\\":100,\\\"wght\\\":400,\\\"GRAD\\\":100,\\\"ROND\\\":100,\\\"slnt\\\":0},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:ZkMsLAENu:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:ZkMsLAENu:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Rounded Google Sans Flex\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n### Variable Properties: Optical Size\\n\\nSome fonts have an \\\"Optical\\\" or \\\"Optical Size\\\" property, which should always match the font size for optimal kerning. This prevents needing to use negative letter-spacing to manually make a font work better at display font sizes.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Opentype Properties\\\",\\\"id\\\":\\\"wG21b8ZiV\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"padding\\\":\\\"20px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"19.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"93.59%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"HzHMW8iuc\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:HzHMW8iuc:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:HzHMW8iuc:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Not great at 48px: default Inter\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"jSDEw6J4I\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":32,\\\"wght\\\":400},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:jSDEw6J4I:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:jSDEw6J4I:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Great at 48px: Inter with Optical Size\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n## Opentype Properties\\n\\nOpentype properties can make a font feel more unique. Fonts like Inter support tons of them, and these properties, just like Variable properties, help feel a font less standard.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Opentype Properties\\\",\\\"id\\\":\\\"wae4JbjNU\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"padding\\\":\\\"20px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"19.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"93.59%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"cS9QNWNWe\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":32,\\\"wght\\\":400},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:cS9QNWNWe:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:cS9QNWNWe:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Inter with Optical Size \u2014\u00A0123\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"DfyKiN7YR\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":32,\\\"wght\\\":400},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\",\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:DfyKiN7YR:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:DfyKiN7YR:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Inter with Optical Size (alt a, alt 1, alt 3, and alt l) and OpenType \u2014\u00A0123\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n## Opentype Properties: Superscript and Subscript\\n\\nUsing Superscript and Subscript for numbers appended to words is a nice typographic detail to add to things like project lists or indeces.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Superscript and Subscript\\\",\\\"id\\\":\\\"MLc4O0iKg\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"padding\\\":\\\"20px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"19.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"93.59%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"iS3k7boOs\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":32,\\\"wght\\\":400},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:iS3k7boOs:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:iS3k7boOs:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Chapter\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:iS3k7boOs:0:1\\\",\\\"attributes\\\":{\\\"text\\\":\\\"01\\\",\\\"openTypeFontFeatures\\\":{\\\"sups\\\":\\\"on\\\"},\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"TMJXKqAt6\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":32,\\\"wght\\\":400},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:TMJXKqAt6:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:TMJXKqAt6:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Chapter\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"}},{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:TMJXKqAt6:0:1\\\",\\\"attributes\\\":{\\\"text\\\":\\\"02\\\",\\\"openTypeFontFeatures\\\":{\\\"subs\\\":\\\"on\\\"},\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n## Typographic Symbols\\n\\nUsing typographic symbols like the trademark symbol, registered trademark symbol, and copyright symbol, can add nice flourishes to typography when used sparingly.\\n```example-json\\n[{\\\"type\\\":\\\"FrameNode\\\",\\\"name\\\":\\\"Opentype Properties\\\",\\\"id\\\":\\\"GEFSyd5Yx\\\",\\\"attributes\\\":{\\\"layout\\\":\\\"stack\\\",\\\"stackDirection\\\":\\\"vertical\\\",\\\"stackDistribution\\\":\\\"center\\\",\\\"stackAlignment\\\":\\\"center\\\",\\\"stackWrapEnabled\\\":false,\\\"gap\\\":\\\"20px\\\",\\\"padding\\\":\\\"20px\\\",\\\"left\\\":\\\"null\\\",\\\"right\\\":\\\"null\\\",\\\"top\\\":\\\"null\\\",\\\"bottom\\\":\\\"19.5px\\\",\\\"centerAnchorX\\\":\\\"50%\\\",\\\"centerAnchorY\\\":\\\"93.59%\\\",\\\"constraintsLocked\\\":false,\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\"},\\\"children\\\":[{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"LSXUj0eOw\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":32,\\\"wght\\\":400},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:LSXUj0eOw:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:LSXUj0eOw:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Introducing My App\u2122\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"RkczI8b1q\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":32,\\\"wght\\\":400},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:RkczI8b1q:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:RkczI8b1q:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"Introducing My App\u00AE\\\"}}]}]},{\\\"type\\\":\\\"RichTextNode\\\",\\\"id\\\":\\\"a7rybsZiW\\\",\\\"attributes\\\":{\\\"linkStylePreset\\\":\\\"Link\\\",\\\"position\\\":\\\"relative\\\",\\\"width\\\":\\\"1fr\\\",\\\"height\\\":\\\"auto\\\",\\\"fontVariationAxes\\\":{\\\"opsz\\\":32,\\\"wght\\\":400},\\\"fontWeight\\\":400,\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"openTypeFontFeatures\\\":{\\\"cv11\\\":\\\"on\\\",\\\"cv05\\\":\\\"on\\\",\\\"cv01\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"left\\\",\\\"textDecorationStyle\\\":\\\"solid\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextBlock\\\",\\\"id\\\":\\\"v:a7rybsZiW:0\\\",\\\"attributes\\\":{\\\"tag\\\":\\\"h1\\\"},\\\"children\\\":[{\\\"type\\\":\\\"TextRun\\\",\\\"id\\\":\\\"v:a7rybsZiW:0:0\\\",\\\"attributes\\\":{\\\"text\\\":\\\"\u00A9 Copyright 2026\\\"}}]}]}]}]\\n```\\n\\n---\\n\\n## Example References\\n```example-json\\n[{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 1\\\",\\\"id\\\":\\\"Sfue7V1QW\\\",\\\"attributes\\\":{\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"48px\\\",\\\"letterSpacing\\\":\\\"0.01em\\\",\\\"lineHeight\\\":\\\"1.1em\\\",\\\"paragraphSpacing\\\":\\\"0\\\"}},\\\"tag\\\":\\\"h1\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Heading 3\\\",\\\"id\\\":\\\"UUInh0_rj\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.2em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}},\\\"tag\\\":\\\"h3\\\"}},{\\\"type\\\":\\\"TextStylePresetNode\\\",\\\"name\\\":\\\"Body\\\",\\\"id\\\":\\\"zzTwSIxIn\\\",\\\"attributes\\\":{\\\"paragraphSpacing\\\":20,\\\"openTypeFontFeatures\\\":{\\\"blwf\\\":\\\"on\\\",\\\"cv09\\\":\\\"on\\\",\\\"cv03\\\":\\\"on\\\",\\\"cv04\\\":\\\"on\\\",\\\"cv11\\\":\\\"on\\\"},\\\"textAlignment\\\":\\\"start\\\",\\\"textColor\\\":\\\"rgb(119, 119, 119)\\\",\\\"breakpoint\\\":{\\\"default\\\":{\\\"minWidth\\\":\\\"0px\\\",\\\"fontSize\\\":\\\"16px\\\",\\\"letterSpacing\\\":\\\"0em\\\",\\\"lineHeight\\\":\\\"1.6em\\\",\\\"paragraphSpacing\\\":\\\"20\\\"}}}},{\\\"type\\\":\\\"LinkStylePresetNode\\\",\\\"name\\\":\\\"Link\\\",\\\"id\\\":\\\"AAVx5OPvp\\\",\\\"attributes\\\":{\\\"link\\\":{\\\"textColor\\\":\\\"rgb(153, 153, 153)\\\",\\\"hover\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"current\\\":{\\\"textColor\\\":\\\"rgb(255, 255, 255)\\\"},\\\"transition\\\":\\\"tween 0.44,0,0.56,1 0.2s 0s\\\"}}}]\\n```\",\"projectId\":\"QXlKw8XVMqBk8MJc3t8p\"}}", "import type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { BundledImplementationGuide, SerializedAgentExample } from \"./types.ts\"\n\nexport const LOCAL_EXAMPLES_STATE_SCHEMA_VERSION = 1\n\nexport interface AgentExamplesVersionManifest {\n\tversionDate: string\n}\n\nexport interface LocalExamplesChangeSet {\n\tadded: NodeID[]\n\tmodified: NodeID[]\n\tdeleted: string[]\n}\n\nexport interface LocalExamplesState {\n\tschemaVersion: number\n\tupdatedAt: string\n\texamples: SerializedAgentExample[]\n\tdeletedBundledExampleNames: string[]\n\tchanges: LocalExamplesChangeSet\n}\n\ninterface BundledSelectionMaps {\n\tnameById: Map<NodeID, string>\n\tidByName: Map<string, NodeID>\n\tids: Set<NodeID>\n}\n\nexport function getBundledSelectionMaps(\n\tbundledExamples: Record<string, BundledImplementationGuide>,\n): BundledSelectionMaps {\n\tconst nameById = new Map<NodeID, string>()\n\tconst idByName = new Map<string, NodeID>()\n\tconst ids = new Set<NodeID>()\n\n\tfor (const [name, example] of Object.entries(bundledExamples)) {\n\t\tnameById.set(example.id, name)\n\t\tidByName.set(name, example.id)\n\t\tids.add(example.id)\n\t}\n\n\treturn { nameById, idByName, ids }\n}\n\nexport function createDefaultLocalExamplesState(): LocalExamplesState {\n\treturn {\n\t\tschemaVersion: LOCAL_EXAMPLES_STATE_SCHEMA_VERSION,\n\t\tupdatedAt: new Date(0).toISOString(),\n\t\texamples: [],\n\t\tdeletedBundledExampleNames: [],\n\t\tchanges: {\n\t\t\tadded: [],\n\t\t\tmodified: [],\n\t\t\tdeleted: [],\n\t\t},\n\t}\n}\n\nexport function cloneLocalExamplesState(state: LocalExamplesState): LocalExamplesState {\n\treturn {\n\t\tschemaVersion: state.schemaVersion,\n\t\tupdatedAt: state.updatedAt,\n\t\texamples: [...state.examples],\n\t\tdeletedBundledExampleNames: [...state.deletedBundledExampleNames],\n\t\tchanges: {\n\t\t\tadded: [...state.changes.added],\n\t\t\tmodified: [...state.changes.modified],\n\t\t\tdeleted: [...state.changes.deleted],\n\t\t},\n\t}\n}\n\nexport function normalizeLocalExamplesState(\n\tstate: LocalExamplesState,\n\tbundledSelectionKeys: ReadonlySet<NodeID>,\n): LocalExamplesState {\n\tconst examplesById = new Map<NodeID, SerializedAgentExample>()\n\tfor (const example of state.examples) {\n\t\texamplesById.set(example.id, example)\n\t}\n\n\tconst deletedBundledExampleNames = Array.from(new Set(state.deletedBundledExampleNames)).sort((a, b) =>\n\t\ta.localeCompare(b),\n\t)\n\tconst examples = Array.from(examplesById.values())\n\tconst added = examples\n\t\t.filter(example => !bundledSelectionKeys.has(example.id))\n\t\t.map(example => example.id)\n\t\t.sort((a, b) => a.localeCompare(b))\n\tconst modified = examples\n\t\t.filter(example => bundledSelectionKeys.has(example.id))\n\t\t.map(example => example.id)\n\t\t.sort((a, b) => a.localeCompare(b))\n\n\treturn {\n\t\tschemaVersion: LOCAL_EXAMPLES_STATE_SCHEMA_VERSION,\n\t\tupdatedAt: state.updatedAt,\n\t\texamples,\n\t\tdeletedBundledExampleNames,\n\t\tchanges: {\n\t\t\tadded,\n\t\t\tmodified,\n\t\t\tdeleted: [...deletedBundledExampleNames],\n\t\t},\n\t}\n}\n\nexport function upsertLocalExample(\n\tstate: LocalExamplesState,\n\texample: SerializedAgentExample,\n\tbundledNameById: ReadonlyMap<NodeID, string>,\n\tbundledSelectionKeys: ReadonlySet<NodeID>,\n): LocalExamplesState {\n\tconst examples = state.examples.filter(current => current.id !== example.id)\n\texamples.push(example)\n\n\tconst deletedBundledExampleNames = bundledNameById.has(example.id)\n\t\t? state.deletedBundledExampleNames.filter(name => name !== bundledNameById.get(example.id))\n\t\t: state.deletedBundledExampleNames\n\n\treturn normalizeLocalExamplesState(\n\t\t{\n\t\t\t...state,\n\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\texamples,\n\t\t\tdeletedBundledExampleNames,\n\t\t},\n\t\tbundledSelectionKeys,\n\t)\n}\n\nexport function removeLocalExampleByName(\n\tstate: LocalExamplesState,\n\tname: string,\n\tbundledSelectionKeys: ReadonlySet<NodeID>,\n): LocalExamplesState {\n\treturn normalizeLocalExamplesState(\n\t\t{\n\t\t\t...state,\n\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\texamples: state.examples.filter(example => example.name !== name),\n\t\t},\n\t\tbundledSelectionKeys,\n\t)\n}\n\nexport function setBundledExampleDeleted(\n\tstate: LocalExamplesState,\n\tname: string,\n\tdeleted: boolean,\n\tbundledSelectionKeys: ReadonlySet<NodeID>,\n): LocalExamplesState {\n\tconst deletedBundledExampleNames = deleted\n\t\t? [...state.deletedBundledExampleNames, name]\n\t\t: state.deletedBundledExampleNames.filter(currentName => currentName !== name)\n\n\treturn normalizeLocalExamplesState(\n\t\t{\n\t\t\t...state,\n\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\tdeletedBundledExampleNames,\n\t\t},\n\t\tbundledSelectionKeys,\n\t)\n}\n\nexport function clearLocalExamples(\n\tstate: LocalExamplesState,\n\tbundledSelectionKeys: ReadonlySet<NodeID>,\n): LocalExamplesState {\n\treturn normalizeLocalExamplesState(\n\t\t{\n\t\t\t...state,\n\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\texamples: [],\n\t\t},\n\t\tbundledSelectionKeys,\n\t)\n}\n\nexport function clearRemovedBundledExamples(\n\tstate: LocalExamplesState,\n\tbundledSelectionKeys: ReadonlySet<NodeID>,\n): LocalExamplesState {\n\treturn normalizeLocalExamplesState(\n\t\t{\n\t\t\t...state,\n\t\t\tupdatedAt: new Date().toISOString(),\n\t\t\tdeletedBundledExampleNames: [],\n\t\t},\n\t\tbundledSelectionKeys,\n\t)\n}\n\nexport function isLocallyAddedExample(state: LocalExamplesState, id: NodeID): boolean {\n\treturn state.changes.added.includes(id)\n}\n\nexport function isLocallyModifiedExample(state: LocalExamplesState, id: NodeID): boolean {\n\treturn state.changes.modified.includes(id)\n}\n", "import * as idb from \"@iamakulov/idb-keyval\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { isArray, isNull, isObject, isString } from \"utils/typeChecks.ts\"\nimport bundledExamples from \"./agent-examples.json\" with { type: \"json\" }\nimport {\n\tLOCAL_EXAMPLES_STATE_SCHEMA_VERSION,\n\ttype LocalExamplesChangeSet,\n\ttype LocalExamplesState,\n\tclearLocalExamples as clearExamplesInState,\n\tclearRemovedBundledExamples as clearRemovedBundledInState,\n\tcloneLocalExamplesState,\n\tcreateDefaultLocalExamplesState,\n\tgetBundledSelectionMaps,\n\tisLocallyAddedExample,\n\tisLocallyModifiedExample,\n\tnormalizeLocalExamplesState,\n\tremoveLocalExampleByName,\n\tsetBundledExampleDeleted,\n\tupsertLocalExample,\n} from \"./localExamplesState.ts\"\nimport type { BundledImplementationGuide, ImplementationGuide, SerializedAgentExample } from \"./types.ts\"\n\nconst bundledNodeExamples: Record<string, BundledImplementationGuide> = bundledExamples\nconst bundledSelectionMaps = getBundledSelectionMaps(bundledNodeExamples)\n\n/** Find bundled example name by selection nodes. */\nexport function getBundledExampleNameById(id: NodeID): string | undefined {\n\treturn bundledSelectionMaps.nameById.get(id)\n}\n\n/** Get a bundled serialized example by name */\nexport function getBundledSerializedByName(name: string): BundledImplementationGuide | undefined {\n\treturn bundledNodeExamples[name]\n}\n\nconst LOCAL_EXAMPLES_STATE_KEY = \"agent-local-examples-state-v2\"\nconst USE_LOCAL_MODE_KEY = \"agent-examples-use-local-mode\"\n\n// In-memory cache for local examples state (populated async)\nlet localExamplesStateCache: LocalExamplesState | null = null\nlet localExamplesStateLoadingPromise: Promise<LocalExamplesState> | null = null\n\nfunction isLocalExamplesState(value: unknown): value is LocalExamplesState {\n\tif (!isObject(value)) return false\n\tif (value.schemaVersion !== LOCAL_EXAMPLES_STATE_SCHEMA_VERSION) return false\n\tif (!isString(value.updatedAt)) return false\n\tif (!isArray(value.examples)) return false\n\tif (!isArray(value.deletedBundledExampleNames)) return false\n\tif (!isObject(value.changes)) return false\n\tif (!isArray(value.changes.added)) return false\n\tif (!isArray(value.changes.modified)) return false\n\tif (!isArray(value.changes.deleted)) return false\n\treturn true\n}\n\nasync function fetchLocalExamplesState(): Promise<LocalExamplesState> {\n\tlet nextState = createDefaultLocalExamplesState()\n\n\ttry {\n\t\tconst stored = await idb.get<unknown>(LOCAL_EXAMPLES_STATE_KEY)\n\t\tif (isLocalExamplesState(stored)) {\n\t\t\tnextState = normalizeLocalExamplesState(stored, bundledSelectionMaps.ids)\n\t\t} else {\n\t\t\tawait idb.set(LOCAL_EXAMPLES_STATE_KEY, nextState)\n\t\t}\n\t} catch {\n\t\t// Fall back to default state on IndexedDB failures\n\t} finally {\n\t\tlocalExamplesStateLoadingPromise = null\n\t}\n\n\tlocalExamplesStateCache = nextState\n\treturn nextState\n}\n\nasync function loadLocalExamplesState(): Promise<LocalExamplesState> {\n\tif (!isNull(localExamplesStateCache)) return cloneLocalExamplesState(localExamplesStateCache)\n\tif (!isNull(localExamplesStateLoadingPromise)) {\n\t\treturn localExamplesStateLoadingPromise.then(state => cloneLocalExamplesState(state))\n\t}\n\n\tconst loadingPromise = fetchLocalExamplesState()\n\tlocalExamplesStateLoadingPromise = loadingPromise\n\treturn loadingPromise.then(state => cloneLocalExamplesState(state))\n}\n\nasync function saveLocalExamplesState(state: LocalExamplesState): Promise<void> {\n\tlocalExamplesStateCache = normalizeLocalExamplesState(state, bundledSelectionMaps.ids)\n\tawait idb.set(LOCAL_EXAMPLES_STATE_KEY, localExamplesStateCache)\n}\n\nfunction getCachedSerializedLocalExamples(): SerializedAgentExample[] {\n\tif (!localExamplesStateCache) return []\n\treturn [...localExamplesStateCache.examples]\n}\n\nfunction getCachedLocalExampleChanges(): LocalExamplesChangeSet {\n\tif (!localExamplesStateCache) return { added: [], modified: [], deleted: [] }\n\treturn {\n\t\tadded: [...localExamplesStateCache.changes.added],\n\t\tmodified: [...localExamplesStateCache.changes.modified],\n\t\tdeleted: [...localExamplesStateCache.changes.deleted],\n\t}\n}\n\n/** Check if local mode is enabled (uses local examples instead of just bundled) */\nexport function isLocalModeEnabled(): boolean {\n\tif (typeof localStorage === \"undefined\") return false\n\tif (typeof localStorage.getItem !== \"function\") return false\n\treturn localStorage.getItem(USE_LOCAL_MODE_KEY) === \"true\"\n}\n\n/** Set whether local mode is enabled */\nexport function setLocalModeEnabled(enabled: boolean): void {\n\tif (typeof localStorage === \"undefined\") return\n\tlocalStorage.setItem(USE_LOCAL_MODE_KEY, String(enabled))\n}\n\nasync function getLocalNodeExamplesFromState(state: LocalExamplesState): Promise<Map<NodeID, ImplementationGuide>> {\n\tconst result = new Map<NodeID, ImplementationGuide>()\n\tfor (const example of state.examples) {\n\t\ttry {\n\t\t\tassert(isString(example.template), \"Template must be a string\")\n\t\t\tresult.set(example.id, { id: example.id, name: example.name, template: example.template })\n\t\t} catch (error) {\n\t\t\t// Log individual failures but continue processing other examples\n\t\t\t// biome-ignore lint/suspicious/noConsole: Error logging for debugging\n\t\t\tconsole.error(`Failed to deserialize local example \"${example.name}\":`, error)\n\t\t}\n\t}\n\treturn result\n}\n\n/** Get all examples (bundled + local overrides if local mode enabled) */\nexport async function getNodeExamples(useLocalMode?: boolean): Promise<Record<string, ImplementationGuide>> {\n\tconst shouldUseLocalMode = useLocalMode ?? isLocalModeEnabled()\n\tif (!shouldUseLocalMode) return bundledNodeExamples\n\n\tconst state = await loadLocalExamplesState()\n\tconst localExamplesById = await getLocalNodeExamplesFromState(state)\n\tconst result: Record<string, ImplementationGuide> = { ...bundledNodeExamples }\n\n\tfor (const removedName of state.deletedBundledExampleNames) {\n\t\tdelete result[removedName]\n\t}\n\n\tfor (const example of state.examples) {\n\t\tconst localExample = localExamplesById.get(example.id)\n\t\tif (!localExample) continue\n\n\t\tconst bundledName = bundledSelectionMaps.nameById.get(example.id)\n\t\tif (bundledName) delete result[bundledName]\n\n\t\tresult[localExample.name] = localExample\n\t}\n\n\treturn result\n}\n\n/** Get bundled examples with serialized metadata. Should be\n *  used for displaying examples in the UI and not for the AI agent.\n */\nexport function getBundledNodeExamples(): Record<string, BundledImplementationGuide> {\n\treturn bundledNodeExamples\n}\n\n/** Data needed for navigating to an example */\ninterface ExampleNavigationData {\n\tid: NodeID\n\tprojectId: string\n}\n\n/** Get navigation data for an example by name (looks up serialized data) */\nexport function getExampleNavigationData(name: string): ExampleNavigationData | undefined {\n\t// Check bundled metadata first\n\tconst bundled = bundledNodeExamples[name]\n\tif (bundled) return { id: bundled.id, projectId: bundled.projectId }\n\n\tfor (const example of getCachedSerializedLocalExamples()) {\n\t\tif (example.name === name) {\n\t\t\treturn { id: example.id, projectId: example.projectId }\n\t\t}\n\t}\n}\n\n/** Get navigation data for a local example by name. */\nexport function getLocalExampleNavigationData(name: string): ExampleNavigationData | undefined {\n\tfor (const example of getCachedSerializedLocalExamples()) {\n\t\tif (example.name === name) {\n\t\t\treturn { id: example.id, projectId: example.projectId }\n\t\t}\n\t}\n}\n\n/** Get serialized local examples. */\nexport async function getSerializedLocalExamples(): Promise<SerializedAgentExample[]> {\n\tconst state = await loadLocalExamplesState()\n\treturn [...state.examples]\n}\n\n/** Get tracked local example changes for the UI. */\nexport function getLocalExampleChanges(): LocalExamplesChangeSet {\n\treturn getCachedLocalExampleChanges()\n}\n\n/** Get the UI status of a local example by id. */\nexport function getLocalExampleChangeStatus(id: NodeID): \"added\" | \"modified\" | undefined {\n\tif (!localExamplesStateCache) return\n\tif (isLocallyAddedExample(localExamplesStateCache, id)) return \"added\"\n\tif (isLocallyModifiedExample(localExamplesStateCache, id)) return \"modified\"\n}\n\n/** Add a local example (async - uses IndexedDB) */\nexport async function addLocalExample(serialized: SerializedAgentExample): Promise<void> {\n\tconst current = await loadLocalExamplesState()\n\tawait saveLocalExamplesState(\n\t\tupsertLocalExample(current, serialized, bundledSelectionMaps.nameById, bundledSelectionMaps.ids),\n\t)\n}\n\n/** Remove a local example by example name (async) */\nexport async function removeLocalExample(name: string): Promise<void> {\n\tconst current = await loadLocalExamplesState()\n\tawait saveLocalExamplesState(removeLocalExampleByName(current, name, bundledSelectionMaps.ids))\n}\n\n/** Clear local examples (async) */\nexport async function clearLocalExamples(): Promise<void> {\n\tconst current = await loadLocalExamplesState()\n\tawait saveLocalExamplesState(clearExamplesInState(current, bundledSelectionMaps.ids))\n}\n\n/** Initialize the caches - call this early to preload data */\nexport async function initExamplesCache(): Promise<void> {\n\tawait loadLocalExamplesState()\n}\n\n/** Get all removed bundled example names */\nexport function getRemovedBundledExamples(): Set<string> {\n\tif (!localExamplesStateCache) return new Set()\n\treturn new Set(localExamplesStateCache.deletedBundledExampleNames)\n}\n\n/** Set whether a bundled example is removed */\nexport async function setRemovedBundledExample(name: string, removed: boolean): Promise<void> {\n\tif (!bundledSelectionMaps.idByName.has(name)) return\n\n\tconst current = await loadLocalExamplesState()\n\tawait saveLocalExamplesState(setBundledExampleDeleted(current, name, removed, bundledSelectionMaps.ids))\n}\n\n/** Clear all removed bundled examples */\nexport async function clearRemovedBundledExamples(): Promise<void> {\n\tconst current = await loadLocalExamplesState()\n\tawait saveLocalExamplesState(clearRemovedBundledInState(current, bundledSelectionMaps.ids))\n}\n\n/** Build example index for system prompt */\nexport async function getNodeExamplesIndex(useLocalMode?: boolean): Promise<string[]> {\n\tconst examples = await getNodeExamples(useLocalMode)\n\treturn Object.values(examples).map(example => `- ${example.name}`)\n}\n", "export const EVICTED_GUIDES_PREFIX = \"evicted guides \"\nexport const EVICTED_GUIDES_SUFFIX = \" due to exceeding\"\n\nconst quotedGuideNameRegex = /\"([^\"]+)\"/g\n\nfunction escapeRegex(source: string): string {\n\treturn source.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n}\n\nconst evictedGuidesSegmentRegex = new RegExp(\n\t`${escapeRegex(EVICTED_GUIDES_PREFIX)}(?<evictedGuidesSegment>.+?)${escapeRegex(EVICTED_GUIDES_SUFFIX)}`,\n)\n\nexport function extractEvictedGuidesFromSystemMessage(systemGuidesMessage: string | undefined): string[] {\n\tif (!systemGuidesMessage) return []\n\n\tconst match = evictedGuidesSegmentRegex.exec(systemGuidesMessage)\n\tconst evictedGuidesSegment = match?.groups?.evictedGuidesSegment\n\tif (!evictedGuidesSegment) return []\n\n\tconst evictedNames: string[] = []\n\tfor (const quotedNameMatch of evictedGuidesSegment.matchAll(quotedGuideNameRegex)) {\n\t\tconst quotedName = quotedNameMatch[1]\n\t\tif (quotedName) evictedNames.push(quotedName)\n\t}\n\treturn evictedNames\n}\n", "import { assert, getLogger } from \"@framerjs/shared\"\nimport { LockQueue } from \"document/utils/LockQueue.ts\"\nimport { getNodeExamples } from \"../examples/exampleLoader.ts\"\nimport type { ImplementationGuide } from \"../examples/types.ts\"\nimport { EVICTED_GUIDES_PREFIX, EVICTED_GUIDES_SUFFIX } from \"./guidesSystemState.ts\"\n\nconst log = getLogger(\"ai:agents\")\n\n/** Get a node example by name for AI context */\nexport async function getNodeExampleData(\n\tname: string,\n\tuseLocalMode?: boolean,\n): Promise<ImplementationGuide | undefined> {\n\tconst examples = await getNodeExamples(useLocalMode)\n\tconst nodeExample = examples[name]\n\tif (!nodeExample) return\n\treturn { ...nodeExample, name }\n}\n\n/**\n * We have a FIFO queue for loading examples which was necessary when examples were large documents\n * with 25k tokens. Now that they are not, we need to work out what the new optimal number is. In\n * the meantime, we preserve the architecture, but use the number of examples as the limit.\n */\nexport const MAX_LOADED_EXAMPLE_NAMES = 10\n\nconst systemMessageReminder = \"Reminder: Use the loaded guides before requesting more.\"\n\ninterface FormatExamplesSystemMessageOptions {\n\tloadedCount: number\n\tevicted?: { loaded: string[]; unloaded: string[] }\n}\n\nexport function formatExamplesSystemMessage(\n\toptions: FormatExamplesSystemMessageOptions,\n\tmaxLoadedGuides: number,\n): string | undefined {\n\tconst { loadedCount, evicted } = options\n\n\tif (evicted && evicted.unloaded.length > 0) {\n\t\tconst loadedList = evicted.loaded.map(name => `\"${name}\"`).join(\", \")\n\t\tconst unloadedList = evicted.unloaded.map(name => `\"${name}\"`).join(\", \")\n\t\treturn `Querying guides ${loadedList} ${EVICTED_GUIDES_PREFIX}${unloadedList}${EVICTED_GUIDES_SUFFIX} the maximum guide count of ${maxLoadedGuides}. ${systemMessageReminder}`\n\t}\n\n\tif (loadedCount === maxLoadedGuides) {\n\t\treturn `${loadedCount}/${maxLoadedGuides} guides have been loaded - requesting more guides will evict the oldest guide. ${systemMessageReminder}`\n\t}\n\n\tif (loadedCount > 0 && loadedCount < maxLoadedGuides) {\n\t\treturn `${loadedCount}/${maxLoadedGuides} guides have been loaded.`\n\t}\n\n\treturn undefined\n}\n\nexport function maxLoadedGuidesErrorMessage(maxLoadedGuides: number): string {\n\treturn `Maximum number of guides loaded in a single request (${maxLoadedGuides}).`\n}\n\nexport type NodeExampleResult = Omit<ImplementationGuide, \"name\">\n\ninterface ErrorResult {\n\t/** An error message to return to the model in the tool-result. */\n\terror: string\n}\n\nexport class Examples {\n\tconstructor(\n\t\tprivate readonly maxLoadedGuides = MAX_LOADED_EXAMPLE_NAMES,\n\t\tpublic readonly loadedExampleNames: string[] = [],\n\t) {}\n\n\tprivate readonly examplesLoadedThisToolCall = new Set<string>()\n\tprivate readonly requestedExamplesThisTurn = new Set<string>()\n\tprivate readonly loadNodeExampleQueue = new LockQueue()\n\n\t// We process `read_project` queries in parallel, but we need to process example requests\n\t// sequentially to ensure we don't allow the max to be exceeded.\n\tprivate async synchronize<T>(cb: () => Promise<T>): Promise<T> {\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tvoid this.loadNodeExampleQueue.request(async () => {\n\t\t\t\ttry {\n\t\t\t\t\tconst result = await cb()\n\t\t\t\t\tresolve(result)\n\t\t\t\t} catch (error) {\n\t\t\t\t\treject(error)\n\t\t\t\t}\n\t\t\t})\n\t\t})\n\t}\n\n\tpublic async loadImplementationGuide(name: string): Promise<{ guide: string } | ErrorResult> {\n\t\tconst result: { guide: string } | ErrorResult = await this.synchronize(async () => {\n\t\t\t// Every example requested after the first 3 will not be loaded, instead explain the error.\n\t\t\tif (this.examplesLoadedThisToolCall.size >= this.maxLoadedGuides) {\n\t\t\t\treturn { error: maxLoadedGuidesErrorMessage(this.maxLoadedGuides) }\n\t\t\t}\n\n\t\t\tconst example = await getNodeExampleData(name)\n\n\t\t\t// Show the system it requested an example that does not exist.\n\t\t\tif (!example) return { error: `Guide \"${name}\" does not exist.` }\n\n\t\t\tthis.loadedExampleNames.push(name)\n\t\t\tthis.examplesLoadedThisToolCall.add(name)\n\t\t\tthis.requestedExamplesThisTurn.add(name)\n\n\t\t\treturn { guide: example.template }\n\t\t})\n\n\t\tif (!result) return { error: `Guide \"${name}\" could not be loaded.` }\n\t\treturn result\n\t}\n\n\tpublic completeTurn(): { requestedExamples?: string[] } | undefined {\n\t\tconst requestedExamples = Array.from(this.requestedExamplesThisTurn)\n\n\t\tthis.requestedExamplesThisTurn.clear()\n\n\t\tif (requestedExamples.length === 0) return\n\t\treturn {\n\t\t\trequestedExamples: requestedExamples.length > 0 ? requestedExamples : undefined,\n\t\t}\n\t}\n\n\t/**\n\t * Unload examples that exceed the maximum example count, moving duplicate examples to the front.\n\t */\n\tprivate unloadExamples(): string[] {\n\t\tconst unloaded: string[] = []\n\t\tconst seenExampleNames = new Set<string>()\n\n\t\tfor (let i = this.loadedExampleNames.length - 1; i >= 0; i--) {\n\t\t\tconst name = this.loadedExampleNames[i]\n\t\t\tassert(name, \"Name must exist at index\")\n\t\t\t// If we have already seen this example, remove it from the list without adding it to the\n\t\t\t// unloaded list.\n\t\t\tif (seenExampleNames.has(name)) {\n\t\t\t\tthis.loadedExampleNames.splice(i, 1)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tseenExampleNames.add(name)\n\n\t\t\tif (seenExampleNames.size <= this.maxLoadedGuides) continue\n\n\t\t\tthis.loadedExampleNames.splice(i, 1)\n\t\t\tunloaded.unshift(name)\n\t\t}\n\n\t\treturn unloaded\n\t}\n\n\tpublic getToolResultSystemMessage(): string | undefined {\n\t\tconst unloaded = this.unloadExamples()\n\t\tconst loaded = Array.from(this.examplesLoadedThisToolCall)\n\n\t\tthis.examplesLoadedThisToolCall.clear()\n\n\t\tif (unloaded.length > 0) {\n\t\t\tlog.trace(\"Unloaded node examples due to max loaded example count\", { unloaded, loaded })\n\t\t}\n\n\t\treturn formatExamplesSystemMessage(\n\t\t\t{\n\t\t\t\tloadedCount: loaded.length,\n\t\t\t\tevicted: unloaded.length > 0 ? { loaded, unloaded } : undefined,\n\t\t\t},\n\t\t\tthis.maxLoadedGuides,\n\t\t)\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { hasTextFit } from \"document/models/CanvasTree/traits/WithTextFit.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport type { AgentContext } from \"../AgentContext.ts\"\nimport type { RichTextTarget } from \"./document.ts\"\nimport { parseRichTextTarget, resolveRichTextTargetHandle } from \"./targets.ts\"\n\nexport function applyVirtualTextTarget(ctx: AgentContext, richTextTarget: RichTextTarget): boolean {\n\tconst handle = resolveRichTextTargetHandle(richTextTarget, ctx)\n\tif (!handle) return false\n\n\tconst nextHTML = ctx.virtualText.apply(handle)\n\n\tif (handle.ownerTarget && !isUndefined(nextHTML) && handle.ownerTarget !== richTextTarget) {\n\t\tif (!applyVirtualTextTarget(ctx, handle.ownerTarget)) return false\n\t}\n\n\tconst updated = ctx.treeResolver.get(handle.nodeId)\n\tassert(updated, `Node ${handle.nodeId} not found in tree`)\n\n\tif (isRichTextNode(updated) && hasTextFit(updated)) {\n\t\tctx.deferred.markTextFitDirty(updated.id)\n\t}\n\n\tconst { targetKey } = parseRichTextTarget(handle.ownerTarget ?? handle.target)\n\tif (targetKey) {\n\t\tctx.treeResolver.recordMutatingNodeUpdates(handle.nodeId, { changedControlProps: new Set([targetKey]) })\n\t}\n\n\treturn true\n}\n", "import type { Changeset } from \"document/models/CanvasTree/Changeset.ts\"\n\nexport type GetTurnChangeset = () => Changeset | undefined\n\nexport interface TurnChangesetState {\n\tgetTurnChangeset: GetTurnChangeset\n\tupdate(changeset?: Changeset): void\n}\n\nexport function createTurnChangeset(changeset?: Changeset): TurnChangesetState {\n\tlet currentChangeset = changeset\n\n\treturn {\n\t\tgetTurnChangeset: () => currentChangeset,\n\t\tupdate: nextChangeset => {\n\t\t\tcurrentChangeset = nextChangeset\n\t\t},\n\t}\n}\n", "import { createAssetReference } from \"@framerjs/assets\"\nimport { assert, emptyArray, getLogger, getServiceMap } from \"@framerjs/shared\"\nimport type { ImagePart, ModelMessage } from \"ai\"\nimport { getImageUrls, type AgentAttachmentImage } from \"app/agent/attachments.ts\"\nimport type { BaseEngineScheduler } from \"document/base-engine/BaseEngine.ts\"\nimport type { Changeset } from \"document/models/CanvasTree/Changeset.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport { createAssetReferenceForUploadImageResult } from \"document/utils/createAssetReferenceFromImageUpload.ts\"\nimport { isFiniteNumber, type Size } from \"library/index.ts\"\nimport { join } from \"utils/join.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport type { BatchAssetUploader } from \"web/lib/BatchAssetUploader.ts\"\nimport * as supportedImages from \"web/lib/images/supportedFormats.ts\"\nimport { isImageUploadResult, type AssetUploadResult, uploadService } from \"web/pages/project/lib/UploadService.ts\"\nimport type { API } from \"web/pages/project/lib/useAPI.ts\"\nimport type { TreeResolver } from \"../TreeResolver.ts\"\nimport { VIEW_IMAGE_TOOL_NAME } from \"../tools/toolNames.ts\"\nimport type { AgentContext } from \"./AgentContext.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\nimport { applyVirtualTextTarget } from \"./richtext/apply.ts\"\nimport type { VirtualRichTextNode } from \"./richtext/document.ts\"\nimport { parseRichTextTarget } from \"./richtext/targets.ts\"\nimport { createTurnChangeset, type GetTurnChangeset } from \"./turnChangeset.ts\"\n\nconst log = getLogger(\"ai:agents:files\")\n\ntype FileUrl = string\ntype AssetReference = string\ntype NormalizedFileUrl = string\n\ninterface ImagesOptions {\n\t/**\n\t * Wheather to trust all URLs, e.g. when using a local agent and there isn't the model of a safe list of files.\n\t */\n\ttrustAllUrls?: boolean\n}\n\ninterface FilesForUrlOptions {\n\t/**\n\t * When true, user-owned chat attachment assets resolved from this URL will get linked to the project\n\t * (`duplicate-from-user`), e.g. when persisting an image variable initial value that came from an attachment.\n\t * Canvas updates should keep this false and rely on `uploadAndUpdateCanvasNode` / `uploadAndUpdateVirtualTextNode`\n\t * linking only after a successful apply.\n\t */\n\tlinkToProject?: boolean\n}\n\nconst urlLikeTokenRegex =\n\t/(?:https?:\\/\\/|data:)[^\\s<>\"'`]+|[a-z0-9](?:[a-z0-9-]*[a-z0-9])?(?:\\.[a-z0-9-]+)+(?:\\/[^\\s<>\"'`]*)?/giu\nconst supportedImageExtensions = new Set(supportedImages.extensions)\n\nfunction trimUrlCandidate(candidate: string): string {\n\treturn candidate.replace(/^[([{<\"'`]+/u, \"\").replace(/[)\\]}>,\"'.;!?`]+$/u, \"\")\n}\n\nfunction hasProtocolLessUrlPath(url: string): boolean {\n\treturn /[/?#]/u.test(url)\n}\n\nfunction normalizeTrustedUrl(url: string): NormalizedFileUrl | undefined {\n\tconst trimmed = trimUrlCandidate(url.trim())\n\tif (!trimmed) return\n\n\tlet parsedUrl: URL | undefined\n\n\ttry {\n\t\tparsedUrl = new URL(trimmed)\n\t} catch {\n\t\tif (!hasProtocolLessUrlPath(trimmed)) return\n\t\ttry {\n\t\t\tparsedUrl = new URL(`https://${trimmed}`)\n\t\t} catch {\n\t\t\treturn\n\t\t}\n\t}\n\n\tif (isFramerAssetUrl(parsedUrl)) {\n\t\t// clean absolute asset URLs so asset references can be matched regardless of the absolute url params\n\t\tparsedUrl.search = \"\"\n\t}\n\n\treturn parsedUrl.toString()\n}\n\nfunction getPathExtension(url: string): string | undefined {\n\tconst { pathname } = new URL(url)\n\tconst filename = pathname.split(\"/\").pop()\n\tconst extension = filename?.match(/\\.([^.]+)$/u)?.[1]\n\treturn extension?.toLowerCase()\n}\n\nfunction isUnsupportedFramerImageUrl(url: string): boolean {\n\tif (!isFramerAssetUrl(url)) return false\n\tconst extension = getPathExtension(url)\n\treturn !!extension && !supportedImageExtensions.has(extension)\n}\n\nexport function extractTrustedUrlsFromText(text: string): readonly string[] {\n\tconst urls = new Set<string>()\n\tfor (const match of text.matchAll(urlLikeTokenRegex)) {\n\t\tconst raw = match[0]\n\t\tif (!raw) continue\n\t\tconst normalized = normalizeTrustedUrl(raw)\n\t\tif (normalized) urls.add(normalized)\n\t}\n\treturn Array.from(urls)\n}\n\nexport class Files {\n\tprivate readonly trustedUrls = new Set<NormalizedFileUrl>()\n\tprivate readonly assetReferenceByTrustedUrl = new Map<NormalizedFileUrl, AssetReference>()\n\tprivate readonly imageDimensionsByParameterlessUrl = new Map<string, { width: number; height: number }>()\n\tprivate readonly visionUrlByTrustedUrl = new Map<NormalizedFileUrl, FileUrl>()\n\t/** User-owned chat attachment assets: normalized image URL \u2192 asset `key` for project linking when applied to canvas. */\n\tprivate readonly userOwnedAttachmentAssetKeyByNormalizedUrl = new Map<NormalizedFileUrl, string>()\n\n\tconstructor(\n\t\tprivate readonly treeStore: TreeStore,\n\t\tprivate readonly scheduler: BaseEngineScheduler,\n\t\tprivate readonly uploadedAssetsByURL: Map<FileUrl, AssetReference>,\n\t\tprivate readonly getTurnChangeset: GetTurnChangeset,\n\t\tprivate readonly treeResolver?: TreeResolver,\n\t\tprivate readonly assetUploader?: BatchAssetUploader,\n\t\tprivate readonly api?: API,\n\t\tprivate readonly options?: ImagesOptions,\n\t) {\n\t\tfor (const [url, assetReference] of this.uploadedAssetsByURL) {\n\t\t\tthis.registerTrustedUrl(url, assetReference)\n\t\t}\n\t}\n\n\tprivate promises: Promise<void>[] = []\n\n\tregisterTrustedUrl(url: string, assetReference?: AssetReference): NormalizedFileUrl | undefined {\n\t\tconst normalized = normalizeTrustedUrl(url)\n\t\tif (!normalized) return\n\t\tthis.trustedUrls.add(normalized)\n\t\tif (assetReference) this.assetReferenceByTrustedUrl.set(normalized, assetReference)\n\t\treturn normalized\n\t}\n\n\tprivate async schedule(task: () => void): Promise<void> {\n\t\tconst changeset = this.getTurnChangeset()\n\t\tassert(changeset, \"Turn changeset is required when updating image assets\")\n\n\t\tawait this.scheduler.scheduleAgentChanges(() => changeset.append(task))\n\t}\n\n\tstatic imageMetadataTag = metadataTags.imageAttachments\n\n\tprompt() {\n\t\tif (this.uploadedAssetsByURL.size === 0) return\n\t\treturn createImageAttachmentsTag(Array.from(this.uploadedAssetsByURL.keys()))\n\t}\n\n\tregisterTrustedUrls(urls: Iterable<string>): readonly string[] {\n\t\tconst normalizedUrls: string[] = []\n\t\tfor (const url of urls) {\n\t\t\tconst normalized = this.registerTrustedUrl(url)\n\t\t\tif (normalized) normalizedUrls.push(normalized)\n\t\t}\n\t\treturn normalizedUrls\n\t}\n\n\tregisterUrlsFromText(text: string): readonly string[] {\n\t\treturn this.registerTrustedUrls(extractTrustedUrlsFromText(text))\n\t}\n\n\tisTrustedUrl(url: string): boolean {\n\t\tconst normalized = normalizeTrustedUrl(url)\n\t\tif (!normalized) return false\n\t\tif (this.options?.trustAllUrls) return true\n\t\treturn this.trustedUrls.has(normalized)\n\t}\n\n\tasync getVisionImageUrl(url: string): Promise<{ imageUrl: string } | { error: string }> {\n\t\tconst normalized = normalizeTrustedUrl(url)\n\t\tif (!normalized) return { error: \"Invalid image URL.\" }\n\t\tif (!this.isTrustedUrl(normalized)) return { error: \"Untrusted image URL.\" }\n\n\t\tconst registeredVisionUrl = this.visionUrlByTrustedUrl.get(normalized)\n\t\tif (registeredVisionUrl) return { imageUrl: registeredVisionUrl }\n\n\t\tif (isUnsupportedFramerImageUrl(normalized)) return { error: \"URL did not resolve to an image.\" }\n\n\t\treturn { imageUrl: normalized }\n\t}\n\n\t/**\n\t * Get asset reference for a URL. If the URL is not cached, it will be uploaded first.\n\t * Always returns a valid asset reference or undefined if upload fails.\n\t */\n\tasync forUrl(url: FileUrl, options?: FilesForUrlOptions): Promise<AssetReference | undefined> {\n\t\tassert(this.isTrustedUrl(url), `Untrusted URL: ${url}`)\n\n\t\tconst finish = (reference: AssetReference): AssetReference => {\n\t\t\tif (options?.linkToProject) {\n\t\t\t\tthis.maybeLinkUserOwnedAttachmentUsedOnCanvas(url)\n\t\t\t}\n\t\t\treturn reference\n\t\t}\n\n\t\tconst cached = this.uploadedAssetsByURL.get(url)\n\t\tif (cached) return finish(cached)\n\n\t\tconst normalized = normalizeTrustedUrl(url)\n\t\tassert(normalized, `Expected a normalizable URL: ${url}`)\n\t\tconst cachedByNormalizedUrl = this.assetReferenceByTrustedUrl.get(normalized)\n\t\tif (cachedByNormalizedUrl) return finish(cachedByNormalizedUrl)\n\n\t\tconst result = await this.uploadAsset(normalized)\n\n\t\tif (!result) return undefined\n\n\t\tconst assetReference = this.registerAssetUpload(normalized, result)\n\t\treturn finish(assetReference)\n\t}\n\n\tprivate async uploadAsset(url: FileUrl): Promise<AssetUploadResult> {\n\t\treturn this.assetUploader ? this.assetUploader.add(url) : uploadService.uploadAssetByURL(url, { silent: true })\n\t}\n\n\tprivate registerAssetUpload(url: FileUrl, result: AssetUploadResult): AssetReference {\n\t\tconst assetReference = isImageUploadResult(result)\n\t\t\t? createAssetReferenceForUploadImageResult(result)\n\t\t\t: createAssetReference(result.filename, null, result.originalFilename)\n\n\t\tthis.uploadedAssetsByURL.set(url, assetReference)\n\t\tthis.registerTrustedUrl(url, assetReference)\n\t\tthis.registerTrustedUrl(result.url, assetReference)\n\t\treturn assetReference\n\t}\n\n\tprivate cacheImageDimensions(url: string, size: Size): void {\n\t\tconst parsedUrl = new URL(url)\n\t\tparsedUrl.search = \"\"\n\t\tthis.imageDimensionsByParameterlessUrl.set(parsedUrl.toString(), size)\n\t}\n\n\tupdateNodeWithAsset<T extends CanvasNode>(\n\t\tnode: T,\n\t\ttargetUrl: string,\n\t\tfn: (reference: AssetReference, latestNode: T) => boolean,\n\t) {\n\t\tthis.promises.push(this.uploadAndUpdateCanvasNode(node, targetUrl, fn))\n\t}\n\n\tupdateVirtualTextNodeWithAsset<T extends VirtualRichTextNode>(\n\t\tctx: AgentContext,\n\t\tnode: T,\n\t\turl: string,\n\t\tfn: (reference: AssetReference, latestNode: T) => boolean,\n\t) {\n\t\tthis.promises.push(this.uploadAndUpdateVirtualTextNode(node, url, fn, ctx))\n\t}\n\n\tprivate async uploadAndUpdateCanvasNode<T extends CanvasNode>(\n\t\tnode: T,\n\t\ttargetUrl: string,\n\t\tfn: (reference: AssetReference, latestNode: T) => boolean,\n\t) {\n\t\tconst assetReference = await this.forUrl(targetUrl)\n\t\tif (!assetReference) return\n\n\t\tawait this.schedule(() => {\n\t\t\tconst latestNode = this.treeStore.tree.current(node)\n\t\t\tif (!latestNode) return\n\t\t\tconst didUpdateNode = fn(assetReference, latestNode)\n\t\t\tif (didUpdateNode) {\n\t\t\t\tthis.treeResolver?.recordChangedNode(latestNode.id, \"update\")\n\t\t\t\tthis.maybeLinkUserOwnedAttachmentUsedOnCanvas(targetUrl)\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate async uploadAndUpdateVirtualTextNode<T extends VirtualRichTextNode>(\n\t\tnode: T,\n\t\turl: string,\n\t\tfn: (reference: AssetReference, latestNode: T) => boolean,\n\t\tctx: AgentContext,\n\t) {\n\t\tconst assetReference = await this.forUrl(url)\n\t\tif (!assetReference) return\n\n\t\tlet applied = false\n\t\tawait this.schedule(() => {\n\t\t\tconst didUpdateNode = fn(assetReference, node)\n\t\t\tif (!didUpdateNode) return\n\n\t\t\tconst target = ctx.virtualText.getTarget(node)\n\t\t\tif (!applyVirtualTextTarget(ctx, target)) return\n\n\t\t\tconst { nodeId } = parseRichTextTarget(target)\n\t\t\tctx.treeResolver.recordChangedNode(nodeId, \"update\")\n\t\t\tapplied = true\n\t\t})\n\t\tif (applied) {\n\t\t\tthis.maybeLinkUserOwnedAttachmentUsedOnCanvas(url)\n\t\t}\n\t}\n\n\tprivate maybeLinkUserOwnedAttachmentUsedOnCanvas(sourceUrl: string): void {\n\t\tconst api = this.api\n\t\tif (!api) return\n\n\t\tconst normalized = normalizeTrustedUrl(sourceUrl)\n\t\tif (!normalized) return\n\n\t\tconst assetKey = this.userOwnedAttachmentAssetKeyByNormalizedUrl.get(normalized)\n\t\tif (!assetKey) return\n\n\t\tvoid api.linkUserAttachmentAssetToProject(assetKey).catch(reason => {\n\t\t\tlog.reportError(reason, { assetKey })\n\t\t})\n\t}\n\n\tasync finalize(): Promise<void> {\n\t\tif (this.promises.length === 0) return\n\t\tconst batch = this.promises.splice(0)\n\t\tconst results = await Promise.allSettled(batch)\n\t\tconst errors = results\n\t\t\t.filter((result): result is PromiseRejectedResult => result.status === \"rejected\")\n\t\t\t.map(result => result.reason)\n\t\tif (errors.length === 0) return\n\t\tif (errors.length === 1) throw errors[0]\n\t\tthrow new AggregateError(errors, \"One or more image updates failed\")\n\t}\n\n\tstatic fromUploadedImages(\n\t\tuploadedImages: readonly (AgentAttachmentImage | undefined)[] | undefined,\n\t\ttreeStore: TreeStore,\n\t\tscheduler: BaseEngineScheduler,\n\t\tgetTurnChangeset: GetTurnChangeset,\n\t\ttreeResolver?: TreeResolver,\n\t\tassetUploader?: BatchAssetUploader,\n\t\tapi?: API,\n\t\toptions?: ImagesOptions,\n\t): Files {\n\t\tif (!uploadedImages) {\n\t\t\treturn new Files(treeStore, scheduler, new Map(), getTurnChangeset, treeResolver, assetUploader, api, options)\n\t\t}\n\t\tconst cache = new Map<FileUrl, AssetReference>()\n\n\t\tfor (const uploadResult of uploadedImages) {\n\t\t\tif (!uploadResult) continue\n\t\t\tconst assetReference = createAssetReferenceForUploadImageResult(uploadResult.referenceImage)\n\t\t\tcache.set(getImageUrls(uploadResult).referenceUrl, assetReference)\n\t\t}\n\n\t\tconst files = new Files(treeStore, scheduler, cache, getTurnChangeset, treeResolver, assetUploader, api, options)\n\t\tfor (const uploadResult of uploadedImages) {\n\t\t\tif (!uploadResult) continue\n\t\t\tfiles.registerUploadedImage(uploadResult)\n\t\t}\n\t\treturn files\n\t}\n\n\treferenceUrls(images: readonly (AgentAttachmentImage | undefined)[] | undefined): readonly string[] {\n\t\tif (!images) return emptyArray()\n\t\tconst urls = new Set<string>()\n\t\tfor (const image of images) {\n\t\t\tif (!image) continue\n\t\t\turls.add(this.registerUploadedImage(image).referenceUrl)\n\t\t}\n\t\treturn Array.from(urls)\n\t}\n\n\tasync dimensionsForImage(url: string): Promise<Size | undefined> {\n\t\tconst parsedUrl = new URL(url)\n\t\tconst width = parseInt(parsedUrl.searchParams.get(\"width\") ?? \"\", 10)\n\t\tconst height = parseInt(parsedUrl.searchParams.get(\"height\") ?? \"\", 10)\n\t\tparsedUrl.search = \"\"\n\t\tconst parameterlessUrl = parsedUrl.toString()\n\t\tif (isFiniteNumber(width) && isFiniteNumber(height)) {\n\t\t\tthis.imageDimensionsByParameterlessUrl.set(parameterlessUrl, { width, height })\n\t\t\treturn { width, height }\n\t\t}\n\n\t\tconst cached = this.imageDimensionsByParameterlessUrl.get(parameterlessUrl)\n\t\tif (cached) return cached\n\n\t\tlet bitmap: ImageBitmap | undefined\n\t\tlet dimensions: Size | undefined\n\t\ttry {\n\t\t\tconst response = await fetch(url)\n\t\t\tif (!response.ok) return undefined\n\t\t\tconst blob = await response.blob()\n\t\t\tbitmap = await createImageBitmap(blob)\n\t\t\tdimensions = { width: bitmap.width, height: bitmap.height }\n\t\t} catch {\n\t\t\treturn undefined\n\t\t} finally {\n\t\t\tbitmap?.close()\n\t\t}\n\n\t\tthis.imageDimensionsByParameterlessUrl.set(parameterlessUrl, dimensions)\n\t\treturn dimensions\n\t}\n\n\t/**\n\t * Returns an image URL that fits within the provided maximum dimension.\n\t *\n\t * If the image already fits, this returns the original URL. Otherwise it\n\t * returns a scaled image URL that preserves the highest possible resolution\n\t * while keeping the image within the limit.\n\t */\n\tasync getScaledImageUrl(url: string, maxDimension: number | undefined): Promise<string> {\n\t\tif (!maxDimension) return url\n\n\t\tconst pixelDimensions = await this.dimensionsForImage(url)\n\t\tif (!pixelDimensions) return url\n\n\t\tconst largestDimension = Math.max(pixelDimensions.width, pixelDimensions.height)\n\t\tif (largestDimension <= maxDimension) return url\n\n\t\tconst imageUrl = new URL(url)\n\t\timageUrl.searchParams.delete(\"width\")\n\t\timageUrl.searchParams.delete(\"height\")\n\t\timageUrl.searchParams.delete(\"kb\")\n\t\timageUrl.searchParams.set(\"scale-down-to\", maxDimension.toString())\n\t\t// optimise images lambda won't return the scaled image if the result is larger than the original\n\t\t// by forcing the format to webp it always returns the scaled image\n\t\timageUrl.searchParams.set(\"format\", \"webp\")\n\t\treturn imageUrl.toString()\n\t}\n\n\t/** Creates an empty Images instance for testing. */\n\tstatic empty(): Files {\n\t\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion\n\t\tconst mockTreeStore = { tree: { current: <T>(n: T) => n ?? null } } as TreeStore\n\t\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion\n\t\tconst mockScheduler = {\n\t\t\tprocessWhenReadyAsync: async <T>(task: () => T) => task(),\n\t\t\tscheduleAgentChanges: async (task: () => void) => task(),\n\t\t} as BaseEngineScheduler\n\t\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion\n\t\tconst turnChangeset = createTurnChangeset({ append: (task: () => void) => task() } as unknown as Changeset)\n\t\t// oxlint-disable-next-line typescript/no-unsafe-type-assertion\n\t\tconst mockAPI = {\n\t\t\tlinkUserAttachmentAssetToProject: () => Promise.resolve(),\n\t\t} as unknown as API\n\t\treturn new Files(\n\t\t\tmockTreeStore,\n\t\t\tmockScheduler,\n\t\t\tnew Map(),\n\t\t\tturnChangeset.getTurnChangeset,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\tmockAPI,\n\t\t)\n\t}\n\n\tprivate registerUploadedImage(image: AgentAttachmentImage): { referenceUrl: string; messageUrl: string } {\n\t\tconst { referenceUrl, messageUrl } = getImageUrls(image)\n\t\tconst assetReference = createAssetReferenceForUploadImageResult(image.referenceImage)\n\n\t\tthis.uploadedAssetsByURL.set(referenceUrl, assetReference)\n\t\tthis.registerTrustedUrl(referenceUrl, assetReference)\n\t\tthis.registerTrustedUrl(messageUrl, assetReference)\n\n\t\tconst refNorm = normalizeTrustedUrl(referenceUrl)\n\t\tconst msgNorm = normalizeTrustedUrl(messageUrl)\n\t\tif (refNorm) this.visionUrlByTrustedUrl.set(refNorm, messageUrl)\n\t\tif (msgNorm) this.visionUrlByTrustedUrl.set(msgNorm, messageUrl)\n\n\t\tif (image.referenceImage.asset.ownerType === \"user\") {\n\t\t\tconst assetKey = image.referenceImage.asset.key\n\t\t\tif (refNorm) this.userOwnedAttachmentAssetKeyByNormalizedUrl.set(refNorm, assetKey)\n\t\t\tif (msgNorm) this.userOwnedAttachmentAssetKeyByNormalizedUrl.set(msgNorm, assetKey)\n\t\t}\n\n\t\treturn { referenceUrl, messageUrl }\n\t}\n}\n\nfunction imagePartToURL(image: ImagePart[\"image\"]): string {\n\tassert(isString(image) || image instanceof URL, \"Expected image URL\")\n\treturn String(image)\n}\n\nexport function createImageAttachmentsTag(urls: readonly string[]): string | undefined {\n\tif (urls.length === 0) return\n\treturn join.lines(\n\t\t`<${Files.imageMetadataTag}>`,\n\t\t`These are exact image URLs. Use them directly for placement, fills, CMS, galleries, cards, backgrounds, and media content. Call ${VIEW_IMAGE_TOOL_NAME} only when the current request depends on visual details of the pixels.`,\n\t\tJSON.stringify(urls),\n\t\t`</${Files.imageMetadataTag}>`,\n\t)\n}\n\nexport function stripImageAttachmentMessages(messages: readonly string[]): string[] {\n\treturn messages.filter(message => !message.trimStart().startsWith(`<${Files.imageMetadataTag}>`))\n}\n\nexport function registerTrustedFileUrlsFromModelMessages(messages: readonly ModelMessage[], ctx: AgentContext): void {\n\tfor (const message of messages) {\n\t\tif (message.role !== \"user\") continue\n\t\tif (typeof message.content === \"string\") {\n\t\t\tctx.files.registerUrlsFromText(message.content)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor (const part of message.content) {\n\t\t\tswitch (part.type) {\n\t\t\t\tcase \"text\":\n\t\t\t\t\tctx.files.registerUrlsFromText(part.text)\n\t\t\t\t\tbreak\n\t\t\t\tcase \"image\":\n\t\t\t\t\tctx.files.registerTrustedUrl(imagePartToURL(part.image))\n\t\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}\n\nconst userContentPrefix = getServiceMap()?.userContent\nconst userContentHostname = userContentPrefix ? new URL(userContentPrefix).hostname : undefined\nexport function isFramerAssetUrl(url: string | URL): boolean {\n\tif (!userContentPrefix) return false\n\tif (typeof url === \"string\") return url.startsWith(userContentPrefix)\n\treturn url.hostname === userContentHostname\n}\n", "export const enum OpenTypeCategoryName {\n\tLetterCase = \"Letter Case\",\n\tNumber = \"Numbers\",\n\tStylisticSet = \"Stylistic Sets\",\n\tCharacterVariant = \"Character Variants\",\n\tContextualAlternate = \"Contextual Alternates\",\n\tHorizontalSpacing = \"Horizontal Spacing\",\n\tLigature = \"Ligatures\",\n\tLetterform = \"Letterforms\",\n\tMoreFeature = \"More Features\", // Used by default.\n}\n\n/**\n * Extracts the most frequent base characters from a given list of characters.\n * [\"\u00E9\", \"\u00E8\", \"e\", \"a\", \"\u00E1\", \"\u00E0\", \"a\", \"2\", \"\u2082\", \"\u00B2\"] -> [\"e\", \"a\", \"2\"]\n */\nexport function extractMostFrequentBaseCharacters(coverage: readonly string[], count?: number): string[] {\n\tconst baseCharacterMap: Map<string, number> = new Map()\n\n\tcoverage.forEach(char => {\n\t\tconst baseChar = getBaseCharacter(char)\n\t\tif (baseChar && isBasicMultilingualPlane(baseChar)) {\n\t\t\tbaseCharacterMap.set(baseChar, (baseCharacterMap.get(baseChar) || 0) + 1)\n\t\t}\n\t})\n\n\tconst sortedBaseChars = Array.from(baseCharacterMap.entries()).sort((a, b) => b[1] - a[1])\n\treturn sortedBaseChars.slice(0, count).map(entry => entry[0])\n}\n\n/**\n *Normalize and extract the base character (e.g. remove diacritics, subscripts, superscripts).\n */\nfunction getBaseCharacter(char: string): string {\n\treturn char.normalize(\"NFD\").replace(/[\\u0300-\\u036f\\u2070-\\u209F\\xb2\\xb3\\xb9]/gu, \"\")\n}\n\n/**\n * Check if a character is in the Basic Multilingual Plane (BMP).\n */\nfunction isBasicMultilingualPlane(char: string): boolean {\n\treturn /^[\\x20-\\x7e\\xa0-\\xff\\u0100-\\u017F\\u0180-\\u024F\\u1E00-\\u1EFF]+$/u.test(char)\n}\n\nexport const openTypePopoutId = \"open-type\"\n", "import type { OpenTypeFeatureTag, StaticOpenTypeFeatureTag } from \"document/models/CanvasTree/utils/openType.ts\"\nimport { OpenTypeCategoryName } from \"./common.ts\"\nimport type { OpenTypePreview } from \"./getOpenTypePreview.tsx\"\n\nexport interface OpenTypeFeatureMetadata {\n\tcategory: OpenTypeCategoryName\n\ttitle: string\n\tshortTitle?: string\n\tpreview?: OpenTypePreview\n\thide?: boolean\n}\n\nexport const openTypeFeatureTagToMetadata: Record<StaticOpenTypeFeatureTag, OpenTypeFeatureMetadata> = {\n\taalt: { category: OpenTypeCategoryName.CharacterVariant, title: \"Access All Alternates\", hide: true },\n\tabvf: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Above-Base Forms\",\n\t\thide: true,\n\t},\n\tabvm: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Above-Base Mark Positioning\",\n\t\thide: true,\n\t},\n\tabvs: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Above-Base Substitutions\",\n\t\thide: true,\n\t},\n\tafrc: { category: OpenTypeCategoryName.MoreFeature, title: \"Alternative Fractions\" },\n\takhn: { category: OpenTypeCategoryName.Letterform, title: \"Akhands\", hide: true },\n\tapkn: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Kerning for Alternate Proportional Widths\",\n\t\tshortTitle: \"APKN\",\n\t},\n\tblwf: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Below-Base Forms\",\n\t\thide: true,\n\t},\n\tblwm: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Below-Base Mark Positioning\",\n\t\thide: true,\n\t},\n\tblws: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Below-Base Substitutions\",\n\t\thide: true,\n\t},\n\tc2pc: {\n\t\tcategory: OpenTypeCategoryName.LetterCase,\n\t\ttitle: \"Petite Capitals From Capitals\",\n\t\tshortTitle: \"All Capitals Petite\",\n\t},\n\tc2sc: {\n\t\tcategory: OpenTypeCategoryName.LetterCase,\n\t\ttitle: \"Small Capitals From Capitals\",\n\t\tshortTitle: \"All Capitals Small\",\n\t},\n\tcalt: {\n\t\tcategory: OpenTypeCategoryName.ContextualAlternate,\n\t\ttitle: \"Contextual Alternates\",\n\t\tshortTitle: \"All Alternates\",\n\t},\n\tcase: { category: OpenTypeCategoryName.LetterCase, title: \"Case Sensitive Forms\", shortTitle: \"Case Sensitive\" },\n\tccmp: { category: OpenTypeCategoryName.Ligature, title: \"CCMP\", hide: true },\n\tcfar: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Conjunct Form After Ro\",\n\t\thide: true,\n\t},\n\tchws: {\n\t\tcategory: OpenTypeCategoryName.HorizontalSpacing,\n\t\ttitle: \"Contextual Half-width Spacing\",\n\t\tshortTitle: \"Contextual Half-width\",\n\t},\n\tcjct: { category: OpenTypeCategoryName.Ligature, title: \"Conjunct Forms\", hide: true },\n\tclig: {\n\t\tcategory: OpenTypeCategoryName.ContextualAlternate,\n\t\ttitle: \"Contextual Ligatures\",\n\t\tshortTitle: \"Ligatures\",\n\t},\n\tcpct: { category: OpenTypeCategoryName.HorizontalSpacing, title: \"Centered CJK Punctuation\" },\n\tcpsp: { category: OpenTypeCategoryName.HorizontalSpacing, title: \"Capital Spacing\" },\n\tcswh: { category: OpenTypeCategoryName.Letterform, title: \"Contextual Swash\" },\n\tcurs: { category: OpenTypeCategoryName.HorizontalSpacing, title: \"Cursive Positioning\", hide: true },\n\tdist: { category: OpenTypeCategoryName.HorizontalSpacing, title: \"Distances\", hide: true },\n\tdlig: { category: OpenTypeCategoryName.Ligature, title: \"Discretionary Ligatures\", shortTitle: \"Discretionary\" },\n\tdnom: { category: OpenTypeCategoryName.Number, title: \"Denominators\", preview: { content: \"a/2\" } },\n\tdtls: { category: OpenTypeCategoryName.CharacterVariant, title: \"Dotless Forms\", hide: true },\n\texpt: { category: OpenTypeCategoryName.MoreFeature, title: \"Expert Forms\", shortTitle: \"Expert\" },\n\tfalt: {\n\t\tcategory: OpenTypeCategoryName.CharacterVariant,\n\t\ttitle: \"Final Glyph on Line Alternates\",\n\t\tshortTitle: \"Final Line Alternates\",\n\t},\n\tfin2: { category: OpenTypeCategoryName.Letterform, title: \"Final Forms 2\", hide: true },\n\tfin3: { category: OpenTypeCategoryName.Letterform, title: \"Final Forms 3\", hide: true },\n\tfina: { category: OpenTypeCategoryName.Letterform, title: \"Final Forms\", hide: true },\n\tflac: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Flattened Accent Forms\",\n\t\thide: true,\n\t},\n\tfrac: { category: OpenTypeCategoryName.Number, title: \"Fractions\", preview: { content: \"1/2\" } },\n\tfwid: { category: OpenTypeCategoryName.HorizontalSpacing, title: \"Full Widths\" },\n\thalf: { category: OpenTypeCategoryName.Letterform, title: \"Half Forms\", hide: true },\n\thaln: { category: OpenTypeCategoryName.Letterform, title: \"Halant Forms\", hide: true },\n\thalt: {\n\t\tcategory: OpenTypeCategoryName.HorizontalSpacing,\n\t\ttitle: \"Alternate Half Widths\",\n\t\tshortTitle: \"Alt Half Widths\",\n\t},\n\thist: { category: OpenTypeCategoryName.Letterform, title: \"Historical Forms\", shortTitle: \"Historical\" },\n\thkna: { category: OpenTypeCategoryName.MoreFeature, title: \"Horizontal Kana Alternates\" },\n\thlig: { category: OpenTypeCategoryName.Ligature, title: \"Historical Ligatures\", shortTitle: \"Historical\" },\n\thngl: { category: OpenTypeCategoryName.Letterform, title: \"Hangul\" },\n\thojo: { category: OpenTypeCategoryName.CharacterVariant, title: \"Hojo Kanji Forms\", shortTitle: \"Hojo\" },\n\thwid: { category: OpenTypeCategoryName.HorizontalSpacing, title: \"Half Widths\" },\n\tinit: { category: OpenTypeCategoryName.Letterform, title: \"Initial Forms\", hide: true },\n\tisol: { category: OpenTypeCategoryName.Letterform, title: \"Isolated Forms\", hide: true },\n\tital: { category: OpenTypeCategoryName.Letterform, title: \"Italics\" },\n\tjalt: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Justification Alternates\",\n\t\tshortTitle: \"Justification\",\n\t},\n\tjp04: { category: OpenTypeCategoryName.CharacterVariant, title: \"JIS2004 Forms\" },\n\tjp78: { category: OpenTypeCategoryName.CharacterVariant, title: \"JIS78 Forms\" },\n\tjp83: { category: OpenTypeCategoryName.CharacterVariant, title: \"JIS83 Forms\" },\n\tjp90: { category: OpenTypeCategoryName.CharacterVariant, title: \"JIS90 Forms\" },\n\tkern: { category: OpenTypeCategoryName.HorizontalSpacing, title: \"Kerning\", preview: { content: \"Yo We Ty\" } },\n\tlfbd: { category: OpenTypeCategoryName.CharacterVariant, title: \"Left Bounds\" },\n\tliga: { category: OpenTypeCategoryName.Ligature, title: \"Standard Ligatures\", shortTitle: \"Standard\" },\n\tljmo: { category: OpenTypeCategoryName.Letterform, title: \"Leading Jamo Forms\", hide: true },\n\tlnum: { category: OpenTypeCategoryName.Number, title: \"Lining Figures\", shortTitle: \"Lining\" },\n\tlocl: { category: OpenTypeCategoryName.Letterform, title: \"Localized Forms\", hide: true },\n\tltra: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Left-to-right Alternates\",\n\t\thide: true,\n\t},\n\tltrm: {\n\t\tcategory: OpenTypeCategoryName.Letterform,\n\t\ttitle: \"Left-to-right Mirrored Forms\",\n\t\thide: true,\n\t},\n\tmark: { category: OpenTypeCategoryName.MoreFeature, title: \"Mark Positioning\", hide: true },\n\tmed2: { category: OpenTypeCategoryName.Letterform, title: \"Medial Forms 2\", hide: true },\n\tmedi: { category: OpenTypeCategoryName.Letterform, title: \"Medial Forms\", hide: true },\n\tmgrk: { category: OpenTypeCategoryName.MoreFeature, title: \"Mathematical Greek\" },\n\tmkmk: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Mark to Mark Positioning\",\n\t\thide: true,\n\t},\n\tmset: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Mark Positioning via Substitution\",\n\t\thide: true,\n\t},\n\tnalt: {\n\t\tcategory: OpenTypeCategoryName.CharacterVariant,\n\t\ttitle: \"Alternate Annotation Form\",\n\t\tshortTitle: \"Alternate Annotation\",\n\t},\n\tnlck: { category: OpenTypeCategoryName.Letterform, title: \"NLC Kanji Forms\", shortTitle: \"NLC Kanji\" },\n\tnukt: { category: OpenTypeCategoryName.Letterform, title: \"Nukta Forms\", hide: true },\n\tnumr: { category: OpenTypeCategoryName.Number, title: \"Numerators\", preview: { content: \"1/b\" } },\n\tonum: { category: OpenTypeCategoryName.Number, title: \"Oldstyle Figures\", shortTitle: \"Oldstyle\" },\n\topbd: { category: OpenTypeCategoryName.Letterform, title: \"Optical Bounds\" },\n\tordn: { category: OpenTypeCategoryName.Number, title: \"Ordinals\" },\n\tornm: { category: OpenTypeCategoryName.CharacterVariant, title: \"Ornaments\" },\n\tpalt: { category: OpenTypeCategoryName.MoreFeature, title: \"Proportional Alternate Widths\" },\n\tpcap: { category: OpenTypeCategoryName.LetterCase, title: \"Petite Capitals\" },\n\tpkna: { category: OpenTypeCategoryName.MoreFeature, title: \"Proportional Kana\" },\n\tpnum: { category: OpenTypeCategoryName.Number, title: \"Proportional Figures\", shortTitle: \"Proportional\" },\n\tpref: { category: OpenTypeCategoryName.MoreFeature, title: \"Pre-base Forms\", hide: true },\n\tpres: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Pre-base Substitutions\",\n\t\thide: true,\n\t},\n\tpstf: { category: OpenTypeCategoryName.MoreFeature, title: \"Post-base Forms\", hide: true },\n\tpsts: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Post-base Substitutions\",\n\t\thide: true,\n\t},\n\tpwid: { category: OpenTypeCategoryName.HorizontalSpacing, title: \"Proportional Widths\" },\n\tqwid: { category: OpenTypeCategoryName.HorizontalSpacing, title: \"Quarter Widths\" },\n\trand: { category: OpenTypeCategoryName.CharacterVariant, title: \"Randomize\" },\n\trclt: {\n\t\tcategory: OpenTypeCategoryName.ContextualAlternate,\n\t\ttitle: \"Required Contextual Alternates\",\n\t\thide: true,\n\t},\n\trkrf: { category: OpenTypeCategoryName.MoreFeature, title: \"Rakar Forms\", hide: true },\n\trlig: { category: OpenTypeCategoryName.Ligature, title: \"Required Ligatures\", hide: true },\n\trphf: { category: OpenTypeCategoryName.MoreFeature, title: \"Reph Form\", hide: true },\n\trtbd: { category: OpenTypeCategoryName.MoreFeature, title: \"Right-to-left embedding\", shortTitle: \"Right Bounds\" },\n\trtla: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Right-to-left alternates\",\n\t\thide: true,\n\t},\n\trtlm: { category: OpenTypeCategoryName.MoreFeature, title: \"Right-to-left mirroring\", hide: true },\n\truby: { category: OpenTypeCategoryName.MoreFeature, title: \"Ruby Notation Forms\", shortTitle: \"Ruby Notation\" },\n\trvrn: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Required Variation Alternates\",\n\t\thide: true,\n\t},\n\tsalt: {\n\t\tcategory: OpenTypeCategoryName.CharacterVariant,\n\t\ttitle: \"Stylistic Alternates\",\n\t\tshortTitle: \"All Alternates\",\n\t},\n\tsinf: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Scientific Inferiors\",\n\t\tpreview: { content: \"Aa Bb Cc\" },\n\t},\n\tsize: { category: OpenTypeCategoryName.MoreFeature, title: \"Optical Size\" },\n\tsmcp: { category: OpenTypeCategoryName.LetterCase, title: \"Small Capitals\" },\n\tsmpl: { category: OpenTypeCategoryName.CharacterVariant, title: \"Simplified Form\", shortTitle: \"Simplified\" },\n\tssty: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Math Script-style Alternates\",\n\t\thide: true,\n\t},\n\tstch: {\n\t\tcategory: OpenTypeCategoryName.CharacterVariant,\n\t\ttitle: \"Stretching Glyph Decomposition\",\n\t\thide: true,\n\t},\n\tsubs: { category: OpenTypeCategoryName.Number, title: \"Subscript\", preview: { content: \"H2O\" } },\n\tsups: { category: OpenTypeCategoryName.Number, title: \"Superscript\", preview: { content: \"No2\" } },\n\tswsh: { category: OpenTypeCategoryName.CharacterVariant, title: \"Swash\" },\n\ttitl: { category: OpenTypeCategoryName.CharacterVariant, title: \"Titling\" },\n\ttjmo: { category: OpenTypeCategoryName.Letterform, title: \"Trailing Jamo Forms\", hide: true },\n\ttnam: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Traditional Name Forms\",\n\t\tshortTitle: \"Traditional Name\",\n\t},\n\ttnum: { category: OpenTypeCategoryName.Number, title: \"Tabular Figures\", shortTitle: \"Tabular\" },\n\ttrad: { category: OpenTypeCategoryName.MoreFeature, title: \"Traditional Forms\", shortTitle: \"Traditional\" },\n\ttwid: { category: OpenTypeCategoryName.HorizontalSpacing, title: \"Third Widths\" },\n\tunic: { category: OpenTypeCategoryName.LetterCase, title: \"Unicase\" },\n\tvalt: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Alternate Vertical Metrics\",\n\t\tshortTitle: \"Alt Vertical\",\n\t},\n\tvapk: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Kerning for Alternate Proportional Vertical Metrics\",\n\t\tshortTitle: \"VAPK\",\n\t},\n\tvatu: { category: OpenTypeCategoryName.MoreFeature, title: \"Vattu Variants\", hide: true },\n\tvchw: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Vertical Contextual Half-width Spacing\",\n\t\tshortTitle: \"Vertical Contextual\",\n\t},\n\tvert: { category: OpenTypeCategoryName.MoreFeature, title: \"Vertical Writing\" },\n\tvhal: { category: OpenTypeCategoryName.MoreFeature, title: \"Alternate Vertical Half Metrics\", shortTitle: \"AVHM\" },\n\tvjmo: { category: OpenTypeCategoryName.MoreFeature, title: \"Vowel Jamo Forms\", hide: true },\n\tvkna: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Vertical Kana Alternates\",\n\t\tshortTitle: \"Vertical Kana\",\n\t},\n\tvkrn: { category: OpenTypeCategoryName.MoreFeature, title: \"Vertical Kerning\" },\n\tvpal: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Proportional Alternate Vertical Metrics\",\n\t\tshortTitle: \"PAVM\",\n\t},\n\tvrt2: { category: OpenTypeCategoryName.MoreFeature, title: \"Vertical Alternates and Rotation\", shortTitle: \"VALT\" },\n\tvrtr: {\n\t\tcategory: OpenTypeCategoryName.MoreFeature,\n\t\ttitle: \"Vertical Alternates for Rotation\",\n\t\tshortTitle: \"Vertical Alternates\",\n\t},\n\tzero: { category: OpenTypeCategoryName.Number, title: \"Slashed Zero\", preview: { content: \"0\" } },\n\tcrcy: { category: OpenTypeCategoryName.MoreFeature, title: \"Currency Symbols\", shortTitle: \"Currency\" },\n}\n\nexport function getOpenTypeFeatureMetadata(tag: OpenTypeFeatureTag): OpenTypeFeatureMetadata {\n\treturn openTypeFeatureTagToMetadata[tag]\n}\n", "import type { OpenTypeFeatureTag } from \"document/models/CanvasTree/utils/openType.ts\"\nimport {\n\tisOpenTypeCharacterVariantFeatureTag,\n\tisOpenTypeFeatureTag,\n\tisOpenTypeStylisticSetFeatureTag,\n} from \"document/models/CanvasTree/utils/openType.ts\"\nimport type { OpenTypeFeature } from \"library/render/fonts/types.ts\"\nimport { OpenTypeCategoryName, extractMostFrequentBaseCharacters } from \"./common.ts\"\nimport type { OpenTypeFeatureMetadata } from \"./getOpenTypeFeatureMetadata.ts\"\nimport { getOpenTypeFeatureMetadata } from \"./getOpenTypeFeatureMetadata.ts\"\n\ninterface OpenTypeFeatureWithTitle {\n\ttag: OpenTypeFeatureTag\n\ttitle: string\n\tshortTitle?: string\n}\n\nexport function categorizeOpenTypeFeatures(\n\tfeatures: OpenTypeFeature[],\n): { category: string; features: OpenTypeFeatureWithTitle[] }[] {\n\tconst groupedFeatures: {\n\t\t[key in OpenTypeCategoryName]: OpenTypeFeatureWithTitle[]\n\t} = {\n\t\t// The order of the categories is important, because it is used to\n\t\t// determine the order of the categories in the UI.\n\t\t[OpenTypeCategoryName.StylisticSet]: [],\n\t\t[OpenTypeCategoryName.CharacterVariant]: [],\n\t\t[OpenTypeCategoryName.Ligature]: [],\n\t\t[OpenTypeCategoryName.Number]: [],\n\t\t[OpenTypeCategoryName.LetterCase]: [],\n\t\t[OpenTypeCategoryName.ContextualAlternate]: [],\n\t\t[OpenTypeCategoryName.HorizontalSpacing]: [],\n\t\t[OpenTypeCategoryName.Letterform]: [],\n\t\t[OpenTypeCategoryName.MoreFeature]: [],\n\t}\n\n\tfor (const feature of features) {\n\t\tconst { tag, coverage } = feature\n\t\tif (!tag || !isOpenTypeFeatureTag(tag)) continue\n\n\t\tconst { category, title, shortTitle, hide } = featureMetadataForTag(tag, coverage)\n\t\tif (hide) continue\n\n\t\tgroupedFeatures[category].push({ tag, title, shortTitle })\n\t}\n\n\treturn Object.entries(groupedFeatures).reduce(\n\t\t(acc: { category: string; features: OpenTypeFeatureWithTitle[] }[], [category, features]) => {\n\t\t\tif (features.length > 0) {\n\t\t\t\tfeatures.sort((a, b) => a.title.localeCompare(b.title))\n\t\t\t\tacc.push({ category, features })\n\t\t\t}\n\t\t\treturn acc\n\t\t},\n\t\t[],\n\t)\n}\n\nfunction getStylisticSetMetadata(tag: OpenTypeFeatureTag): OpenTypeFeatureMetadata {\n\tconst index = getDynamicFeatureIndex(tag)\n\treturn { category: OpenTypeCategoryName.StylisticSet, title: `Stylistic Set ${index}` }\n}\n\nfunction getCharacterVariantMetadata(tag: OpenTypeFeatureTag, coverage?: string[]): OpenTypeFeatureMetadata {\n\tconst index = getDynamicFeatureIndex(tag)\n\n\t// Character Variants are only based on a single character.\n\tconst basedCharacter = coverage ? extractMostFrequentBaseCharacters(coverage, 1) : undefined\n\tconst title = basedCharacter ? `Alternative ${basedCharacter}` : `Character Variant ${index}`\n\n\treturn { category: OpenTypeCategoryName.CharacterVariant, title }\n}\n\nfunction getDynamicFeatureIndex(tag: OpenTypeFeatureTag) {\n\treturn parseInt(tag.slice(2))\n}\n\nexport function featureMetadataForTag(tag: OpenTypeFeatureTag, coverage?: string[]): OpenTypeFeatureMetadata {\n\tif (isOpenTypeStylisticSetFeatureTag(tag)) return getStylisticSetMetadata(tag)\n\tif (isOpenTypeCharacterVariantFeatureTag(tag)) return getCharacterVariantMetadata(tag, coverage)\n\treturn getOpenTypeFeatureMetadata(tag)\n}\n", "import { isOpenTypeFeatureTag } from \"document/models/CanvasTree/utils/openType.ts\"\nimport type { OpenTypeFeature } from \"library/render/fonts/types.ts\"\n\nexport function filterSupportedOpenTypeFeatures(\n\tfeatures: OpenTypeFeature[] | undefined,\n): OpenTypeFeature[] | undefined {\n\treturn features?.filter(feature => isOpenTypeFeatureTag(feature.tag))\n}\n", "import { isDeprecatedFontFamily } from \"document/components/chrome/shared/FontPopout/utils/deprecatedFonts.ts\"\nimport { fontStore } from \"library/index.ts\"\nimport type { OpenTypeFeature, ReadonlyFont } from \"library/render/fonts/types.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport { filterSupportedOpenTypeFeatures } from \"./filterSupportedOpenTypeFeatures.ts\"\n\nexport async function getSupportedOpenTypeFeatures(fontData: ReadonlyFont): Promise<OpenTypeFeature[] | undefined> {\n\tif (isDeprecatedFontFamily(fontData.family)) return undefined\n\n\tconst features = await getOpenTypeFeaturesForSource(fontData)\n\treturn filterSupportedOpenTypeFeatures(features)\n}\n\nasync function getOpenTypeFeaturesForSource(fontData: ReadonlyFont): Promise<OpenTypeFeature[] | undefined> {\n\tconst fontSourceName = fontData.family.source\n\n\tswitch (fontSourceName) {\n\t\tcase \"custom\":\n\t\t\treturn fontStore.custom.getOpenTypeFeatures(fontData)\n\t\tcase \"fontshare\": {\n\t\t\treturn fontStore.fontshare.getOpenTypeFeatures(fontData)\n\t\t}\n\t\tcase \"framer\": {\n\t\t\treturn fontStore.framer.getOpenTypeFeatures(fontData)\n\t\t}\n\t\tcase \"google\": {\n\t\t\treturn fontStore.google.getOpenTypeFeatures(fontData)\n\t\t}\n\t\tcase \"builtIn\":\n\t\t\treturn fontStore.builtIn.getOpenTypeFeatures(fontData)\n\t\tcase \"local\":\n\t\t\tthrow new Error(\"Local font does not support OpenType features\")\n\t\tdefault:\n\t\t\tassertNever(fontSourceName)\n\t}\n}\n", "import { assert, type Prettify, assertNever } from \"@framerjs/shared\"\nimport { featureMetadataForTag } from \"document/components/chrome/properties/rows/OpenTypeRow/utils/categorizeOpenTypeFeatures.ts\"\nimport { getSupportedOpenTypeFeatures } from \"document/components/chrome/properties/rows/OpenTypeRow/utils/getOpenTypeFeaturesJSON.ts\"\nimport type { LoadedScopeNode } from \"document/models/CanvasTree/index.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\ttype CharacterVariantOpenTypeFeatureTag,\n\ttype StaticOpenTypeFeatureTag,\n\ttype StylisticSetOpenTypeFeatureTag,\n\tisFeatureAppliedByDefault,\n\tisOpenTypeCharacterVariantFeatureTag,\n\tisOpenTypeFeatureTag,\n\tisOpenTypeStylisticSetFeatureTag,\n} from \"document/models/CanvasTree/utils/openType.ts\"\nimport { fontStore } from \"library/render/fonts/fontStore.ts\"\nimport type { Font, FontFamily, ReadonlyFont, ReadonlyFontFamily, VariationAxis } from \"library/render/fonts/types.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { escapeValue } from \"../prompt/utils.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\n\nexport const FONT_COMMUNICATION_GUIDELINES = `When talking about fonts, never reference technical names like OpenType feature/axis tags (ie. wdth, cv02, ss05, clig) and instead look up Character Variant and Stylistic Set names in ${escapeValue(\"openTypeFeatures\")} on your ${escapeValue(metadataTags.availableFonts)} section or use what you know about the OpenType spec to speak plainly.`\n\n/**\n * Font variants that should be excluded from AI agent context, indexed by font family name.\n * These are decorative/novelty variants that use fake weights and always look like bugs\n * when picked by the agent (e.g. \"Brukt\" is a distressed/textured variant of Apfel Grotezk).\n */\nconst excludedFontVariantsByFamily: Record<string, Set<string>> = {\n\t\"apfel grotezk\": new Set([\"brukt\"]),\n}\n\n/** Returns true if a font variant should be excluded from AI agent context. */\nexport function isExcludedFontVariant(font: ReadonlyFont): boolean {\n\tconst familyName = font.family?.name\n\tif (!familyName) return false\n\tconst excludedVariants = excludedFontVariantsByFamily[familyName.toLowerCase()]\n\tif (!excludedVariants) return false\n\tif (!font.variant) return false\n\treturn excludedVariants.has(font.variant.toLowerCase())\n}\n\ntype AIFontWeight = NonNullable<Font[\"weight\"]>\ntype AIFontStyle = NonNullable<Font[\"style\"]>\n\nexport interface AIFontFamilyBase {\n\tname: FontFamily[\"name\"]\n\tweights: AIFontWeight[] // 100, 200, 300, 400, 500, 600, 700, 800, 900\n\tstyles: AIFontStyle[] // normal, italic\n\tcategory: Font[\"category\"] // serif, sans-serif, monospace, display, handwriting\n\t/** Variation axes - only present for variable fonts */\n\tvariationAxes?: VariationAxis[]\n\t/** Supported OpenType feature tags (excluding shaping and default-on features) */\n\topenTypeFeatures?: AIOpenTypeFeature[]\n}\n\ntype WithCoverageKeys<T extends object> = Prettify<T & { coverage: string[]; label: string; isDefault?: boolean }>\n\nexport type AIOpenTypeFeature =\n\t| { type: \"static\"; tag: StaticOpenTypeFeatureTag; isDefault?: boolean }\n\t| WithCoverageKeys<{\n\t\t\ttype: \"stylistic-set\"\n\t\t\ttag: StylisticSetOpenTypeFeatureTag\n\t  }>\n\t| WithCoverageKeys<{\n\t\t\ttype: \"character-variant\"\n\t\t\ttag: CharacterVariantOpenTypeFeatureTag\n\t  }>\n\n/**\n * Compact serialised form of AIOpenTypeFeature for LLM context.\n * - Static features with no `isDefault` become a plain tag string.\n * - Coverage arrays are joined into a single space-separated string.\n * - The `type` discriminator is stripped.\n */\nexport type SerializedOpenTypeFeature =\n\t| StaticOpenTypeFeatureTag\n\t| { tag: StaticOpenTypeFeatureTag; isDefault?: boolean }\n\t| {\n\t\t\ttag: CharacterVariantOpenTypeFeatureTag | StylisticSetOpenTypeFeatureTag\n\t\t\tcoverage: string\n\t\t\tlabel: string\n\t\t\tisDefault?: boolean\n\t  }\n\nexport function serializeOpenTypeFeatures(features: readonly AIOpenTypeFeature[]): SerializedOpenTypeFeature[] {\n\treturn features.map(feature => {\n\t\tswitch (feature.type) {\n\t\t\tcase \"static\":\n\t\t\t\tif (!feature.isDefault) return feature.tag\n\t\t\t\treturn { tag: feature.tag, isDefault: true }\n\t\t\tcase \"character-variant\":\n\t\t\tcase \"stylistic-set\":\n\t\t\t\treturn {\n\t\t\t\t\ttag: feature.tag,\n\t\t\t\t\tcoverage: feature.coverage.join(\" \"),\n\t\t\t\t\tlabel: feature.label,\n\t\t\t\t\t...(feature.isDefault && { isDefault: true }),\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tassertNever(feature, `Unhandled opentype feature: ${feature}`)\n\t\t}\n\t})\n}\n\nexport interface AIFontFamilyWithReason extends AIFontFamilyBase {\n\treason: string\n}\n\nexport type AIFontFamily = AIFontFamilyWithReason | AIFontFamilyBase\n\n/** Default font family names offered to the AI agent. */\nconst DEFAULT_FONT_FAMILY_NAMES = [\n\t\"Geist\",\n\t\"Geist Mono\",\n\t\"Inter\",\n\t\"Instrument Serif\",\n\t\"Apfel Grotezk\",\n\t\"EB Garamond\",\n\t\"Google Sans Code\",\n] as const\n\nexport const DEFAULT_FONT_FAMILY_NAME = \"Inter\"\n\n/**\n * Hydrate a font family from the font store into the AI agent format.\n * Returns undefined if the font family cannot be found.\n */\nasync function hydrateFontFamily(font: ReadonlyFont): Promise<AIFontFamilyBase> {\n\tconst family = font.family\n\tconst weights = getFontFamilyWeights(family)\n\tconst styles = getFontFamilyStyles(family)\n\tconst variationAxes = getVariationAxes(family)\n\tconst openTypeFeatures = font.hasOpenTypeFeatures ? await getOpenTypeFeatures(font) : undefined\n\n\treturn {\n\t\tname: family.name,\n\t\tweights,\n\t\tstyles,\n\t\tcategory: font.category,\n\t\tvariationAxes,\n\t\topenTypeFeatures,\n\t}\n}\n\nlet defaultFontFamiliesCache: Promise<AIFontFamilyBase[]> | undefined\n/** Resolve default font families from the font store at runtime. */\nexport async function getDefaultFontFamilies(): Promise<AIFontFamilyBase[]> {\n\tif (!defaultFontFamiliesCache) {\n\t\tdefaultFontFamiliesCache = fontStore\n\t\t\t.importAllWebFonts()\n\t\t\t.then(() =>\n\t\t\t\tPromise.all(\n\t\t\t\t\tDEFAULT_FONT_FAMILY_NAMES.map(familyName => {\n\t\t\t\t\t\tconst font = fontStore.getAvailableFonts().find(f => f.family.name === familyName)\n\t\t\t\t\t\tassert(font, `font family \"${familyName}\" not found in font store`)\n\n\t\t\t\t\t\treturn hydrateFontFamily(font)\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.catch(err => {\n\t\t\t\tdefaultFontFamiliesCache = undefined\n\t\t\t\tthrow err\n\t\t\t})\n\t}\n\n\treturn defaultFontFamiliesCache\n}\n\n/**\n * Get OpenType feature tags for a font, for serialisation into agent context\n */\nexport async function getOpenTypeFeatures(font: ReadonlyFont): Promise<AIOpenTypeFeature[]> {\n\tif (!font.hasOpenTypeFeatures) {\n\t\treturn []\n\t}\n\n\tconst features = await getSupportedOpenTypeFeatures(font)\n\tif (!features || features.length === 0) {\n\t\treturn []\n\t}\n\n\treturn features.flatMap<AIOpenTypeFeature>(feature => {\n\t\tif (!isOpenTypeFeatureTag(feature.tag)) {\n\t\t\treturn []\n\t\t}\n\n\t\tconst isDefault = isFeatureAppliedByDefault(feature.tag) ? true : undefined\n\n\t\tif (isOpenTypeCharacterVariantFeatureTag(feature.tag)) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: \"character-variant\",\n\t\t\t\t\ttag: feature.tag,\n\t\t\t\t\tcoverage: feature.coverage ?? [],\n\t\t\t\t\tlabel: featureMetadataForTag(feature.tag, feature.coverage ?? []).title,\n\t\t\t\t\tisDefault,\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\tif (isOpenTypeStylisticSetFeatureTag(feature.tag)) {\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\ttype: \"stylistic-set\",\n\t\t\t\t\ttag: feature.tag,\n\t\t\t\t\tcoverage: feature.coverage ?? [],\n\t\t\t\t\tlabel: featureMetadataForTag(feature.tag, feature.coverage ?? []).title,\n\t\t\t\t\tisDefault,\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn [{ type: \"static\", tag: feature.tag, isDefault }]\n\t})\n}\n\n/** Convert font variation axes to simplified AI format */\nfunction getVariationAxes(family: ReadonlyFontFamily): VariationAxis[] | undefined {\n\t// Find a variable font in the family to get axes from\n\tfor (const font of family.fonts) {\n\t\tif (font.variationAxes && font.variationAxes.length > 0) {\n\t\t\treturn Array.from(font.variationAxes)\n\t\t}\n\t}\n\treturn undefined\n}\n\n/**\n * Prepare context for LLM which includes all fonts used in the current scope and the default\n * available fonts.\n */\nexport async function prepareFontsContext(scopeNode: LoadedScopeNode): Promise<AIFontFamily[]> {\n\tconst defaultFonts = await getDefaultFontFamilies()\n\tconst fonts = new Map<string, AIFontFamily>(defaultFonts.map(f => [f.name, f]))\n\n\tfor (const child of scopeNode.walk()) {\n\t\tlet childFontSelectors: string[] = []\n\t\tif (isRichTextNode(child)) {\n\t\t\t// TODO: Currently text nodes with style presets don't extract the fonts correctly. We need to fix this.\n\t\t\tchildFontSelectors = child.getFonts(false)\n\t\t}\n\n\t\t// TODO: Collect fonts used within components\n\n\t\tfor (const selector of childFontSelectors) {\n\t\t\tconst fontObject = fontStore.getFontBySelector(selector)\n\t\t\tif (!fontObject) continue\n\n\t\t\t// If the font is already in our map, skip it\n\t\t\tif (fonts.has(fontObject.family.name)) continue\n\n\t\t\tconst fontFamily = await hydrateFontFamily(fontObject)\n\t\t\tfonts.set(fontFamily.name, fontFamily)\n\t\t}\n\t}\n\n\treturn Array.from(fonts.values())\n}\n\nfunction getFontFamilyWeights(family: ReadonlyFontFamily): AIFontWeight[] {\n\tif (!family.fonts) return []\n\tconst weights = new Set<AIFontWeight>()\n\tfor (const font of family.fonts) {\n\t\tif (isUndefined(font.weight)) continue\n\t\tif (isExcludedFontVariant(font)) continue\n\t\tweights.add(font.weight)\n\t}\n\treturn Array.from(weights).sort((a, b) => a - b)\n}\n\nfunction getFontFamilyStyles(family: ReadonlyFontFamily): AIFontStyle[] {\n\tif (!family.fonts) return []\n\tconst styles = new Set<AIFontStyle>()\n\tfor (const font of family.fonts) {\n\t\tif (isUndefined(font.style)) continue\n\t\tif (isExcludedFontVariant(font)) continue\n\t\tstyles.add(font.style)\n\t}\n\treturn Array.from(styles)\n}\n\nexport interface SerializedAIFontFamily extends Omit<AIFontFamilyBase, \"openTypeFeatures\"> {\n\treason?: string\n\topenTypeFeatures?: SerializedOpenTypeFeature[]\n}\n\n/** Compact-serialize font families for LLM context, stripping verbose OpenType feature objects. */\nexport function serializeFontsForContext(fonts: readonly AIFontFamily[]): SerializedAIFontFamily[] {\n\treturn fonts.map(font => {\n\t\tconst { openTypeFeatures, ...rest } = font\n\t\treturn {\n\t\t\t...rest,\n\t\t\t...(openTypeFeatures?.length && { openTypeFeatures: serializeOpenTypeFeatures(openTypeFeatures) }),\n\t\t}\n\t})\n}\n", "import type { BaseEngineScheduler } from \"document/base-engine/BaseEngine.ts\"\nimport type { LoadedSmartComponentNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isCodeComponentNode, isSmartComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { getSmartComponentForCodeComponent } from \"document/models/CanvasTree/nodes/utils/smartComponentInstanceHelpers.ts\"\nimport { isFormContainer } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport { type FormConfigDestination, createDestination } from \"document/models/CanvasTree/traits/forms/formConfig.ts\"\nimport type { FormsStore } from \"document/stores/FormsStore.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport type { TreeResolver } from \"../TreeResolver.ts\"\nimport { DeferTraitError } from \"./DeferTraitError.ts\"\nimport type { GetTurnChangeset } from \"./turnChangeset.ts\"\n\nexport class Forms {\n\tprivate promises: Promise<void>[] = []\n\tprivate promiseMap: Map<string, Promise<void>> = new Map()\n\n\tconstructor(\n\t\tprivate readonly treeStore: TreeStore,\n\t\tprivate readonly formsStore: FormsStore,\n\t\tprivate readonly scheduler: BaseEngineScheduler,\n\t\tprivate readonly getTurnChangeset: GetTurnChangeset,\n\t\tprivate readonly treeResolver: TreeResolver,\n\t) {}\n\n\tprivate async schedule(nodeId: NodeID, task: () => void): Promise<void> {\n\t\tthis.treeResolver.recordChangedNode(nodeId, \"update\")\n\n\t\tconst changeset = this.getTurnChangeset()\n\t\tassert(changeset, \"Turn changeset is required when saving form config\")\n\t\tawait this.scheduler.scheduleAgentChanges(() => changeset.append(task))\n\t}\n\n\tsaveFormConfig(nodeId: NodeID, destination: FormConfigDestination): void {\n\t\tconst node = this.treeStore.tree.get(nodeId)\n\t\tif (!node || !isFormContainer(node)) {\n\t\t\tthrow new DeferTraitError(`Cannot save form config: ${nodeId} not found or not a form container`)\n\t\t}\n\n\t\tconst promise = this.formsStore.updateFormConfig(\n\t\t\tthis.treeStore.tree,\n\t\t\tnodeId,\n\t\t\t{ destinations: [destination] },\n\t\t\ttask => this.schedule(nodeId, task),\n\t\t)\n\t\tthis.promises.push(promise)\n\t}\n\n\tsaveDefaultDestination(nodeId: NodeID): void {\n\t\tthis.saveFormConfig(nodeId, createDestination(\"verifiedEmail\"))\n\t}\n\n\tdeferUntilFormButtonIsLoaded(formSubmitButtonId: NodeID): LoadedSmartComponentNode {\n\t\tconst buttonNode = this.treeStore.tree.get(formSubmitButtonId)\n\t\tif (!buttonNode) {\n\t\t\tthrow new DeferTraitError(`Cannot set formSubmitButtonId: ${formSubmitButtonId} not found`)\n\t\t}\n\n\t\tassert(isCodeComponentNode(buttonNode), \"form submit button must be a ComponentInstanceNode\")\n\t\tconst componentSource = getSmartComponentForCodeComponent(this.treeStore.tree, buttonNode)\n\n\t\tassert(isSmartComponentNode(componentSource), \"form submit button must be instance of ComponentNode\")\n\n\t\tif (componentSource.isLoaded()) return componentSource\n\n\t\tconst existingPromise = this.promiseMap.get(formSubmitButtonId)\n\n\t\tif (!existingPromise) {\n\t\t\tconst promise = componentSource.load().then(() => {})\n\t\t\tthis.promises.push(promise)\n\t\t\tthis.promiseMap.set(formSubmitButtonId, promise)\n\t\t}\n\n\t\tthrow new DeferTraitError(`Form button ${componentSource.id} is not loaded`)\n\t}\n\n\t/**\n\t * Should be called after deferred traits are retried as promises may not be created until then\n\t */\n\tasync finalize(): Promise<void> {\n\t\tconst pending = this.promises\n\t\tthis.promises = []\n\t\tthis.promiseMap.clear()\n\t\tawait Promise.all(pending)\n\t}\n}\n", "import type { AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { ModuleType } from \"@framerjs/shared\"\nimport type { LocalModuleIdentifier, ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { AnyLayoutTemplateNode } from \"document/models/CanvasTree/index.ts\"\nimport { isLayoutTemplateNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport type { DeferredOps } from \"./deferred.ts\"\nimport { ModuleDefinitions, addModuleName, getNodeName } from \"./moduleDefinitions.ts\"\nimport type { VectorSets } from \"./vectors.ts\"\n\nexport class LayoutTemplates extends ModuleDefinitions {\n\tprotected override get variableScopeType(): ScopeType {\n\t\treturn ScopeType.LayoutTemplate\n\t}\n\n\tprotected override getScope(localModuleIdentifier: LocalModuleIdentifier): AnyLayoutTemplateNode | null {\n\t\tconst { type, localIdName } = localModuleIdentifier\n\t\tif (type !== ModuleType.LayoutTemplate) return null\n\t\treturn this.treeStore.tree.getNodeWithTrait(localIdName, isLayoutTemplateNode)\n\t}\n\n\tstatic async fromTree(\n\t\ttreeStore: TreeStore,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\tvectorSets: VectorSets,\n\t\tdeferred: DeferredOps,\n\t): Promise<LayoutTemplates> {\n\t\tconst identifiers = new Set<ModuleExportIdentifierString>()\n\t\tconst existingNames = new Map<ModuleExportIdentifierString, string>()\n\t\tconst names = new Set<string>()\n\n\t\tfor (const child of treeStore.tree.root.children) {\n\t\t\tif (isLayoutTemplateNode(child, true)) {\n\t\t\t\tidentifiers.add(child.instanceIdentifier)\n\t\t\t\taddModuleName(existingNames, names, child.instanceIdentifier, getNodeName(child))\n\t\t\t}\n\t\t}\n\n\t\tconst { namesByIdentifier, identifiersByName } = ModuleDefinitions.buildNameMappings(\n\t\t\tidentifiers,\n\t\t\tcomponentLoader,\n\t\t\texistingNames,\n\t\t)\n\n\t\treturn new LayoutTemplates(\n\t\t\tnew Map(),\n\t\t\tnamesByIdentifier,\n\t\t\tidentifiersByName,\n\t\t\ttreeStore,\n\t\t\tvectorSets,\n\t\t\tdeferred,\n\t\t\tnew Map(),\n\t\t\tcomponentLoader,\n\t\t)\n\t}\n\n\tstatic fromIdentifiers(\n\t\tidentifiers: Set<ModuleExportIdentifierString>,\n\t\tvectorSets: VectorSets,\n\t\tcomponentLoader: AnyComponentLoader,\n\t\ttreeStore: TreeStore,\n\t\tdeferred: DeferredOps,\n\t) {\n\t\tconst { namesByIdentifier, identifiersByName } = ModuleDefinitions.buildNameMappings(identifiers, componentLoader)\n\n\t\treturn new LayoutTemplates(\n\t\t\tnew Map(),\n\t\t\tnamesByIdentifier,\n\t\t\tidentifiersByName,\n\t\t\ttreeStore,\n\t\t\tvectorSets,\n\t\t\tdeferred,\n\t\t\tnew Map(),\n\t\t\tcomponentLoader,\n\t\t)\n\t}\n}\n", "import { emptyArray } from \"@framerjs/shared\"\nimport { flatten } from \"app/ai/utils/flatten.ts\"\nimport type { CanvasNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { isRichTextNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport type { UpdateCommandAttributes } from \"../dsl.ts\"\nimport { toAttributes } from \"../traits/attributes.ts\"\nimport { nullString } from \"../traits/helpers.ts\"\nimport { toVirtualNodeAttributes } from \"../traits/virtualAttributes.ts\"\nimport type { AgentContext } from \"./AgentContext.ts\"\nimport { collectMetadata } from \"./nodes.ts\"\nimport type {\n\tRichTextReaderHandle,\n\tRichTextTarget,\n\tVirtualRichTextNode,\n\tVirtualRichTextRoot,\n\tVirtualRichTextTextRun,\n} from \"./richtext/document.ts\"\nimport { serializeVirtualText } from \"./richtext/serialize.ts\"\nimport { resolveRichTextTargetHandle } from \"./richtext/targets.ts\"\nimport { getVirtualRichTextChildren } from \"./richtext/traversal.ts\"\n\nconst updateCommandNodeIdPath: keyof UpdateCommandAttributes = \"id\"\nconst virtualTextAttributePath = \"text\" as const satisfies keyof VirtualRichTextTextRun\n\ntype SerializedAttributeValues = Record<string, unknown>\ntype VirtualNodeFilterId = NodeID\n\nexport type VirtualNodeAttributeFilter = ReadonlyMap<VirtualNodeFilterId, ReadonlySet<string>>\n\nexport interface VirtualTargetAttributeFilter {\n\tsourceRoots: readonly VirtualRichTextRoot[]\n\tattributesByNodeId: VirtualNodeAttributeFilter\n}\n\nexport type AttributeChangeDecisionReason = \"untracked_node\" | \"unchanged\" | \"updated_ok\" | \"side_effect\"\nexport type AttributeChangeDecisionMetrics = Map<\n\tstring,\n\t{\n\t\treason: AttributeChangeDecisionReason\n\t\tbefore: unknown\n\t\tafter: unknown\n\t\tupdate: unknown\n\t}\n>\n\nexport interface AttributesWithSideEffectChanges {\n\tattributes: ReadonlySet<string>\n\tvirtualAttributesByTarget: ReadonlyMap<RichTextTarget, VirtualTargetAttributeFilter>\n\tmetrics: AttributeChangeDecisionMetrics\n}\n\ninterface TrackedNodeAttributeChanges {\n\tbaseline: SerializedAttributeValues\n\tappliedValuesByAttributePath: SerializedAttributeValues\n\tvirtualTargetChanges: Map<RichTextTarget, TrackedVirtualTargetChanges>\n}\n\ninterface TrackedVirtualTargetChanges {\n\tbaselineAttributeRoots: readonly SerializedVirtualAttributeNode[]\n\tappliedValuesByNodeId: Map<string, SerializedAttributeValues>\n}\n\ninterface SerializedVirtualAttributeNode {\n\tid: string\n\tattributes: SerializedAttributeValues\n\tchildren: readonly SerializedVirtualAttributeNode[]\n}\n\nexport class NodeAttributeChanges {\n\tprivate readonly changesByNodeId = new Map<NodeID, TrackedNodeAttributeChanges>()\n\n\tconstructor(private readonly ctx: AgentContext) {}\n\n\tcaptureInsertedNode(node: CanvasNode): void {\n\t\tif (this.changesByNodeId.has(node.id)) return\n\t\tthis.changesByNodeId.set(node.id, createTrackedNodeChanges({}))\n\t}\n\n\tasync captureNodeBeforeUpdate(node: CanvasNode): Promise<void> {\n\t\tif (this.changesByNodeId.has(node.id)) return\n\t\tthis.changesByNodeId.set(node.id, createTrackedNodeChanges(await serializeNodeAttributes(node, this.ctx)))\n\t}\n\n\tasync captureVirtualNodeInsert(target: RichTextTarget, virtualNodeId: string) {\n\t\tconst resolvedOwnerNode = await this.captureVirtualNodeCanvasNode(target)\n\t\tthis.trackVirtualNode(resolvedOwnerNode.id, target, virtualNodeId)\n\t}\n\n\tasync captureBeforeVirtualNodeUpdate(target: RichTextTarget, virtualNode: VirtualRichTextNode) {\n\t\tconst resolvedOwnerNode = await this.captureVirtualNodeCanvasNode(target)\n\t\tthis.trackVirtualNode(resolvedOwnerNode.id, target, virtualNode.id)\n\t}\n\n\tasync recordAppliedNodeAttributes(node: CanvasNode, attributes: Record<string, unknown>): Promise<void> {\n\t\tconst changes = this.changesByNodeId.get(node.id)\n\t\tassert(changes, `No tracked changes found for node ${node.id} when recording applied attributes. This is a bug`)\n\t\tObject.assign(changes.appliedValuesByAttributePath, attributes)\n\t}\n\n\tasync recordAppliedVirtualNodeAttributes(\n\t\ttarget: RichTextTarget,\n\t\tvirtualNodeId: string,\n\t\tattributes: Record<string, unknown>,\n\t): Promise<void> {\n\t\tconst node = this.resolveRichTextTarget(target)\n\t\tconst virtualTargetChanges = this.requireTrackedVirtualTargetChanges(node.id, target)\n\t\tconst appliedValuesByAttributePath = virtualTargetChanges.appliedValuesByNodeId.get(virtualNodeId)\n\t\tassert(\n\t\t\tappliedValuesByAttributePath,\n\t\t\t`No tracked virtual changes found for node ${virtualNodeId} on target ${target}`,\n\t\t)\n\n\t\tObject.assign(appliedValuesByAttributePath, attributes)\n\t}\n\n\tasync getAttributesWithSideEffectChanges(node: CanvasNode): Promise<AttributesWithSideEffectChanges> {\n\t\tconst changes = this.changesByNodeId.get(node.id)\n\t\tconst metrics: AttributeChangeDecisionMetrics = new Map()\n\n\t\tif (!changes) {\n\t\t\tmetrics.set(\"$node\", { reason: \"untracked_node\", before: undefined, after: undefined, update: undefined })\n\t\t\treturn { attributes: new Set(), virtualAttributesByTarget: new Map(), metrics }\n\t\t}\n\n\t\tconst attributesToReport = new Set<string>()\n\t\tconst virtualAttributesByTarget = new Map<RichTextTarget, VirtualTargetAttributeFilter>()\n\n\t\tconst currentTargetNodeAttributes = changes.baseline ? await serializeNodeAttributes(node, this.ctx) : undefined\n\n\t\t/**\n\t\t * When just creating a +RichTextNode with text directly set, virtual nodes materialise magically\n\t\t *\n\t\t * We track these as side effect inserts\n\t\t */\n\n\t\tconst nodeTarget = node.id\n\t\tconst currentRootsForInsertSideEffects = getVirtualTargetSnapshot(nodeTarget, this.ctx)\n\t\tconst sideEffectInsertedRoots = await this.getSideEffectInsertedVirtualRoots(\n\t\t\tnode,\n\t\t\tchanges,\n\t\t\tcurrentRootsForInsertSideEffects,\n\t\t)\n\n\t\tif (sideEffectInsertedRoots.length > 0) {\n\t\t\tconst sideEffectInsertedAttributesByVirtualNodeId = await getVirtualAttributesWithSideEffectChanges(\n\t\t\t\t{ baselineAttributeRoots: [], appliedValuesByNodeId: new Map() },\n\t\t\t\tsideEffectInsertedRoots,\n\t\t\t\tthis.ctx,\n\t\t\t)\n\t\t\tvirtualAttributesByTarget.set(nodeTarget, {\n\t\t\t\tsourceRoots: currentRootsForInsertSideEffects,\n\t\t\t\tattributesByNodeId: sideEffectInsertedAttributesByVirtualNodeId.attributesByVirtualNodeId,\n\t\t\t})\n\t\t\tfor (const [path, reason] of sideEffectInsertedAttributesByVirtualNodeId.metrics) {\n\t\t\t\tmetrics.set(path, reason)\n\t\t\t}\n\t\t}\n\n\t\t/**\n\t\t * For inserts & updated we've tracked via DSL we next reconcile these changes\n\t\t */\n\n\t\tfor (const [target, virtualTargetChange] of changes.virtualTargetChanges) {\n\t\t\tconst currentDocument = this.ctx.virtualText.getDocument(target)\n\t\t\tassert(\n\t\t\t\tcurrentDocument,\n\t\t\t\t`No virtual text document found for target ${target} when calculating side effect changes even though we've been operating on it. This is a bug`,\n\t\t\t)\n\t\t\tconst currentRoots = structuredClone(currentDocument.children)\n\t\t\tconst sideEffectChanges = await getVirtualAttributesWithSideEffectChanges(\n\t\t\t\tvirtualTargetChange,\n\t\t\t\tcurrentRoots,\n\t\t\t\tthis.ctx,\n\t\t\t)\n\n\t\t\tconst existingAttributesForTarget = virtualAttributesByTarget.get(target)?.attributesByNodeId\n\t\t\tvirtualAttributesByTarget.set(target, {\n\t\t\t\tsourceRoots: currentRoots,\n\t\t\t\tattributesByNodeId: existingAttributesForTarget\n\t\t\t\t\t? new Map([\n\t\t\t\t\t\t\t...existingAttributesForTarget.entries(),\n\t\t\t\t\t\t\t...sideEffectChanges.attributesByVirtualNodeId.entries(),\n\t\t\t\t\t\t])\n\t\t\t\t\t: sideEffectChanges.attributesByVirtualNodeId,\n\t\t\t})\n\n\t\t\tfor (const [path, reason] of sideEffectChanges.metrics) {\n\t\t\t\tmetrics.set(path, reason)\n\t\t\t}\n\t\t}\n\n\t\tconst paths = new Set([\n\t\t\t...Object.keys(changes.baseline ?? {}),\n\t\t\t...Object.keys(currentTargetNodeAttributes ?? {}),\n\t\t\t...Object.keys(changes.appliedValuesByAttributePath).filter(path => !isVirtualAttributePath(path)),\n\t\t])\n\t\tpaths.delete(updateCommandNodeIdPath)\n\n\t\tfor (const path of paths) {\n\t\t\tconst rawUpdateValue = changes.appliedValuesByAttributePath[path]\n\t\t\tconst currentValue = coerceNullToUndefined(currentTargetNodeAttributes?.[path])\n\t\t\tconst baselineValue = coerceNullToUndefined(changes.baseline?.[path])\n\t\t\tconst updateValue = coerceNullToUndefined(rawUpdateValue)\n\t\t\tconst isAppliedDelete = isDeletedByUpdateCommand(currentValue, rawUpdateValue)\n\n\t\t\tif (isEqual(currentValue, baselineValue)) {\n\t\t\t\tmetrics.set(path, { reason: \"unchanged\", before: baselineValue, after: currentValue, update: undefined })\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (Object.hasOwn(changes.appliedValuesByAttributePath, path) && isAppliedDelete) {\n\t\t\t\tmetrics.set(path, {\n\t\t\t\t\treason: \"updated_ok\",\n\t\t\t\t\tbefore: baselineValue,\n\t\t\t\t\tafter: currentValue,\n\t\t\t\t\tupdate: updateValue,\n\t\t\t\t})\n\t\t\t\tattributesToReport.add(path)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (Object.hasOwn(changes.appliedValuesByAttributePath, path) && isEqual(currentValue, updateValue)) {\n\t\t\t\tmetrics.set(path, {\n\t\t\t\t\treason: \"updated_ok\",\n\t\t\t\t\tbefore: baselineValue,\n\t\t\t\t\tafter: currentValue,\n\t\t\t\t\tupdate: updateValue,\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tmetrics.set(path, { reason: \"side_effect\", before: baselineValue, after: currentValue, update: undefined })\n\t\t\tattributesToReport.add(path)\n\t\t}\n\n\t\treturn { attributes: attributesToReport, virtualAttributesByTarget, metrics }\n\t}\n\n\treset(): void {\n\t\tthis.changesByNodeId.clear()\n\t}\n\n\tasDisposable(): Disposable & {\n\t\tgetAttributesWithSideEffectChanges: NodeAttributeChanges[\"getAttributesWithSideEffectChanges\"]\n\t} {\n\t\treturn {\n\t\t\t[Symbol.dispose]: this.reset.bind(this),\n\t\t\tgetAttributesWithSideEffectChanges: this.getAttributesWithSideEffectChanges.bind(this),\n\t\t}\n\t}\n\n\tprivate async captureVirtualNodeCanvasNode(target: RichTextTarget): Promise<CanvasNode> {\n\t\tconst resolvedNode = this.resolveRichTextTarget(target)\n\t\tawait this.captureNodeBeforeUpdate(resolvedNode)\n\t\tawait this.captureVirtualTarget(resolvedNode, target)\n\t\treturn resolvedNode\n\t}\n\n\tprivate trackVirtualNode(nodeId: NodeID, target: RichTextTarget, virtualNodeId: string): void {\n\t\tconst virtualTargetChanges = this.requireTrackedVirtualTargetChanges(nodeId, target)\n\t\tvirtualTargetChanges.appliedValuesByNodeId.set(\n\t\t\tvirtualNodeId,\n\t\t\tvirtualTargetChanges.appliedValuesByNodeId.get(virtualNodeId) ?? {},\n\t\t)\n\t}\n\n\tprivate async captureVirtualTarget(node: CanvasNode, target: RichTextTarget): Promise<void> {\n\t\tconst changes = this.requireTrackedNodeChanges(node.id)\n\t\tif (changes.virtualTargetChanges.has(target)) return\n\t\tchanges.virtualTargetChanges.set(target, {\n\t\t\tbaselineAttributeRoots: await serializeVirtualTargetAttributeTree(\n\t\t\t\tgetVirtualTargetSnapshot(target, this.ctx),\n\t\t\t\tthis.ctx,\n\t\t\t),\n\t\t\tappliedValuesByNodeId: new Map(),\n\t\t})\n\t}\n\n\tprivate async getSideEffectInsertedVirtualRoots(\n\t\tnode: CanvasNode,\n\t\tchanges: TrackedNodeAttributeChanges,\n\t\tcurrentRoots: readonly VirtualRichTextRoot[],\n\t): Promise<readonly VirtualRichTextRoot[]> {\n\t\tconst sideEffectInsertedNodes: VirtualRichTextRoot[] = []\n\t\tif (!isRichTextNode(node) || currentRoots.length === 0) {\n\t\t\treturn sideEffectInsertedNodes\n\t\t}\n\n\t\tconst trackedVirtualTargetChanges = changes.virtualTargetChanges.get(node.id)\n\t\tconst trackedVirtualRoots = new Set(\n\t\t\t(trackedVirtualTargetChanges?.baselineAttributeRoots ?? emptyArray()).map(root => root.id),\n\t\t)\n\n\t\tfor (const root of currentRoots) {\n\t\t\tif (!trackedVirtualRoots.has(root.id)) {\n\t\t\t\tsideEffectInsertedNodes.push(root)\n\t\t\t}\n\t\t}\n\n\t\treturn sideEffectInsertedNodes\n\t}\n\n\tprivate requireTrackedNodeChanges(nodeId: NodeID): TrackedNodeAttributeChanges {\n\t\tconst changes = this.changesByNodeId.get(nodeId)\n\t\tassert(changes, `No tracked changes found for node ${nodeId}. This is a bug`)\n\t\treturn changes\n\t}\n\n\tprivate requireTrackedVirtualTargetChanges(nodeId: NodeID, target: RichTextTarget): TrackedVirtualTargetChanges {\n\t\tconst virtualTargetChanges = this.requireTrackedNodeChanges(nodeId).virtualTargetChanges.get(target)\n\t\tassert(\n\t\t\tvirtualTargetChanges,\n\t\t\t`No tracked virtual target changes found for ${target} on node ${nodeId}. This is a bug`,\n\t\t)\n\t\treturn virtualTargetChanges\n\t}\n\n\tprivate resolveRichTextTarget(target: RichTextTarget): CanvasNode {\n\t\tconst handle = resolveRichTextTargetHandle(target, this.ctx)\n\t\tassert(handle, `No rich text target handle found for ${target}`)\n\n\t\tconst ownerNode = this.ctx.treeResolver.get(handle.nodeId)\n\t\tassert(ownerNode, `No owner node found for rich text target ${target}`)\n\t\treturn ownerNode\n\t}\n}\n\nfunction coerceNullToUndefined<T>(value: T): T | undefined {\n\treturn value === nullString || value === null ? undefined : value\n}\n\nfunction createTrackedNodeChanges(baseline: SerializedAttributeValues): TrackedNodeAttributeChanges {\n\treturn {\n\t\tbaseline,\n\t\tappliedValuesByAttributePath: {},\n\t\tvirtualTargetChanges: new Map(),\n\t}\n}\n\nasync function serializeNodeAttributes(node: CanvasNode, ctx: AgentContext): Promise<SerializedAttributeValues> {\n\tconst attributesAndMetadata = await toAttributes(node, null, ctx, {\n\t\trichText: handle => serializeRichTextWithoutRehydration(handle, ctx),\n\t})\n\n\tcollectMetadata(ctx.treeStore.getDataTreeOrPartialTree(), node, attributesAndMetadata, {\n\t\tincludeRect: true,\n\t\tincludeMediaQueryRange: true,\n\t})\n\n\treturn flatten(attributesAndMetadata)\n}\n\nasync function getVirtualAttributesWithSideEffectChanges(\n\tchanges: TrackedVirtualTargetChanges,\n\tcurrentRoots: readonly VirtualRichTextRoot[],\n\tctx: AgentContext,\n): Promise<{ attributesByVirtualNodeId: VirtualNodeAttributeFilter; metrics: AttributeChangeDecisionMetrics }> {\n\tconst metrics: AttributeChangeDecisionMetrics = new Map()\n\tconst attributesByVirtualNodeId = new Map<string, Set<string>>()\n\t// Pending applied-ok values held back from the report. We only echo them when some\n\t// OTHER node in the same target had a side effect on the SAME attribute \u2014 i.e. the\n\t// agent's SET caused storage to shift around for that attribute. Otherwise the SET\n\t// landed cleanly and re-emitting it would be stutter.\n\tconst pendingAppliedOkByAttribute = new Map<string, Array<{ virtualNodeId: string; attribute: string }>>()\n\t// Attributes that had a side effect on any node in this target. Used by the per-attribute\n\t// fold below to decide whether to echo a pending applied-ok value.\n\tconst sideEffectAttributes = new Set<string>()\n\tconst currentAttributeRoots = await serializeVirtualTargetAttributeTree(currentRoots, ctx)\n\tconst baselineLocalByNodeId = getLocalAttributesByNodeId(changes.baselineAttributeRoots)\n\tconst currentLocalByNodeId = getLocalAttributesByNodeId(currentAttributeRoots)\n\tconst trackedNodeIds = new Set([\n\t\t...changes.appliedValuesByNodeId.keys(),\n\t\t...baselineLocalByNodeId.keys(),\n\t\t...currentLocalByNodeId.keys(),\n\t])\n\n\tfor (const virtualNodeId of trackedNodeIds) {\n\t\tconst appliedValuesByAttributePath = changes.appliedValuesByNodeId.get(virtualNodeId) ?? {}\n\t\tdelete appliedValuesByAttributePath[updateCommandNodeIdPath]\n\n\t\tconst attributesToReport = new Set<string>()\n\t\tattributesByVirtualNodeId.set(virtualNodeId, attributesToReport)\n\n\t\tconst isInserted = !baselineLocalByNodeId.has(virtualNodeId) && currentLocalByNodeId.has(virtualNodeId)\n\t\tconst baselineAttributes = baselineLocalByNodeId.get(virtualNodeId) ?? {}\n\t\tconst currentAttributes = currentLocalByNodeId.get(virtualNodeId) ?? {}\n\t\tconst paths = new Set([\n\t\t\t...Object.keys(baselineAttributes),\n\t\t\t...Object.keys(currentAttributes),\n\t\t\t...Object.keys(appliedValuesByAttributePath),\n\t\t])\n\n\t\tlet anyDifference = false\n\t\tfor (const attribute of paths) {\n\t\t\tconst path = `${virtualNodeId}/${attribute}`\n\t\t\tconst currentValue = currentAttributes[attribute]\n\t\t\tconst baselineValue = baselineAttributes[attribute]\n\t\t\tconst updateValue = appliedValuesByAttributePath[attribute]\n\t\t\tconst isAppliedDelete = isDeletedByUpdateCommand(currentValue, updateValue)\n\n\t\t\tif (isEqual(currentValue, baselineValue)) {\n\t\t\t\tmetrics.set(path, {\n\t\t\t\t\treason: \"unchanged\",\n\t\t\t\t\tbefore: baselineValue,\n\t\t\t\t\tafter: currentValue,\n\t\t\t\t\tupdate: undefined,\n\t\t\t\t})\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tanyDifference = true\n\n\t\t\tif (Object.hasOwn(appliedValuesByAttributePath, attribute) && isAppliedDelete) {\n\t\t\t\tmetrics.set(path, {\n\t\t\t\t\treason: \"updated_ok\",\n\t\t\t\t\tbefore: baselineValue,\n\t\t\t\t\tafter: currentValue,\n\t\t\t\t\tupdate: updateValue,\n\t\t\t\t})\n\t\t\t\tattributesToReport.add(attribute)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (Object.hasOwn(appliedValuesByAttributePath, attribute) && isEqual(currentValue, updateValue)) {\n\t\t\t\tmetrics.set(path, {\n\t\t\t\t\treason: \"updated_ok\",\n\t\t\t\t\tbefore: baselineValue,\n\t\t\t\t\tafter: currentValue,\n\t\t\t\t\tupdate: updateValue,\n\t\t\t\t})\n\t\t\t\tconst queue = pendingAppliedOkByAttribute.get(attribute) ?? []\n\t\t\t\tqueue.push({ virtualNodeId, attribute })\n\t\t\t\tpendingAppliedOkByAttribute.set(attribute, queue)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tmetrics.set(path, {\n\t\t\t\treason: \"side_effect\",\n\t\t\t\tbefore: baselineValue,\n\t\t\t\tafter: currentValue,\n\t\t\t\tupdate: undefined,\n\t\t\t})\n\t\t\tattributesToReport.add(attribute)\n\t\t\tsideEffectAttributes.add(attribute)\n\t\t}\n\n\t\t// For newly inserted nodes, or updated nodes with any change we will always include the text attribute as useful context\n\t\tif ((isInserted || anyDifference) && paths.has(virtualTextAttributePath)) {\n\t\t\tattributesToReport.add(virtualTextAttributePath)\n\t\t}\n\t}\n\n\t// Per-attribute fold: echo a pending applied-ok only when some virtual node in this\n\t// target reported a side effect on the same attribute. That's the case where the agent's\n\t// value got reshuffled by normalization and confirmation is load-bearing. A node can't\n\t// be both side-effect and applied-ok for the same attribute, so this is safe.\n\tfor (const [attribute, pendings] of pendingAppliedOkByAttribute) {\n\t\tif (!sideEffectAttributes.has(attribute)) continue\n\t\tfor (const { virtualNodeId } of pendings) {\n\t\t\tattributesByVirtualNodeId.get(virtualNodeId)?.add(attribute)\n\t\t}\n\t}\n\n\treturn { attributesByVirtualNodeId, metrics }\n}\n\nfunction getVirtualTargetSnapshot(target: RichTextTarget, ctx: AgentContext): readonly VirtualRichTextRoot[] {\n\tconst document = ctx.virtualText.getDocument(target)\n\tif (document) return structuredClone(document.children)\n\n\tconst handle = resolveRichTextTargetHandle(target, ctx)\n\tif (!handle) return []\n\n\treturn structuredClone(ctx.virtualText.hydrate(handle)?.children ?? [])\n}\n\nasync function serializeVirtualNodeAttributes(\n\tnode: VirtualRichTextNode,\n\tctx: AgentContext,\n): Promise<SerializedAttributeValues> {\n\tconst attributes = await toVirtualNodeAttributes(node, ctx, {\n\t\trichText: handle => serializeRichTextWithoutRehydration(handle, ctx),\n\t})\n\n\treturn flatten(attributes)\n}\n\nfunction serializeRichTextWithoutRehydration(handle: RichTextReaderHandle, ctx: AgentContext) {\n\tconst document = ctx.virtualText.getDocument(handle.target)\n\treturn serializeVirtualText(document?.children ?? [], ctx)\n}\n\nasync function serializeVirtualTargetAttributeTree(\n\troots: readonly VirtualRichTextRoot[],\n\tctx: AgentContext,\n): Promise<SerializedVirtualAttributeNode[]> {\n\treturn Promise.all(roots.map(root => serializeVirtualAttributeNode(root, ctx)))\n}\n\nasync function serializeVirtualAttributeNode(\n\tnode: VirtualRichTextNode,\n\tctx: AgentContext,\n): Promise<SerializedVirtualAttributeNode> {\n\tconst children = getVirtualRichTextChildren(node) ?? []\n\treturn {\n\t\tid: node.id,\n\t\tattributes: await serializeVirtualNodeAttributes(node, ctx),\n\t\tchildren: await Promise.all(children.map(child => serializeVirtualAttributeNode(child, ctx))),\n\t}\n}\n\nfunction getLocalAttributesByNodeId(\n\troots: readonly SerializedVirtualAttributeNode[],\n): Map<string, SerializedAttributeValues> {\n\tconst attributesByNodeId = new Map<string, SerializedAttributeValues>()\n\tfunction visit(node: SerializedVirtualAttributeNode): void {\n\t\tattributesByNodeId.set(node.id, node.attributes)\n\t\tfor (const child of node.children) visit(child)\n\t}\n\tfor (const root of roots) visit(root)\n\treturn attributesByNodeId\n}\n\nfunction isDeletedByUpdateCommand(currentValue: unknown, updateValue: unknown): boolean {\n\treturn currentValue === undefined && updateValue === \"null\"\n}\n\nfunction isVirtualAttributePath(path: string): boolean {\n\treturn path.includes(\"/\")\n}\n", "export type RenamedIds = {\n\tfrom: string /* LLM ID */\n\tto: string /* Canvas ID */\n}[]\n\nexport function formatRenamedIds(renamedIds: Map<string, string>): RenamedIds {\n\treturn Array.from(renamedIds, ([from, to]) => ({ from, to }))\n}\n", "import { assert } from \"library/utils/assert.ts\"\n\n/**\n * Turns this:\n *\n * ```ts\n * {\n *     \"foo\": \"a\",\n *     \"bar\": \"b\",\n *     \"baz\": \"b\",\n * }\n * ```\n *\n * Into this:\n *\n * ```ts\n * {\n *     \"a\": \"foo\",\n *     \"b\": \"baz\",\n * }\n * ```\n *\n * Make sure to use `as const` on the input, otherwise you won't get an inverted type. The type for\n * the above example will be this (note the union):\n *\n * ```ts\n * {\n *     \"a\": \"foo\";\n *     \"b\": \"bar\" | \"baz\";\n * }\n * ```\n */\nexport function invert<T extends Record<string, string>>(record: T): { [K in keyof T as T[K]]: K } {\n\tconst result: Record<string, string> = {}\n\tfor (const key of Object.keys(record)) {\n\t\tassert(record[key])\n\t\tresult[record[key]] = key\n\t}\n\n\treturn result as ReturnType<typeof invert<T>>\n}\n", "import { assertNever, getLogger, hasAnyDefinedProperty } from \"@framerjs/shared\"\nimport { getFillAndStopIds, parseFillFromMark } from \"document/models/CanvasTree/nodes/RichTextNode.ts\"\nimport { isRichTextTag } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport { isGradient } from \"document/models/Gradient.ts\"\nimport type { RichTextModuleAlignment, RichTextModuleWidth } from \"document/models/richText/RichTextDocument.ts\"\nimport type { Mark as PmMark, Node as ProseMirrorNode } from \"prosemirror-model\"\nimport { createEditorState, normalizeProseMirrorDoc } from \"prosemirror/editorState.ts\"\nimport { isBackgroundMaskMark } from \"prosemirror/schema/backgroundMask.ts\"\nimport { isBackgroundStylesMark, isEmptyBackgroundStyles } from \"prosemirror/schema/backgroundStyles.ts\"\nimport { isBlockquoteNode } from \"prosemirror/schema/blockquote.ts\"\nimport { type ImageNode, isImageNode } from \"prosemirror/schema/image.ts\"\nimport {\n\ttype FramerProseMirrorSchema,\n\tschemaSupportsBlockquotes,\n\tschemaSupportsEmbeds,\n\tschemaSupportsLinks,\n\tschemaSupportsMedia,\n\tschemaSupportsStyles,\n\tschemaSupportsTables,\n} from \"prosemirror/schema/index.ts\"\nimport { isInlineCodeMark } from \"prosemirror/schema/inlineCode.ts\"\nimport { isInlineStylesMark } from \"prosemirror/schema/inlineStyles.ts\"\nimport { isLinkMark } from \"prosemirror/schema/link.ts\"\nimport {\n\ttype BulletedListAttrs,\n\ttype BulletedListNode,\n\ttype ListItemAttrs,\n\ttype ListItemNode,\n\ttype NumberedListAttrs,\n\ttype NumberedListNode,\n\tisBulletedListNode,\n\tisListItemNode,\n\tisNumberedListNode,\n} from \"prosemirror/schema/list.ts\"\nimport { isModuleNode, ModuleAlignment, ModuleWidth } from \"prosemirror/schema/module.ts\"\nimport { MarkName, NodeName } from \"prosemirror/schema/names.ts\"\nimport { isTableCellNode, isTableHeaderNode, isTableNode, isTableRowNode } from \"prosemirror/schema/table.ts\"\nimport { isProseMirrorTextNode } from \"prosemirror/schema/text.ts\"\nimport { getDefaultTextBlockAttrs, type TextBlockAttrs, isTextBlockNode } from \"prosemirror/schema/textBlock.ts\"\nimport { serializeRichText } from \"prosemirror/serialization/dom.ts\"\nimport { invert } from \"utils/invert.ts\"\nimport { isNonNull, isNumber, isObject, isReadonlyArray, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { TextMediaBlockClass } from \"../../dsl.ts\"\nimport {\n\ttype RichTextDocument,\n\ttype VirtualRichTextMediaBlock,\n\ttype VirtualRichTextNode,\n\ttype VirtualRichTextRoot,\n\ttype RichTextTarget,\n\ttype VirtualRichTextList,\n\ttype VirtualRichTextListItem,\n\ttype VirtualRichTextTable,\n\ttype VirtualRichTextTableCell,\n\ttype VirtualRichTextTableCellPreservedAttrs,\n\ttype VirtualRichTextTableRow,\n\ttype VirtualRichTextTextBlock,\n\ttype VirtualRichTextTextRun,\n\ttype WithVirtualTextBlockStyles,\n\ttype WithVirtualTextStyles,\n\tcreateMediaBlock,\n\tcreateRichTextBlockquote,\n\tcreateRichTextBulletList,\n\tcreateRichTextLineBreak,\n\tcreateRichTextListItem,\n\tcreateRichTextNumberedList,\n\tcreateRichTextTable,\n\tcreateRichTextTableCell,\n\tcreateRichTextTableRow,\n\tcreateRichTextTextComponentInstance,\n\tcreateRichTextTextBlock,\n\tcreateRichTextTextRun,\n\tcreateRichTextUnsupported,\n\tcreateRichTextDocument,\n\tcreateVirtualNodeId,\n\tisVirtualRichTextLineBreak,\n\tisVirtualRichTextTextRun,\n} from \"./document.ts\"\nimport { normalizeRichTextDocumentStyles, resolveRunMarks, resolveScopeAttrs } from \"./styleInheritance.ts\"\n\ntype StyleAncestor = RichTextDocument | VirtualRichTextNode\n\nconst log = getLogger(\"ai:agents:virtualText:prosemirror\")\n\ninterface ParsedRichTextDocument {\n\tdocument: RichTextDocument\n}\n\ninterface RichTextSerializationOptions {\n\tinlineCodeStylePreset?: string\n}\n\nconst richTextWidthToModuleWidth: Record<RichTextModuleWidth, ModuleWidth> = {\n\tfill: ModuleWidth.Fill,\n\tfit: ModuleWidth.Fit,\n} as const\n\nconst richTextAlignmentToModuleAlignment: Record<RichTextModuleAlignment, ModuleAlignment> = {\n\tleft: ModuleAlignment.Left,\n\tcenter: ModuleAlignment.Center,\n\tright: ModuleAlignment.Right,\n} as const\n\nconst moduleWidthToRichTextWidth = invert(richTextWidthToModuleWidth)\nconst moduleAlignmentToRichTextAlignment = invert(richTextAlignmentToModuleAlignment)\n\n/**\n * Parses HTML into a rich text document tree via ProseMirror.\n *\n * This is a pure parsing step \u2014 it produces a tree of RichTextRoot nodes\n * but does not index them. The editor constructor handles indexing.\n *\n */\nexport function parseHTMLToRichTextDocument(\n\thtml: string,\n\tschema: FramerProseMirrorSchema,\n\ttarget: RichTextTarget,\n): RichTextDocument {\n\tconst state = createEditorState(html, schema)\n\tconst document = createRichTextDocument()\n\n\tif (html.length === 0) return document\n\n\tdocument.children = parseBlocks(state.doc, target, document)\n\tnormalizeRichTextDocumentStyles(document)\n\n\treturn document\n}\n\nexport function serializeRichTextDocumentToHTML(\n\tdocument: RichTextDocument,\n\tschema: FramerProseMirrorSchema,\n\toptions: RichTextSerializationOptions = {},\n): string {\n\tconst proseMirrorBlocks: ProseMirrorNode[] = []\n\tfor (const block of document.children) {\n\t\tconst proseMirrorBlock = buildProseMirrorRoot(block, schema, options, [document], document)\n\t\tif (!proseMirrorBlock) continue\n\t\tproseMirrorBlocks.push(proseMirrorBlock)\n\t}\n\n\tif (proseMirrorBlocks.length === 0) return \"\"\n\n\tconst doc = schema.topNodeType.createChecked(undefined, proseMirrorBlocks)\n\tconst normalizedDoc = normalizeProseMirrorDoc(doc, schema)\n\treturn serializeRichText(normalizedDoc, schema)\n}\n\nfunction parseBlocks(doc: ProseMirrorNode, target: RichTextTarget, document: RichTextDocument): VirtualRichTextRoot[] {\n\tconst blocks: VirtualRichTextRoot[] = []\n\n\tdoc.forEach((blockNode, _blockOffset, blockIndex) => {\n\t\tconst parsed = parseRootNode(blockNode, target, document, [blockIndex])\n\t\tblocks.push(parsed.root)\n\t})\n\n\treturn blocks\n}\n\nfunction parseRootNode(\n\tblockNode: ProseMirrorNode,\n\ttarget: RichTextTarget,\n\tdocument: RichTextDocument,\n\tpath: readonly number[],\n): { root: VirtualRichTextRoot; textBlocks: VirtualRichTextTextBlock[] } {\n\tconst blockId = createVirtualNodeId(target, ...path)\n\n\tif (isImageNode(blockNode)) {\n\t\tif (blockNode.attrs.type !== \"image\") {\n\t\t\treturn {\n\t\t\t\troot: createUnsupportedRichTextBlock(blockId, blockNode),\n\t\t\t\ttextBlocks: [],\n\t\t\t}\n\t\t}\n\n\t\tconst mediaBlock = createMediaBlock(blockId)\n\t\tmediaBlock.mediaType = blockNode.attrs.type\n\t\tmediaBlock.src = blockNode.attrs.src\n\t\tmediaBlock.alt = blockNode.attrs.alt\n\t\tmediaBlock.pixelWidth = blockNode.attrs.pixelWidth\n\t\tmediaBlock.pixelHeight = blockNode.attrs.pixelHeight\n\t\tmediaBlock.linkAttrs = extractMediaLinkAttrs(blockNode)\n\t\treturn { root: mediaBlock, textBlocks: [] }\n\t}\n\n\tif (isBulletedListNode(blockNode)) {\n\t\treturn parseListNode(createRichTextBulletList(blockId), blockNode, target, document, path)\n\t}\n\n\tif (isNumberedListNode(blockNode)) {\n\t\tconst list = createRichTextNumberedList(blockId)\n\t\tlist.listStyleType = isString(blockNode.attrs.listStyleType) ? blockNode.attrs.listStyleType : \"decimal\"\n\t\tlist.start = Number.isFinite(blockNode.attrs.start) ? blockNode.attrs.start : 1\n\t\treturn parseListNode(list, blockNode, target, document, path)\n\t}\n\n\tif (isBlockquoteNode(blockNode)) {\n\t\treturn parseBlockquoteNode(blockNode, target, document, path)\n\t}\n\n\tif (isTableNode(blockNode)) {\n\t\treturn parseTableNode(blockNode, target, document, path)\n\t}\n\n\tif (isModuleNode(blockNode)) {\n\t\tconst componentInstance = createRichTextTextComponentInstance(\n\t\t\tblockId,\n\t\t\tblockNode.attrs.identifier,\n\t\t\tblockNode.attrs.props ?? {},\n\t\t)\n\t\tcomponentInstance.width = moduleWidthToRichTextWidth[blockNode.attrs.width ?? \"fill\"]\n\t\tcomponentInstance.alignment = moduleAlignmentToRichTextAlignment[blockNode.attrs.alignment ?? \"left\"]\n\t\treturn { root: componentInstance, textBlocks: [] }\n\t}\n\n\tif (!isTextBlockNode(blockNode) || !canHydrateTextBlock(blockNode)) {\n\t\treturn {\n\t\t\troot: createUnsupportedRichTextBlock(blockId, blockNode),\n\t\t\ttextBlocks: [],\n\t\t}\n\t}\n\n\tconst tag = isRichTextTag(blockNode.attrs.tag) ? blockNode.attrs.tag : undefined\n\tconst block = createRichTextTextBlock(blockId, tag)\n\tblock.blockStyles = { ...blockNode.attrs.blockStyles }\n\tblock.inlineStyles = { ...blockNode.attrs.inlineStyles }\n\tblock.textStylePreset = isString(blockNode.attrs.textStylePreset) ? blockNode.attrs.textStylePreset : undefined\n\n\tlet childIndex = 0\n\tblockNode.forEach(inline => {\n\t\tif (inline.type.name === NodeName.LineBreak) {\n\t\t\tblock.children.push(createRichTextLineBreak(createVirtualNodeId(target, ...path, childIndex)))\n\t\t\tchildIndex++\n\t\t\treturn\n\t\t}\n\n\t\tif (!inline.isText) return\n\n\t\tconst run = createRichTextTextRun(createVirtualNodeId(target, ...path, childIndex))\n\t\tblock.children.push(run)\n\t\trun.text = inline.text ?? \"\"\n\t\tchildIndex++\n\n\t\tfor (const mark of inline.marks) {\n\t\t\tif (isInlineStylesMark(mark)) {\n\t\t\t\tObject.assign(run.inlineStyles, mark.attrs.inlineStyles)\n\t\t\t}\n\n\t\t\tif (isBackgroundStylesMark(mark)) {\n\t\t\t\tObject.assign(run.backgroundStyles, mark.attrs.backgroundStyles)\n\t\t\t}\n\n\t\t\tif (isBackgroundMaskMark(mark)) {\n\t\t\t\tconst gradient = parseFillFromMark(mark.attrs)\n\t\t\t\tif (isGradient(gradient)) {\n\t\t\t\t\tdocument.backgroundMask = gradient\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (isLinkMark(mark)) {\n\t\t\t\trun.linkAttrs = mark.attrs\n\t\t\t}\n\n\t\t\tif (mark.type.name === MarkName.Bold) run.bold = true\n\t\t\tif (mark.type.name === MarkName.Italic) run.italic = true\n\n\t\t\tif (isInlineCodeMark(mark)) {\n\t\t\t\tif (mark.type.name === MarkName.InlineCode) {\n\t\t\t\t\trun.inlineCode = true\n\t\t\t\t\tif (isString(mark.attrs.inlineCodeStylePreset)) {\n\t\t\t\t\t\trun.inlineCodeStylePreset = mark.attrs.inlineCodeStylePreset\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n\n\t// Framer serializes empty paragraphs as `<p><br class=\"trailing-break\"></p>`.\n\t// A synthetic RichTextLineBreak preserves this representation in the virtual tree.\n\tif (block.children.length === 0) {\n\t\tblock.children.push(createRichTextLineBreak(createVirtualNodeId(target, ...path, 0)))\n\t}\n\n\treturn { root: block, textBlocks: [block] }\n}\n\nfunction parseListNode(\n\tlist: VirtualRichTextList,\n\tblockNode: BulletedListNode | NumberedListNode,\n\ttarget: RichTextTarget,\n\tdocument: RichTextDocument,\n\tpath: readonly number[],\n): { root: VirtualRichTextList; textBlocks: VirtualRichTextTextBlock[] } {\n\tapplyStyledBlockAttributes(list, blockNode.attrs)\n\n\tconst textBlocks: VirtualRichTextTextBlock[] = []\n\tblockNode.forEach((childNode, _childOffset, childIndex) => {\n\t\tif (!isListItemNode(childNode)) {\n\t\t\tlist.children.push(createRichTextListItem(createVirtualNodeId(target, ...path, childIndex)))\n\t\t\treturn\n\t\t}\n\n\t\tconst parsedItem = parseListItemNode(childNode, target, document, [...path, childIndex])\n\t\tlist.children.push(parsedItem.item)\n\t\ttextBlocks.push(...parsedItem.textBlocks)\n\t})\n\n\treturn { root: list, textBlocks }\n}\n\nfunction parseBlockquoteNode(\n\tblockNode: ProseMirrorNode,\n\ttarget: RichTextTarget,\n\tdocument: RichTextDocument,\n\tpath: readonly number[],\n): { root: VirtualRichTextRoot; textBlocks: VirtualRichTextTextBlock[] } {\n\tconst blockquote = createRichTextBlockquote(createVirtualNodeId(target, ...path))\n\tconst textBlocks: VirtualRichTextTextBlock[] = []\n\n\tblockNode.forEach((childNode, _childOffset, childIndex) => {\n\t\tconst parsedRoot = parseRootNode(childNode, target, document, [...path, childIndex])\n\t\tblockquote.children.push(parsedRoot.root)\n\t\ttextBlocks.push(...parsedRoot.textBlocks)\n\t})\n\n\treturn { root: blockquote, textBlocks }\n}\n\nfunction parseTableNode(\n\ttableNode: ProseMirrorNode,\n\ttarget: RichTextTarget,\n\tdocument: RichTextDocument,\n\tpath: readonly number[],\n): { root: VirtualRichTextTable; textBlocks: VirtualRichTextTextBlock[] } {\n\tconst table = createRichTextTable(createVirtualNodeId(target, ...path))\n\tconst textBlocks: VirtualRichTextTextBlock[] = []\n\n\ttableNode.forEach((rowNode, _rowOffset, rowIndex) => {\n\t\tif (!isTableRowNode(rowNode)) return\n\n\t\tconst parsedRow = parseTableRowNode(rowNode, target, document, [...path, rowIndex])\n\t\ttable.children.push(parsedRow.row)\n\t\ttextBlocks.push(...parsedRow.textBlocks)\n\t})\n\n\treturn { root: table, textBlocks }\n}\n\nfunction parseTableRowNode(\n\trowNode: ProseMirrorNode,\n\ttarget: RichTextTarget,\n\tdocument: RichTextDocument,\n\tpath: readonly number[],\n): { row: VirtualRichTextTableRow; textBlocks: VirtualRichTextTextBlock[] } {\n\tconst row = createRichTextTableRow(createVirtualNodeId(target, ...path))\n\tconst textBlocks: VirtualRichTextTextBlock[] = []\n\n\trowNode.forEach((cellNode, _cellOffset, cellIndex) => {\n\t\tif (!isTableCellNode(cellNode) && !isTableHeaderNode(cellNode)) return\n\n\t\tconst parsedCell = parseTableCellNode(cellNode, target, document, [...path, cellIndex])\n\t\trow.children.push(parsedCell.cell)\n\t\ttextBlocks.push(...parsedCell.textBlocks)\n\t})\n\n\treturn { row, textBlocks }\n}\n\nfunction parseTableCellNode(\n\tcellNode: ProseMirrorNode,\n\ttarget: RichTextTarget,\n\tdocument: RichTextDocument,\n\tpath: readonly number[],\n): { cell: VirtualRichTextTableCell; textBlocks: VirtualRichTextTextBlock[] } {\n\tconst cell = createRichTextTableCell(\n\t\tcreateVirtualNodeId(target, ...path),\n\t\tisTableHeaderNode(cellNode) ? \"header\" : \"cell\",\n\t)\n\n\tcell.preservedAttrs = parseTableCellPreservedAttrs(cellNode.attrs)\n\n\tconst textBlocks: VirtualRichTextTextBlock[] = []\n\tcellNode.forEach((childNode, _childOffset, childIndex) => {\n\t\tconst parsedRoot = parseRootNode(childNode, target, document, [...path, childIndex])\n\t\tcell.children.push(parsedRoot.root)\n\t\ttextBlocks.push(...parsedRoot.textBlocks)\n\t})\n\n\treturn { cell, textBlocks }\n}\n\nfunction parseTableCellPreservedAttrs(\n\tattrs: ProseMirrorNode[\"attrs\"],\n): VirtualRichTextTableCellPreservedAttrs | undefined {\n\tif (!isObject(attrs)) return\n\n\tconst preservedAttrs: VirtualRichTextTableCellPreservedAttrs = {}\n\n\tif (isNumber(attrs.colspan)) preservedAttrs.colspan = attrs.colspan\n\tif (isNumber(attrs.rowspan)) preservedAttrs.rowspan = attrs.rowspan\n\n\tconst colwidth = attrs.colwidth\n\tif (colwidth === null || (isReadonlyArray(colwidth) && colwidth.every(isNumber))) {\n\t\tpreservedAttrs.colwidth = colwidth\n\t}\n\n\treturn Object.values(preservedAttrs).some(value => !isUndefined(value)) ? preservedAttrs : undefined\n}\n\nfunction parseListItemNode(\n\tlistItemNode: ListItemNode,\n\ttarget: RichTextTarget,\n\tdocument: RichTextDocument,\n\tpath: readonly number[],\n): { item: VirtualRichTextListItem; textBlocks: VirtualRichTextTextBlock[] } {\n\tconst item = createRichTextListItem(createVirtualNodeId(target, ...path))\n\tapplyStyledBlockAttributes(item, listItemNode.attrs)\n\n\tconst textBlocks: VirtualRichTextTextBlock[] = []\n\tlistItemNode.forEach((childNode, _childOffset, childIndex) => {\n\t\tconst parsedRoot = parseRootNode(childNode, target, document, [...path, childIndex])\n\t\titem.children.push(parsedRoot.root)\n\t\ttextBlocks.push(...parsedRoot.textBlocks)\n\t})\n\n\treturn { item, textBlocks }\n}\n\nfunction applyStyledBlockAttributes(\n\tnode: WithVirtualTextStyles & WithVirtualTextBlockStyles,\n\tattrs: TextBlockAttrs | BulletedListAttrs | NumberedListAttrs | ListItemAttrs,\n): void {\n\tnode.blockStyles = { ...attrs.blockStyles }\n\tnode.inlineStyles = { ...attrs.inlineStyles }\n\tnode.textStylePreset = isString(attrs.textStylePreset) ? attrs.textStylePreset : undefined\n}\nfunction createUnsupportedRichTextBlock(id: string, blockNode: ProseMirrorNode) {\n\tconst nodeType =\n\t\tisImageNode(blockNode) && blockNode.attrs.type === \"video\" ? TextMediaBlockClass : blockNode.type.name\n\treturn createRichTextUnsupported(id, nodeType, blockNode.toJSON(), getUnsupportedRichTextReason(blockNode))\n}\n\nfunction getUnsupportedRichTextReason(blockNode: ProseMirrorNode): string {\n\tif (isImageNode(blockNode) && blockNode.attrs.type === \"video\") {\n\t\treturn \"This TextMediaBlock is preserved but cannot be edited yet because it contains video media.\"\n\t}\n\n\tif (isTextBlockNode(blockNode)) {\n\t\treturn \"This rich text block contains content or formatting that cannot be edited yet.\"\n\t}\n\n\treturn \"This rich text block type is preserved but cannot be edited yet.\"\n}\n\nfunction canHydrateTextBlock(blockNode: ProseMirrorNode): boolean {\n\tlet isSupported = true\n\n\tblockNode.forEach(inline => {\n\t\tif (!isSupported) return\n\t\tif (inline.type.name === NodeName.LineBreak) return\n\t\tif (!isProseMirrorTextNode(inline)) {\n\t\t\tisSupported = false\n\t\t\treturn\n\t\t}\n\n\t\tfor (const mark of inline.marks) {\n\t\t\tif (!isSupportedTextMark(mark)) {\n\t\t\t\tisSupported = false\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t})\n\n\treturn isSupported\n}\n\nfunction isSupportedTextMark(mark: PmMark): boolean {\n\treturn (\n\t\tisInlineStylesMark(mark) ||\n\t\tisBackgroundStylesMark(mark) ||\n\t\tisBackgroundMaskMark(mark) ||\n\t\tisLinkMark(mark) ||\n\t\tmark.type.name === MarkName.Bold ||\n\t\tmark.type.name === MarkName.Italic ||\n\t\tmark.type.name === MarkName.InlineCode\n\t)\n}\n\nfunction buildProseMirrorRoot(\n\troot: VirtualRichTextRoot,\n\tschema: FramerProseMirrorSchema,\n\toptions?: RichTextSerializationOptions,\n\tancestors: readonly StyleAncestor[] = [],\n\tdocument?: RichTextDocument,\n): ProseMirrorNode | null {\n\tswitch (root.type) {\n\t\tcase \"unsupported\":\n\t\t\treturn schema.nodeFromJSON(root.nodeJson)\n\t\tcase \"blockquote\": {\n\t\t\tif (!schemaSupportsBlockquotes(schema)) return null\n\n\t\t\tconst content = root.children\n\t\t\t\t.map(child => buildProseMirrorRoot(child, schema, options, ancestors, document))\n\t\t\t\t.filter(isNonNull)\n\t\t\tif (content.length === 0) return null\n\n\t\t\treturn schema.nodes[NodeName.Blockquote].create(undefined, content)\n\t\t}\n\t\tcase \"table\": {\n\t\t\tif (!schemaSupportsTables(schema)) return null\n\n\t\t\tconst rows = root.children\n\t\t\t\t.map(row => buildProseMirrorTableRow(row, schema, options, ancestors, document))\n\t\t\t\t.filter(isNonNull)\n\t\t\tif (rows.length === 0) return null\n\n\t\t\treturn schema.nodes[NodeName.Table].create(undefined, rows)\n\t\t}\n\t\tcase \"componentInstance\": {\n\t\t\tif (!schemaSupportsEmbeds(schema)) return null\n\n\t\t\treturn schema.nodes[NodeName.Module].create({\n\t\t\t\tidentifier: root.identifier,\n\t\t\t\tprops: root.props,\n\t\t\t\twidth: richTextWidthToModuleWidth[root.width],\n\t\t\t\talignment: richTextAlignmentToModuleAlignment[root.alignment],\n\t\t\t})\n\t\t}\n\t\tcase \"mediaBlock\": {\n\t\t\tif (root.src.trim() === \"\") return null\n\t\t\tif (!schemaSupportsMedia(schema)) return null\n\n\t\t\tlog.debug(\"building prose mirror media block\", { root })\n\n\t\t\treturn schema.nodes[NodeName.Image].create({\n\t\t\t\tsrc: root.src,\n\t\t\t\talt: root.alt,\n\t\t\t\tpixelWidth: root.pixelWidth,\n\t\t\t\tpixelHeight: root.pixelHeight,\n\t\t\t\ttype: root.mediaType,\n\t\t\t\t...root.linkAttrs,\n\t\t\t})\n\t\t}\n\t\tcase \"textBlock\":\n\t\t\treturn buildProseMirrorTextBlock(root, schema, options, ancestors, document)\n\t\tcase \"bulletList\": {\n\t\t\tconst listAttrs = resolveScopeAttrs(ancestors, root)\n\t\t\tconst content = root.children\n\t\t\t\t.map(child => buildProseMirrorListItem(child, schema, options, [...ancestors, root], document))\n\t\t\t\t.filter(isNonNull)\n\t\t\tif (content.length === 0) return null\n\n\t\t\treturn schema.nodes[NodeName.BulletedList].create(\n\t\t\t\t{\n\t\t\t\t\ttextDirection: \"auto\",\n\t\t\t\t\tinlineStyles: listAttrs.inlineStyles,\n\t\t\t\t\tblockStyles: listAttrs.blockStyles,\n\t\t\t\t\ttextStylePreset: listAttrs.textStylePreset,\n\t\t\t\t},\n\t\t\t\tcontent,\n\t\t\t)\n\t\t}\n\t\tcase \"numberedList\": {\n\t\t\tconst listAttrs = resolveScopeAttrs(ancestors, root)\n\t\t\tconst content = root.children\n\t\t\t\t.map(child => buildProseMirrorListItem(child, schema, options, [...ancestors, root], document))\n\t\t\t\t.filter(isNonNull)\n\t\t\tif (content.length === 0) return null\n\n\t\t\treturn schema.nodes[NodeName.NumberedList].create(\n\t\t\t\t{\n\t\t\t\t\ttextDirection: \"auto\",\n\t\t\t\t\tinlineStyles: listAttrs.inlineStyles,\n\t\t\t\t\tblockStyles: listAttrs.blockStyles,\n\t\t\t\t\ttextStylePreset: listAttrs.textStylePreset,\n\t\t\t\t\tlistStyleType: root.listStyleType,\n\t\t\t\t\tstart: root.start,\n\t\t\t\t},\n\t\t\t\tcontent,\n\t\t\t)\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(root)\n\t}\n}\n\nfunction buildProseMirrorTableRow(\n\trow: VirtualRichTextTableRow,\n\tschema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithTables,\n\toptions?: RichTextSerializationOptions,\n\tancestors: readonly StyleAncestor[] = [],\n\tdocument?: RichTextDocument,\n): ProseMirrorNode | null {\n\tconst cells = row.children.map(cell => buildProseMirrorTableCell(cell, schema, options, ancestors, document))\n\tif (cells.length === 0) return null\n\treturn schema.nodes[NodeName.TableRow].create(undefined, cells)\n}\n\nfunction buildProseMirrorTableCell(\n\tcell: VirtualRichTextTableCell,\n\tschema: FramerProseMirrorSchema & FramerProseMirrorSchema.WithTables,\n\toptions?: RichTextSerializationOptions,\n\tancestors: readonly StyleAncestor[] = [],\n\tdocument?: RichTextDocument,\n): ProseMirrorNode {\n\tconst content = cell.children\n\t\t.map(child => buildProseMirrorRoot(child, schema, options, ancestors, document))\n\t\t.filter(isNonNull)\n\tconst safeContent =\n\t\tcontent.length > 0 ? content : [schema.nodes[NodeName.TextBlock].create(getDefaultTextBlockAttrs())]\n\tconst nodeName = cell.cellType === \"header\" ? NodeName.TableHeader : NodeName.TableCell\n\treturn schema.nodes[nodeName].create(cell.preservedAttrs, safeContent)\n}\n\nfunction buildProseMirrorTextBlock(\n\tblock: VirtualRichTextTextBlock,\n\tschema: FramerProseMirrorSchema,\n\toptions?: RichTextSerializationOptions,\n\tancestors: readonly StyleAncestor[] = [],\n\tdocument?: RichTextDocument,\n): ProseMirrorNode {\n\tlog.debug(\"building prose mirror block\", { block, options })\n\tconst blockAttrs = resolveScopeAttrs(ancestors, block)\n\tconst runAncestors = [...ancestors, block]\n\tconst hasTextRuns = block.children.some(child => isVirtualRichTextTextRun(child) && child.text !== \"\")\n\tconst content = block.children.flatMap(child => {\n\t\tif (isVirtualRichTextLineBreak(child)) {\n\t\t\tif (!hasTextRuns) return []\n\n\t\t\treturn schema.nodes[NodeName.LineBreak].create()\n\t\t}\n\n\t\tif (child.text === \"\") return []\n\n\t\treturn buildProseMirrorTextNode(child, schema, options, runAncestors, document)\n\t})\n\n\treturn schema.nodes[NodeName.TextBlock].create(\n\t\t{\n\t\t\ttag: block.tag,\n\t\t\ttextDirection: \"auto\",\n\t\t\tinlineStyles: blockAttrs.inlineStyles,\n\t\t\tblockStyles: blockAttrs.blockStyles,\n\t\t\ttextStylePreset: blockAttrs.textStylePreset,\n\t\t},\n\t\tcontent,\n\t)\n}\n\nfunction buildProseMirrorListItem(\n\titem: VirtualRichTextListItem,\n\tschema: FramerProseMirrorSchema,\n\toptions?: RichTextSerializationOptions,\n\tancestors: readonly StyleAncestor[] = [],\n\tdocument?: RichTextDocument,\n): ProseMirrorNode | null {\n\tconst itemAttrs = resolveScopeAttrs(ancestors, item)\n\tconst content = item.children\n\t\t.map(child => buildProseMirrorRoot(child, schema, options, [...ancestors, item], document))\n\t\t.filter(isNonNull)\n\tif (content.length === 0) return null\n\tif (content[0]?.type.name !== NodeName.TextBlock) {\n\t\tcontent.unshift(schema.nodes[NodeName.TextBlock].create(getDefaultTextBlockAttrs()))\n\t}\n\n\treturn schema.nodes[NodeName.ListItem].create(\n\t\t{\n\t\t\tinlineStyles: itemAttrs.inlineStyles,\n\t\t\tblockStyles: itemAttrs.blockStyles,\n\t\t\ttextStylePreset: itemAttrs.textStylePreset,\n\t\t},\n\t\tcontent,\n\t)\n}\n\nfunction buildProseMirrorTextNode(\n\trun: VirtualRichTextTextRun,\n\tschema: FramerProseMirrorSchema,\n\toptions?: RichTextSerializationOptions,\n\tancestors: readonly StyleAncestor[] = [],\n\tdocument?: RichTextDocument,\n): ProseMirrorNode {\n\tlog.debug(\"building prose mirror text node\", { run, options })\n\tconst marks: PmMark[] = []\n\tconst runMarks = resolveRunMarks(ancestors, run)\n\n\tif (hasAnyDefinedProperty(run.inlineStyles) && schemaSupportsStyles(schema)) {\n\t\tmarks.push(\n\t\t\tschema.marks[MarkName.InlineStyles].create({\n\t\t\t\tinlineStyles: run.inlineStyles,\n\t\t\t}),\n\t\t)\n\t}\n\n\tif (!isEmptyBackgroundStyles(runMarks.backgroundStyles) && schemaSupportsStyles(schema)) {\n\t\tmarks.push(\n\t\t\tschema.marks[MarkName.BackgroundStyles].create({\n\t\t\t\tbackgroundStyles: runMarks.backgroundStyles,\n\t\t\t}),\n\t\t)\n\t}\n\n\tconst backgroundMask = document?.backgroundMask\n\tif (isGradient(backgroundMask) && schemaSupportsStyles(schema)) {\n\t\tmarks.push(schema.marks[MarkName.BackgroundMask].create(getFillAndStopIds(backgroundMask)))\n\t}\n\n\tif (run.bold) {\n\t\tmarks.push(schema.marks[MarkName.Bold].create())\n\t}\n\tif (run.italic) {\n\t\tmarks.push(schema.marks[MarkName.Italic].create())\n\t}\n\tif (run.inlineCode) {\n\t\tmarks.push(\n\t\t\tschema.marks[MarkName.InlineCode].create({\n\t\t\t\tinlineCodeStylePreset: schemaSupportsStyles(schema)\n\t\t\t\t\t? (run.inlineCodeStylePreset ?? options?.inlineCodeStylePreset)\n\t\t\t\t\t: undefined,\n\t\t\t}),\n\t\t)\n\t}\n\n\tif (runMarks.linkAttrs && schemaSupportsLinks(schema)) {\n\t\tmarks.push(schema.marks[MarkName.Link].create(runMarks.linkAttrs))\n\t}\n\n\treturn schema.text(run.text, marks)\n}\n\nfunction extractMediaLinkAttrs(blockNode: ImageNode): VirtualRichTextMediaBlock[\"linkAttrs\"] {\n\tconst { link, openInNewTab, smoothScroll, clickTrackingId, relValues, preserveParams } = blockNode.attrs\n\tif (isUndefined(link)) return\n\n\treturn {\n\t\tlink,\n\t\topenInNewTab,\n\t\tsmoothScroll,\n\t\tclickTrackingId,\n\t\trelValues,\n\t\tpreserveParams,\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { randomID } from \"library/render/types/randomID.ts\"\nimport type { FramerProseMirrorSchema } from \"prosemirror/schema/index.ts\"\nimport { isNumber, isUndefined } from \"utils/typeChecks.ts\"\nimport {\n\ttype RichTextDocument,\n\ttype VirtualRichTextNode,\n\ttype VirtualRichTextRoot,\n\ttype RichTextTarget,\n\tcreateRichTextDocument,\n\tisVirtualRichTextUnsupported,\n} from \"./document.ts\"\nimport { serializeRichTextDocumentToHTML } from \"./prosemirror.ts\"\nimport { getVirtualRichTextChildren } from \"./traversal.ts\"\n\ninterface IndexEntry {\n\t/** The parent node's ID, or undefined for root-level blocks. */\n\tparentId: string | undefined\n\tnode: VirtualRichTextNode\n}\n\ninterface RichTextDocumentEditorOptions {\n\ttarget: RichTextTarget\n\tdocument?: RichTextDocument\n\t/** Called when a node ID is registered in the index. */\n\tonNodeRegistered?: (id: string) => void\n\t/** Called when a node is removed from the index. */\n\tonNodeRemoved?: (node: VirtualRichTextNode) => void\n}\n\n/**\n * Manages the tree structure and index for a single rich text document.\n *\n * A pure indexed tree \u2014 owns the node index, serialization, and all structural\n * mutation operations. Has no knowledge of defaults, patches, or agent state.\n */\nexport class RichTextDocumentEditor {\n\treadonly target: RichTextTarget\n\tprivate nodeIndex = new Map<string, IndexEntry>()\n\treadonly document: RichTextDocument\n\n\tprivate readonly onNodeRegistered?: (id: string) => void\n\tprivate readonly onNodeRemoved?: (node: VirtualRichTextNode) => void\n\n\tconstructor(options: RichTextDocumentEditorOptions) {\n\t\tthis.target = options.target\n\t\tthis.onNodeRegistered = options.onNodeRegistered\n\t\tthis.onNodeRemoved = options.onNodeRemoved\n\t\tthis.document = options.document ?? createRichTextDocument()\n\n\t\tthis.indexBlocks(this.document.children)\n\t}\n\n\tget(id: string): VirtualRichTextNode | undefined {\n\t\treturn this.nodeIndex.get(id)?.node\n\t}\n\n\thas(id: string): boolean {\n\t\treturn this.nodeIndex.has(id)\n\t}\n\n\tparentOf(node: VirtualRichTextNode): VirtualRichTextNode | undefined {\n\t\tconst entry = this.nodeIndex.get(node.id)\n\t\tif (!entry?.parentId) return undefined\n\t\treturn this.nodeIndex.get(entry.parentId)?.node\n\t}\n\n\tgetTarget(node: VirtualRichTextNode): RichTextTarget {\n\t\tassert(this.nodeIndex.has(node.id), `Node \"${node.id}\" not present in document`)\n\t\treturn this.target\n\t}\n\n\t/** Insert a node into the tree. */\n\tinsert(node: VirtualRichTextNode, parentId: string | undefined, position?: number): void {\n\t\tassert(!this.nodeIndex.has(node.id), `ID \"${node.id}\" is already used`)\n\t\tconst siblings = this.getChildrenArray(parentId)\n\t\tconst to = normalizePosition(position, siblings.length)\n\t\tsiblings.splice(to, 0, node)\n\n\t\tthis.nodeIndex.set(node.id, { parentId, node })\n\t\tthis.onNodeRegistered?.(node.id)\n\t}\n\n\t/** Remove a node and all its descendants from the tree. */\n\tremove(id: string): void {\n\t\tconst entry = this.nodeIndex.get(id)\n\t\tif (!entry) return\n\n\t\tconst siblings = this.getChildrenArray(entry.parentId)\n\t\tconst idx = siblings.findIndex(n => n.id === id)\n\t\tif (idx === -1) return\n\n\t\tsiblings.splice(idx, 1)\n\t\tthis.unregisterSubtree(entry.node)\n\t}\n\n\t/** Move a node to a new parent/position. parentId=undefined means root level. */\n\tmove(id: string, parentId: string | undefined, position?: number): void {\n\t\tconst entry = this.nodeIndex.get(id)\n\t\tif (!entry) return\n\n\t\t// Validate both ends before mutating.\n\t\tconst oldSiblings = this.getChildrenArray(entry.parentId)\n\t\tconst from = oldSiblings.findIndex(n => n.id === id)\n\t\tif (from === -1) return\n\t\tconst newSiblings = this.getChildrenArray(parentId)\n\n\t\t// Remove from current location\n\t\toldSiblings.splice(from, 1)\n\n\t\t// Insert at new location\n\t\tconst to = normalizePosition(position, newSiblings.length)\n\t\tnewSiblings.splice(to, 0, entry.node)\n\n\t\t// Update index entry\n\t\tentry.parentId = parentId\n\t}\n\n\t/** Deep-duplicate a node. Assigns new IDs to all descendants. */\n\tduplicate(id: string, newId: string, parentId?: string, position?: number): VirtualRichTextNode | undefined {\n\t\tassert(!this.nodeIndex.has(newId), `ID \"${newId}\" is already used`)\n\t\tconst entry = this.nodeIndex.get(id)\n\t\tif (!entry) return\n\t\tassert(!isVirtualRichTextUnsupported(entry.node), `Cannot duplicate unsupported block \"${id}\"`)\n\n\t\tconst targetParentId = parentId ?? entry.parentId\n\t\tconst clone = structuredClone(entry.node)\n\t\tthis.reassignIds(clone, newId)\n\n\t\tconst siblings = this.getChildrenArray(targetParentId)\n\t\tconst to = normalizePosition(position, siblings.length)\n\t\tsiblings.splice(to, 0, clone)\n\n\t\tthis.registerSubtree(clone, targetParentId)\n\t\treturn clone\n\t}\n\n\t/**\n\t * Splice a node out of this editor's tree without invoking `onNodeRemoved`.\n\t *\n\t * Pair with `attachSubtree` on a destination editor: that call fires\n\t * `onNodeRegistered` for every descendant, which re-keys `targetsByVirtualNodeId`\n\t * to the destination target \u2014 so the cross-editor mapping ends up correct.\n\t *\n\t * Why we suppress `onNodeRemoved` here specifically: for a `TextComponentInstance`\n\t * it would call `removeNestedTargetsForOwnerIds`, tearing down nested rich-text\n\t * sub-target editors keyed by `<instanceId>/<controlKey>`. Those editors must\n\t * survive a MOVE so the instance's nested content rides along with it.\n\t */\n\tdetachSubtree(id: string): VirtualRichTextNode {\n\t\tconst entry = this.nodeIndex.get(id)\n\t\tassert(entry, `Node \"${id}\" not found in editor index`)\n\n\t\tconst siblings = this.getChildrenArray(entry.parentId)\n\t\tconst idx = siblings.findIndex(n => n.id === id)\n\t\tassert(idx !== -1, `Node \"${id}\" index not found in siblings`)\n\n\t\tsiblings.splice(idx, 1)\n\t\tthis.removeFromIndex(entry.node)\n\t\treturn entry.node\n\t}\n\n\t/**\n\t * Splice a previously-detached or freshly-cloned subtree into this editor at\n\t * (parentId, position). Re-registers every descendant via `registerSubtree`,\n\t * so `onNodeRegistered` fires and any external index (e.g. `targetsByVirtualNodeId`)\n\t * gets re-keyed to this editor's target.\n\t */\n\tattachSubtree(node: VirtualRichTextNode, parentId: string | undefined, position?: number): void {\n\t\tconst siblings = this.getChildrenArray(parentId)\n\t\tconst to = normalizePosition(position, siblings.length)\n\t\tsiblings.splice(to, 0, node)\n\t\tthis.registerSubtree(node, parentId)\n\t}\n\n\t/**\n\t * Deep-clone a subtree rooted at `id`, assign new ids (root = newId, descendants = random),\n\t * and return the clone without inserting it anywhere. Caller is responsible for attaching\n\t * the clone to a destination editor via `attachSubtree`.\n\t */\n\tcloneSubtreeForTransfer(id: string, newId: string): VirtualRichTextNode | undefined {\n\t\tconst entry = this.nodeIndex.get(id)\n\t\tif (!entry) return\n\t\tassert(!isVirtualRichTextUnsupported(entry.node), `Cannot duplicate unsupported block \"${id}\"`)\n\n\t\tconst clone = structuredClone(entry.node)\n\t\tthis.reassignIds(clone, newId)\n\t\treturn clone\n\t}\n\n\t/** Remove all nodes from the index and clear the blocks array. */\n\tclear(): void {\n\t\tfor (const block of this.document.children) {\n\t\t\tthis.unregisterSubtree(block)\n\t\t}\n\t\tthis.document.children.length = 0\n\t}\n\n\ttoHTML(schema: FramerProseMirrorSchema, inlineCodeStylePreset?: string): string {\n\t\treturn serializeRichTextDocumentToHTML(this.document, schema, { inlineCodeStylePreset })\n\t}\n\n\t/** Get the children array for a given parentId. undefined = document root. */\n\tprivate getChildrenArray(parentId: string | undefined): VirtualRichTextNode[] {\n\t\tif (isUndefined(parentId)) return this.document.children\n\n\t\tconst parentEntry = this.nodeIndex.get(parentId)\n\t\tassert(parentEntry, `Parent \"${parentId}\" not found`)\n\n\t\tconst children = getVirtualRichTextChildren(parentEntry.node)\n\t\tassert(children, `Parent \"${parentId}\" (${parentEntry.node.type}) does not accept children`)\n\n\t\treturn children\n\t}\n\n\tprivate unregisterSubtree(node: VirtualRichTextNode): void {\n\t\tthis.nodeIndex.delete(node.id)\n\t\tthis.onNodeRemoved?.(node)\n\n\t\tconst children = getVirtualRichTextChildren(node)\n\t\tif (children) {\n\t\t\tfor (const child of children) {\n\t\t\t\tthis.unregisterSubtree(child)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate removeFromIndex(node: VirtualRichTextNode): void {\n\t\tthis.nodeIndex.delete(node.id)\n\n\t\tconst children = getVirtualRichTextChildren(node)\n\t\tif (children) {\n\t\t\tfor (const child of children) {\n\t\t\t\tthis.removeFromIndex(child)\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate registerSubtree(node: VirtualRichTextNode, parentId: string | undefined): void {\n\t\tthis.nodeIndex.set(node.id, { parentId, node })\n\t\tthis.onNodeRegistered?.(node.id)\n\n\t\tconst children = getVirtualRichTextChildren(node)\n\t\tif (children) {\n\t\t\tfor (const child of children) {\n\t\t\t\tthis.registerSubtree(child, node.id)\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Walk a pre-built block tree and index every node. Called during construction. */\n\tprivate indexBlocks(blocks: VirtualRichTextRoot[]): void {\n\t\tfor (const block of blocks) {\n\t\t\tthis.registerSubtree(block, undefined)\n\t\t}\n\t}\n\n\t/** Reassign IDs on a cloned subtree. The root gets `newId`, descendants get random IDs. */\n\tprivate reassignIds(node: VirtualRichTextNode, newId: string): void {\n\t\tnode.id = newId\n\n\t\tconst children = getVirtualRichTextChildren(node)\n\t\tif (children) {\n\t\t\tfor (const child of children) {\n\t\t\t\tthis.reassignIds(child, randomID())\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction normalizePosition(position: number | undefined, maxExclusive: number): number {\n\tif (!isNumber(position) || position < 0 || position > maxExclusive) {\n\t\treturn maxExclusive\n\t}\n\treturn position\n}\n", "import { assert, getLogger } from \"@framerjs/shared\"\nimport { applyTypography } from \"app/ai/utils/typography.ts\"\nimport type { NodeID, RichTextNode as RichTextCanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport { isRichTextNode as isRichTextCanvasNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { randomID } from \"library/render/types/randomID.ts\"\nimport { isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { RejectedCommandError, RejectedCommandKind } from \"../../RejectedCommandError.ts\"\nimport type { AgentContext } from \"../AgentContext.ts\"\nimport {\n\ttype RichTextDocument,\n\ttype VirtualRichTextInline,\n\ttype RichTextReaderHandle,\n\ttype RichTextTarget,\n\ttype RichTextTargetHandle,\n\ttype VirtualTextDestination,\n\ttype VirtualRichTextTextBlock,\n\ttype VirtualRichTextNode,\n\tisVirtualRichTextTextBlock,\n\tisVirtualRichTextTextRun,\n\tcreateRichTextTextBlock,\n\tcreateRichTextTextRun,\n\tcreateRichTextLineBreak,\n\tisVirtualRichTextNode,\n\tisVirtualRichTextTextComponentInstance,\n\tparseVirtualNodeId,\n\tisVirtualNodeId,\n} from \"./document.ts\"\nimport { RichTextDocumentEditor } from \"./editor.ts\"\nimport { parseHTMLToRichTextDocument } from \"./prosemirror.ts\"\nimport { normalizeRichTextDocumentStyles } from \"./styleInheritance.ts\"\nimport { createRichTextNodeTargetHandle, parseRichTextTarget } from \"./targets.ts\"\nimport { walkVirtualRichText } from \"./traversal.ts\"\n\nconst log = getLogger(\"ai:agents:virtualText\")\nconst splitPatchTextLinesRegex = /\\n|\\\\n/u\n\nfunction resolveHandle(handleOrNode: RichTextReaderHandle | RichTextCanvasNode): RichTextReaderHandle {\n\treturn handleOrNode instanceof CanvasNode && isRichTextCanvasNode(handleOrNode)\n\t\t? createRichTextNodeTargetHandle(handleOrNode)\n\t\t: handleOrNode\n}\n\nexport class VirtualText {\n\tprivate editors = new Map<RichTextTarget, RichTextDocumentEditor>()\n\tprivate targetsByVirtualNodeId = new Map<string, RichTextTarget>()\n\tprivate hydratedTargets = new Set<RichTextTarget>()\n\tprivate virtualNodeIdByAlias = new Map<string, string>()\n\tprivate aliasByVirtualNodeId = new Map<string, string>()\n\tprivate dirtyTargets = new Set<RichTextTarget>()\n\n\tremove(id: string): void {\n\t\tconst resolvedId = this.resolveNodeAlias(id)\n\t\tthis.resolveEditorForBlock(resolvedId)?.remove(resolvedId)\n\t}\n\n\tmove(id: string, destination: VirtualTextDestination, position?: number): void {\n\t\tconst resolvedId = this.resolveNodeAlias(id)\n\t\tconst sourceEditor = this.requireEditorForBlock(resolvedId)\n\t\tconst destinationTarget = this.getTarget(destination)\n\t\tconst parentIdInDestination = isVirtualRichTextNode(destination) ? destination.id : undefined\n\n\t\tif (destinationTarget === sourceEditor.target) {\n\t\t\tsourceEditor.move(resolvedId, parentIdInDestination, position)\n\t\t\treturn\n\t\t}\n\n\t\tconst detached = sourceEditor.detachSubtree(resolvedId)\n\n\t\tconst destinationEditor = this.getOrCreateEditor(destinationTarget)\n\t\tdestinationEditor.attachSubtree(detached, parentIdInDestination, position)\n\t}\n\n\tduplicate(id: string, newId: string, destination?: VirtualTextDestination, position?: number): void {\n\t\tconst resolvedId = this.resolveNodeAlias(id)\n\t\tassert(!this.targetsByVirtualNodeId.has(newId), `ID \"${newId}\" is already used`)\n\t\tconst sourceEditor = this.requireEditorForBlock(resolvedId)\n\t\tif (!destination) {\n\t\t\tsourceEditor.duplicate(resolvedId, newId, undefined, position)\n\t\t\treturn\n\t\t}\n\n\t\tconst destinationTarget = this.getTarget(destination)\n\t\tconst parentIdInDestination = isVirtualRichTextNode(destination) ? destination.id : undefined\n\n\t\tif (destinationTarget === sourceEditor.target) {\n\t\t\tsourceEditor.duplicate(resolvedId, newId, parentIdInDestination, position)\n\t\t\treturn\n\t\t}\n\n\t\tconst clone = sourceEditor.cloneSubtreeForTransfer(resolvedId, newId)\n\t\tif (!clone) return\n\n\t\tconst destinationEditor = this.getOrCreateEditor(destinationTarget)\n\t\tdestinationEditor.attachSubtree(clone, parentIdInDestination, position)\n\t}\n\n\thas(id: string): boolean {\n\t\treturn this.targetsByVirtualNodeId.has(this.resolveNodeAlias(id))\n\t}\n\n\tget(id: string): VirtualRichTextNode | undefined {\n\t\tconst resolvedId = this.resolveNodeAlias(id)\n\t\treturn this.resolveEditorForBlock(resolvedId)?.get(resolvedId)\n\t}\n\n\tinsert(node: VirtualRichTextNode, destination: VirtualTextDestination, position?: number): void {\n\t\tassert(!this.targetsByVirtualNodeId.has(node.id), `ID \"${node.id}\" is already used`)\n\n\t\tif (isVirtualRichTextNode(destination)) {\n\t\t\tconst editor = this.requireEditorForBlock(destination.id)\n\t\t\teditor.insert(node, destination.id, position)\n\t\t\treturn\n\t\t}\n\n\t\tconst editor = this.getOrCreateEditor(destination)\n\t\teditor.insert(node, undefined, position)\n\t\treturn\n\t}\n\n\tgetParentBlock(childNode: VirtualRichTextInline): VirtualRichTextTextBlock | undefined {\n\t\tconst parent = this.resolveEditorForBlock(childNode.id)?.parentOf(childNode)\n\t\tif (parent && isVirtualRichTextTextBlock(parent)) return parent\n\t\treturn undefined\n\t}\n\n\t/**\n\t * Walks the virtual rich text ancestor chain from `node` upward (block \u2192 list item \u2192 list \u2192 ...)\n\t * and returns the first defined value the `read` callback produces, including the\n\t * `RichTextDocument` root (held separately from the parent index). `node` itself is skipped so\n\t * callers can still tell whether the run/block carries its own value.\n\t */\n\tfindInheritedValue<V>(\n\t\tnode: VirtualRichTextNode,\n\t\tread: (scope: VirtualRichTextNode | RichTextDocument) => V | undefined,\n\t): V | undefined {\n\t\tconst editor = this.resolveEditorForBlock(node.id)\n\t\tlet current = editor?.parentOf(node)\n\t\twhile (current) {\n\t\t\tconst value = read(current)\n\t\t\tif (value !== undefined) return value\n\t\t\tcurrent = editor?.parentOf(current)\n\t\t}\n\t\tconst document = editor?.document\n\t\treturn document ? read(document) : undefined\n\t}\n\n\tgetTarget(destination: VirtualTextDestination): RichTextTarget {\n\t\tif (isString(destination)) return destination\n\n\t\tconst editor = this.resolveEditorForBlock(destination.id)\n\t\tif (!editor) {\n\t\t\tthrow new RejectedCommandError(\n\t\t\t\tRejectedCommandKind.RichTextTargetNotFound,\n\t\t\t\t`Rich text target for virtual node ID \"${destination.id}\" not found`,\n\t\t\t)\n\t\t}\n\n\t\treturn editor.getTarget(destination)\n\t}\n\n\tgetTargetNodeId(node: VirtualRichTextNode): NodeID {\n\t\treturn parseRichTextTarget(this.getTarget(node)).nodeId\n\t}\n\tsafeGetTargetNodeId(node: VirtualRichTextNode): NodeID | undefined {\n\t\ttry {\n\t\t\treturn this.getTargetNodeId(node)\n\t\t} catch {\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\tgetDocument(target: RichTextTarget): RichTextDocument | undefined {\n\t\treturn this.editors.get(target)?.document\n\t}\n\n\tmaybeHydrateDocument(handleOrNode: RichTextReaderHandle | RichTextCanvasNode): RichTextDocument | undefined {\n\t\tconst handle = resolveHandle(handleOrNode)\n\t\tconst target = handle.target\n\t\tconst editor = this.editors.get(target)\n\t\tif (editor) return editor.document\n\n\t\treturn this.hydrate(handleOrNode)\n\t}\n\n\treplaceDocumentText(target: RichTextTarget, text: string, tag?: VirtualRichTextTextBlock[\"tag\"]): void {\n\t\tconst editor = this.getOrCreateEditor(target)\n\t\tconst document = editor.document\n\t\tif (tag) document.tag = tag\n\n\t\t// Derive a fallback tag from the existing text blocks before clearing, so that replacing\n\t\t// the root text of a hydrated heading (e.g. <h2>) does not silently downgrade it to <p>.\n\t\tconst blockTag = tag ?? document.tag ?? uniformTextBlockTag(document)\n\n\t\teditor.clear()\n\n\t\t// Split on real newline or escaped \\n so we can build runs + line breaks instead of literal \\n.\n\t\t// Apply typography per line so opening-quote detection sees correct line boundaries.\n\t\t// TODO: Add a typography mode (e.g. \"smart\" vs \"verbatim\") at RichTextNode/run level,\n\t\t// so code-like copyable content can opt out of quote/ellipsis rewriting.\n\t\tconst lines = text.split(splitPatchTextLinesRegex).map(line => applyTypography(line))\n\t\tconst block = createRichTextTextBlock(randomID(), blockTag)\n\t\teditor.insert(block, undefined, 0)\n\n\t\tfor (let i = 0; i < lines.length; i++) {\n\t\t\tconst run = createRichTextTextRun(randomID())\n\t\t\trun.text = lines[i] ?? \"\"\n\t\t\teditor.insert(run, block.id)\n\t\t\tif (i < lines.length - 1) {\n\t\t\t\teditor.insert(createRichTextLineBreak(randomID()), block.id)\n\t\t\t}\n\t\t}\n\t}\n\n\tresolve(id: string): VirtualRichTextNode | undefined {\n\t\t// LLM generated IDs for new nodes don't have to adhere to the virtual format.\n\t\tif (!isVirtualNodeId(id)) return this.get(id)\n\n\t\tconst resolvedId = this.resolveNodeAlias(id)\n\t\tif (this.targetsByVirtualNodeId.has(resolvedId)) return this.get(id)\n\n\t\t// When not registered, we parse the rich text target to let the LLM know which target to re-read.\n\t\tconst { richTextTarget } = parseVirtualNodeId(id)\n\t\tconst { nodeId } = parseRichTextTarget(richTextTarget)\n\n\t\tthrow new RejectedCommandError(\n\t\t\tRejectedCommandKind.RichTextTargetNotFound,\n\t\t\t`Virtual rich text node \"${id}\" was not found. Re-read owner node \"${nodeId}\" to get up-to-date virtual document.`,\n\t\t)\n\t}\n\n\tgetOrCreateNodeAlias(node: VirtualRichTextNode, prefix: string): string {\n\t\tif (!isVirtualNodeId(node.id)) return node.id\n\n\t\tconst existingAlias = this.aliasByVirtualNodeId.get(node.id)\n\t\tif (existingAlias) return existingAlias\n\n\t\tfor (let index = 1; ; index++) {\n\t\t\tconst alias = `${prefix}${index}`\n\t\t\tif (this.targetsByVirtualNodeId.has(alias)) continue\n\t\t\tif (this.virtualNodeIdByAlias.has(alias)) continue\n\n\t\t\tthis.virtualNodeIdByAlias.set(alias, node.id)\n\t\t\tthis.aliasByVirtualNodeId.set(node.id, alias)\n\t\t\treturn alias\n\t\t}\n\t}\n\n\thydrate(handleOrNode: RichTextReaderHandle | RichTextCanvasNode): RichTextDocument | undefined {\n\t\tconst handle = resolveHandle(handleOrNode)\n\n\t\tlog.debug(\"hydrating virtual text for target: \" + handle.target, { handle })\n\t\tthis.removeDocument(handle.target)\n\n\t\tconst html = handle.readHTML()\n\t\tif (isUndefined(html)) return\n\n\t\tconst target = handle.target\n\n\t\tconst editor = new RichTextDocumentEditor({\n\t\t\ttarget,\n\t\t\tdocument: parseHTMLToRichTextDocument(html, handle.schema, target),\n\t\t\tonNodeRegistered: id => this.registerVirtualNodeId(id, target),\n\t\t\tonNodeRemoved: node => this.unregisterVirtualNode(node),\n\t\t})\n\n\t\tthis.editors.set(target, editor)\n\t\tthis.hydratedTargets.add(target)\n\n\t\treturn editor.document\n\t}\n\n\tapply(handleOrNode: RichTextTargetHandle | RichTextCanvasNode): string | undefined {\n\t\tconst handle = this.resolveHandle(handleOrNode)\n\t\tlog.debug(\"applying virtual text for target: \" + handle.target, { handle })\n\t\tconst editor = this.editors.get(handle.target)\n\n\t\tif (!editor) return\n\n\t\t// Apply typography to all run text before serialization so behavior is consistent\n\t\t// whether text came from root replacement or direct RichTextTextRun edits.\n\t\tif (editor.document.children.length > 0) {\n\t\t\tthis.applyTypographyToBlocks(editor.document)\n\t\t}\n\n\t\tthis.dirtyTargets.add(handle.target)\n\t\tconst nextHTML = editor.toHTML(handle.schema, handle.inlineCodeStylePreset)\n\n\t\tlog.debug(\"applying new HTML to target\", { nextHTML })\n\n\t\tconst currentHTML = handle.readHTML()\n\t\tif (nextHTML !== currentHTML) {\n\t\t\thandle.writeHTML(nextHTML)\n\t\t}\n\n\t\treturn nextHTML\n\t}\n\n\tfinalize(): RichTextTarget[] {\n\t\tconst targets = Array.from(this.dirtyTargets)\n\t\tthis.dirtyTargets.clear()\n\n\t\tfor (const target of targets) {\n\t\t\tconst document = this.editors.get(target)?.document\n\t\t\tif (!document) continue\n\n\t\t\tnormalizeRichTextDocumentStyles(document)\n\t\t}\n\t\treturn targets\n\t}\n\n\tremoveDocument(target: RichTextTarget): void {\n\t\tconst editor = this.editors.get(target)\n\t\tif (editor) {\n\t\t\teditor.clear()\n\t\t\tthis.editors.delete(target)\n\t\t}\n\n\t\tthis.hydratedTargets.delete(target)\n\t\tthis.dirtyTargets.delete(target)\n\t}\n\n\tprivate resolveHandle(handleOrNode: RichTextTargetHandle | RichTextCanvasNode): RichTextTargetHandle {\n\t\treturn handleOrNode instanceof CanvasNode && isRichTextCanvasNode(handleOrNode)\n\t\t\t? createRichTextNodeTargetHandle(handleOrNode)\n\t\t\t: handleOrNode\n\t}\n\n\tprivate resolveEditorForBlock(blockId: string): RichTextDocumentEditor | undefined {\n\t\tconst target = this.targetsByVirtualNodeId.get(blockId)\n\t\tif (!target) return\n\n\t\treturn this.editors.get(target)\n\t}\n\n\tprivate requireEditorForBlock(blockId: string): RichTextDocumentEditor {\n\t\tconst editor = this.resolveEditorForBlock(blockId)\n\t\tassert(editor, `No editor found for RichText block with id \"${blockId}\"`)\n\t\treturn editor\n\t}\n\n\tprivate getOrCreateEditor(target: RichTextTarget): RichTextDocumentEditor {\n\t\tconst existing = this.editors.get(target)\n\t\tif (existing) return existing\n\n\t\treturn this.createEmptyEditor(target)\n\t}\n\n\tprivate createEmptyEditor(target: RichTextTarget) {\n\t\tconst editor = new RichTextDocumentEditor({\n\t\t\ttarget,\n\t\t\tonNodeRegistered: id => this.registerVirtualNodeId(id, target),\n\t\t\tonNodeRemoved: node => this.unregisterVirtualNode(node),\n\t\t})\n\t\tthis.editors.set(target, editor)\n\n\t\treturn editor\n\t}\n\n\tprivate registerVirtualNodeId(id: string, target: RichTextTarget): void {\n\t\tthis.targetsByVirtualNodeId.set(id, target)\n\t}\n\n\tprivate unregisterVirtualNode(node: VirtualRichTextNode): void {\n\t\tconst alias = this.aliasByVirtualNodeId.get(node.id)\n\n\t\tthis.unregisterVirtualNodeId(node.id)\n\t\tif (!isVirtualRichTextTextComponentInstance(node)) return\n\n\t\tconst ownerIds = alias ? [node.id, alias] : [node.id]\n\t\tthis.removeNestedTargetsForOwnerIds(ownerIds)\n\t}\n\n\tprivate unregisterVirtualNodeId(id: string): void {\n\t\tthis.targetsByVirtualNodeId.delete(id)\n\n\t\tconst alias = this.aliasByVirtualNodeId.get(id)\n\t\tif (!alias) return\n\n\t\tthis.aliasByVirtualNodeId.delete(id)\n\t\tthis.virtualNodeIdByAlias.delete(alias)\n\t}\n\n\tprivate removeNestedTargetsForOwnerIds(ownerIds: readonly string[]): void {\n\t\tfor (const target of Array.from(this.editors.keys())) {\n\t\t\tif (ownerIds.some(ownerId => target.startsWith(`${ownerId}/`))) this.removeDocument(target)\n\t\t}\n\t}\n\n\tprivate resolveNodeAlias(id: string): string {\n\t\treturn this.virtualNodeIdByAlias.get(id) ?? id\n\t}\n\n\tprivate applyTypographyToBlocks(document: RichTextDocument): void {\n\t\tfor (const node of walkVirtualRichText(document)) {\n\t\t\tif (!isVirtualRichTextTextRun(node)) continue\n\t\t\tif (node.inlineCode) continue\n\n\t\t\tnode.text = applyTypography(node.text)\n\t\t}\n\t}\n}\n\nfunction uniformTextBlockTag(document: RichTextDocument): VirtualRichTextTextBlock[\"tag\"] | undefined {\n\tlet tag: VirtualRichTextTextBlock[\"tag\"] | undefined\n\tfor (const node of walkVirtualRichText(document)) {\n\t\tif (!isVirtualRichTextTextBlock(node)) continue\n\t\tif (tag === undefined) {\n\t\t\ttag = node.tag\n\t\t\tcontinue\n\t\t}\n\t\tif (tag !== node.tag) return undefined\n\t}\n\treturn tag\n}\n\n/** Test helper: hydrates virtual text, runs the callback, then applies changes. */\nexport function withVirtualText(\n\tctxOrVirtualText: AgentContext | VirtualText,\n\tnode: RichTextCanvasNode,\n\tfn: () => void,\n) {\n\tconst vt = ctxOrVirtualText instanceof VirtualText ? ctxOrVirtualText : ctxOrVirtualText.virtualText\n\tvt.hydrate(node)\n\tfn()\n\tvt.apply(node)\n}\n", "import type {\n\tAnyComponentLoader,\n\tSerializedVerifiedPropertyControls,\n\tVerifiedPropertyControls,\n} from \"@framerjs/framer-runtime\"\nimport {\n\tModuleType,\n\tassert,\n\tasGlobalId,\n\texternalModuleIdentifier,\n\tgetLogger,\n\tisExternalModuleIdentifier,\n\tisModuleExportIdentifier,\n\ttype ModuleExportIdentifierString,\n\tparseModuleIdentifier,\n\temptyArray,\n} from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { waitForLoadingComponentsWithTimeout } from \"code-generation/utils/waitForLoadingComponentsWithTimeout.ts\"\nimport {\n\tshaderKeys,\n\tshaderPresets,\n\ttype ShaderKey as AgentShaderName,\n\ttype ShaderPreset,\n} from \"document/components/chrome/insertSidebar/dataSources/items/shaderItems.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { ExternalModulesListNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport { createUnusedObject } from \"utils/createUnusedObject.ts\"\nimport { join } from \"utils/join.ts\"\nimport { getLookupQueryForModuleComponent } from \"utils/moduleComponents.ts\"\nimport { type ControlsHandle, getControlsHandle } from \"./controlDefinitions.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\n\ntype AgentShaderPreset = Omit<ShaderPreset, \"key\"> & { name: AgentShaderName }\ntype ControlProperties = SerializedVerifiedPropertyControls | VerifiedPropertyControls\n\nexport function shaderPresetToAgentShaderPreset(preset: ShaderPreset): AgentShaderPreset\nexport function shaderPresetToAgentShaderPreset(preset: ShaderPreset | undefined): AgentShaderPreset | undefined\nexport function shaderPresetToAgentShaderPreset(preset: ShaderPreset | undefined): AgentShaderPreset | undefined {\n\tif (!preset) return undefined\n\tconst { key, ...rest } = preset\n\treturn {\n\t\tname: key,\n\t\t...rest,\n\t}\n}\n\nconst shaderNamesSet = new Set<string>(shaderKeys)\nexport function isShaderName(value: string): value is AgentShaderName {\n\treturn shaderNamesSet.has(value)\n}\n\nexport interface ProjectShader {\n\tname: AgentShaderName\n\ttitle: string\n\tshaderModuleIdentifier: ModuleExportIdentifierString\n\tcontrols: ControlProperties | undefined\n}\n\nexport interface ShaderDefinitionWithControlHandle extends Omit<ProjectShader, \"controls\"> {\n\tcontrols: ControlsHandle<ControlProperties>\n}\n\nexport interface ShadersJsonDefinition extends ProjectShader {}\n\nconst log = getLogger(\"ai:agents:shaders\")\n\nexport class Shaders {\n\tstatic readonly availableShadersTag = metadataTags.availableShaders\n\tstatic readonly shaderDefinitionsTag = metadataTags.shaderDefinition\n\n\tprivate readonly fullCatalog: readonly Readonly<AgentShaderPreset>[] = shaderPresets.map(preset =>\n\t\tshaderPresetToAgentShaderPreset(preset),\n\t)\n\tprivate readonly fullCatalogByName: Map<AgentShaderName, Readonly<AgentShaderPreset>> = new Map(\n\t\tshaderPresets.map(entry => [entry.key, shaderPresetToAgentShaderPreset(entry)]),\n\t)\n\n\tprivate readonly projectShaders: ProjectShader[] = []\n\tprivate readonly projectShadersByIdentifier = new Map<ModuleExportIdentifierString, ProjectShader>()\n\tprivate readonly sentShaderDefinitionIdentifiers = new Set<ModuleExportIdentifierString>()\n\n\tprivate readonly identifiersByName = new Map<AgentShaderName, ModuleExportIdentifierString>()\n\tprivate readonly namesByIdentifier = new Map<ModuleExportIdentifierString, AgentShaderName>()\n\tprivate readonly propertiesByIdentifier = new Map<ModuleExportIdentifierString, ControlProperties>()\n\n\tstatic async fromTree(\n\t\ttree: CanvasTree,\n\t\tmodulesStore: ModulesStore,\n\t\tcomponentLoader: AnyComponentLoader,\n\t): Promise<Shaders> {\n\t\tassert(tree, \"Tree is required\")\n\t\tassert(modulesStore, \"ModulesStore is required\")\n\n\t\tconst presetsByModuleId = new Map(shaderPresets.map(preset => [preset.shaderModuleId, preset] as const))\n\t\tconst projectShaders: ProjectShader[] = []\n\t\tconst projectShaderNodes = ExternalModulesListNode.getModuleNodes(tree)\n\t\tfor (const shaderNode of projectShaderNodes) {\n\t\t\tif (shaderNode.type !== ModuleType.Shader) continue\n\t\t\tif (!isModuleExportIdentifier(shaderNode.codeComponentIdentifier)) continue\n\n\t\t\tconst presetForShader = presetsByModuleId.get(shaderNode.id)\n\t\t\tif (!presetForShader) {\n\t\t\t\tlog.warn(\"No preset found for shader module\", shaderNode.id)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tprojectShaders.push({\n\t\t\t\tname: presetForShader.key,\n\t\t\t\tshaderModuleIdentifier: shaderNode.codeComponentIdentifier,\n\t\t\t\ttitle: presetForShader.title,\n\t\t\t\tcontrols: undefined,\n\t\t\t})\n\t\t}\n\n\t\tlog.debug(\"Project shaders collected from external modules:\", projectShaders, { shaderPresets })\n\n\t\treturn new Shaders(modulesStore, componentLoader, projectShaders)\n\t}\n\n\tstatic fromJSON(\n\t\tshaderDefinitions: readonly ShadersJsonDefinition[],\n\t\tmodulesStore?: ModulesStore,\n\t\tcomponentLoader?: AnyComponentLoader,\n\t): Shaders {\n\t\treturn new Shaders(\n\t\t\tmodulesStore ?? createUnusedObject(\"ModulesStore\"),\n\t\t\tcomponentLoader ?? createUnusedObject(\"ComponentLoader\"),\n\t\t\tshaderDefinitions,\n\t\t)\n\t}\n\n\tconstructor(\n\t\tprivate readonly modulesStore: ModulesStore,\n\t\tprivate readonly componentLoader: AnyComponentLoader,\n\t\tinitialShadersState: readonly (ProjectShader | ShadersJsonDefinition)[],\n\t) {\n\t\tfor (const shader of initialShadersState) {\n\t\t\tthis.recordProjectShader(shader)\n\t\t}\n\t}\n\n\tavailableShadersPrompt(): string {\n\t\treturn join.lines(\n\t\t\t`<${Shaders.availableShadersTag}>`,\n\t\t\t`### Current Site Shaders`,\n\t\t\tJSON.stringify(\n\t\t\t\tthis.projectShaders.map(shader => {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tname: shader.name,\n\t\t\t\t\t\ttitle: shader.title,\n\t\t\t\t\t}\n\t\t\t\t}),\n\t\t\t),\n\t\t\t`### Additionally Available Shaders`,\n\t\t\tJSON.stringify(this.getAdditionalShadersPromptDefinitions()),\n\t\t\t`</${Shaders.availableShadersTag}>`,\n\t\t)\n\t}\n\n\tshadersFromSelectionPrompt(): string[] {\n\t\tconst definitions = this.projectShaders.flatMap(shader => {\n\t\t\tif (this.sentShaderDefinitionIdentifiers.has(shader.shaderModuleIdentifier)) return emptyArray<string>()\n\n\t\t\tconst controls = this.getPropertiesForIdentifier(shader.shaderModuleIdentifier)\n\t\t\tif (!controls) return emptyArray<string>()\n\n\t\t\tthis.sentShaderDefinitionIdentifiers.add(shader.shaderModuleIdentifier)\n\n\t\t\treturn [\n\t\t\t\tjoin.lines(\n\t\t\t\t\t`<${Shaders.shaderDefinitionsTag} name=\"${shader.name}\">`,\n\t\t\t\t\tJSON.stringify({\n\t\t\t\t\t\tshaderModuleIdentifier: shader.shaderModuleIdentifier,\n\t\t\t\t\t\tcontrols,\n\t\t\t\t\t}),\n\t\t\t\t\t`</${Shaders.shaderDefinitionsTag}>`,\n\t\t\t\t),\n\t\t\t]\n\t\t})\n\n\t\treturn definitions\n\t}\n\n\ttoJSON(): ShadersJsonDefinition[] {\n\t\treturn this.projectShaders.flatMap(shader => {\n\t\t\tconst controls = this.getPropertiesForIdentifier(shader.shaderModuleIdentifier, true)\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tname: shader.name,\n\t\t\t\t\ttitle: shader.title,\n\t\t\t\t\tshaderModuleIdentifier: shader.shaderModuleIdentifier,\n\t\t\t\t\tcontrols,\n\t\t\t\t},\n\t\t\t]\n\t\t})\n\t}\n\n\tpublic async = {\n\t\tforIdentifier: async (\n\t\t\tidentifier: ModuleExportIdentifierString,\n\t\t): Promise<ShaderDefinitionWithControlHandle | undefined> => {\n\t\t\tconst existingShader = this.forIdentifier(identifier)\n\t\t\tif (existingShader) return existingShader\n\n\t\t\tawait this.loadShaderDefinition(identifier)\n\n\t\t\treturn this.forIdentifier(identifier)\n\t\t},\n\t}\n\n\tasync requestCompleteShaderDefinition(shaderName: AgentShaderName): Promise<ShadersJsonDefinition> {\n\t\tconst entry = this.fullCatalogByName.get(shaderName)\n\t\tif (!entry) {\n\t\t\tthrow new Error(\"No shader found for the specified name.\")\n\t\t}\n\n\t\tlog.info(\"Fetching:\", { name: shaderName, entry })\n\n\t\tconst shaderIdentifier = await this.fetchShaderModuleIdentifier(entry.name)\n\n\t\tconst shader = await this.async.forIdentifier(shaderIdentifier)\n\t\tif (!shader) {\n\t\t\tlog.error(\"Shader found in catalog but failed to load:\", { entry, shaderIdentifier })\n\t\t\tthrow new Error(\"Shader found in catalog but failed to load, please try again or choose a different shader.\")\n\t\t}\n\n\t\treturn {\n\t\t\t...shader,\n\t\t\tcontrols: shader.controls.properties(),\n\t\t}\n\t}\n\n\tasync fetchShaderModuleIdentifier(shaderName: AgentShaderName): Promise<ModuleExportIdentifierString> {\n\t\tconst cached = this.identifiersByName.get(shaderName)\n\t\tif (cached) {\n\t\t\tlog.debug(\"Shader Module cache hit for\", shaderName, \"->\", cached)\n\t\t\treturn cached\n\t\t}\n\n\t\tconst entry = this.fullCatalogByName.get(shaderName)\n\t\tassert(entry, `Shader with name ${shaderName} not found in catalog.`)\n\n\t\tconst moduleQuery = await this.modulesStore.lookUpModule(getLookupQueryForModuleComponent(entry))\n\t\tconst shaderModule = moduleQuery.module\n\t\tassert(shaderModule, `Module lookup failed for shader URL ${entry.moduleURL}`)\n\t\tassert(shaderModule.files.module, `Module ${shaderModule.id} has no module file`)\n\n\t\tconst identifier = externalModuleIdentifier(\n\t\t\tasGlobalId(shaderModule.id),\n\t\t\tshaderModule.saveId,\n\t\t\tshaderModule.files.module,\n\t\t\t\"default\",\n\t\t)\n\n\t\tthis.identifiersByName.set(shaderName, identifier.value)\n\t\tthis.namesByIdentifier.set(identifier.value, shaderName)\n\n\t\tlog.info(\"Fetched shader module identifier:\", shaderName, \"->\", identifier.value)\n\t\treturn identifier.value\n\t}\n\n\tasync insert(shaderName: AgentShaderName): Promise<ModuleExportIdentifierString> {\n\t\tconst identifierString = await this.fetchShaderModuleIdentifier(shaderName)\n\t\tconst identifier = parseModuleIdentifier(identifierString)\n\t\tassert(\n\t\t\tisExternalModuleIdentifier(identifier),\n\t\t\t`Cached shader module identifier ${identifierString} should have been an external module identifier.`,\n\t\t)\n\n\t\tlog.debug(\"Adding external module to project:\", identifierString)\n\n\t\tconst projectShader = this.projectShadersByIdentifier.get(identifierString)\n\t\tif (projectShader) {\n\t\t\tlog.debug(\"Already in project\")\n\n\t\t\treturn identifierString\n\t\t}\n\n\t\tawait this.modulesStore.addExternalModulesToProject([identifier], {\n\t\t\tonTreeUpdate: noop,\n\t\t})\n\n\t\tthis.recordProjectShader({\n\t\t\tname: shaderName,\n\t\t\tshaderModuleIdentifier: identifierString,\n\t\t\ttitle: this.fullCatalogByName.get(shaderName)?.title ?? shaderName,\n\t\t\tcontrols: undefined,\n\t\t})\n\n\t\tlog.debug(\"Added shader to project:\", shaderName, \"->\", identifierString)\n\t\treturn identifierString\n\t}\n\n\tgetNameForIdentifier(identifier: ModuleExportIdentifierString): AgentShaderName {\n\t\tconst name = this.getKnownShaderNameForIdentifier(identifier)\n\t\tassert(\n\t\t\tname,\n\t\t\t`Shader for identifier ${identifier} should have existed from this shaders instance instantiating or from a previous install call, but was not found in namesByIdentifier map.`,\n\t\t)\n\t\treturn name\n\t}\n\n\tgetPropertiesForIdentifier(\n\t\tidentifier: ModuleExportIdentifierString,\n\t\tcacheOnly?: true,\n\t): ControlProperties | undefined {\n\t\tconst cachedProperties = this.propertiesByIdentifier.get(identifier)\n\t\tif (cachedProperties) return cachedProperties\n\t\tif (cacheOnly) return undefined\n\n\t\tconst shader = this.componentLoader.shaderForIdentifier(identifier)\n\t\tif (!shader) return\n\n\t\tthis.propertiesByIdentifier.set(identifier, shader.properties)\n\t\treturn shader.properties\n\t}\n\n\tforIdentifier(identifier: ModuleExportIdentifierString): ShaderDefinitionWithControlHandle | undefined {\n\t\tconst properties = this.getPropertiesForIdentifier(identifier)\n\t\tif (!properties) return undefined\n\n\t\t// Shader control keys are their own names (no title aliasing).\n\t\tconst controlPropKeysByControlName = new Map<string, string>()\n\t\tconst controlPropNamesByKeys = new Map<string, string>()\n\t\tfor (const propertyKey in properties) {\n\t\t\tcontrolPropKeysByControlName.set(propertyKey, propertyKey)\n\t\t\tcontrolPropNamesByKeys.set(propertyKey, propertyKey)\n\t\t}\n\n\t\tconst name = this.getKnownShaderNameForIdentifier(identifier)\n\t\tif (!name) return undefined\n\n\t\tconst preset = this.fullCatalogByName.get(name)\n\t\tassert(preset, `No shader preset found for name ${name} in catalog.`)\n\t\tconst projectShader = this.projectShadersByIdentifier.get(identifier)\n\n\t\treturn {\n\t\t\tname,\n\t\t\ttitle: projectShader?.title ?? preset.title,\n\t\t\tshaderModuleIdentifier: identifier,\n\t\t\tcontrols: getControlsHandle({ controlPropKeysByControlName, controlPropNamesByKeys }, properties),\n\t\t}\n\t}\n\n\tprivate recordProjectShader(shader: ProjectShader): void {\n\t\tconst existingShader = this.projectShadersByIdentifier.get(shader.shaderModuleIdentifier)\n\t\tif (existingShader) {\n\t\t\texistingShader.controls = shader.controls ?? existingShader.controls\n\t\t} else {\n\t\t\tthis.projectShaders.push(shader)\n\t\t\tthis.projectShadersByIdentifier.set(shader.shaderModuleIdentifier, shader)\n\t\t}\n\n\t\t// When hydrating from JSON, we have controls\n\t\tif (shader.controls) {\n\t\t\tthis.propertiesByIdentifier.set(shader.shaderModuleIdentifier, shader.controls)\n\t\t}\n\n\t\tthis.identifiersByName.set(shader.name, shader.shaderModuleIdentifier)\n\t\tthis.namesByIdentifier.set(shader.shaderModuleIdentifier, shader.name)\n\t}\n\n\tprivate getKnownShaderNameForIdentifier(identifier: ModuleExportIdentifierString): AgentShaderName | undefined {\n\t\tconst cachedName = this.namesByIdentifier.get(identifier)\n\t\tif (cachedName) return cachedName\n\n\t\tconst parsedIdentifier = parseModuleIdentifier(identifier)\n\t\tif (!isExternalModuleIdentifier(parsedIdentifier)) return undefined\n\n\t\tconst inferred = shaderPresets.find(preset => preset.shaderModuleId === parsedIdentifier.moduleId)\n\t\tif (!inferred) return undefined\n\n\t\tconst name = inferred.key\n\t\tthis.namesByIdentifier.set(identifier, name)\n\t\tthis.identifiersByName.set(name, identifier)\n\t\treturn name\n\t}\n\n\tprivate async loadShaderDefinition(identifier: ModuleExportIdentifierString): Promise<void> {\n\t\tlet shader = this.componentLoader.shaderForIdentifier(identifier)\n\t\tif (!shader) {\n\t\t\tconst parsedIdentifier = parseModuleIdentifier(identifier)\n\t\t\tassert(\n\t\t\t\tisExternalModuleIdentifier(parsedIdentifier),\n\t\t\t\t`Expected shader identifier ${identifier} to be an external module identifier.`,\n\t\t\t)\n\n\t\t\tawait this.modulesStore.preloadExternalModules([parsedIdentifier])\n\n\t\t\tassert(this.componentLoader.environment === \"editor\", \"Agent should be running in the editor environment\")\n\t\t\tawait waitForLoadingComponentsWithTimeout(this.componentLoader, [identifier], this.modulesStore)\n\n\t\t\tshader = this.componentLoader.shaderForIdentifier(identifier)\n\t\t}\n\n\t\tassert(\n\t\t\tshader,\n\t\t\t`Shader with identifier ${identifier} should have been loadable after preloading its module, but was not found.`,\n\t\t)\n\n\t\tconst name = this.getKnownShaderNameForIdentifier(identifier)\n\n\t\tassert(name, `Name for shader with identifier ${identifier} should have been found.`)\n\n\t\tthis.propertiesByIdentifier.set(identifier, shader.properties)\n\t}\n\n\tprivate getAdditionalShadersPromptDefinitions(): Array<Pick<AgentShaderPreset, \"name\" | \"title\" | \"keywords\">> {\n\t\tconst projectShaderNames = new Set(this.projectShaders.map(shader => shader.name))\n\n\t\treturn this.fullCatalog.flatMap(entry => {\n\t\t\tif (projectShaderNames.has(entry.name)) {\n\t\t\t\treturn emptyArray()\n\t\t\t}\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tname: entry.name,\n\t\t\t\t\ttitle: entry.title,\n\t\t\t\t\tkeywords: entry.keywords,\n\t\t\t\t},\n\t\t\t]\n\t\t})\n\t}\n}\n", "import { assertNever, type ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport type { SupportedDSLNodeClass } from \"app/ai/agents/dsl.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/CanvasTree.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport {\n\tBLOCKQUOTE_ENTITY_ROOT_ID,\n\tCMS_ENTITY_ROOT_ID,\n\tINLINE_CODE_ENTITY_ROOT_ID,\n\tLINK_ENTITY_ROOT_ID,\n\tTEXT_ENTITY_ROOT_ID,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { PresetsListNode } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { getPathForReferencedNode } from \"document/models/CanvasTree/nodes/utils/entityFolderNode.ts\"\nimport {\n\tisComponentPresetNode,\n\tisTextStylePresetPrimaryNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withRichTextTag, type RichTextTag } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { join } from \"utils/join.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport { toAttributes } from \"../traits/attributes.ts\"\nimport {\n\ttype BreakpointLabel,\n\ttype BreakpointSlot,\n\tgetBreakpointsForPreset,\n\tserializeAllBreakpointSlots,\n\tbreakpointEligibleProperties,\n} from \"../traits/textStylePresetBreakpointSlots.ts\"\nimport type { AgentContext } from \"./AgentContext.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\nimport { StylePresetType, type AgentSupportedStylePresetNode } from \"./stylePresetType.ts\"\n\nconst stylePresetNodeClasses = [\n\tClassDiscriminator.TextStylePresetNode,\n\tClassDiscriminator.LinkStylePresetNode,\n\tClassDiscriminator.InlineCodeStylePresetNode,\n\tClassDiscriminator.BlockquoteStylePresetNode,\n\tClassDiscriminator.TableStylePresetNode,\n\tClassDiscriminator.ImageStylePresetNode,\n\tClassDiscriminator.ComponentPresetNode,\n] as const satisfies SupportedDSLNodeClass[]\ntype StylePresetNodeClass = (typeof stylePresetNodeClasses)[number]\n\nconst stylePresetNodeClassesSet = new Set<string>(stylePresetNodeClasses)\nexport function isStylePresetNodeClass(nodeClass: ClassDiscriminator): nodeClass is StylePresetNodeClass {\n\treturn stylePresetNodeClassesSet.has(nodeClass)\n}\n\nconst nonComponentStylePresetNodeClassesSet = new Set<string>(\n\tstylePresetNodeClasses.filter(nodeClass => nodeClass !== ClassDiscriminator.ComponentPresetNode),\n)\nfunction isNonComponentStylePresetNodeClass(\n\tnodeClass: ClassDiscriminator,\n): nodeClass is Exclude<StylePresetNodeClass, ClassDiscriminator.ComponentPresetNode> {\n\treturn nonComponentStylePresetNodeClassesSet.has(nodeClass)\n}\n\ntype StylePresetId = NodeID\n\nconst stylePresetNodeToType = {\n\t[ClassDiscriminator.TextStylePresetNode]: StylePresetType.Text,\n\t[ClassDiscriminator.LinkStylePresetNode]: StylePresetType.Link,\n\t[ClassDiscriminator.InlineCodeStylePresetNode]: StylePresetType.InlineCode,\n\t[ClassDiscriminator.BlockquoteStylePresetNode]: StylePresetType.Blockquote,\n\t[ClassDiscriminator.TableStylePresetNode]: StylePresetType.Table,\n\t[ClassDiscriminator.ImageStylePresetNode]: StylePresetType.Image,\n\t[ClassDiscriminator.ComponentPresetNode]: StylePresetType.Component,\n} as const satisfies Record<StylePresetNodeClass, StylePresetType>\n\nconst stylePresetTypeToEntityRootId = {\n\t[StylePresetType.Text]: TEXT_ENTITY_ROOT_ID,\n\t[StylePresetType.Link]: LINK_ENTITY_ROOT_ID,\n\t[StylePresetType.InlineCode]: INLINE_CODE_ENTITY_ROOT_ID,\n\t[StylePresetType.Blockquote]: BLOCKQUOTE_ENTITY_ROOT_ID,\n\t[StylePresetType.Image]: CMS_ENTITY_ROOT_ID,\n\t[StylePresetType.Table]: CMS_ENTITY_ROOT_ID,\n\t[StylePresetType.Component]: CMS_ENTITY_ROOT_ID,\n} as const satisfies Record<StylePresetType, NodeID>\n\nfunction resolvePresetName(tree: CanvasTree, preset: AgentSupportedStylePresetNode, type: StylePresetType): string {\n\treturn getPathForReferencedNode(tree, preset, stylePresetTypeToEntityRootId[type], { leadingSlash: false })\n}\n\n/**\n * Extends Record<string, unknown> to allow spreading dynamic attributes from toAttributes(). The\n * toAttributes() function returns DSLAttributes with various trait properties (font, textColor,\n * fontSize, etc.) that vary based on the node. By extending Record<string, unknown>, we can spread\n * these dynamic properties into the definition while still requiring the specific fields (type, id,\n * name).\n */\ninterface TextStylePresetDefinition extends Record<string, unknown> {\n\ttype: StylePresetType.Text\n\tid: StylePresetId\n\tname: string\n\ttag?: RichTextTag\n\tbreakpoint?: Partial<Record<BreakpointLabel, BreakpointSlot>>\n}\n\ninterface LinkStylePresetDefinition extends Record<string, unknown> {\n\ttype: StylePresetType.Link\n\tid: StylePresetId\n\tname: string\n}\n\ninterface InlineCodeStylePresetDefinition extends Record<string, unknown> {\n\ttype: StylePresetType.InlineCode\n\tid: StylePresetId\n\tname: string\n}\n\ninterface BlockquoteStylePresetDefinition extends Record<string, unknown> {\n\ttype: StylePresetType.Blockquote\n\tid: StylePresetId\n\tname: string\n}\n\ninterface TableStylePresetDefinition extends Record<string, unknown> {\n\ttype: StylePresetType.Table\n\tid: StylePresetId\n\tname: string\n}\n\ninterface ImageStylePresetDefinition extends Record<string, unknown> {\n\ttype: StylePresetType.Image\n\tid: StylePresetId\n\tname: string\n}\n\ninterface ComponentPresetDefinition extends Record<string, unknown> {\n\ttype: StylePresetType.Component\n\tid: StylePresetId\n\tname: string\n\tcomponentId: string\n\tcomponentIdentifier: ModuleExportIdentifierString\n}\n\nexport type StylePresetDefinition =\n\t| TextStylePresetDefinition\n\t| LinkStylePresetDefinition\n\t| InlineCodeStylePresetDefinition\n\t| BlockquoteStylePresetDefinition\n\t| TableStylePresetDefinition\n\t| ImageStylePresetDefinition\n\t| ComponentPresetDefinition\n\nexport class StylePresets {\n\tstatic metadataTag = metadataTags.stylePresets\n\n\tconstructor(\n\t\tprivate readonly stylePresets: Map<StylePresetId, StylePresetDefinition> = new Map(),\n\t\tprivate readonly nameToId: Record<StylePresetType, Map<string, StylePresetId>> = {\n\t\t\t[StylePresetType.Text]: new Map(),\n\t\t\t[StylePresetType.Link]: new Map(),\n\t\t\t[StylePresetType.InlineCode]: new Map(),\n\t\t\t[StylePresetType.Blockquote]: new Map(),\n\t\t\t[StylePresetType.Table]: new Map(),\n\t\t\t[StylePresetType.Image]: new Map(),\n\t\t\t[StylePresetType.Component]: new Map(),\n\t\t},\n\t) {}\n\n\tasync init(ctx: AgentContext) {\n\t\tconst presetsListNode = PresetsListNode.get(ctx.treeStore.tree)\n\t\tif (!presetsListNode) return\n\n\t\tfor (const preset of presetsListNode.getTextStylePresets()) {\n\t\t\tawait this.add(preset, ctx)\n\t\t}\n\t\tfor (const preset of presetsListNode.getLinkStylePresets()) {\n\t\t\tawait this.add(preset, ctx)\n\t\t}\n\t\tfor (const preset of presetsListNode.getInlineCodeStylePresets()) {\n\t\t\tawait this.add(preset, ctx)\n\t\t}\n\t\tfor (const preset of presetsListNode.getBlockquoteStylePresets()) {\n\t\t\tawait this.add(preset, ctx)\n\t\t}\n\t\tfor (const preset of presetsListNode.getTableStylePresets()) {\n\t\t\tawait this.add(preset, ctx)\n\t\t}\n\t\tfor (const preset of presetsListNode.getImageStylePresets()) {\n\t\t\tawait this.add(preset, ctx)\n\t\t}\n\t\tfor (const preset of presetsListNode.getComponentPresets()) {\n\t\t\tawait this.add(preset, ctx)\n\t\t}\n\t}\n\n\tstatic fromJSON(json: StylePresetDefinition[]): StylePresets {\n\t\tconst presets = new StylePresets()\n\t\tfor (const preset of json) {\n\t\t\tpresets.stylePresets.set(preset.id, preset)\n\t\t\tpresets.nameToId[preset.type].set(preset.name, preset.id)\n\t\t}\n\t\treturn presets\n\t}\n\n\ttoJSON(): StylePresetDefinition[] {\n\t\treturn Array.from(this.stylePresets.values())\n\t}\n\n\t/**\n\t * Slim version of toJSON() for serialized examples, picking only the fields needed to generate\n\t * agent-examples.json at bundle time.\n\t * */\n\ttoExampleJSON(): StylePresetDefinition[] {\n\t\treturn this.toJSON().map((preset): StylePresetDefinition => {\n\t\t\tswitch (preset.type) {\n\t\t\t\tcase StylePresetType.Text:\n\t\t\t\t\treturn { type: preset.type, id: preset.id, name: preset.name, tag: preset.tag }\n\t\t\t\tcase StylePresetType.Link:\n\t\t\t\t\treturn { type: preset.type, id: preset.id, name: preset.name }\n\t\t\t\tcase StylePresetType.InlineCode:\n\t\t\t\t\treturn { type: preset.type, id: preset.id, name: preset.name }\n\t\t\t\tcase StylePresetType.Blockquote:\n\t\t\t\t\treturn { type: preset.type, id: preset.id, name: preset.name }\n\t\t\t\tcase StylePresetType.Table:\n\t\t\t\t\treturn { type: preset.type, id: preset.id, name: preset.name }\n\t\t\t\tcase StylePresetType.Image:\n\t\t\t\t\treturn { type: preset.type, id: preset.id, name: preset.name }\n\t\t\t\tcase StylePresetType.Component:\n\t\t\t\t\treturn {\n\t\t\t\t\t\ttype: preset.type,\n\t\t\t\t\t\tid: preset.id,\n\t\t\t\t\t\tname: preset.name,\n\t\t\t\t\t\tcomponentId: preset.componentId,\n\t\t\t\t\t\tcomponentIdentifier: preset.componentIdentifier,\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(preset)\n\t\t\t}\n\t\t})\n\t}\n\n\tprompt() {\n\t\treturn join.lines(`<${StylePresets.metadataTag}>`, JSON.stringify(this.toJSON()), `</${StylePresets.metadataTag}>`)\n\t}\n\n\tasync add(preset: AgentSupportedStylePresetNode, ctx: AgentContext) {\n\t\tassert(isStylePresetNodeClass(preset.__class))\n\n\t\tthis.remove(preset.id)\n\t\tconst definition = await StylePresets.toDefinition(preset, ctx)\n\t\tif (!definition) return\n\n\t\tthis.stylePresets.set(preset.id, definition)\n\t\tthis.nameToId[definition.type].set(definition.name, preset.id)\n\t}\n\n\t// Name-only entry written at ADD time. The full definition replaces this when add() runs at the\n\t// first SET.\n\tregisterNewPreset(\n\t\ttype: StylePresetType,\n\t\tid: StylePresetId,\n\t\tname: string,\n\t\tcomponentId?: string,\n\t\tcomponentIdentifier?: ModuleExportIdentifierString,\n\t) {\n\t\tthis.remove(id)\n\t\tif (type === StylePresetType.Component) {\n\t\t\tassert(componentId, \"Component id is required for component preset nodes\")\n\t\t\tassert(componentIdentifier, \"Component identifier is required for component preset nodes\")\n\t\t\tthis.stylePresets.set(id, { type, id, name, componentId, componentIdentifier })\n\t\t} else {\n\t\t\tthis.stylePresets.set(id, { type, id, name })\n\t\t}\n\t\tthis.nameToId[type].set(name, id)\n\t}\n\n\tsetName(id: StylePresetId, name: string) {\n\t\tconst existing = this.stylePresets.get(id)\n\t\tif (!existing || existing.name === name) return\n\t\tthis.nameToId[existing.type].delete(existing.name)\n\t\texisting.name = name\n\t\tthis.nameToId[existing.type].set(name, id)\n\t}\n\n\tremove(id: StylePresetId) {\n\t\tconst preset = this.stylePresets.get(id)\n\t\tif (preset) this.nameToId[preset.type].delete(preset.name)\n\t\tthis.stylePresets.delete(id)\n\t}\n\n\tforId(id: StylePresetId): StylePresetDefinition | undefined {\n\t\treturn this.stylePresets.get(id)\n\t}\n\n\tforName(presetName: string | undefined, presetType: StylePresetType): StylePresetDefinition | undefined {\n\t\tif (!presetName) return\n\t\tconst id = this.nameToId[presetType].get(presetName)\n\t\tif (!id) return\n\t\treturn this.stylePresets.get(id)\n\t}\n\n\tforNameOrId(presetNameOrId: string | undefined, presetType: StylePresetType): StylePresetDefinition | undefined {\n\t\tif (!presetNameOrId) return\n\t\treturn this.forName(presetNameOrId, presetType) ?? this.forId(presetNameOrId)\n\t}\n\n\texistingNamesForType(presetType: StylePresetType): ReadonlySet<string> {\n\t\treturn new Set(this.nameToId[presetType].keys())\n\t}\n\n\tstatic async toDefinition(\n\t\tpreset: AgentSupportedStylePresetNode,\n\t\tctx: AgentContext,\n\t): Promise<StylePresetDefinition | undefined> {\n\t\tassert(isStylePresetNodeClass(preset.__class))\n\n\t\tif (isComponentPresetNode(preset)) return StylePresets.toComponentPresetDefinition(preset, ctx)\n\n\t\treturn StylePresets.toNonComponentDefinition(preset, ctx)\n\t}\n\n\tprivate static async toComponentPresetDefinition(\n\t\tpreset: ComponentPresetNode,\n\t\tctx: AgentContext,\n\t): Promise<ComponentPresetDefinition | undefined> {\n\t\tconst componentId = ctx.components.getIdForModuleIdentifier(preset.componentIdentifier)\n\t\t// Only component presets backed by available component metadata can be exposed to the agent.\n\t\t// Unknown preset components may exist in imported/copied/stale project data, so skip them.\n\t\tif (!componentId) return\n\n\t\tawait ctx.components.async.forIdentifier(preset.componentIdentifier)\n\n\t\tconst attributes = await toAttributes(preset, undefined, ctx)\n\n\t\treturn {\n\t\t\t...attributes,\n\t\t\ttype: StylePresetType.Component,\n\t\t\tid: preset.id,\n\t\t\tname: resolvePresetName(ctx.treeStore.tree, preset, StylePresetType.Component),\n\t\t\tcomponentId,\n\t\t\tcomponentIdentifier: preset.componentIdentifier,\n\t\t}\n\t}\n\n\tprivate static async toNonComponentDefinition(\n\t\tpreset: Exclude<AgentSupportedStylePresetNode, ComponentPresetNode>,\n\t\tctx: AgentContext,\n\t): Promise<Exclude<StylePresetDefinition, ComponentPresetDefinition>> {\n\t\tconst nodeClass = preset.__class\n\t\tassert(isNonComponentStylePresetNodeClass(nodeClass))\n\t\tconst type = stylePresetNodeToType[nodeClass]\n\t\tconst attributes = await toAttributes(preset, undefined, ctx)\n\n\t\tconst definition: Exclude<StylePresetDefinition, ComponentPresetDefinition> = {\n\t\t\t...attributes,\n\t\t\ttype,\n\t\t\tid: preset.id,\n\t\t\tname: resolvePresetName(ctx.treeStore.tree, preset, type),\n\t\t}\n\n\t\tif (withRichTextTag(preset)) definition.tag = preset.tag\n\n\t\tif (!isTextStylePresetPrimaryNode(preset)) return definition\n\n\t\tconst breakpoints = getBreakpointsForPreset(ctx.treeStore.tree, preset)\n\n\t\tdefinition.breakpoint = serializeAllBreakpointSlots(preset, breakpoints)\n\n\t\t// Make sure we remove the breakpoint eligible properties from the definition so they are not duplicated.\n\t\tfor (const key of breakpointEligibleProperties) {\n\t\t\tdelete definition[key]\n\t\t}\n\n\t\treturn definition\n\t}\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { ColorStyleTokenListNode } from \"document/models/CanvasTree/nodes/ColorStyleTokenListNode.ts\"\nimport type { ColorStyleTokenNode } from \"document/models/CanvasTree/nodes/ColorStyleTokenNode.ts\"\nimport { isColorStyleTokenNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { tokenIdFromCSSVariable, tokenToCSSCustomProperty } from \"document/models/CanvasTree/utils/tokens.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport { join } from \"utils/join.ts\"\nimport { isUndefined } from \"utils/typeChecks.ts\"\nimport { getNameValue } from \"../traits/name.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\n\ntype LlmId = string\ntype TokenId = NodeID\n\nexport type ColorTheme = \"light\" | \"dark\"\n\nenum TokenType {\n\tColor = \"color\",\n}\n\ninterface ColorTokenDefinition {\n\ttype: TokenType.Color\n\tid: TokenId\n\tname: string\n\tlight: string\n\tdark?: string\n}\n\n// TokenDefinition is a union type that will expand as more token types are added. Currently only\n// ColorTokenDefinition is supported, but additional token types (e.g., spacing, etc.) will be added\n// in the future.\nexport type TokenDefinition = ColorTokenDefinition\n\ninterface TokenHandle {\n\tnode: ColorStyleTokenNode\n\ttoCSS: () => string\n}\n\nexport class Tokens {\n\tstatic metadataTag = metadataTags.tokens\n\n\tconstructor(\n\t\tprivate readonly treeStore: TreeStore,\n\t\tprivate readonly tokenIdsByLlmId: Map<LlmId, TokenId>,\n\t\tprivate readonly tokenNames: Map<TokenId, string> = new Map(),\n\t) {}\n\n\tstatic fromJSON(treeStore: TreeStore, json: TokenDefinition[]): Tokens {\n\t\tconst tokenIdsByLlmId = new Map<LlmId, TokenId>()\n\t\tconst tokenNames = new Map<TokenId, string>()\n\t\tfor (const definition of json) {\n\t\t\ttokenIdsByLlmId.set(definition.id, definition.id)\n\t\t\ttokenNames.set(definition.id, definition.name)\n\t\t}\n\t\treturn new Tokens(treeStore, tokenIdsByLlmId, tokenNames)\n\t}\n\n\tstatic fromTree(treeStore: TreeStore): Tokens {\n\t\tconst tokenIdsByLlmId = new Map<LlmId, TokenId>()\n\t\tconst tokenNames = new Map<TokenId, string>()\n\t\tconst colorStyleTokenListNode = ColorStyleTokenListNode.get(treeStore.tree)\n\t\tif (!colorStyleTokenListNode) return new Tokens(treeStore, tokenIdsByLlmId, tokenNames)\n\t\tconst tree = treeStore.getDataTreeOrPartialTree()\n\t\tfor (const node of colorStyleTokenListNode.children) {\n\t\t\tif (node.softDeleted) continue\n\t\t\ttokenIdsByLlmId.set(node.id, node.id)\n\t\t\tconst name = getNameValue(tree, node)\n\t\t\tif (name) tokenNames.set(node.id, name)\n\t\t}\n\t\treturn new Tokens(treeStore, tokenIdsByLlmId, tokenNames)\n\t}\n\n\tgetThemes(): ReadonlySet<ColorTheme> {\n\t\tconst themes = new Set<ColorTheme>([\"light\"])\n\t\tfor (const token of this.values()) {\n\t\t\tif (isUndefined(token.dark)) continue\n\t\t\tthemes.add(\"dark\")\n\t\t\tbreak\n\t\t}\n\t\treturn themes\n\t}\n\n\tprompt() {\n\t\treturn join.lines(`<${Tokens.metadataTag}>`, JSON.stringify(this.toJSON()), `</${Tokens.metadataTag}>`)\n\t}\n\n\ttoJSON(): TokenDefinition[] {\n\t\tconst tree = this.treeStore.getDataTreeOrPartialTree()\n\t\tconst definitions: TokenDefinition[] = []\n\t\tconst ids = new Set(this.tokenIdsByLlmId.values())\n\t\tfor (const id of ids) {\n\t\t\tconst node = tree.getNodeWithTrait(id, isColorStyleTokenNode)\n\t\t\tif (!node || node.softDeleted) continue\n\t\t\tdefinitions.push({\n\t\t\t\ttype: TokenType.Color,\n\t\t\t\tlight: node.light,\n\t\t\t\tid: node.id,\n\t\t\t\tname: this.tokenNames.get(node.id) ?? Dictionary.Color,\n\t\t\t\tdark: node.dark,\n\t\t\t})\n\t\t}\n\t\treturn definitions\n\t}\n\n\tadd(llmId: LlmId, id: TokenId, name?: string) {\n\t\tthis.tokenIdsByLlmId.set(llmId, id)\n\t\tif (name !== undefined) this.tokenNames.set(id, name)\n\t}\n\n\tremove(llmId: LlmId | TokenId) {\n\t\tconst id = this.tokenIdsByLlmId.get(llmId)\n\t\tthis.tokenIdsByLlmId.delete(llmId)\n\t\tif (id !== undefined) this.tokenNames.delete(id)\n\t\tthis.tokenNames.delete(llmId)\n\t}\n\n\tsetName(id: TokenId, name: string) {\n\t\tthis.tokenNames.set(id, name)\n\t}\n\n\tresolve(variable: string | undefined): TokenHandle | undefined {\n\t\tif (!variable) return\n\n\t\tconst tokenId = tokenIdFromCSSVariable(variable)\n\t\tif (!tokenId) return\n\n\t\tconst nodeId = this.tokenIdsByLlmId.get(tokenId) ?? tokenId\n\t\tif (isUndefined(nodeId) || !this.treeStore.tree.has(nodeId)) return\n\n\t\tconst node = this.treeStore.tree.getNodeWithTrait(nodeId, isColorStyleTokenNode)\n\t\tif (!node) return\n\n\t\treturn {\n\t\t\tnode,\n\t\t\ttoCSS: () => (node.softDeleted ? node.colorForMode(false) : `var(${tokenToCSSCustomProperty({ id: node.id })})`),\n\t\t}\n\t}\n\n\tvalues() {\n\t\tconst tokens: ColorStyleTokenNode[] = []\n\t\tconst ids = new Set(this.tokenIdsByLlmId.values())\n\t\tfor (const id of ids) {\n\t\t\tconst node = this.treeStore.tree.getNodeWithTrait(id, isColorStyleTokenNode)\n\t\t\tif (!node || node.softDeleted) continue\n\t\t\ttokens.push(node)\n\t\t}\n\t\treturn tokens\n\t}\n\n\texistingNames(): ReadonlySet<string> {\n\t\treturn new Set(this.tokenNames.values())\n\t}\n\n\tnameForNode(node: ColorStyleTokenNode): string | undefined {\n\t\treturn this.tokenNames.get(node.id)\n\t}\n}\n", "import type { AnyComponentLoader, VerifiedControlDescription } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { GlobalModuleId, ModuleExportIdentifier, ModuleExportIdentifierString } from \"@framerjs/shared\"\nimport {\n\tassert,\n\tModuleType,\n\tasGlobalId,\n\texternalModuleIdentifier,\n\tinvertMap,\n\tisExternalModuleIdentifier,\n\tisModuleExportIdentifier,\n\tparseModuleIdentifier,\n} from \"@framerjs/shared\"\nimport { type FramerVectorSetInfo, isFramerVectorSetInfo } from \"code-generation/utils/annotations.ts\"\nimport { vectorSetItems } from \"document/components/chrome/insertSidebar/dataSources/items/vectorSetItems.ts\"\nimport type { VectorsDataSourceItem } from \"document/components/chrome/insertSidebar/types.ts\"\nimport type { CanvasTree } from \"document/models/CanvasTree/index.ts\"\nimport { ExternalModulesListNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport { isExternalModuleNode, isVectorSetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { VectorSetItemVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { prefixControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport type { VectorsStore } from \"document/stores/VectorsStore.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport type { Size } from \"library/index.ts\"\nimport { type ControlDescription, ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { parseModuleAnnotations } from \"modules/utils.ts\"\nimport { join } from \"utils/join.ts\"\nimport { isNumber } from \"utils/typeChecks.ts\"\nimport {\n\ttype VectorSetListItem,\n\texternalVectorSetInfo,\n\tinfoForVariableCreate,\n\titemsForIdentifier,\n\tlocalVectorSetInfo,\n\tvectorInfoForIdentifier,\n\tvectorSetIdentifierForGlobalModuleId,\n\tvectorSetIdentifierForVectorInfo,\n\tvectorSetInfoForIdentifier,\n} from \"utils/vectorSets.ts\"\nimport type { BaseControlsDefinition, ControlsHandle } from \"./controlDefinitions.ts\"\nimport { buildControlDefinitions, getVectorControlsHandle } from \"./controlDefinitions.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\n\ntype VectorSetName = string\ntype IconName = string\n\nexport interface VectorControl {\n\ttype: ControlType | \"icon\"\n\toptions?: (string | undefined)[]\n}\n\nexport interface VectorSetDefinition extends BaseControlsDefinition<VectorControl> {\n\ticons: Map<IconName, ModuleExportIdentifierString>\n\tproperties: Record<string, ControlDescription | undefined>\n\tsent?: boolean\n\tintrinsicSize: Size\n}\n\nfunction first<K extends string, V>(object: Record<K, V>): V | undefined {\n\tfor (const key in object) return object[key]\n}\n\ninterface Vector {\n\tname: string\n\tsetName: string\n}\n\ninterface VectorSetHandle {\n\tname: string\n\tcontrols: ControlsHandle\n\tgetName: (identifier?: ModuleExportIdentifierString) => string | undefined\n\tgetIdentifierByName: (name: string) => ModuleExportIdentifierString | undefined\n}\n\ninterface VectorSetDefinitionJSON {\n\tcontrols: Record<string, VectorControl | undefined>\n\tcontrolPropKeysByControlName: Record<string, string>\n\ticons: Record<IconName, ModuleExportIdentifierString>\n\tproperties: Record<string, ControlDescription | undefined>\n\tintrinsicSize?: Size\n}\n\nexport interface VectorSetsJSON {\n\tdefinitions: Record<VectorSetName, VectorSetDefinitionJSON>\n\tvectorSetNamesByModuleId: Record<GlobalModuleId, VectorSetName>\n\tvectorsByIdentifier: Record<ModuleExportIdentifierString, Vector>\n}\n\nconst hiddenVectorSets: Pick<VectorsDataSourceItem, \"title\" | \"vectorSetModuleId\">[] = [\n\t{\n\t\ttitle: \"Logos\",\n\t\tvectorSetModuleId: \"rTgCpOIUH6tdiqNh47fL\",\n\t},\n]\n\nconst insertSidebarGlobalModuleIds = [...vectorSetItems, ...hiddenVectorSets].reduce((acc, item) => {\n\treturn acc.add(asGlobalId(item.vectorSetModuleId))\n}, new Set<GlobalModuleId>())\n\nexport class VectorSets {\n\tstatic iconSetDefinitionTag = metadataTags.iconSetDefinition\n\tstatic availableSetsMetadataTag = metadataTags.availableIconSets\n\tprivate vectorSetModuleIdsByName: Map<string, GlobalModuleId>\n\tprivate localVectorSetModuleIds: Set<GlobalModuleId>\n\n\tconstructor(\n\t\tprivate readonly definitions: Map<VectorSetName, VectorSetDefinition>,\n\t\tprivate readonly vectorSetNamesByModuleId: Map<GlobalModuleId, VectorSetName>,\n\t\tprivate readonly vectorsByIdentifier: Map<ModuleExportIdentifierString, Vector>,\n\t\tprivate readonly treeStore?: TreeStore,\n\t\tprivate readonly modulesStore?: ModulesStore,\n\t\tprivate readonly vectorsStore?: VectorsStore,\n\t\tprivate readonly componentLoader?: AnyComponentLoader,\n\t) {\n\t\tthis.vectorSetModuleIdsByName = invertMap(vectorSetNamesByModuleId)\n\n\t\t// When the class is instantiated with definitions, assume they are sets in the project.\n\t\tthis.localVectorSetModuleIds = new Set()\n\t\tfor (const name of definitions.keys()) {\n\t\t\tconst id = this.vectorSetModuleIdsByName.get(name)\n\t\t\tif (!id) continue\n\t\t\tthis.localVectorSetModuleIds.add(asGlobalId(id))\n\t\t}\n\t}\n\n\tprivate async addSetDefinition(\n\t\tidentifier: ModuleExportIdentifier,\n\t\tvectorSetInfo: FramerVectorSetInfo,\n\t\tgetHandle: () => VectorSetHandle | undefined,\n\t): Promise<VectorSetHandle | undefined> {\n\t\tconst tree = this.treeStore?.tree\n\t\tassert(tree, \"Tree is required\")\n\t\tassert(this.modulesStore, \"ModulesStore is required\")\n\t\tassert(this.vectorsStore, \"VectorsStore is required\")\n\t\tassert(this.componentLoader, \"ComponentLoader is required\")\n\n\t\tconst moduleId: GlobalModuleId = isExternalModuleIdentifier(identifier)\n\t\t\t? identifier.moduleId\n\t\t\t: this.modulesStore.forType(ModuleType.VectorSet).getByLocalId(identifier.localId).id\n\n\t\tconst definition = await buildVectorSetDefinition(\n\t\t\titemsForIdentifier(identifier, vectorSetInfo, tree, this.modulesStore, this.vectorsStore),\n\t\t\tthis.modulesStore,\n\t\t\ttree,\n\t\t\tthis.componentLoader,\n\t\t)\n\t\tif (!definition) return\n\n\t\tconst setName = this.vectorSetNamesByModuleId.get(moduleId)\n\t\tif (!setName) return\n\n\t\t// Merge new definitions into existing ones\n\t\tthis.definitions.set(setName, definition)\n\n\t\tfor (const [iconName, itemIdentifier] of definition.icons) {\n\t\t\tthis.vectorsByIdentifier.set(itemIdentifier, { name: iconName, setName })\n\t\t}\n\n\t\treturn getHandle()\n\t}\n\n\t/**\n\t * Insert a vector into the project, optionally adding the set to the project if it's not already\n\t * there.\n\t */\n\tpublic async insert(setName: string, iconName?: string): Promise<ModuleExportIdentifierString | undefined> {\n\t\tassert(this.modulesStore, \"ModulesStore is required\")\n\n\t\tconst moduleId = this.vectorSetModuleIdsByName.get(setName)\n\t\tif (!moduleId) return\n\n\t\t// If the set is not already in the project, add it to the project.\n\t\tif (\n\t\t\t!this.modulesStore.getPersistedModuleByGlobalId(moduleId) &&\n\t\t\t!this.treeStore?.tree?.getNodeWithTrait(moduleId, isExternalModuleNode)\n\t\t) {\n\t\t\tawait this.modulesStore.addOrUpdateVectorSetAndVectors({ moduleId, saveId: \"\" })\n\t\t}\n\n\t\tconst handle = await this.ensureSetHandle(setName, moduleId)\n\t\tif (!handle) return\n\n\t\tconst definition = this.definitions.get(handle.name)\n\t\tconst resolvedIconName = iconName ?? definition?.icons.keys().next().value\n\t\tif (!resolvedIconName) return\n\n\t\treturn handle.getIdentifierByName(resolvedIconName)\n\t}\n\n\tpublic async insertForVariable(\n\t\tsetName: string,\n\t\ticonName?: string,\n\t): Promise<Pick<VectorSetItemVariableDefinition, \"initialValue\" | \"setModuleId\">> {\n\t\tconst tree = this.treeStore?.tree\n\t\tassert(tree, \"Tree is required\")\n\t\tassert(this.modulesStore, \"ModulesStore is required\")\n\n\t\tconst handle = await this.ensureSetHandle(setName)\n\t\tconst definition = handle && this.definitions.get(handle.name)\n\t\tassert(handle && definition, `Icon set \"${setName}\" not found.`)\n\t\tassert(definition.icons.size > 0, `Icon set \"${handle.name}\" does not contain any icons.`)\n\n\t\tconst resolvedIconName = iconName ?? definition.icons.keys().next().value\n\t\tassert(resolvedIconName, `Icon set \"${handle.name}\" does not contain any icons.`)\n\n\t\tconst identifier = await this.insert(handle.name, resolvedIconName)\n\t\tassert(identifier, `Icon \"${resolvedIconName}\" not found in set \"${handle.name}\".`)\n\n\t\tconst resolved = infoForVariableCreate(identifier, tree, this.modulesStore)\n\t\tassert(resolved, `Icon \"${resolvedIconName}\" could not be prepared as a variable from set \"${handle.name}\".`)\n\n\t\treturn resolved\n\t}\n\n\tprivate async ensureSetHandle(setName: string, moduleId?: GlobalModuleId): Promise<VectorSetHandle | undefined> {\n\t\tconst resolvedModuleId = moduleId ?? this.vectorSetModuleIdsByName.get(setName)\n\t\tif (!resolvedModuleId) return\n\n\t\tconst cachedHandle = this.forModuleId(resolvedModuleId)\n\t\tif (cachedHandle) return cachedHandle\n\n\t\tconst loadedHandle = await this.async.forModuleId(resolvedModuleId)\n\t\tif (loadedHandle) return loadedHandle\n\n\t\treturn this.createInsertSidebarDefinition(setName, resolvedModuleId)\n\t}\n\n\tpublic forSet(setName: string, instanceIdentifier?: ModuleExportIdentifierString): VectorSetHandle | undefined {\n\t\tconst set = this.definitions.get(setName)\n\t\tif (!set) return\n\n\t\treturn {\n\t\t\tname: setName,\n\t\t\tgetName: (identifier?: ModuleExportIdentifierString) => {\n\t\t\t\tconst id = identifier ?? instanceIdentifier\n\t\t\t\tif (!id) return\n\t\t\t\treturn this.vectorsByIdentifier.get(id)?.name\n\t\t\t},\n\t\t\tgetIdentifierByName: (name: string) => set.icons.get(name),\n\t\t\tcontrols: getVectorControlsHandle(set),\n\t\t}\n\t}\n\n\tpublic forInstanceIdentifier(identifier: ModuleExportIdentifierString) {\n\t\tconst vector = this.vectorsByIdentifier.get(identifier)\n\t\tif (!vector) return\n\n\t\treturn this.forSet(vector.setName, identifier)\n\t}\n\n\tpublic forModuleId(moduleId: GlobalModuleId) {\n\t\tconst setName = this.vectorSetNamesByModuleId.get(moduleId)\n\t\tif (!setName) return\n\t\treturn this.forSet(setName)\n\t}\n\n\t/**\n\t * Async wrappers of synchronous class methods for accessing vector sets that may not have been\n\t * loaded yet. Loading an unloaded set prepares a definition that will be provided to the LLM in\n\t * the next request as a context message.\n\t */\n\tpublic async = {\n\t\tforInstanceIdentifier: async (identifier: ModuleExportIdentifierString): Promise<VectorSetHandle | undefined> => {\n\t\t\t// If the vector has already been loaded, return the existing handle.\n\t\t\tif (this.vectorsByIdentifier.has(identifier)) return this.forInstanceIdentifier(identifier)\n\n\t\t\tconst tree = this.treeStore?.tree\n\t\t\tassert(tree, \"Tree is required\")\n\t\t\tassert(this.modulesStore, \"ModulesStore is required\")\n\n\t\t\tawait this.modulesStore.whenInitialized()\n\n\t\t\t// Otherwise work out the vector set identifier from the instance identifier.\n\t\t\tconst vectorInfo = vectorInfoForIdentifier(parseModuleIdentifier(identifier), tree, this.modulesStore)\n\t\t\tif (!vectorInfo) return\n\n\t\t\tconst setIdentifier = vectorSetIdentifierForVectorInfo(vectorInfo, tree, this.modulesStore)\n\t\t\tif (!setIdentifier) return\n\n\t\t\tconst parsed = parseModuleIdentifier(setIdentifier)\n\t\t\tconst info = vectorSetInfoForIdentifier(parsed, vectorInfo, tree, this.modulesStore)\n\t\t\tif (!info) return\n\n\t\t\t// Add the entire set definition to the context, returning the handle.\n\t\t\treturn this.addSetDefinition(parsed, info, () => this.forInstanceIdentifier(identifier))\n\t\t},\n\t\tforModuleId: async (moduleId: GlobalModuleId): Promise<VectorSetHandle | undefined> => {\n\t\t\t// If we have already created a definition for this set, return the existing handle.\n\t\t\tconst name = this.vectorSetNamesByModuleId.get(moduleId)\n\t\t\tconst definition = name && this.definitions.get(name)\n\t\t\tif (definition) return this.forModuleId(moduleId)\n\n\t\t\tconst tree = this.treeStore?.tree\n\t\t\tassert(tree, \"Tree is required\")\n\t\t\tassert(this.modulesStore, \"ModulesStore is required\")\n\n\t\t\tawait this.modulesStore.whenInitialized()\n\n\t\t\tconst setIdentifier = vectorSetIdentifierForGlobalModuleId(moduleId, tree, this.modulesStore)\n\t\t\tif (!setIdentifier) return\n\n\t\t\tconst parsed = parseModuleIdentifier(setIdentifier)\n\t\t\tconst info = isExternalModuleIdentifier(parsed)\n\t\t\t\t? externalVectorSetInfo(tree, moduleId)\n\t\t\t\t: localVectorSetInfo(this.modulesStore, parsed.localId)\n\n\t\t\tif (!info) return\n\n\t\t\t// Add the entire set definition to the context, returning the handle.\n\t\t\treturn this.addSetDefinition(parsed, info, () => this.forModuleId(moduleId))\n\t\t},\n\t}\n\n\t/** For the mock component loader used for example/recipe bundling */\n\tpublic getPropertiesForIdentifier(\n\t\tidentifier: ModuleExportIdentifierString,\n\t): Record<string, ControlDescription | undefined> | undefined {\n\t\tconst vector = this.vectorsByIdentifier.get(identifier)\n\t\tif (!vector) return\n\t\tconst def = this.definitions.get(vector.setName)\n\t\treturn def?.properties\n\t}\n\n\t/**\n\t * Analyze the document and create a context message that tells the LLM which sets are already\n\t * being used in the project, as well as the sets that are available to add to the project from\n\t * insert.\n\t */\n\tpublic availableVectorSetsPrompt(): string {\n\t\tconst projectIconSetNames = new Set<string>()\n\t\tconst insertIconSetNames = new Set<string>()\n\t\tconst tree = this.treeStore?.tree\n\t\t// Categorize the sets by whether they are in the project or can be added from insert.\n\t\tfor (const [id, name] of this.vectorSetNamesByModuleId) {\n\t\t\tif (\n\t\t\t\tthis.modulesStore?.getPersistedModuleByGlobalId(id) ||\n\t\t\t\ttree?.getNodeWithTrait(id, isExternalModuleNode) ||\n\t\t\t\tthis.localVectorSetModuleIds.has(id)\n\t\t\t) {\n\t\t\t\tprojectIconSetNames.add(name)\n\t\t\t} else {\n\t\t\t\tinsertIconSetNames.add(name)\n\t\t\t}\n\t\t}\n\n\t\treturn join.lines(\n\t\t\t`<${VectorSets.availableSetsMetadataTag}>`,\n\t\t\t`### Current Site Icon Set Names`,\n\t\t\tJSON.stringify(Array.from(projectIconSetNames)),\n\t\t\t`### Additionally Available Icon Set Names`,\n\t\t\tJSON.stringify(Array.from(insertIconSetNames)),\n\t\t\t`</${VectorSets.availableSetsMetadataTag}>`,\n\t\t)\n\t}\n\n\tprivate createCompleteIconSetsMessage(setName: string, controls: Record<string, VectorControl | undefined>): string {\n\t\treturn join.lines(\n\t\t\t`<${VectorSets.iconSetDefinitionTag} name=\"${setName}\">`,\n\t\t\tJSON.stringify({ controls }),\n\t\t\t`</${VectorSets.iconSetDefinitionTag}>`,\n\t\t)\n\t}\n\n\t/**\n\t * Create a context message with complete icon set definitions for the current selection that\n\t * haven't been seen by the llm yet.\n\t */\n\tpublic iconSetsFromSelectionPrompt(): string[] {\n\t\tconst messages: string[] = []\n\n\t\tfor (const [name, def] of this.definitions) {\n\t\t\tif (def.sent) continue\n\t\t\tdef.sent = true\n\n\t\t\tmessages.push(this.createCompleteIconSetsMessage(name, def.controls))\n\t\t}\n\n\t\treturn messages\n\t}\n\n\t/**\n\t * Ensure the full icon set definition has been built locally so vector traits can resolve icon\n\t * names without implying that the definition was already delivered to the LLM.\n\t */\n\tpublic async ensureSetDefinition(setName: string): Promise<Record<string, VectorControl | undefined> | undefined> {\n\t\tconst definition = this.definitions.get(setName)\n\t\tif (definition) return definition.controls\n\n\t\tassert(this.treeStore?.tree, \"Tree is required\")\n\t\tassert(this.modulesStore, \"ModulesStore is required\")\n\t\tassert(this.vectorsStore, \"VectorsStore is required\")\n\t\tassert(this.componentLoader, \"ComponentLoader is required\")\n\n\t\tconst moduleId = this.vectorSetModuleIdsByName.get(setName)\n\t\tif (!moduleId) return\n\n\t\t// Await a handle to a set, we don't need the handle, but we do need to ensure the handle was\n\t\t// created successfully to know we can read the raw definition it created.\n\t\tconst handle = await this.ensureSetHandle(setName, moduleId)\n\t\tif (!handle) return\n\n\t\treturn this.definitions.get(setName)?.controls\n\t}\n\n\t/**\n\t * An agent can tool call to request complete icon set definition set name, for\n\t * example when creating from scratch.\n\t */\n\tpublic async requestCompleteSetDefinition(\n\t\tsetName: string,\n\t): Promise<Record<string, VectorControl | undefined> | undefined> {\n\t\tconst controls = await this.ensureSetDefinition(setName)\n\t\tif (!controls) return\n\n\t\tconst definition = this.definitions.get(setName)\n\t\tif (definition) definition.sent = true\n\n\t\treturn controls\n\t}\n\n\tprivate async createInsertSidebarDefinition(\n\t\tsetName: string,\n\t\tmoduleId: GlobalModuleId,\n\t): Promise<VectorSetHandle | undefined> {\n\t\tif (!insertSidebarGlobalModuleIds.has(moduleId)) return\n\n\t\tconst tree = this.treeStore?.tree\n\t\tassert(tree, \"Tree is required\")\n\t\tassert(this.modulesStore, \"ModulesStore is required\")\n\t\tassert(this.componentLoader, \"ComponentLoader is required\")\n\n\t\t// If the module is already in the project, create and return a handle based on the tree\n\t\t// annotations.\n\t\tconst externalModuleNode = tree.getNodeWithTrait(moduleId, isExternalModuleNode)\n\t\tif (externalModuleNode) return this.async.forModuleId(moduleId)\n\n\t\tconst { module } = await this.modulesStore.lookUpModule({ moduleId, saveId: \"\" })\n\t\tassert(module.files.module, \"Module must be defined\")\n\t\tconst identifier = externalModuleIdentifier(moduleId, module.saveId, module.files.module, \"default\")\n\n\t\t// If the module is not already in the project, preload and evaluate it. If the module was in\n\t\t// the project this would not return a result and throw.\n\t\tconst [result] = await this.modulesStore.preloadExternalModules([identifier])\n\t\tassert(result, \"Result must be defined\")\n\n\t\tconst rawAnnotations = this.componentLoader.componentForIdentifier(identifier.value)?.annotations\n\t\tif (!rawAnnotations) return\n\n\t\tconst info = parseModuleAnnotations({ [identifier.value]: rawAnnotations })?.[identifier.value]?.[\n\t\t\tAnnotationKey.FramerVectorSet\n\t\t]\n\t\tif (!isFramerVectorSetInfo(info)) return\n\n\t\tconst items: Record<ModuleExportIdentifierString, VectorSetListItem> = {}\n\t\tfor (const item of info.items) {\n\t\t\tassert(item.saveId, \"Save id must be defined in an Insert Sidebar Vector Set\")\n\n\t\t\tconst moduleIdentifier = externalModuleIdentifier(item.moduleId, item.saveId, `${item.id}.js`, \"default\").value\n\n\t\t\titems[moduleIdentifier] = {\n\t\t\t\tname: item.name,\n\t\t\t\tmoduleId: item.moduleId,\n\t\t\t\tmoduleIdentifier,\n\t\t\t\tsaveId: item.saveId,\n\t\t\t}\n\t\t}\n\n\t\tconst definition = await buildVectorSetDefinition(items, this.modulesStore, tree, this.componentLoader)\n\t\tif (!definition) return\n\n\t\t// Create a new definition for the insert sidebar vector set.\n\t\tthis.definitions.set(setName, definition)\n\n\t\tfor (const [iconName, itemIdentifier] of definition.icons) {\n\t\t\tthis.vectorsByIdentifier.set(itemIdentifier, { name: iconName, setName })\n\t\t}\n\n\t\t// Return the handle.\n\t\treturn this.forModuleId(moduleId)\n\t}\n\n\ttoJSON(): VectorSetsJSON {\n\t\tconst definitions: Record<VectorSetName, VectorSetDefinitionJSON> = {}\n\t\tfor (const [name, def] of this.definitions) {\n\t\t\tconst icons: Record<IconName, ModuleExportIdentifierString> = {}\n\t\t\tfor (const [iconName, identifier] of def.icons) {\n\t\t\t\ticons[iconName] = identifier\n\t\t\t}\n\t\t\tconst controlPropKeysByControlName: Record<string, string> = {}\n\t\t\tfor (const [controlName, controlKey] of def.controlPropKeysByControlName) {\n\t\t\t\tcontrolPropKeysByControlName[controlName] = controlKey\n\t\t\t}\n\t\t\tdefinitions[name] = {\n\t\t\t\tcontrols: def.controls,\n\t\t\t\tcontrolPropKeysByControlName,\n\t\t\t\ticons,\n\t\t\t\tproperties: def.properties,\n\t\t\t}\n\t\t}\n\n\t\tconst vectorSetNamesByModuleId: Record<GlobalModuleId, VectorSetName> = {}\n\t\tfor (const [moduleId, name] of this.vectorSetNamesByModuleId) {\n\t\t\tvectorSetNamesByModuleId[moduleId] = name\n\t\t}\n\n\t\tconst vectorsByIdentifier: Record<ModuleExportIdentifierString, Vector> = {}\n\t\tfor (const [identifier, vector] of this.vectorsByIdentifier) {\n\t\t\tvectorsByIdentifier[identifier] = vector\n\t\t}\n\n\t\treturn { definitions, vectorSetNamesByModuleId, vectorsByIdentifier }\n\t}\n\n\tstatic fromJSON(json: VectorSetsJSON): VectorSets {\n\t\tconst definitions = new Map<VectorSetName, VectorSetDefinition>()\n\t\tfor (const [name, def] of Object.entries(json.definitions)) {\n\t\t\tconst icons = new Map<IconName, ModuleExportIdentifierString>()\n\t\t\tfor (const [iconName, identifier] of Object.entries(def.icons)) {\n\t\t\t\ticons.set(iconName, identifier)\n\t\t\t}\n\t\t\tconst controlPropKeysByControlName = new Map<string, string>()\n\t\t\tfor (const [controlName, controlKey] of Object.entries(def.controlPropKeysByControlName)) {\n\t\t\t\tcontrolPropKeysByControlName.set(controlName, controlKey)\n\t\t\t}\n\t\t\tdefinitions.set(name, {\n\t\t\t\tcontrols: def.controls,\n\t\t\t\tcontrolPropKeysByControlName,\n\t\t\t\tcontrolPropNamesByKeys: invertMap(controlPropKeysByControlName),\n\t\t\t\ticons,\n\t\t\t\tproperties: def.properties,\n\t\t\t\tintrinsicSize: def.intrinsicSize || defaultIntrinsicSize,\n\t\t\t})\n\t\t}\n\n\t\tconst vectorSetNamesByModuleId = new Map<GlobalModuleId, VectorSetName>()\n\t\tfor (const [moduleId, name] of Object.entries(json.vectorSetNamesByModuleId)) {\n\t\t\tvectorSetNamesByModuleId.set(moduleId as GlobalModuleId, name)\n\t\t}\n\n\t\tconst vectorsByIdentifier = new Map<ModuleExportIdentifierString, Vector>()\n\t\tfor (const [identifier, vector] of Object.entries(json.vectorsByIdentifier)) {\n\t\t\tvectorsByIdentifier.set(identifier as ModuleExportIdentifierString, vector)\n\t\t}\n\n\t\treturn new VectorSets(\n\t\t\tdefinitions,\n\t\t\tvectorSetNamesByModuleId,\n\t\t\tvectorsByIdentifier,\n\t\t\t// Not needed for deserialization.\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t\tundefined,\n\t\t)\n\t}\n\n\t/**\n\t * Instantiate a VectorSet instance from the tree, recording the available sets and creating a\n\t * mapping of unique set names to global module ids.\n\t *\n\t * Subsequent requests for more vector info will use the unique names as keys.\n\t */\n\tstatic async fromTree(\n\t\ttreeStore: TreeStore,\n\t\tmodulesStore: ModulesStore,\n\t\tvectorsStore: VectorsStore,\n\t\tcomponentLoader: AnyComponentLoader,\n\t): Promise<VectorSets> {\n\t\tconst tree = treeStore.tree\n\t\tassert(tree, \"Tree is required\")\n\t\tassert(modulesStore, \"ModulesStore is required\")\n\n\t\tconst processedModuleIds = new Set<GlobalModuleId>()\n\t\tconst names = new Set<string>()\n\n\t\tconst availableSetNameToModuleId = new Map<string, GlobalModuleId>()\n\n\t\t// Local Vector Sets\n\t\tfor (const child of tree.root.children) {\n\t\t\tif (!isVectorSetNode(child)) continue\n\t\t\tconst identifier = parseModuleIdentifier(child.instanceIdentifier)\n\t\t\tif (!isModuleExportIdentifier(identifier)) continue\n\n\t\t\tconst info = localVectorSetInfo(modulesStore, identifier.localId)\n\t\t\tif (!info?.name) continue\n\n\t\t\tconst uniqueNameValue = uniqueName(info.name, names)\n\t\t\tnames.add(uniqueNameValue)\n\t\t\tavailableSetNameToModuleId.set(\n\t\t\t\tuniqueNameValue,\n\t\t\t\tmodulesStore.forType(ModuleType.VectorSet).getByLocalId(identifier.localId).id,\n\t\t\t)\n\t\t}\n\n\t\t// External Vector Sets\n\t\tconst externalModules = ExternalModulesListNode.getModuleNodes(tree)\n\t\tfor (const child of externalModules) {\n\t\t\tif (child.type !== ModuleType.VectorSet) continue\n\t\t\tconst moduleId = asGlobalId(child.id)\n\t\t\tprocessedModuleIds.add(moduleId)\n\n\t\t\tconst info = externalVectorSetInfo(tree, moduleId)\n\t\t\tif (!info?.name) continue\n\n\t\t\tconst uniqueNameValue = uniqueName(info.name, names)\n\t\t\tnames.add(uniqueNameValue)\n\t\t\tavailableSetNameToModuleId.set(uniqueNameValue, moduleId)\n\t\t}\n\n\t\t// Insert Sidebar Vector Sets\n\t\tfor (const item of [...vectorSetItems, ...hiddenVectorSets]) {\n\t\t\tconst moduleId = asGlobalId(item.vectorSetModuleId)\n\t\t\t// Skip if we've already encountered this external vector set, don't list `Lucide` twice if\n\t\t\t// the user has already added it to their project.\n\t\t\tif (processedModuleIds.has(moduleId)) continue\n\n\t\t\tconst uniqueNameValue = uniqueName(item.title, names)\n\t\t\tnames.add(uniqueNameValue)\n\t\t\tavailableSetNameToModuleId.set(uniqueNameValue, moduleId)\n\t\t}\n\n\t\treturn new VectorSets(\n\t\t\tnew Map(),\n\t\t\tinvertMap(availableSetNameToModuleId),\n\t\t\tnew Map(),\n\t\t\ttreeStore,\n\t\t\tmodulesStore,\n\t\t\tvectorsStore,\n\t\t\tcomponentLoader,\n\t\t)\n\t}\n}\n\nasync function buildVectorSetDefinition(\n\titems: Record<ModuleExportIdentifierString, VectorSetListItem>,\n\tmodulesStore: ModulesStore,\n\ttree: CanvasTree,\n\tcomponentLoader: AnyComponentLoader,\n): Promise<VectorSetDefinition | undefined> {\n\tconst icons = new Map<IconName, ModuleExportIdentifierString>()\n\n\tfor (const itemIdentifier in items) {\n\t\tif (!isModuleExportIdentifier(itemIdentifier)) continue\n\t\tconst item = items[itemIdentifier]\n\t\tassert(item, \"Item must be defined\")\n\t\ticons.set(item.name, itemIdentifier)\n\t}\n\n\tconst instance = first(items)\n\tif (!instance) return\n\n\t// The first instance may not be evaluated yet, so we need to preload the external\n\t// module to ensure we can extract controls.\n\tconst parsedInstanceIdentifier = parseModuleIdentifier(instance.moduleIdentifier)\n\tif (isExternalModuleIdentifier(parsedInstanceIdentifier)) {\n\t\ttry {\n\t\t\tawait modulesStore.preloadExternalModules([parsedInstanceIdentifier])\n\t\t} catch {\n\t\t\t// Swallow this error. If the module cannot be preloaded we will early return if it's not\n\t\t\t// already in the component loader.\n\t\t}\n\t}\n\n\tconst properties = componentLoader.componentForIdentifier(instance.moduleIdentifier)?.properties\n\tif (!properties) return\n\n\tconst { controls, ...baseDefinition } = await buildControlDefinitions<VectorControl, VerifiedControlDescription>(\n\t\tproperties,\n\t\tasync (_prefixedTitle, control) => {\n\t\t\tassert(\n\t\t\t\tcontrol.type === ControlType.Color ||\n\t\t\t\t\tcontrol.type === ControlType.Number ||\n\t\t\t\t\tcontrol.type === ControlType.Boolean ||\n\t\t\t\t\tcontrol.type === ControlType.String,\n\t\t\t\t\"Icons support only a subset of controls\",\n\t\t\t)\n\t\t\treturn { type: control.type, defaultValue: control.defaultValue }\n\t\t},\n\t)\n\n\tcontrols[prefixControlPropKey(\"icon\")] = { type: \"icon\", options: Array.from(icons.keys()) }\n\n\treturn {\n\t\t...baseDefinition,\n\t\tcontrols,\n\t\ticons,\n\t\t// Snapshot the properties of the first instance, this allows insertion of\n\t\t// unevaluated external vectors to set their controls.\n\t\tproperties,\n\t\tintrinsicSize: getIntrinsicSize(parsedInstanceIdentifier, tree, modulesStore),\n\t}\n}\n\nconst defaultIntrinsicSize: Size = { width: 24, height: 24 }\n\nfunction getIntrinsicSize(identifier: ModuleExportIdentifier, tree: CanvasTree, modulesStore: ModulesStore): Size {\n\tif (isExternalModuleIdentifier(identifier)) {\n\t\tconst node = tree.getNodeWithTrait(identifier.moduleId, isExternalModuleNode)\n\t\tif (!node) return defaultIntrinsicSize\n\n\t\treturn sizeFromAnnotations(\n\t\t\tnode.annotation(AnnotationKey.FramerIntrinsicWidth),\n\t\t\tnode.annotation(AnnotationKey.FramerIntrinsicHeight),\n\t\t)\n\t}\n\n\tconst module = modulesStore.forType(ModuleType.VectorSet).getByLocalId(identifier.localId)\n\tif (!module) return defaultIntrinsicSize\n\n\tconst annotations = module.annotations(null, \"default\")\n\tif (!annotations) return defaultIntrinsicSize\n\n\treturn sizeFromAnnotations(\n\t\tannotations[AnnotationKey.FramerIntrinsicWidth],\n\t\tannotations[AnnotationKey.FramerIntrinsicHeight],\n\t)\n}\n\nfunction sizeFromAnnotations(width: unknown, height: unknown): Size {\n\tif (!isNumber(width) || !isNumber(height)) return defaultIntrinsicSize\n\treturn { width, height }\n}\n", "import { isErrorDefinition, type AnyComponentLoader } from \"@framerjs/framer-runtime\"\nimport { assert, assertNever, isEmptyObject, parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { AgentAttachmentFile, AgentAttachmentImage } from \"app/agent/attachments.ts\"\nimport type { SelectionForContext } from \"app/ai/agents/Agent.ts\"\nimport { createSelectedNodesContextMessage } from \"app/ai/agents/context/nodes.ts\"\nimport type { Source } from \"app/ai/agents/source.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { BaseEngineScheduler } from \"document/base-engine/BaseEngine.ts\"\nimport type { Changeset } from \"document/models/CanvasTree/Changeset.ts\"\nimport { type CanvasTree, FrameNode, type ScopeNode, WebPageNode } from \"document/models/CanvasTree/index.ts\"\nimport { type NodeID, randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isLayoutTemplateNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Loaded } from \"document/models/CanvasTree/traits/WithScopeLoader.ts\"\nimport type { CodeGenerationStore } from \"document/stores/CodeGenerationStore.ts\"\nimport type { FormsStore } from \"document/stores/FormsStore.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport type { SessionStore } from \"document/stores/SessionStore.ts\"\nimport type { TreeStore } from \"document/stores/TreeStore.ts\"\nimport type { VectorsStore } from \"document/stores/VectorsStore.ts\"\nimport { createUnusedObject } from \"utils/createUnusedObject.ts\"\nimport { BatchAssetUploader } from \"web/lib/BatchAssetUploader.ts\"\nimport type { API } from \"web/pages/project/lib/useAPI.ts\"\nimport { TreeResolver } from \"../TreeResolver.ts\"\nimport { cloneChecklistRuntimeState, type ChecklistRuntimeState, createChecklistStore } from \"../tools/checklist.ts\"\nimport {\n\tcreateNodeByIdCursorStore,\n\ttype NodeByIdCursorStore,\n\ttype NodeByIdCursorStoreState,\n\tcreateNodeByIdCursorStoreState,\n} from \"../tools/nodeById/cursorStore.ts\"\nimport { createMockFormsStore, createMockScheduler, createMockTreeStore } from \"../traits/types.ts\"\nimport {\n\ttype ActiveCodeFile,\n\tcreateActiveViewContextMessage,\n\tcreateAdditionalContextMessage,\n} from \"./additionalContextMessage.ts\"\nimport { Collections, type CmsSelectionGroupByCollection } from \"./collections.ts\"\nimport { Components } from \"./components.ts\"\nimport { DeferredOps } from \"./deferred.ts\"\nimport { DynamicValues } from \"./dynamicValues.ts\"\nimport { Examples } from \"./examples.ts\"\nimport { Files } from \"./files.ts\"\nimport type { AIFontFamily } from \"./fonts.ts\"\nimport { prepareFontsContext, serializeFontsForContext } from \"./fonts.ts\"\nimport { Forms } from \"./forms.ts\"\nimport { AgentIssues } from \"./issues.ts\"\nimport { LayoutTemplates } from \"./layoutTemplates.ts\"\nimport { metadataTags } from \"./metadataTags.ts\"\nimport { NodeAttributeChanges } from \"./nodeAttributeChanges.ts\"\nimport { formatRenamedIds, type RenamedIds } from \"./renamedIds.ts\"\nimport { VirtualText } from \"./richtext/virtualText.ts\"\nimport { Shaders } from \"./shaders.ts\"\nimport { StylePresets } from \"./stylePresets.ts\"\nimport { Tokens } from \"./tokens.ts\"\nimport { createTurnChangeset, type TurnChangesetState } from \"./turnChangeset.ts\"\nimport { VectorSets } from \"./vectors.ts\"\n\n/** No-op hooks for testing and serialization contexts where engine is not available */\nconst noopHooks: AgentContextHooks = {\n\tgetEngine: () => undefined,\n}\n\nfunction* emptyIterateFiles(): Iterable<AgentAttachmentFile> {}\n\nfunction shouldWaitForComponentDefinitions(modulesStore: ModulesStore): boolean {\n\treturn !modulesStore.usesNoopExternalModuleEvaluation()\n}\n\nexport interface AgentContextHooks {\n\tgetEngine: () => VekterEngine | undefined\n}\n\nexport interface SystemState {\n\tguides?: string\n\trenamedIds?: RenamedIds\n}\n\nexport interface ContextRuntimeState {\n\treadonly scriptDataByKey: readonly (readonly [string, string])[]\n\treadonly checklist?: ChecklistRuntimeState\n}\n\nexport function cloneContextRuntimeState(state: ContextRuntimeState): ContextRuntimeState {\n\tconst scriptDataByKey: [string, string][] = []\n\tfor (const [key, value] of state.scriptDataByKey) {\n\t\tscriptDataByKey.push([key, value])\n\t}\n\tconst checklist = cloneChecklistRuntimeState(state.checklist)\n\treturn {\n\t\tscriptDataByKey,\n\t\t...(checklist ? { checklist } : {}),\n\t}\n}\n\nconst systemStateKeys: (keyof SystemState)[] = [\"guides\", \"renamedIds\"]\n\nexport interface AgentContextDependencies {\n\ttreeStore: TreeStore\n\tmodulesStore: ModulesStore\n\tvectorsStore: VectorsStore\n\tformsStore: FormsStore\n\tsessionStore: SessionStore\n\tscheduler: BaseEngineScheduler\n\tcomponentLoader: AnyComponentLoader\n\tcodeGenerationStore: CodeGenerationStore\n\thooks: AgentContextHooks\n\tsource: Source\n\tprojectId: string\n\tapi?: API\n}\n\nexport class AgentContext {\n\tstatic async init(\n\t\tdependencies: AgentContextDependencies,\n\t\tscopeNode: Loaded<ScopeNode>,\n\t\tnodeByIdCursorStoreState: NodeByIdCursorStoreState,\n\t\tuploadedImages?: readonly (AgentAttachmentImage | undefined)[],\n\t\truntimeState?: ContextRuntimeState,\n\t\titerateFiles: () => Iterable<AgentAttachmentFile> = emptyIterateFiles,\n\t): Promise<AgentContext> {\n\t\tconst {\n\t\t\ttreeStore,\n\t\t\tmodulesStore,\n\t\t\tscheduler,\n\t\t\tvectorsStore,\n\t\t\tformsStore,\n\t\t\tsessionStore,\n\t\t\tcomponentLoader,\n\t\t\tcodeGenerationStore,\n\t\t\thooks,\n\t\t\tsource,\n\t\t\tapi,\n\t\t} = dependencies\n\t\tconst turnChangeset = createTurnChangeset()\n\t\tconst vectorSets = await VectorSets.fromTree(treeStore, modulesStore, vectorsStore, componentLoader)\n\t\tconst deferred = new DeferredOps(codeGenerationStore, async fn => {\n\t\t\tconst changeset = turnChangeset.getTurnChangeset()\n\t\t\tif (!changeset) {\n\t\t\t\tfn()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tawait scheduler.scheduleAgentChanges(() => changeset.append(fn))\n\t\t})\n\t\tconst dynamicValues = new DynamicValues()\n\t\tconst virtualText = new VirtualText()\n\t\tconst collections = await Collections.fromTree(treeStore, componentLoader, dynamicValues)\n\t\tconst treeResolver = new TreeResolver(treeStore, scopeNode, componentLoader, collections, virtualText)\n\t\tdynamicValues.setTreeResolver(treeResolver)\n\t\tconst components = await Components.fromTree(\n\t\t\ttreeResolver,\n\t\t\ttreeStore,\n\t\t\tmodulesStore,\n\t\t\tvectorSets,\n\t\t\tcomponentLoader,\n\t\t\tdeferred,\n\t\t\t{\n\t\t\t\twaitForDefinitions: shouldWaitForComponentDefinitions(modulesStore),\n\t\t\t},\n\t\t)\n\t\tconst layoutTemplates = await LayoutTemplates.fromTree(treeStore, componentLoader, vectorSets, deferred)\n\t\tconst shaders = await Shaders.fromTree(treeStore.tree, modulesStore, componentLoader)\n\t\tconst tokens = Tokens.fromTree(treeStore)\n\t\tconst stylePresets = new StylePresets()\n\t\tconst fonts = await prepareFontsContext(scopeNode)\n\t\tconst engine = hooks.getEngine()\n\t\tconst assetUploader = engine ? new BatchAssetUploader(engine, { silent: true }) : undefined\n\t\tconst files = Files.fromUploadedImages(\n\t\t\tuploadedImages,\n\t\t\ttreeStore,\n\t\t\tscheduler,\n\t\t\tturnChangeset.getTurnChangeset,\n\t\t\ttreeResolver,\n\t\t\tassetUploader,\n\t\t\tapi,\n\t\t\t{ trustAllUrls: source.prompt === \"local\" },\n\t\t)\n\t\tconst nodeByIdCursorStore = createNodeByIdCursorStore(nodeByIdCursorStoreState)\n\t\tconst forms = new Forms(treeStore, formsStore, scheduler, turnChangeset.getTurnChangeset, treeResolver)\n\t\tconst ctx = new AgentContext(\n\t\t\tscopeNode,\n\t\t\ttreeStore,\n\t\t\tvectorSets,\n\t\t\tcomponents,\n\t\t\tcomponentLoader,\n\t\t\ttokens,\n\t\t\tstylePresets,\n\t\t\tfiles,\n\t\t\tfonts,\n\t\t\tdeferred,\n\t\t\tcollections,\n\t\t\tdynamicValues,\n\t\t\ttreeResolver,\n\t\t\tsessionStore,\n\t\t\thooks,\n\t\t\tsource,\n\t\t\tnodeByIdCursorStore,\n\t\t\tturnChangeset,\n\t\t\tvirtualText,\n\t\t\tforms,\n\t\t\tshaders,\n\t\t\tlayoutTemplates,\n\t\t\titerateFiles,\n\t\t)\n\t\tif (runtimeState) ctx.resetRuntimeState(runtimeState)\n\n\t\tawait stylePresets.init(ctx)\n\n\t\treturn ctx\n\t}\n\n\t/**\n\t * Returns a lightweight proxy of `ctx` whose `treeStore.tree` (and\n\t * `treeStore.getDataTreeOrPartialTree()`) resolves to the given tree. Everything\n\t * else delegates to the original context via the prototype chain. Use at\n\t * call-site edges that need overlay classification against a different snapshot\n\t * (e.g. the \"to\" tree in `transformNodesToCommands`).\n\t *\n\t * `getDataTreeOrPartialTree` is intercepted alongside `tree` so that callers\n\t * which read the data-tree proxy (when the dataOnlyTree experiment is active)\n\t * also observe the override instead of silently falling through to the\n\t * underlying treeStore.\n\t */\n\tstatic override(ctx: AgentContext, overrides: { tree: CanvasTree }): AgentContext {\n\t\treturn Object.create(ctx, {\n\t\t\ttreeStore: {\n\t\t\t\tvalue: Object.create(ctx.treeStore, {\n\t\t\t\t\ttree: { value: overrides.tree },\n\t\t\t\t\tgetDataTreeOrPartialTree: { value: () => overrides.tree },\n\t\t\t\t}),\n\t\t\t},\n\t\t})\n\t}\n\n\tconstructor(\n\t\tpublic scopeNode: Loaded<ScopeNode>,\n\t\treadonly treeStore: TreeStore,\n\t\treadonly vectorSets: VectorSets,\n\t\treadonly components: Components,\n\t\treadonly componentLoader: AnyComponentLoader,\n\t\treadonly tokens: Tokens,\n\t\treadonly stylePresets: StylePresets,\n\t\treadonly files: Files,\n\t\treadonly fonts: AIFontFamily[],\n\t\treadonly deferred: DeferredOps,\n\t\treadonly collections: Collections,\n\t\treadonly dynamicValues: DynamicValues,\n\t\treadonly treeResolver: TreeResolver,\n\t\treadonly sessionStore: SessionStore,\n\t\treadonly hooks: AgentContextHooks,\n\t\treadonly source: Source,\n\t\treadonly nodeByIdCursorStore: NodeByIdCursorStore,\n\t\treadonly turnChangeset: TurnChangesetState,\n\t\treadonly virtualText: VirtualText,\n\t\treadonly forms: Forms,\n\t\treadonly shaders: Shaders,\n\t\treadonly layoutTemplates: LayoutTemplates,\n\t\tprivate readonly iterateFiles: () => Iterable<AgentAttachmentFile> = emptyIterateFiles,\n\t) {}\n\n\treadonly issues = new AgentIssues()\n\treadonly examples = new Examples()\n\treadonly nodeAttributeChanges = new NodeAttributeChanges(this)\n\treadonly checklist = createChecklistStore()\n\tprivate readonly scriptDataByKey = new Map<string, string>()\n\tprivate subModelCost = 0\n\tprivate previousSelectionKey: string | undefined = undefined\n\tprivate previousScopeId: NodeID | undefined = undefined\n\tprivate previousCodeFileContextKey: string | undefined = undefined\n\tprivate previousEditorTheme: \"dark\" | \"light\" | undefined = undefined\n\n\t// TODO: Consider limits on number of stored values and their total size.\n\tstoreScriptData(key: string, serializedValue: string): void {\n\t\tthis.scriptDataByKey.set(key, serializedValue)\n\t}\n\n\tloadScriptData(key: string): string | null {\n\t\treturn this.scriptDataByKey.get(key) ?? null\n\t}\n\n\tgetScriptDataKeys(): string[] {\n\t\treturn Array.from(this.scriptDataByKey.keys())\n\t}\n\n\taddSubModelCost(cost: number): void {\n\t\tif (!Number.isFinite(cost) || cost <= 0) return\n\t\tthis.subModelCost += cost\n\t}\n\n\tconsumeSubModelCost(): number {\n\t\tconst cost = this.subModelCost\n\t\tthis.subModelCost = 0\n\t\treturn cost\n\t}\n\n\tupdateScope(scopeNode: Loaded<ScopeNode>): void {\n\t\tif (this.scopeNode.id !== scopeNode.id) {\n\t\t\tthis.previousSelectionKey = undefined\n\t\t}\n\t\tthis.scopeNode = scopeNode\n\t\tthis.treeResolver.updateInsertionScope(scopeNode)\n\t}\n\n\tupdateTurnChangeset(changeset: Changeset | undefined): void {\n\t\tthis.turnChangeset.update(changeset)\n\t}\n\n\t/**\n\t * Yields attached files newest-first. Consumers iterate this generator and stop on the first\n\t * match, so duplicate filenames across turns resolve to the most recently attached file\n\t * without surfacing a confusing error to the agent.\n\t */\n\t*attachedFiles(): Iterable<AgentAttachmentFile> {\n\t\tyield* this.iterateFiles()\n\t}\n\n\tgetToolResultSystemStateMessages(): SystemState | undefined {\n\t\tconst payload: SystemState = {}\n\t\tfor (const key of systemStateKeys) {\n\t\t\tswitch (key) {\n\t\t\t\tcase \"guides\": {\n\t\t\t\t\tconst guides = this.examples.getToolResultSystemMessage()\n\t\t\t\t\tif (guides) payload.guides = guides\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tcase \"renamedIds\": {\n\t\t\t\t\tconst renamedIds = formatRenamedIds(this.treeResolver.extractRenamedIds())\n\t\t\t\t\tif (renamedIds.length > 0) payload.renamedIds = renamedIds\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(key, \"Invalid system state key\")\n\t\t\t}\n\t\t}\n\n\t\treturn !isEmptyObject(payload) ? payload : undefined\n\t}\n\n\tprivate hasSentInitialContextMessages = false\n\n\t/** Returns context messages every time, without the one-shot guard. */\n\tcontextMessages(): string[] {\n\t\tconst contextMessages: string[] = [\n\t\t\t`<${metadataTags.availableFonts}>${JSON.stringify(serializeFontsForContext(this.fonts))}</${metadataTags.availableFonts}>`,\n\t\t\tthis.components.prompt(),\n\t\t\t...this.components.componentDefinitionsFromSelectionPrompt(),\n\t\t\tthis.tokens.prompt(),\n\t\t\tthis.stylePresets.prompt(),\n\t\t\tthis.vectorSets.availableVectorSetsPrompt(),\n\t\t\t...this.vectorSets.iconSetsFromSelectionPrompt(),\n\t\t\tthis.shaders.availableShadersPrompt(),\n\t\t\t...this.shaders.shadersFromSelectionPrompt(),\n\t\t]\n\n\t\tconst defaultLayoutTemplateMessage = this.defaultLayoutTemplateMessage()\n\t\tif (defaultLayoutTemplateMessage) contextMessages.push(defaultLayoutTemplateMessage)\n\n\t\tconst additionalContextMessage = createAdditionalContextMessage(this.sessionStore.user?.name)\n\t\tif (additionalContextMessage) contextMessages.push(additionalContextMessage)\n\n\t\treturn contextMessages\n\t}\n\n\t/** Returns context messages only on the first call per instance (for multi-turn agent flow). */\n\tinitialContextMessages(): string[] {\n\t\tif (this.hasSentInitialContextMessages) return []\n\t\tthis.hasSentInitialContextMessages = true\n\t\treturn this.contextMessages()\n\t}\n\n\t/**\n\t * Returns the active view context message when the active view has changed since the last call\n\t * (or on the first call). This keeps canvas scope or code file info fresh across turns.\n\t */\n\tactiveViewContextMessage(): string | undefined {\n\t\tconst engine = this.hooks.getEngine()\n\t\tif (engine?.stores.codeEditorStore.currentCodeFileId) {\n\t\t\tthis.previousScopeId = undefined\n\n\t\t\tconst activeCodeFile = this.getActiveCodeFile(engine)\n\t\t\tif (!activeCodeFile) {\n\t\t\t\tthis.previousCodeFileContextKey = undefined\n\t\t\t\treturn undefined\n\t\t\t}\n\n\t\t\tconst currentCodeFileContextKey = JSON.stringify({\n\t\t\t\tid: activeCodeFile.id,\n\t\t\t\tpath: activeCodeFile.path,\n\t\t\t\tcomponentNames: activeCodeFile.componentNames,\n\t\t\t})\n\t\t\tif (this.previousCodeFileContextKey === currentCodeFileContextKey) return undefined\n\t\t\tthis.previousCodeFileContextKey = currentCodeFileContextKey\n\n\t\t\treturn createActiveViewContextMessage(this.treeStore, { type: \"codeFile\", codeFile: activeCodeFile })\n\t\t}\n\n\t\tthis.previousCodeFileContextKey = undefined\n\n\t\tif (this.previousScopeId === this.scopeNode.id) return undefined\n\t\tthis.previousScopeId = this.scopeNode.id\n\n\t\treturn createActiveViewContextMessage(this.treeStore, { type: \"scope\", scope: this.scopeNode })\n\t}\n\n\tprivate getActiveCodeFile(engine: VekterEngine): ActiveCodeFile | undefined {\n\t\tconst { codeEditorStore, componentsStore } = engine.stores\n\t\tconst currentCodeFileId = codeEditorStore.currentCodeFileId\n\t\tconst currentFilePath = codeEditorStore.currentFilePath\n\t\tif (!currentCodeFileId || !currentFilePath) return undefined\n\n\t\tconst component = componentsStore.componentDefinitionForFile(currentFilePath)\n\t\tconst componentNames: string[] = []\n\t\tif (component && !isErrorDefinition(component) && component.name) {\n\t\t\tcomponentNames.push(component.name)\n\t\t}\n\n\t\treturn {\n\t\t\tid: currentCodeFileId,\n\t\t\tpath: currentFilePath,\n\t\t\tcomponentNames,\n\t\t}\n\t}\n\n\t/**\n\t * If the selection has changed, add the new selection to the result messages.\n\t * Selection context is inserted just before the user message.\n\t */\n\tasync selectionContextMessages(\n\t\tselectionForContext: SelectionForContext,\n\t\tcmsSelectionsGroupedByCollection: readonly CmsSelectionGroupByCollection[] = [],\n\t): Promise<string[]> {\n\t\tconst selectedNodesContextMessage = await createSelectedNodesContextMessage(selectionForContext, this)\n\t\tconst selectionContextKey = JSON.stringify({\n\t\t\tselectedNodesContextMessage,\n\t\t\tcollectionContextVersionKey: this.collections.collectionContextVersionKey(cmsSelectionsGroupedByCollection),\n\t\t})\n\t\tif (this.previousSelectionKey === selectionContextKey) {\n\t\t\treturn []\n\t\t}\n\t\tthis.previousSelectionKey = selectionContextKey\n\n\t\tconst messages: string[] = []\n\n\t\tconst collectionPromptMessages = await this.collections.buildContextPromptMessages(\n\t\t\tthis.treeStore.getDataTreeOrPartialTree().getNodes(selectionForContext.keys()),\n\t\t\tcmsSelectionsGroupedByCollection,\n\t\t\tthis,\n\t\t)\n\t\tmessages.push(...collectionPromptMessages)\n\n\t\tmessages.push(selectedNodesContextMessage)\n\n\t\t// If changing the selection incorporated previously unseen component or icon definitions,\n\t\t// send them to the LLM.\n\t\tconst additionalComponentDefinitions = this.components.componentDefinitionsFromSelectionPrompt()\n\t\tconst additionalCompleteSets = this.vectorSets.iconSetsFromSelectionPrompt()\n\t\tconst additionalShaderDefinitions = this.shaders.shadersFromSelectionPrompt()\n\t\tmessages.push(...additionalComponentDefinitions)\n\t\tmessages.push(...additionalCompleteSets)\n\t\tmessages.push(...additionalShaderDefinitions)\n\n\t\treturn messages\n\t}\n\n\teditorThemeMessage(): string | undefined {\n\t\tconst engine = this.hooks.getEngine()\n\t\tconst theme = engine?.stores.documentSettingsStore.hasDarkAppearance ? \"dark\" : \"light\"\n\t\tif (this.previousEditorTheme === theme) return\n\t\tthis.previousEditorTheme = theme\n\t\treturn `<${metadataTags.editorTheme}>${theme}</${metadataTags.editorTheme}>`\n\t}\n\n\tprivate defaultLayoutTemplateMessage(): string | undefined {\n\t\tconst identifier = this.treeResolver.getLookupTree().root.layoutTemplateIdentifier\n\t\tif (!identifier) return\n\n\t\tconst parsed = parseModuleIdentifier(identifier)\n\t\tif (!parsed) return\n\n\t\tconst node = this.treeResolver.getLookupTree().getNodeWithTrait(parsed.localIdName, isLayoutTemplateNode)\n\t\tif (!node) return\n\n\t\tconst tag = metadataTags.defaultLayoutTemplate\n\t\treturn `<${tag}>${JSON.stringify({ id: node.id, name: node.resolveValue(\"name\") })}</${tag}>`\n\t}\n\n\tcompleteTurn(): { requestedExamples?: string[] } | undefined {\n\t\tthis.deferred.clearSeenTraits()\n\t\tthis.checklist.create()\n\t\treturn this.examples.completeTurn()\n\t}\n\n\t/**\n\t * Snapshot tool runtime state so a new context can resume it later.\n\t *\n\t * `api.store(key, value)` is a public tool-side effect that later scripts can observe through\n\t * `api.load(key)`. The persisted tool result only contains the script's final return value or\n\t * error, so step runtime snapshots store this map explicitly in the migrated agent snapshot.\n\t * Reconstructing it from history would require re-running historical scripts, which is unsafe\n\t * because scripts can update the project, call model-backed helpers, and depend on the current\n\t * implementation. Checklist progress is private request-local tool state, so it is captured here\n\t * for resume/replay and cleared when starting a fresh turn.\n\t */\n\tgetRuntimeState(): ContextRuntimeState {\n\t\tconst checklist = this.checklist.getRuntimeState()\n\t\treturn {\n\t\t\tscriptDataByKey: Array.from(this.scriptDataByKey.entries()),\n\t\t\t...(checklist ? { checklist } : {}),\n\t\t}\n\t}\n\n\tresetRuntimeState(state: ContextRuntimeState): void {\n\t\tthis.scriptDataByKey.clear()\n\t\tfor (const [key, value] of state.scriptDataByKey) {\n\t\t\tthis.scriptDataByKey.set(key, value)\n\t\t}\n\t\tthis.checklist.restore(state.checklist)\n\t}\n\n\t/** Creates an AgentContext for testing without requiring real dependencies. */\n\t// TODO: Replace with real dependencies in tests.\n\tstatic createForTest(\n\t\tctx: Partial<AgentContext> & { modulesStore?: ModulesStore } = {},\n\t\tfonts: AIFontFamily[] = [],\n\t\tids?: { scopeId?: NodeID; primaryVariantId?: NodeID },\n\t\tapi?: API,\n\t): AgentContext {\n\t\tconst vectorSets = ctx.vectorSets ?? new VectorSets(new Map(), new Map(), new Map())\n\t\tlet scope: ScopeNode | undefined\n\t\tif (ctx.scopeNode) {\n\t\t\tscope = ctx.scopeNode\n\t\t} else {\n\t\t\tconst primary = new FrameNode({\n\t\t\t\tid: ids?.primaryVariantId ?? randomID(),\n\t\t\t\tisMaster: true,\n\t\t\t\tisVariant: true,\n\t\t\t\tisBreakpoint: true,\n\t\t\t})\n\t\t\tscope = new WebPageNode({ id: ids?.scopeId ?? randomID(), baseVariantId: primary.id })\n\t\t\tscope.addChild(primary)\n\t\t}\n\n\t\tassert(scope?.isLoaded(), \"Scope node must be loaded\")\n\t\tconst treeStore = ctx.treeStore ?? createMockTreeStore(undefined, scope)\n\t\tif (!treeStore.tree.has(scope.id)) {\n\t\t\ttreeStore.tree.insertNode(scope)\n\t\t}\n\n\t\tconst tokens = ctx.tokens ?? Tokens.fromTree(treeStore)\n\t\tconst stylePresets = ctx.stylePresets ?? new StylePresets()\n\t\tconst turnChangeset = createTurnChangeset()\n\t\tconst componentLoader =\n\t\t\tctx.componentLoader ??\n\t\t\t({\n\t\t\t\tcomponentForIdentifier: () => {},\n\t\t\t\treactComponentForIdentifier: () => {},\n\t\t\t} as unknown as AnyComponentLoader)\n\t\tconst dynamicValues = ctx.dynamicValues ?? new DynamicValues()\n\t\tconst collections = ctx.collections ?? new Collections(treeStore, componentLoader, dynamicValues)\n\t\tconst virtualText = ctx.virtualText ?? new VirtualText()\n\t\tconst hooks = ctx.hooks ?? noopHooks\n\t\tconst treeResolver =\n\t\t\tctx.treeResolver ?? new TreeResolver(treeStore, scope, componentLoader, collections, virtualText)\n\t\tif (!ctx.dynamicValues) {\n\t\t\tdynamicValues.setTreeResolver(treeResolver)\n\t\t}\n\t\tconst engine = hooks.getEngine()\n\t\tconst modulesStore = ctx.modulesStore ?? engine?.stores?.modulesStore\n\t\tconst assetUploader = engine ? new BatchAssetUploader(engine, { silent: true }) : undefined\n\t\tconst source: Source = ctx.source ?? { agent: \"app\", prompt: \"in-app\" }\n\t\tconst files =\n\t\t\tctx.files ??\n\t\t\tnew Files(\n\t\t\t\ttreeStore,\n\t\t\t\tcreateMockScheduler(),\n\t\t\t\tnew Map(),\n\t\t\t\tturnChangeset.getTurnChangeset,\n\t\t\t\ttreeResolver,\n\t\t\t\tassetUploader,\n\t\t\t\tapi,\n\t\t\t\t{ trustAllUrls: source.prompt === \"local\" },\n\t\t\t)\n\n\t\tconst deferred = ctx.deferred ?? new DeferredOps()\n\t\tconst components =\n\t\t\tctx.components ??\n\t\t\tnew Components(\n\t\t\t\ttreeResolver,\n\t\t\t\ttreeStore,\n\t\t\t\tvectorSets,\n\t\t\t\tdeferred,\n\t\t\t\tcomponentLoader,\n\t\t\t\tmodulesStore,\n\t\t\t\tnew Map(),\n\t\t\t\tfalse,\n\t\t\t\tnew Map(),\n\t\t\t)\n\n\t\tconst sessionStore = ctx.sessionStore ?? ({ user: { name: \"\" } } as SessionStore)\n\t\tconst forms =\n\t\t\tctx.forms ??\n\t\t\tnew Forms(treeStore, createMockFormsStore(), createMockScheduler(), turnChangeset.getTurnChangeset, treeResolver)\n\n\t\tconst shaders = ctx.shaders ?? new Shaders(modulesStore ?? createUnusedObject(\"ModulesStore\"), componentLoader, [])\n\t\tconst layoutTemplates =\n\t\t\tctx.layoutTemplates ??\n\t\t\tnew LayoutTemplates(new Map(), new Map(), new Map(), treeStore, vectorSets, deferred, new Map(), componentLoader)\n\t\tconst nodeByIdCursorStore = ctx.nodeByIdCursorStore ?? createNodeByIdCursorStore(createNodeByIdCursorStoreState())\n\n\t\treturn new AgentContext(\n\t\t\tscope,\n\t\t\ttreeStore,\n\t\t\tvectorSets,\n\t\t\tcomponents,\n\t\t\tcomponentLoader,\n\t\t\ttokens,\n\t\t\tstylePresets,\n\t\t\tfiles,\n\t\t\tfonts,\n\t\t\tdeferred,\n\t\t\tcollections,\n\t\t\tdynamicValues,\n\t\t\ttreeResolver,\n\t\t\tsessionStore,\n\t\t\thooks,\n\t\t\tsource,\n\t\t\tnodeByIdCursorStore,\n\t\t\tturnChangeset,\n\t\t\tvirtualText,\n\t\t\tforms,\n\t\t\tshaders,\n\t\t\tlayoutTemplates,\n\t\t)\n\t}\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ACC,aAAO,CAAC,kBAAkB;AAAA,IAC3B;AACC,aAAO,CAAC,qBAAqB;AAAA,IAC9B;AAGC,aAAO,CAAC,eAAe,0BAA0B;AAAA,IAClD;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,I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MACA;AAAA,MACA;AAAA,MACA,EAAE,cAAc,OAAO,WAAW,QAAQ;AAAA,IAC3C;AAED,UAAM,WAAW,IAAI,YAAY,IAAI,YAAY;AACjD,UAAM,aACL,IAAI,cACJ,IAAI;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAI,IAAI;AAAA,MACR;AAAA,MACA,oBAAI,IAAI;AAAA,IACT;AAED,UAAM,eAAe,IAAI,gBAAiB,EAAE,MAAM,EAAE,MAAM,GAAG,EAAE;AAC/D,UAAM,QACL,IAAI,SACJ,IAAI,MAAM,WAAW,qBAAqB,GAAG,oBAAoB,GAAG,cAAc,kBAAkB,YAAY;AAEjH,UAAM,UAAU,IAAI,WAAW,IAAI,QAAQ,gBAAgB,mBAAmB,cAAc,GAAG,iBAAiB,CAAC,CAAC;AAClH,UAAM,kBACL,IAAI,mBACJ,IAAI,gBAAgB,oBAAI,IAAI,GAAG,oBAAI,IAAI,GAAG,oBAAI,IAAI,GAAG,WAAW,YAAY,UAAU,oBAAI,IAAI,GAAG,eAAe;AACjH,UAAM,sBAAsB,IAAI,uBAAuB,0BAA0B,+BAA+B,CAAC;AAEjH,WAAO,IAAI;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACAA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AACD;",
  "names": ["key", "isUndefined", "existing", "container", "CommandType", "type", "text", "first", "key", "isUndefined", "name", "fontSize", "size", "fontSize", "letterSpacing", "lineHeight", "type", "key", "text", "type", "key", "defaultValue", "type", "attributeKey", "keys", "assertNever", "definition", "nullString", "assert", "numberValue", "unit", "isUndefined", "key", "definition", "boxShadows", "randomID", "isUndefined", "lookup", "key", "isUndefined", "separator", "first", "randomID", "name", "first", "definition", "warning", "isUndefined", "type", "key", "name", "randomID", "key", "isUndefined", "type", "link", "updatedControlProp", "movedSourceRepeatArray", "virtualText", "name", "assertNever", "log", "metadata", "warning", "isUndefined", "key", "definition", "controls", "controls", "key", "log", "warning", "Slot", "key", "get", "set", "key", "font", "textAlignment", "isUndefined", "linkStylePreset", "first", "type", "link", "isUndefined", "key", "nullString", "warning", "font", "name", "font", "isUndefined", "type", "isUndefined", "link", "nullString", "border", "attributeKey", "controls", "key", "name", "set", "serializedValue", "imageValue", "warning", "randomID", "item", "fromAttributes", "toAttributes", "definition", "nullString", "definition", "fromAttributes", "inlineCode", "toAttributes", "definition", "nullString", "fromAttributes", "isUndefined", "fromAttributesToTextRun", "warnUnsupportedVirtualTextNodes", "fromAttributesToRichTextNode", "toAttributes", "definition", "nullString", "fromAttributes", "fromAttributesToTextRun", "warnUnsupportedVirtualTextNodes", "fromAttributesToRichTextNode", "toAttributes", "presetIdToAttributes", "definition", "fromAttributes", "media", "isUndefined", "nullString", "toAttributes", "key", "isUndefined", "type", "definition", "fromAttributes", "layout", "nullString", "toAttributes", "gap", "definition", "assert", "hasGridLayout", "fromAttributes", "type", "isUndefined", "definition", "fromAttributes", "isUndefined", "toAttributes", "text", "definition", "fromAttributes", "nullString", "toAttributes", "text", "isUndefined", "fromVirtualAttributes", "toVirtualAttributes", "definition", "fromAttributes", "isUndefined", "toAttributes", "nullString", "definition", "key", "isUndefined", "keys", "fromAttributes", "warning", "toAttributes", "font", "log", "assert", "assertNever", "dslKey", "isUndefined", "keys", "fromAttributes", "key", "isSupportedCanvasNode", "isUndefined", "presetNode", "assertNever", "applyFont", "font", "fromAttributes", "toAttributes", "nullString", "defaultValue", "fontSize", "fromAttributes", "isUndefined", "size", "toAttributes", "nullString", "defaultValue", "fromAttributes", "isUndefined", "size", "toAttributes", "nullString", "defaultValue", "fromAttributes", "isUndefined", "size", "toAttributes", "isUndefined", "fromAttributes", "toAttributes", "nullString", "isUndefined", "fromAttributes", "toAttributes", "nullString", "isUndefined", "getFullDSLKey", "dslKey", "defaultValue", "fromAttributes", "key", "assertNever", "toAttributes", "nullString", "getFullDSLKey", "isUndefined", "dslKey", "collectRichTextNodeAttributes", "collectTextStylePresetAttributes", "collectVirtualTextAttributes", "assertNever", "key", "fromAttributes", "toAttributes", "nullString", "getFullDSLKey", "dslKey", "node", "textBackgroundColor", "isUndefined", "fromAttributes", "toAttributes", "nullString", "getFullDSLKey", "dslKey", "node", "textColor", "isUndefined", "guard", "keys", "key", "definition", "fromAttributes", "toAttributes", "fromVirtualAttributes", "toVirtualAttributes", "key", "isUndefined", "nullString", "isUndefined", "type", "block", "attributes", "key", "name", "scopeType", "name", "nullString", "isUndefined", "delay", "transition", "fromAttributes", "toAttributes", "definition", "fromAttributes", "appearEffect", "isUndefined", "toAttributes", "definition", "fromAttributes", "definition", "nullString", "fromAttributes", "isUndefined", "fill", "toAttributes", "backdrop", "definition", "nullString", "fromAttributes", "blendingMode", "isUndefined", "toAttributes", "nullString", "definition", "fromAttributes", "blockquote", "isUndefined", "warnings", "key", "toAttributes", "definition", "nullString", "fromAttributes", "fromAttributesToRichTextNode", "toAttributes", "presetIdToAttributes", "definition", "nullString", "fromAttributes", "toAttributes", "definition", "nullString", "fromAttributes", "toAttributes", "boxShadows", "definition", "nullString", "fromAttributes", "toAttributes", "nullString", "definition", "fromAttributes", "isUndefined", "key", "getAttributeKey", "toAttributes", "assertNever", "nullString", "definition", "isUndefined", "cursor", "type", "placement", "transition", "key", "fromAttributes", "toAttributes", "isEmptyObject", "definition", "fromAttributes", "dragEffect", "isUndefined", "transition", "toAttributes", "definition", "nullString", "isUndefined", "toAttributes", "fromAttributes", "fill", "definition", "nullString", "fromAttributes", "key", "isUndefined", "toAttributes", "definition", "fromAttributes", "flowEffect", "transition", "toAttributes", "definition", "nullString", "fromAttributes", "toAttributes", "definition", "fromAttributes", "assert", "toAttributes", "definition", "nullString", "fromAttributes", "definition", "nullString", "fromAttributes", "definition", "nullString", "fromAttributes", "toAttributes", "definition", "nullString", "fromAttributes", "toAttributes", "nullString", "definition", "fromAttributes", "toAttributes", "definition", "nullString", "fromAttributes", "definition", "nullString", "fromAttributes", "definition", "nullString", "fromAttributes", "definition", "nullString", "type", "fromAttributes", "toAttributes", "definition", "nullString", "formContainer", "isEmptyObject", "supportedVariableTypes", "type", "controls", "nullString", "definition", "key", "delay", "meta", "randomID", "action", "isUndefined", "definition", "fromAttributes", "nullString", "definition", "fromAttributes", "hoverEffect", "isUndefined", "opacity", "transition", "boxShadows", "toAttributes", "definition", "fromAttributes", "definition", "nullString", "dslAttributeKey", "fromAttributes", "isUndefined", "toAttributes", "nullString", "definition", "fromAttributes", "key", "isUndefined", "toAttributes", "definition", "fromAttributes", "isUndefined", "toAttributes", "padding", "definition", "fromAttributes", "lightboxEffect", "zIndex", "backdrop", "transition", "nullString", "toAttributes", "dslKey", "nullString", "definition", "fromAttributes", "link", "isUndefined", "key", "toAttributes", "definition", "nullString", "fromAttributes", "link", "transition", "toAttributes", "definition", "fromAttributes", "loopEffect", "isUndefined", "opacity", "transition", "toAttributes", "definition", "nullString", "randomID", "fromAttributes", "masks", "isUndefined", "toAttributes", "nullString", "definition", "toAttributes", "metadata", "isUndefined", "fromAttributes", "key", "cursor", "type", "definition", "fromAttributes", "isUndefined", "definition", "fromAttributes", "opacity", "isUndefined", "toAttributes", "definition", "fromAttributes", "toAttributes", "overflow", "definition", "nullString", "fromAttributes", "overscroll", "isUndefined", "toAttributes", "definition", "nullString", "fromAttributes", "key", "toAttributes", "nullString", "fromAttributes", "isUndefined", "paragraphSpacing", "toAttributes", "definition", "fromAttributes", "parallaxEffect", "isUndefined", "toAttributes", "definition", "isUndefined", "keys", "key", "fromAttributes", "nullString", "toAttributes", "definition", "fromAttributes", "isUndefined", "key", "definition", "fromAttributes", "isUndefined", "assert", "assertNever", "toAttributes", "redirect", "definition", "fromAttributes", "isUndefined", "toAttributes", "log", "key", "repeater", "definition", "toAttributes", "isUndefined", "filters", "randomID", "first", "currentNode", "engine", "fromAttributes", "definition", "fromAttributes", "toAttributes", "definition", "fromAttributes", "rotation", "isUndefined", "definition", "fromAttributes", "toAttributes", "nullString", "definition", "key", "fromAttributes", "scrollVariantEffect", "isUndefined", "randomID", "toAttributes", "definition", "nullString", "key", "fromAttributes", "definition", "fromAttributes", "isUndefined", "definition", "nullString", "isUndefined", "resolveId", "key", "fromAttributes", "styleTransformEffect", "transition", "toAttributes", "definition", "nullString", "fromAttributes", "isUndefined", "warnings", "key", "borderShorthand", "toAttributes", "definition", "nullString", "fromAttributes", "isUndefined", "fromAttributesToRichTextNode", "toAttributes", "presetIdToAttributes", "definition", "fromAttributes", "tapEffect", "opacity", "transition", "isUndefined", "boxShadows", "toAttributes", "definition", "fromAttributes", "textEffect", "isUndefined", "delay", "isSupportedTrigger", "toAttributes", "definition", "fromAttributes", "toAttributes", "definition", "nullString", "fromAttributes", "virtualText", "isUndefined", "toAttributes", "textStylePreset", "definition", "fromAttributes", "isUndefined", "nullString", "assert", "toAttributes", "definition", "key", "nullString", "fromAttributes", "isUndefined", "toAttributes", "nullString", "isUndefined", "fromAttributes", "toAttributes", "definition", "fromAttributes", "toAttributes", "nullString", "fromAttributes", "isUndefined", "textWrapBalance", "toAttributes", "definition", "fromAttributes", "tickerEffect", "isUndefined", "toAttributes", "definition", "nullString", "fromAttributes", "type", "definition", "toAttributes", "variableBinding", "fromAttributes", "toAttributes", "fromAttributes", "resolveHandleResult", "set", "identifier", "definition", "fromAttributes", "isUndefined", "toAttributes", "visible", "nullString", "definition", "fromAttributes", "isUndefined", "toAttributes", "definition", "fromAttributes", "zIndex", "isUndefined", "textStylePreset", "toAttributes", "fromAttributes", "key", "isUndefined", "metadata", "layoutTemplate", "key", "toAttributes", "attributeKey", "name", "set", "children", "isUndefined", "log", "cursor", "key", "cursor", "name", "delay", "text", "key", "type", "isFunction", "keys", "text", "name", "key", "metadata", "type", "metadata", "key", "isFunction", "name", "tool", "type", "text", "key", "log", "text", "first", "isAsyncIterable", "key", "options", "scopeType", "name", "controls", "log", "name", "getNodeName", "defaultValue", "set", "nullString", "controls", "definition", "type", "scopeType", "record", "key", "log", "definition", "log", "name", "record", "key", "name", "name", "assert", "name", "clearLocalExamples", "clearRemovedBundledExamples", "log", "name", "isUndefined", "log", "text", "size", "features", "assertNever", "font", "font", "isUndefined", "assert", "type", "getNodeName", "assert", "nullString", "toAttributes", "record", "key", "assert", "log", "block", "inline", "blockquote", "isUndefined", "link", "block", "inlineCodeStylePreset", "isUndefined", "log", "editor", "text", "block", "isUndefined", "key", "log", "controls", "name", "type", "assert", "definition", "name", "toAttributes", "key", "definition", "name", "isUndefined", "key", "name", "definition", "set", "controls", "key", "virtualText", "randomID"]
}
