{
  "version": 3,
  "sources": ["../../src/web/pages/project/permissions/useIsViewOnly.ts", "../../src/document/components/chrome/contentManagement/utils/saveActivePrivateDraftCollectionItem.ts", "../../src/document/components/chrome/contentManagement/utils/closeCollectionItems.tsx", "../../src/document/components/chrome/contentManagement/utils/createSampleCollection.ts", "../../src/document/components/chrome/contentManagement/utils/createCollection.ts", "../../src/document/components/chrome/QuickActions/utils/useLocaleScopeFilterQuickActions.ts", "../../src/document/components/chrome/localization/getNameForLocalizationStatus.ts", "../../src/document/components/chrome/QuickActions/utils/useQuickActionCache.ts", "../../src/document/components/chrome/projectbar/ToolbarTooltip.tsx", "../../src/document/components/chrome/properties/rows/StyleAssetRow.tsx", "../../src/document/components/chrome/properties/utils/useRename.tsx", "../../src/document/components/chrome/properties/rows/StyleAssetRow.styles.ts", "../../src/document/components/chrome/assets/utils/openAssetStyleInAssetsPanel.ts", "../../src/app/ActionLabels.ts", "../../src/document/components/utils/contextAlignmentActions.ts", "../../src/document/models/CanvasTree/utils/sortGroundNodes.ts", "../../src/document/components/chrome/agentPanel/components/IconAgentCMS.tsx", "../../src/document/components/chrome/agentPanel/components/IconAgentHome.tsx", "../../src/document/components/chrome/agentPanel/components/IconAgentPage.tsx", "../../src/document/components/chrome/presetsPanel/PresetIcon.tsx", "../../src/document/components/chrome/presetsPanel/PresetIcon.styles.ts", "../../src/document/components/chrome/shared/ColorPicker/tokens/ColorPickerTokenRowPreview.styles.ts", "../../src/document/components/chrome/shared/ColorPicker/tokens/ColorPickerTokenRowPreview.tsx", "../../src/document/components/canvas/CanvasDropZone.tsx", "../../src/document/components/chrome/insertSidebar/insertDataSourceItemToast.ts", "../../src/document/components/chrome/assets/IconAgentAssetLayoutTemplate.tsx", "../../src/document/components/tools/pathEdit/utils/convertToOutline.ts", "../../src/document/components/utils/createContainer.ts", "../../src/app/menu.ts", "../../src/document/components/chrome/assets/actions/rename.ts", "../../src/document/components/chrome/contentManagement/utils/sanitizeCollectionName.ts", "../../src/document/components/chrome/assets/utils/getReferenceNodeFullPath.ts", "../../src/document/components/chrome/assets/actions/utils.ts", "../../src/document/components/chrome/assets/actions/create.ts", "../../src/document/components/chrome/contentManagement/utils/handleDuplicateCollection.ts", "../../src/document/components/chrome/contentManagement/utils/getCollectionCreationOptions.ts", "../../src/document/components/utils/externalModuleGroups.tsx", "../../src/document/components/utils/searchListItems.ts", "../../src/web/lib/checkProjectAccess.ts", "../../src/document/models/CanvasTree/nodes/utils/externalModuleNodeHelpers.ts", "../../src/document/models/CanvasTree/utils/getFrameFillColor.ts", "../../src/document/components/chrome/assets/DraggableEntityItem.tsx", "../../src/document/components/chrome/shared/CollapsibleRow.tsx", "../../src/document/components/chrome/shared/CollapseIndicator.styles.ts", "../../src/document/components/chrome/layers/LayerPanelItem.styles.ts", "../../src/document/components/chrome/shared/EditableTextInput/EditableTextInput.tsx", "../../src/document/components/chrome/shared/EditableTextInput/EditableTextInput.styles.ts", "../../src/document/components/chrome/shared/CollapsibleRow.styles.ts", "../../src/document/components/chrome/shared/SubLabel.styles.ts", "../../src/document/components/chrome/shared/utils/panelMultiSelect.ts", "../../src/document/components/chrome/shared/InsertionIndicator.styles.ts", "../../src/document/components/chrome/shared/InsertionIndicator.tsx", "../../src/document/components/chrome/shared/utils/dragExpandTime.ts", "../../src/document/components/chrome/shared/utils/panelDragDrop.ts", "../../src/document/components/chrome/assets/DraggableEntityItem.styles.ts", "../../src/document/components/chrome/assets/actions/move.ts", "../../src/document/components/chrome/agentPanel/components/IconAgentVectorSet.tsx", "../../src/document/components/chrome/assets/EntityAssetRow.styles.ts", "../../src/document/components/chrome/shared/utils/getInsertionPositionForSelection.ts", "../../src/document/components/chrome/assets/utils/hasAnyUnreferencedItems.ts", "../../src/document/components/chrome/assets/utils/multiselect.ts", "../../src/document/components/chrome/assets/utils/assetTypeHelpers.tsx", "../../src/document/components/chrome/assets/utils/getExportedModulesMap.ts", "../../src/document/components/utils/enumerate.tsx", "../../src/document/components/chrome/contentManagement/utils/contentManagementActions.tsx", "../../src/document/components/chrome/contentManagement/utils/getCollectionsReferencingCollection.ts", "../../src/document/components/chrome/contentManagement/utils/handleCreateCollectionItem.ts", "../../src/document/components/chrome/contentManagement/utils/screenFeatureUtils.ts", "../../src/document/components/chrome/contentManagement/utils/getCollectionItemMenuOptions.ts", "../../src/document/components/chrome/localization/batchTranslateUtils.ts", "../../src/document/components/chrome/localization/createLocale.tsx", "../../src/document/components/chrome/localization/useSourceOptionsMenu.ts", "../../src/document/components/chrome/localization/LocalizationValueStatus.tsx", "../../src/document/components/chrome/localization/LocalizationValueStatus.styles.ts", "../../src/document/components/chrome/localization/showMatchingItemsToast.ts", "../../src/document/components/chrome/localization/openTextEditorOverlay.ts", "../../src/document/components/chrome/localization/viewLocalizationValueSource.ts", "../../src/document/components/chrome/shared/VariablesModal/getVariableCreationMenuOptions.ts", "../../src/document/components/chrome/shared/utils/panelIconForVariable.tsx", "../../src/document/components/utils/contextMenu.ts", "../../src/utils/searchUtils.ts"],
  "sourcesContent": ["import engine from \"document/engine.ts\"\nimport { isViewOnly } from \"./isViewOnly.ts\"\nimport type { ExtendedPermissions } from \"./projectPermissions.ts\"\n\n/**\n * A React hook built around {@link isViewOnly}, will trigger necessary re-renders if the view-only\n * state changes.\n */\nexport function useIsViewOnly(permissionToCheck: keyof ExtendedPermissions): boolean {\n\tconst { loadingStore, chromeStore, projectStore, sessionStore } = engine.stores\n\tconst isReady = loadingStore.useState(state => state.isReady)\n\tconst userIsViewer = chromeStore.useState(state => state.userIsViewer)\n\tconst userIsAccountSharing = chromeStore.useState(state => state.userIsAccountSharing)\n\tconst isViewingBranchFromOtherUser = chromeStore.useState(state => state.isViewingBranchFromOtherUser)\n\tconst acl = projectStore.useState(state => state.acl)\n\tconst userId = sessionStore.useState(state => state.user?.id) // Can be `undefined` in tests\n\treturn isViewOnly(\n\t\t{ isReady, userIsViewer, userIsAccountSharing, isViewingBranchFromOtherUser, acl, userId },\n\t\tpermissionToCheck,\n\t)\n}\n", "import { assert, assertNever, unhandledError } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CollectionItemNode, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { isCollectionItemNode, isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport {\n\tisCollectionReferenceVariableDefinition,\n\tisMultiCollectionReferenceVariableDefinition,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isMultiCollectionReferenceControlPropValue } from \"document/models/controlProps/ControlProp.ts\"\nimport type { AddReferenceAction } from \"document/utils/contentManagementOverlayStack.ts\"\nimport { getNewCollectionItemNodeFromStackElement } from \"document/utils/contentManagementOverlayStack.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { isArray, isString } from \"utils/typeChecks.ts\"\nimport { getTakenSlugs } from \"../useTakenSlugs.ts\"\nimport { getCollectionItemVariablesWithError } from \"./fieldValidationHelpers.ts\"\nimport { maybeAutoGenerateSlugForCollectionItem } from \"./maybeAutoGenerateSlugForCollectionItem.ts\"\n\n/**\n * Attempts to save the active item. Returns true if saved successfully, or false if there are errors.\n */\nexport async function saveActivePrivateDraftCollectionItem(engine: VekterEngine): Promise<{ saved: boolean }> {\n\tconst { contentManagementStore, codeGenerationStore } = engine.stores\n\tconst privateDraftStackElement = contentManagementStore.getActivePrivateDraftCollectionStackElement()\n\tassert(privateDraftStackElement, \"Private draft collection stack element required to save\")\n\n\tconst collection = engine.tree.getNode<CollectionNode>(privateDraftStackElement.collectionId)\n\tassert(isCollectionNode(collection), \"Private draft collection item needs to be associated to a collection\")\n\n\tconst privateDraftCollectionItem = getNewCollectionItemNodeFromStackElement({\n\t\ttreeStore: engine.stores.treeStore,\n\t\tcontentManagementStore,\n\t\tstackElement: privateDraftStackElement,\n\t})\n\tassert(privateDraftCollectionItem, \"Private draft collection item must be available to be saved\")\n\n\tconst saved = await engine.scheduler.processWhenReadyAsync(() => {\n\t\tconst takenSlugs = getTakenSlugs(collection, privateDraftCollectionItem)\n\n\t\tconst didUpdateItem = !!maybeAutoGenerateSlugForCollectionItem(collection, privateDraftCollectionItem, takenSlugs)\n\t\tif (didUpdateItem) {\n\t\t\tcontentManagementStore.didUpdateTemporaryCollectionItem()\n\t\t}\n\n\t\tconst variablesWithError = getCollectionItemVariablesWithError(\n\t\t\tengine.tree,\n\t\t\tengine.componentLoader,\n\t\t\tcollection,\n\t\t\tprivateDraftCollectionItem,\n\t\t\ttakenSlugs,\n\t\t)\n\n\t\tif (variablesWithError.length > 0) {\n\t\t\tconst firstVariableWithError = variablesWithError[0]\n\t\t\tif (firstVariableWithError) {\n\t\t\t\t// We only support one error at a time, but getCollectionItemValidationErrors\n\t\t\t\t// returns all errors because On-Page Editing needs them.\n\t\t\t\t// There's nothing preventing us from showing all errors, we just haven't done it yet.\n\t\t\t\t// https://framer-team.slack.com/archives/C068W7EDVMY/p1750781259558949\n\t\t\t\tcontentManagementStore.setCollectionItemControlToHighlight(firstVariableWithError.id)\n\t\t\t}\n\n\t\t\tcontentManagementStore.showErrorsOnActivePrivateDraftCollectionItem()\n\t\t\treturn false\n\t\t}\n\n\t\tif (engine.tree.has(privateDraftCollectionItem.id)) {\n\t\t\tprivateDraftCollectionItem.set({ privateToUserId: undefined })\n\t\t} else {\n\t\t\tengine.stores.scopeStore.insertNode(privateDraftCollectionItem, collection.id, 0)\n\t\t}\n\t\tcontentManagementStore.markActivePrivateDraftCollectionItemAsSaved(privateDraftCollectionItem.id)\n\n\t\tif (privateDraftStackElement.saveAction) {\n\t\t\tswitch (privateDraftStackElement.saveAction.type) {\n\t\t\t\tcase \"add-reference\": {\n\t\t\t\t\taddReference({\n\t\t\t\t\t\tengine,\n\t\t\t\t\t\tsaveAction: privateDraftStackElement.saveAction,\n\t\t\t\t\t\tprivateDraftCollectionItem,\n\t\t\t\t\t})\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdefault: {\n\t\t\t\t\tassertNever(privateDraftStackElement.saveAction.type)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true\n\t})\n\n\tif (saved) {\n\t\tawait codeGenerationStore.updateComponent(collection.id).catch(unhandledError)\n\t}\n\n\treturn { saved }\n}\n\nfunction addReference({\n\tengine,\n\tsaveAction,\n\tprivateDraftCollectionItem,\n}: {\n\tengine: VekterEngine\n\tsaveAction: AddReferenceAction\n\tprivateDraftCollectionItem: CollectionItemNode\n}) {\n\tconst parentCollection = engine.tree.getNodeWithTrait(saveAction.parentItemCollectionId, isCollectionNode)\n\tif (!parentCollection) return // It may have been deleted\n\tconst parentItem =\n\t\tengine.tree.getNodeWithTrait(saveAction.parentItemId, isCollectionItemNode) ??\n\t\tengine.stores.contentManagementStore.temporaryItemCache.get(saveAction.parentItemId)\n\tif (!parentItem) return // It may have been deleted\n\n\tconst variable = parentCollection.getVariable(saveAction.variableId)\n\tif (!variable) return\n\n\tif (isCollectionReferenceVariableDefinition(variable)) {\n\t\tparentItem.setControlProp(saveAction.variableId, {\n\t\t\ttype: ControlType.CollectionReference,\n\t\t\tvalue: privateDraftCollectionItem.id,\n\t\t})\n\t}\n\n\tif (isMultiCollectionReferenceVariableDefinition(variable)) {\n\t\tconst currentControlProp = parentItem.getControlProp(variable.id)\n\t\tlet currentValue: readonly string[] = []\n\n\t\tif (\n\t\t\tcurrentControlProp &&\n\t\t\tisMultiCollectionReferenceControlPropValue(currentControlProp.value) &&\n\t\t\tisArray(currentControlProp.value) &&\n\t\t\tcurrentControlProp.value.every(isString)\n\t\t) {\n\t\t\tcurrentValue = currentControlProp.value\n\t\t}\n\n\t\tparentItem.setControlProp(saveAction.variableId, {\n\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\tvalue: [...currentValue, privateDraftCollectionItem.id],\n\t\t})\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CollectionItemNode, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { privateDraftCollectionItemHasUserData } from \"document/models/CanvasTree/nodes/utils/privateDraftCollectionItemHasUserData.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport {\n\tgetCollectionNodeFromStackElement,\n\tgetItemNodeFromStackElement,\n\tisNewCollectionItemStackElement,\n\ttype NewCollectionStackElement,\n\ttype OverlayStackElement,\n} from \"document/utils/contentManagementOverlayStack.ts\"\nimport { isPromise } from \"utils/typeChecks.ts\"\nimport { saveActivePrivateDraftCollectionItem } from \"./saveActivePrivateDraftCollectionItem.ts\"\n\ntype CloseCollectionItemsTarget = \"active\" | \"all\" | \"all-except-selected\"\ntype ClosePrivateDraftCollectionItemAction = \"discard\" | \"cancel\" | \"save\" | \"save-or-confirm-discard-on-failure\"\ntype ClosePrivateDraftCollectionItemResult = ClosePrivateDraftCollectionItemAction | \"discard-silently\"\n\ntype DiscardConfirmationResult = \"discard\" | \"cancel\"\n\nasync function promptForDiscardConfirmation({ engine }: { engine: VekterEngine }): Promise<DiscardConfirmationResult> {\n\treturn new Promise<DiscardConfirmationResult>(resolve => {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.Confirmation,\n\t\t\ttitle: Dictionary.UnsavedChanges,\n\t\t\tdescription: `Some required fields are not filled in, so the item can\u2019t be saved. Would you like to keep editing or discard the item? By discarding, all content will be lost.`,\n\t\t\tonConfirm: () => resolve(\"discard\"),\n\t\t\tonCancel: () => resolve(\"cancel\"), // do nothing, hide the modal\n\t\t\tonDismiss: () => resolve(\"cancel\"), // do nothing, hide the modal\n\t\t\tcancelLabel: Dictionary.ContinueEditing,\n\t\t\tconfirmLabel: Dictionary.DiscardItem,\n\t\t\tdismissVariant: \"primary\",\n\t\t\tvariant: \"destructiveSecondary\",\n\t\t\tcancelOnEnter: true,\n\t\t\tkeyboardConfirmMode: false,\n\t\t\tsource: \"content_management_store\",\n\t\t\tbuttonDirection: \"column\",\n\t\t})\n\t})\n}\n\nfunction closePrivateDraftCollectionItem({\n\tstackElement: element,\n\tengine,\n\tuserChoice,\n\tcollectionItem,\n\tcollection,\n}: {\n\tstackElement: NewCollectionStackElement\n\tengine: VekterEngine\n\tuserChoice: ClosePrivateDraftCollectionItemAction | undefined\n\tcollectionItem: CollectionItemNode\n\tcollection: CollectionNode\n}): Promise<ClosePrivateDraftCollectionItemResult> | ClosePrivateDraftCollectionItemResult {\n\tconst hasUserData = privateDraftCollectionItemHasUserData({\n\t\tcollection,\n\t\tcollectionItem,\n\t})\n\tif (!hasUserData) {\n\t\treturn \"discard-silently\"\n\t}\n\n\tif (userChoice === \"discard\") {\n\t\t// need to ask if the user really wants to discard\n\t\treturn promptForDiscardConfirmation({ engine })\n\t}\n\tif (userChoice === \"cancel\") {\n\t\t// no need to save or ask anything, just propagate the \"cancel\" further\n\t\treturn \"cancel\"\n\t}\n\n\treturn savePrivateDraftCollectionItem({\n\t\tengine,\n\t\telement,\n\t\tconfirmDiscardOnFailure: userChoice === \"save-or-confirm-discard-on-failure\",\n\t})\n}\n\nasync function savePrivateDraftCollectionItem({\n\tengine,\n\telement,\n\tconfirmDiscardOnFailure,\n}: {\n\tengine: VekterEngine\n\telement: NewCollectionStackElement\n\tconfirmDiscardOnFailure: boolean\n}): Promise<ClosePrivateDraftCollectionItemResult> {\n\tconst { saved } = await saveActivePrivateDraftCollectionItem(engine)\n\tif (!saved) {\n\t\tif (confirmDiscardOnFailure) {\n\t\t\treturn promptForDiscardConfirmation({ engine })\n\t\t}\n\n\t\tif (element.attemptedClose) {\n\t\t\t// The item still can't be saved after another close attempt, so maybe the user wants to discard now.\n\t\t\treturn promptForDiscardConfirmation({ engine })\n\t\t}\n\n\t\treturn \"cancel\"\n\t}\n\n\treturn \"save\"\n}\n\nfunction isSelectedRootCollectionItem({\n\telement,\n\tindex,\n\tstack,\n}: {\n\telement: OverlayStackElement | undefined\n\tindex: number\n\tstack: readonly OverlayStackElement[]\n}) {\n\tif (!element) return false\n\tif (index !== stack.length - 1) return false\n\treturn element.type === \"existing\" || element.type === \"privateDraft\"\n}\n\nexport async function closeCollectionItems({\n\tengine,\n\ttarget,\n\taction = \"save\",\n}: {\n\tengine: VekterEngine\n\ttarget: CloseCollectionItemsTarget\n\taction?: \"save\" | \"discard\" | \"save-or-confirm-discard-on-failure\"\n}): Promise<{ userKeptEditing: true } | { userKeptEditing: false; saved: boolean }> {\n\tconst { contentManagementStore, chromeStore } = engine.stores\n\tlet reversedStack = [...chromeStore.contentManagementOverlayStack].reverse()\n\n\tif (target === \"active\") {\n\t\t// \"active\" is chosen when the topmost item must be closed, e.g.,\n\t\t// by pressing the \"X\" button\n\t\treversedStack = reversedStack.slice(0, 1)\n\t}\n\n\tconst activeElement = reversedStack[0]\n\tif (\n\t\ttarget !== \"all-except-selected\" ||\n\t\t!isSelectedRootCollectionItem({ element: activeElement, index: 0, stack: reversedStack })\n\t) {\n\t\tcontentManagementStore.setAttemptedCloseOnActivePrivateDraftCollectionItem()\n\t}\n\n\t// only if the action is discard, we need to prompt for confirmation\n\tlet userChoice: ClosePrivateDraftCollectionItemAction = action\n\n\tfor (let i = 0; i < reversedStack.length; i++) {\n\t\tconst element = reversedStack[i]\n\t\tif (!element) continue\n\n\t\tif (target === \"all-except-selected\" && isSelectedRootCollectionItem({ element, index: i, stack: reversedStack })) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Tree-backed private drafts need scheduler cleanup even when a blank draft closes synchronously.\n\t\tlet shouldProcessPopWhenReady = element.type === \"privateDraft\"\n\t\tif (isNewCollectionItemStackElement(element)) {\n\t\t\tconst collection = getCollectionNodeFromStackElement({\n\t\t\t\tstackElement: element,\n\t\t\t\ttree: engine.tree,\n\t\t\t})\n\t\t\tassert(collection, \"Attempt to close a private draft collection item with missing collection\")\n\t\t\tconst item = getItemNodeFromStackElement({\n\t\t\t\ttreeStore: engine.stores.treeStore,\n\t\t\t\tcontentManagementStore,\n\t\t\t\tstackElement: element,\n\t\t\t})\n\t\t\tassert(item, \"Attempt to close a private draft collection item not available\")\n\n\t\t\tconst maybeResult = closePrivateDraftCollectionItem({\n\t\t\t\tstackElement: element,\n\t\t\t\tengine,\n\t\t\t\tuserChoice,\n\t\t\t\tcollectionItem: item,\n\t\t\t\tcollection,\n\t\t\t})\n\n\t\t\tlet result: ClosePrivateDraftCollectionItemResult | undefined\n\t\t\tif (isPromise(maybeResult)) {\n\t\t\t\t// Saving or confirming a discard resumes asynchronously, so defer the pop until the\n\t\t\t\t// scheduler is ready. Cache-backed temporary blank drafts can still pop in the current frame.\n\t\t\t\tshouldProcessPopWhenReady = true\n\t\t\t\tresult = await maybeResult\n\t\t\t} else {\n\t\t\t\tresult = maybeResult\n\t\t\t}\n\n\t\t\tif (result === \"cancel\") return { userKeptEditing: true }\n\n\t\t\tif (result !== \"discard-silently\") {\n\t\t\t\t// The first choice propagates to parent items\n\t\t\t\tuserChoice = result\n\t\t\t}\n\t\t}\n\n\t\tif (shouldProcessPopWhenReady) {\n\t\t\tawait engine.scheduler.processWhenReadyAsync(() => {\n\t\t\t\tcontentManagementStore.popOverlayStack(engine.tree)\n\t\t\t})\n\t\t} else {\n\t\t\tcontentManagementStore.popOverlayStack(engine.tree)\n\t\t}\n\t}\n\n\tconst closeResult = { userKeptEditing: false, saved: userChoice !== \"discard\" } as const\n\treturn closeResult\n}\n", "import { type AssetMap, createAssetReference, createAssetReferenceForImage } from \"@framerjs/assets\"\nimport { assert, ModuleType, assertNever, hostInfo, parseModuleIdentifier, unhandledError } from \"@framerjs/shared\"\nimport { projectFeatures } from \"app/projectFeatures.ts\"\nimport { startOfDay, subDays } from \"date-fns\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { ContentManagementNode } from \"document/models/CanvasTree/index.ts\"\nimport { CollectionItemNode, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport type { CollectionVariableDefinition } from \"document/models/CanvasTree/traits/CollectionVariableDefinition.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport type { CollectionControlProp } from \"document/models/controlProps/CollectionControlProp.ts\"\nimport type { ImageControlProp } from \"document/models/controlProps/ControlProp.ts\"\nimport { type PrefixedControlProps, prefixControlPropKey } from \"document/models/controlProps/controlPropKey.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { entries } from \"utils/entries.ts\"\nimport { extractTagsFromRichText } from \"utils/richTextUtils.ts\"\nimport { ensureStylePresetForTags } from \"utils/stylePresetUtils.ts\"\nimport { isArray, isObject, isString } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { createVariable } from \"../../properties/utils/createVariable.ts\"\nimport { createContentManagementNodeIfNeeded } from \"./createContentManagementNodeIfNeeded.ts\"\n\nexport const sampleCollectionName = \"Articles\"\n\ntype PartialImageControlProp = Pick<ImageControlProp, \"value\" | \"alt\">\n\ninterface BlogWithReferencesRecord {\n\ttitle: string\n\tslug: string\n\tdate: string\n\timage: PartialImageControlProp\n\tcontent: string\n\t/** Array of category slugs. We don't know the IDs until the collection is created. */\n\tcategories: string[]\n}\n\ninterface CategoryRecord {\n\tcategory: string\n\tslug: string\n}\n\n// Source Project: https://development.framer.com/projects/wnIfhupFogYd1xBX8qKN-1mCT6\nconst sampleBlogAssetsDevelopment = {\n\tmoduleIdentifier: parseModuleIdentifier(\"module:ODqTTu3YfLrgEzNXDlYz/Ss73IabPJloDiOobWAG7/YoupmcGsP.js:default\"),\n\tcontentImageIdentifiers: [\n\t\t\"f9RiWoNpmlCMqVRIHz8l8wYfeI.jpg\",\n\t\t\"2uTNEj5aTl2K3NJaEFWMbnrA.jpg\",\n\t\t\"BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",\n\t\t\"aNsAT3jCvt4zglbWCUoFe33Q.jpg\",\n\t\t\"GfGkADagM4KEibNcIiRUWlfrR0.jpg\",\n\t] as const,\n}\n\n// Source Project: https://framer.com/projects/6nSUtlAVxVGy2nBZStAN\nconst sampleBlogAssetsProduction = {\n\tmoduleIdentifier: parseModuleIdentifier(\"module:f49YpunYonWSK8c7dYEw/3CXffMITM3H11Ot7A8Mi/JYjdEl9gN.js:default\"),\n\tcontentImageIdentifiers: [\n\t\t\"f9RiWoNpmlCMqVRIHz8l8wYfeI.jpg\",\n\t\t\"2uTNEj5aTl2K3NJaEFWMbnrA.jpg\",\n\t\t\"BYnxEV1zjYb9bhWh1IwBZ1ZoS60.jpg\",\n\t\t\"aNsAT3jCvt4zglbWCUoFe33Q.jpg\",\n\t\t\"GfGkADagM4KEibNcIiRUWlfrR0.jpg\",\n\t] as const,\n}\n\nconst sampleBlogAssets = hostInfo.isProduction ? sampleBlogAssetsProduction : sampleBlogAssetsDevelopment\n\nfunction daysAgo(days: number): string {\n\treturn startOfDay(subDays(new Date(), days)).toISOString()\n}\n\nfunction getBlogSampleDataWithReferences(assetMap?: AssetMap): BlogWithReferencesRecord[] {\n\tconst [image1, image2, image3, image4, image5] = sampleBlogAssets.contentImageIdentifiers.map(identifier => {\n\t\tconst asset = assetMap?.assetForKey(identifier)\n\t\tif (!asset) return createAssetReference(identifier)\n\t\tassert(asset.properties?.image, \"Asset should have image properties\")\n\t\treturn createAssetReferenceForImage({\n\t\t\tidentifier,\n\t\t\tintrinsicSize: {\n\t\t\t\twidth: asset.properties.image.width,\n\t\t\t\theight: asset.properties.image.height,\n\t\t\t},\n\t\t})\n\t})\n\n\treturn [\n\t\t{\n\t\t\tslug: \"getting-started\",\n\t\t\ttitle: \"Getting Started\",\n\t\t\tdate: daysAgo(0),\n\t\t\timage: { value: image1, alt: \"Green Fern\" },\n\t\t\tcategories: [\"cms\", \"basics\"],\n\t\t\tcontent:\n\t\t\t\t`<h2>Editing Content</h2>` +\n\t\t\t\t`<p>You can choose to set up different types of input fields depending on your content. For instance, a blog might have a title, a slug, and a long-form field for formatted content. These may be different for a product directory or a photo blog, where you may need to add an image field. To edit the fields each CMS item will have, click on any of the column titles. This will trigger a modal to add new fields, where you can also re-arrange the fields or modify or delete the existing ones.</p>` +\n\t\t\t\t`<h2>Adding Content to the Canvas</h2>` +\n\t\t\t\t`<p>After setting up the content, go back to the canvas. Your collections are accessible from the Insert menu. Open the Insert menu, navigate to the CMS Content section, and drag and drop your collection onto the canvas. This will add a special stack with layers connected to your data. From here, you can edit the visual properties on the right, just as you would do with a regular Stack.</p>` +\n\t\t\t\t`<h2>Add a Page with Content</h2>` +\n\t\t\t\t`<p>If you wish to add a page instead that will automatically be populated with data from the CMS, navigate to the left panel. One you are in the <strong>Pages</strong> tab, click on the <code>+</code> button next to the CMS section. If you add the <strong>Index</strong> page, a page will be added with a list of all of the items in your collection. If you add the <strong>Detail</strong> page, you will be presented with a page with content from your individual items.</p>` +\n\t\t\t\t`<p><strong>Note</strong>: If you chose to add the sample data, a new detail page called <code>/blog</code> will be added to your website, and you will find the stack of content added into the page for you.</p>` +\n\t\t\t\t`<p>The detail page will display content pulled from the first entry of the collection by default. In order to preview other items in the collection, change the content by selecting a different item from the dropdown menu.</p>`,\n\t\t},\n\n\t\t{\n\t\t\tslug: \"whats-new\",\n\t\t\ttitle: \"What\u2019s New\",\n\t\t\tdate: daysAgo(7),\n\t\t\timage: {\n\t\t\t\tvalue: image2,\n\t\t\t\talt: \"Yellow Flower\",\n\t\t\t},\n\t\t\tcategories: [\"updates\"],\n\t\t\tcontent:\n\t\t\t\t`<h2>Reference Fields</h2>` +\n\t\t\t\t`<p>To add Pagination, select your Collection List, click on Pagination, select one of the two options, then pick how many items to load. Pagination also works with existing Limits and Start Offsets. Both the Spinner and Button are completely customizable, and you can pick any Variant for their Loading states. The Spinner itself is just a layer with a conic gradient and a Loop Effect, so you get full control. Adding Pagination helps make your blogs and changelogs much faster to load, especially when they contain dozens of items.</p>` +\n\t\t\t\t`<ul>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>Infinite Scrolling with custom Spinner component</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>Load More Button with custom Button component</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>Enjoy freeform positioning of both components</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>Design your own Loading and Hidden states</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>Make your CMS Pages much faster to load</p></li>` +\n\t\t\t\t`</ul>` +\n\t\t\t\t`<h2>Filtering</h2>` +\n\t\t\t\t`<p>We've added the ability to filter your collection lists in the CMS. This allows you to keep your content in a single collection, yet customize how that collection is presented on each of your web pages. For example, if you're creating docs for your app, you might want to filter articles per topic on your homepage. Or when creating a blog, you might want to filter your blog posts per category.</p>`,\n\t\t},\n\n\t\t{\n\t\t\tslug: \"styling-elements\",\n\t\t\ttitle: \"Styling Elements\",\n\t\t\tdate: daysAgo(35),\n\t\t\timage: {\n\t\t\t\tvalue: image3,\n\t\t\t\talt: \"Orange Flower\",\n\t\t\t},\n\t\t\tcategories: [\"pro-tips\"],\n\t\t\tcontent:\n\t\t\t\t`<h2>New This Month</h2>` +\n\t\t\t\t`<p>This quality update brings canvas and layer panel improvements. We've updated the Component symbol throughout the app to differentiate it from Grids. Plus, we've made Primary Breakpoints and Variants more distinct in the left panel, making it easier to see if you're editing the primary or an instance. Breakpoints will now also show the ranges in the layer panel. See more updates below.</p>` +\n\t\t\t\t`<h2>From January</h2>` +\n\t\t\t\t`<p>Last month, we added support for automatic tinting and new layout options for components, plus a whole lot of fixes and improvements. If you give your Page a Fill color, this will now also tint browsers like Safari and will ensure you don't get plain white backgrounds when overscrolling on any mobile device. Plus, we've added support for Min Max sizing to all Smart and Code components, greatly simplifying many common layouts and patterns. See the full changelog below.</p>` +\n\t\t\t\t`<ul>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>We automatically set the body background, based on your Page's fill color</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>You can now override the body background and customize per breakpoint</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>We now support Min Max sizing for all Smart and Code Component</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>We now consistently show the Min Max hint within the property panel</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>You can now use all alignment options for layers with Position set to Fixed</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>We now inform you if a parent layer height changes due to layout edits</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>We improved the Radius and Padding controls, no longer resetting values</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>Number inputs split in four no longer show steppers, so longer values fit</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>We improved Appear Effects using Scale with Spring transitions</p></li>` +\n\t\t\t\t`</ul>`,\n\t\t},\n\n\t\t{\n\t\t\tslug: \"importing-content\",\n\t\t\ttitle: \"Importing Content\",\n\t\t\tdate: daysAgo(45),\n\t\t\timage: {\n\t\t\t\tvalue: image4,\n\t\t\t\talt: \"Purple Flower\",\n\t\t\t},\n\t\t\tcategories: [\"cms\", \"pro-tips\"],\n\t\t\tcontent:\n\t\t\t\t`<h2>Prepare your CSV file</h2>` +\n\t\t\t\t`<p>Make sure your file is exported as a \"CSV\" file, also known as a \"Comma Separated Values\" file. If you encounter any issues you'll want to verify your file is UTF-8 encoded and less than 5mb. If your file is larger than that, try removing columns you may not need. See below for additional information on specific fields.</p>` +\n\t\t\t\t`<p><em>Tip: You do not have to import every column from your CSV. Only fields set up in your CMS collection in the next step will be imported.</em></p>` +\n\t\t\t\t`<h3>Rich Text Fields</h3>` +\n\t\t\t\t`<p>Formatted text content needs to be formatted as HTML. Many tags are supported, such as paragraphs and headers &lt;p&gt;,&lt;h1&gt;, &lt;h2&gt;), formatting (&lt;em&gt;, &lt;i&gt;, &lt;strong&gt;), links (&lt;a&gt;), lists (&lt;ol&gt;, &lt;ul&gt;, &lt;li&gt;) and images (&lt;img&gt;). Images from URLs will be automatically downloaded from their original source and imported into Framer.</p>` +\n\t\t\t\t`<h3>Image Fields</h3>` +\n\t\t\t\t`<p>Images in your CSV content must be URLs to an image. They will be downloaded and imported into Framer. Relative paths are not supported.</p>` +\n\t\t\t\t`<h3>Date Fields</h3>` +\n\t\t\t\t`<p>Recommended format is ISO8601 compliant, for example: 2023-12-17T14:42:00. The shorthand value of year-month-day is also supported, for example: 1982-12-01. Long format strings may work, but will depend on your browser, for example: Tue May 12 2020 18:50:21 GMT-0500 (Central Daylight Time). All time data, including time zone information, will be stripped from the date.</p>` +\n\t\t\t\t`<h3>Color Fields</h3>` +\n\t\t\t\t`<p>A color formatted as CSS hexadecimal RGB code, rgb, hls or hlv expression, or a named color. All variants with an alpha value are also supported. Examples: #00ffee, rgb(0, 153, 255), hsla(204, 100%, 50%, 0.5), blue, darkgreen, rebeccapurple.</p>` +\n\t\t\t\t`<h3>Toggle Fields</h3>` +\n\t\t\t\t`<p>A boolean value. Y, yes, TRUE, 1 will be interpreted as the toggle being \"Yes\", all other values will be \"No\". </p>` +\n\t\t\t\t`<h2>Prepare your CMS Collection</h2>` +\n\t\t\t\t`<p>Here is a checklist to prepare your CMS collection for importing.</p>` +\n\t\t\t\t`<ol>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>Verify each field/column in your CSV has a matching field in your CMS collection with the <em>same name.</em></p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>Include a unique field for each item, often named \"Slug\"</p></li>` +\n\t\t\t\t`<li data-preset-tag=\"p\"><p>Verify that your data types match <em>(eg. a CMS Date field for a date field in your data)</em></p></li>` +\n\t\t\t\t`</ol>` +\n\t\t\t\t`<p><em>Tip: Framer uses your Slug field to identify each item, and will use it to update that item with repeat imports.</em></p>` +\n\t\t\t\t`<h2>Import your CSV file</h2>` +\n\t\t\t\t`<p>You can find the Import feature by going to the CMS in your project, and clicking \"Import\" in the toolbar. From there, you can select your CSV file for importing. You may also drag &amp; drop your CSV file directly into the CMS collection interface.</p>` +\n\t\t\t\t`<p><em>Tip: Importing supports Undo / Redo actions. If you're not happy with the import, you can simply undo the change with <strong>CMD+Z</strong> on MacOS or <strong>CTRL + Z</strong> on Windows. Redo will not re-run the import, but instantly apply the changes to the collection.</em></p>` +\n\t\t\t\t`<h2>Updating or Re-Importing</h2>` +\n\t\t\t\t`<p>To update your content, you can import into the same collection again. If any item in the new import has a slug field that matches one of the items in your collection, you will be able to update it or skip importing it again.</p>`,\n\t\t},\n\n\t\t{\n\t\t\tslug: \"best-practices\",\n\t\t\ttitle: \"Best Practices\",\n\t\t\tdate: daysAgo(57),\n\t\t\timage: {\n\t\t\t\tvalue: image5,\n\t\t\t\talt: \"Lilac Flower\",\n\t\t\t},\n\t\t\tcategories: [\"pro-tips\"],\n\t\t\tcontent:\n\t\t\t\t`<h3>Choose Compelling Topics</h3>` +\n\t\t\t\t`<p>Use analytics tools to understand demographic data and user behavior. Tailor your content to address audience needs and interests, solving their specific problems. Conduct keyword research with tools like Google Keyword Planner or SEMrush. Analyze industry trends and competitors to select relevant and trending topics that improve SEO. Utilize headline analyzers like CoSchedule's Headline Analyzer. Craft titles that are clear, specific, and contain high-ranking keywords. Use power words to increase click-through rates.</p>` +\n\t\t\t\t`<h3>Organize Your Content</h3>` +\n\t\t\t\t`<p>Implement a clear structure using HTML tags for headings (H1, H2, H3) and lists (&lt;ul&gt;, &lt;ol&gt;). This enhances readability and SEO. Leverage CSS for formatting to improve UX. Embed high-quality images, infographics, charts, and graphs. Use Framer for creating visuals and optimize them with alt text for SEO. Ensure they are mobile-responsive. Place keywords naturally within the content, especially in headings and subheadings. Optimize meta descriptions, image alt texts, and use internal and external links.</p>` +\n\t\t\t\t`<h3>Pagination and SEO</h3>` +\n\t\t\t\t`<p>Consider adding pagination for extensive content lists, enhancing performance by reducing load times and improving user experience by making large amounts of content more readable and navigable. Additionally, pagination benefits SEO by facilitating easier search engine crawling and reducing bounce rates. By selecting a list of content coming from the blog, you can click the blue plus icon at the bottom to add infinite scrolling or a load more button. If you add pagination with infinite scrolling, try to avoid positioning layouts like pivots and footers below the loading content. This will help minimize layout shifts, thus not harming SEO.</p>` +\n\t\t\t\t`<h3>Monitor Performance</h3>` +\n\t\t\t\t`<p>Utilize the built-in Framer analytics to track performance metrics and adjust content strategy based on data insights. By combining these best practices with technical best techniques, you can create a blog that not only engages and informs but also performs well in search rankings and user engagement. Happy blogging!</p>`,\n\t\t},\n\t]\n}\n\nfunction getCategorySampleData(): CategoryRecord[] {\n\treturn [\n\t\t{\n\t\t\tslug: \"cms\",\n\t\t\tcategory: \"CMS\",\n\t\t},\n\t\t{\n\t\t\tslug: \"basics\",\n\t\t\tcategory: \"Basics\",\n\t\t},\n\t\t{\n\t\t\tslug: \"pro-tips\",\n\t\t\tcategory: \"Pro Tips\",\n\t\t},\n\t\t{\n\t\t\tslug: \"updates\",\n\t\t\tcategory: \"Updates\",\n\t\t},\n\t]\n}\n\nexport function uniqueCollectionName(contentManagementNode: ContentManagementNode, name: string): string {\n\t// FIXME If CMS Node will ever become shallow this code needs to be checked/updated\n\tconst existingCollectionNames = new Set(\n\t\tcontentManagementNode.isLoaded() ? contentManagementNode.children.map(child => child.name).filter(isString) : [],\n\t)\n\treturn uniqueName(name, existingCollectionNames)\n}\n\nfunction getTypeForBlogWithReferencesKey(key: keyof BlogWithReferencesRecord) {\n\tswitch (key) {\n\t\tcase \"image\":\n\t\t\treturn ControlType.Image\n\t\tcase \"date\":\n\t\t\treturn ControlType.Date\n\t\tcase \"content\":\n\t\t\treturn ControlType.RichText\n\t\tcase \"slug\":\n\t\tcase \"title\":\n\t\t\treturn ControlType.String\n\t\tcase \"categories\":\n\t\t\treturn ControlType.MultiCollectionReference\n\t\tdefault:\n\t\t\tassertNever(key, \"Each collection sample key should be associated with a control type\")\n\t}\n}\n\nasync function addSampleCollectionAssets(engine: VekterEngine) {\n\tconst projectId = engine.remoteDocument?.projectId\n\tif (!projectId) return\n\n\t// Check if we already have all the example assets in the project.\n\tconst hasSampleAssets = sampleBlogAssets.contentImageIdentifiers.every(identifier =>\n\t\tengine.stores.assetStore.assetMap.assetForKey(identifier),\n\t)\n\tif (hasSampleAssets) return\n\n\t// Copy over the module's assets from the source project.\n\ttry {\n\t\tawait engine.stores.assetStore.assetService?.duplicateModuleAssets(\n\t\t\tsampleBlogAssets.moduleIdentifier.moduleId,\n\t\t\tsampleBlogAssets.moduleIdentifier.saveId,\n\t\t)\n\t} catch {\n\t\t// TODO: Show a toast here.\n\t}\n}\n\nfunction ensureSampleCollectionStylePresets(engine: VekterEngine) {\n\tconst tags = new Set<string>()\n\tconst blogSample = getBlogSampleDataWithReferences()\n\n\tfor (const item of blogSample) {\n\t\textractTagsFromRichText(item.content, tags)\n\t}\n\n\tfor (const tag of [\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\", \"p\"]) {\n\t\ttags.add(tag)\n\t}\n\n\tensureStylePresetForTags(engine, tags)\n}\n\nexport async function loadSampleCollectionDependencies(engine: VekterEngine) {\n\tensureSampleCollectionStylePresets(engine)\n\tawait addSampleCollectionAssets(engine)\n}\n\nconst categoriesSampleCollectionName = \"Categories\"\n\nconst scopeType = \"collection\"\n\nexport async function createSampleCollection(\n\tengine: VekterEngine,\n\t{\n\t\tsource,\n\t\tshowCollectionAfterCreation = true,\n\t}: {\n\t\tsource: string\n\t\tshowCollectionAfterCreation?: boolean\n\t},\n): Promise<CollectionNode> {\n\tassert(projectFeatures.isOn(\"sites\"), \"CMS sample data should only be created for site projects\")\n\n\tconst [blogCollection, categoryCollection] = await engine.scheduler.processWhenReadyAsync(() => {\n\t\tconst contentManagementNode = createContentManagementNodeIfNeeded(engine.tree)\n\n\t\tconst categoryTitleVariableId = randomID()\n\n\t\tconst categoryVariablesByKey: Record<keyof CategoryRecord, CollectionVariableDefinition> = {\n\t\t\tcategory: createVariable(\n\t\t\t\t{\n\t\t\t\t\tid: categoryTitleVariableId,\n\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\tname: \"Title\",\n\t\t\t\t\tinitialValue: \"\",\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t),\n\t\t\tslug: createVariable(\n\t\t\t\t{\n\t\t\t\t\ttype: \"slug\",\n\t\t\t\t\tname: \"Slug\",\n\t\t\t\t\tinitialValue: \"\",\n\t\t\t\t\tassociatedStringVariable: categoryTitleVariableId,\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t),\n\t\t}\n\t\tconst categoryCollectionName = uniqueCollectionName(contentManagementNode, categoriesSampleCollectionName)\n\t\tconst categoryCollectionNode = new CollectionNode({\n\t\t\tname: categoryCollectionName,\n\t\t\tvariables: Object.values(categoryVariablesByKey),\n\t\t})\n\n\t\tconst blogTitleVariableId = randomID()\n\n\t\tconst blogVariablesByKey: Record<keyof BlogWithReferencesRecord, CollectionVariableDefinition> = {\n\t\t\ttitle: createVariable(\n\t\t\t\t{\n\t\t\t\t\tid: blogTitleVariableId,\n\t\t\t\t\ttype: ControlType.String,\n\t\t\t\t\tname: \"Title\",\n\t\t\t\t\tinitialValue: \"\",\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t),\n\t\t\tslug: createVariable(\n\t\t\t\t{\n\t\t\t\t\ttype: \"slug\",\n\t\t\t\t\tname: \"Slug\",\n\t\t\t\t\tinitialValue: \"\",\n\t\t\t\t\tassociatedStringVariable: blogTitleVariableId,\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t),\n\t\t\tdate: createVariable(\n\t\t\t\t{\n\t\t\t\t\ttype: ControlType.Date,\n\t\t\t\t\tname: \"Date\",\n\t\t\t\t\tinitialValue: \"\",\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t),\n\t\t\timage: createVariable(\n\t\t\t\t{\n\t\t\t\t\ttype: ControlType.Image,\n\t\t\t\t\tname: \"Image\",\n\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t),\n\t\t\tcategories: createVariable(\n\t\t\t\t{\n\t\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t\t\tname: \"Categories\",\n\t\t\t\t\tdataIdentifier: categoryCollectionNode.instanceIdentifier,\n\t\t\t\t\tinitialValue: [],\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t),\n\t\t\tcontent: createVariable(\n\t\t\t\t{\n\t\t\t\t\ttype: ControlType.RichText,\n\t\t\t\t\tname: \"Content\",\n\t\t\t\t\tinitialValue: \"\",\n\t\t\t\t},\n\t\t\t\tscopeType,\n\t\t\t),\n\t\t}\n\t\tconst blogCollectionName = uniqueCollectionName(contentManagementNode, sampleCollectionName)\n\t\tconst blogCollectionNode = new CollectionNode({\n\t\t\tname: blogCollectionName,\n\t\t\tvariables: Object.values(blogVariablesByKey),\n\t\t})\n\n\t\tgetCategorySampleData().forEach(categoryRecord => {\n\t\t\tconst controlProps: PrefixedControlProps<CollectionControlProp> = Object.fromEntries(\n\t\t\t\tentries(categoryRecord).map(([key, value]) => {\n\t\t\t\t\tconst controlProp: CollectionControlProp = { type: ControlType.String, value }\n\t\t\t\t\treturn [prefixControlPropKey(categoryVariablesByKey[key].id), controlProp]\n\t\t\t\t}),\n\t\t\t)\n\t\t\tconst collectionItem = CollectionItemNode.create(controlProps)\n\t\t\tcategoryCollectionNode.addChild(collectionItem)\n\t\t})\n\n\t\tconst categorySlugVariable = categoryCollectionNode.variables.find(variable => variable.type === \"slug\")\n\t\tassert(categorySlugVariable, \"Slug variable must exist\")\n\n\t\tgetBlogSampleDataWithReferences(engine.stores.assetStore.assetMap).forEach(blogRecord => {\n\t\t\tconst controlProps: PrefixedControlProps<CollectionControlProp> = Object.fromEntries(\n\t\t\t\tentries(blogRecord).map(([key, value]) => {\n\t\t\t\t\tconst type = getTypeForBlogWithReferencesKey(key)\n\t\t\t\t\tlet controlProp: CollectionControlProp\n\n\t\t\t\t\tif (type === ControlType.Image) {\n\t\t\t\t\t\tassert(isObject(value))\n\t\t\t\t\t\tcontrolProp = { type, ...value }\n\t\t\t\t\t} else if (type === ControlType.MultiCollectionReference) {\n\t\t\t\t\t\tassert(isArray(value))\n\n\t\t\t\t\t\t// Convert the slugs from sample data to actual references to the real IDs\n\t\t\t\t\t\tconst categoryReferences = categoryCollectionNode\n\t\t\t\t\t\t\t.getUnsortedChildren()\n\t\t\t\t\t\t\t.filter(item => {\n\t\t\t\t\t\t\t\tconst categoryControlProp = item.getControlProp(categorySlugVariable.id)\n\t\t\t\t\t\t\t\tassert(categoryControlProp?.type === ControlType.String, \"Slug must be a string\")\n\t\t\t\t\t\t\t\tassert(!isDynamicValue(categoryControlProp.value), \"Slug must not be a variable\")\n\t\t\t\t\t\t\t\tassert(isString(categoryControlProp.value), \"Slug must have a string value\")\n\t\t\t\t\t\t\t\treturn value.includes(categoryControlProp.value)\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.map(item => item.id)\n\n\t\t\t\t\t\tcontrolProp = { type, value: categoryReferences }\n\t\t\t\t\t} else {\n\t\t\t\t\t\tassert(isString(value))\n\t\t\t\t\t\tcontrolProp = { type, value }\n\t\t\t\t\t}\n\n\t\t\t\t\treturn [prefixControlPropKey(blogVariablesByKey[key].id), controlProp]\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tconst collectionItem = CollectionItemNode.create(controlProps)\n\t\t\tblogCollectionNode.addChild(collectionItem)\n\t\t})\n\n\t\tengine.stores.scopeStore.insertNode(blogCollectionNode, contentManagementNode.id)\n\t\tengine.stores.scopeStore.insertNode(categoryCollectionNode, contentManagementNode.id)\n\n\t\tif (showCollectionAfterCreation) {\n\t\t\tengine.stores.scopeStore.select(contentManagementNode.id, { keepHistory: false })\n\t\t\tengine.stores.selectionStore.set(blogCollectionNode.id)\n\t\t}\n\n\t\treturn [blogCollectionNode, categoryCollectionNode] as const\n\t})\n\n\tfunction compiledModulePromises() {\n\t\treturn [blogCollection, categoryCollection].map(collection =>\n\t\t\tengine.stores.codeGenerationStore\n\t\t\t\t.createModuleFromComponentSource(collection.draftOrCurrent())\n\t\t\t\t.then(modules => {\n\t\t\t\t\tmodules?.forEach(module => {\n\t\t\t\t\t\tif (module?.type !== ModuleType.Collection) return\n\t\t\t\t\t\trecord(\"collection_create\", {\n\t\t\t\t\t\t\tmoduleId: module.id,\n\t\t\t\t\t\t\trecordCount: collection.getItemCount(),\n\t\t\t\t\t\t\trecordSource: \"sample\",\n\t\t\t\t\t\t\tsource,\n\t\t\t\t\t\t})\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\t.catch(unhandledError),\n\t\t)\n\t}\n\n\tvoid compiledModulePromises()\n\n\treturn blogCollection\n}\n", "import { ModuleType, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport type { CollectionVariableDefinition } from \"document/models/CanvasTree/traits/CollectionVariableDefinition.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { createVariable } from \"../../properties/utils/createVariable.ts\"\nimport { createContentManagementNodeIfNeeded } from \"./createContentManagementNodeIfNeeded.ts\"\nimport { uniqueCollectionName } from \"./createSampleCollection.ts\"\n\nconst scopeType = \"collection\"\n\nexport function createCollection(engine: VekterEngine, source: string): CollectionNode | undefined {\n\tconst contentManagementNode = createContentManagementNodeIfNeeded(engine.tree)\n\tengine.stores.scopeStore.select(contentManagementNode.id, { keepHistory: false })\n\n\tconst variables: CollectionVariableDefinition[] = []\n\n\tconst titleVariable = createVariable(\n\t\t{\n\t\t\ttype: ControlType.String,\n\t\t\tname: \"Title\",\n\t\t\tinitialValue: \"\",\n\t\t},\n\t\tscopeType,\n\t)\n\tconst slugVariable = createVariable(\n\t\t{\n\t\t\ttype: \"slug\",\n\t\t\tname: \"Slug\",\n\t\t\tinitialValue: \"\",\n\t\t\tassociatedStringVariable: titleVariable.id,\n\t\t},\n\t\tscopeType,\n\t)\n\n\tvariables.push(titleVariable, slugVariable)\n\n\tconst contentVariable = createVariable(\n\t\t{\n\t\t\ttype: ControlType.RichText,\n\t\t\tname: \"Content\",\n\t\t\tinitialValue: \"\",\n\t\t},\n\t\tscopeType,\n\t)\n\tvariables.push(contentVariable)\n\n\tconst name = uniqueCollectionName(contentManagementNode, Dictionary.Collection)\n\tconst collection = new CollectionNode({ name, variables })\n\tengine.stores.scopeStore.insertNode(collection)\n\tengine.stores.selectionStore.set(collection.id)\n\n\tengine.stores.codeGenerationStore\n\t\t.createModuleFromComponentSource(collection.draftOrCurrent())\n\t\t.then(modules => {\n\t\t\tmodules?.forEach(module => {\n\t\t\t\tif (module?.type !== ModuleType.Collection) return\n\n\t\t\t\trecord(\"collection_create\", {\n\t\t\t\t\tmoduleId: module?.id,\n\t\t\t\t\trecordCount: collection.getItemCount(),\n\t\t\t\t\trecordSource: \"blank\",\n\t\t\t\t\tsource,\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t\t.catch(unhandledError)\n\treturn collection\n}\n", "import { assertNever, emptyArray } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { EngineChange } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport { getRouteSegmentRootNode } from \"document/models/CanvasTree/nodes/RouteSegmentRootNode.utils.ts\"\nimport {\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisLayoutTemplateNode,\n\tisRootNode,\n\tisRouteSegmentNode,\n\tisSmartComponentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { useDeprecatedEngineState } from \"document/useDeprecatedEngineState.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { useMemo } from \"react\"\nimport type {\n\tLocalizationSourceGroup,\n\tLocalizationSourceOrGroupStatus,\n} from \"../../localization/getLocalizationSources.ts\"\nimport { allFilterStatuses, withLocalizationSubGroups } from \"../../localization/getLocalizationSources.ts\"\nimport { getNameForLocalizationStatus } from \"../../localization/getNameForLocalizationStatus.ts\"\nimport { getTitleForLocalizationScope } from \"../../localization/getTitleForLocalizationScope.ts\"\nimport type { QuickActionsGroup, QuickActionsItem } from \"../types.ts\"\nimport { QuickActionsCategoryType, QuickActionsType } from \"../types.ts\"\nimport type { LocalizationScope } from \"./LocalizationScope.ts\"\nimport {\n\ttype GetQuickActionsCacheValue,\n\ttype SetQuickActionsCacheValue,\n\tuseQuickActionsCache,\n} from \"./useQuickActionCache.ts\"\n\nfunction getLocalizationSourceRoots(): {\n\twebPagesAndRoutesWithLocalizedValues: ReadonlySet<NodeID>\n\tsmartComponentsWithLocalizedValues: ReadonlySet<NodeID>\n\tcollectionsWithLocalizedValues: ReadonlySet<NodeID>\n\tlayoutTemplatesWithLocalizedValues: ReadonlySet<NodeID>\n} {\n\tconst webPagesAndRoutesWithLocalizedValues = new Set<NodeID>()\n\tconst smartComponentsWithLocalizedValues = new Set<NodeID>()\n\tconst collectionsWithLocalizedValues = new Set<NodeID>()\n\tconst layoutTemplatesWithLocalizedValues = new Set<NodeID>()\n\tconst result = {\n\t\twebPagesAndRoutesWithLocalizedValues,\n\t\tsmartComponentsWithLocalizedValues,\n\t\tcollectionsWithLocalizedValues,\n\t\tlayoutTemplatesWithLocalizedValues,\n\t}\n\n\tconst groups = engine.stores.localizationStore.groups\n\tif (!groups) return result\n\n\tfunction handleGroup(group: LocalizationSourceGroup) {\n\t\tif (withLocalizationSubGroups(group)) {\n\t\t\tfor (const subGroup of group.groups) {\n\t\t\t\thandleGroup(subGroup)\n\t\t\t}\n\t\t}\n\n\t\tconst localizationScope = engine.tree.get<LocalizationScope>(group.nodeId)\n\t\t// TODO Check and handle shallow/fully loaded scope state\n\t\tif (!localizationScope) return\n\t\tif (isRootNode(localizationScope)) return\n\n\t\tif (isRouteSegmentNode(localizationScope)) {\n\t\t\twebPagesAndRoutesWithLocalizedValues.add(localizationScope.id)\n\t\t} else if (isCollectionNode(localizationScope)) {\n\t\t\tcollectionsWithLocalizedValues.add(localizationScope.id)\n\t\t} else if (isCollectionItemNode(localizationScope)) {\n\t\t\tassert(localizationScope.parentid, \"Collection item scope does not have a parent\")\n\t\t\tcollectionsWithLocalizedValues.add(localizationScope.parentid)\n\t\t} else if (isWebPageNode(localizationScope)) {\n\t\t\twebPagesAndRoutesWithLocalizedValues.add(localizationScope.id)\n\t\t} else if (isSmartComponentNode(localizationScope)) {\n\t\t\tsmartComponentsWithLocalizedValues.add(localizationScope.id)\n\t\t} else if (isLayoutTemplateNode(localizationScope)) {\n\t\t\tlayoutTemplatesWithLocalizedValues.add(localizationScope.id)\n\t\t} else {\n\t\t\tassertNever(localizationScope, \"Invalid localization scope\")\n\t\t}\n\t}\n\n\tfor (const group of groups) {\n\t\thandleGroup(group)\n\t}\n\n\treturn result\n}\n\nconst clearFilterId = \"Clear\"\n\nexport function performLocaleScopeFilterAction(id: NodeID) {\n\tengine.stores.localizationStore.scopeFilter = id === clearFilterId ? null : id\n}\n\nfunction collectCMSQuickActions(\n\tcollectionsWithLocalizedValues: ReadonlySet<string>,\n\tresult: QuickActionsGroup[],\n\tgetCachedAction: GetQuickActionsCacheValue,\n\tsetCachedAction: SetQuickActionsCacheValue,\n) {\n\tif (collectionsWithLocalizedValues.size === 0) return\n\n\tconst collectionNodeActionItems: QuickActionsItem[] = []\n\tconst collectionItemNodeActionGroups: QuickActionsGroup[] = []\n\n\t// FIXME If CMS Node will ever become shallow this code needs to be checked/updated\n\tconst contentManagementNode = getContentManagementNode(engine.tree)?.loaded\n\n\tif (!contentManagementNode) return\n\n\tfor (const collectionNode of contentManagementNode.children) {\n\t\tif (!isCollectionNode(collectionNode)) continue\n\t\tif (!collectionsWithLocalizedValues.has(collectionNode.id)) continue\n\n\t\tconst cached = getCachedAction(collectionNode)\n\t\tif (cached) {\n\t\t\tcollectionNodeActionItems.push(cached)\n\t\t} else {\n\t\t\tconst item: QuickActionsItem = {\n\t\t\t\tkind: \"item\",\n\t\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\t\tid: collectionNode.id,\n\t\t\t\tname: getTitleForLocalizationScope(collectionNode, engine.tree, engine.componentLoader),\n\t\t\t\ticon: \"IconCMS\",\n\t\t\t}\n\t\t\tsetCachedAction(collectionNode, item)\n\t\t\tcollectionNodeActionItems.push(item)\n\t\t}\n\n\t\tconst itemActions: QuickActionsItem[] = []\n\t\tfor (const collectionItemNode of collectionNode.getUnsortedChildren()) {\n\t\t\tif (!isCollectionItemNode(collectionItemNode)) continue\n\n\t\t\tconst cachedAction = getCachedAction(collectionItemNode)\n\t\t\tif (cachedAction) {\n\t\t\t\titemActions.push(cachedAction)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tconst item: QuickActionsItem = {\n\t\t\t\tkind: \"item\",\n\t\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\t\tid: collectionItemNode.id,\n\t\t\t\tname: getTitleForLocalizationScope(collectionItemNode, engine.tree, engine.componentLoader),\n\t\t\t\ticon: \"IconFile\",\n\t\t\t}\n\t\t\tsetCachedAction(collectionItemNode, item)\n\t\t\titemActions.push(item)\n\t\t}\n\n\t\tif (itemActions.length > 0) {\n\t\t\tcollectionItemNodeActionGroups.push({\n\t\t\t\tkind: \"group\",\n\t\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\t\ttitle: collectionNode.name ? `${collectionNode.name} Items` : Dictionary.Unknown,\n\t\t\t\titems: itemActions,\n\t\t\t})\n\t\t}\n\t}\n\n\tif (collectionNodeActionItems.length > 0) {\n\t\tresult.push({\n\t\t\tkind: \"group\",\n\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\ttitle: Dictionary.Cms,\n\t\t\titems: collectionNodeActionItems,\n\t\t})\n\t}\n\n\tresult.push(...collectionItemNodeActionGroups)\n}\n\nexport function useLocaleScopeFilterQuickActions(activeCategory: QuickActionsCategoryType): QuickActionsGroup[] {\n\tconst [getCachedAction, setCachedAction] = useQuickActionsCache()\n\n\treturn useDeprecatedEngineState(\n\t\t[EngineChange.Tree, EngineChange.ActiveBundle, engine.stores.localizationStore],\n\t\t() => {\n\t\t\tif (activeCategory !== QuickActionsCategoryType.LocaleScopeFilter) return []\n\n\t\t\tconst result: QuickActionsGroup[] = []\n\n\t\t\tconst { scopeStore } = engine.stores\n\n\t\t\tconst {\n\t\t\t\twebPagesAndRoutesWithLocalizedValues: webPagesWithLocalizedValues,\n\t\t\t\tsmartComponentsWithLocalizedValues,\n\t\t\t\tlayoutTemplatesWithLocalizedValues,\n\t\t\t\tcollectionsWithLocalizedValues,\n\t\t\t} = getLocalizationSourceRoots()\n\n\t\t\tif (webPagesWithLocalizedValues.size > 0) {\n\t\t\t\tconst items: QuickActionsItem[] = []\n\n\t\t\t\tfor (const webPageNode of scopeStore.getWebPageNodes()) {\n\t\t\t\t\tif (!webPagesWithLocalizedValues.has(webPageNode.id)) continue\n\t\t\t\t\t// TODO Check and handle shallow/fully loaded scope state\n\t\t\t\t\tif (!webPageNode.isLoaded()) continue\n\n\t\t\t\t\tconst cached = getCachedAction(webPageNode)\n\t\t\t\t\tif (cached) {\n\t\t\t\t\t\titems.push(cached)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tconst item: QuickActionsItem = {\n\t\t\t\t\t\tkind: \"item\",\n\t\t\t\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\t\t\t\tid: webPageNode.id,\n\t\t\t\t\t\tname: getTitleForLocalizationScope(webPageNode, engine.tree, engine.componentLoader),\n\t\t\t\t\t\ticon: \"IconGlobe\",\n\t\t\t\t\t}\n\t\t\t\t\tsetCachedAction(webPageNode, item)\n\t\t\t\t\titems.push(item)\n\t\t\t\t}\n\n\t\t\t\tconst routeSegmentRootNode = getRouteSegmentRootNode(engine.tree)\n\t\t\t\tfor (const routeSegmentNode of routeSegmentRootNode.walk()) {\n\t\t\t\t\tif (!isRouteSegmentNode(routeSegmentNode)) continue\n\t\t\t\t\tif (!webPagesWithLocalizedValues.has(routeSegmentNode.id)) continue\n\n\t\t\t\t\tconst cached = getCachedAction(routeSegmentNode)\n\t\t\t\t\tif (cached) {\n\t\t\t\t\t\titems.push(cached)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst item: QuickActionsItem = {\n\t\t\t\t\t\t\tkind: \"item\",\n\t\t\t\t\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\t\t\t\t\tid: routeSegmentNode.id,\n\t\t\t\t\t\t\tname: getTitleForLocalizationScope(routeSegmentNode, engine.tree, engine.componentLoader),\n\t\t\t\t\t\t\ticon: \"IconGlobe\",\n\t\t\t\t\t\t}\n\t\t\t\t\t\tsetCachedAction(routeSegmentNode, item)\n\t\t\t\t\t\titems.push(item)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tresult.push({\n\t\t\t\t\tkind: \"group\",\n\t\t\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\t\t\ttitle: \"Web Pages\",\n\t\t\t\t\titems,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (smartComponentsWithLocalizedValues.size > 0) {\n\t\t\t\tconst items: QuickActionsItem[] = []\n\n\t\t\t\tfor (const smartComponentNode of scopeStore.getSmartComponentNodes()) {\n\t\t\t\t\tif (!smartComponentsWithLocalizedValues.has(smartComponentNode.id)) continue\n\t\t\t\t\t// TODO Check and handle shallow/fully loaded scope state\n\t\t\t\t\tif (!smartComponentNode.isLoaded()) continue\n\n\t\t\t\t\tconst cached = getCachedAction(smartComponentNode)\n\t\t\t\t\tif (cached) {\n\t\t\t\t\t\titems.push(cached)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tconst item: QuickActionsItem = {\n\t\t\t\t\t\tkind: \"item\",\n\t\t\t\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\t\t\t\tid: smartComponentNode.id,\n\t\t\t\t\t\tname: getTitleForLocalizationScope(smartComponentNode, engine.tree, engine.componentLoader),\n\t\t\t\t\t\ticon: \"IconComponent\",\n\t\t\t\t\t}\n\t\t\t\t\tsetCachedAction(smartComponentNode, item)\n\t\t\t\t\titems.push(item)\n\t\t\t\t}\n\n\t\t\t\tresult.push({\n\t\t\t\t\tkind: \"group\",\n\t\t\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\t\t\ttitle: \"Components\",\n\t\t\t\t\titems,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (layoutTemplatesWithLocalizedValues.size > 0) {\n\t\t\t\tconst items: QuickActionsItem[] = []\n\n\t\t\t\tfor (const layoutTemplateNode of scopeStore.getLayoutTemplateNodes()) {\n\t\t\t\t\tif (!layoutTemplatesWithLocalizedValues.has(layoutTemplateNode.id)) continue\n\t\t\t\t\t// TODO Check and handle shallow/fully loaded scope state\n\t\t\t\t\tif (!layoutTemplateNode.isLoaded()) continue\n\n\t\t\t\t\tconst cached = getCachedAction(layoutTemplateNode)\n\t\t\t\t\tif (cached) {\n\t\t\t\t\t\titems.push(cached)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tconst item: QuickActionsItem = {\n\t\t\t\t\t\tkind: \"item\",\n\t\t\t\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\t\t\t\tid: layoutTemplateNode.id,\n\t\t\t\t\t\tname: getTitleForLocalizationScope(layoutTemplateNode, engine.tree, engine.componentLoader),\n\t\t\t\t\t\ticon: \"IconLayoutTemplate\",\n\t\t\t\t\t}\n\t\t\t\t\tsetCachedAction(layoutTemplateNode, item)\n\t\t\t\t\titems.push(item)\n\t\t\t\t}\n\n\t\t\t\tresult.push({\n\t\t\t\t\tkind: \"group\",\n\t\t\t\t\ttype: QuickActionsType.LocaleScopeFilter,\n\t\t\t\t\ttitle: Dictionary.Templates,\n\t\t\t\t\titems,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tcollectCMSQuickActions(collectionsWithLocalizedValues, result, getCachedAction, setCachedAction)\n\n\t\t\treturn result\n\t\t},\n\t\t[activeCategory],\n\t\ttrue,\n\t)\n}\n\nexport function performLocaleStatusFilterAction(_id: string) {\n\tconst id = _id as LocalizationSourceOrGroupStatus | typeof clearFilterId\n\tengine.stores.localizationStore.status = id === clearFilterId ? null : id\n}\n\nexport function useLocaleStatusFilterQuickActions(\n\tactiveCategory: QuickActionsCategoryType,\n): readonly QuickActionsGroup[] {\n\tconst statusFilter = engine.stores.localizationStore.useState(state => state.status)\n\n\treturn useMemo<readonly QuickActionsGroup[]>(() => {\n\t\tif (activeCategory !== QuickActionsCategoryType.LocaleStatusFilter) {\n\t\t\treturn emptyArray()\n\t\t}\n\n\t\tconst items: QuickActionsItem[] = []\n\n\t\tif (statusFilter) {\n\t\t\titems.push({\n\t\t\t\tkind: \"item\",\n\t\t\t\ttype: QuickActionsType.LocaleStatusFilter,\n\t\t\t\tname: \"View All\",\n\t\t\t\tid: clearFilterId,\n\t\t\t})\n\t\t}\n\n\t\tfor (const status of allFilterStatuses) {\n\t\t\tif (status === statusFilter) continue\n\n\t\t\titems.push({\n\t\t\t\tkind: \"item\",\n\t\t\t\ttype: QuickActionsType.LocaleStatusFilter,\n\t\t\t\tname: getNameForLocalizationStatus(status),\n\t\t\t\tid: status,\n\t\t\t})\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tkind: \"group\",\n\t\t\t\ttype: QuickActionsType.LocaleStatusFilter,\n\t\t\t\ttitle: \"Status\",\n\t\t\t\titems,\n\t\t\t},\n\t\t]\n\t}, [activeCategory, statusFilter])\n}\n", "import { shouldBeNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { LocalizationSourceOrGroupStatus, LocalizationSourceStatus } from \"./getLocalizationSources.ts\"\n\nexport function getNameForLocalizationStatus(\n\tstatus: LocalizationSourceOrGroupStatus | LocalizationSourceStatus,\n): string {\n\tswitch (status) {\n\t\tcase \"done\":\n\t\t\treturn \"Done\"\n\t\tcase \"new\":\n\t\t\treturn \"New\"\n\t\tcase \"needsReview\":\n\t\t\treturn `To ${Dictionary.Review}`\n\t\tcase \"warning\":\n\t\t\treturn \"Warning\"\n\t\tcase \"hidden\":\n\t\t\treturn \"Hidden\"\n\t\tdefault:\n\t\t\tshouldBeNever(status)\n\t\t\treturn \"\"\n\t}\n}\n", "import { useCallback } from \"react\"\nimport { useConstant } from \"utils/useConstant.ts\"\nimport type { QuickActionsItem } from \"../types.ts\"\n\ntype NestedQuickActionsCache<PrimaryKey extends object = object, SecondaryKey extends object = object> = WeakMap<\n\tPrimaryKey,\n\tWeakMap<SecondaryKey, QuickActionsItem>\n>\n\nfunction createWeakMap() {\n\treturn new WeakMap()\n}\n\nfunction createNestedWeakMap<PK extends object, SK extends object>(): NestedQuickActionsCache<PK, SK> {\n\treturn createWeakMap()\n}\n\nexport type GetQuickActionsCacheValue<K = object> = (key: K) => QuickActionsItem | undefined\n\nexport type SetQuickActionsCacheValue<K = object> = (key: K, value: QuickActionsItem) => QuickActionsItem\n\nexport function useQuickActionsCache<K extends object = object>(): [\n\tGetQuickActionsCacheValue<K>,\n\tSetQuickActionsCacheValue<K>,\n] {\n\tconst cache = useConstant(createWeakMap)\n\n\tconst getCache = useCallback((key: K): QuickActionsItem | undefined => {\n\t\treturn cache.get(key)\n\t}, [])\n\n\tconst setCache = useCallback((key: K, value: QuickActionsItem) => {\n\t\tcache.set(key, value)\n\t\treturn value\n\t}, [])\n\n\treturn [getCache, setCache] as const\n}\n\ntype GetNestedQuickActionsCacheValue<PrimaryKey = object, SecondaryKey = object> = (\n\tprimaryKey: PrimaryKey,\n\tsecondaryKey: SecondaryKey,\n) => QuickActionsItem | undefined\n\ntype SetNestedQuickActionsCacheValue<PrimaryKey = object, SecondaryKey = object> = (\n\tprimaryKey: PrimaryKey,\n\tsecondaryKey: SecondaryKey,\n\tvalue: QuickActionsItem,\n) => QuickActionsItem\n\nexport function useNestedQuickActionsCache<PrimaryKey extends object, SecondaryKey extends object>(): [\n\tGetNestedQuickActionsCacheValue<PrimaryKey, SecondaryKey>,\n\tSetNestedQuickActionsCacheValue<PrimaryKey, SecondaryKey>,\n] {\n\tconst cache = useConstant(createNestedWeakMap)\n\n\tconst getCache = useCallback((primaryKey: PrimaryKey, secondaryKey: SecondaryKey): QuickActionsItem | undefined => {\n\t\tconst secondaryMap = cache.get(primaryKey)\n\t\tif (!secondaryMap) return undefined\n\t\treturn secondaryMap.get(secondaryKey)\n\t}, [])\n\n\tconst setCache = useCallback((primaryKey: PrimaryKey, secondaryKey: SecondaryKey, value: QuickActionsItem) => {\n\t\tlet secondaryMap = cache.get(primaryKey)\n\t\tif (!secondaryMap) {\n\t\t\tsecondaryMap = new WeakMap<SecondaryKey, QuickActionsItem>()\n\t\t\tcache.set(primaryKey, secondaryMap)\n\t\t}\n\t\tsecondaryMap.set(secondaryKey, value)\n\t\treturn value\n\t}, [])\n\n\treturn [getCache, setCache] as const\n}\n", "import { Tooltip } from \"@framerjs/fresco\"\nimport { useDimensionValue } from \"app/agent/hooks/useDimensionValue.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type React from \"react\"\n\ninterface ToolbarTooltipProps {\n\tchildren: React.ReactNode\n\tcolorVariant?: React.ComponentProps<typeof Tooltip>[\"colorVariant\"]\n\tdirection?: React.ComponentProps<typeof Tooltip>[\"direction\"]\n\tenabled: boolean\n\toffsetDelta?: number\n\ttext: string\n\tshortcut?: string\n}\n\nexport function useToolbarTooltipVariant(\n\tvariant?: React.ComponentProps<typeof Tooltip>[\"variant\"],\n): React.ComponentProps<typeof Tooltip>[\"variant\"] {\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\treturn variant ?? (isAgentExperimentOn ? \"toolbar\" : \"default\")\n}\n\nexport function getNativeToolbarTooltipText(text: string, shortcut?: string): string {\n\treturn shortcut ? `${text} (${shortcut})` : text\n}\n\nfunction getToolbarTooltipPositionOffset(\n\tdirection: React.ComponentProps<typeof Tooltip>[\"direction\"],\n\toffset: number,\n): React.ComponentProps<typeof Tooltip>[\"positionOffset\"] {\n\tswitch (direction) {\n\t\tcase \"left\":\n\t\tcase \"right\":\n\t\t\treturn { x: offset }\n\t\tcase \"top\":\n\t\tcase \"bottom\":\n\t\tcase undefined:\n\t\t\treturn { y: offset }\n\t}\n}\n\nexport function ToolbarTooltip({\n\tchildren,\n\tcolorVariant,\n\tdirection,\n\tenabled,\n\toffsetDelta = 0,\n\ttext,\n\tshortcut,\n}: ToolbarTooltipProps) {\n\tconst defaultTooltipOffset = useDimensionValue(\"tooltipOffset\")\n\tconst tooltipOffset = defaultTooltipOffset + offsetDelta\n\n\tif (!enabled) return children\n\n\treturn (\n\t\t<Tooltip\n\t\t\ttext={text}\n\t\t\tshortcut={shortcut}\n\t\t\tcolorVariant={colorVariant}\n\t\t\tdirection={direction}\n\t\t\tvariant=\"toolbar\"\n\t\t\tpositionOffset={getToolbarTooltipPositionOffset(direction, tooltipOffset)}\n\t\t>\n\t\t\t{children}\n\t\t</Tooltip>\n\t)\n}\n", "import engine from \"document/engine.ts\"\nimport React, { useCallback } from \"react\"\nimport { PopoutButton } from \"../../shared/PopoutButton.tsx\"\nimport { useRename } from \"../utils/useRename.tsx\"\nimport * as styles from \"./StyleAssetRow.styles.ts\"\n\ninterface Props {\n\t/* The content to render when it is not renaming */\n\tchildren: React.ReactNode\n\t/* 14x14 */\n\ticon: React.ReactNode\n\tid: string\n\tname: string\n\tpopout: React.ReactNode\n\tdisplayPopoutDivider: boolean\n\tisViewOnly?: boolean\n\tonContextMenu?(event: React.MouseEvent, startRenaming: () => void): void\n}\n\n/**\n * Renamable style asset row with popout\n */\nexport const StyleAssetRow = React.memo(\n\t({ children, icon, id, name, popout, displayPopoutDivider, onContextMenu, isViewOnly }: Props) => {\n\t\tconst [startRenaming, isRenaming, onRename, cancelRename] = useRename(engine, id)\n\n\t\tfunction confirmRename(event: React.SyntheticEvent<HTMLInputElement>) {\n\t\t\tonRename(event.currentTarget.value.trim() || name)\n\t\t}\n\n\t\tfunction renameWithEnter(event: React.KeyboardEvent<HTMLInputElement>) {\n\t\t\t// don't propagate keyboard events to the popout button when renaming\n\t\t\tevent.stopPropagation()\n\n\t\t\tif (event.key === \"Enter\") {\n\t\t\t\tconfirmRename(event)\n\t\t\t}\n\n\t\t\tif (event.key === \"Escape\") {\n\t\t\t\tcancelRename()\n\t\t\t}\n\t\t}\n\n\t\tfunction handleClick(event: React.MouseEvent) {\n\t\t\tif (isRenaming) {\n\t\t\t\t// don't propagate clicks to the popout button when renaming\n\t\t\t\tevent.stopPropagation()\n\t\t\t}\n\t\t}\n\n\t\tfunction handleContextMenu(event: React.MouseEvent) {\n\t\t\tonContextMenu?.(event, startRenaming)\n\t\t}\n\n\t\tfunction handleFocus(event: React.FocusEvent<HTMLInputElement>) {\n\t\t\tevent.target.select()\n\t\t}\n\n\t\tconst handleDoubleClick = useCallback(() => {\n\t\t\tif (isViewOnly || isRenaming) return\n\t\t\tstartRenaming()\n\t\t}, [isViewOnly, isRenaming, startRenaming])\n\n\t\treturn (\n\t\t\t<PopoutButton\n\t\t\t\tdisplayDivider={displayPopoutDivider}\n\t\t\t\tid={getAssetStylePopoutId(id)}\n\t\t\t\tpopout={popout}\n\t\t\t\tnavigationTitle={isViewOnly ? name : `Edit ${name}`}\n\t\t\t\tonContextMenu={handleContextMenu}\n\t\t\t\tonDoubleClick={handleDoubleClick}\n\t\t\t\ttogglePopoutEnabled\n\t\t\t\tclassName={styles.button}\n\t\t\t>\n\t\t\t\t<div className={styles.icon}>{icon}</div>\n\t\t\t\t{isRenaming ? (\n\t\t\t\t\t<input\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\tclassName={styles.input}\n\t\t\t\t\t\tplaceholder={name}\n\t\t\t\t\t\tdefaultValue={name}\n\t\t\t\t\t\tonBlur={confirmRename}\n\t\t\t\t\t\tonKeyDown={renameWithEnter}\n\t\t\t\t\t\tonClick={handleClick}\n\t\t\t\t\t\tonFocus={handleFocus}\n\t\t\t\t\t\tautoCorrect=\"off\"\n\t\t\t\t\t\tspellCheck={false}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\tchildren\n\t\t\t\t)}\n\t\t\t</PopoutButton>\n\t\t)\n\t},\n)\n\nexport function getAssetStylePopoutId(id: string): string {\n\treturn `asset-style-popout-${id}`\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { useState } from \"react\"\n\nexport function useRename(engine: VekterEngine, nodeId: string) {\n\tconst [isRenaming, setIsRenaming] = useState(false)\n\n\tfunction startRenaming() {\n\t\tsetIsRenaming(true)\n\t}\n\n\tconst onRename = engine.scheduler.wrapHandler((name: string) => {\n\t\tengine.tree.get(nodeId)?.set({ name })\n\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\tsetIsRenaming(false)\n\t\t})\n\t})\n\n\tfunction cancelRename() {\n\t\tsetIsRenaming(false)\n\t}\n\n\treturn [startRenaming, isRenaming, onRename, cancelRename] as const\n}\n", "import \"StyleAssetRow.styles_1fz8xf4.wyw.css\"; export const input = \"input_i1ldific\";\nexport const button = \"button_b1l2hhm2\";\nexport const icon = \"icon_iw2pulc\";", "import { assert } from \"@framerjs/shared\"\nimport { getEntityTypeRootIdForNode } from \"app/ai/agents/TreeResolver.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport type { BlockquoteStylePresetNode } from \"document/models/CanvasTree/nodes/BlockquoteStylePresetNode.ts\"\nimport type { ColorStyleTokenNode } from \"document/models/CanvasTree/nodes/ColorStyleTokenNode.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 { isStylePresetNode } from \"document/models/CanvasTree/nodes/utils/isStylePresetNode.ts\"\nimport { isColorStyleTokenNode, isComponentPresetNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ActiveContentPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { getAssetStylePopoutId } from \"../../properties/rows/StyleAssetRow.tsx\"\nimport { getPopoutElementById } from \"../../shared/PopoutButton.tsx\"\nimport { popoutWindow } from \"../../shared/PopoutWindow.tsx\"\nimport { expandAssetEntityItemsFromNode } from \"./expandAssetEntityItems.ts\"\n\nexport type AssetStyleNode =\n\t| TextStylePresetNode\n\t| LinkStylePresetNode\n\t| BlockquoteStylePresetNode\n\t| TableStylePresetNode\n\t| InlineCodeStylePresetNode\n\t| ImageStylePresetNode\n\t| ColorStyleTokenNode\n\t| ComponentPresetNode\n\nexport function isAssetStyleNode(node: CanvasNode | null | undefined): node is AssetStyleNode {\n\treturn isStylePresetNode(node) || isColorStyleTokenNode(node) || isComponentPresetNode(node)\n}\n\nexport function openAssetStyleInAssetsPanel(engine: VekterEngine, preset: AssetStyleNode): void {\n\tengine.stores.chromeStore.contentPanelTab = ActiveContentPanelTab.Assets\n\tconst entityTypeRootId = getEntityTypeRootIdForNode(preset)\n\tassert(entityTypeRootId, \"Asset style node must have an entity type root id.\")\n\texpandAssetEntityItemsFromNode(engine, preset.id, entityTypeRootId, false)\n\n\tengine.scheduler.runBeforeNextFrame(() => {\n\t\tconst popoutId = getAssetStylePopoutId(preset.id)\n\t\tconst element = getPopoutElementById(popoutId)\n\t\telement?.scrollIntoView()\n\n\t\tif (popoutWindow.navigation.isPresenting(popoutId)) return\n\t\tpopoutWindow.navigation.presentPopout(popoutId)\n\t})\n}\n", "import { Dictionary } from \"app/dictionary.ts\"\nimport type { AppAction } from \"./AppActions.ts\"\n\ntype ActionLabels = {\n\t[key in AppAction]?: string\n}\n\nexport const actionLabels: ActionLabels = {\n\t// file\n\tarchiveProject: \"Archive\",\n\tcopyProjectLink: \"Copy Project Link\",\n\tcopyRemixLink: \"Copy Remix Link\",\n\tcopyAIKitRemixLink: \"Copy AI Kit Remix Link\",\n\tduplicateProject: Dictionary.Duplicate,\n\tgoToProjects: \"Go to Dashboard\",\n\timportFigma: \"Import from Figma\",\n\tinviteCollaborators: \"Invite Collaborators\",\n\tnewProject: Dictionary.New,\n\topenPublishedSite: \"Open Site\",\n\tpublishSite: \"Publish Site\",\n\tquickActions: \"Quick Actions\",\n\tsaveTemplateAsProject: \"Save as Project\",\n\ttransferProject: \"Transfer Project\",\n\tunarchiveProject: \"Unarchive\",\n\tuploadImage: \"Upload Image\",\n\tuploadVideo: \"Upload Video\",\n\ttoggleVersionHistory: \"Version History\",\n\ttoggleLocalization: Dictionary.Localization,\n\ttoggleContentManagement: Dictionary.Cms,\n\topenAnalytics: Dictionary.Analytics,\n\topenCanvas: Dictionary.Canvas,\n\topenCMS: Dictionary.Cms,\n\topenLocalization: Dictionary.Localization,\n\topenEvaluations: Dictionary.Evaluations,\n\topenSettings: Dictionary.Settings,\n\n\t// settings\n\topenGeneralSettings: \"General\",\n\topenDomainSettings: \"Domains\",\n\topenRedirects: \"Redirects\",\n\topenForms: \"Forms\",\n\topenStagingAndVersions: \"Versions\",\n\topenUsage: \"Usage\",\n\topenPlans: \"Plans\",\n\topenCustomCode: Dictionary.CustomCode,\n\tsaveSiteSettings: \"Save Settings\",\n\n\t// preferences\n\tnewContentAsDraft: \"Auto-Draft Content\",\n\tuseDirectSelect: \"Use Direct Selection\",\n\tautoSwitchToLayers: \"Auto Switch to Layers Panel\",\n\tuseSmartLayoutPins: \"Auto Layout Pinning\",\n\treverseZoomDirection: \"Reverse Zoom Direction\",\n\tfastZoom: \"Fast Zoom\",\n\tanimateOnZoom: \"Animate on Zoom\",\n\tkeyboardZoomsToSelection: \"Keyboard Zooms to Selection\",\n\tshowScrollToContentToast: \"Off-Screen Content Hint\",\n\tresetDefaultFrameBackground: \"Reset Default Frame Fill\",\n\tnudgePreferences: \"Nudge Amount\",\n\ttogglePerformanceMode: \"Performance Mode\",\n\ttoggleCanvasPages: \"Canvas Pages\",\n\texitCanvasOnDoubleClick: \"Exit Canvas on Double Click\",\n\ttemplatesModalOnNewProject: \"Show Templates on New Project\",\n\n\t// edit\n\tundo: \"Undo\",\n\tredo: \"Redo\",\n\tgoBack: \"Back\",\n\tgoForward: \"Forward\",\n\tcut: \"Cut\",\n\tcopy: Dictionary.Copy,\n\tcopyStyle: \"Copy Style\",\n\tcopyFill: \"Copy Fill\",\n\tcopyLink: Dictionary.CopyLink,\n\tcopyNodeId: \"Copy Node ID\",\n\tcopyCSS: \"Copy CSS\",\n\tcopySVG: \"Copy SVG\",\n\tcopyText: \"Copy Text\",\n\tcopyGrid: `Copy ${Dictionary.Guides}`,\n\tcopyEffects: \"Copy Effects\",\n\tcopyCursor: \"Copy Cursor\",\n\tcopyURL: Dictionary.CopyUrl,\n\tpaste: Dictionary.Paste,\n\tpasteStyle: \"Paste Style\",\n\tpasteFill: \"Paste Fill\",\n\tpasteEffects: \"Paste Effects\",\n\tpasteCursor: \"Paste Cursor\",\n\tpasteInPlace: \"Paste in Place\",\n\tpasteGrid: `Paste ${Dictionary.Guides}`,\n\tduplicate: Dictionary.Duplicate,\n\tdelete: Dictionary.Delete,\n\trename: Dictionary.Rename,\n\trenameLayers: Dictionary.AutoRename,\n\ttoggleLayerLock: \"Lock\",\n\ttoggleLayerVisible: Dictionary.Hide,\n\ttoggleLayerClip: \"Toggle Overflow\",\n\tselectMostRecentPage: \"Back To Page\",\n\tselectAll: \"Select All\",\n\tselectGroundNode: \"Select Top Parent\",\n\tselectParent: \"Select Parent\",\n\tselectSiblings: \"Select All Siblings\",\n\tselectChildren: \"Select All Children\",\n\tfakeSelectChildren: \"Select All Children\",\n\tselectAllTopParents: \"Select All Top Parents\",\n\tselectTextNodes: \"Select All Text Layers\",\n\tcycleSelection: \"Cycle Selection (Forwards)\",\n\tdecycleSelection: \"Cycle Selection (Backwards)\",\n\n\t// view\n\tzoomIn: \"Zoom In\",\n\tzoomOut: \"Zoom Out\",\n\tresetZoom: \"Zoom to 100%\",\n\tzoomToFitAll: \"Zoom to Fit\",\n\tzoomToFitSelection: \"Zoom to Selection\",\n\ttoggleInterface: \"Show Interface\",\n\ttoggleShowAllLinks: \"Show All Links\",\n\ttoggleRulers: `Show ${Dictionary.Rulers}`,\n\ttoggleGrids: `Show ${Dictionary.Guides}`,\n\ttoggleShowPixelGrid: \"Show Pixel Grid\",\n\ttoggleAppearance: \"Night Mode\",\n\ttoggleAppearanceSystem: \"System Default\",\n\tshowPages: \"Show Pages\",\n\tshowLayers: \"Show Layers\",\n\tshowAssets: \"Show Assets\",\n\tshowAgent: `Show ${Dictionary.Agent}`,\n\tnewAgentChat: Dictionary.NewChat,\n\tcollapseLayers: \"Collapse Layers\",\n\topenPanelSearch: \"Find Content\",\n\topenTemplates: Dictionary.Templates,\n\tnextCollectionItem: \"Next Item\",\n\tpreviousCollectionItem: \"Previous Item\",\n\n\t// tool\n\ttoggleInsert: Dictionary.Insert,\n\tgenerateWebPage: Dictionary.Wireframer,\n\ttoggleLibraryModal: Dictionary.Library,\n\tstartLinkTool: Dictionary.Link,\n\tsampleColor: \"Sample Color\",\n\ttoolCreateScreen: Dictionary.Screen,\n\ttoolCreateFrame: Dictionary.Frame,\n\ttoolCreateRounded: Dictionary.Rounded,\n\ttoolCreateImage: Dictionary.Image,\n\ttoolCreateVideo: Dictionary.Video,\n\ttoolCreateText: Dictionary.Text,\n\ttoolCreateRows: Dictionary.Rows,\n\ttoolCreateColumns: Dictionary.Columns,\n\ttoolCreateGrid: Dictionary.Grid,\n\ttoolCreateGridSpan: Dictionary.GridRow,\n\ttoolCreateGridRow: Dictionary.GridSpan,\n\ttoolCreateStack: Dictionary.Stack,\n\ttoolCreateMasonry: Dictionary.Masonry,\n\ttoolPath: Dictionary.Path,\n\ttoolScale: Dictionary.Scale,\n\ttoolCreateRectangleShape: Dictionary.Rectangle,\n\ttoolCreateOvalShape: Dictionary.Oval,\n\ttoolCreatePolygonShape: Dictionary.Polygon,\n\ttoolCreateStarShape: Dictionary.Star,\n\ttoolComment: \"Comment\",\n\ttoolZoom: \"Zoom\",\n\ttoolChat: \"Cursor Chat\",\n\ttoolAgentPanel: Dictionary.Agent,\n\n\t// layout\n\taddEnclosingFrame: \"Add Frame\",\n\taddEnclosingStack: \"Add Stack\",\n\tautoSizeLayout: Dictionary.FitContent,\n\tremoveFramePreservingChildren: \"Remove Wrapper\",\n\tsizeToFitContent: \"Resize to Fit Content\",\n\tmoveForward: \"Bring Forward\",\n\tmoveBackward: \"Send Backward\",\n\tmoveToFront: \"Bring to Front\",\n\tmoveToBack: \"Send to Back\",\n\talignLeft: \"Align Left\",\n\talignCenter: \"Align Horizontally\",\n\talignRight: \"Align Right\",\n\talignTop: \"Align Top\",\n\talignMiddle: \"Align Vertically\",\n\talignBottom: \"Align Bottom\",\n\tdistributeHorizontal: \"Distribute Horizontally\",\n\tdistributeVertical: \"Distribute Vertically\",\n\talignToSelection: \"Align to Selection\",\n\talignToParent: \"Align to Parent\",\n\n\t// shape boolean\n\tunite: \"Unite\",\n\tsubtract: \"Subtract\",\n\tintersect: \"Intersect\",\n\texclude: \"Exclude\",\n\tjoin: \"Join\",\n\n\t// text\n\tmakeBold: \"Bold\",\n\tmakeItalic: \"Italic\",\n\tmakeUnderlined: \"Underline\",\n\tchooseFontFamily: \"Select Typeface\",\n\n\t// graphic\n\tgroup: Dictionary.Group,\n\tungroup: \"Ungroup\",\n\tflipHorizontal: \"Flip Horizontally\",\n\tflipVertical: \"Flip Vertically\",\n\tconvertToOutline: \"Convert to Outline\",\n\tflattenPath: \"Flatten\",\n\treversePath: \"Reverse Path Direction\",\n\n\t// component\n\tmakeComponent: \"Create Component\",\n\tmakeCodeComponent: \"Create From Code\",\n\tshowComponentMaster: `Show ${Dictionary.Primary}`,\n\tdetachComponentInstanceFromMaster: `Detach From ${Dictionary.Primary}`,\n\tupdateComponentMasterFromInstance: `Update ${Dictionary.Primary} From ${Dictionary.Instance}`,\n\tresetComponentInstanceOverrides: \"Reset Overrides\",\n\n\t// preview\n\tshowPreview: \"Open Preview\",\n\topenFullScreen: \"Open in Fullscreen\",\n\tpreviewNextBreakpoint: \"Preview Next Breakpoint\",\n\tpreviewPreviousBreakpoint: \"Preview Previous Breakpoint\",\n\ttogglePreviewInterface: \"Toggle Preview Fullscreen\",\n\treload: \"Refresh\",\n\ttoggleConsole: \"Inspect\",\n\n\t// plugins\n\topenPlugins: \"Browse All\",\n\trunRecentPlugin: \"Run Recent Plugin\",\n\tclearRecentPlugins: \"Clear Recent Plugins\",\n\tshowPluginDeveloperTools: \"Show Developer Tools\",\n\topenPluginDocumentation: \"API Documentation\",\n\topenDevelopmentPlugin: \"Open Development Plugin\",\n\topenTextSearchPlugin: \"Text Search\",\n\n\t// code\n\tsaveCodeFile: \"Save File\",\n\tcreateCodeComponent: \"Create Code Component\",\n\tcreateOverride: \"Create Code Override\",\n\tshowAPIDocumentation: \"API Documentation\",\n\n\t// help\n\tkeyboardShortcuts: \"Keyboard Shortcuts\",\n\trequestFeature: \"Request Feature\",\n\topenCommunity: \"Join Community\",\n\tcopyVersion: \"Copy Version Number\",\n\tsitesGetStarted: \"Watch Tutorials\",\n\tstartAppTour: \"Start App Tour\",\n\tcontactSupport: \"Contact Support\",\n\tbrowseMarketplace: \"Browse Marketplace\",\n\n\t// account\n\topenAccountSettings: \"Your Account\",\n\n\t// beta\n\ttoggleBetaChannel: \"Use Beta\",\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { convertPathToCanvas, groupPathSegmentSelectors } from \"document/components/tools/pathEdit/utils/index.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CanvasTree, PathNode } from \"document/models/CanvasTree/index.ts\"\nimport { nodeIDFromString } from \"document/models/CanvasTree/index.ts\"\nimport { isSlotPropertyNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isPositionAbsolute, isPositionFixed } from \"document/models/CanvasTree/traits/utils/positionTypeHelpers.ts\"\nimport { convertCanvasFrameToNode, convertFrameToCanvas } from \"document/models/CanvasTree/utils/geometry.ts\"\nimport { getConstraintsLocked } from \"document/models/CanvasTree/utils/getConstraintsLocked.ts\"\nimport { Matrix } from \"document/models/Matrix.ts\"\nimport { Path } from \"document/models/Path.ts\"\nimport { shouldGuessPinToBottom } from \"document/models/shouldGuessPinToBottom.ts\"\nimport { shouldGuessPinToRight } from \"document/models/shouldGuessPinToRight.ts\"\nimport type { PathSegmentSelector } from \"document/stores/PathSelectionStore.ts\"\nimport type { PathSegment } from \"library/render/types/PathSegment.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport { Rect } from \"library/render/types/Rect.ts\"\n\nexport namespace ContextAlignment {\n\texport type AlignOption = \"Left\" | \"Center\" | \"Right\" | \"Top\" | \"Middle\" | \"Bottom\"\n\texport type DistributeOption = \"Horizontally\" | \"Vertically\"\n\n\texport const align = engine.scheduler.wrapHandler(\n\t\t(tree: CanvasTree, selectedNodes: CanvasNode[], alignmentType: AlignOption) => {\n\t\t\tconst withoutDescendants = tree.withoutDescendants(selectedNodes)\n\n\t\t\tif (withoutDescendants.length === 0) {\n\t\t\t\treturn\n\t\t\t} else if (withoutDescendants.length === 1) {\n\t\t\t\tconst node = withoutDescendants[0]\n\t\t\t\tassert(node, \"Expected node after length === 1 check\")\n\t\t\t\tconst parentNode = tree.getParent(node.id)\n\t\t\t\tif (parentNode === null) {\n\t\t\t\t\t// See alignmentButtonEnabled\n\t\t\t\t\tthrow Error(\"Can\u2019t align node without parent\")\n\t\t\t\t}\n\t\t\t\tconst frame = tree.getRect(node)\n\t\t\t\tconst parentSizeInfo = tree.getParentSizeInfo(node)\n\t\t\t\tif (!parentSizeInfo.positioning) return\n\t\t\t\tconst matrix = node.originAdjustedMatrix(parentSizeInfo)\n\t\t\t\tconst cornerPoints = Matrix.convertPointsWithClipping(matrix, Rect.pointsAtOrigin(frame))\n\t\t\t\tconst bbox = Rect.boundingRectFromPoints(cornerPoints)\n\n\t\t\t\tconst referencePositions = Rect.positions(Rect.atOrigin(parentSizeInfo.positioning))\n\t\t\t\tconst bboxPositions = Rect.positions(bbox)\n\n\t\t\t\tlet partialPoint: Partial<Point>\n\t\t\t\tswitch (alignmentType) {\n\t\t\t\t\tcase \"Left\":\n\t\t\t\t\t\tpartialPoint = { x: frame.x - bboxPositions.minX }\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"Center\":\n\t\t\t\t\t\tpartialPoint = { x: frame.x + referencePositions.midX - bboxPositions.midX }\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"Right\":\n\t\t\t\t\t\tpartialPoint = { x: frame.x + referencePositions.maxX - bboxPositions.maxX }\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"Top\":\n\t\t\t\t\t\tpartialPoint = { y: frame.y - bboxPositions.minY }\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"Middle\":\n\t\t\t\t\t\tpartialPoint = { y: frame.y + referencePositions.midY - bboxPositions.midY }\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase \"Bottom\":\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tpartialPoint = { y: frame.y + referencePositions.maxY - bboxPositions.maxY }\n\t\t\t\t}\n\t\t\t\tconst point = { x: frame.x, y: frame.y, ...partialPoint }\n\t\t\t\tconst newFrame = { ...frame, ...Point.pixelAligned(point, frame) }\n\t\t\t\tengine.tree.current(node)?.set(\n\t\t\t\t\tnode.updateForRect({\n\t\t\t\t\t\trect: newFrame,\n\t\t\t\t\t\tparentSizeInfo,\n\t\t\t\t\t\tconstraintsLocked: getConstraintsLocked(node),\n\t\t\t\t\t\tshouldGuessPinToBottom: shouldGuessPinToBottom(tree, node),\n\t\t\t\t\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, parentNode),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tlet frame: Rect\n\t\t\t\tif (engine.stores.persistedUserDefaults.alignToParent) {\n\t\t\t\t\tconst firstNode = withoutDescendants[0]\n\t\t\t\t\tassert(firstNode, \"Expected first node after length checks\")\n\t\t\t\t\tconst parent = tree.getParent(firstNode.id)\n\t\t\t\t\tif (!parent) return\n\t\t\t\t\tframe = convertFrameToCanvas(tree, parent)\n\t\t\t\t} else {\n\t\t\t\t\tconst frames = withoutDescendants.map(node => {\n\t\t\t\t\t\treturn convertFrameToCanvas(tree, node)\n\t\t\t\t\t}) as [Rect]\n\t\t\t\t\tframe = Rect.merge(...frames)\n\t\t\t\t}\n\n\t\t\t\twithoutDescendants.forEach(node => {\n\t\t\t\t\tconst nodeRect = tree.getRect(node)\n\t\t\t\t\tconst parentNode = tree.getParent(node.id)\n\t\t\t\t\tconst frameInParent = convertCanvasFrameToNode(tree, parentNode, frame)\n\t\t\t\t\tlet partialPoint: Partial<Point>\n\n\t\t\t\t\t// TODO: use bounding box so this also works for rotated layers\n\t\t\t\t\tswitch (alignmentType) {\n\t\t\t\t\t\tcase \"Left\":\n\t\t\t\t\t\t\tpartialPoint = { x: frameInParent.x }\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase \"Center\":\n\t\t\t\t\t\t\tpartialPoint = { x: frameInParent.x + frameInParent.width / 2 - nodeRect.width / 2 }\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase \"Right\":\n\t\t\t\t\t\t\tpartialPoint = { x: frameInParent.x + frameInParent.width - nodeRect.width }\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase \"Top\":\n\t\t\t\t\t\t\tpartialPoint = { y: frameInParent.y }\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase \"Middle\":\n\t\t\t\t\t\t\tpartialPoint = { y: frameInParent.y + frameInParent.height / 2 - nodeRect.height / 2 }\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tcase \"Bottom\":\n\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\tpartialPoint = { y: frameInParent.y + frameInParent.height - nodeRect.height }\n\t\t\t\t\t}\n\t\t\t\t\tconst point = { x: nodeRect.x, y: nodeRect.y, ...partialPoint }\n\t\t\t\t\tconst newFrame = { ...nodeRect, ...Point.pixelAligned(point, nodeRect) }\n\n\t\t\t\t\tengine.tree.current(node)?.set(\n\t\t\t\t\t\tnode.updateForRect({\n\t\t\t\t\t\t\trect: newFrame,\n\t\t\t\t\t\t\tparentSizeInfo: tree.getParentSizeInfo(node),\n\t\t\t\t\t\t\tconstraintsLocked: getConstraintsLocked(node),\n\t\t\t\t\t\t\tshouldGuessPinToBottom: shouldGuessPinToBottom(tree, node),\n\t\t\t\t\t\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, parentNode),\n\t\t\t\t\t\t}),\n\t\t\t\t\t)\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t)\n\n\texport const alignPathSegments = engine.scheduler.wrapHandler(\n\t\t(tree: CanvasTree, segmentSelection: PathSegmentSelector[], alignmentType: AlignOption) => {\n\t\t\tlet frame: Rect\n\n\t\t\tif (segmentSelection.length === 1) {\n\t\t\t\tconst segmentSelector = segmentSelection[0]\n\t\t\t\tassert(segmentSelector, \"Expected segmentSelector after length === 1 check\")\n\t\t\t\tconst node = tree.getNode(segmentSelector.id) as PathNode\n\t\t\t\tconst pathData = convertPathToCanvas(tree, node, node)[0]\n\t\t\t\tassert(pathData, \"Expected pathData from convertPathToCanvas\")\n\t\t\t\tconst { pathSegments } = pathData\n\t\t\t\tframe = Path.anchorBoundingBox(pathSegments)\n\t\t\t} else {\n\t\t\t\tconst pointsInCanvas = segmentSelection.map(segmentSelector => {\n\t\t\t\t\tconst node = tree.getNode(segmentSelector.id) as PathNode\n\t\t\t\t\tconst segment = node.pathSegments[segmentSelector.index]\n\t\t\t\t\tassert(segment, \"Expected segment at segmentSelector.index\")\n\t\t\t\t\treturn tree.convertPointToCanvas(node, segment)\n\t\t\t\t}) as [Point]\n\t\t\t\tframe = Rect.boundingRectFromPoints(pointsInCanvas)\n\t\t\t}\n\n\t\t\tconst selectedIndexesPerNode = groupPathSegmentSelectors(segmentSelection)\n\n\t\t\tfor (const nodeId in selectedIndexesPerNode) {\n\t\t\t\tconst selectedIndexes = selectedIndexesPerNode[nodeId]\n\t\t\t\tassert(selectedIndexes, \"Key from for/in must have value in selectedIndexesPerNode\")\n\n\t\t\t\tconst node = tree.get<PathNode>(nodeIDFromString(nodeId))\n\t\t\t\tif (!node) continue\n\n\t\t\t\tconst pathSegments = node.pathSegments.map((segment: PathSegment, index: number) => {\n\t\t\t\t\tconst outOfSelection = !selectedIndexes.includes(index)\n\t\t\t\t\tif (outOfSelection) {\n\t\t\t\t\t\treturn segment\n\t\t\t\t\t}\n\t\t\t\t\tconst canvasPoint = tree.convertPointToCanvas(node, segment)\n\t\t\t\t\tconst aligned = alignPoint(canvasPoint, frame, alignmentType)\n\t\t\t\t\tconst local = tree.convertPointToNode(node, aligned)\n\t\t\t\t\treturn segment.merge(local)\n\t\t\t\t})\n\n\t\t\t\tnode.set(node.updateForPath({ pathSegments }))\n\t\t\t}\n\t\t},\n\t)\n\n\texport function alignEnabled(\n\t\ttree: CanvasTree,\n\t\twithoutDescendants: CanvasNode[],\n\t\talignToParent = engine.stores.persistedUserDefaults.alignToParent,\n\t) {\n\t\tconst parentDirectedNode = withoutDescendants.every(\n\t\t\tnode => node.cache.parentDirected && !isPositionAbsolute(node) && !isPositionFixed(node),\n\t\t)\n\t\tif (parentDirectedNode) return false\n\n\t\tconst numberOfNodesSelected = withoutDescendants.length\n\t\tif (numberOfNodesSelected === 0) {\n\t\t\treturn false\n\t\t}\n\n\t\tconst firstNode = withoutDescendants[0]\n\t\tif (!firstNode) return false\n\n\t\tconst anySlotPropertyNode = withoutDescendants.some(isSlotPropertyNode)\n\t\tif (anySlotPropertyNode) return false\n\n\t\tif (numberOfNodesSelected === 1) {\n\t\t\treturn tree.getParent(firstNode.id) !== null\n\t\t} else if (!alignToParent) {\n\t\t\treturn true\n\t\t} else {\n\t\t\tconst parent = tree.getParent(firstNode.id)\n\t\t\tif (!parent) return false\n\t\t\tconst sameParent = withoutDescendants.every(node => node.parentid === parent.id)\n\t\t\treturn sameParent\n\t\t}\n\t}\n\n\tfunction alignPoint(point: Point, bounds: Rect, alignmentType: AlignOption) {\n\t\tswitch (alignmentType) {\n\t\t\tcase \"Left\":\n\t\t\t\treturn { y: point.y, x: bounds.x }\n\t\t\tcase \"Center\":\n\t\t\t\treturn { y: point.y, x: bounds.x + bounds.width / 2 }\n\t\t\tcase \"Right\":\n\t\t\t\treturn { y: point.y, x: bounds.x + bounds.width }\n\t\t\tcase \"Top\":\n\t\t\t\treturn { x: point.x, y: bounds.y }\n\t\t\tcase \"Middle\":\n\t\t\t\treturn { x: point.x, y: bounds.y + bounds.height / 2 }\n\t\t\tdefault:\n\t\t\t\treturn { x: point.x, y: bounds.y + bounds.height }\n\t\t}\n\t}\n\n\texport const distribute = engine.scheduler.wrapHandler(\n\t\t(tree: CanvasTree, selectedNodes: CanvasNode[], distributionType: DistributeOption) => {\n\t\t\tconst nodes = tree.withoutDescendants(selectedNodes)\n\n\t\t\tconst minNodes = engine.stores.persistedUserDefaults.alignToParent ? 2 : 3\n\t\t\tif (nodes.length < minNodes) return\n\n\t\t\tconst orderedNodes = sort(nodes, node => {\n\t\t\t\tconst center = canvasCenterPoint(tree, node)\n\t\t\t\treturn distributionValue(center, distributionType)\n\t\t\t})\n\n\t\t\tlet minValue: number, maxValue: number\n\t\t\tif (engine.stores.persistedUserDefaults.alignToParent) {\n\t\t\t\tconst firstNode = nodes[0]\n\t\t\t\tassert(firstNode, \"Expected first node after minNodes check\")\n\t\t\t\tconst parent = tree.getParent(firstNode.id)\n\t\t\t\tif (!parent) return\n\t\t\t\tminValue = distributionValue(canvasMinPoint(tree, parent), distributionType)\n\t\t\t\tmaxValue = distributionValue(canvasMaxPoint(tree, parent), distributionType)\n\t\t\t} else {\n\t\t\t\tconst firstOrderedNode = orderedNodes[0]\n\t\t\t\tconst lastOrderedNode = orderedNodes[orderedNodes.length - 1]\n\t\t\t\tassert(firstOrderedNode, \"Expected first ordered node after minNodes check\")\n\t\t\t\tassert(lastOrderedNode, \"Expected last ordered node after minNodes check\")\n\t\t\t\tminValue = distributionValue(canvasMinPoint(tree, firstOrderedNode), distributionType)\n\t\t\t\tmaxValue = distributionValue(canvasMaxPoint(tree, lastOrderedNode), distributionType)\n\t\t\t}\n\n\t\t\tconst sizes = orderedNodes.map(node => {\n\t\t\t\tconst frame = convertFrameToCanvas(tree, node)\n\t\t\t\treturn distributionType === \"Horizontally\" ? frame.width : frame.height\n\t\t\t})\n\t\t\tconst totalSize = sizes.reduce((previous, current) => {\n\t\t\t\treturn previous + current\n\t\t\t}, 0)\n\t\t\tconst stepSize = (maxValue - minValue - totalSize) / (orderedNodes.length - 1)\n\n\t\t\tlet currentOffset = minValue\n\n\t\t\torderedNodes.forEach((node, index) => {\n\t\t\t\tconst center = canvasCenterPoint(tree, node)\n\n\t\t\t\tconst currentSize = sizes[index]\n\t\t\t\tassert(currentSize !== undefined, \"Expected size at index from orderedNodes\")\n\t\t\t\tcurrentOffset += currentSize / 2\n\n\t\t\t\tif (index > 0) {\n\t\t\t\t\tconst previousSize = sizes[index - 1]\n\t\t\t\t\tassert(previousSize !== undefined, \"Expected previous size at index - 1\")\n\t\t\t\t\tcurrentOffset += previousSize / 2 + stepSize\n\t\t\t\t}\n\n\t\t\t\tif (distributionType === \"Horizontally\") {\n\t\t\t\t\tcenter.x = currentOffset\n\t\t\t\t} else {\n\t\t\t\t\tcenter.y = currentOffset\n\t\t\t\t}\n\t\t\t\tconst parent = tree.getParent(node.id)\n\t\t\t\tconst localCenterPoint = tree.convertPointToNode(parent, center)\n\t\t\t\tconst nodeRect = tree.getRect(node)\n\t\t\t\tconst newPoint = {\n\t\t\t\t\tx: localCenterPoint.x - nodeRect.width / 2,\n\t\t\t\t\ty: localCenterPoint.y - nodeRect.height / 2,\n\t\t\t\t}\n\t\t\t\tconst newFrame = { ...nodeRect, ...Point.pixelAligned(newPoint, nodeRect) }\n\t\t\t\tengine.tree.current(node)?.set(\n\t\t\t\t\tnode.updateForRect({\n\t\t\t\t\t\trect: newFrame,\n\t\t\t\t\t\tparentSizeInfo: tree.getParentSizeInfo(node),\n\t\t\t\t\t\tconstraintsLocked: getConstraintsLocked(node),\n\t\t\t\t\t\tshouldGuessPinToBottom: shouldGuessPinToBottom(tree, node),\n\t\t\t\t\t\tshouldGuessPinToRight: shouldGuessPinToRight(tree, node, parent),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t})\n\t\t},\n\t)\n\n\texport const distributePathSegments = engine.scheduler.wrapHandler(\n\t\t(tree: CanvasTree, vectorPointSelection: PathSegmentSelector[], distributionType: DistributeOption) => {\n\t\t\t// Sort by distribution value, but we don't want to calculate distribution value more often then needed\n\t\t\tconst orderedSegments = sort(vectorPointSelection, vecPointSelector => {\n\t\t\t\tconst node = tree.getNode(vecPointSelector.id) as PathNode\n\t\t\t\tconst segment = node.pathSegments[vecPointSelector.index]\n\t\t\t\tassert(segment, \"Expected segment at vecPointSelector.index\")\n\t\t\t\tconst canvasPoint = tree.convertPointToCanvas(node, segment)\n\t\t\t\treturn distributionValue(canvasPoint, distributionType)\n\t\t\t})\n\n\t\t\tconst minSelector = orderedSegments[0]\n\t\t\tconst maxSelector = orderedSegments[orderedSegments.length - 1]\n\t\t\tassert(minSelector, \"Expected minSelector after sort\")\n\t\t\tassert(maxSelector, \"Expected maxSelector after sort\")\n\t\t\tconst minValueNode = tree.getNode(minSelector.id) as PathNode\n\t\t\tconst maxValueNode = tree.getNode(maxSelector.id) as PathNode\n\t\t\tconst minSegment = minValueNode.pathSegments[minSelector.index]\n\t\t\tconst maxSegment = maxValueNode.pathSegments[maxSelector.index]\n\t\t\tassert(minSegment, \"Expected minSegment at minSelector.index\")\n\t\t\tassert(maxSegment, \"Expected maxSegment at maxSelector.index\")\n\t\t\tconst minValue = distributionValue(tree.convertPointToCanvas(minValueNode, minSegment), distributionType)\n\t\t\tconst maxValue = distributionValue(tree.convertPointToCanvas(maxValueNode, maxSegment), distributionType)\n\t\t\tconst stepSize = (maxValue - minValue) / (orderedSegments.length - 1)\n\n\t\t\tconst selectedIndexesPerNode = groupPathSegmentSelectors(vectorPointSelection)\n\n\t\t\tfor (const nodeId in selectedIndexesPerNode) {\n\t\t\t\tconst segmentIndexes = selectedIndexesPerNode[nodeId]\n\t\t\t\tassert(segmentIndexes, \"Key from for/in must have value in selectedIndexesPerNode\")\n\n\t\t\t\tconst node = tree.get<PathNode>(nodeIDFromString(nodeId))\n\t\t\t\tif (!node) continue\n\n\t\t\t\tconst pathSegments = node.pathSegments.map((segment: PathSegment, index: number) => {\n\t\t\t\t\tconst notInSelection = !segmentIndexes.includes(index)\n\t\t\t\t\tif (notInSelection) {\n\t\t\t\t\t\treturn segment\n\t\t\t\t\t}\n\t\t\t\t\tconst orderedIndex = orderedSegments.findIndex(orderedVecPoint => {\n\t\t\t\t\t\treturn orderedVecPoint.id === node.id && orderedVecPoint.index === index\n\t\t\t\t\t})\n\t\t\t\t\tconst value = minValue + orderedIndex * stepSize\n\t\t\t\t\tconst point = tree.convertPointToCanvas(node, segment)\n\t\t\t\t\tif (distributionType === \"Horizontally\") {\n\t\t\t\t\t\tpoint.x = value\n\t\t\t\t\t} else {\n\t\t\t\t\t\tpoint.y = value\n\t\t\t\t\t}\n\t\t\t\t\treturn segment.merge(tree.convertPointToNode(node, point))\n\t\t\t\t})\n\n\t\t\t\tnode.set({ pathSegments })\n\t\t\t}\n\t\t},\n\t)\n\n\texport function distributeEnabled(\n\t\ttree: CanvasTree,\n\t\twithoutDescendants: CanvasNode[],\n\t\talignToParent = engine.stores.persistedUserDefaults.alignToParent,\n\t) {\n\t\tconst minNodes = alignToParent ? 2 : 3\n\t\tif (withoutDescendants.length < minNodes) return false\n\n\t\tconst parentDirectedNode = withoutDescendants.find(node => node.cache.parentDirected && !isPositionAbsolute(node))\n\t\tif (parentDirectedNode) return false\n\n\t\tif (alignToParent) {\n\t\t\tconst firstNode = withoutDescendants[0]\n\t\t\tassert(firstNode, \"Expected first node after minNodes check\")\n\t\t\tconst parent = tree.getParent(firstNode.id)\n\t\t\tif (!parent) return false\n\t\t\tconst sameParent = withoutDescendants.every(node => node.parentid === firstNode.parentid)\n\t\t\treturn sameParent\n\t\t} else {\n\t\t\treturn true\n\t\t}\n\t}\n\n\tfunction canvasCenterPoint(tree: CanvasTree, node: CanvasNode) {\n\t\treturn Rect.center(convertFrameToCanvas(tree, node))\n\t}\n\n\tfunction canvasMinPoint(tree: CanvasTree, node: CanvasNode) {\n\t\tconst frame = convertFrameToCanvas(tree, node)\n\t\treturn { x: frame.x, y: frame.y }\n\t}\n\n\tfunction canvasMaxPoint(tree: CanvasTree, node: CanvasNode) {\n\t\tconst frame = convertFrameToCanvas(tree, node)\n\t\treturn { x: Rect.maxX(frame), y: Rect.maxY(frame) }\n\t}\n\n\tfunction distributionValue(point: Point, distributionType: DistributeOption) {\n\t\tif (distributionType === \"Horizontally\") {\n\t\t\treturn point.x\n\t\t} else {\n\t\t\treturn point.y\n\t\t}\n\t}\n\n\tfunction sort<T>(items: T[], comperator: (item: T) => number): T[] {\n\t\tconst sortedByIndex = items\n\t\t\t.map((item, index) => {\n\t\t\t\treturn [comperator(item), index] as const\n\t\t\t})\n\t\t\t.sort((a, b) => a[0] - b[0])\n\n\t\tconst itemsLength = items.length\n\t\tconst orderedItems = new Array<T>(itemsLength)\n\t\tfor (let i = 0; i < itemsLength; i++) {\n\t\t\tconst sortedItem = sortedByIndex[i]\n\t\t\tassert(sortedItem, \"Expected sortedItem at index within loop bounds\")\n\t\t\tconst originalIndex = sortedItem[1]\n\t\t\tconst item = items[originalIndex]\n\t\t\tassert(item !== undefined, \"Expected item at originalIndex\")\n\t\t\torderedItems[i] = item\n\t\t}\n\n\t\treturn orderedItems\n\t}\n}\n", "import type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { isNull } from \"utils/typeChecks.ts\"\nimport type { CanvasNode } from \"../nodes/CanvasNode.ts\"\nimport type { ScopeNode } from \"../nodes/ScopeNode.ts\"\n\nfunction sortByName(a: CanvasNode, b: CanvasNode) {\n\tconst aName = a.resolveValue(\"name\")\n\tconst bName = b.resolveValue(\"name\")\n\tif (isNull(aName)) return -1\n\tif (isNull(bName)) return 1\n\n\treturn aName.localeCompare(bName, undefined, { numeric: true })\n}\n\nexport function sortGroundNodesForPage({ engine, page }: { engine: VekterEngine; page?: ScopeNode }): void {\n\tconst selectedPage = page ?? engine.stores.scopeStore.active\n\n\tconst groundNodes = selectedPage.getGroundNodes()\n\n\tconst sortedGroundNodes = [...groundNodes].sort(sortByName)\n\n\tsortedGroundNodes.forEach((child, index) => {\n\t\tengine.tree.moveNode(child, selectedPage.id, index)\n\t})\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentCMS(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg\n\t\t\trole=\"presentation\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\twidth=\"12\"\n\t\t\theight=\"12\"\n\t\t\tviewBox=\"0 0 12 12\"\n\t\t\tfill=\"none\"\n\t\t\taria-hidden=\"true\"\n\t\t\tfocusable=\"false\"\n\t\t\t{...props}\n\t\t>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillOpacity={0.2}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\td=\"M1.5 8.75v-5.5C1.5 1.869 3.515.75 6 .75s4.5 1.119 4.5 2.5v5.5m0 0c0 1.381-2.015 2.5-4.5 2.5s-4.5-1.119-4.5-2.5\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"none\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\td=\"M10.25 3.25c0 1.105-1.903 2-4.25 2s-4.25-.895-4.25-2M10.25 6c0 1.105-1.903 2-4.25 2s-4.25-.895-4.25-2\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import { useId, type SVGProps } from \"react\"\n\nconst iconPath =\n\t\"M.5 5.422c0-.9.404-1.752 1.1-2.322l2.5-2.046a3 3 0 0 1 3.8 0L10.4 3.1c.696.57 1.1 1.422 1.1 2.322V9a3 3 0 0 1-3 3h-5a3 3 0 0 1-3-3Z\"\n\nexport function IconAgentHome(props: SVGProps<SVGSVGElement>) {\n\tconst clipPathId = `agent-home-icon-${useId().replace(/:/g, \"\")}`\n\n\treturn (\n\t\t<svg\n\t\t\trole=\"presentation\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\twidth=\"12\"\n\t\t\theight=\"12\"\n\t\t\tviewBox=\"0 0 12 12\"\n\t\t\tfill=\"none\"\n\t\t\t{...props}\n\t\t>\n\t\t\t<defs>\n\t\t\t\t<clipPath id={clipPathId}>\n\t\t\t\t\t<path d={iconPath} />\n\t\t\t\t</clipPath>\n\t\t\t</defs>\n\t\t\t<path\n\t\t\t\td={iconPath}\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillOpacity={0.2}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"3\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\tclipPath={`url(#${clipPathId})`}\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M6 10.5V8\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"2\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentPage(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg\n\t\t\trole=\"presentation\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\twidth=\"12\"\n\t\t\theight=\"12\"\n\t\t\tviewBox=\"0 0 12 12\"\n\t\t\tfill=\"none\"\n\t\t\t{...props}\n\t\t>\n\t\t\t<path\n\t\t\t\td=\"M1.75 2.75a2 2 0 0 1 2-2h1a1 1 0 0 1 1 1v2.5a1 1 0 0 0 1 1h2.5a1 1 0 0 1 1 1v3a2 2 0 0 1-2 2h-4.5a2 2 0 0 1-2-2Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillOpacity={0.2}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M4.5.75h1.172a2 2 0 0 1 1.414.586l2.578 2.578a2 2 0 0 1 .586 1.414V6.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import { IconLayerComponent } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport { useMemo } from \"react\"\nimport type { ComponentWithPreset } from \"utils/getComponentsWithPresets.ts\"\nimport * as styles from \"./PresetIcon.styles.ts\"\n\ninterface PresetIconProps {\n\ticon: React.ReactNode\n\tcolor?: string\n\tclassName?: string\n}\n\ninterface PresetIconPropsWithClassName extends PresetIconProps {\n\tclassName: string\n}\n\ninterface PresetIconPropsWithColor extends PresetIconProps {\n\tcolor: string\n}\n\nexport function PresetIcon({ icon, ...props }: PresetIconPropsWithClassName | PresetIconPropsWithColor) {\n\treturn (\n\t\t<span className={cx(styles.icon, props?.className)} style={{ color: props?.color }}>\n\t\t\t{icon}\n\t\t</span>\n\t)\n}\n\ninterface ComponentPresetIconProps {\n\tpreset: ComponentPresetNode\n\tcomponents: ComponentWithPreset[]\n}\n\nexport function ComponentPresetIcon({ preset, components }: ComponentPresetIconProps) {\n\t/**\n\t * This is at most 2 iterations at the moment, but it could be more if we\n\t * add more component types. If this becomes a problem we need to find another way\n\t * to get these component presets.\n\t */\n\tconst component = useMemo(\n\t\t() => components.find(localComponent => localComponent.componentIdentifier === preset.componentIdentifier),\n\t\t[preset.componentIdentifier, components],\n\t)\n\n\treturn (\n\t\t<PresetIcon\n\t\t\ticon={getComponentIcon(component?.name ?? preset.resolveValue(\"name\") ?? Dictionary.Unknown)}\n\t\t\tcolor={colors.alternativePresetIcon}\n\t\t/>\n\t)\n}\n\nfunction getComponentIcon(name: string) {\n\tconst lowerName = name.toLowerCase()\n\n\tif (lowerName.includes(\"code\")) {\n\t\treturn (\n\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\td=\"M0 3a3 3 0 0 1 3-3h6a3 3 0 0 1 3 3v6a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3Zm3 1.25c0 .414.336.75.75.75h4.5a.75.75 0 0 0 0-1.5h-4.5a.75.75 0 0 0-.75.75Zm0 3.5c0 .414.336.75.75.75h2.5a.75.75 0 0 0 0-1.5h-2.5a.75.75 0 0 0-.75.75Z\"\n\t\t\t\t/>\n\t\t\t</svg>\n\t\t)\n\t}\n\n\tif (lowerName.includes(\"youtube\") || lowerName.includes(\"vimeo\")) {\n\t\treturn (\n\t\t\t<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 12 12\">\n\t\t\t\t<path\n\t\t\t\t\td=\"M 0 3 C 0 1.343 1.343 0 3 0 L 9 0 C 10.657 0 12 1.343 12 3 L 12 9 C 12 10.657 10.657 12 9 12 L 3 12 C 1.343 12 0 10.657 0 9 Z M 4.768 2.989 C 4.436 2.777 4 3.016 4 3.411 L 4 8.589 C 4 8.984 4.436 9.223 4.768 9.011 L 8.837 6.422 C 9.146 6.225 9.146 5.775 8.837 5.578 Z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</svg>\n\t\t)\n\t}\n\n\treturn <IconLayerComponent />\n}\n", "import \"PresetIcon.styles_3gzj5x.wyw.css\"; export const icon = \"icon_i136r0ky\";", "import \"ColorPickerTokenRowPreview.styles_1pbm0yw.wyw.css\"; export const icon = \"icon_i1wb0hqe\";\nexport const dashed = \"dashed_dxlwbcn\";", "import { colors } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport * as styles from \"./ColorPickerTokenRowPreview.styles.ts\"\n\nexport function ColorTokenPreview({\n\tvalue,\n\tsize = \"large\",\n\tdashed = false,\n\tclassName,\n}: {\n\tvalue?: string\n\tsize?: \"small\" | \"large\"\n\tdashed?: boolean\n\tclassName?: string\n}) {\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\tbackground: value || colors.colorStyleDisabled,\n\t\t\t\t\"--colorStyleIconSize\": size === \"large\" ? \"15px\" : \"10px\",\n\t\t\t}}\n\t\t\tclassName={cx(styles.icon, dashed && styles.dashed, className)}\n\t\t/>\n\t)\n}\n", "import type { EntityDefinition } from \"@framerjs/framer-runtime\"\nimport { isReactComponentDefinition } from \"@framerjs/framer-runtime\"\nimport { FileDropZone } from \"@framerjs/fresco\"\nimport type { DraggableEvent } from \"@framerjs/fresco/layout-transitions\"\nimport { useDroppable } from \"@framerjs/fresco/layout-transitions\"\nimport type { ExternalModuleExportIdentifier } from \"@framerjs/shared\"\nimport {\n\tasGlobalId,\n\tgetLogger,\n\tisExternalModuleIdentifier,\n\tisLocalModuleIdentifier,\n\tparseModuleIdentifier,\n\tunhandledError,\n} from \"@framerjs/shared\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { codeComponentFromDefinition } from \"document/components/utils/componentHelpers.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode, CodeComponentNode, FrameNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { ExternalModuleNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport type { StylePresetNode } from \"document/models/CanvasTree/nodes/utils/isStylePresetNode.ts\"\nimport { isCodeComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { scopeSupportsOverlays } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport { hasFloatingPosition } from \"document/models/CanvasTree/traits/WithFloatingPosition.ts\"\nimport type { WithConstraints, WithPins } from \"document/models/CanvasTree/traits/WithPins.ts\"\nimport type { IsMaster } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport React from \"react\"\nimport { framerLayersClipboardHandler } from \"utils/clipboard/helpers/layers.ts\"\nimport type { FramerLayersClipboardData } from \"utils/clipboard/helpers/types.ts\"\nimport { swapCursor } from \"utils/cursor.ts\"\nimport { insertStylePresets } from \"utils/stylePresetUtils.ts\"\nimport type { ComponentAddedToCanvasSource } from \"utils/tracking/trackComponentAddedToCanvas.ts\"\nimport { isArray } from \"utils/typeChecks.ts\"\nimport { mimeTypes as imageMimeTypes } from \"web/lib/images/supportedFormats.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { mimeTypes as videoMimeTypes } from \"web/lib/videos/supportedFormats.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport type { InsertableComponentType } from \"../chrome/assets/types.ts\"\nimport { insertDataSourceItemToast } from \"../chrome/insertSidebar/insertDataSourceItemToast.ts\"\nimport type { ImageToUpload, LayoutVariants } from \"../chrome/insertSidebar/types.ts\"\nimport { OverlayType } from \"../chrome/insertSidebar/types.ts\"\nimport {\n\ttype InsertionInfo,\n\tgetStackOrGridInRange,\n\tgetStackOrGridInsertionIndexAndLine,\n} from \"../tools/utils/stackInsertionHelpers.ts\"\nimport { autoDetach } from \"../utils/editActionForCodeComponent.ts\"\nimport { getInsertionParent, getSizeForTemplate, insertComponent } from \"../utils/insertComponent.ts\"\nimport { canReplaceNode, replaceNodeWithTemplate } from \"../utils/replaceNodes.ts\"\nimport { addImagesToCanvas } from \"./addImagesToCanvas.ts\"\nimport { addVideosToCanvas } from \"./addVideosToCanvas.ts\"\n\nconst log = getLogger(\"canvasDropZone\")\n\nexport const DraggableComponentDataType = \"DraggableComponent\"\nexport const DraggableComponentsDataType = \"DraggableComponents\"\n\nexport interface DraggableComponentData {\n\tcomponent: CanvasNode | null\n\tnodesToRegenerate?: NodeID[]\n\tstylePresets?: StylePresetNode[]\n\tsource: ComponentAddedToCanvasSource\n\tisLayoutSection?: boolean\n\ttype?: InsertableComponentType\n\toverlayType?: OverlayType\n\n\t/** Contains details of an image to upload\n\t *  once dropped on a dropzone\n\t */\n\timageToUpload?: ImageToUpload\n}\n\nexport const DraggableModuleComponentDataType = \"DraggableModuleComponent\"\n\nexport interface DraggableModuleComponentData {\n\tcomponent: CanvasNode | CodeComponentNode | null\n\tmoduleIdentifier: ExternalModuleExportIdentifier\n\tsource: ComponentAddedToCanvasSource\n\tshouldBecomeFullWidthForVariants: LayoutVariants\n\tisLayoutSection?: boolean\n\tshouldDetachOnInsert: boolean\n\toverlayType?: OverlayType\n\tvectorSetModuleId?: string | undefined\n}\n\nexport const DraggableCodeFileType = \"CodeFileWithMultipleComponents\"\nexport interface DraggableCodeFileData {\n\tcomponentDefinitions: EntityDefinition[]\n\tsource: ComponentAddedToCanvasSource\n}\n\nexport const DraggableClipboardDataType = \"DraggableClipboardData\"\n\ninterface DraggableClipboardData {\n\tclipboardData: FramerLayersClipboardData\n\tisLayoutSection?: boolean\n\tnode: FrameNode | CodeComponentNode | null\n}\n\nconst onDrop = engine.scheduler.wrapHandler((event: DraggableEvent) => {\n\tif (getIsViewOnly(engine, \"canDesign\")) return\n\tconst { toolStore, canvasStore, modulesStore, chromeStore, contextMenuStore, codeGenerationStore } = engine.stores\n\ttoolStore.stackInsertionIndicator = null\n\ttoolStore.replaceableFloatingPositionNode = null\n\n\tconst draggableComponentData = event.dataTransfer.getData(DraggableComponentDataType) as\n\t\t| DraggableComponentData\n\t\t| undefined\n\n\tconst canvasPoint = canvasStore.convertContainerPointToCanvas(event.client)\n\n\tif (draggableComponentData) {\n\t\tconst { component, nodesToRegenerate, stylePresets, source, type, isLayoutSection, overlayType, imageToUpload } =\n\t\t\tdraggableComponentData\n\t\tif (!component) return\n\n\t\tinsertDataSourceItemToast(async () => {\n\t\t\tif (nodesToRegenerate) {\n\t\t\t\tfor (const nodeId of nodesToRegenerate) {\n\t\t\t\t\tawait codeGenerationStore.forceComponentUpdate(nodeId)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tif (stylePresets) {\n\t\t\t\t\tinsertStylePresets(engine, stylePresets)\n\t\t\t\t}\n\n\t\t\t\tdropComponentAtMousePoint({\n\t\t\t\t\tcomponent,\n\t\t\t\t\tcanvasPoint,\n\t\t\t\t\tcmdOrCtrlKey: event.cmdOrCtrlKey,\n\t\t\t\t\tsource,\n\t\t\t\t\ttype,\n\t\t\t\t\tisLayoutSection,\n\t\t\t\t\toverlayType,\n\t\t\t\t\timageToUpload,\n\t\t\t\t})\n\t\t\t})\n\t\t}).catch(unhandledError)\n\n\t\treturn\n\t}\n\n\tconst draggableModuleComponentData = event.dataTransfer.getData(DraggableModuleComponentDataType) as\n\t\t| DraggableModuleComponentData\n\t\t| undefined\n\tif (draggableModuleComponentData) {\n\t\tconst {\n\t\t\tcomponent,\n\t\t\tmoduleIdentifier,\n\t\t\tsource,\n\t\t\tshouldBecomeFullWidthForVariants,\n\t\t\tshouldDetachOnInsert,\n\t\t\toverlayType,\n\t\t\tisLayoutSection,\n\t\t\tvectorSetModuleId,\n\t\t} = draggableModuleComponentData\n\t\tif (!component) return\n\n\t\tengine.beginUndoGroup()\n\n\t\tif (shouldDetachOnInsert) {\n\t\t\tengine.stores.chromeStore.autoDetachingNodeId = component.id\n\t\t}\n\n\t\tinsertDataSourceItemToast(async () => {\n\t\t\tawait engine.stores.modulesStore.addExternalModulesToProject([moduleIdentifier], {\n\t\t\t\tonTreeUpdate: () => {\n\t\t\t\t\tdropComponentAtMousePoint({\n\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\tcanvasPoint,\n\t\t\t\t\t\tcmdOrCtrlKey: event.cmdOrCtrlKey,\n\t\t\t\t\t\tsource,\n\t\t\t\t\t\toverlayType,\n\t\t\t\t\t\tshouldBecomeFullWidthForVariants,\n\t\t\t\t\t\tisLayoutSection,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t})\n\t\t})\n\t\t\t.then(async () => {\n\t\t\t\tif (!shouldDetachOnInsert) return\n\t\t\t\tif (!isCodeComponentNode(component)) return\n\t\t\t\tconst externalModuleNode = isExternalModuleIdentifier(moduleIdentifier)\n\t\t\t\t\t? engine.tree.getNode<ExternalModuleNode>(moduleIdentifier.moduleId)\n\t\t\t\t\t: null\n\t\t\t\tif (!externalModuleNode?.type) return\n\t\t\t\tawait autoDetach(component, engine, moduleIdentifier, externalModuleNode.type).catch(unhandledError)\n\t\t\t})\n\t\t\t.then(async () => {\n\t\t\t\tif (!isCodeComponentNode(component)) return\n\t\t\t\tconst identifier = component.codeComponentIdentifier\n\t\t\t\tconst parsed = parseModuleIdentifier(identifier)\n\t\t\t\tif (isLocalModuleIdentifier(parsed)) return\n\t\t\t\tif (!vectorSetModuleId) return\n\t\t\t\t// If we're inserting an external vector module, pull in the set as well as the\n\t\t\t\t// latest vectors in the set as external modules.\n\t\t\t\tawait modulesStore.addOrUpdateVectorSetAndVectors({\n\t\t\t\t\tmoduleId: asGlobalId(vectorSetModuleId),\n\t\t\t\t\tsaveId: \"\",\n\t\t\t\t})\n\t\t\t})\n\t\t\t.finally(() => {\n\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\tengine.endUndoGroup()\n\t\t\t\t\tchromeStore.autoDetachingNodeId = null\n\t\t\t\t})\n\t\t\t})\n\t\t\t.catch(log.error)\n\n\t\treturn\n\t}\n\n\tconst draggableCodeFileData = event.dataTransfer.getData(DraggableCodeFileType) as DraggableCodeFileData\n\tif (draggableCodeFileData) {\n\t\tconst { componentDefinitions, source } = draggableCodeFileData\n\t\tif (componentDefinitions.length < 1) return // Only code file with more than one component should use DraggableCodeFileType\n\n\t\tconst menuOptions: MenuItemOptions[] = []\n\t\tcomponentDefinitions.forEach(definition => {\n\t\t\tif (!isReactComponentDefinition(definition)) return\n\t\t\tmenuOptions.push({\n\t\t\t\tlabel: definition.name,\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst component = codeComponentFromDefinition(definition)\n\t\t\t\t\tdropComponentAtMousePoint({\n\t\t\t\t\t\tcomponent,\n\t\t\t\t\t\tcanvasPoint: event.client,\n\t\t\t\t\t\tcmdOrCtrlKey: event.cmdOrCtrlKey,\n\t\t\t\t\t\tsource,\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t})\n\t\t})\n\t\tcontextMenuStore.show(menuOptions, { location: { x: event.client.x, y: event.client.y } })\n\t\treturn\n\t}\n\n\tconst multiComponentsData = event.dataTransfer.getData(DraggableComponentsDataType) as\n\t\t| DraggableComponentData[]\n\t\t| undefined\n\n\tif (isArray(multiComponentsData)) {\n\t\tmultiComponentsData.forEach(componentData => {\n\t\t\tconst { component, source, type, isLayoutSection, overlayType, imageToUpload } = componentData\n\t\t\tif (!component) return\n\n\t\t\tdropComponentAtMousePoint({\n\t\t\t\tcomponent,\n\t\t\t\tcanvasPoint,\n\t\t\t\tcmdOrCtrlKey: event.cmdOrCtrlKey,\n\t\t\t\tsource,\n\t\t\t\ttype,\n\t\t\t\tisLayoutSection,\n\t\t\t\toverlayType,\n\t\t\t\timageToUpload,\n\t\t\t})\n\t\t})\n\n\t\trecord(\"asset_bulk_move_canvas\", { count: multiComponentsData.length })\n\n\t\treturn\n\t}\n\n\tconst draggableClipboardData = event.dataTransfer.getData(DraggableClipboardDataType) as\n\t\t| DraggableClipboardData\n\t\t| undefined\n\n\tif (draggableClipboardData) {\n\t\tconst { clipboardData, isLayoutSection, node } = draggableClipboardData\n\t\tif (!clipboardData) return\n\n\t\tconst nodesAtPoint = engine.tree.getNodesAtPoint(engine.stores.scopeStore.active, canvasPoint)\n\n\t\tconst insertTargetNodeId = nodesAtPoint[0]?.id\n\t\tlet insertTarget: { parentId: NodeID; index?: number } | undefined = insertTargetNodeId\n\t\t\t? { parentId: insertTargetNodeId }\n\t\t\t: undefined\n\n\t\tif (node) {\n\t\t\tconst info = getStackOrGridInsertion(engine, event, node, isLayoutSection)\n\n\t\t\tif (info) {\n\t\t\t\tconst { insertionInfo, stackNodeId } = info\n\t\t\t\tconst { insertionIndex } = insertionInfo\n\n\t\t\t\tif (insertionIndex !== null) {\n\t\t\t\t\tinsertTarget = { parentId: stackNodeId, index: insertionIndex }\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tvoid framerLayersClipboardHandler({\n\t\t\tengine,\n\t\t\tlayersData: clipboardData,\n\t\t\tposition: canvasPoint,\n\t\t\tinsertTarget,\n\t\t\tshouldPasteTextStyles: true,\n\t\t})\n\n\t\treturn\n\t}\n})\n\nconst onDragOver = engine.scheduler.wrapHandler((event: DraggableEvent) => {\n\tif (getIsViewOnly(engine, \"canDesign\")) return\n\n\tconst { canvasStore, toolStore, scopeStore, treeStore } = engine.stores\n\ttoolStore.stackInsertionIndicator = null\n\ttoolStore.replaceableFloatingPositionNode = null\n\n\tconst data = event.dataTransfer.getData(DraggableClipboardDataType) as DraggableClipboardData | undefined\n\tif (data) {\n\t\tconst { isLayoutSection, node } = data\n\t\tif (!node) return\n\n\t\thighlightWithInsertionIndicator(engine, event, node, isLayoutSection)\n\t\t// For clipboard data, we don't support overlays, so we can return early.\n\t\treturn\n\t}\n\n\tconst componentData = (event.dataTransfer.getData(DraggableComponentDataType) ||\n\t\tevent.dataTransfer.getData(DraggableModuleComponentDataType)) as\n\t\t| DraggableComponentData\n\t\t| DraggableModuleComponentData\n\t\t| undefined\n\tif (!componentData) return\n\tconst { component, isLayoutSection, overlayType } = componentData\n\tif (!component) return\n\n\tconst activeScope = scopeStore.active\n\tif (overlayType === OverlayType.Relative && scopeSupportsOverlays(activeScope)) {\n\t\tconst mouse = canvasStore.convertContainerPointToCanvas(event.client)\n\t\tconst replaceableNodes = engine.tree\n\t\t\t.getNodesAtPoint(activeScope, mouse)\n\t\t\t.filter((node): node is CanvasNode & WithPins & WithConstraints => canReplaceNode(node, { allowVariants: true }))\n\n\t\tconst floatingPositionNode = engine.tree.getTopMostChildNode(replaceableNodes.filter(hasFloatingPosition))\n\t\tif (floatingPositionNode) {\n\t\t\ttreeStore.setHighlight(floatingPositionNode.id)\n\t\t\tevent.dataTransfer.dropEffectCursor = swapCursor\n\t\t\ttoolStore.replaceableFloatingPositionNode = floatingPositionNode.id\n\t\t} else {\n\t\t\tconst addOverlayToNode = engine.tree.getTopMostChildNode(replaceableNodes)\n\t\t\tif (addOverlayToNode) {\n\t\t\t\ttreeStore.setHighlight(addOverlayToNode.id)\n\t\t\t\ttoolStore.replaceableFloatingPositionNode = addOverlayToNode.id\n\t\t\t}\n\t\t}\n\n\t\treturn\n\t}\n\n\thighlightWithInsertionIndicator(engine, event, component, isLayoutSection)\n})\n\nfunction getStackOrGridInsertion(\n\tengine: VekterEngine,\n\tevent: DraggableEvent,\n\tnode: CanvasNode,\n\tisLayoutSection: boolean | undefined,\n): { insertionInfo: InsertionInfo; stackNodeId: NodeID } | undefined {\n\tconst { canvasStore } = engine.stores\n\n\tconst mouse = canvasStore.convertContainerPointToCanvas(event.client)\n\n\tconst stackInRange = getStackOrGridInRange(engine, mouse, [node], null, isLayoutSection)\n\tif (!stackInRange) return\n\n\tconst componentSize = getSizeForTemplate(engine, node)\n\n\treturn {\n\t\tinsertionInfo: getStackOrGridInsertionIndexAndLine(stackInRange, engine, mouse, componentSize),\n\t\tstackNodeId: stackInRange.id,\n\t}\n}\n\nfunction highlightWithInsertionIndicator(\n\tengine: VekterEngine,\n\tevent: DraggableEvent,\n\tnode: CanvasNode,\n\tisLayoutSection: boolean | undefined,\n) {\n\tconst { canvasStore, toolStore, treeStore } = engine.stores\n\n\tconst mouse = canvasStore.convertContainerPointToCanvas(event.client)\n\n\tconst replaceableNode = getReplaceableNode(mouse, event.cmdOrCtrlKey)\n\tif (replaceableNode) {\n\t\ttreeStore.setHighlight(replaceableNode.id)\n\t\tevent.dataTransfer.dropEffectCursor = swapCursor\n\t\ttoolStore.replaceableFloatingPositionNode = null\n\t}\n\n\tconst info = getStackOrGridInsertion(engine, event, node, isLayoutSection)\n\n\tif (info) {\n\t\tconst { insertionInfo, stackNodeId } = info\n\t\tconst { insertionLine } = insertionInfo\n\t\ttoolStore.stackInsertionIndicator = insertionLine\n\t\ttreeStore.setHighlight(stackNodeId)\n\t} else {\n\t\tconst parent = getInsertionParent(engine, node, mouse, isLayoutSection)\n\t\ttreeStore.setHighlight(parent ? parent.id : null)\n\t}\n}\n\nconst onDragLeave = engine.scheduler.wrapHandler(() => {\n\tconst { toolStore, treeStore } = engine.stores\n\ttoolStore.stackInsertionIndicator = null\n\ttoolStore.replaceableFloatingPositionNode = null\n\ttreeStore.setHighlight(null)\n})\n\nconst onFileDrop = engine.scheduler.wrapHandler(async (event: DragEvent) => {\n\tif (getIsViewOnly(engine, \"canDesign\")) return\n\tif (!event.dataTransfer?.files) return\n\n\tconst files: { images: File[]; videos: File[] } = {\n\t\timages: [],\n\t\tvideos: [],\n\t}\n\n\tfor (const currentFile of event.dataTransfer.files) {\n\t\tif (currentFile && ![...imageMimeTypes, ...videoMimeTypes].includes(currentFile.type)) {\n\t\t\tconst extension = currentFile.name.split(\".\").pop()\n\t\t\ttoast({\n\t\t\t\tkey: `unsupported-file-drop-${extension}`,\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\ttext: `The file type (.${extension}) is not supported.`,\n\t\t\t\ticon: \"error\",\n\t\t\t\tduration: 5000,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tif (currentFile?.type.includes(\"video\")) {\n\t\t\tfiles.videos.push(currentFile)\n\t\t} else if (currentFile?.type.includes(\"image\")) {\n\t\t\tfiles.images.push(currentFile)\n\t\t}\n\t}\n\n\tevent.preventDefault()\n\n\t// TODO: Position better when multiple files are dropped and they consist both images and videos\n\tconst canvasPoint = engine.stores.canvasStore.convertContainerPointToCanvas({ x: event.x, y: event.y })\n\tawait Promise.all([\n\t\taddVideosToCanvas(engine, files.videos, canvasPoint, \"drop\"),\n\t\taddImagesToCanvas(engine, files.images, canvasPoint, \"drop\", true),\n\t])\n})\n\nconst style: React.CSSProperties = {\n\tposition: \"absolute\",\n\ttop: \"var(--framerInternalUI-chromeMarginTop)\",\n\tright: \"var(--framerInternalUI-chromeMarginRight)\",\n\tbottom: \"var(--framerInternalUI-chromeMarginBottom)\",\n\tleft: \"var(--framerInternalUI-chromeMarginLeft)\",\n}\n\nconst supportedDropDataTypes: string[] = [\n\tDraggableComponentDataType,\n\tDraggableComponentsDataType,\n\tDraggableModuleComponentDataType,\n\tDraggableCodeFileType,\n\tDraggableClipboardDataType,\n]\n\nexport const CanvasDropZone = React.memo(() => {\n\tconst ref = useDroppable({\n\t\tdataTypes: supportedDropDataTypes,\n\t\tonDrop,\n\t\tonDragOver,\n\t\tonDragLeave,\n\t\tdropEffect: \"copy\",\n\t})\n\n\treturn <FileDropZone ref={ref} onDrop={onFileDrop} style={style} />\n})\n\n// Helpers\n\nfunction getReplaceableNode(\n\tmousePoint: Point,\n\tcmdOrCtrlKey: boolean,\n\toverlayType?: OverlayType,\n): (CanvasNode & WithPins & WithConstraints) | undefined {\n\tif (!cmdOrCtrlKey && !overlayType) return\n\n\tconst replaceableNodes = engine.tree\n\t\t.getNodesAtPoint(engine.stores.scopeStore.active, mousePoint)\n\t\t.filter((node): node is CanvasNode & WithPins & WithConstraints =>\n\t\t\tcanReplaceNode(node, { allowVariants: !!overlayType }),\n\t\t)\n\n\tif (overlayType === OverlayType.Relative) {\n\t\treturn engine.tree.getTopMostChildNode(replaceableNodes.filter(hasFloatingPosition))\n\t}\n\n\treturn engine.tree.getTopMostChildNode(replaceableNodes)\n}\n\ninterface DropComponentAtMousePointOptions {\n\tcomponent: CanvasNode\n\tcanvasPoint: Point\n\tcmdOrCtrlKey: boolean\n\tsource: ComponentAddedToCanvasSource\n\toverlayType?: OverlayType\n\tshouldBecomeFullWidthForVariants?: LayoutVariants\n\tpackageIdentifier?: string | null\n\tisLayoutSection?: boolean\n\ttype?: InsertableComponentType\n\timageToUpload?: ImageToUpload\n}\n\nfunction dropComponentAtMousePoint({\n\tcomponent,\n\tcanvasPoint,\n\tcmdOrCtrlKey,\n\tsource,\n\tshouldBecomeFullWidthForVariants,\n\toverlayType,\n\tisLayoutSection,\n\timageToUpload,\n\ttype,\n}: DropComponentAtMousePointOptions) {\n\tconst replaceableNode = getReplaceableNode(canvasPoint, cmdOrCtrlKey, overlayType)\n\tif (replaceableNode) {\n\t\treplaceNodeWithTemplate(engine, replaceableNode, component, overlayType === OverlayType.Relative).catch(\n\t\t\tunhandledError,\n\t\t)\n\t} else {\n\t\tinsertComponent({\n\t\t\tengine: engine,\n\t\t\tcomponent,\n\t\t\tcanvasPoint,\n\t\t\tsource,\n\t\t\ttype,\n\t\t\tshouldBecomeFullWidthForVariants,\n\t\t\tisLayoutSection,\n\t\t\tinsertAsOverlayType: overlayType,\n\t\t\timageToUpload,\n\t\t})\n\t}\n}\n\nexport function candidateForMaster(\n\tcomponent: CanvasNode & IsMaster,\n\tvekterEngine: VekterEngine,\n): CanvasNode | null | undefined {\n\tconst candidate = vekterEngine.tree.get(component.id)\n\n\tif (!vekterEngine.tree.hasNode(component)) {\n\t\treturn candidate\n\t}\n}\n", "import { toastProgress } from \"web/lib/toaster.ts\"\n\nexport function insertDataSourceItemToast<T>(work: () => Promise<T>): Promise<T> {\n\treturn toastProgress(\n\t\t{\n\t\t\tkey: \"insert-data-source-item\",\n\t\t\tprogress: { variant: \"progress\", text: \"Inserting\u2026\" },\n\t\t\terror: { variant: \"error\", text: \"Failed to insert\" },\n\t\t\twaitTime: 100,\n\t\t},\n\t\twork,\n\t)\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentAssetLayoutTemplate(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<g transform=\"translate(1 0)\">\n\t\t\t\t<path d=\"M 1 3.5 L 9 3.5 L 9 5 L 1 5 Z\" fill=\"currentColor\" />\n\t\t\t\t<path d=\"M 1 4 L 9 4 L 9 11 L 1 11 Z\" fill=\"currentColor\" opacity=\"0.2\" />\n\t\t\t\t<path\n\t\t\t\t\td=\"M 0 2.5 C 0 1.119 1.119 0 2.5 0 L 7.5 0 C 8.881 0 10 1.119 10 2.5 L 10 9.5 C 10 10.881 8.881 12 7.5 12 L 2.5 12 C 1.119 12 0 10.881 0 9.5 Z M 1.5 9.5 C 1.5 10.052 1.948 10.5 2.5 10.5 L 7.5 10.5 C 8.052 10.5 8.5 10.052 8.5 9.5 L 8.5 2.5 C 8.5 1.948 8.052 1.5 7.5 1.5 L 2.5 1.5 C 1.948 1.5 1.5 1.948 1.5 2.5 Z\"\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n", "import { assert, assertNever, getLogger } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode, NodeID, VectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { BooleanShapeNode, PathNode, isVectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isShapeGroupNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withChildren } from \"document/models/CanvasTree/traits/WithChildren.ts\"\nimport { withFill, withOptionalFill } from \"document/models/CanvasTree/traits/WithFill.ts\"\nimport { shapeFillDefaults } from \"document/models/CanvasTree/traits/WithFillDefaults.ts\"\nimport { withPath } from \"document/models/CanvasTree/traits/WithPath.ts\"\nimport { PathBooleanType } from \"document/models/CanvasTree/traits/WithPathBoolean.ts\"\nimport { withPosition } from \"document/models/CanvasTree/traits/WithPosition.ts\"\nimport { withShape } from \"document/models/CanvasTree/traits/WithShape.ts\"\nimport { withSize } from \"document/models/CanvasTree/traits/WithSize.ts\"\nimport { withStroke } from \"document/models/CanvasTree/traits/WithStroke.ts\"\nimport { isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { convertPathToParent } from \"document/models/CanvasTree/utils/convertPathToParent.ts\"\nimport { Path } from \"document/models/Path.ts\"\nimport type { WithPaths } from \"library/render/traits/Path.ts\"\nimport { toSVGPath } from \"library/render/traits/Path.ts\"\nimport { ConvertColor } from \"library/render/types/Color/ConvertColor.ts\"\nimport type { HandleMirroring } from \"library/render/types/PathSegment.ts\"\nimport { PathSegment } from \"library/render/types/PathSegment.ts\"\nimport { Point } from \"library/render/types/Point.ts\"\nimport type { LineCap, LineJoin } from \"library/render/types/Stroke.ts\"\nimport { copyShapeStyle } from \"./index.ts\"\n\ntype StyleableVectorNode = Parameters<typeof copyShapeStyle>[0]\ntype OutlinableVectorNode = VectorNode &\n\tStyleableVectorNode & {\n\t\tresolveValue(property: \"strokeWidth\"): number | undefined\n\t\tresolveValue(property: \"strokeColor\"): string | undefined\n\t}\n\nconst enum PathKitVerb {\n\tMove = 0,\n\tLine = 1,\n\tQuad = 2,\n\tConic = 3,\n\tCubic = 4,\n\tClose = 5,\n}\n\nconst log = getLogger(\"convertToOutline\")\n\nlet pathKitPromise: Promise<PathKit.PathKitModule> | undefined\n\nfunction getPathKit() {\n\tif (!pathKitPromise) {\n\t\tpathKitPromise = Promise.all([import(\"pathkit-wasm/bin/pathkit.js\"), import(\"pathkit-wasm/bin/pathkit.wasm\")]).then(\n\t\t\t([{ default: pathKitInit }, { default: pathkitWasmURL }]) =>\n\t\t\t\tpathKitInit({\n\t\t\t\t\tlocateFile: () => pathkitWasmURL,\n\t\t\t\t}),\n\t\t)\n\t\tpathKitPromise = pathKitPromise.catch(error => {\n\t\t\tpathKitPromise = undefined\n\t\t\tthrow error\n\t\t})\n\t}\n\n\treturn pathKitPromise\n}\n\nfunction sourcePathsForOutline(node: OutlinableVectorNode): { paths: WithPaths; parentOffset: Point | null } {\n\tif (withPath(node)) {\n\t\treturn {\n\t\t\tpaths: node.calculatedPaths(),\n\t\t\tparentOffset: null,\n\t\t}\n\t}\n\n\tconst basePaths = node.calculatedPaths()\n\tconst pathsInParent = convertPathToParent(node, basePaths)\n\tconst boundingBox = Path.boundingBox(pathsInParent)\n\tconst parentOffset = { x: boundingBox.x, y: boundingBox.y }\n\tconst paths = pathsInParent.map(path => Path.offset(path, Point.reverse(parentOffset)))\n\n\treturn {\n\t\tpaths,\n\t\tparentOffset,\n\t}\n}\n\nfunction pathsToParent(node: OutlinableVectorNode, paths: WithPaths, parentOffset: Point | null): WithPaths {\n\tif (parentOffset) {\n\t\treturn paths.map(path => Path.offset(path, parentOffset))\n\t}\n\n\treturn convertPathToParent(node, paths)\n}\n\nfunction pathKitDashForStrokeDashArray(strokeDashArray: string | undefined): { on: number; off: number } | null {\n\tif (!strokeDashArray) return null\n\n\tconst rawIntervals = strokeDashArray\n\t\t.split(/[,\\s]+/u)\n\t\t.map(value => Number(value))\n\t\t.filter(value => Number.isFinite(value) && value > 0)\n\n\tif (rawIntervals.length === 0) return null\n\tif (rawIntervals.length === 1) {\n\t\tconst on = rawIntervals[0]\n\t\tassert(on !== undefined, \"Expected dash interval at index 0\")\n\t\treturn { on, off: on }\n\t}\n\n\tif (rawIntervals.length === 2) {\n\t\tconst on = rawIntervals[0]\n\t\tconst off = rawIntervals[1]\n\t\tassert(on !== undefined && off !== undefined, \"Expected dash intervals at index 0 and 1\")\n\t\treturn { on, off }\n\t}\n\n\t// PathKit supports a single on/off pair; collapse longer SVG dash patterns.\n\tconst intervals = rawIntervals.length % 2 === 0 ? rawIntervals : rawIntervals.concat(rawIntervals)\n\tconst on = intervals.reduce((sum, value, index) => (index % 2 === 0 ? sum + value : sum), 0)\n\tconst off = intervals.reduce((sum, value, index) => (index % 2 === 1 ? sum + value : sum), 0)\n\n\tif (on <= 0 || off <= 0) return null\n\treturn { on, off }\n}\n\nfunction strokePathForNode(\n\tpathKit: PathKit.PathKitModule,\n\tnode: OutlinableVectorNode,\n\tsourcePath: PathKit.PathKitPath,\n\tsourcePaths: WithPaths,\n): PathKit.PathKitPath | null {\n\tconst strokeWidth = node.resolveValue(\"strokeWidth\")\n\tif (!strokeWidth || strokeWidth <= 0) return null\n\n\tconst isClosedPath = Path.isClosed(sourcePaths)\n\tconst hasInsideStroke = isClosedPath && node.strokeAlignment === \"inside\"\n\tconst renderedStrokeWidth = hasInsideStroke ? strokeWidth * 2 : strokeWidth\n\n\tconst outlinedPath = sourcePath.copy()\n\tif (!outlinedPath) return null\n\n\tconst dash = pathKitDashForStrokeDashArray(node.strokeDashArray)\n\tif (dash) {\n\t\tconst dashResult = outlinedPath.dash(dash.on, dash.off, node.strokeDashOffset ?? 0)\n\t\tif (!dashResult) {\n\t\t\toutlinedPath.delete()\n\t\t\treturn null\n\t\t}\n\t}\n\n\tconst strokeResult = outlinedPath.stroke({\n\t\twidth: renderedStrokeWidth,\n\t\tmiter_limit: node.strokeMiterLimit ?? 4,\n\t\tcap: pathKitCap(pathKit, node.lineCap),\n\t\tjoin: pathKitJoin(pathKit, node.lineJoin),\n\t})\n\n\tif (!strokeResult) {\n\t\toutlinedPath.delete()\n\t\treturn null\n\t}\n\n\tif (hasInsideStroke) {\n\t\tif (!outlinedPath.op(sourcePath, pathKit.PathOp.INTERSECT)) {\n\t\t\toutlinedPath.delete()\n\t\t\treturn null\n\t\t}\n\t}\n\n\treturn outlinedPath\n}\n\nfunction nonOverlappingFillPathsForOutlinedPath(\n\tpathKit: PathKit.PathKitModule,\n\tsourcePath: PathKit.PathKitPath,\n\toutlinedPath: PathKit.PathKitPath,\n): WithPaths | null {\n\tlet fillPath: PathKit.PathKitPath | null = null\n\ttry {\n\t\tfillPath = sourcePath.copy()\n\t\tif (!fillPath) return null\n\n\t\tif (!fillPath.op(outlinedPath, pathKit.PathOp.DIFFERENCE)) return null\n\n\t\tfillPath.simplify()\n\n\t\tconst fillPaths = withPathsFromPathKitCommands(fillPath.toCmds())\n\t\treturn fillPaths.length > 0 ? fillPaths : null\n\t} finally {\n\t\tfillPath?.delete()\n\t}\n}\n\nexport function convertToOutlineEnabled(nodes: CanvasNode[]) {\n\tif (nodes.length !== 1) return false\n\n\tconst selectedNode = nodes[0]\n\tif (!selectedNode) return false\n\tif (!isOutlinableVectorNode(selectedNode)) return false\n\tif (isReplicaOrReplicaChild(selectedNode)) return false\n\tif (!selectedNode.strokeEnabled) return false\n\n\tconst strokeWidth = selectedNode.resolveValue(\"strokeWidth\")\n\tif (!strokeWidth || strokeWidth <= 0) return false\n\n\treturn true\n}\n\nfunction isOutlinableVectorNode(node: CanvasNode): node is OutlinableVectorNode {\n\tif (isShapeGroupNode(node)) return false\n\treturn (\n\t\tisVectorNode(node) &&\n\t\twithShape(node) &&\n\t\twithPosition(node) &&\n\t\twithSize(node) &&\n\t\twithStroke(node) &&\n\t\twithFill(node) &&\n\t\twithOptionalFill(node)\n\t)\n}\n\nfunction pathKitJoin(pathKit: PathKit.PathKitModule, lineJoin: LineJoin | undefined) {\n\tswitch (lineJoin) {\n\t\tcase \"round\":\n\t\t\treturn pathKit.StrokeJoin.ROUND\n\t\tcase \"bevel\":\n\t\t\treturn pathKit.StrokeJoin.BEVEL\n\t\tcase \"miter\":\n\t\tcase undefined:\n\t\t\treturn pathKit.StrokeJoin.MITER\n\t\tdefault:\n\t\t\tassertNever(lineJoin)\n\t}\n}\n\nfunction pathKitCap(pathKit: PathKit.PathKitModule, lineCap: LineCap | undefined) {\n\tswitch (lineCap) {\n\t\tcase \"round\":\n\t\t\treturn pathKit.StrokeCap.ROUND\n\t\tcase \"square\":\n\t\t\treturn pathKit.StrokeCap.SQUARE\n\t\tcase \"butt\":\n\t\tcase undefined:\n\t\t\treturn pathKit.StrokeCap.BUTT\n\t\tdefault:\n\t\t\tassertNever(lineCap)\n\t}\n}\n\nfunction almostZero(value: number) {\n\treturn Math.abs(value) < 0.000_001\n}\n\nfunction almostEqual(a: number, b: number) {\n\treturn Math.abs(a - b) < 0.000_001\n}\n\nfunction mirroringForHandles(\n\thandleInX: number,\n\thandleInY: number,\n\thandleOutX: number,\n\thandleOutY: number,\n): HandleMirroring {\n\tif (almostZero(handleInX) && almostZero(handleInY) && almostZero(handleOutX) && almostZero(handleOutY)) {\n\t\treturn \"straight\"\n\t}\n\n\tif (almostEqual(handleInX, -handleOutX) && almostEqual(handleInY, -handleOutY)) {\n\t\tconst inLength = Math.hypot(handleInX, handleInY)\n\t\tconst outLength = Math.hypot(handleOutX, handleOutY)\n\t\treturn almostEqual(inLength, outLength) ? \"symmetric\" : \"asymmetric\"\n\t}\n\n\treturn \"disconnected\"\n}\n\nfunction createPathSegment({\n\tx,\n\ty,\n\thandleInX = 0,\n\thandleInY = 0,\n\thandleOutX = 0,\n\thandleOutY = 0,\n}: {\n\tx: number\n\ty: number\n\thandleInX?: number\n\thandleInY?: number\n\thandleOutX?: number\n\thandleOutY?: number\n}): PathSegment {\n\treturn new PathSegment({\n\t\tx,\n\t\ty,\n\t\thandleInX,\n\t\thandleInY,\n\t\thandleOutX,\n\t\thandleOutY,\n\t\thandleMirroring: mirroringForHandles(handleInX, handleInY, handleOutX, handleOutY),\n\t})\n}\n\nfunction cubicScaleForConicWeight(weight: number): number | null {\n\tif (!Number.isFinite(weight)) return null\n\n\tconst denominator = 3 * (1 + weight)\n\tif (almostZero(denominator)) return null\n\n\t// Convert Skia conics to cubic handles directly to avoid expanding rounded joins/caps\n\t// through an SVG stringify/parse roundtrip.\n\treturn (4 * weight) / denominator\n}\n\nfunction addQuadraticSegment(pathSegments: PathSegment[], controlX: number, controlY: number, x: number, y: number) {\n\tconst previousIndex = pathSegments.length - 1\n\tconst previous = pathSegments[previousIndex]\n\tassert(previous !== undefined, \"Expected previous path segment\")\n\n\tconst handleOutX = (2 / 3) * (controlX - previous.x)\n\tconst handleOutY = (2 / 3) * (controlY - previous.y)\n\tconst handleInX = (2 / 3) * (controlX - x)\n\tconst handleInY = (2 / 3) * (controlY - y)\n\n\tpathSegments[previousIndex] = previous.merge({\n\t\thandleOutX,\n\t\thandleOutY,\n\t\thandleMirroring: mirroringForHandles(previous.handleInX, previous.handleInY, handleOutX, handleOutY),\n\t})\n\n\tpathSegments.push(\n\t\tcreatePathSegment({\n\t\t\tx,\n\t\t\ty,\n\t\t\thandleInX,\n\t\t\thandleInY,\n\t\t}),\n\t)\n}\n\nfunction addConicSegment(\n\tpathSegments: PathSegment[],\n\tcontrolX: number,\n\tcontrolY: number,\n\tx: number,\n\ty: number,\n\tweight: number,\n) {\n\tconst previousIndex = pathSegments.length - 1\n\tconst previous = pathSegments[previousIndex]\n\tassert(previous !== undefined, \"Expected previous path segment\")\n\n\tconst cubicScale = cubicScaleForConicWeight(weight)\n\tif (cubicScale === null) {\n\t\taddQuadraticSegment(pathSegments, controlX, controlY, x, y)\n\t\treturn\n\t}\n\n\tconst control1X = previous.x + cubicScale * (controlX - previous.x)\n\tconst control1Y = previous.y + cubicScale * (controlY - previous.y)\n\tconst control2X = x + cubicScale * (controlX - x)\n\tconst control2Y = y + cubicScale * (controlY - y)\n\n\tconst handleOutX = control1X - previous.x\n\tconst handleOutY = control1Y - previous.y\n\tconst handleInX = control2X - x\n\tconst handleInY = control2Y - y\n\n\tpathSegments[previousIndex] = previous.merge({\n\t\thandleOutX,\n\t\thandleOutY,\n\t\thandleMirroring: mirroringForHandles(previous.handleInX, previous.handleInY, handleOutX, handleOutY),\n\t})\n\n\tpathSegments.push(\n\t\tcreatePathSegment({\n\t\t\tx,\n\t\t\ty,\n\t\t\thandleInX,\n\t\t\thandleInY,\n\t\t}),\n\t)\n}\n\nfunction pushCurrentPath(result: WithPaths, pathSegments: PathSegment[], pathClosed: boolean) {\n\tif (pathSegments.length === 0) return\n\tresult.push({ pathSegments, pathClosed })\n}\n\nfunction withPathsFromPathKitCommands(commands: number[][]): WithPaths {\n\tconst result: WithPaths = []\n\tlet pathSegments: PathSegment[] = []\n\tlet pathClosed = false\n\n\tfor (const command of commands) {\n\t\tconst verb = command[0]\n\t\tassert(verb !== undefined, \"Expected path command verb\")\n\n\t\tswitch (verb) {\n\t\t\tcase PathKitVerb.Move: {\n\t\t\t\tpushCurrentPath(result, pathSegments, pathClosed)\n\t\t\t\tconst x = command[1]\n\t\t\t\tconst y = command[2]\n\t\t\t\tassert(x !== undefined && y !== undefined, \"Expected move command values\")\n\t\t\t\tpathSegments = [createPathSegment({ x, y })]\n\t\t\t\tpathClosed = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase PathKitVerb.Line: {\n\t\t\t\tif (pathSegments.length === 0) break\n\t\t\t\tconst x = command[1]\n\t\t\t\tconst y = command[2]\n\t\t\t\tassert(x !== undefined && y !== undefined, \"Expected line command values\")\n\t\t\t\tpathSegments.push(createPathSegment({ x, y }))\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase PathKitVerb.Conic: {\n\t\t\t\tif (pathSegments.length === 0) break\n\n\t\t\t\tconst controlX = command[1]\n\t\t\t\tconst controlY = command[2]\n\t\t\t\tconst x = command[3]\n\t\t\t\tconst y = command[4]\n\t\t\t\tassert(\n\t\t\t\t\tcontrolX !== undefined && controlY !== undefined && x !== undefined && y !== undefined,\n\t\t\t\t\t\"Expected conic command values\",\n\t\t\t\t)\n\n\t\t\t\tconst weight = command[5]\n\t\t\t\tassert(weight !== undefined, \"Expected conic command weight\")\n\t\t\t\taddConicSegment(pathSegments, controlX, controlY, x, y, weight)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase PathKitVerb.Quad: {\n\t\t\t\tif (pathSegments.length === 0) break\n\n\t\t\t\tconst controlX = command[1]\n\t\t\t\tconst controlY = command[2]\n\t\t\t\tconst x = command[3]\n\t\t\t\tconst y = command[4]\n\t\t\t\tassert(\n\t\t\t\t\tcontrolX !== undefined && controlY !== undefined && x !== undefined && y !== undefined,\n\t\t\t\t\t\"Expected quadratic command values\",\n\t\t\t\t)\n\n\t\t\t\taddQuadraticSegment(pathSegments, controlX, controlY, x, y)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase PathKitVerb.Cubic: {\n\t\t\t\tif (pathSegments.length === 0) break\n\n\t\t\t\tconst control1X = command[1]\n\t\t\t\tconst control1Y = command[2]\n\t\t\t\tconst control2X = command[3]\n\t\t\t\tconst control2Y = command[4]\n\t\t\t\tconst x = command[5]\n\t\t\t\tconst y = command[6]\n\t\t\t\tassert(\n\t\t\t\t\tcontrol1X !== undefined &&\n\t\t\t\t\t\tcontrol1Y !== undefined &&\n\t\t\t\t\t\tcontrol2X !== undefined &&\n\t\t\t\t\t\tcontrol2Y !== undefined &&\n\t\t\t\t\t\tx !== undefined &&\n\t\t\t\t\t\ty !== undefined,\n\t\t\t\t\t\"Expected cubic command values\",\n\t\t\t\t)\n\n\t\t\t\tconst previousIndex = pathSegments.length - 1\n\t\t\t\tconst previous = pathSegments[previousIndex]\n\t\t\t\tassert(previous !== undefined, \"Expected previous path segment\")\n\n\t\t\t\tconst handleOutX = control1X - previous.x\n\t\t\t\tconst handleOutY = control1Y - previous.y\n\t\t\t\tconst handleInX = control2X - x\n\t\t\t\tconst handleInY = control2Y - y\n\n\t\t\t\tpathSegments[previousIndex] = previous.merge({\n\t\t\t\t\thandleOutX,\n\t\t\t\t\thandleOutY,\n\t\t\t\t\thandleMirroring: mirroringForHandles(previous.handleInX, previous.handleInY, handleOutX, handleOutY),\n\t\t\t\t})\n\n\t\t\t\tpathSegments.push(\n\t\t\t\t\tcreatePathSegment({\n\t\t\t\t\t\tx,\n\t\t\t\t\t\ty,\n\t\t\t\t\t\thandleInX,\n\t\t\t\t\t\thandleInY,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcase PathKitVerb.Close: {\n\t\t\t\tif (pathSegments.length === 0) break\n\t\t\t\tpathClosed = true\n\t\t\t\tpushCurrentPath(result, pathSegments, pathClosed)\n\t\t\t\tpathSegments = []\n\t\t\t\tpathClosed = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t}\n\t}\n\n\tpushCurrentPath(result, pathSegments, pathClosed)\n\treturn result\n}\n\nfunction nodeFromPaths(\n\tengine: VekterEngine,\n\tnode: VectorNode,\n\tpaths: WithPaths,\n\tstyle: ReturnType<typeof copyShapeStyle>,\n): NodeID {\n\tconst id = randomID()\n\tconst boundingBox = Path.boundingBox(paths)\n\n\tif (paths.length === 1) {\n\t\tconst firstPath = paths[0]\n\t\tassert(firstPath !== undefined, \"Expected path at index 0\")\n\t\tconst normalizedPath = Path.offset(firstPath, Point.reverse(boundingBox))\n\t\tengine.createPath(node.parentid, { id, ...normalizedPath, ...boundingBox, ...style })\n\t} else {\n\t\tconst nodesToAdd: CanvasNode[] = []\n\t\tconst booleanNode = new BooleanShapeNode({\n\t\t\tid,\n\t\t\tparentid: node.parentid,\n\t\t\tpathBoolean: PathBooleanType.Exclude,\n\t\t\t...boundingBox,\n\t\t\t...style,\n\t\t})\n\t\tnodesToAdd.push(booleanNode)\n\n\t\tfor (const path of paths) {\n\t\t\tconst childBoundingBox = Path.boundingBox(path)\n\t\t\tconst frame = { ...childBoundingBox, ...Point.subtract(childBoundingBox, boundingBox) }\n\t\t\tconst normalizedPath = Path.offset(path, Point.reverse(childBoundingBox))\n\t\t\tnodesToAdd.push(new PathNode({ parentid: id, ...frame, ...normalizedPath, ...style }))\n\t\t}\n\n\t\tengine.tree.insertNodes(nodesToAdd)\n\t}\n\n\treturn id\n}\n\nfunction outlinedAndFillPathsForNode(\n\tpathKit: PathKit.PathKitModule,\n\tnode: OutlinableVectorNode,\n\tsourcePaths: WithPaths,\n\tincludeFill: boolean,\n): { outlinedPaths: WithPaths | null; fillPaths: WithPaths | null } {\n\tconst sourcePathData = toSVGPath(sourcePaths)\n\n\tlet sourcePath: PathKit.PathKitPath | null = null\n\tlet outlinedPath: PathKit.PathKitPath | null = null\n\ttry {\n\t\tsourcePath = pathKit.FromSVGString(sourcePathData)\n\t\tif (!sourcePath) return { outlinedPaths: null, fillPaths: null }\n\n\t\toutlinedPath = strokePathForNode(pathKit, node, sourcePath, sourcePaths)\n\t\tif (!outlinedPath) return { outlinedPaths: null, fillPaths: null }\n\n\t\toutlinedPath.simplify()\n\n\t\tconst outlinedPaths = withPathsFromPathKitCommands(outlinedPath.toCmds())\n\t\tif (outlinedPaths.length === 0) return { outlinedPaths: null, fillPaths: null }\n\n\t\tconst fillPaths = includeFill ? nonOverlappingFillPathsForOutlinedPath(pathKit, sourcePath, outlinedPath) : null\n\n\t\treturn { outlinedPaths, fillPaths }\n\t} finally {\n\t\toutlinedPath?.delete()\n\t\tsourcePath?.delete()\n\t}\n}\n\nfunction getNonTransparentStrokeColor(node: OutlinableVectorNode): string | undefined {\n\tconst strokeColor = node.resolveValue(\"strokeColor\")\n\tif (!strokeColor || ConvertColor.getAlpha(strokeColor) === 0) return shapeFillDefaults.fillColor\n\treturn strokeColor\n}\n\nexport async function convertToOutline(engine: VekterEngine, node: CanvasNode): Promise<NodeID | null> {\n\ttry {\n\t\tif (!convertToOutlineEnabled([node])) return null\n\n\t\tconst pathKit = await getPathKit()\n\n\t\tconst vectorNodeId = node.id\n\t\tconst vectorNode = engine.tree.getNode(vectorNodeId)\n\t\tif (!vectorNode || !isOutlinableVectorNode(vectorNode)) return null\n\n\t\tconst includeFill = Boolean(vectorNode.fillEnabled && vectorNode.fillType)\n\t\tconst { paths: sourcePaths, parentOffset } = sourcePathsForOutline(vectorNode)\n\t\tconst { outlinedPaths, fillPaths } = outlinedAndFillPathsForNode(pathKit, vectorNode, sourcePaths, includeFill)\n\t\tif (!outlinedPaths) return null\n\n\t\treturn await engine.scheduler.processWhenReadyAsync((): NodeID | null => {\n\t\t\tconst currentNode = engine.tree.getNode(vectorNodeId)\n\t\t\tif (!currentNode || !isOutlinableVectorNode(currentNode)) return null\n\n\t\t\tconst outlineStyle = copyShapeStyle(currentNode)\n\n\t\t\toutlineStyle.strokeEnabled = false\n\t\t\toutlineStyle.strokeWidth = 0\n\t\t\toutlineStyle.strokeDashArray = \"0\"\n\t\t\toutlineStyle.strokeDashOffset = 0\n\t\t\toutlineStyle.fillEnabled = true\n\t\t\toutlineStyle.fillType = \"color\"\n\t\t\toutlineStyle.fillColor = getNonTransparentStrokeColor(currentNode)\n\t\t\toutlineStyle.fillLinearGradient = undefined\n\t\t\toutlineStyle.fillRadialGradient = undefined\n\t\t\toutlineStyle.fillImage = undefined\n\t\t\toutlineStyle.fillImageResize = undefined\n\t\t\toutlineStyle.fillImageOriginalName = undefined\n\t\t\toutlineStyle.fillImagePixelWidth = undefined\n\t\t\toutlineStyle.fillImagePixelHeight = undefined\n\t\t\toutlineStyle.fillImagePositionX = undefined\n\t\t\toutlineStyle.fillImagePositionY = undefined\n\t\t\toutlineStyle.fillImageTileSize = undefined\n\n\t\t\tconst shouldCreateFillNode = Boolean(currentNode.fillEnabled && currentNode.fillType)\n\n\t\t\tconst sourceNodeParent = engine.tree.getParent(currentNode.id)\n\t\t\tconst sourceNodeIndex =\n\t\t\t\tsourceNodeParent && withChildren(sourceNodeParent) ? sourceNodeParent.children.indexOf(currentNode) : -1\n\t\t\tconst sourceNodeParentId = sourceNodeParent && withChildren(sourceNodeParent) ? sourceNodeParent.id : null\n\n\t\t\tconst outlinedPathsInParent = pathsToParent(currentNode, outlinedPaths, parentOffset)\n\t\t\tconst outlinedNodeId = nodeFromPaths(engine, currentNode, outlinedPathsInParent, outlineStyle)\n\t\t\tlet fillNodeId: NodeID | null = null\n\n\t\t\tif (shouldCreateFillNode) {\n\t\t\t\tconst nonOverlappingFillPaths = fillPaths\n\n\t\t\t\tif (nonOverlappingFillPaths && nonOverlappingFillPaths.length > 0) {\n\t\t\t\t\tconst fillStyle = copyShapeStyle(currentNode)\n\t\t\t\t\tfillStyle.strokeEnabled = false\n\t\t\t\t\tfillStyle.strokeWidth = 0\n\t\t\t\t\tfillStyle.strokeDashArray = \"0\"\n\t\t\t\t\tfillStyle.strokeDashOffset = 0\n\n\t\t\t\t\tconst fillPathsInParent = pathsToParent(currentNode, nonOverlappingFillPaths, parentOffset)\n\t\t\t\t\tfillNodeId = nodeFromPaths(engine, currentNode, fillPathsInParent, fillStyle)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tengine.deleteNode(currentNode.id)\n\n\t\t\tif (sourceNodeParentId && sourceNodeIndex >= 0) {\n\t\t\t\tif (fillNodeId) {\n\t\t\t\t\tengine.moveNode(fillNodeId, sourceNodeParentId, sourceNodeIndex)\n\t\t\t\t\tengine.moveNode(outlinedNodeId, sourceNodeParentId, sourceNodeIndex + 1)\n\t\t\t\t} else {\n\t\t\t\t\tengine.moveNode(outlinedNodeId, sourceNodeParentId, sourceNodeIndex)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (fillNodeId) {\n\t\t\t\tengine.stores.selectionStore.set([fillNodeId, outlinedNodeId])\n\t\t\t} else {\n\t\t\t\tengine.stores.selectionStore.set(outlinedNodeId)\n\t\t\t}\n\n\t\t\treturn outlinedNodeId\n\t\t})\n\t} catch (error) {\n\t\tlog.reportError(error, {\n\t\t\tnodeId: node.id,\n\t\t})\n\t\treturn null\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { EngineChangeFlag, ObserverToken } from \"document/EngineChanges.ts\"\nimport engine from \"document/engine.ts\"\nimport React from \"react\"\n\ninterface EngineChangeContainerClass<P, S> extends React.ComponentClass<P, S> {\n\tgetStores?: () => any[]\n\tcalculateState: () => S\n\tengineChangeKeys: EngineChangeFlag[]\n}\n\nfunction isEngineChangeContainerClass<P, S>(containerClass: any): containerClass is EngineChangeContainerClass<P, S> {\n\treturn !!containerClass.engineChangeKeys\n}\n\nexport function createContainer<P, S, T extends EngineChangeContainerClass<P, S>>(containerClass: T): T {\n\tassert(\n\t\tisEngineChangeContainerClass(containerClass),\n\t\t`Missing engineChangeKeys property on ${containerClass.name || Dictionary.Unknown}`,\n\t)\n\n\tconst baseClass = containerClass as React.ComponentClass<P, S>\n\tconst displayName = containerClass.displayName || containerClass.name || \"Container\"\n\n\tconst isPure = containerClass.prototype instanceof React.PureComponent\n\tconst hasShouldComponentUpdate = typeof containerClass.prototype.shouldComponentUpdate === \"function\"\n\tif (!isPure && !hasShouldComponentUpdate) {\n\t\t// biome-ignore lint/suspicious/noConsole: <explanation>\n\t\tconsole.warn(\n\t\t\t`Component ${displayName} passed to createContainer() should extend PureComponent to gain a performance improvement`,\n\t\t)\n\t}\n\n\tconst NewClass = class extends baseClass {\n\t\tstatic override displayName = displayName\n\t\tstatic getStores = containerClass.getStores\n\t\tstatic calculateState = containerClass.calculateState\n\t\t__engineChangeObserver: ObserverToken\n\n\t\tconstructor(props: P) {\n\t\t\tsuper(props)\n\t\t\tthis.__engineChangeObserver = engine.scheduler.changes.observeWithComponent(\n\t\t\t\tcontainerClass.engineChangeKeys,\n\t\t\t\tthis,\n\t\t\t\tcontainerClass.calculateState,\n\t\t\t)\n\t\t\tthis.state = containerClass.calculateState()\n\t\t}\n\n\t\toverride componentWillUnmount() {\n\t\t\tengine.scheduler.changes.removeObserver(this.__engineChangeObserver)\n\t\t\tif (super.componentWillUnmount) {\n\t\t\t\tsuper.componentWillUnmount()\n\t\t\t}\n\t\t}\n\t}\n\treturn NewClass as any as T\n}\n", "import type { MenuOptionIcon } from \"@framerjs/framer-services\"\nimport type { ReactNode } from \"react\"\nimport type { AppAction } from \"./AppActions.ts\"\n\n// This interface should (closely) match Electron\u2019s API\nexport interface MenuItemOptions {\n\ttype?: \"normal\" | \"separator\" | \"checkbox\" // NOTE: Not compatible with Electron API, missing \"radio\", \"submenu\"\n\tlabel?: string\n\tdescription?: string\n\t/**\n\t * Use ellipsis when the menu item requires *additional information* (input\n\t * or a selection) *before* it carries out the operation. But: a simple\n\t * confirmation dialog is not considered a dialog that requires additional\n\t * information.\n\t */\n\tellipsis?: boolean\n\t// sublabel?: string\n\taccelerator?: string\n\tacceleratorWindows?: string\n\t// You can specify this prop if you want to only show the label but not trigger the action on the key combination press\n\tacceleratorLabel?: string\n\tacceleratorLabelWindows?: string\n\tacceleratorLabelTokens?: string[]\n\t/**\n\t * If the enabled property is undefined, the menu item will be enabled.\n\t *\n\t * If the enabled property is a boolean, it will be used to determine if the\n\t * menu item is enabled.\n\t *\n\t * If the enabled property is a function, it will be called and the result will\n\t * be used to determine if the menu item is enabled. This works for both sync\n\t * and async functions. Note that if the function returns a promise, the menu\n\t * item will be disabled until the promise resolves.\n\t */\n\tenabled?: boolean | (() => boolean | Promise<boolean>)\n\tvisible?: boolean\n\tchecked?: boolean\n\t/**\n\t * Renders the item as a non-interactive, display-only row: no hover/active\n\t * state, no keyboard focus, and clicking it does nothing (and does not close\n\t * the menu). Use for informational rows such as a key/value stat list.\n\t */\n\treadonly?: boolean\n\tsubmenu?: MenuItemOptions[] | (() => MenuItemOptions[])\n\teditReason?: string | false\n\t// id?: string;\n\t// position?: string;\n\tmixed?: boolean // NOTE: Not compatible with Electron (not supported), to be used together with checked\n\tclick?: () => void // NOTE: Not compatible with Electron API, missing arguments\n\trole?: AppAction // NOTE: Not compatible with Electron API (MenuItemRole | MenuItemRoleMac)\n\talternate?: boolean // Only supported on macOS!\n\tbadge?: string\n\tbadgeClassName?: string\n\t/** Content shown in a tooltip when hovering anywhere on the row. */\n\ttooltip?: ReactNode\n\ticon?: MenuOptionIcon\n\tavatar?: {\n\t\tsrc: string | null\n\t\tdisplayName: string\n\t}\n\t/**\n\t * Additional aliases to match against during search filtering.\n\t * These are not displayed in the menu but are used for search.\n\t */\n\taliases?: string[]\n\t// Optional key for ensuring unique lists that may have same labels, e.g.\n\t// user input.\n\tkey?: string\n}\n\ninterface EnabledCheckMenuItemOptions extends Omit<MenuItemOptions, \"enabled\"> {\n\t/**\n\t * Provides a function that will define the menu \"enabled\" state and will\n\t * have its condition re-evaluated before executing the click action.\n\t */\n\tenabled: () => boolean\n\tclick: () => void\n}\n\n/**\n * This MenuItemOptions wrapper is used to re-evaluate the \"enabled\" condition\n * before executing the click action. This is necessary to prevent issues if the\n * condition changes when the menu is already displayed.\n * More details: https://github.com/framer/FramerStudio/pull/15262\n */\nexport function withEnabledCheck(options: EnabledCheckMenuItemOptions): MenuItemOptions {\n\treturn {\n\t\t...options,\n\t\tenabled: options.enabled(),\n\t\tclick: () => {\n\t\t\tif (!options.enabled()) return\n\t\t\toptions.click()\n\t\t},\n\t}\n}\n", "import path from \"path\"\nimport type { LocalModuleId } from \"@framerjs/shared\"\nimport { assert } from \"@framerjs/shared\"\nimport { restoreExtension, sanitizeFilePath } from \"code-editor/utils.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { editPanelTitle } from \"document/components/chrome/Pages/utils/editPanelRow.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\n\nimport { EntityFolderNode } from \"document/models/CanvasTree/nodes/EntityFolderNode.ts\"\nimport type { EntityReferenceNode } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tCODE_FILE_ENTITY_TYPE_ROOT_ID,\n\tCONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { isLocalModuleNode } from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport { isNodeId } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport {\n\tcreateEntityFolderNodesFromPath,\n\twouldAssetEntityCollide,\n} from \"document/models/CanvasTree/nodes/utils/entityFolderNode.ts\"\nimport { entityRootTypeIdForEntityNode } from \"document/models/CanvasTree/nodes/utils/entityTypeRootNode.ts\"\nimport {\n\tisEntityFolderNode,\n\tisEntityReferenceNode,\n\tisSmartComponentNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { splitPathToSegments } from \"document/utils/assetPath.ts\"\nimport { renameCodeFileModule } from \"utils/codeFiles.ts\"\nimport { sanitizeCollectionName } from \"../../contentManagement/utils/sanitizeCollectionName.ts\"\nimport { expandAssetEntityItems } from \"../utils/expandAssetEntityItems.ts\"\nimport { getReferenceNodeFullPath } from \"../utils/getReferenceNodeFullPath.ts\"\nimport { getEntityInputId } from \"./utils.ts\"\n\nexport function renameEntity(id: NodeID, popout: boolean = false) {\n\tconst inputId = getEntityInputId(id, popout)\n\teditPanelTitle(inputId)\n}\n\nexport function expandParentAndRenameEntity(engine: VekterEngine, parentId: NodeID, itemId: NodeID, popout: boolean) {\n\tconst isFolderOpen = engine.stores.chromeStore.isExpandedAssetEntityItem(parentId, popout)\n\tif (!isFolderOpen) {\n\t\texpandAssetEntityItems(engine, parentId, popout)\n\t\t// Wait for the folder to expand before renaming the entity\n\t\tsetTimeout(() => renameEntity(itemId, popout), 50)\n\t\treturn\n\t}\n\trenameEntity(itemId, popout)\n}\n\ninterface RenameEntityOptions {\n\t/** When true, expanded state is tracked for the popout panel. */\n\tpopout: boolean\n}\n\nexport function renameEntityFolderNode(\n\tengine: VekterEngine,\n\tnodeId: NodeID,\n\tnewName: string,\n\toptions: RenameEntityOptions,\n): void {\n\tconst node = engine.tree.getNode(nodeId)\n\tif (!isEntityFolderNode(node)) return\n\n\tconst parentNodeId = node.parentid\n\tif (!isNodeId(parentNodeId)) return\n\n\tconst { popout } = options\n\n\t// The new name can be a path, so we need to split it into segments.\n\tconst pathSegments = splitPathToSegments(newName)\n\tif (pathSegments.length === 0) return\n\n\t// Folders only collide with same-kind siblings; sharing a name with a\n\t// reference (e.g. a `Gallery` folder next to a `Gallery` collection) is fine.\n\tif (wouldAssetEntityCollide(engine.tree, pathSegments, parentNodeId, \"folder\")) return\n\n\t// The last segment is the new folder name. The rest are the new folder parents.\n\tconst newFolderName = pathSegments.pop()\n\n\t// We first need to create the new parent folder nodes, if there are any.\n\tif (pathSegments.length > 0) {\n\t\t// Special case: if the first path segment matches the current folder name,\n\t\t// we need to create the path excluding the self-reference\n\t\tconst currentFolderName = node.getName()\n\t\tconst isFirstSegmentSelfReference = pathSegments[0] === currentFolderName\n\n\t\tlet pathToCreate = pathSegments\n\t\tlet targetParentId = parentNodeId\n\n\t\tif (isFirstSegmentSelfReference) {\n\t\t\t// Skip the first segment since it refers to the current folder\n\t\t\tpathToCreate = pathSegments.slice(1)\n\n\t\t\t// Create a new folder with the current name at the same level\n\t\t\tconst newFolderWithCurrentName = new EntityFolderNode({ name: currentFolderName })\n\t\t\tconst createdFolder = engine.tree.insertNode(newFolderWithCurrentName, parentNodeId)\n\t\t\ttargetParentId = createdFolder.id\n\t\t}\n\n\t\tconst newParentId = createEntityFolderNodesFromPath(engine.tree, pathToCreate, targetParentId)\n\t\tengine.tree.moveNode(node, newParentId)\n\n\t\t// Make sure all the parent folders are expanded\n\t\texpandAssetEntityItems(engine, newParentId, popout)\n\t}\n\n\t// Finally, we can rename the current folder name, if it is different from the new folder name.\n\tif (node.getName() !== newFolderName) node.set({ name: newFolderName })\n\n\t// Update file paths for any code files within this folder\n\tupdateCodeFilePathsInFolder(engine, node)\n}\n\n/**\n * Updates the file paths of all code file entity references within a folder\n * after the folder has been renamed or moved.\n */\nfunction updateCodeFilePathsInFolder(engine: VekterEngine, folderNode: EntityFolderNode) {\n\t// Determine if this folder is within the code files entity type root\n\tconst entityTypeRootId = entityRootTypeIdForEntityNode(folderNode)\n\tif (entityTypeRootId !== CODE_FILE_ENTITY_TYPE_ROOT_ID) return\n\n\t// Find all entity reference nodes that are code files within this folder\n\tfor (const child of folderNode.walk()) {\n\t\tif (!isEntityReferenceNode(child)) continue\n\n\t\tvoid updateLocalModulePath(engine, child)\n\t}\n}\n\nexport async function renameEntityReferenceNode(\n\tengine: VekterEngine,\n\tnodeId: NodeID,\n\tnewName: string,\n\toptions: RenameEntityOptions,\n) {\n\tconst referenceNode = engine.tree.getNode(nodeId)\n\tif (!isEntityReferenceNode(referenceNode)) return\n\n\t// We ensure that the referenced node exists, before doing any action.\n\tconst referencedNode = engine.tree.getNode(referenceNode.referenceId)\n\tif (!referencedNode) return\n\n\tconst { popout } = options\n\n\tconst entityTypeRootId = entityRootTypeIdForEntityNode(referenceNode)\n\n\tconst referencedNodeParentId = referenceNode.parentid\n\tif (referencedNodeParentId === null || referencedNodeParentId === undefined) return\n\n\t// The new name can be a path, so we need to split it into segments.\n\tconst pathSegments = splitPathToSegments(newName)\n\tif (pathSegments.length === 0) return\n\n\tif (wouldAssetEntityCollide(engine.tree, pathSegments, referencedNodeParentId, \"reference\")) {\n\t\treturn\n\t}\n\n\t// The last segment is the entity name. The rest are the entity parents.\n\tconst newEntityName = pathSegments.pop()\n\n\t// We first need to create the new parent entity nodes, if there are any.\n\tif (pathSegments.length > 0) {\n\t\tconst newParentId = createEntityFolderNodesFromPath(engine.tree, pathSegments, referencedNodeParentId)\n\t\tengine.tree.moveNode(referenceNode, newParentId)\n\n\t\t// Make sure all the parent folders are expanded\n\t\texpandAssetEntityItems(engine, newParentId, popout)\n\t}\n\n\t// For code files and code components, we want to store the full path on the original node.\n\tif (entityTypeRootId === CODE_FILE_ENTITY_TYPE_ROOT_ID) {\n\t\tif (!isLocalModuleNode(referencedNode)) return\n\n\t\tconst currentName = referencedNode.save.name\n\t\tif (!currentName) return\n\n\t\tconst newPath = restoreExtension(replacePathTip(currentName, sanitizeFilePath(newName, false).path), currentName)\n\n\t\tconst localId = referencedNode.id as LocalModuleId\n\t\tawait renameCodeFileModule(engine.stores.modulesStore, localId, newPath)\n\n\t\treturn\n\t}\n\n\tif (entityTypeRootId === CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID) {\n\t\tif (!newEntityName) return\n\t\tconst finalName = sanitizeCollectionName(engine.tree, referencedNode.id, newEntityName)\n\t\tif (!finalName) return\n\t\tif (referencedNode.resolveValue(\"name\") !== finalName) {\n\t\t\treferencedNode.set({ name: finalName })\n\t\t}\n\t\treturn\n\t}\n\n\tconst current = isSmartComponentNode(referencedNode) ? referencedNode.name : referenceNode.getName()\n\n\t// We rename the referenced node name, if it is different from the new entity name.\n\tif (current !== newEntityName) referencedNode.set({ name: newEntityName })\n}\n\n/**\n * Replaces the last segment of the given path with a new segment.\n *\n * @param originalPath - The original file path (e.g., /a/b/hello.tsx).\n * @param newPath - The new segment to replace the tip of the original path (e.g., c/hello.tsx).\n * @returns The modified path with the new segment appended (e.g., /a/b/c/hello.tsx).\n */\nfunction replacePathTip(originalPath: string, newPath: string): string {\n\tconst originalDir = path.dirname(originalPath) // Get the directory of the original path\n\tconst newTip = path.normalize(newPath) // Normalize the new path segment\n\treturn path.join(originalDir, newTip)\n}\n\n/**\n * Updates the file path for a single code file entity reference node.\n * @param engine The Vekter engine instance.\n * @param referenceNode The entity reference node to update.\n * @returns A promise that resolves when the file path has been updated.\n */\nexport async function updateLocalModulePath(engine: VekterEngine, referenceNode: EntityReferenceNode) {\n\tconst localModuleNode = engine.tree.get(referenceNode.referenceId)\n\tassert(isLocalModuleNode(localModuleNode), \"referenced node must be a local module node\")\n\n\tconst previousPath = localModuleNode.save.name\n\tif (!previousPath) return\n\n\t// The tip can't change after drag and drop.\n\tconst tip = extractTipFromPath(previousPath)\n\t// Everything before the tip may have changed, so we need to build a new path.\n\tconst referenceNodeFullPath = getReferenceNodeFullPath(referenceNode)\n\n\tconst newPath = restoreExtension(sanitizeFilePath(`${referenceNodeFullPath}/${tip}`, false).path, previousPath)\n\tif (newPath === previousPath) return\n\n\tconst localId = localModuleNode.id as LocalModuleId\n\tawait renameCodeFileModule(engine.stores.modulesStore, localId, newPath)\n}\n\nfunction extractTipFromPath(path: string) {\n\tconst previousPathSegments = splitPathToSegments(path)\n\treturn previousPathSegments[previousPathSegments.length - 1]\n}\n", "import type { CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport { isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\n\n/**\n * Sanitizes a collection name by removing forbidden characters and ensuring\n * uniqueness among sibling collections. Returns the sanitized name, or null\n * if the resulting name would be empty.\n */\nexport function sanitizeCollectionName(tree: CanvasTree, collectionId: NodeID, name: string): string | null {\n\tconst contentManagementNode = getContentManagementNode(tree)?.loaded\n\tif (!contentManagementNode) return null\n\n\tconst existingNames = new Set<string>()\n\tfor (const child of contentManagementNode.children) {\n\t\tif (!isCollectionNode(child) || child.id === collectionId) continue\n\t\tconst childName = child.resolveValue(\"name\")\n\t\tif (childName) existingNames.add(childName)\n\t}\n\n\tconst sanitized = name.replace(/[{}]/gu, \"\").trim()\n\tconst finalName = uniqueName(sanitized, existingNames)\n\tif (finalName.length === 0) return null\n\n\treturn finalName\n}\n", "import type { EntityFolderNode } from \"document/models/CanvasTree/nodes/EntityFolderNode.ts\"\nimport type { EntityReferenceNode } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport { isEntityTypeRootNode } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { isEntityFolderNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { assert } from \"library/utils/assert.ts\"\n\nexport function getReferenceNodeFullPath(node: EntityFolderNode | EntityReferenceNode) {\n\tconst segments: string[] = []\n\n\tfor (const parent of node.ancestors()) {\n\t\tif (isEntityTypeRootNode(parent)) break\n\n\t\tassert(isEntityFolderNode(parent), \"only entity folders can be ancestors of a reference node\")\n\n\t\tsegments.unshift(parent.getName())\n\t}\n\n\treturn segments.join(\"/\")\n}\n", "import { ModuleType, assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode, CanvasTree, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { ANALYTICS_SCOPE_ID } from \"document/models/CanvasTree/nodes/AnalyticsScopeNode.ts\"\nimport { COLOR_STYLE_TOKEN_LIST_NODE_ID } from \"document/models/CanvasTree/nodes/ColorStyleTokenListNode.ts\"\nimport { CONTENT_MANAGEMENT_ID } from \"document/models/CanvasTree/nodes/ContentManagementNode.ts\"\nimport { EntityReferenceNode } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tAB_TESTS_ENTITY_TYPE_ROOT_ID,\n\tBLOCKQUOTE_ENTITY_ROOT_ID,\n\tCMS_ENTITY_ROOT_ID,\n\tCODE_FILE_ENTITY_TYPE_ROOT_ID,\n\tCOLOR_ENTITY_ROOT_ID,\n\tCOMPONENTS_ENTITY_TYPE_ROOT_ID,\n\tCONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID,\n\ttype EntityTypeRootId,\n\tFUNNELS_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\tVECTOR_SET_ENTITY_TYPE_ROOT_ID,\n\tensureEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { LOCAL_MODULES_LIST_ID, isLocalModuleNode } from \"document/models/CanvasTree/nodes/LocalModuleNode.ts\"\nimport { PRESETS_LIST_NODE_ID } from \"document/models/CanvasTree/nodes/PresetsListNode.ts\"\nimport { buildReferenceNodeId } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport {\n\tisBlockquoteStylePresetPrimaryNode,\n\tisCollectionNode,\n\tisColorStyleTokenNode,\n\tisComponentPresetNode,\n\tisFunnelNode,\n\tisImageStylePresetNode,\n\tisInlineCodeStylePresetNode,\n\tisLayoutTemplateNode,\n\tisLinkStylePresetNode,\n\tisSmartComponentNode,\n\tisTableStylePresetNode,\n\tisTextStylePresetPrimaryNode,\n\tisVectorSetNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\n\nexport function referenceUnreferencedNodesByTypeRoot(engine: VekterEngine, typeRootId: EntityTypeRootId) {\n\tconst unreferencedNodesParentId = getNonReferenceParentIdByTypeRootId(engine.tree, typeRootId)\n\n\tconst unreferencedNodesParentNodes = unreferencedNodesParentId.map(parentId => engine.tree.get(parentId))\n\tassert(unreferencedNodesParentNodes.length > 0, \"unreferenced nodes parent node must exist\")\n\n\tconst unreferencedNodesSiblings = unreferencedNodesParentNodes.flatMap(\n\t\tparentNode => parentNode?.children?.toArray() ?? [],\n\t)\n\n\tif (!unreferencedNodesSiblings || unreferencedNodesSiblings.length === 0) return\n\n\tconst isReferenceNeededForTypeRoot = typeRootIdToUnreferencedNodeTypeCheck[typeRootId]\n\n\t// Ensure the root node exists before inserting references\n\tensureEntityTypeRootNode(engine.tree, typeRootId)\n\n\tengine.tree.beginAllowPartialScopeAccess()\n\n\tfor (const node of unreferencedNodesSiblings) {\n\t\tif (!isReferenceNeededForTypeRoot(node)) continue\n\n\t\tconst referenceId = buildReferenceNodeId(typeRootId, node.id)\n\t\tif (engine.tree.get(referenceId)) continue\n\n\t\tconst referenceNode = new EntityReferenceNode({ id: referenceId })\n\t\tengine.tree.insertNode(referenceNode, typeRootId)\n\t}\n\n\tengine.tree.endAllowPartialScopeAccess()\n}\n\nfunction isCodeFileLocalModuleNode(node: CanvasNode): boolean {\n\treturn isLocalModuleNode(node) && node.save.type === ModuleType.Code\n}\n\nconst typeRootIdToUnreferencedNodeTypeCheck = {\n\t[BLOCKQUOTE_ENTITY_ROOT_ID]: node => isBlockquoteStylePresetPrimaryNode(node),\n\t[INLINE_CODE_ENTITY_ROOT_ID]: node => isInlineCodeStylePresetNode(node),\n\t[LINK_ENTITY_ROOT_ID]: node => isLinkStylePresetNode(node),\n\t[TEXT_ENTITY_ROOT_ID]: node => isTextStylePresetPrimaryNode(node),\n\t[CMS_ENTITY_ROOT_ID]: node =>\n\t\tisImageStylePresetNode(node) || isTableStylePresetNode(node) || isComponentPresetNode(node),\n\t[CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID]: node => isCollectionNode(node) && !node.managedByPlugin,\n\t[CODE_FILE_ENTITY_TYPE_ROOT_ID]: node => isCodeFileLocalModuleNode(node),\n\t[COMPONENTS_ENTITY_TYPE_ROOT_ID]: node => isSmartComponentNode(node) || isCodeFileLocalModuleNode(node),\n\t[COLOR_ENTITY_ROOT_ID]: node => isColorStyleTokenNode(node),\n\t[LAYOUT_TEMPLATE_ENTITY_ROOT_ID]: node => isLayoutTemplateNode(node),\n\t[VECTOR_SET_ENTITY_TYPE_ROOT_ID]: node => isVectorSetNode(node),\n\t[FUNNELS_ENTITY_TYPE_ROOT_ID]: node => isFunnelNode(node) && !node.abTestingParentId,\n\t[AB_TESTS_ENTITY_TYPE_ROOT_ID]: node => isFunnelNode(node) && !!node.abTestingParentId,\n} as const satisfies Record<EntityTypeRootId, (node: CanvasNode) => boolean>\n\nconst typeRootIdToUnreferencedNodeParentId = {\n\t[BLOCKQUOTE_ENTITY_ROOT_ID]: PRESETS_LIST_NODE_ID,\n\t[INLINE_CODE_ENTITY_ROOT_ID]: PRESETS_LIST_NODE_ID,\n\t[LINK_ENTITY_ROOT_ID]: PRESETS_LIST_NODE_ID,\n\t[TEXT_ENTITY_ROOT_ID]: PRESETS_LIST_NODE_ID,\n\t[CMS_ENTITY_ROOT_ID]: PRESETS_LIST_NODE_ID,\n\t[CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID]: CONTENT_MANAGEMENT_ID,\n\t[CODE_FILE_ENTITY_TYPE_ROOT_ID]: LOCAL_MODULES_LIST_ID,\n\t[COLOR_ENTITY_ROOT_ID]: COLOR_STYLE_TOKEN_LIST_NODE_ID,\n\t[FUNNELS_ENTITY_TYPE_ROOT_ID]: ANALYTICS_SCOPE_ID,\n\t[AB_TESTS_ENTITY_TYPE_ROOT_ID]: ANALYTICS_SCOPE_ID,\n} as const satisfies Record<\n\tExclude<\n\t\tEntityTypeRootId,\n\t\t| typeof COMPONENTS_ENTITY_TYPE_ROOT_ID\n\t\t| typeof LAYOUT_TEMPLATE_ENTITY_ROOT_ID\n\t\t| typeof VECTOR_SET_ENTITY_TYPE_ROOT_ID\n\t>,\n\tNodeID\n>\n\nfunction getNonReferenceParentIdByTypeRootId(tree: CanvasTree, typeRootId: EntityTypeRootId): NodeID[] {\n\tif (typeRootId === LAYOUT_TEMPLATE_ENTITY_ROOT_ID || typeRootId === VECTOR_SET_ENTITY_TYPE_ROOT_ID) {\n\t\t// VECTOR @TODO - Support external vector sets.\n\t\treturn [tree.root.id]\n\t}\n\n\t// For the COMPONENTS_ENTITY_TYPE_ROOT_ID, we don't have a single source of unreferenced components;\n\t// code files and smart components are not stored in the same parent. So, we need to check the root for\n\t// the smart components, but also inside local modules for the code files.\n\tif (typeRootId === COMPONENTS_ENTITY_TYPE_ROOT_ID) return [tree.root.id, LOCAL_MODULES_LIST_ID]\n\n\treturn [typeRootIdToUnreferencedNodeParentId[typeRootId]]\n}\n\nconst ENTITY_INPUT_ID = `__entity_input`\n\nexport function getEntityInputId(id: NodeID, popout: boolean): string {\n\treturn `${ENTITY_INPUT_ID}_${id}_${popout ? \"popout\" : \"panel\"}`\n}\n", "import { assert, assertNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { ContextAction } from \"document/components/utils/contextActions.ts\"\nimport type { NodeID, SmartComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport type { ComponentPresetNode } from \"document/models/CanvasTree/nodes/ComponentPresetNode.ts\"\nimport { EntityFolderNode } from \"document/models/CanvasTree/nodes/EntityFolderNode.ts\"\nimport {\n\tAB_TESTS_ENTITY_TYPE_ROOT_ID,\n\tBLOCKQUOTE_ENTITY_ROOT_ID,\n\tCMS_ENTITY_ROOT_ID,\n\tCODE_FILE_ENTITY_TYPE_ROOT_ID,\n\tCOLOR_ENTITY_ROOT_ID,\n\tCOMPONENTS_ENTITY_TYPE_ROOT_ID,\n\tCONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID,\n\ttype EntityTypeRootId,\n\ttype EntityTypeRootNode,\n\tFUNNELS_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\tVECTOR_SET_ENTITY_TYPE_ROOT_ID,\n\tensureEntityTypeRootNode,\n\tisEntityTypeRootNodeId,\n\ttrackingTypeForRootId,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport type { LayoutTemplateNode } from \"document/models/CanvasTree/nodes/LayoutTemplateNode.ts\"\nimport {\n\tgetFolderNodeByName,\n\tisValidEntityParentNode,\n} from \"document/models/CanvasTree/nodes/utils/entityFolderNode.ts\"\nimport { createReferenceForNodeIfNeeded } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport { entityRootTypeIdForEntityNode } from \"document/models/CanvasTree/nodes/utils/entityTypeRootNode.ts\"\nimport type { StylePresetNode } from \"document/models/CanvasTree/nodes/utils/isStylePresetNode.ts\"\nimport { isEntityFolderNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { RichTextTag } from \"document/models/CanvasTree/traits/WithRichTextTag.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { createBlockquoteStylePreset } from \"utils/blockquoteStylePresetUtils.ts\"\nimport { createComponentPreset } from \"utils/componentPresetUtils.ts\"\nimport type { ComponentWithPreset } from \"utils/getComponentsWithPresets.ts\"\nimport { createImageStylePreset } from \"utils/imageStylePresetUtils.ts\"\nimport { createInlineCodeStylePreset } from \"utils/inlineCodeStylePresetUtils.ts\"\nimport { createLinkStylePreset } from \"utils/linkStylePresetUtils.ts\"\nimport { createTableStylePreset } from \"utils/tableStylePresetUtils.ts\"\nimport { createTextStylePreset } from \"utils/textStylePresetUtils.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { expandParentAndRenameEntity } from \"./rename.ts\"\n\nexport function createAndRenameFolderNode(engine: VekterEngine, parentId: NodeID, popout: boolean): void {\n\tif (isEntityTypeRootNodeId(parentId) && !engine.tree.has(parentId)) {\n\t\t// If the parent node does not exist, we create it on demand.\n\t\t// Realistically this is just for types introduced after the feature was\n\t\t// launched.\n\t\tensureEntityTypeRootNode(engine.tree, parentId)\n\t}\n\n\tconst parentNode = engine.tree.getNode(parentId)\n\tassert(parentNode && isValidEntityParentNode(parentNode), \"Invalid parent node\")\n\n\tconst name = getUniqueEntityFolderName(parentNode, Dictionary.Folder)\n\tconst newFolderId = engine.tree.insertNode(new EntityFolderNode({ name }), parentId).id\n\n\trecord(\"entity_folder_create\", {\n\t\tdepth: engine.tree.ancestors(newFolderId).filter(isEntityFolderNode).length,\n\t\tentityType: trackingTypeForRootId(entityRootTypeIdForEntityNode(parentNode)),\n\t})\n\n\tengine.scheduler.runAtEndOfFrame(() => expandParentAndRenameEntity(engine, parentId, newFolderId, popout))\n}\n\nfunction getUniqueEntityFolderName(parentNode: EntityFolderNode | EntityTypeRootNode, name: string): string {\n\tconst existingFolderNode = getFolderNodeByName(parentNode, name)\n\tif (!existingFolderNode) return name\n\n\tconst existingNames = new Set(parentNode.children.map(child => child.getName()))\n\treturn uniqueName(name, existingNames)\n}\n\ninterface CreateEntityReferenceBaseOptions {\n\trootType: EntityTypeRootId\n\t/** When parentId is not provided, the parent is assumed to be the root node. */\n\tparentId?: NodeID\n\tonDone?: (nodeId: NodeID) => void\n}\n\ntype CustomEntityTypeRootIds = typeof TEXT_ENTITY_ROOT_ID | typeof CMS_ENTITY_ROOT_ID | typeof COLOR_ENTITY_ROOT_ID\n\ninterface CreateEntityReferenceDefaultOptions extends CreateEntityReferenceBaseOptions {\n\trootType: Exclude<EntityTypeRootId, CustomEntityTypeRootIds>\n}\n\ninterface CreateEntityReferenceOptionsForTextStyle extends CreateEntityReferenceBaseOptions {\n\trootType: typeof TEXT_ENTITY_ROOT_ID\n\ttag: RichTextTag\n}\n\ninterface CreateEntityReferenceOptionsForColorStyle extends CreateEntityReferenceBaseOptions {\n\trootType: typeof COLOR_ENTITY_ROOT_ID\n\tpresent: VoidFunction\n\tonDone?: undefined\n}\n\ninterface CreateEntityReferenceOptionsForCms extends CreateEntityReferenceBaseOptions {\n\trootType: typeof CMS_ENTITY_ROOT_ID\n\tcmsOptions: { type: \"image\" } | { type: \"table\" } | { type: \"component\"; component: ComponentWithPreset }\n}\n\ntype CreateEntityReferenceOptions =\n\t| CreateEntityReferenceDefaultOptions\n\t| CreateEntityReferenceOptionsForTextStyle\n\t| CreateEntityReferenceOptionsForCms\n\t| CreateEntityReferenceOptionsForColorStyle\n\nexport function createEntityReferenceNodeForRootType(engine: VekterEngine, options: CreateEntityReferenceOptions) {\n\tconst { rootType, onDone } = options\n\t// When parentId is undefined we want to default to the root node\n\tconst parentId = options.parentId ?? rootType\n\n\tconst onCreate = (node: StylePresetNode | ComponentPresetNode | SmartComponentNode | LayoutTemplateNode) => {\n\t\tcreateReferenceForNodeIfNeeded(engine.tree, parentId, node.id, false)\n\t\tengine.scheduler.runAtEndOfFrame(() => onDone?.(node.id))\n\t}\n\n\tswitch (rootType) {\n\t\tcase BLOCKQUOTE_ENTITY_ROOT_ID:\n\t\t\treturn createBlockquoteStylePreset(engine, {\n\t\t\t\tonCreate,\n\t\t\t})\n\t\tcase LINK_ENTITY_ROOT_ID:\n\t\t\treturn createLinkStylePreset(engine, {\n\t\t\t\tonCreate,\n\t\t\t})\n\t\tcase TEXT_ENTITY_ROOT_ID:\n\t\t\treturn createTextStylePreset(engine, options.tag, {\n\t\t\t\tonCreate,\n\t\t\t})\n\t\tcase COLOR_ENTITY_ROOT_ID: {\n\t\t\t// options.present() displays the creation color popout. The creation\n\t\t\t// for the referenced color is handled by the `onChange` callback\n\t\t\t// passed to the popout component.\n\t\t\treturn options.present()\n\t\t}\n\t\tcase CMS_ENTITY_ROOT_ID: {\n\t\t\tswitch (options.cmsOptions.type) {\n\t\t\t\tcase \"image\":\n\t\t\t\t\treturn createImageStylePreset(engine, { onCreate })\n\t\t\t\tcase \"table\":\n\t\t\t\t\treturn createTableStylePreset(engine, { onCreate })\n\t\t\t\tcase \"component\":\n\t\t\t\t\treturn createComponentPreset(engine, options.cmsOptions.component, onCreate)\n\t\t\t\tdefault:\n\t\t\t\t\treturn assertNever(options.cmsOptions)\n\t\t\t}\n\t\t}\n\t\tcase INLINE_CODE_ENTITY_ROOT_ID:\n\t\t\treturn createInlineCodeStylePreset(engine, {\n\t\t\t\tonCreate,\n\t\t\t})\n\t\tcase CODE_FILE_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn ContextAction.createCodeComponent(engine, parentId)\n\t\tcase COMPONENTS_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn ContextAction.makeComponent(engine, \"components_panel\", parentId, node => onDone?.(node.id))\n\t\tcase VECTOR_SET_ENTITY_TYPE_ROOT_ID: {\n\t\t\tengine.stores.modalStore.set({\n\t\t\t\ttype: ModalType.VectorSetCreation,\n\t\t\t\tsource: \"assets_panel\",\n\t\t\t\tonConfirm: (name: string) => {\n\t\t\t\t\tconst vectorSet = ContextAction.createVectorSet(engine, name, true, parentId)\n\t\t\t\t\tengine.stores.modalStore.dismiss()\n\t\t\t\t\tonDone?.(vectorSet.id)\n\t\t\t\t},\n\t\t\t})\n\t\t\treturn\n\t\t}\n\t\tcase LAYOUT_TEMPLATE_ENTITY_ROOT_ID: {\n\t\t\tengine.stores.modalStore.push({\n\t\t\t\ttype: ModalType.CreateLayoutTemplate,\n\t\t\t\tsource: \"assets_panel\",\n\t\t\t\tonConfirm: (name: string) => {\n\t\t\t\t\tconst node = ContextAction.createLayoutTemplate(engine.tree, \"assets_panel\", name, undefined, parentId)\n\t\t\t\t\tengine.scheduler.runAtEndOfFrame(() => onDone?.(node.id))\n\t\t\t\t},\n\t\t\t})\n\n\t\t\treturn\n\t\t}\n\t\tcase CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID: {\n\t\t\tthrow new Error(\n\t\t\t\t\"Collection creation should be handled by CollectionPanel, not createEntityReferenceNodeForRootType\",\n\t\t\t)\n\t\t}\n\t\tcase FUNNELS_ENTITY_TYPE_ROOT_ID:\n\t\tcase AB_TESTS_ENTITY_TYPE_ROOT_ID:\n\t\t\tthrow new Error(\n\t\t\t\t`${rootType} creation should be handled by Analytics sidebar, not createEntityReferenceNodeForRootType`,\n\t\t\t)\n\t\tdefault:\n\t\t\tassertNever(rootType)\n\t}\n}\n", "import { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MetricsInteractionViews } from \"app/metrics.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CollectionItemNode, CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { CONTENT_MANAGEMENT_ID } from \"document/models/CanvasTree/nodes/ContentManagementNode.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport {\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisContentManagementNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { type Pages, record } from \"web/lib/tracker.ts\"\nimport { closeCollectionItems } from \"./closeCollectionItems.tsx\"\nimport { uniqueCollectionName } from \"./createSampleCollection.ts\"\n\ntype DuplicateCollectionMetricView =\n\t| MetricsInteractionViews.CONTEXT_MENU\n\t| MetricsInteractionViews.CMS\n\t| MetricsInteractionViews.QUICK_ACTIONS\n\t| Pages.collectionPanel\n\ntype CurrentVariableId = NodeID\ntype NewVariableId = NodeID\ntype RenamedVariableIds = Map<CurrentVariableId, NewVariableId>\n\nexport async function handleDuplicateCollection(\n\tengine: VekterEngine,\n\tcollectionId: NodeID,\n\tmetricView: DuplicateCollectionMetricView,\n): Promise<{ collectionNode: CollectionNode; renamedVariableIds: RenamedVariableIds } | null> {\n\tconst { userKeptEditing } = await closeCollectionItems({\n\t\tengine,\n\t\ttarget: \"all\",\n\t})\n\tif (userKeptEditing) return null\n\n\treturn engine.scheduler.processWhenReadyAsync(() => {\n\t\tconst collectionNode = engine.tree.get(collectionId)\n\t\tif (!collectionNode) return null\n\t\tassert(isCollectionNode(collectionNode), \"Expecting a Collection node\")\n\n\t\tconst currentVariableIds = collectionNode.variables.map(variable => variable.id)\n\t\tconst currentAndNewVariableIds: [CurrentVariableId, NewVariableId][] = currentVariableIds.map(currentVariableId => [\n\t\t\tcurrentVariableId,\n\t\t\trandomID(),\n\t\t])\n\t\tconst renamedVariableIds: RenamedVariableIds = new Map(currentAndNewVariableIds)\n\n\t\tconst variables = collectionNode.variables.map(existingVariable => {\n\t\t\tconst newId = renamedVariableIds.get(existingVariable.id)\n\t\t\tassert(newId, \"New id should exist\")\n\t\t\treturn { ...existingVariable, id: newId }\n\t\t})\n\n\t\tconst contentManagementNode = engine.tree.getNode(CONTENT_MANAGEMENT_ID)\n\t\tassert(isContentManagementNode(contentManagementNode), \"ContentManagementNode should exist\")\n\t\t// FIXME If CMS Node will ever become shallow this code needs to be checked/updated\n\t\tassert(contentManagementNode.isLoaded())\n\t\tconst newCollectionNodeName = uniqueCollectionName(\n\t\t\tcontentManagementNode,\n\t\t\tisString(collectionNode.name) ? collectionNode.name : Dictionary.Collection,\n\t\t)\n\n\t\tconst newCollectionNode = new CollectionNode({ name: newCollectionNodeName, variables })\n\n\t\trecord(\"collection_duplicate\", {\n\t\t\tsourceModuleId: collectionNode.instanceIdentifier,\n\t\t\tmoduleId: newCollectionNode.instanceIdentifier,\n\t\t\trecordCount: collectionNode.getItemCount(),\n\t\t\tsource: metricView,\n\t\t})\n\n\t\tcollectionNode.getUnsortedChildren().forEach(existingCollectionItem => {\n\t\t\tassert(isCollectionItemNode(existingCollectionItem), \"Expects collection item node children\")\n\t\t\tconst newCollectionItemNode = CollectionItemNode.create(\n\t\t\t\texistingCollectionItem.isDraft ? { isDraft: true } : undefined,\n\t\t\t)\n\n\t\t\tcollectionNode.variables.forEach(existingVariable => {\n\t\t\t\tconst newId = renamedVariableIds.get(existingVariable.id)\n\t\t\t\tassert(newId, \"New id should exist\")\n\t\t\t\tconst controlProp = existingCollectionItem.getControlProp(existingVariable.id)\n\t\t\t\tif (!controlProp) return\n\t\t\t\tnewCollectionItemNode.setControlProp(newId, controlProp)\n\t\t\t})\n\n\t\t\tnewCollectionNode.addChild(newCollectionItemNode)\n\t\t})\n\n\t\tengine.stores.scopeStore.insertNode(newCollectionNode, contentManagementNode.id)\n\t\tengine.stores.selectionStore.set(newCollectionNode.id)\n\n\t\treturn { collectionNode: newCollectionNode, renamedVariableIds }\n\t})\n}\n", "import { unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { type MenuItemOptions, withEnabledCheck } from \"app/menu.ts\"\nimport type { MetricsInteractionViews } from \"app/metrics.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport { CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { createReferenceAlways } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { Clipboard } from \"utils/clipboard/document.ts\"\nimport { type Pages, record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { QuickActionsCategoryType } from \"../../QuickActions/types.ts\"\nimport { createAndRenameFolderNode } from \"../../assets/actions/create.ts\"\nimport { expandParentAndRenameEntity } from \"../../assets/actions/rename.ts\"\nimport { closeCollectionItems } from \"./closeCollectionItems.tsx\"\nimport { createCollection } from \"./createCollection.ts\"\nimport { handleDuplicateCollection } from \"./handleDuplicateCollection.ts\"\n\nasync function canCreateNewCollection(engine: VekterEngine) {\n\tconst { userKeptEditing } = await closeCollectionItems({\n\t\tengine,\n\t\ttarget: \"all\",\n\t})\n\n\treturn !userKeptEditing\n}\n\ntype CollectionCreationOptionsPage =\n\t| MetricsInteractionViews.CMS\n\t| MetricsInteractionViews.CONTEXT_MENU\n\t| MetricsInteractionViews.QUICK_ACTIONS\n\t| Pages.collectionPanel\n\ninterface CollectionCreationOptions {\n\tincludeCSV?: boolean\n\tcanPaste?: boolean\n\tcollectionIdToDuplicate?: string\n}\n\nexport function addNewCollection(\n\tengine: VekterEngine,\n\tpage: CollectionCreationOptionsPage,\n\tid: \"create_blank_collection\" | \"import_to_new_collection\",\n): CollectionNode | undefined {\n\tconst collection = createCollection(engine, \"collection_panel\")\n\tif (!collection) return\n\tcreateReferenceAlways(engine.tree, CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID, collection.id)\n\tengine.scheduler.runAtEndOfFrame(() =>\n\t\texpandParentAndRenameEntity(engine, CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID, collection.id, false),\n\t)\n\trecord(\"ui_interaction\", { id, page })\n\treturn collection\n}\n\nexport function getCollectionCreationOptions(\n\tengine: VekterEngine,\n\tpage: CollectionCreationOptionsPage,\n\t{ includeCSV = true, canPaste = true, collectionIdToDuplicate }: CollectionCreationOptions = {},\n): MenuItemOptions[] {\n\tconst isViewOnly = getIsViewOnly(engine, \"canAddCollections\")\n\tconst isPreviewingLocaleOnCanvas = engine.stores.chromeStore.isPreviewingLocaleOnCanvas\n\n\tconst enabled = !isViewOnly && !isPreviewingLocaleOnCanvas\n\n\treturn [\n\t\t{\n\t\t\tlabel: \"Add Collection\",\n\t\t\trole: \"newCollection\",\n\t\t\tenabled,\n\t\t\tclick: async () => {\n\t\t\t\tif (!(await canCreateNewCollection(engine))) return\n\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\taddNewCollection(engine, page, \"create_blank_collection\")\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t\t{ type: \"separator\" },\n\t\t{\n\t\t\tlabel: Dictionary.ImportCollection,\n\t\t\trole: \"importCollection\",\n\t\t\tenabled,\n\t\t\tvisible: includeCSV,\n\t\t\tclick: () => {\n\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\ttype: ModalType.QuickActions,\n\t\t\t\t\tinitialCategory: { type: QuickActionsCategoryType.Plugins },\n\t\t\t\t\tsource: \"toolbar\",\n\t\t\t\t\tinitialPluginState: {\n\t\t\t\t\t\tmode: \"collection\",\n\t\t\t\t\t\tintent: \"collection/add\",\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.PasteCollection,\n\t\t\trole: \"pasteCollection\",\n\t\t\tenabled:\n\t\t\t\t!isViewOnly &&\n\t\t\t\tcanPaste &&\n\t\t\t\tengine.stores.loadingStore.hasMinimalEditableData &&\n\t\t\t\tengine.stores.loadingStore.allModulesLoadedAndEvaluated,\n\t\t\tclick: () => {\n\t\t\t\tClipboard.pasteCollections(engine).catch(unhandledError)\n\t\t\t},\n\t\t},\n\t\twithEnabledCheck({\n\t\t\tlabel: \"Duplicate Collection\",\n\t\t\trole: \"duplicateCollection\",\n\t\t\tenabled: () => !isViewOnly,\n\t\t\tvisible: !!collectionIdToDuplicate,\n\t\t\tclick: () => {\n\t\t\t\tif (!collectionIdToDuplicate) return\n\t\t\t\thandleDuplicateCollection(engine, collectionIdToDuplicate, page).catch(unhandledError)\n\t\t\t},\n\t\t}),\n\t\t{ type: \"separator\" },\n\t\t{\n\t\t\tlabel: Dictionary.AddCollectionFolder,\n\t\t\trole: \"newCollectionFolder\",\n\t\t\tenabled: !isViewOnly,\n\t\t\tclick: () => {\n\t\t\t\tcreateAndRenameFolderNode(engine, CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID, false)\n\t\t\t},\n\t\t},\n\t]\n}\n", "import { IconComponent } from \"@framerjs/fresco\"\nimport type { GlobalModuleId } from \"@framerjs/shared\"\nimport { ModuleType, asLocalId, parseModuleIdentifier, unhandledError } from \"@framerjs/shared\"\nimport type { ExternalModulesListNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport type { DynamicModuleInfo } from \"document/stores/ModulesStore.ts\"\nimport { useMemo } from \"react\"\nimport { isFunction } from \"utils/typeChecks.ts\"\nimport type { ListItemGroup } from \"../chrome/assets/types.ts\"\nimport { sortComponents } from \"./componentHelpers.ts\"\nimport { searchListItems } from \"./searchListItems.ts\"\n\nexport function getExternalModuleComponentGroups({\n\texternalModulesListNode,\n\texternalModules,\n\ttitleFormatter,\n\tsearchTerm = \"\",\n}: {\n\texternalModulesListNode: ExternalModulesListNode | null\n\texternalModules: ReadonlyMap<GlobalModuleId, DynamicModuleInfo>\n\ttitleFormatter?: (value: string) => string\n\tsearchTerm?: string\n}): ListItemGroup[] {\n\tif (!externalModulesListNode?.children?.length) {\n\t\tconst noExternalGroupPlaceholder: ListItemGroup = {\n\t\t\ttitle: \"Other\",\n\t\t\titems: [],\n\t\t}\n\t\treturn [noExternalGroupPlaceholder]\n\t}\n\n\tconst folders: Map<string, ListItemGroup> = new Map()\n\n\tfor (const node of externalModulesListNode.children) {\n\t\tif (node.type !== ModuleType.Canvas && node.type !== ModuleType.Code) {\n\t\t\tcontinue\n\t\t}\n\n\t\tconst folderId = node.group?.id ?? \"Other\"\n\t\tconst folderName = node.group?.name ?? \"Other\"\n\n\t\tconst folder = folders.get(folderId) ?? {\n\t\t\ttitle: isFunction(titleFormatter) ? titleFormatter(folderName) : folderName,\n\t\t\titems: [],\n\t\t}\n\n\t\tfolders.set(folderId, folder)\n\n\t\tconst parsedId = parseModuleIdentifier(node.codeComponentIdentifier)\n\n\t\tif (parsedId?.kind !== \"externalModuleExport\") {\n\t\t\tunhandledError(new Error(\"expected externalModuleNode identifier to be of kind externalModuleExports\"))\n\t\t\tcontinue\n\t\t}\n\n\t\tconst externalModule = externalModules.get(parsedId.moduleId)\n\t\t// If the external module is only known from the tree and not the module system, then we\n\t\t// cannot know the local id. Ideally we would refactor the types to reflect that as\n\t\t// possibility. But for now we just provide an empty string as id.\n\t\tconst localId = asLocalId(externalModule?.localId ?? \"\")\n\t\tconst updateSaveId = externalModule?.status?.updateSaveId\n\t\tconst description = externalModule?.description ?? \"From Another Project\"\n\n\t\tfolder.items.push({\n\t\t\tid: `externalModuleComponent_${node.codeComponentIdentifier}`,\n\t\t\tlocalId,\n\t\t\tcodeComponentIdentifier: node.codeComponentIdentifier,\n\t\t\tname: node.title,\n\t\t\ttype: \"externalModuleComponent\",\n\t\t\tIcon: IconComponent,\n\t\t\tdescription,\n\t\t\tintrinsicWidth: node.intrinsicWidth,\n\t\t\tintrinsicHeight: node.intrinsicHeight,\n\t\t\townerType: node.ownerType,\n\t\t\townerId: node.ownerId,\n\t\t\tfolderName,\n\t\t\tmoduleType: node.type,\n\t\t\tscopeNodeId: node.scopeNodeId,\n\t\t\thasUpdate: Boolean(updateSaveId && updateSaveId !== parsedId.saveId),\n\t\t})\n\t}\n\n\tconst foldersList = [...folders.values()]\n\n\t// Sort items in folders alphabetically.\n\tfor (const folder of foldersList) {\n\t\tfolder.items = searchListItems(sortComponents(folder.items), searchTerm)\n\t}\n\n\t// Sort folders alphabetically.\n\tconst trimmedTitleCache = new Map<string, string>()\n\tfoldersList.sort((a, b) => {\n\t\tconst titleA = getTrimmedTitle(a.title, trimmedTitleCache)\n\t\tconst titleB = getTrimmedTitle(b.title, trimmedTitleCache)\n\t\treturn titleA.localeCompare(titleB, undefined, { numeric: true })\n\t})\n\n\treturn foldersList\n}\n\nfunction getTrimmedTitle(title: string, trimmedTitleCache: Map<string, string>) {\n\tconst cached = trimmedTitleCache.get(title)\n\tif (cached) return cached\n\n\tconst trimmedTitle = title.trim()\n\ttrimmedTitleCache.set(title, trimmedTitle)\n\treturn trimmedTitle\n}\n\n/**\n * Hook to get ExternalModuleNodes Grouped as ListItemGroups\n * from the externalModulesListNode\n */\nexport function useExternalModuleComponentsGrouped({\n\texternalModulesListNode,\n\texternalModules,\n\ttitleFormatter,\n\tsearchTerm,\n}: {\n\texternalModulesListNode: ExternalModulesListNode | null\n\texternalModules: ReadonlyMap<GlobalModuleId, DynamicModuleInfo>\n\ttitleFormatter?: (value: string) => string\n\tsearchTerm?: string\n}): ListItemGroup[] {\n\treturn useMemo(\n\t\t() =>\n\t\t\tgetExternalModuleComponentGroups({\n\t\t\t\texternalModulesListNode,\n\t\t\t\texternalModules,\n\t\t\t\ttitleFormatter,\n\t\t\t\tsearchTerm,\n\t\t\t}),\n\t\t[externalModulesListNode, externalModules, titleFormatter, searchTerm],\n\t)\n}\n", "import type { ListItem } from \"../chrome/assets/types.ts\"\n\nfunction shouldSearchListItems(search: string) {\n\treturn search.trim().length > 0\n}\n\nfunction searchItems<T>(items: T[], buildSearchString: (item: T) => string, searchQuery: string) {\n\tconst searchQueries = searchQuery\n\t\t.trim()\n\t\t.split(/\\s+/u)\n\t\t.map(n => n.toLowerCase())\n\treturn items.filter(item => {\n\t\tconst searchString = buildSearchString(item).toLowerCase()\n\t\treturn searchQueries.every(query => searchString.includes(query))\n\t})\n}\n\nexport function searchListItems<T extends ListItem>(listItems: T[], search: string): T[] {\n\tif (!shouldSearchListItems(search)) return listItems\n\n\t// Exclude teaser list items from search\n\tconst items = listItems.filter(item => !item.description?.includes(\"Soon\"))\n\treturn searchItems<T>(\n\t\titems,\n\t\ti =>\n\t\t\t[i.name, i.description]\n\t\t\t\t.flat()\n\t\t\t\t.filter(v => !!v)\n\t\t\t\t.join(\" \"),\n\t\tsearch,\n\t)\n}\n", "import { apiFetcher } from \"./apiFetcher.ts\"\n\ntype CheckProjectAccessResponse =\n\t| {\n\t\t\thasAccess: true\n\t  }\n\t| {\n\t\t\thasAccess: false\n\t\t\tcanRequestAccess: boolean\n\t  }\n\nexport async function checkProjectAccess(projectId: string): Promise<CheckProjectAccessResponse> {\n\treturn apiFetcher.get(`/web/projects/${projectId}/acl/request-access`)\n}\n", "import { openNewTab } from \"@framerjs/app-shared\"\nimport type { LocalModuleId } from \"@framerjs/shared\"\nimport { ModuleType } from \"@framerjs/shared\"\nimport { setViewParamsInURL } from \"utils/urlParams.ts\"\nimport { checkProjectAccess } from \"web/lib/checkProjectAccess.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport type { ExternalModuleNode } from \"../ExternalModuleNode.ts\"\n\nexport function getExternalModuleSourceProjectURL(\n\texternalModuleNodeLike: Partial<ExternalModuleNode>,\n\tlocalId: LocalModuleId | undefined,\n): URL | undefined {\n\tif (externalModuleNodeLike.ownerType !== \"project\" || !externalModuleNodeLike.ownerId) return\n\n\tconst projectId = externalModuleNodeLike.ownerId\n\tconst sourceProjectURL = new URL(`/projects/${projectId}`, window.location.href)\n\tif (externalModuleNodeLike.scopeNodeId) {\n\t\t// Link straight to the component isolation for smart components.\n\t\tsetViewParamsInURL(sourceProjectURL, { nodeId: externalModuleNodeLike.scopeNodeId })\n\t}\n\n\tif (externalModuleNodeLike.type === ModuleType.Code) {\n\t\t// Link straight to the code file for code modules\n\t\tsourceProjectURL.searchParams.set(\"view\", `code:${localId}`)\n\t}\n\n\treturn sourceProjectURL\n}\n\n/**\n * Checks project access and shows appropriate error toasts if access is denied or if the check fails.\n */\nexport async function openExternalModuleWithAccessCheck(sourceProjectURL: URL, projectId: string): Promise<void> {\n\ttry {\n\t\tconst accessResult = await checkProjectAccess(projectId)\n\n\t\tif (accessResult.hasAccess || accessResult.canRequestAccess) {\n\t\t\topenNewTab(sourceProjectURL.href)\n\t\t} else {\n\t\t\ttoast({\n\t\t\t\ttype: \"add\",\n\t\t\t\tvariant: \"error\",\n\t\t\t\tprimaryText: \"You don\u2019t have access\",\n\t\t\t\tsecondaryText: \"to this component.\",\n\t\t\t\tduration: 3000,\n\t\t\t})\n\t\t}\n\t} catch {\n\t\ttoast({\n\t\t\ttype: \"add\",\n\t\t\tvariant: \"error\",\n\t\t\tprimaryText: \"Unable to check access\",\n\t\t\tsecondaryText: \"to this component.\",\n\t\t\tduration: 3000,\n\t\t})\n\t}\n}\n", "import type { CanvasTree } from \"../CanvasTree.ts\"\nimport type FrameNode from \"../nodes/FrameNode.ts\"\nimport { isComputedValue } from \"../traits/ComputedValue.ts\"\nimport { isVariableReference } from \"../traits/VariableReference.ts\"\nimport { findTokenNode } from \"./findTokenNode.ts\"\nimport { fallbackValueFromCSSVariable, isTokenCSSVariable, tokenIdFromCSSVariable } from \"./tokens.ts\"\n\nexport function getFrameFillColor(tree: CanvasTree, node: FrameNode): null | string {\n\tif (node.fillType !== \"color\") return null\n\tif (isTokenCSSVariable(node.fillColor)) {\n\t\tconst tokenId = tokenIdFromCSSVariable(node.fillColor)\n\t\tconst token = tokenId ? findTokenNode(tokenId, tree) : null\n\t\tif (token) return node.fillColor\n\t\treturn fallbackValueFromCSSVariable(node.fillColor)\n\t}\n\tif (isVariableReference(node.fillColor) || isComputedValue(node.fillColor)) {\n\t\treturn null\n\t}\n\treturn node.fillColor\n}\n", "import { isReactComponentDefinition } from \"@framerjs/framer-runtime\"\nimport { AnnotationKey, type Annotations, type ParsedAnnotations } from \"@framerjs/framer-runtime/crossorigin\"\nimport { Stack } from \"@framerjs/fresco\"\nimport type { DraggableEvent } from \"@framerjs/fresco/layout-transitions\"\nimport { Draggable, useDroppable } from \"@framerjs/fresco/layout-transitions\"\nimport {\n\tassert,\n\ttype ModuleExportIdentifierString,\n\tModuleType,\n\tassertNever,\n\tlocalModuleIdentifierForStableName,\n} from \"@framerjs/shared\"\nimport { cx } from \"@linaria/core\"\nimport { experiments, useExperimentIsOn } from \"app/experiments.ts\"\nimport { isFramerVectorSetInfo, parseIntrinsicSizeFromAnnotations } from \"code-generation/utils/annotations.ts\"\nimport { EngineContext } from \"document/base-engine/BaseEngine.ts\"\nimport {\n\ttype DraggableCodeFileData,\n\tDraggableCodeFileType,\n\ttype DraggableComponentData,\n\tDraggableComponentDataType,\n\tDraggableComponentsDataType,\n} from \"document/components/canvas/CanvasDropZone.tsx\"\nimport { codeComponentFromDefinition } from \"document/components/utils/componentHelpers.ts\"\nimport engine from \"document/engine.ts\"\nimport { type CanvasTree, CodeComponentNode } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tCODE_FILE_ENTITY_TYPE_ROOT_ID,\n\ttype EntityTypeRootId,\n\tVECTOR_SET_ENTITY_TYPE_ROOT_ID,\n\tisEntityTypeRootNodeId,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isNodeId } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { buildReferenceNodeId } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport { isExternalModuleNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { ModulesStore } from \"document/stores/ModulesStore.ts\"\nimport { useEngineCallback } from \"document/useEngineCallback.ts\"\nimport { ActiveMainView } from \"document/utils/ActiveEditorType.ts\"\nimport { DimensionType } from \"library/index.ts\"\nimport { isEqual } from \"library/render/utils/isEqual.ts\"\nimport React, { useEffect } from \"react\"\nimport { isNull, isString, isUndefined } from \"utils/typeChecks.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport type { EntityDefinition } from \"../../../../../../runtime/src/host/index.ts\"\nimport { CollapsibleRow } from \"../shared/CollapsibleRow.tsx\"\nimport { InsertionIndicator } from \"../shared/InsertionIndicator.tsx\"\nimport { dragExpandTime } from \"../shared/utils/dragExpandTime.ts\"\nimport { type DragAndDropPosition, calculateInsertionIndex, calculateOffset } from \"../shared/utils/panelDragDrop.ts\"\nimport * as styles from \"./DraggableEntityItem.styles.ts\"\nimport { moveEntityNode } from \"./actions/move.ts\"\nimport { referenceUnreferencedNodesByTypeRoot } from \"./actions/utils.ts\"\nimport { getAssetTypePluralName, getIconForAssetType } from \"./utils/assetTypeHelpers.tsx\"\nimport type { ModuleInfo } from \"./utils/getExportedModulesMap.ts\"\nimport { getModulesMap } from \"./utils/getExportedModulesMap.ts\"\nimport { getAssetSectionForTracking, getReferenceNodeIdFromSelectedId, hasAnyFolders } from \"./utils/multiselect.ts\"\n\nconst defaultIndicatorLeftOffset = 32\n\ninterface DragoverEntityItem {\n\tinsertParentId: NodeID\n\tinsertOffset: number\n\tindicatorPosition: \"top\" | \"bottom\" | null\n}\n\ninterface Props {\n\titemId: NodeID\n\tdepth: number\n\tisFolder: boolean\n\tisCodeFileFolder?: boolean\n\tisViewOnly: boolean\n\tindicatorLeftOffset?: number\n\tisCollapsed?: boolean\n\ttypeRootId: EntityTypeRootId\n\thasAnyNonReferencedNodeSibling: boolean\n\tentityModules?: readonly ModuleInfo[]\n\tisSortable?: boolean\n\tpopout: boolean\n\tcolor?: string\n\tinteractionBorderColor?: string\n\tselectedIds?: ReadonlySet<NodeID>\n\tclassName?: string\n\tchildren: (info: { isDragPreview: boolean; isDraggedOver: boolean }) => React.ReactNode\n\tgetOrderedIds?: (selectedIds: ReadonlySet<NodeID>) => NodeID[]\n}\n\nexport const DraggableAssetRow = React.memo(function DraggableAssetRow({\n\titemId,\n\ttypeRootId,\n\tdepth,\n\tisFolder,\n\tindicatorLeftOffset = defaultIndicatorLeftOffset,\n\tisViewOnly,\n\tisCollapsed,\n\thasAnyNonReferencedNodeSibling,\n\tentityModules,\n\tchildren,\n\tcolor,\n\tisCodeFileFolder,\n\tisSortable = true,\n\tpopout,\n\tselectedIds,\n\tclassName,\n\tgetOrderedIds,\n\tinteractionBorderColor,\n}: Props) {\n\tconst [dragoverItem, setDragoverItem] = React.useState<DragoverEntityItem | undefined>(undefined)\n\n\t// Code file folders are only displayed as folders in the UI, but they are still references.\n\tconst referenceId = isFolder && !isCodeFileFolder ? itemId : buildReferenceNodeId(typeRootId, itemId)\n\tconst isEntityTypeRootNode = isFolder && isEntityTypeRootNodeId(itemId)\n\n\tconst isDraggedOver = (isFolder || isEntityTypeRootNode) && dragoverItem?.insertOffset === -1\n\tconst isMultiSelection = selectedIds && selectedIds.size > 1 && selectedIds.has(itemId)\n\n\tconst handleDragStart = useEngineCallback(\n\t\t(event: DraggableEvent) => {\n\t\t\t// Handle component data for canvas drops\n\t\t\tif (isMultiSelection) {\n\t\t\t\tconst componentsData: DraggableComponentData[] = []\n\t\t\t\tconst modulesMap = getModulesMap(engine.componentLoader)\n\n\t\t\t\tfor (const selectedId of selectedIds) {\n\t\t\t\t\tconst componentData = getComponentDataForSelectedId(selectedId, typeRootId, modulesMap)\n\t\t\t\t\tif (componentData) {\n\t\t\t\t\t\tcomponentsData.push(componentData)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (componentsData.length > 0) {\n\t\t\t\t\tevent.dataTransfer.setData(DraggableComponentsDataType, componentsData)\n\t\t\t\t}\n\n\t\t\t\tconst entityItemsData: EntityItemsData = {\n\t\t\t\t\t// Sort items by their visual order if order function is provided\n\t\t\t\t\titemIds: getOrderedIds ? getOrderedIds(selectedIds) : Array.from(selectedIds), // Fallback to unsorted array if ordered getter is not provided\n\t\t\t\t\ttypeRootId,\n\t\t\t\t}\n\t\t\t\tevent.dataTransfer.setData(ENTITY_ITEMS_DATA_TYPE, entityItemsData)\n\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (typeRootId === VECTOR_SET_ENTITY_TYPE_ROOT_ID && !isFolder) {\n\t\t\t\tconst data = dataForLocalVectorSet(engine.stores.modulesStore, itemId)\n\t\t\t\tif (!data) return\n\t\t\t\tevent.dataTransfer.setData(DraggableComponentDataType, data)\n\t\t\t}\n\n\t\t\tif (entityModules && engine.stores.chromeStore.mainView === ActiveMainView.Canvas) {\n\t\t\t\tif (entityModules.length === 1) {\n\t\t\t\t\tconst entityModule = entityModules[0]\n\t\t\t\t\tassert(!isUndefined(entityModule), \"entityModule should not be undefined\")\n\n\t\t\t\t\tconst data = createComponentDataFromModule(entityModule, typeRootId)\n\t\t\t\t\tif (data) {\n\t\t\t\t\t\tevent.dataTransfer.setData(DraggableComponentDataType, data)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tconst componentDefinitions: EntityDefinition[] = []\n\t\t\t\t\tfor (const module of entityModules) {\n\t\t\t\t\t\tconst component = engine.componentLoader.componentForIdentifier(module.moduleIdentifier)\n\t\t\t\t\t\tif (isNull(component)) continue\n\t\t\t\t\t\tcomponentDefinitions.push(component)\n\t\t\t\t\t}\n\n\t\t\t\t\tconst data: DraggableCodeFileData = {\n\t\t\t\t\t\tcomponentDefinitions,\n\t\t\t\t\t\tsource: getModuleSourceForTypeRoot(typeRootId),\n\t\t\t\t\t}\n\t\t\t\t\tevent.dataTransfer.setData(DraggableCodeFileType, data)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!isSortable) return\n\n\t\t\tconst entityItemsData: EntityItemsData = {\n\t\t\t\titemIds: [itemId],\n\t\t\t\ttypeRootId,\n\t\t\t}\n\t\t\tevent.dataTransfer.setData(ENTITY_ITEMS_DATA_TYPE, entityItemsData)\n\n\t\t\tif (isFolder) engine.stores.chromeStore.collapseAssetEntityItem(referenceId, popout)\n\t\t},\n\t\t[\n\t\t\tisSortable,\n\t\t\treferenceId,\n\t\t\titemId,\n\t\t\ttypeRootId,\n\t\t\tisFolder,\n\t\t\tentityModules,\n\t\t\tpopout,\n\t\t\tisMultiSelection,\n\t\t\tselectedIds,\n\t\t\tgetOrderedIds,\n\t\t],\n\t)\n\n\tconst handleDragLeave = () => {\n\t\tsetDragoverItem(undefined)\n\t}\n\n\tconst handleDragOver = useEngineCallback(\n\t\t(event: DraggableEvent, position: DragAndDropPosition) => {\n\t\t\tconst entityItemsData = event.dataTransfer.getData(ENTITY_ITEMS_DATA_TYPE) as EntityItemsData | undefined\n\n\t\t\tif (!entityItemsData) return\n\n\t\t\t// Check if dragging within the same type root\n\t\t\tif (entityItemsData.typeRootId !== typeRootId) return\n\n\t\t\t// Don't allow dropping on one of the dragged items themselves\n\t\t\tif (entityItemsData.itemIds.includes(itemId)) return\n\n\t\t\tconst targetItemParentId = engine.tree.get(referenceId)?.parentid ?? typeRootId\n\n\t\t\tif (isEntityTypeRootNode) {\n\t\t\t\tif (!isNodeId(targetItemParentId)) return\n\t\t\t\tsetDragoverItem(\n\t\t\t\t\tupdateDragoverItemIfNeeded({\n\t\t\t\t\t\tinsertParentId: targetItemParentId,\n\t\t\t\t\t\tinsertOffset: 1,\n\t\t\t\t\t\tindicatorPosition: \"bottom\",\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (position === \"middle\") {\n\t\t\t\tsetDragoverItem(\n\t\t\t\t\tupdateDragoverItemIfNeeded({\n\t\t\t\t\t\tinsertParentId: referenceId,\n\t\t\t\t\t\tinsertOffset: -1,\n\t\t\t\t\t\tindicatorPosition: null,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif (position !== \"top\" && position !== \"bottom\") assertNever(position)\n\n\t\t\tconst parentItem = engine.tree.get(targetItemParentId)\n\t\t\tif (!parentItem || !parentItem.children) return\n\n\t\t\t// If the dragged over item is a folder and it is expanded, we want to insert it into the folder\n\t\t\t// instead of after it.\n\t\t\tconst isOpenedFolder = isFolder && !isCollapsed && position === \"bottom\"\n\n\t\t\tconst insertOffset = isOpenedFolder ? -1 : calculateOffset(position)\n\n\t\t\tsetDragoverItem(\n\t\t\t\tupdateDragoverItemIfNeeded({\n\t\t\t\t\tinsertParentId: isOpenedFolder ? referenceId : parentItem.id,\n\t\t\t\t\tinsertOffset,\n\t\t\t\t\tindicatorPosition: isOpenedFolder ? null : position,\n\t\t\t\t}),\n\t\t\t)\n\t\t},\n\t\t[isEntityTypeRootNode, typeRootId, isFolder, isCollapsed, referenceId, itemId],\n\t)\n\n\tconst handleDrop = useEngineCallback(\n\t\t(event: DraggableEvent) => {\n\t\t\tconst entityItemsData = event.dataTransfer.getData(ENTITY_ITEMS_DATA_TYPE) as EntityItemsData | undefined\n\n\t\t\tif (!dragoverItem || !entityItemsData) return\n\n\t\t\tconst { insertParentId, insertOffset } = dragoverItem\n\n\t\t\tif (isCollapsed) engine.stores.chromeStore.expandAssetEntityItem(insertParentId, popout)\n\n\t\t\tif (hasAnyNonReferencedNodeSibling) referenceUnreferencedNodesByTypeRoot(engine, typeRootId)\n\n\t\t\tconst insertionIndex = calculateInsertionIndex(insertOffset, insertParentId, referenceId)\n\t\t\tif (isNull(insertionIndex)) return\n\n\t\t\t// Process items in reverse order to avoid index shifting issues\n\t\t\t// This matches the approach used in usePagesDragDrop.tsx\n\t\t\t// TODO: when the reordering fix is done for pages and layers, we need to add the same fix here\n\t\t\tfor (let i = entityItemsData.itemIds.length - 1; i >= 0; i--) {\n\t\t\t\tconst draggedItemId = entityItemsData.itemIds[i]\n\t\t\t\tif (!draggedItemId) continue\n\n\t\t\t\tconst entityId = getReferenceNodeIdFromSelectedId(draggedItemId, typeRootId)\n\t\t\t\tif (!entityId || entityId === insertParentId) continue\n\n\t\t\t\tconst parentNode = engine.tree.get(insertParentId)\n\t\t\t\tif (!parentNode || !parentNode.children) continue\n\n\t\t\t\tlet localInsertionIndex = insertionIndex\n\t\t\t\tconst currentIndex = parentNode.children.findIndex(child => child.id === entityId)\n\t\t\t\tif (currentIndex !== -1 && currentIndex < insertionIndex) {\n\t\t\t\t\tlocalInsertionIndex -= 1\n\t\t\t\t}\n\n\t\t\t\tvoid moveEntityNode(engine, {\n\t\t\t\t\tentityId,\n\t\t\t\t\tnewParentId: insertParentId,\n\t\t\t\t\ttypeRootId,\n\t\t\t\t\tpositionInParent: localInsertionIndex,\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (entityItemsData.itemIds.length > 1) {\n\t\t\t\trecord(\"asset_bulk_move_section\", {\n\t\t\t\t\tsource: getAssetSectionForTracking(typeRootId),\n\t\t\t\t\tcount: entityItemsData.itemIds.length,\n\t\t\t\t})\n\t\t\t}\n\t\t},\n\t\t[dragoverItem, referenceId, typeRootId, hasAnyNonReferencedNodeSibling, isCollapsed, popout],\n\t)\n\n\tuseEffect(() => {\n\t\t// This will auto expand the folder if the user is dragging over it.\n\t\tif (!dragoverItem || !isFolder) return\n\t\tif (dragoverItem.insertParentId !== referenceId) return\n\t\tconst timeout = setTimeout(\n\t\t\t() => engine.stores.chromeStore.expandAssetEntityItem(referenceId, popout),\n\t\t\tdragExpandTime,\n\t\t)\n\t\treturn () => clearTimeout(timeout)\n\t}, [dragoverItem, referenceId, isFolder, popout])\n\n\tconst commonRefProps = {\n\t\tdataTypes: [ENTITY_ITEMS_DATA_TYPE],\n\t\tonDrop: handleDrop,\n\t\tonDragLeave: handleDragLeave,\n\t\tenabled: !isViewOnly,\n\t}\n\n\tconst topDroppableRef = useDroppable({\n\t\t...commonRefProps,\n\t\tonDragOver: (event: DraggableEvent) => handleDragOver(event, \"top\"),\n\t})\n\n\tconst midDroppableRef = useDroppable({\n\t\t...commonRefProps,\n\t\tonDragOver: (event: DraggableEvent) => handleDragOver(event, \"middle\"),\n\t})\n\n\tconst bottomDroppableRef = useDroppable({\n\t\t...commonRefProps,\n\t\tonDragOver: (event: DraggableEvent) => handleDragOver(event, \"bottom\"),\n\t})\n\n\treturn (\n\t\t<div className={cx(styles.container, className)}>\n\t\t\t<Draggable onDragStart={handleDragStart} hideDragSource={false}>\n\t\t\t\t{({ isDragPreview }) => {\n\t\t\t\t\tif (isDragPreview && isMultiSelection) {\n\t\t\t\t\t\treturn <MultiSelectionDragPreview typeRootId={typeRootId} selectedIds={selectedIds} />\n\t\t\t\t\t}\n\n\t\t\t\t\treturn (\n\t\t\t\t\t\t<EngineContext.Provider value={engine}>{children({ isDragPreview, isDraggedOver })}</EngineContext.Provider>\n\t\t\t\t\t)\n\t\t\t\t}}\n\t\t\t</Draggable>\n\n\t\t\t<Stack direction=\"column\" gap={0} className={styles.dropTargetContainer}>\n\t\t\t\t<div ref={topDroppableRef} className={styles.dropTarget} />\n\t\t\t\t<div ref={midDroppableRef} className={styles.dropTarget} />\n\t\t\t\t<div ref={bottomDroppableRef} className={styles.dropTarget} />\n\t\t\t</Stack>\n\n\t\t\t{!isEntityTypeRootNode && dragoverItem && isString(dragoverItem.indicatorPosition) && (\n\t\t\t\t<InsertionIndicator\n\t\t\t\t\tleftOffset={indicatorLeftOffset}\n\t\t\t\t\tdepth={depth}\n\t\t\t\t\tposition={dragoverItem.indicatorPosition}\n\t\t\t\t\tcolor={interactionBorderColor ?? color}\n\t\t\t\t/>\n\t\t\t)}\n\t\t</div>\n\t)\n})\n\nconst ENTITY_ITEMS_DATA_TYPE = \"entity-items\"\n\ninterface EntityItemsData {\n\titemIds: NodeID[]\n\ttypeRootId: EntityTypeRootId\n}\n\nfunction updateDragoverItemIfNeeded(newDragoverItem: DragoverEntityItem) {\n\treturn (oldDragoverItem: DragoverEntityItem | undefined) => {\n\t\tif (isEqual(oldDragoverItem, newDragoverItem)) return oldDragoverItem\n\t\treturn newDragoverItem\n\t}\n}\n\nfunction dataForVectorInfo(\n\tidentifier: ModuleExportIdentifierString,\n\tannotations: Annotations | ParsedAnnotations | undefined,\n): DraggableComponentData {\n\tconst size = annotations ? parseIntrinsicSizeFromAnnotations(annotations) : undefined\n\n\treturn {\n\t\tcomponent: new CodeComponentNode({\n\t\t\twidth: size?.width ?? undefined,\n\t\t\theight: size?.height ?? undefined,\n\t\t\theightType: DimensionType.FixedNumber,\n\t\t\twidthType: DimensionType.FixedNumber,\n\t\t\tcodeComponentIdentifier: identifier,\n\t\t\tslotsAreChildNodes: experiments.isOn(\"componentSlotsAreChildNodes\"),\n\t\t}),\n\t\tsource: \"vector_panel\",\n\t\ttype: \"component\",\n\t}\n}\n\nexport function dataForLocalVectorSet(modulesStore: ModulesStore, id: NodeID): DraggableComponentData | undefined {\n\tconst info = modulesStore.forType(ModuleType.VectorSet).getByStableName(id)?.annotations(null, \"default\")?.[\n\t\tAnnotationKey.FramerVectorSet\n\t]\n\n\tif (!isFramerVectorSetInfo(info)) return\n\n\tconst firstItem = info?.items[0]\n\tif (!firstItem) return\n\n\tconst annotations = modulesStore\n\t\t.forType(ModuleType.Vector)\n\t\t.getByStableName(firstItem.id)\n\t\t?.annotations(null, \"default\")\n\n\tconst identifier = localModuleIdentifierForStableName(ModuleType.Vector, firstItem.id, \"default\").value\n\treturn dataForVectorInfo(identifier, annotations)\n}\n\nexport function dataForExternalVectorSet(tree: CanvasTree, id: NodeID): DraggableComponentData | undefined {\n\tconst info = tree.getNodeWithTrait(id, isExternalModuleNode)?.annotation(AnnotationKey.FramerVectorSet)\n\tif (!isFramerVectorSetInfo(info)) return\n\n\tconst firstItem = info?.items[0]\n\tif (!firstItem) return\n\n\tconst vector = tree.getNodeWithTrait(firstItem.moduleId, isExternalModuleNode)\n\tif (!vector) return\n\n\treturn dataForVectorInfo(vector.codeComponentIdentifier, vector.annotations)\n}\n\nfunction getModuleSourceForTypeRoot(typeRootId: EntityTypeRootId): \"code_panel\" | \"component_panel\" {\n\treturn typeRootId === CODE_FILE_ENTITY_TYPE_ROOT_ID ? \"code_panel\" : \"component_panel\"\n}\n\nfunction createComponentDataFromModule(\n\tmodule: ModuleInfo,\n\ttypeRootId: EntityTypeRootId,\n): DraggableComponentData | null {\n\tconst entityDefinition = engine.componentLoader.componentForIdentifier(module.moduleIdentifier)\n\tif (!entityDefinition || !isReactComponentDefinition(entityDefinition)) {\n\t\treturn null\n\t}\n\n\tconst component = codeComponentFromDefinition(entityDefinition)\n\tconst source = getModuleSourceForTypeRoot(typeRootId)\n\n\treturn {\n\t\tcomponent,\n\t\tsource,\n\t\ttype: \"component\",\n\t}\n}\n\nfunction getComponentDataForSelectedId(\n\tselectedId: NodeID,\n\ttypeRootId: EntityTypeRootId,\n\tmodulesMap: Map<NodeID, readonly ModuleInfo[]>,\n): DraggableComponentData | null {\n\tif (typeRootId === VECTOR_SET_ENTITY_TYPE_ROOT_ID) {\n\t\treturn dataForLocalVectorSet(engine.stores.modulesStore, selectedId) || null\n\t}\n\n\tconst modules = modulesMap.get(selectedId)\n\tif (modules && modules.length > 0) {\n\t\tconst module = modules[0]\n\t\tif (module) {\n\t\t\treturn createComponentDataFromModule(module, typeRootId)\n\t\t}\n\t}\n\n\treturn null\n}\n\nfunction MultiSelectionDragPreview({\n\ttypeRootId,\n\tselectedIds,\n}: {\n\ttypeRootId: EntityTypeRootId\n\tselectedIds: ReadonlySet<NodeID>\n}) {\n\tconst agentExperimentEnabled = useExperimentIsOn(\"agent\")\n\tconst hasFolder = hasAnyFolders(selectedIds)\n\n\tconst assetTypeName = hasFolder ? \"items\" : getAssetTypePluralName(typeRootId)\n\tconst icon = getIconForAssetType(typeRootId, selectedIds, { agentExperimentEnabled })\n\tconst title = `${selectedIds.size} ${assetTypeName}`\n\n\treturn (\n\t\t<CollapsibleRow\n\t\t\tid=\"multi-selection-drag-preview\"\n\t\t\ttitle={title}\n\t\t\tIcon={icon}\n\t\t\twithCollapse={false}\n\t\t\tisSelected={false}\n\t\t\tisEditable={false}\n\t\t\trowClassName={styles.multiItemPlaceholder}\n\t\t/>\n\t)\n}\n", "import { useClickHandlers } from \"@framerjs/app-shared/src/PreferMouseDown.tsx\"\nimport {\n\tCenterChild,\n\tContextMenuButton,\n\tIconLayerError,\n\tIconSectionCollapsed,\n\tNavigationStackItemContext,\n} from \"@framerjs/fresco\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport React, { useContext } from \"react\"\nimport { isFunction, isString } from \"utils/typeChecks.ts\"\nimport { PanelTooltip } from \"../PanelTooltip.tsx\"\nimport { frameIcon as frameIconStyle } from \"../layers/LayerPanelItem.styles.ts\"\nimport { EditableTextInput } from \"../shared/EditableTextInput/EditableTextInput.tsx\"\nimport * as styles from \"./CollapsibleRow.styles.ts\"\nimport { caretHeight, caretWidth, gap, rowIndentation } from \"./CollapsibleRow.styles.ts\"\nimport type { Props as EditableTextInputProps } from \"./EditableTextInput/EditableTextInput.tsx\"\nimport { PopoutContext } from \"./PopoutContext.ts\"\nimport { subLabelText, subLabelTextSelected } from \"./SubLabel.styles.ts\"\nimport { isMultiSelectModifierKeyPressedInEvent } from \"./utils/panelMultiSelect.ts\"\n\nfunction preventDefaultAndStopPropagation(event: React.MouseEvent) {\n\tevent.preventDefault()\n\tevent.stopPropagation()\n}\n\ninterface CommonProps {\n\tid: NodeID\n\ttitle?: string\n\ttooltip?: string\n\tIcon: React.FunctionComponent | JSX.Element | React.ReactNode\n\t/**\n\t * When true the icon slot is not rendered at all (e.g. section headers).\n\t * Defaults to false so text alignment is preserved with sibling rows\n\t * that do render an icon, even if `Icon` itself is nullish.\n\t */\n\thideIcon?: boolean\n\tbadge?: string\n\tinlineLabel?: string\n\tsubLabel?: string\n\t/**\n\t * Replaces the default trailing context menu button when present.\n\t * Use for row-specific trailing UI such as Update/Edit buttons or collapsed-count badges.\n\t */\n\ttrailingElementOverride?: React.ReactNode\n\t/**\n\t * Adds an extra trailing action after the default menu/override slot.\n\t * Use when the row should keep its normal trailing behavior and expose an additional action.\n\t */\n\tadditionalTrailingActionElement?: React.ReactNode\n\t/**\n\t * Prefer passing a synchronous getMenuOptions function as we do not want to delay the rendering\n\t * of the context menu or this will negatively impact usability. An async function can be used\n\t * for extremely fast but async lookups, eg: checking clipboard data.\n\t */\n\tgetMenuOptions?: (id: NodeID) => readonly MenuItemOptions[] | Promise<MenuItemOptions[]>\n\tisSelected?: boolean\n\tonSelect?: (id: NodeID, event: React.MouseEvent) => void\n\t/**\n\t * When being used with drag & drop, `mouseDown` and `onClick` fire first before the drag & drop can begin. This results\n\t * in either not being able to trigger the drag and drop or disabling single-click behavior on a multi-selection. This\n\t * should be used sparingly.\n\t */\n\tonMouseUp?: (id: NodeID) => void\n\tonEdit?: (id: NodeID) => void //  Optional function to override the default editing behavior (double click).\n\trowClassName?: string\n\ticonWrapperClassName?: string\n\tdataTestId?: string\n\twarningTitle?: string\n\twarningText?: string\n\tisDivider?: boolean\n}\n\ntype EditProps =\n\t| {\n\t\t\tisEditable: boolean\n\t\t\tinputId: string\n\t\t\ttitleOnEdit?: string\n\t\t\tonTitleChange: (id: NodeID, title: string, final: boolean, reset: () => void) => void\n\t\t\tonTitleFocus?: React.FocusEventHandler<HTMLInputElement>\n\t  }\n\t| {\n\t\t\tisEditable: false\n\t\t\tinputId?: never\n\t\t\ttitleOnEdit?: never\n\t\t\tonTitleChange?: never\n\t\t\tonTitleFocus?: never\n\t  }\n\ntype CollapseProps =\n\t| {\n\t\t\twithCollapse: true\n\t\t\tdepth: number\n\t\t\tisCollapsible?: boolean\n\t\t\tisCollapsed?: boolean\n\t\t\ttitleCanTriggerCollapse?: boolean\n\t\t\ttoggleCollapse?: (id: string) => void\n\t\t\tcanToggleCollapse?: () => boolean\n\t  }\n\t| {\n\t\t\twithCollapse: false\n\t\t\tdepth?: never\n\t\t\tisCollapsible?: never\n\t\t\tisCollapsed?: never\n\t\t\ttitleCanTriggerCollapse?: never\n\t\t\ttoggleCollapse?: never\n\t\t\tcanToggleCollapse?: never\n\t  }\n\ntype CollapsibleRowProps = CommonProps & EditProps & CollapseProps & Pick<EditableTextInputProps, \"selectionStyle\">\n\nexport function CollapsibleRowDivider({ depth }: { depth: number }) {\n\treturn (\n\t\t<div\n\t\t\tstyle={{ marginLeft: 2 * gap + caretWidth + depth * rowIndentation }}\n\t\t\tclassName={cx(styles.collapsibleRowDivider)}\n\t\t/>\n\t)\n}\n\n/**\n * NOTE: When we stop keyboard events from bubbling (e.g. for chevrons), the canvas never\n * sees the modifier release. Manually forward the event so `mouseStore` stays in sync.\n */\nfunction forwardModifiersToMouseStore(event: React.KeyboardEvent) {\n\tengine.stores.mouseStore.setModifiers(event.nativeEvent)\n}\n\ntype SharedTextInputProps = Omit<EditableTextInputProps, \"className\" | \"inputClassName\">\n\nexport const CollapsibleRow = React.forwardRef<HTMLDivElement, CollapsibleRowProps>(function CollapsibleRow(\n\t{\n\t\tid,\n\t\tinputId,\n\t\ttitle,\n\t\ttooltip,\n\t\tIcon,\n\t\thideIcon = false,\n\t\tbadge,\n\t\twarningTitle,\n\t\twarningText,\n\t\tinlineLabel,\n\t\tsubLabel,\n\t\tadditionalTrailingActionElement,\n\t\ttrailingElementOverride,\n\t\tgetMenuOptions,\n\t\tisSelected,\n\t\tonSelect,\n\t\tonMouseUp,\n\t\tonEdit,\n\t\trowClassName,\n\t\ticonWrapperClassName,\n\t\tdataTestId,\n\t\t// Edit\n\t\tisEditable,\n\t\ttitleOnEdit,\n\t\tonTitleChange,\n\t\tonTitleFocus,\n\t\t// Collapse\n\t\twithCollapse,\n\t\tdepth,\n\t\tisCollapsible,\n\t\tisCollapsed,\n\t\ttoggleCollapse,\n\t\ttitleCanTriggerCollapse = false,\n\t\tcanToggleCollapse,\n\t\tselectionStyle,\n\t\tisDivider,\n\t},\n\tforwardedRef,\n) {\n\tconst [isMenuOpen, setIsMenuOpen] = React.useState(false)\n\tconst [isEditing, setIsEditing] = React.useState(false)\n\tconst isAgentExperimentOn = useExperimentIsOn(\"agent\")\n\tconst isRenderingWithinPopout = isString(useContext(NavigationStackItemContext))\n\tconst popoutNavigation = React.useContext(PopoutContext)\n\n\tconst handleToggleCollapse = (event: React.MouseEvent) => {\n\t\tif (!toggleCollapse || (canToggleCollapse && !canToggleCollapse())) return\n\t\t// We don't want to select the row when toggling collapse.\n\t\tpreventDefaultAndStopPropagation(event)\n\t\ttoggleCollapse(id)\n\t}\n\n\tconst showMenu = async (event: React.MouseEvent<HTMLElement>, { atMousePosition }: { atMousePosition: boolean }) => {\n\t\tif (!getMenuOptions) return\n\t\tpreventDefaultAndStopPropagation(event)\n\n\t\tconst buttonBounds = event.currentTarget.getBoundingClientRect()\n\n\t\tsetIsMenuOpen(true)\n\t\tengine.stores.contextMenuStore.show(await getMenuOptions(id), {\n\t\t\tsearchable: false,\n\t\t\tlocation: atMousePosition\n\t\t\t\t? { x: event.clientX, y: event.clientY }\n\t\t\t\t: { x: buttonBounds.left, y: buttonBounds.bottom - 6 },\n\t\t\tonDone: () => setIsMenuOpen(false),\n\t\t})\n\t}\n\n\t// Only trigger collapse when not editing to avoid interfering with input interaction\n\tconst handleTitleClick = (event: React.MouseEvent) => {\n\t\tif (isEditing) {\n\t\t\tevent.stopPropagation()\n\t\t\treturn\n\t\t}\n\t\thandleToggleCollapse(event)\n\t}\n\n\tconst handleTitleChange = (newTitle: string, final: boolean, reset: () => void) => {\n\t\tonTitleChange?.(id, newTitle, final, reset)\n\t}\n\n\tconst handleDoubleClick = (event: React.MouseEvent) => {\n\t\t// Prevent double clicking from registering with multi-select keys being pressed.\n\t\tif (isMultiSelectModifierKeyPressedInEvent(event)) return\n\t\tif (onEdit) return onEdit(id)\n\t\tif (!isEditable) return\n\n\t\t// Prevent popout from opening when double clicking to edit the title.\n\t\tif (!isRenderingWithinPopout) {\n\t\t\tpopoutNavigation?.close()\n\t\t}\n\n\t\tif (isEditing) return\n\t\tsetIsEditing(true)\n\t}\n\n\tconst handleKeyDown = (event: React.KeyboardEvent) => {\n\t\tif (event.key === \" \") {\n\t\t\t// We want to prevent other actions from happening when the user is\n\t\t\t// is pressing space when editing the title. This fixes an issue\n\t\t\t// where pressing space when renaming an asset style would trigger\n\t\t\t// the popout of closing.\n\t\t\tevent.stopPropagation()\n\t\t}\n\t}\n\n\tconst handleSelect = (event: React.MouseEvent) => onSelect?.(id, event)\n\tconst handleMouseUp = () => {\n\t\tonMouseUp?.(id)\n\t}\n\n\tconst selectClickHandlers = useClickHandlers(handleSelect)\n\tconst collapsibleClickHandlers = useClickHandlers(handleToggleCollapse)\n\n\tconst collapseButtonAriaLabelPrefix = isCollapsed ? Dictionary.Expand : Dictionary.Collapse\n\n\tconst sharedTextInputProps: SharedTextInputProps = {\n\t\tid: inputId,\n\t\tonKeyDown: handleKeyDown,\n\t\tplaceholder: title ?? \"\",\n\t\teditingInitialValue: titleOnEdit,\n\t\tallowEdit: isEditable,\n\t\tallowEmpty: false,\n\t\tonValueChange: handleTitleChange,\n\t\tonDoubleClick: handleDoubleClick,\n\t\tonFocus: onTitleFocus,\n\t\tisEditing,\n\t\tsetIsEditing,\n\t\t// Uses onClick with an isEditing guard instead of collapsibleClickHandlers,\n\t\t// because the mousedown handler would block text input interaction.\n\t\tonClick: handleTitleClick,\n\t\tlabel: inlineLabel,\n\t\tsmall: true,\n\t\tselectionStyle,\n\t}\n\n\treturn (\n\t\t// biome-ignore lint/nursery/noStaticElementInteractions: Wrapping div is needed to capture whole row clicks.\n\t\t<div\n\t\t\tref={forwardedRef}\n\t\t\trole=\"presentation\"\n\t\t\ttitle={tooltip}\n\t\t\tclassName={cx(\n\t\t\t\tstyles.collapsibleRow,\n\t\t\t\tisSelected && styles.collapsibleRowSelected,\n\t\t\t\tisMenuOpen && styles.collapsibleRowWithOpenMenu,\n\t\t\t\tisDivider && styles.collapsibleRowDividerContainer,\n\t\t\t\trowClassName,\n\t\t\t)}\n\t\t\tstyle={{ paddingLeft: depth ? gap + caretWidth + depth * rowIndentation : undefined }}\n\t\t\t{...selectClickHandlers}\n\t\t\tonMouseUp={handleMouseUp}\n\t\t\tonContextMenu={event => showMenu(event, { atMousePosition: true })}\n\t\t\tdata-testid={dataTestId}\n\t\t\taria-selected={isSelected}\n\t\t\taria-expanded={!isCollapsed}\n\t\t>\n\t\t\t{withCollapse && isCollapsible ? (\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t{...collapsibleClickHandlers}\n\t\t\t\t\tonMouseUp={onMouseUp ? preventDefaultAndStopPropagation : undefined}\n\t\t\t\t\tonKeyDown={forwardModifiersToMouseStore}\n\t\t\t\t\tonKeyUp={forwardModifiersToMouseStore}\n\t\t\t\t\taria-label={`${collapseButtonAriaLabelPrefix} row`}\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.collapseArea,\n\t\t\t\t\t\tisCollapsed && styles.collapseIndicatorCollapsed,\n\t\t\t\t\t\tisSelected && styles.collapseIndicatorSelected,\n\t\t\t\t\t)}\n\t\t\t\t\tstyle={{ paddingLeft: gap + depth * rowIndentation }}\n\t\t\t\t>\n\t\t\t\t\t<CenterChild>\n\t\t\t\t\t\t<IconSectionCollapsed height={caretHeight} />\n\t\t\t\t\t</CenterChild>\n\t\t\t\t</button>\n\t\t\t) : null}\n\n\t\t\t<div\n\t\t\t\t{...(titleCanTriggerCollapse && withCollapse && isCollapsible\n\t\t\t\t\t? {\n\t\t\t\t\t\t\t...collapsibleClickHandlers,\n\t\t\t\t\t\t\tonMouseUp: onMouseUp ? preventDefaultAndStopPropagation : undefined,\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined)}\n\t\t\t\tclassName={styles.collapsibleTitleArea}\n\t\t\t>\n\t\t\t\t{isDivider ? (\n\t\t\t\t\t<DividerRowContent isSelected={isSelected}>\n\t\t\t\t\t\t<RowEndContent\n\t\t\t\t\t\t\ttrailingElementOverride={trailingElementOverride}\n\t\t\t\t\t\t\tadditionalTrailingActionElement={additionalTrailingActionElement}\n\t\t\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\t\t\tgetMenuOptions={getMenuOptions}\n\t\t\t\t\t\t\tshowMenu={showMenu}\n\t\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\t\tbadge={badge}\n\t\t\t\t\t\t\tsubLabel={subLabel}\n\t\t\t\t\t\t\tisAgentExperimentOn={isAgentExperimentOn}\n\t\t\t\t\t\t\twarningTitle={warningTitle}\n\t\t\t\t\t\t\twarningText={warningText}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</DividerRowContent>\n\t\t\t\t) : (\n\t\t\t\t\t<RowContent\n\t\t\t\t\t\twithCollapse={withCollapse}\n\t\t\t\t\t\tIcon={Icon}\n\t\t\t\t\t\thideIcon={hideIcon}\n\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\tisAgentExperimentOn={isAgentExperimentOn}\n\t\t\t\t\t\ticonWrapperClassName={iconWrapperClassName}\n\t\t\t\t\t\tcollapsibleClickHandlers={collapsibleClickHandlers}\n\t\t\t\t\t\tsuppressMouseUp={!!onMouseUp}\n\t\t\t\t\t\ttextInputProps={sharedTextInputProps}\n\t\t\t\t\t>\n\t\t\t\t\t\t<RowEndContent\n\t\t\t\t\t\t\ttrailingElementOverride={trailingElementOverride}\n\t\t\t\t\t\t\tadditionalTrailingActionElement={additionalTrailingActionElement}\n\t\t\t\t\t\t\tisEditing={isEditing}\n\t\t\t\t\t\t\tgetMenuOptions={getMenuOptions}\n\t\t\t\t\t\t\tshowMenu={showMenu}\n\t\t\t\t\t\t\tisSelected={isSelected}\n\t\t\t\t\t\t\tbadge={badge}\n\t\t\t\t\t\t\tsubLabel={subLabel}\n\t\t\t\t\t\t\tisAgentExperimentOn={isAgentExperimentOn}\n\t\t\t\t\t\t\twarningTitle={warningTitle}\n\t\t\t\t\t\t\twarningText={warningText}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</RowContent>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t</div>\n\t)\n})\n\ninterface DividerRowContentProps {\n\tisSelected: boolean | undefined\n\tchildren: React.ReactNode\n}\n\nfunction DividerRowContent({ isSelected, children }: DividerRowContentProps) {\n\treturn (\n\t\t<>\n\t\t\t<hr className={cx(styles.dividerCollapsible, isSelected && styles.dividerSelected)} />\n\t\t\t{children}\n\t\t</>\n\t)\n}\n\ninterface RowEndContentProps {\n\ttrailingElementOverride: React.ReactNode | undefined\n\tadditionalTrailingActionElement: React.ReactNode | undefined\n\tisEditing: boolean\n\tgetMenuOptions: CommonProps[\"getMenuOptions\"] | undefined\n\tshowMenu: (event: React.MouseEvent<HTMLElement>, options: { atMousePosition: boolean }) => void\n\tisSelected: boolean | undefined\n\tbadge: string | undefined\n\tsubLabel: string | undefined\n\tisAgentExperimentOn: boolean\n\twarningTitle: string | undefined\n\twarningText: string | undefined\n}\n\nfunction RowEndContent({\n\ttrailingElementOverride,\n\tadditionalTrailingActionElement,\n\tisEditing,\n\tgetMenuOptions,\n\tshowMenu,\n\tisSelected,\n\tbadge,\n\tsubLabel,\n\tisAgentExperimentOn,\n\twarningTitle,\n\twarningText,\n}: RowEndContentProps) {\n\treturn (\n\t\t<>\n\t\t\t{trailingElementOverride && !isEditing ? (\n\t\t\t\ttrailingElementOverride\n\t\t\t) : getMenuOptions ? (\n\t\t\t\t<ContextMenuButton\n\t\t\t\t\tonMouseDown={event => showMenu(event, { atMousePosition: false })}\n\t\t\t\t\tclassName={cx(styles.settingsButton, isSelected && styles.settingsButtonSelected)}\n\t\t\t\t/>\n\t\t\t) : null}\n\t\t\t{additionalTrailingActionElement && !isEditing ? additionalTrailingActionElement : null}\n\t\t\t{badge && (\n\t\t\t\t<div className={cx(getMenuOptions && styles.hideOnHover)}>\n\t\t\t\t\t{badge === Dictionary.A_B ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<span className={styles.badge}>A</span>\n\t\t\t\t\t\t\t<span className={styles.badge}>B</span>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<span className={styles.badge}>{badge}</span>\n\t\t\t\t\t)}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{subLabel && (\n\t\t\t\t<div\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tgetMenuOptions && styles.hideOnHover,\n\t\t\t\t\t\tstyles.subLabel,\n\t\t\t\t\t\tisAgentExperimentOn && subLabelText,\n\t\t\t\t\t\tisAgentExperimentOn && isSelected && subLabelTextSelected,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{subLabel}\n\t\t\t\t</div>\n\t\t\t)}\n\t\t\t{!!warningTitle && !!warningText && (\n\t\t\t\t<div className={cx(frameIconStyle, styles.conflictWarning)}>\n\t\t\t\t\t<PanelTooltip\n\t\t\t\t\t\tdirection=\"left\"\n\t\t\t\t\t\tdelay=\"long\"\n\t\t\t\t\t\ticon={<IconLayerError />}\n\t\t\t\t\t\ttitle={warningTitle}\n\t\t\t\t\t\ttext={warningText}\n\t\t\t\t\t/>\n\t\t\t\t</div>\n\t\t\t)}\n\t\t</>\n\t)\n}\n\ninterface RowContentProps {\n\twithCollapse: boolean\n\tIcon: React.FunctionComponent | JSX.Element | React.ReactNode\n\thideIcon: boolean | undefined\n\tisSelected: boolean | undefined\n\tisAgentExperimentOn: boolean\n\ticonWrapperClassName: string | undefined\n\tcollapsibleClickHandlers: ReturnType<typeof useClickHandlers>\n\tsuppressMouseUp: boolean\n\ttextInputProps: SharedTextInputProps\n\tchildren: React.ReactNode\n}\n\nfunction RowContent({\n\twithCollapse,\n\tIcon,\n\thideIcon,\n\tisSelected,\n\tisAgentExperimentOn,\n\ticonWrapperClassName,\n\tcollapsibleClickHandlers,\n\tsuppressMouseUp,\n\ttextInputProps,\n\tchildren,\n}: RowContentProps) {\n\treturn (\n\t\t<>\n\t\t\t{withCollapse && <div className={styles.collapseSpacer} />}\n\t\t\t{!hideIcon && (\n\t\t\t\t<CenterChild\n\t\t\t\t\t{...collapsibleClickHandlers}\n\t\t\t\t\tonMouseUp={suppressMouseUp ? preventDefaultAndStopPropagation : undefined}\n\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\tstyles.iconWrapper,\n\t\t\t\t\t\tisSelected && styles.iconWrapperSelected,\n\t\t\t\t\t\tisAgentExperimentOn && styles.iconWrapperAgent,\n\t\t\t\t\t\ticonWrapperClassName,\n\t\t\t\t\t)}\n\t\t\t\t>\n\t\t\t\t\t{isFunction(Icon) ? <Icon /> : Icon}\n\t\t\t\t</CenterChild>\n\t\t\t)}\n\t\t\t<EditableTextInput\n\t\t\t\t{...textInputProps}\n\t\t\t\tclassName={cx(\n\t\t\t\t\tstyles.inputWrapper,\n\t\t\t\t\tisSelected && styles.inputWrapperSelected,\n\t\t\t\t\tisAgentExperimentOn && styles.inputWrapperAgent,\n\t\t\t\t\thideIcon && styles.hideIconInputWrapper,\n\t\t\t\t)}\n\t\t\t/>\n\t\t\t{children}\n\t\t</>\n\t)\n}\n", "import \"CollapseIndicator.styles_1wo8tdo.wyw.css\"; export const collapseIndicatorWidth = 11;\nexport const collapseIndicator = \"collapseIndicator_c1nw3fht\";\nexport const alignLeft = \"alignLeft_a1pw5sbj\";\nexport const collapsePlaceholder = \"collapsePlaceholder_c39zbqh\";\nexport const collapseIndicatorMargin = 10;\nexport const withPaddingAndMargin = \"withPaddingAndMargin_wqiy257\";\nexport const collapseIndicatorExpanded = \"collapseIndicatorExpanded_c1sx3h7b\";", "import \"LayerPanelItem.styles_104tfp5.wyw.css\"; import { dimensions } from \"@framerjs/fresco/tokens\";\nimport { collapseIndicatorMargin, collapseIndicatorWidth } from \"../shared/CollapseIndicator.styles.ts\";\nconst inputPadding = dimensions.values.contentItemInputPadding;\nconst inputBorderWidth = 1;\nconst frameIconWidth = 12;\nconst frameIconMargin = dimensions.values.inputSpacing - inputBorderWidth - inputPadding;\nexport const layerPanelItemCollapseWrapperWidth = frameIconWidth + frameIconMargin + collapseIndicatorWidth + collapseIndicatorMargin + collapseIndicatorMargin / 2;\nexport const row = \"row_rf89uo9\";\nexport const rowEditing = \"rowEditing_r147hnu4\";\nexport const rowHidden = \"rowHidden_r1oj6byl\";\nexport const rowSelected = \"rowSelected_rl63xea\";\nexport const rowHiddenSelected = \"rowHiddenSelected_rw8zid5\";\nexport const rowComponentNode = \"rowComponentNode_r1980kzk\";\nexport const agentContextToolHighlight = \"agentContextToolHighlight_a13fol1j\";\nexport const indent = \"indent_i18jgb23\";\nexport const input = \"input_ia5afqi\";\nexport const inputUserComponent = \"inputUserComponent_i1roe1y1\";\nexport const inputWrapper = \"inputWrapper_i16ktx2l\";\nexport const editingInput = \"editingInput_ebmoaqb\";\nexport const componentLabel = \"componentLabel_c1ovsc2i\";\nexport const primaryLabel = \"primaryLabel_p1uyeq0c\";\nexport const componentLabelSelected = \"componentLabelSelected_cpedzud\";\nexport const frameIcon = \"frameIcon_f1yod2t0\";\nexport const icon = \"icon_i1icgddi\";\nexport const iconDefault = \"iconDefault_i1y03bmp\";\nexport const iconHidden = \"iconHidden_iortn90\";\nexport const iconHiddenSelected = \"iconHiddenSelected_iid943i\";\nexport const iconSelected = \"iconSelected_iituews\";\nexport const iconComponent = \"iconComponent_i1252060\";\nexport const iconComponentDimmed = \"iconComponentDimmed_i6c8x8h\";\nexport const iconDimmed = \"iconDimmed_iys2pub\";\nexport const iconTint = \"iconTint_i1hn5f8x\";\nexport const agentIndicatorIcon = \"agentIndicatorIcon_aqcrdjw\";\nexport const textDefault = \"textDefault_t9x9qx5\";\nexport const textSelected = \"textSelected_t18efthf\";\nexport const textInactiveSelected = \"textInactiveSelected_truxvvm\";\nexport const textInactive = \"textInactive_tndvsk7\";\nexport const textEditing = \"textEditing_t8d5w75\";\nexport const agentTextHighlighting = \"agentTextHighlighting_a1sjufi4\";\nexport const agentTextEditing = \"agentTextEditing_a1p8hsz\";\nexport const iconLock = \"iconLock_i1x8yv5a\";\nexport const opaqueLock = \"opaqueLock_o1ici22l\";\nexport const itemContent = \"itemContent_ircqkit\";\nexport const labelsWrapper = \"labelsWrapper_l14a7qxm\";\nexport const rightStickyWrapper = \"rightStickyWrapper_r17oxikb\";\nexport const stickyAlignment = \"stickyAlignment_sytp6a8\";\nexport const collapseWrapper = \"collapseWrapper_cqo66s3\";\nexport const leftStickyWrapper = \"leftStickyWrapper_lya950q\";", "import type { TextInputProps } from \"@framerjs/fresco\"\nimport { TextInput, truncateWithEllipsis } from \"@framerjs/fresco\"\nimport { isSafari } from \"@framerjs/shared/src/environment.ts\"\nimport { cx } from \"@linaria/core\"\nimport { useExperimentIsOn } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport React, { useEffect } from \"react\"\nimport { deregisterEditActionForPanelTitle, registerEditActionForPanelTitle } from \"../../Pages/utils/editPanelRow.ts\"\nimport * as styles from \"./EditableTextInput.styles.ts\"\n\nexport interface Props extends Omit<TextInputProps, \"ref\" | \"onChange\" | \"value\"> {\n\t/* Value to show when not editing */\n\tplaceholder: string\n\t/* Initial value when editing. If not provided, default to placeholder. */\n\teditingInitialValue?: string\n\t/* Placeholder when editing. If not provided, default to editingInitialValue. */\n\teditingPlaceholder?: string\n\t/* If double click to edit is enable */\n\tallowEdit: boolean\n\t/* Allow input value to be empty.\n    If not allowed, onValueChange won't be triggered by an empty value,\n    and the internal input value will be reset to the intial value */\n\tallowEmpty?: boolean\n\tclassName?: string\n\tinputClassName?: string\n\tlabel?: string\n\tonValueChange: (value: string, final: boolean, reset: () => void) => void\n\t/** Optional method to override default editing behavior. */\n\tonDoubleClick?: (event: React.MouseEvent) => void\n\tisEditing: boolean\n\tsetIsEditing: React.Dispatch<React.SetStateAction<boolean>>\n\tselectionStyle?: \"tinted\" | \"unsaturated\"\n}\n\nexport const EditableTextInput = React.forwardRef<HTMLInputElement, Props>(\n\t(\n\t\t{\n\t\t\tid,\n\t\t\tlabel,\n\t\t\tplaceholder,\n\t\t\tisEditing,\n\t\t\tsetIsEditing,\n\t\t\teditingInitialValue = placeholder,\n\t\t\teditingPlaceholder = editingInitialValue,\n\t\t\tallowEdit,\n\t\t\tallowEmpty = true,\n\t\t\tonValueChange,\n\t\t\tonDoubleClick,\n\t\t\tclassName: wrapperClassName,\n\t\t\tinputClassName,\n\t\t\tselectionStyle = \"tinted\",\n\t\t\t...rest\n\t\t},\n\t\tforwardedRef,\n\t) => {\n\t\tconst agentExperimentIsOn = useExperimentIsOn(\"agent\")\n\t\tconst fallbackRef = React.useRef<HTMLInputElement | null>(null)\n\t\tconst inputRef = forwardedRef ?? fallbackRef\n\t\tconst handleChange = (value: string, final: boolean, reset: () => void) => {\n\t\t\tif (!final) return\n\t\t\tif (value === editingInitialValue) return\n\t\t\tif (!allowEmpty && value === \"\") {\n\t\t\t\treset()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tonValueChange(value, final, reset)\n\t\t}\n\n\t\tconst handleBlur = () => {\n\t\t\t// Prevent outdated value from rendering when the tree is updated\n\t\t\tengine.scheduler.runBeforeNextFrame(() => setIsEditing(false))\n\t\t}\n\n\t\tconst startEditing = () => {\n\t\t\tif (isEditing || !allowEdit) return\n\t\t\tsetIsEditing(true)\n\t\t}\n\n\t\tuseEffect(() => {\n\t\t\tif (!id) return\n\t\t\tregisterEditActionForPanelTitle(id, () => setIsEditing(true))\n\t\t\treturn () => deregisterEditActionForPanelTitle(id)\n\t\t})\n\n\t\treturn (\n\t\t\t<div\n\t\t\t\tonDoubleClick={onDoubleClick ? onDoubleClick : startEditing}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"editing\",\n\t\t\t\t\t!isEditing && styles.nonEditingInputWrapper,\n\t\t\t\t\tisEditing && styles.editingInputWrapper,\n\t\t\t\t\twrapperClassName,\n\t\t\t\t)}\n\t\t\t>\n\t\t\t\t{isEditing ? (\n\t\t\t\t\t<TextInput\n\t\t\t\t\t\tautoFocus\n\t\t\t\t\t\tblurOnEnter\n\t\t\t\t\t\tref={inputRef}\n\t\t\t\t\t\tid={id}\n\t\t\t\t\t\tvalue={editingInitialValue}\n\t\t\t\t\t\tplaceholder={editingPlaceholder}\n\t\t\t\t\t\tenabled={isEditing}\n\t\t\t\t\t\tonChange={handleChange}\n\t\t\t\t\t\tonBlur={handleBlur}\n\t\t\t\t\t\tclassName={cx(\n\t\t\t\t\t\t\tstyles.input,\n\t\t\t\t\t\t\tisEditing && styles.editingInput,\n\t\t\t\t\t\t\tagentExperimentIsOn && isEditing && styles.inlineEditingInput,\n\t\t\t\t\t\t\tagentExperimentIsOn && selectionStyle === \"unsaturated\" && styles.unsaturatedSelection,\n\t\t\t\t\t\t\tinputClassName,\n\t\t\t\t\t\t)}\n\t\t\t\t\t\t{...rest}\n\t\t\t\t\t/>\n\t\t\t\t) : (\n\t\t\t\t\t<>\n\t\t\t\t\t\t<span className={cx(styles.text, truncateWithEllipsis, isSafari() && styles.textSafari)}>\n\t\t\t\t\t\t\t{placeholder}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t{label && <span className={styles.label}>{label}</span>}\n\t\t\t\t\t</>\n\t\t\t\t)}\n\t\t\t</div>\n\t\t)\n\t},\n)\n", "import \"EditableTextInput.styles_1lyda5.wyw.css\"; export const editingInputWrapper = \"editingInputWrapper_en4qia2\";\nexport const nonEditingInputWrapper = \"nonEditingInputWrapper_n17gpdk2\";\nexport const text = \"text_t3suiwm\";\nexport const textSafari = \"textSafari_t1s99slc\";\nexport const label = \"label_ly4wtci\";\nexport const input = \"input_i22e7rk\";\nexport const editingInput = \"editingInput_e5zlgza\";\nexport const inlineEditingInput = \"inlineEditingInput_i18trgiu\";\nexport const unsaturatedSelection = \"unsaturatedSelection_u1wkvghs\";", "import \"CollapsibleRow.styles_q2v6rc.wyw.css\"; const iconSize = 12;\nexport const caretWidth = 6;\nexport const caretHeight = 6;\nexport const gap = 10;\nexport const rowIndentation = iconSize + gap;\nexport const inputWrapper = \"inputWrapper_i3lf05q\";\nexport const inputWrapperAgent = \"inputWrapperAgent_i1odo8pq\";\nexport const inputWrapperSelected = \"inputWrapperSelected_iy5ki9g\";\nexport const settingsButton = \"settingsButton_srucjtl\";\nexport const settingsButtonSelected = \"settingsButtonSelected_s23srp5\";\nexport const hideOnHover = \"hideOnHover_hymbto6\";\nexport const badge = \"badge_b1wayvt3\";\nexport const collapsibleRowWithOpenMenu = \"collapsibleRowWithOpenMenu_c5b8jxj\";\nexport const collapsibleRowPaddingRight = 4;\nexport const collapsibleRow = \"collapsibleRow_c97qmlw\";\nexport const collapsibleRowSelected = \"collapsibleRowSelected_cimf5a8\";\nexport const iconWrapper = \"iconWrapper_i1g47cmw\";\nexport const iconWrapperSelected = \"iconWrapperSelected_i11kbyn2\";\nexport const iconWrapperAgent = \"iconWrapperAgent_iaud15x\";\nexport const collapseSpacer = \"collapseSpacer_c1gi2t9h\";\nexport const collapseArea = \"collapseArea_cwhmypa\";\nexport const collapseIndicatorCollapsed = \"collapseIndicatorCollapsed_c1e76oam\";\nexport const collapseIndicatorSelected = \"collapseIndicatorSelected_c1u6onkx\";\nexport const subLabel = \"subLabel_saa07z4\";\nexport const collapsibleTitleArea = \"collapsibleTitleArea_c1j3gzec\";\nexport const collapsibleRowDivider = \"collapsibleRowDivider_c1oteaxv\";\nexport const collapsibleRowDividerContainer = \"collapsibleRowDividerContainer_cd35766\";\nexport const dividerCollapsible = \"dividerCollapsible_do8xoxv\";\nexport const dividerSelected = \"dividerSelected_d7mca4t\";\nexport const conflictWarning = \"conflictWarning_cqw00wn\";\nexport const hideIconInputWrapper = \"hideIconInputWrapper_hsv1hev\";", "import \"SubLabel.styles_1t5hvu5.wyw.css\"; export const subLabelText = \"subLabelText_spzzsdk\";\nexport const subLabelTextSelected = \"subLabelTextSelected_sj86cvt\";", "import { isCommandKeyPressed } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\n\nexport function isRangeSelecting() {\n\treturn engine.stores.mouseStore.shiftKey\n}\n\nexport function isToggleSelecting() {\n\treturn engine.stores.mouseStore.cmdKey || engine.stores.mouseStore.ctrlKey\n}\n\nexport function isMultiSelectModifierKeyPressed() {\n\treturn isRangeSelecting() || isToggleSelecting()\n}\n\nexport function isMultiSelectModifierKeyPressedInEvent(event: React.MouseEvent) {\n\treturn isCommandKeyPressed(event) || event.shiftKey\n}\n", "import \"InsertionIndicator.styles_18vm97c.wyw.css\"; export const INSERTION_INDICATOR_COLOR = \"--insertion-indicator-color\";\nexport const container = \"container_c1ba02zj\";\nexport const line = \"line_l1k1c7a1\";\nexport const circle = \"circle_cn0j1kj\";", "import { rowIndentation } from \"./CollapsibleRow.styles.ts\"\nimport * as styles from \"./InsertionIndicator.styles.ts\"\n\ninterface Props {\n\tleftOffset?: number\n\tdepth: number\n\tposition: \"top\" | \"bottom\"\n\tcolor?: string\n}\n\nexport const InsertionIndicator = ({ leftOffset = 0, depth = 0, position, color }: Props) => {\n\tconst marginLeft = leftOffset + depth * rowIndentation\n\n\treturn (\n\t\t<div\n\t\t\tstyle={{\n\t\t\t\ttop: position === \"top\" ? 0 : undefined,\n\t\t\t\tbottom: position === \"bottom\" ? -1 : undefined,\n\t\t\t\t[styles.INSERTION_INDICATOR_COLOR]: color,\n\t\t\t}}\n\t\t\tclassName={styles.container}\n\t\t>\n\t\t\t<div style={{ marginLeft, width: `calc(100% - ${marginLeft}px)` }} className={styles.line}>\n\t\t\t\t<div className={styles.circle} />\n\t\t\t</div>\n\t\t</div>\n\t)\n}\n", "/** The amount of time in milliseconds to wait before expanding a node after a drag. */\nexport const dragExpandTime = 500\n", "import { assertNever } from \"@framerjs/shared\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\n\nexport type DragAndDropPosition = \"top\" | \"bottom\" | \"middle\"\n\nexport function calculateOffset(position: Exclude<DragAndDropPosition, \"middle\">) {\n\tswitch (position) {\n\t\tcase \"top\":\n\t\t\treturn 0\n\t\tcase \"bottom\":\n\t\t\treturn 1\n\t\tdefault:\n\t\t\tassertNever(position)\n\t}\n}\n\nexport function calculateInsertionIndex(\n\tinsertOffset: number,\n\tinsertParentId: NodeID,\n\tdropTargetId: NodeID,\n): number | null {\n\tif (insertOffset === -1) {\n\t\t// Dropping into a folder - insert at the end\n\t\tconst targetParent = engine.tree.get(insertParentId)\n\t\treturn targetParent?.children?.length ?? 0\n\t}\n\n\t// Dropping between items\n\tconst targetParent = engine.tree.get(insertParentId)\n\tif (!targetParent?.children) return null\n\n\tconst targetIndex = targetParent.children.findIndex(child => child.id === dropTargetId)\n\tif (targetIndex === -1) {\n\t\t// Target not found, insert at end\n\t\treturn targetParent.children.length\n\t}\n\n\t// Insert before or after the target\n\treturn targetIndex + insertOffset\n}\n", "import \"DraggableEntityItem.styles_1kn75gl.wyw.css\"; export const container = \"container_c19ob8lo\";\nexport const dropTargetContainer = \"dropTargetContainer_dqe20r0\";\nexport const dropTarget = \"dropTarget_djrovbw\";\nexport const multiItemPlaceholder = \"multiItemPlaceholder_m1mplqpt\";", "import { assert } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { EntityFolderNode } from \"document/models/CanvasTree/nodes/EntityFolderNode.ts\"\nimport type { EntityReferenceNode } from \"document/models/CanvasTree/nodes/EntityReferenceNode.ts\"\nimport {\n\tCODE_FILE_ENTITY_TYPE_ROOT_ID,\n\tCOMPONENTS_ENTITY_TYPE_ROOT_ID,\n\ttype EntityTypeRootId,\n\ttype EntityTypeRootNode,\n\ttrackingTypeForRootId,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport {\n\tgetFolderNodeByName,\n\tisValidEntityParentNode,\n} from \"document/models/CanvasTree/nodes/utils/entityFolderNode.ts\"\nimport { entityRootTypeIdForEntityNode } from \"document/models/CanvasTree/nodes/utils/entityTypeRootNode.ts\"\nimport { isEntityFolderNode, isEntityReferenceNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { updateLocalModulePath } from \"./rename.ts\"\n\ninterface MoveEntityNodesConfig {\n\tentityId: NodeID\n\tnewParentId: NodeID\n\ttypeRootId: EntityTypeRootId\n\tpositionInParent?: number\n}\n\nexport async function moveEntityNode(\n\tengine: VekterEngine,\n\t{ entityId, newParentId, typeRootId, positionInParent }: MoveEntityNodesConfig,\n) {\n\tif (entityId === newParentId) return\n\n\tconst entityNode = engine.tree.get<EntityFolderNode | EntityReferenceNode>(entityId)\n\tconst newParentNode = engine.tree.get<EntityFolderNode | EntityTypeRootNode>(newParentId)\n\tif (!entityNode || !newParentNode) return\n\n\tif (!canMoveEntityNode(entityNode, newParentNode)) return\n\n\tengine.tree.moveNode(entityNode, newParentId, positionInParent)\n\n\trecord(isEntityFolderNode(entityNode) ? \"entity_folder_reorder\" : \"entity_reference_reorder\", {\n\t\tentityType: trackingTypeForRootId(typeRootId),\n\t})\n\n\tawait updateReferenceName(engine, entityId, typeRootId)\n}\n\nfunction canMoveEntityNode(\n\tentityNode: EntityFolderNode | EntityReferenceNode,\n\tnewParentNode: EntityFolderNode | EntityTypeRootNode,\n) {\n\tif (!isValidEntityParentNode(newParentNode)) return false\n\n\t// We can't move a folder to a different type of node.\n\tconst entityType = entityRootTypeIdForEntityNode(entityNode)\n\tif (entityRootTypeIdForEntityNode(newParentNode) !== entityType) return false\n\n\t// We can't move a folder to a parent that already has a folder with the same name.\n\t// Unless the existing folder node is the same as the entity node.\n\tconst existingFolderNode = getFolderNodeByName(newParentNode, entityNode.getName())\n\tif (existingFolderNode && existingFolderNode.id !== entityNode.id) return false\n\n\treturn true\n}\n\nasync function updateReferenceName(engine: VekterEngine, movedNodeId: NodeID, typeRootId: EntityTypeRootId) {\n\t// For code files, we need to keep the full path up to date on the original\n\t// node. Because we rely on it for code imports. For smart components,\n\t// temporarily want to do the same so we can keep the 2 models in sync while\n\t// we have the experiment.\n\tif (typeRootId !== COMPONENTS_ENTITY_TYPE_ROOT_ID && typeRootId !== CODE_FILE_ENTITY_TYPE_ROOT_ID) return\n\n\tconst movedNode = engine.tree.get(movedNodeId)\n\tassert(\n\t\tisEntityFolderNode(movedNode) || isEntityReferenceNode(movedNode),\n\t\t\"moved node must be a folder or reference node\",\n\t)\n\n\t// First, we need to find all the reference nodes affected by the move.\n\tconst referenceNodesToUpdate: EntityReferenceNode[] = []\n\tfor (const child of movedNode.walk()) {\n\t\tif (!isEntityReferenceNode(child)) continue\n\t\treferenceNodesToUpdate.push(child)\n\t}\n\n\t// Then, we need to update the path of each reference node.\n\tfor (const referenceNode of referenceNodesToUpdate) {\n\t\tif (typeRootId === CODE_FILE_ENTITY_TYPE_ROOT_ID) {\n\t\t\tvoid updateLocalModulePath(engine, referenceNode)\n\t\t}\n\t}\n}\n", "import type { SVGProps } from \"react\"\n\nexport function IconAgentVectorSet(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg\n\t\t\trole=\"presentation\"\n\t\t\txmlns=\"http://www.w3.org/2000/svg\"\n\t\t\twidth=\"12\"\n\t\t\theight=\"12\"\n\t\t\tviewBox=\"0 0 12 12\"\n\t\t\tfill=\"none\"\n\t\t\t{...props}\n\t\t>\n\t\t\t<path\n\t\t\t\td=\"M5.148 1.884a1 1 0 0 1 1.704 0l4.21 6.842a1 1 0 0 1-.852 1.524H1.79a1 1 0 0 1-.852-1.524Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillOpacity={0.2}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n", "import \"EntityAssetRow.styles_16bb61m.wyw.css\"; export const FOLDER_COLOR = \"--entity-asset-folder-color\";\nexport const INTERACTION_BORDER_COLOR = \"--entity-asset-interaction-border-color\";\nexport const button = \"button_bxflhux\";\nexport const outline = \"outline_o1je1zhz\";\nexport const icon = \"icon_i1rdyvjx\";\nexport const blue = \"blue_b7ncebt\";\nexport const externalVectors = \"externalVectors_esuqfvg\";\nexport const vectorBadge = \"vectorBadge_vb8z7y7\";\nexport const draggedOverRow = \"draggedOverRow_dcrgoo0\";", "import engine from \"document/engine.ts\"\nimport type { CanvasNode, MaybeNodeID, NodeID } from \"document/models/CanvasTree/index.ts\"\n\ntype InsertionInfo = {\n\tparentId: NodeID\n\tposition?: number\n}\n\n/**\n * Generic utility to determine the best insertion position for a new folder\n * based on a selection of items. Works for both Pages and Assets.\n *\n * When all selected items share the same parent, creates folder at the position of the first item.\n * When items have different parents, falls back to the specified parent.\n */\nexport function getInsertionPositionForSelection<T>(\n\titems: readonly T[],\n\textractNodeId: (item: T) => NodeID | null,\n\tfallbackParentId: NodeID,\n): InsertionInfo {\n\tif (items.length === 0) {\n\t\treturn { parentId: fallbackParentId }\n\t}\n\n\tlet firstNode: CanvasNode | null = null\n\tlet firstParentId: MaybeNodeID = null\n\tlet allSameParent = true\n\n\tfor (const item of items) {\n\t\tconst nodeId = extractNodeId(item)\n\t\tif (!nodeId) continue\n\n\t\tconst node = engine.tree.get(nodeId)\n\t\tif (!node) continue\n\n\t\tif (!firstNode) {\n\t\t\tfirstNode = node\n\t\t\tfirstParentId = node.parentid\n\t\t} else {\n\t\t\tif (node.parentid !== firstParentId) {\n\t\t\t\tallSameParent = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!firstNode || !firstParentId) {\n\t\treturn { parentId: fallbackParentId }\n\t}\n\n\tif (allSameParent) {\n\t\tconst parentNode = engine.tree.get(firstParentId)\n\t\tif (parentNode?.children) {\n\t\t\tconst currentIndex = parentNode.children.findIndex(child => child.id === firstNode.id)\n\t\t\tif (currentIndex !== -1) {\n\t\t\t\treturn { parentId: firstParentId, position: currentIndex }\n\t\t\t}\n\t\t}\n\t\treturn { parentId: firstParentId }\n\t}\n\n\treturn { parentId: fallbackParentId }\n}\n", "import engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport type { EntityTypeRootId } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { buildReferenceNodeId } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\n\n/**\n * Given a set of node ids, check if any of them are unreferenced\n *\n * @param ids - The set of node ids to check\n * @param entityTypeRootId - The entity type root id to check\n * @returns True if any of the nodes are unreferenced, false otherwise\n */\nexport function hasAnyUnreferencedItems(ids: ReadonlySet<NodeID>, entityTypeRootId: EntityTypeRootId): boolean {\n\tfor (const id of ids) {\n\t\tconst referenceNodeId = buildReferenceNodeId(entityTypeRootId, id)\n\t\tconst hasReference = engine.tree.has(referenceNodeId)\n\t\tif (!hasReference) return true\n\t}\n\treturn false\n}\n", "import { assertNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport engine from \"document/engine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { EntityFolderNode } from \"document/models/CanvasTree/nodes/EntityFolderNode.ts\"\nimport {\n\tAB_TESTS_ENTITY_TYPE_ROOT_ID,\n\tBLOCKQUOTE_ENTITY_ROOT_ID,\n\tCMS_ENTITY_ROOT_ID,\n\tCODE_FILE_ENTITY_TYPE_ROOT_ID,\n\tCOLOR_ENTITY_ROOT_ID,\n\tCOMPONENTS_ENTITY_TYPE_ROOT_ID,\n\tCONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID,\n\ttype EntityTypeRootId,\n\ttype EntityTypeRootNode,\n\tFUNNELS_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\tVECTOR_SET_ENTITY_TYPE_ROOT_ID,\n\tisEntityTypeRootNode,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport { getFolderNodeByName } from \"document/models/CanvasTree/nodes/utils/entityFolderNode.ts\"\nimport { buildReferenceNodeId } from \"document/models/CanvasTree/nodes/utils/entityReferenceNode.ts\"\nimport { isEntityFolderNode, isEntityReferenceNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { uniqueName } from \"document/utils/uniqueName.ts\"\nimport { getInsertionPositionForSelection } from \"../../shared/utils/getInsertionPositionForSelection.ts\"\nimport { moveEntityNode } from \"../actions/move.ts\"\nimport { expandParentAndRenameEntity } from \"../actions/rename.ts\"\nimport { referenceUnreferencedNodesByTypeRoot } from \"../actions/utils.ts\"\nimport { getNodeName } from \"./getNodeName.ts\"\nimport { hasAnyUnreferencedItems } from \"./hasAnyUnreferencedItems.ts\"\nimport type { AssetRow } from \"./useAssetPanelEntityRows.ts\"\n\n// Helper function to check if the selection contains any folders\nexport function hasAnyFolders(ids: ReadonlySet<NodeID>) {\n\tfor (const id of ids) {\n\t\tconst node = engine.tree.get(id)\n\t\tif (isEntityFolderNode(node)) return true\n\t}\n\treturn false\n}\n\n// Helper function to check if the selection contains only folders\nexport function hasOnlyFolders(ids: ReadonlySet<NodeID>) {\n\tif (ids.size === 0) return false\n\n\tfor (const id of ids) {\n\t\tconst node = engine.tree.get(id)\n\t\tif (!isEntityFolderNode(node)) return false\n\t}\n\treturn true\n}\n\nfunction getUniqueEntityFolderName(parentNode: EntityFolderNode | EntityTypeRootNode, name: string): string {\n\tconst existingFolderNode = getFolderNodeByName(parentNode, name)\n\tif (!existingFolderNode) return name\n\n\tconst existingNames = new Set<string>()\n\tfor (const child of parentNode.children) {\n\t\texistingNames.add(getNodeName(child))\n\t}\n\n\treturn uniqueName(name, existingNames)\n}\n\nexport function getReferenceNodeIdFromSelectedId(selectedId: NodeID, typeRootId: EntityTypeRootId): NodeID {\n\tconst node = engine.tree.get(selectedId)\n\n\tif (isEntityFolderNode(node)) {\n\t\treturn selectedId\n\t}\n\n\tif (isEntityReferenceNode(node)) {\n\t\treturn node.referenceId\n\t}\n\n\treturn buildReferenceNodeId(typeRootId, selectedId)\n}\n\n/**\n * Creates a function that returns node IDs in their render order.\n * This is used to maintain visual order during drag and drop operations.\n *\n * @param rows - The array of asset rows in their current render order\n * @returns Function that takes a set of selected IDs and returns them ordered by their appearance in rows\n */\nexport function createRenderOrderedGetter(rows: readonly AssetRow[]): (selectedIds: ReadonlySet<NodeID>) => NodeID[] {\n\treturn (selectedIds: ReadonlySet<NodeID>) => {\n\t\tconst orderedIds: NodeID[] = []\n\t\tfor (const row of rows) {\n\t\t\tif (selectedIds.has(row.id)) orderedIds.push(row.id)\n\t\t}\n\t\treturn orderedIds\n\t}\n}\n\n/**\n * Creates a reusable folder creation handler configured with specific callbacks and entity type.\n * Returns a function that can be called with selected node IDs to create folders and clear selection.\n */\nexport function createFolderFromSelection(onClearSelection: () => void, entityTypeRootId: EntityTypeRootId) {\n\treturn (nodeIds: ReadonlySet<NodeID>) => {\n\t\tif (nodeIds.size === 0) return\n\n\t\t// Reference unreferenced items before moving the selection to the new folder\n\t\tif (hasAnyUnreferencedItems(nodeIds, entityTypeRootId)) {\n\t\t\treferenceUnreferencedNodesByTypeRoot(engine, entityTypeRootId)\n\t\t}\n\n\t\t// Determine target parent and position: creates folder at the position of first selected item when possible\n\t\tconst insertionInfo = getInsertionPositionForSelection(\n\t\t\tArray.from(nodeIds),\n\t\t\tselectedId => getReferenceNodeIdFromSelectedId(selectedId, entityTypeRootId),\n\t\t\tentityTypeRootId,\n\t\t)\n\t\tconst targetParentNode = engine.tree.get(insertionInfo.parentId)\n\t\tif (!targetParentNode || (!isEntityFolderNode(targetParentNode) && !isEntityTypeRootNode(targetParentNode))) {\n\t\t\treturn\n\t\t}\n\n\t\tconst folderName = getUniqueEntityFolderName(targetParentNode, Dictionary.NewFolder)\n\t\tconst newFolderId = engine.tree.insertNode(\n\t\t\tnew EntityFolderNode({ name: folderName }),\n\t\t\tinsertionInfo.parentId,\n\t\t\tinsertionInfo.position,\n\t\t).id\n\n\t\tlet position = 0\n\t\tfor (const selectedId of nodeIds) {\n\t\t\tconst entityId = getReferenceNodeIdFromSelectedId(selectedId, entityTypeRootId)\n\t\t\tvoid moveEntityNode(engine, {\n\t\t\t\tentityId,\n\t\t\t\tnewParentId: newFolderId,\n\t\t\t\ttypeRootId: entityTypeRootId,\n\t\t\t\tpositionInParent: position,\n\t\t\t})\n\t\t\tposition++\n\t\t}\n\n\t\tonClearSelection()\n\n\t\t// Highlight the new folder for renaming\n\t\tengine.scheduler.runAtEndOfFrame(() =>\n\t\t\texpandParentAndRenameEntity(engine, insertionInfo.parentId, newFolderId, false),\n\t\t)\n\t}\n}\n\n/**\n * Converts EntityTypeRootId to a simple asset section string for tracking purposes\n */\nexport function getAssetSectionForTracking(typeRootId: EntityTypeRootId): string {\n\tswitch (typeRootId) {\n\t\tcase INLINE_CODE_ENTITY_ROOT_ID:\n\t\tcase COLOR_ENTITY_ROOT_ID:\n\t\tcase TEXT_ENTITY_ROOT_ID:\n\t\tcase CMS_ENTITY_ROOT_ID:\n\t\tcase BLOCKQUOTE_ENTITY_ROOT_ID:\n\t\tcase LINK_ENTITY_ROOT_ID:\n\t\t\treturn \"styles\"\n\t\tcase CODE_FILE_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn \"code_files\"\n\t\tcase COMPONENTS_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn \"components\"\n\t\tcase LAYOUT_TEMPLATE_ENTITY_ROOT_ID:\n\t\t\treturn \"templates\"\n\t\tcase VECTOR_SET_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn \"vector_sets\"\n\t\tcase FUNNELS_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn \"funnels\"\n\t\tcase AB_TESTS_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn \"ab_tests\"\n\t\tcase CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn \"collections\"\n\t\tdefault:\n\t\t\tassertNever(typeRootId)\n\t}\n}\n", "import {\n\tIconAssetsCodeFile,\n\tIconEntityFolder,\n\tIconLayerComponent,\n\tIconLayerVector,\n\tIconLayoutTemplate,\n\tIconSidebarCollection,\n} from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { assertNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport {\n\tAB_TESTS_ENTITY_TYPE_ROOT_ID,\n\tBLOCKQUOTE_ENTITY_ROOT_ID,\n\tCMS_ENTITY_ROOT_ID,\n\tCODE_FILE_ENTITY_TYPE_ROOT_ID,\n\tCOLOR_ENTITY_ROOT_ID,\n\tCOMPONENTS_ENTITY_TYPE_ROOT_ID,\n\tCONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID,\n\ttype EntityTypeRootId,\n\tFUNNELS_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\tVECTOR_SET_ENTITY_TYPE_ROOT_ID,\n} from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport type { ReactNode } from \"react\"\nimport { IconAgentCMS } from \"../../agentPanel/components/IconAgentCMS.tsx\"\nimport { IconAgentCode } from \"../../agentPanel/components/IconAgentCode.tsx\"\nimport { IconAgentComponent } from \"../../agentPanel/components/IconAgentComponent.tsx\"\nimport { IconAgentVectorSet } from \"../../agentPanel/components/IconAgentVectorSet.tsx\"\nimport { IconABTest, IconFunnel } from \"../../analytics/icons.tsx\"\nimport { PresetIcon } from \"../../presetsPanel/PresetIcon.tsx\"\nimport * as assetRowStyles from \"../EntityAssetRow.styles.ts\"\nimport { IconAgentAssetLayoutTemplate } from \"../IconAgentAssetLayoutTemplate.tsx\"\nimport { hasOnlyFolders } from \"./multiselect.ts\"\n\nexport function getAssetTypePluralName(typeRootId: EntityTypeRootId): string {\n\tswitch (typeRootId) {\n\t\tcase INLINE_CODE_ENTITY_ROOT_ID:\n\t\tcase BLOCKQUOTE_ENTITY_ROOT_ID:\n\t\tcase COLOR_ENTITY_ROOT_ID:\n\t\tcase LINK_ENTITY_ROOT_ID:\n\t\tcase TEXT_ENTITY_ROOT_ID:\n\t\tcase CMS_ENTITY_ROOT_ID:\n\t\t\treturn Dictionary.Styles\n\t\tcase CODE_FILE_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn Dictionary.CodeFiles\n\t\tcase COMPONENTS_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn Dictionary.Components\n\t\tcase LAYOUT_TEMPLATE_ENTITY_ROOT_ID:\n\t\t\treturn Dictionary.Templates\n\t\tcase VECTOR_SET_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn Dictionary.VectorSets\n\t\tcase FUNNELS_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn Dictionary.Funnels\n\t\tcase AB_TESTS_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn Dictionary.AbTests\n\t\tcase CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn Dictionary.Collections\n\t\tdefault:\n\t\t\tassertNever(typeRootId)\n\t}\n}\n\n/**\n * Gets a simplified icon for an asset type (used for drag previews)\n *\n * NOTE: This does NOT replace getIconForEntityReferenceItem() in EntityAssetRow.tsx,\n * which handles specific node cases (text style tags, CMS types, etc.).\n * These are simplified versions specifically for drag preview scenarios.\n */\nexport function getIconForAssetType(\n\ttypeRootId: EntityTypeRootId,\n\tselectedIds?: ReadonlySet<NodeID>,\n\t{ agentExperimentEnabled = false }: { agentExperimentEnabled?: boolean } = {},\n): ReactNode {\n\tif (selectedIds && hasOnlyFolders(selectedIds)) {\n\t\treturn <IconEntityFolder />\n\t}\n\n\tswitch (typeRootId) {\n\t\tcase INLINE_CODE_ENTITY_ROOT_ID:\n\t\tcase BLOCKQUOTE_ENTITY_ROOT_ID:\n\t\tcase COLOR_ENTITY_ROOT_ID:\n\t\tcase LINK_ENTITY_ROOT_ID:\n\t\tcase TEXT_ENTITY_ROOT_ID:\n\t\tcase CMS_ENTITY_ROOT_ID:\n\t\t\treturn <PresetIcon icon=\"s\" color={colors.presetIcon} />\n\t\tcase CODE_FILE_ENTITY_TYPE_ROOT_ID:\n\t\t\tif (agentExperimentEnabled) return <IconAgentCode style={{ color: colors.assetCodeFileIcon }} />\n\t\t\treturn <IconAssetsCodeFile style={{ color: colors.assetCodeFileIcon }} />\n\t\tcase COMPONENTS_ENTITY_TYPE_ROOT_ID:\n\t\t\tif (agentExperimentEnabled) return <IconAgentComponent style={{ color: colors.assetComponentIcon }} />\n\t\t\treturn <IconLayerComponent color={colors.assetComponentIcon} />\n\t\tcase LAYOUT_TEMPLATE_ENTITY_ROOT_ID:\n\t\t\tif (agentExperimentEnabled) return <IconAgentAssetLayoutTemplate style={{ color: colors.assetComponentIcon }} />\n\t\t\treturn <IconLayoutTemplate style={{ color: colors.assetComponentIcon }} />\n\t\tcase VECTOR_SET_ENTITY_TYPE_ROOT_ID:\n\t\t\tif (agentExperimentEnabled) return <IconAgentVectorSet className={assetRowStyles.blue} />\n\t\t\treturn <IconLayerVector className={assetRowStyles.blue} />\n\t\tcase FUNNELS_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn <IconFunnel />\n\t\tcase AB_TESTS_ENTITY_TYPE_ROOT_ID:\n\t\t\treturn <IconABTest />\n\t\tcase CONTENT_MANAGEMENT_ENTITY_TYPE_ROOT_ID:\n\t\t\tif (agentExperimentEnabled) return <IconAgentCMS />\n\t\t\treturn <IconSidebarCollection />\n\t\tdefault:\n\t\t\tassertNever(typeRootId)\n\t}\n}\n", "import type { ComponentLoader } from \"@framerjs/framer-runtime\"\nimport type { LocalModuleId } from \"@framerjs/shared\"\nimport { ModuleType, isLocalModuleIdentifier, parseModuleIdentifier } from \"@framerjs/shared\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\n\nexport interface ModuleInfo {\n\tname: string\n\tmoduleIdentifier: string\n\ttype: ModuleType.Code | ModuleType.Canvas\n}\n\nexport type LocalModuleIdToExportedModulesMap = Map<LocalModuleId | NodeID, ModuleInfo[]>\n\nexport function getModulesMap(componentLoader: ComponentLoader): LocalModuleIdToExportedModulesMap {\n\tconst definitions = componentLoader.getAllLocalModules()\n\tconst exportedModulesMap: LocalModuleIdToExportedModulesMap = new Map()\n\n\tfor (const definition of definitions) {\n\t\tif (definition.type !== \"component\") continue\n\t\tconst moduleIdentifier = parseModuleIdentifier(definition.identifier)\n\t\tif (!moduleIdentifier) continue\n\n\t\tif (!isLocalModuleIdentifier(moduleIdentifier)) continue\n\t\tif (moduleIdentifier.type !== ModuleType.Code && moduleIdentifier.type !== ModuleType.Canvas) continue\n\n\t\tconst id = moduleIdentifier.type === ModuleType.Code ? moduleIdentifier.localId : moduleIdentifier.localIdName\n\n\t\t// We don't want to override any existing value added to the modules array\n\t\t// for the same localId. We only want to add the latest one.\n\t\tconst valueForModuleId = exportedModulesMap.get(id) ?? []\n\t\tvalueForModuleId.push({\n\t\t\tname: definition.name,\n\t\t\tmoduleIdentifier: moduleIdentifier.value,\n\t\t\ttype: moduleIdentifier.type,\n\t\t})\n\n\t\texportedModulesMap.set(id, valueForModuleId)\n\t}\n\n\treturn exportedModulesMap\n}\n", "import { Fragment, type ReactNode } from \"react\"\n\nexport function enumerate(names: readonly ReactNode[]): ReactNode {\n\tif (names.length === 0) return \"\"\n\tif (names.length === 1) return names[0]\n\treturn (\n\t\t<>\n\t\t\t{names.slice(0, -2).map((name, index) => (\n\t\t\t\t<Fragment key={index}>{name}, </Fragment>\n\t\t\t))}\n\t\t\t{names.at(-2)} and {names.at(-1)}\n\t\t</>\n\t)\n}\n", "import type { ConfirmationModalConfirmationButtonVariant } from \"@framerjs/fresco/components/ConfirmationModal\"\nimport { assert } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { enumerate } from \"document/components/utils/enumerate.tsx\"\nimport { getMetricsInteractionSourceForScopeType } from \"document/components/utils/getMetricsInteractionSourceForScopeType.ts\"\nimport type { AnyWebPageNode, CollectionNode, NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport { isCollectionItemNode, isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { getPersistedOrTemporaryCollectionItemById } from \"document/utils/contentManagementOverlayStack.ts\"\nimport pluralize from \"pluralize\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getCollectionsReferencingCollection } from \"./getCollectionsReferencingCollection.ts\"\n\nfunction getDetailPageForCollection(engine: VekterEngine, collectionId: NodeID): AnyWebPageNode | undefined {\n\tif (engine.stores.contentManagementStore.hasActivePrivateDraftCollectionItem()) return undefined\n\n\tconst collection = engine.tree.getNode<CollectionNode>(collectionId)\n\tassert(isCollectionNode(collection), \"Collection should exist\")\n\treturn engine.stores.scopeStore\n\t\t.getWebPageNodes()\n\t\t.find(webPage => webPage.dataIdentifier === collection.instanceIdentifier)\n}\n\nexport function canViewCollectionOnCanvas(engine: VekterEngine, collectionId: NodeID): boolean {\n\tconst detailPage = getDetailPageForCollection(engine, collectionId)\n\treturn Boolean(detailPage)\n}\n\nexport function viewCollectionOnCanvas(engine: VekterEngine, collectionId: NodeID, collectionItemId: string) {\n\tconst detailPage = getDetailPageForCollection(engine, collectionId)\n\tif (!detailPage) return\n\n\tengine.stores.scopeStore.select(detailPage.id, { keepHistory: false, collectionItemId })\n}\n\nexport function deleteCollectionItemsWithConfirmation(\n\tengine: VekterEngine,\n\tcollectionItemIds: readonly NodeID[],\n\tsource: \"collection_table\" | \"collection_record_menu\" | \"context_menu\" | \"toolbar\",\n) {\n\tif (collectionItemIds.length === 0) return\n\tconst collectionItems = engine.tree.getNodes(collectionItemIds)\n\tconst parentId = collectionItems[0]?.parentid\n\tassert(parentId, \"Attempt to delete CollectionItemNode without parent\")\n\tassert(\n\t\tcollectionItems.every(item => item.parentid === parentId),\n\t\t\"Attempt to delete CollectionItemNodes from different CollectionNodes at once\",\n\t)\n\n\tconst deleteCollectionItems = engine.scheduler.wrapHandler(() => {\n\t\tengine.deleteNodes(collectionItemIds)\n\n\t\t// The selection will fall back to the parent collection if one of these items is selected\n\n\t\trecord(\"collection_record_delete\", {\n\t\t\tsource:\n\t\t\t\tsource === \"collection_record_menu\"\n\t\t\t\t\t? source\n\t\t\t\t\t: getMetricsInteractionSourceForScopeType(engine.stores.scopeStore.scopeType),\n\t\t})\n\t})\n\n\tconst collection = engine.tree.getNodeWithTrait(parentId, isCollectionNode)\n\tconst allCollections = getContentManagementNode(engine.tree)?.loaded?.children\n\tconst referencingCollections = getCollectionsReferencingCollection(allCollections, collection)\n\n\tconst modal = {\n\t\ttype: ModalType.ConfirmDeleteCollectionItems,\n\t\tvariant: \"destructive\",\n\t\tconfirmLabel: Dictionary.Delete,\n\t\tonConfirm: deleteCollectionItems,\n\t\tsource,\n\t} as const\n\n\tif (referencingCollections.length > 0) {\n\t\tconst count = collectionItems.length\n\t\tengine.stores.modalStore.set({\n\t\t\t...modal,\n\t\t\ttitle: `${Dictionary.Delete} ${count > 1 ? `${count} ${Dictionary.Items}` : Dictionary.Item}`,\n\t\t\tdescription: (\n\t\t\t\t<>\n\t\t\t\t\t{pluralize(\"This\", collectionItemIds.length)} {pluralize(\"item\", collectionItemIds.length)} will be also\n\t\t\t\t\tdeleted from references in the{\" \"}\n\t\t\t\t\t{enumerate(\n\t\t\t\t\t\treferencingCollections.map(collection => (\n\t\t\t\t\t\t\t<strong key={collection.id}>{collection.resolveValue(\"name\")}</strong>\n\t\t\t\t\t\t)),\n\t\t\t\t\t)}{\" \"}\n\t\t\t\t\t{pluralize(\"collection\", referencingCollections.length)}.\n\t\t\t\t</>\n\t\t\t),\n\t\t})\n\t} else if (collectionItems.length > 1) {\n\t\tengine.stores.modalStore.set({\n\t\t\t...modal,\n\t\t\ttitle: \"Delete Items\",\n\t\t\tdescription: `You are about to delete ${collectionItems.length} items.`,\n\t\t})\n\t} else {\n\t\tdeleteCollectionItems()\n\t}\n}\n\ntype NewStatusOrLoopStatusMap = true | undefined | Map<NodeID, true | undefined>\n\nexport function setCollectionItemsStatusWithConfirmation(\n\tengine: VekterEngine,\n\tcollectionItemIds: readonly NodeID[],\n\tnewDraftStatusOrLookup: NewStatusOrLoopStatusMap,\n\tsource: \"collection_table\" | \"collection_item_overlay\",\n\toptions?: {\n\t\tconfirmedAction?: () => void\n\t},\n) {\n\tconst collectionItemIdsRequiringDraftStatusChange = collectionItemIds.filter(id => {\n\t\tconst node = getPersistedOrTemporaryCollectionItemById({\n\t\t\ttreeStore: engine.stores.treeStore,\n\t\t\tcontentManagementStore: engine.stores.contentManagementStore,\n\t\t\titemId: id,\n\t\t})\n\t\tif (!node) return false\n\n\t\treturn node.isDraft !== resolveNextStatusValue(node.id, newDraftStatusOrLookup)\n\t})\n\tif (collectionItemIdsRequiringDraftStatusChange.length === 0) return\n\n\tconst collectionItemIdsRequiringConfirmation = collectionItemIdsRequiringDraftStatusChange.filter(id => {\n\t\tconst node = engine.tree.getNodeWithTrait(id, isCollectionItemNode)\n\t\treturn node && !node.privateToUserId\n\t})\n\n\tconst setDraftStatus = engine.scheduler.wrapHandler(() => {\n\t\toptions?.confirmedAction?.()\n\n\t\tconst recordValueFor = new Set<\"collection_record_draft\" | \"collection_record_undraft\">()\n\n\t\tif (newDraftStatusOrLookup === true) recordValueFor.add(\"collection_record_draft\")\n\t\tif (newDraftStatusOrLookup === undefined) recordValueFor.add(\"collection_record_undraft\")\n\n\t\tlet updatedTemporaryCollectionItem = false\n\t\tfor (const id of collectionItemIdsRequiringDraftStatusChange) {\n\t\t\tconst node = getPersistedOrTemporaryCollectionItemById({\n\t\t\t\ttreeStore: engine.stores.treeStore,\n\t\t\t\tcontentManagementStore: engine.stores.contentManagementStore,\n\t\t\t\titemId: id,\n\t\t\t})\n\t\t\tif (!node) continue\n\n\t\t\tconst nextStatus = resolveNextStatusValue(node.id, newDraftStatusOrLookup)\n\t\t\trecordValueFor.add(nextStatus === true ? \"collection_record_draft\" : \"collection_record_undraft\")\n\n\t\t\tnode.set({ isDraft: resolveNextStatusValue(node.id, newDraftStatusOrLookup) })\n\t\t\tconst isTemporaryItem = !engine.tree.has(id)\n\t\t\tif (isTemporaryItem) {\n\t\t\t\tupdatedTemporaryCollectionItem = true\n\t\t\t}\n\t\t}\n\n\t\tfor (const track of recordValueFor) {\n\t\t\trecord(track, {\n\t\t\t\tsource: getMetricsInteractionSourceForScopeType(engine.stores.scopeStore.scopeType),\n\t\t\t})\n\t\t}\n\n\t\tif (updatedTemporaryCollectionItem) {\n\t\t\tengine.stores.contentManagementStore.didUpdateTemporaryCollectionItem()\n\t\t}\n\t})\n\n\tif (collectionItemIdsRequiringConfirmation.length === 0) {\n\t\tsetDraftStatus()\n\t\treturn\n\t}\n\n\tengine.stores.modalStore.set({\n\t\t...getConfirmationModalDetails(newDraftStatusOrLookup, collectionItemIdsRequiringConfirmation),\n\t\ttype: ModalType.ConfirmCollectionItemStatusChange,\n\t\tconfirmLabel: Dictionary.Confirm,\n\t\tonConfirm: setDraftStatus,\n\t\tsource,\n\t})\n}\n\nfunction resolveNextStatusValue(nodeId: NodeID, newStatusOrLookup: NewStatusOrLoopStatusMap) {\n\tif (newStatusOrLookup instanceof Map) return newStatusOrLookup.get(nodeId) ?? undefined\n\treturn newStatusOrLookup\n}\n\ninterface ConfirmationDetails {\n\ttitle: string\n\tdescription: string\n\tvariant: ConfirmationModalConfirmationButtonVariant\n}\n\nfunction getConfirmationModalDetails(\n\tnewDraftStatusOrLookup: NewStatusOrLoopStatusMap,\n\teffectedNodeIds: readonly string[],\n) {\n\tif (newDraftStatusOrLookup === true) {\n\t\treturn toDraftConfirmationDetails(effectedNodeIds.length > 1, effectedNodeIds.length)\n\t}\n\n\tif (newDraftStatusOrLookup === undefined) {\n\t\treturn toLiveConfirmationDetails(effectedNodeIds.length > 1, effectedNodeIds.length)\n\t}\n\n\tlet toDraft = 0\n\tlet toLive = 0\n\tfor (const id of effectedNodeIds) {\n\t\tif (resolveNextStatusValue(id, newDraftStatusOrLookup) === true) {\n\t\t\ttoDraft++\n\t\t} else {\n\t\t\ttoLive++\n\t\t}\n\t}\n\n\tif (toLive === 0) {\n\t\treturn toDraftConfirmationDetails(toDraft > 1, toDraft)\n\t}\n\n\tif (toDraft === 0) {\n\t\treturn toLiveConfirmationDetails(toLive > 1, toLive)\n\t}\n\n\treturn toCombinedChangeConfirmationDetails(toDraft, toLive)\n}\n\nfunction toDraftConfirmationDetails(isMultiSelection: boolean, selectionCount: number): ConfirmationDetails {\n\treturn {\n\t\tvariant: \"destructive\",\n\t\ttitle: isMultiSelection ? \"Mark Items as Draft\" : Dictionary.MarkAsDraft,\n\t\tdescription: isMultiSelection\n\t\t\t? `${selectionCount} items will be removed from your website after you publish your changes.`\n\t\t\t: \"This item will be removed from your website after you publish your changes.\",\n\t}\n}\n\nfunction toLiveConfirmationDetails(isMultiSelection: boolean, selectionCount: number): ConfirmationDetails {\n\treturn {\n\t\tvariant: \"primary\",\n\t\ttitle: isMultiSelection ? \"Mark Items as Live\" : Dictionary.MarkAsLive,\n\t\tdescription: isMultiSelection\n\t\t\t? `${selectionCount} items will be added to your website after you publish your changes.`\n\t\t\t: \"This item will be added to your website after you publish your changes.\",\n\t}\n}\n\nfunction toCombinedChangeConfirmationDetails(draftCount: number, liveCount: number): ConfirmationDetails {\n\treturn {\n\t\tvariant: \"destructive\",\n\t\ttitle: \"Change Status of Items\",\n\t\tdescription: `${liveCount} ${liveCount === 1 ? \"item\" : \"items\"} will be added to and ${draftCount} ${draftCount === 1 ? \"item\" : \"items\"} will be removed from your website after you publish your changes.`,\n\t}\n}\n", "import type { CollectionNode } from \"document/models/CanvasTree/index.ts\"\nimport type { ReadonlyChildList } from \"document/models/CanvasTree/nodes/ChildList.ts\"\nimport { isAnyCollectionReferencingVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\n\nexport function getCollectionsReferencingCollection(\n\tcollectionNodes: ReadonlyChildList<CollectionNode> | undefined,\n\tcollection: CollectionNode | null,\n): CollectionNode[] {\n\tif (!collectionNodes || !collection) return []\n\treturn collectionNodes.filter(potentiallyReferencingCollection => {\n\t\treturn potentiallyReferencingCollection.variables.some(\n\t\t\tvariable =>\n\t\t\t\tisAnyCollectionReferencingVariableDefinition(variable) &&\n\t\t\t\tvariable.dataIdentifier === collection.instanceIdentifier,\n\t\t)\n\t})\n}\n", "import { unhandledError } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { useEngineState } from \"document/useEngineState.ts\"\nimport { assert } from \"library/utils/assert.ts\"\nimport { getSelectedCollectionId } from \"utils/collectionUtils.ts\"\nimport { createCollectionItem } from \"utils/createCollectionItem.ts\"\nimport { Pages } from \"web/lib/tracker.ts\"\nimport { closeCollectionItems } from \"./closeCollectionItems.tsx\"\n\nexport function useHasNewCollectionItemOverlayOpen(engine: VekterEngine) {\n\treturn useEngineState(\n\t\t() => {\n\t\t\treturn engine.stores.contentManagementStore.hasAnyPrivateDraftCollectionItem()\n\t\t},\n\t\t[],\n\t\t// We need to listen to chromeStore here because the private draft state is derived from\n\t\t// chromeStore.contentManagementOverlayStack.\n\t\t[engine.stores.chromeStore],\n\t)\n}\n\nexport async function handleCreateCollectionItem(engine: VekterEngine) {\n\tconst { userKeptEditing } = await closeCollectionItems({ engine, target: \"all\" })\n\tif (userKeptEditing) return\n\n\tengine.scheduler.processWhenReady(() => {\n\t\tconst collectionId = getSelectedCollectionId(engine)\n\t\tassert(collectionId, \"Collection needs to be selected to allow creation of new item\")\n\t\t// Enforce that the collection is selected so the new item is created at the root of the overlay stack\n\t\tengine.stores.contentManagementStore.clearOverlayStack()\n\t\tcreateCollectionItem({\n\t\t\tcollectionId,\n\t\t\tengine,\n\t\t\tsource: Pages.toolbar,\n\t\t})\n\t})\n}\n\nexport function dismissCreateCollectionItem(engine: VekterEngine) {\n\tengine.scheduler.processWhenReady(() => {\n\t\tcloseCollectionItems({\n\t\t\tengine,\n\t\t\ttarget: \"all\",\n\t\t}).catch(unhandledError)\n\t})\n}\n", "import { collapsedViewBreakpoint } from \"utils/chromeBreakpoints.ts\"\nimport { useMediaQuery } from \"utils/useMediaQuery.ts\"\n\nconst greaterThanCollapsedViewWidth = `(min-width: ${collapsedViewBreakpoint + 1}px)`\n\n// Re-use of the same media query as our general \"collapsed view\", but seperate fns/hooks to allow\n// for a clear view of which functions can be removed as/when we make more features available.\n\n/** Localization currently is not responsive and the user will get stuck there on mobile */\nexport function isLocalizationNavigableInScreen() {\n\treturn window.matchMedia(greaterThanCollapsedViewWidth).matches\n}\n\n/** Restricting the use of field editing due to screen size & design limitations */\nexport function isEditFieldsUseableInScreen() {\n\treturn window.matchMedia(greaterThanCollapsedViewWidth).matches\n}\n\n/** Restricting the use of field editing due to screen size & design limitations */\nexport function useIsEditFieldsUseableInScreen() {\n\treturn useMediaQuery(greaterThanCollapsedViewWidth)\n}\n", "import { assert, unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { NodeID } from \"document/models/CanvasTree/index.ts\"\nimport { CONTENT_MANAGEMENT_ID } from \"document/models/CanvasTree/nodes/ContentManagementNode.ts\"\nimport { isCollectionItemNode, isCollectionNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isRichTextVariableDefinition } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { ActiveMainView, CollectionPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { cmsSchemaParams, makeSchema } from \"prosemirror/schema/index.ts\"\nimport { parseRichText } from \"prosemirror/serialization/dom.ts\"\nimport { serializeRichTextToMarkdown } from \"prosemirror/serialization/markdown.ts\"\nimport { copyText } from \"utils/clipboard/index.ts\"\nimport { isEmptyRichTextValue } from \"utils/isEmptyRichTextValue.ts\"\nimport { isString } from \"utils/typeChecks.ts\"\nimport { setViewParamsInURL } from \"utils/urlParams.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { performLocaleScopeFilterAction } from \"../../QuickActions/utils/useLocaleScopeFilterQuickActions.ts\"\nimport { openAnalyticsFromCurrentlySelectedItem } from \"../../analytics/utils/openAnalytics.ts\"\nimport { closeCollectionItems } from \"./closeCollectionItems.tsx\"\nimport {\n\tcanViewCollectionOnCanvas,\n\tdeleteCollectionItemsWithConfirmation,\n\tsetCollectionItemsStatusWithConfirmation,\n\tviewCollectionOnCanvas,\n} from \"./contentManagementActions.tsx\"\nimport { handleCreateCollectionItem } from \"./handleCreateCollectionItem.ts\"\nimport { saveActivePrivateDraftCollectionItem } from \"./saveActivePrivateDraftCollectionItem.ts\"\nimport { isEditFieldsUseableInScreen, isLocalizationNavigableInScreen } from \"./screenFeatureUtils.ts\"\n\ninterface CollectionItemMenuOptions {\n\tengine: VekterEngine\n\tcollectionId: NodeID\n\tcollectionItemId: NodeID\n\ttrackingPage: \"collection_record_menu\" | \"context_menu\"\n}\n\nfunction saveItemShouldBeVisible(trackingPage: CollectionItemMenuOptions[\"trackingPage\"]): boolean {\n\tswitch (trackingPage) {\n\t\tcase \"collection_record_menu\":\n\t\t\treturn false\n\t\tcase \"context_menu\":\n\t\t\treturn true\n\t}\n}\n\nexport function getCollectionItemMenuOptions({\n\tengine,\n\tcollectionId,\n\tcollectionItemId,\n\ttrackingPage,\n}: CollectionItemMenuOptions): MenuItemOptions[] {\n\tconst collection = engine.tree.get(collectionId)\n\tconst isManagedByPlugin = isCollectionNode(collection) && Boolean(collection.managedByPlugin)\n\n\tconst { chromeStore, contentManagementStore, selectionStore, documentSettingsStore, scopeStore } = engine.stores\n\n\tconst dataIsViewOnly = getIsViewOnly(engine, \"canEditContent\") || isManagedByPlugin\n\tconst variablesIsViewOnly = getIsViewOnly(engine, \"canEditVariables\") || isManagedByPlugin\n\tconst inCMS = chromeStore.mainView === ActiveMainView.ContentManagement\n\tconst canViewInLocalization = Boolean(engine.tree.root.locales && engine.tree.root.locales.length > 0)\n\tconst canViewOnCanvas = canViewCollectionOnCanvas(engine, collectionId)\n\tconst hasActivePrivateDraftCollectionItem = contentManagementStore.hasActivePrivateDraftCollectionItem()\n\tconst hasNewCollectionItemOverlayOpen = contentManagementStore.hasAnyPrivateDraftCollectionItem()\n\tconst isDraft = engine.tree.getNodeWithTrait(collectionItemId, isCollectionItemNode)?.isDraft\n\n\tconst menuOptions: MenuItemOptions[] = [\n\t\t{\n\t\t\tlabel: Dictionary.Save,\n\t\t\tvisible: saveItemShouldBeVisible(trackingPage) && hasActivePrivateDraftCollectionItem,\n\t\t\tclick: () => saveActivePrivateDraftCollectionItem(engine),\n\t\t},\n\t\t{\n\t\t\ttype: \"separator\",\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.NewItem,\n\t\t\trole: \"newCollectionItem\",\n\t\t\tvisible: inCMS,\n\t\t\tenabled: !hasNewCollectionItemOverlayOpen,\n\t\t\tclick: () => handleCreateCollectionItem(engine),\n\t\t},\n\t\t{\n\t\t\tlabel: isDraft ? Dictionary.Undraft + \" Item\" : Dictionary.Draft + \" Item\",\n\t\t\trole: isDraft ? \"undraftCollectionItem\" : \"draftCollectionItem\",\n\t\t\tvisible: inCMS,\n\t\t\tenabled: !hasNewCollectionItemOverlayOpen,\n\t\t\tclick: () => {\n\t\t\t\tsetCollectionItemsStatusWithConfirmation(\n\t\t\t\t\tengine,\n\t\t\t\t\t[collectionItemId],\n\t\t\t\t\tisDraft ? undefined : true,\n\t\t\t\t\t\"collection_table\",\n\t\t\t\t)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: \"separator\",\n\t\t},\n\t\t{\n\t\t\tlabel: \"Open in CMS\",\n\t\t\tvisible: !inCMS,\n\t\t\tclick: () => {\n\t\t\t\tscopeStore.select(CONTENT_MANAGEMENT_ID, { keepHistory: false })\n\t\t\t\tselectionStore.set(collectionItemId)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: canViewOnCanvas ? \"Open in Canvas\" : \"Open in Canvas (not used)\",\n\t\t\tenabled: canViewOnCanvas,\n\t\t\tvisible: inCMS,\n\t\t\tclick: () => viewCollectionOnCanvas(engine, collectionId, collectionItemId),\n\t\t},\n\t\t{\n\t\t\tlabel: \"Open in Localization\",\n\t\t\tenabled: canViewInLocalization,\n\t\t\tvisible: inCMS && isLocalizationNavigableInScreen(),\n\t\t\tclick: () => {\n\t\t\t\tchromeStore.setLocalizationsVisible(true)\n\t\t\t\tperformLocaleScopeFilterAction(collectionItemId)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"View Analytics\",\n\t\t\tenabled: canViewOnCanvas,\n\t\t\tclick: () => {\n\t\t\t\topenAnalyticsFromCurrentlySelectedItem(engine)\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\ttype: \"separator\",\n\t\t},\n\t\t{\n\t\t\tlabel: variablesIsViewOnly ? Dictionary.ViewFields : Dictionary.EditFields,\n\t\t\trole: \"editFields\",\n\t\t\tenabled: true,\n\t\t\tvisible: isEditFieldsUseableInScreen() && chromeStore.activeCollectionPanelTab !== CollectionPanelTab.Fields,\n\t\t\tclick: () => {\n\t\t\t\tif (!inCMS) {\n\t\t\t\t\tscopeStore.select(CONTENT_MANAGEMENT_ID, { keepHistory: false })\n\t\t\t\t\tselectionStore.set(collectionItemId)\n\t\t\t\t}\n\n\t\t\t\trecord(\"ui_interaction\", { id: \"edit_collection_variables\", page: trackingPage })\n\t\t\t\tchromeStore.activeCollectionPanelTab = CollectionPanelTab.Fields\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.CopyLink,\n\t\t\trole: \"copyLinkToCollectionItem\",\n\t\t\tenabled: contentManagementStore.isActiveCollectionItemSelected(),\n\t\t\tvisible: inCMS,\n\t\t\tclick: () => {\n\t\t\t\tconst activeNodeId = documentSettingsStore.activeNode?.id\n\t\t\t\tassert(activeNodeId, \"Expected active node when a collection (item) is selected\")\n\t\t\t\tconst shareURL = new URL(window.location.href)\n\t\t\t\tshareURL.search = \"\"\n\t\t\t\tsetViewParamsInURL(shareURL, { nodeId: activeNodeId })\n\t\t\t\tcopyText(shareURL.href).catch(unhandledError)\n\t\t\t\trecord(\"ui_interaction\", { id: \"copy_collection_record_link\", page: trackingPage })\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: \"Copy as Markdown\",\n\t\t\trole: \"copyCollectionItemAsMarkdown\",\n\t\t\tenabled: true,\n\t\t\tvisible: inCMS,\n\t\t\tclick: () => {\n\t\t\t\tconst itemNode = engine.tree.getNodeWithTrait(collectionItemId, isCollectionItemNode)\n\t\t\t\tassert(itemNode, \"Expected active collection item node\")\n\n\t\t\t\tconst collectionNode = engine.tree.get(collectionId)\n\t\t\t\tassert(isCollectionNode(collectionNode), \"Expected parent collection node\")\n\n\t\t\t\tconst richTextVariables = collectionNode.variables.filter(isRichTextVariableDefinition)\n\n\t\t\t\tconst markdownParts: string[] = []\n\t\t\t\tfor (const variable of richTextVariables) {\n\t\t\t\t\tconst controlProp = itemNode.getControlProp(variable.id)\n\t\t\t\t\tif (controlProp?.type !== ControlType.RichText) continue\n\t\t\t\t\tconst html = controlProp.value\n\t\t\t\t\tif (!isString(html)) continue\n\t\t\t\t\tif (isEmptyRichTextValue(html)) continue\n\n\t\t\t\t\tconst schema = makeSchema(cmsSchemaParams)\n\t\t\t\t\tconst doc = parseRichText(html, schema)\n\t\t\t\t\tconst markdown = serializeRichTextToMarkdown(doc, engine, schema)\n\t\t\t\t\tif (markdown.trim() !== \"\") markdownParts.push(markdown.trim())\n\t\t\t\t}\n\n\t\t\t\tconst result = markdownParts.join(\"\\n\\n------------------------------------\\n\\n\")\n\t\t\t\tcopyText(result).catch(unhandledError)\n\t\t\t\trecord(\"ui_interaction\", { id: \"copy_collection_record_markdown\", page: trackingPage })\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: hasActivePrivateDraftCollectionItem ? Dictionary.Discard : Dictionary.Delete,\n\t\t\trole: \"deleteCollectionItem\",\n\t\t\tenabled: !dataIsViewOnly,\n\t\t\tvisible: inCMS,\n\t\t\tclick: () => {\n\t\t\t\tif (hasActivePrivateDraftCollectionItem) {\n\t\t\t\t\tcloseCollectionItems({ engine, target: \"active\", action: \"discard\" }).catch(unhandledError)\n\t\t\t\t} else {\n\t\t\t\t\tdeleteCollectionItemsWithConfirmation(engine, [collectionItemId], trackingPage)\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t]\n\n\treturn menuOptions\n}\n", "import type { ModalOpenSource } from \"@framerjs/events\"\nimport { showModalIfAiDisabled } from \"app/ai/config/disableAi.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/nodes/CanvasNode.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { showAiCreditLimitModalIfReached } from \"../shared/UpsellModal/utils/aiCreditsUpsell.ts\"\nimport { upsellTranslateAll } from \"../shared/UpsellModal/utils/localizationUpsellModals.tsx\"\nimport { canBeBatchTranslated, canBeBatchTranslatedAndVisibleInLocale } from \"./canBeBatchTranslated.ts\"\nimport type { LocalizationSourceGroup, LocalizationSourceKeyPath } from \"./getLocalizationSources.ts\"\nimport { getLocalizationSourcesForNode } from \"./getLocalizationSourcesForNode.ts\"\nimport { forEachLocalizationSourceInNonExcludedGroups } from \"./localizationSourceGroupUtils.ts\"\n\nexport function getBatchTranslatableKeyPaths(\n\tlocale: Locale,\n\tfilteredGroupsAndSources: readonly LocalizationSourceGroup[] | null,\n): Set<string> {\n\tconst keyPaths: Set<string> = new Set()\n\n\t// Only includes filtered items. For example when searching, or filtering by status or scope,\n\t// only the filtered items are included.\n\tif (!filteredGroupsAndSources) return keyPaths\n\n\tforEachLocalizationSourceInNonExcludedGroups(filteredGroupsAndSources, locale, source => {\n\t\tif (!canBeBatchTranslated(locale, source, engine.stores.previewStore.framerSiteId)) {\n\t\t\treturn\n\t\t}\n\n\t\tkeyPaths.add(source.keyPath)\n\t})\n\n\treturn keyPaths\n}\n\nexport function hasBatchTranslatableItems(locale?: Locale): boolean {\n\tif (!locale) return false\n\n\tconst count = engine.stores.localizationStore.batchTranslatableItemCountPerLocale[locale.id] ?? 0\n\treturn count > 0\n}\n\nexport function showBatchTranslateAllModal(locales: Locale[] | Locale, source: ModalOpenSource) {\n\tif (showModalIfAiDisabled(engine, source)) return\n\tif (showAiCreditLimitModalIfReached(engine, source)) return\n\tif (upsellTranslateAll(engine, source)) return\n\n\tconst localesArray = Array.isArray(locales) ? locales : [locales]\n\tconst localesWithKeyPaths: { locale: Locale; keyPaths: ReadonlySet<string> }[] = []\n\n\tfor (const locale of localesArray) {\n\t\tconst keyPaths = getBatchTranslatableKeyPaths(locale, engine.stores.localizationStore.filteredGroupsAndSources)\n\t\tif (keyPaths.size === 0) continue\n\t\tlocalesWithKeyPaths.push({ locale, keyPaths })\n\t}\n\n\tif (localesWithKeyPaths.length === 0) return\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.BatchTranslate,\n\t\tlocalesWithKeyPaths,\n\t\tsource,\n\t})\n}\n\nfunction getBatchTranslatableKeyPathsForNodes(\n\tlocale: Locale,\n\tnodes: CanvasNode[],\n): { keyPaths: ReadonlySet<string>; totalSourcesChecked: number } {\n\tconst keyPaths: Set<LocalizationSourceKeyPath> = new Set()\n\t// Output how many sources exist in the nodes, regardless of whether they are batch translatable\n\t// or not. It allows us to easily see if the given layers are not currently translatable, or\n\t// don't have translatable content in them\n\tlet totalSourcesChecked = 0\n\n\tconst tree = engine.tree\n\tconst framerSiteId = engine.stores.previewStore.framerSiteId\n\n\tfor (const node of nodes) {\n\t\tconst sources = getLocalizationSourcesForNode(node, engine, true)\n\t\tfor (const source of sources) {\n\t\t\ttotalSourcesChecked++\n\t\t\tif (!canBeBatchTranslatedAndVisibleInLocale(tree, locale, source, framerSiteId)) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tkeyPaths.add(source.keyPath)\n\t\t}\n\t}\n\treturn { keyPaths, totalSourcesChecked }\n}\n\nexport function showBatchTranslateLayersModal(\n\tlocales: readonly Locale[],\n\tnodes: CanvasNode[],\n\tsource: ModalOpenSource,\n) {\n\tif (showModalIfAiDisabled(engine, source)) return\n\tif (showAiCreditLimitModalIfReached(engine, source)) return\n\tif (upsellTranslateAll(engine, source)) return\n\n\tconst localesWithKeyPaths: { locale: Locale; keyPaths: ReadonlySet<string> }[] = []\n\n\tfor (const locale of locales) {\n\t\tconst { keyPaths } = getBatchTranslatableKeyPathsForNodes(locale, nodes)\n\t\tif (keyPaths.size === 0) continue\n\t\tlocalesWithKeyPaths.push({ locale, keyPaths })\n\t}\n\n\tif (localesWithKeyPaths.length === 0) return\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.BatchTranslate,\n\t\tlocalesWithKeyPaths,\n\t\tsource,\n\t})\n}\n\nexport function getSourceAndTranslationInfoForLayers(\n\tnodes: CanvasNode[],\n\tlocales: readonly Locale[] | undefined,\n): { sourcesExist: boolean; sourcesHaveAnythingToTranslate: boolean } {\n\tif (!nodes.length || !locales || locales.length === 0) {\n\t\treturn { sourcesExist: false, sourcesHaveAnythingToTranslate: false }\n\t}\n\n\tlet sourcesExist = false\n\tfor (const locale of locales) {\n\t\tconst { keyPaths, totalSourcesChecked } = getBatchTranslatableKeyPathsForNodes(locale, nodes)\n\n\t\tif (keyPaths.size > 0) {\n\t\t\treturn { sourcesExist: true, sourcesHaveAnythingToTranslate: true }\n\t\t}\n\n\t\tsourcesExist = totalSourcesChecked > 0 || sourcesExist\n\t}\n\treturn { sourcesExist, sourcesHaveAnythingToTranslate: false }\n}\n", "import { AddOnLicenseType, isPaidLicenseType } from \"@framerjs/app-shared\"\nimport type { ModalOpenSource } from \"@framerjs/events\"\nimport { assert, assertNever, getLogger } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { experiments } from \"app/experiments.ts\"\nimport engine from \"document/engine.ts\"\nimport type { LocaleId } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { PollStatus } from \"web/pages/project/lib/api/pollProject.ts\"\nimport type { RemoteDispatch } from \"web/pages/project/lib/useRemoteDispatch.ts\"\nimport { getAddOnPlanId } from \"../siteSettings/Plans/Stripe/addOns/api/getAddOnPlanId.ts\"\nimport {\n\tPutAddOnSubscriptionStatus,\n\tputAddOnSubscription,\n} from \"../siteSettings/Plans/Stripe/addOns/api/putAddOnSubscription.ts\"\nimport { shouldUseBillingV3 } from \"../siteSettings/Plans/Stripe/api/billingV3.ts\"\n\nconst log = getLogger(\"createLocale\")\n\nexport function createLocale(modalSource: ModalOpenSource, initialLanguageCode?: string): void {\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.LocaleSettings,\n\t\tinitialNewLocale: true,\n\t\tinitialLanguageCode,\n\t\tsource: modalSource,\n\t})\n}\n\nexport function deleteLocaleWithConfirmation(\n\tlocaleId: LocaleId,\n\tmodalSource: ModalOpenSource,\n\tremoteDispatch: RemoteDispatch | null,\n): void {\n\tconst locales = engine.tree.root.locales\n\tif (!locales) return\n\n\tconst locale = locales.find(({ id }) => id === localeId)\n\tif (!locale) return\n\n\tconst localizedValueCount = engine.stores.localizationStore.getLocalizedValueCountForLocale(localeId)\n\n\tasync function deleteLocale() {\n\t\tif (!engine.tree.root.locales) return\n\n\t\tconst currentLocales = engine.tree.root.locales\n\t\tconst filteredLocales = currentLocales.filter(({ id }) => id !== localeId)\n\t\tconst newLocales = filteredLocales.length === 0 ? undefined : filteredLocales\n\n\t\t// Optimistically update the locale list, rollback on error (for better user experience)\n\t\tengine.scheduler.processWhenReady(() => {\n\t\t\tengine.tree.root.set({ locales: newLocales })\n\t\t})\n\t\tconst expectedLocaleCount = newLocales?.length ?? 0\n\t\tconst restoredLocaleCount = currentLocales.length\n\n\t\tconst { project } = engine.stores.projectStore\n\t\tassert(project, \"We're inside the locales menu, so the project must be defined\")\n\n\t\t// Only update add-on subscription if on a paid license and new locale count is below limit\n\t\tconst isExpectedCountBelowLocaleLimit = expectedLocaleCount < (project.settings.resourceLimits.locales ?? Infinity)\n\t\tconst shouldRemoveAddOn = isPaidLicenseType(project.license.type) && isExpectedCountBelowLocaleLimit\n\n\t\tif (shouldRemoveAddOn) {\n\t\t\tconst isBillingV3 = shouldUseBillingV3({\n\t\t\t\tbillingV3ExperimentOn: experiments.isOn(\"billingV3\"),\n\t\t\t\tteamLicenseType: project.teamLicenseType ?? null,\n\t\t\t\tteamLicenseVersion: project.teamLicenseVersion ?? null,\n\t\t\t})\n\t\t\tconst addOnPlanId = project.license.period\n\t\t\t\t? await getAddOnPlanId({\n\t\t\t\t\t\tprojectLicenseType: project.license.type,\n\t\t\t\t\t\taddonLicenseType: AddOnLicenseType.Locale,\n\t\t\t\t\t\tperiod: project.license.period,\n\t\t\t\t\t\tisBillingV3,\n\t\t\t\t\t})\n\t\t\t\t: null\n\n\t\t\tconst result = addOnPlanId\n\t\t\t\t? await putAddOnSubscription(project.id, { plan: addOnPlanId, quantity: expectedLocaleCount }, isBillingV3)\n\t\t\t\t: null\n\n\t\t\tconst isFailed = result == null || result.status !== PutAddOnSubscriptionStatus.Success\n\t\t\tif (isFailed) {\n\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\tengine.tree.root.set({ locales: currentLocales })\n\t\t\t\t})\n\t\t\t\ttoast({\n\t\t\t\t\ttype: \"add\",\n\t\t\t\t\tvariant: \"error\",\n\t\t\t\t\tprimaryText: \"Failed to remove\",\n\t\t\t\t\tsecondaryText: \"locale.\",\n\t\t\t\t\tkey: \"failed_to_remove_locale\",\n\t\t\t\t\ticon: \"error\",\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (!remoteDispatch) return\n\t\t\t// we need to refetch the project to get the updated locale count\n\t\t\t// For example, When project is pending cancellation, it should not be possible to add a locale\n\t\t\t// so after removing a locale, we need to refetch the project to get the updated locale count & limits\n\t\t\tconst pollResult = await remoteDispatch.pollProject({\n\t\t\t\tintervalMillis: 500,\n\t\t\t\tattempts: 5,\n\t\t\t\tstopCondition: () =>\n\t\t\t\t\t// NOTE: this is strange because we fetch the project, but check the locale count in the tree\n\t\t\t\t\t(engine.tree.root.locales?.length ?? 0) === (isFailed ? restoredLocaleCount : expectedLocaleCount),\n\t\t\t})\n\t\t\tswitch (pollResult.status) {\n\t\t\t\tcase PollStatus.TimeoutError:\n\t\t\t\tcase PollStatus.UnhandledError:\n\t\t\t\t\tlog.error(\"Failed to poll project after locale deletion\", pollResult)\n\t\t\t\t\tbreak\n\t\t\t\tcase PollStatus.Success:\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tassertNever(pollResult)\n\t\t\t}\n\t\t}\n\n\t\trecord(\"locale_delete\", {\n\t\t\tlocalizedValueCount,\n\t\t\tsource: modalSource,\n\t\t})\n\t}\n\n\tif (localizedValueCount === 0) {\n\t\tvoid deleteLocale()\n\t\treturn\n\t}\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.Confirmation,\n\t\tvariant: \"destructive\",\n\t\ttitle: `Delete ${locale.name} ${Dictionary.Locale}`,\n\t\tdescription: `You are about to delete the ${Dictionary.Locale.toLowerCase()} for all project collaborators.`,\n\t\tconfirmLabel: Dictionary.Delete,\n\t\tonConfirm: deleteLocale,\n\t\tsource: modalSource,\n\t})\n}\n", "import { unhandledError } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport { isContentNode } from \"document/models/CanvasTree/nodes/TreeNode.ts\"\nimport { isRootNode, isWebPageNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useState } from \"react\"\nimport { copyText } from \"utils/clipboard/index.ts\"\nimport { upsellLocalizationTranslationLimit } from \"../shared/UpsellModal/utils/localizationUpsellModals.tsx\"\nimport { getLocalizationStatusActionMenuItems } from \"./LocalizationValueStatus.tsx\"\nimport type { LocalizationSource } from \"./getLocalizationSources.ts\"\nimport { isImageSource, isLinkSource } from \"./getLocalizationSources.ts\"\nimport { openTextEditorOverlay } from \"./openTextEditorOverlay.ts\"\nimport { viewLocalizationValueSource } from \"./viewLocalizationValueSource.ts\"\n\nexport function viewSourceOption(source: LocalizationSource): MenuItemOptions {\n\tconst node = engine.tree.get(source.nodeId)\n\n\tlet label = `View on ${Dictionary.Canvas}`\n\n\tif (isRootNode(node)) {\n\t\tlabel = `View in ${Dictionary.SiteSettings}`\n\t}\n\n\tif (isWebPageNode(node)) {\n\t\tlabel = `View in ${Dictionary.PageSettings}`\n\t}\n\n\tif (isContentNode(node)) {\n\t\tlabel = `View in ${Dictionary.Cms}`\n\t}\n\n\treturn {\n\t\tlabel,\n\t\tenabled: Boolean(node),\n\t\tclick: () => viewLocalizationValueSource(source),\n\t}\n}\n\nexport function useSourceOptionsMenu({\n\tsource,\n\tactiveLocale,\n\tmanagedByPlugin,\n\topenAtMousePosition = false,\n\tonMenuOpen,\n\tonMenuClose,\n}: {\n\tsource: LocalizationSource | undefined\n\tactiveLocale: Locale\n\tmanagedByPlugin: boolean\n\topenAtMousePosition?: boolean\n\tonMenuOpen?: () => void\n\tonMenuClose?: () => void\n}) {\n\tconst [isOpen, setIsOptionsOpen] = useState(false)\n\n\tconst popup = (event: React.MouseEvent<HTMLElement>) => {\n\t\tif (event.target instanceof HTMLInputElement) return\n\n\t\tif (!source) return\n\n\t\tconst element = event.currentTarget\n\t\tconst bounds = element.getBoundingClientRect()\n\n\t\tonMenuOpen?.()\n\t\tsetIsOptionsOpen(true)\n\n\t\tconst sourceOptions: MenuItemOptions[] = [\n\t\t\t...getLocalizationStatusActionMenuItems(source, activeLocale, \"localization_table\", { managedByPlugin }),\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: `Open in ${Dictionary.Overlay}`,\n\t\t\t\tvisible: !isImageSource(source) && !isImageSource(source),\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (upsellLocalizationTranslationLimit(engine, source, activeLocale, \"localization_table\")) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\topenTextEditorOverlay(source)\n\t\t\t\t},\n\t\t\t},\n\t\t\tviewSourceOption(source),\n\t\t]\n\n\t\tif (isLinkSource(source)) {\n\t\t\tsourceOptions.unshift(\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Copy Source Text\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tcopyText(source.value).catch(unhandledError)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{ type: \"separator\" },\n\t\t\t)\n\t\t}\n\n\t\tengine.stores.contextMenuStore.show(sourceOptions, {\n\t\t\tlocation: {\n\t\t\t\tx: openAtMousePosition ? event.clientX : bounds.left,\n\t\t\t\ty: openAtMousePosition ? event.clientY : bounds.bottom,\n\t\t\t},\n\t\t\tonDone: () => {\n\t\t\t\tonMenuClose?.()\n\t\t\t\tsetIsOptionsOpen(false)\n\t\t\t},\n\t\t})\n\t}\n\n\treturn {\n\t\tisOpen,\n\t\tpopup,\n\t}\n}\n", "import type { BadgeProps } from \"@framerjs/fresco\"\nimport { Badge, CenterChild, FixedPositionTooltip, IconWarning, useTooltip } from \"@framerjs/fresco\"\nimport { colors } from \"@framerjs/fresco/tokens\"\nimport { cx } from \"@linaria/core\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport engine from \"document/engine.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { useRef } from \"react\"\nimport { isNullish } from \"utils/typeChecks.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport * as styles from \"./LocalizationValueStatus.styles.ts\"\nimport type { LocalizationSource, LocalizationSourceStatus } from \"./getLocalizationSources.ts\"\nimport { isImageSource } from \"./getLocalizationSources.ts\"\nimport { getNameForLocalizationStatus } from \"./getNameForLocalizationStatus.ts\"\nimport { showMatchingItemsToast } from \"./showMatchingItemsToast.ts\"\nimport type { LocalizedValueTrackingSource } from \"./updateLocalizedValue.ts\"\nimport { approveLocalizedValue, clearLocalizedValue, requestReviewForLocalizedValue } from \"./updateLocalizedValue.ts\"\n\nfunction getClearEnabled(source: LocalizationSource, activeLocale: Locale) {\n\tif (isImageSource(source)) {\n\t\tconst localizedImageValue = source.imageLocalizedValues[activeLocale.id]\n\t\tif (localizedImageValue) return source.image !== \"\"\n\t}\n\tconst localizedValue = source.localizedValues[activeLocale.id]\n\treturn Boolean(localizedValue)\n}\n\nfunction hasLocalizedValue(source: LocalizationSource, activeLocale: Locale) {\n\tif (isImageSource(source)) {\n\t\tconst localizedImageValue = source.imageLocalizedValues[activeLocale.id]\n\t\tif (localizedImageValue) return !isNullish(localizedImageValue.value)\n\t}\n\tconst localizedValue = source.localizedValues[activeLocale.id]\n\tif (localizedValue) return !isNullish(localizedValue.value)\n\treturn false\n}\n\nexport function getLocalizationStatusActionMenuItems(\n\tsource: LocalizationSource,\n\tactiveLocale: Locale,\n\ttrackingSource: LocalizedValueTrackingSource,\n\t{ hideDisabledItems = false, managedByPlugin }: { hideDisabledItems?: boolean; managedByPlugin: boolean },\n): MenuItemOptions[] {\n\tconst isReadOnly = getIsViewOnly(engine, \"canEditContent\") || managedByPlugin\n\n\tconst status = source.localizedValueStatuses[activeLocale.id]\n\tconst hasWarning = status === \"warning\"\n\tconst approveEnabled = status !== \"done\"\n\tconst askForReviewEnabled = status !== \"needsReview\"\n\tconst clearEnabled = getClearEnabled(source, activeLocale)\n\n\treturn [\n\t\t{\n\t\t\tlabel: hasLocalizedValue(source, activeLocale) ? \"Approve\" : \"Ignore\",\n\t\t\tenabled: approveEnabled && !isReadOnly && !hasWarning,\n\t\t\tvisible: hideDisabledItems ? approveEnabled : true,\n\t\t\tclick: () => {\n\t\t\t\tapproveLocalizedValue(engine, source, activeLocale, { trackingSource })\n\t\t\t\tshowMatchingItemsToast(engine, { type: \"ignore\" }, source, activeLocale, {\n\t\t\t\t\tgeneratedByAI: false,\n\t\t\t\t\ttrackingSource,\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tlabel: `To ${Dictionary.Review}`,\n\t\t\tenabled: askForReviewEnabled && !isReadOnly && !hasWarning,\n\t\t\tvisible: hideDisabledItems ? askForReviewEnabled : true,\n\t\t\tclick: () => requestReviewForLocalizedValue(engine, source, activeLocale, trackingSource),\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Clear,\n\t\t\tenabled: clearEnabled && !isReadOnly,\n\t\t\tvisible: hideDisabledItems ? clearEnabled : true,\n\t\t\tclick: () => {\n\t\t\t\tclearLocalizedValue(engine, source, activeLocale, { target: \"all\", trackingSource })\n\t\t\t\tshowMatchingItemsToast(engine, { type: \"clear\" }, source, activeLocale, {\n\t\t\t\t\tgeneratedByAI: false,\n\t\t\t\t\ttrackingSource,\n\t\t\t\t})\n\t\t\t},\n\t\t},\n\t]\n}\n\nfunction getBadgeVariant(status: LocalizationSourceStatus): BadgeProps[\"variant\"] {\n\tswitch (status) {\n\t\tcase \"new\":\n\t\t\treturn undefined\n\t\tcase \"needsReview\":\n\t\t\treturn \"componentTintDimmed\"\n\t\tcase \"done\":\n\t\t\treturn \"neutral\"\n\t\tcase \"warning\":\n\t\t\treturn \"warning\"\n\t}\n}\n\nconst iconSize = 20\n\nexport function LocalizationValueStatus({\n\tsource,\n\tactiveLocale,\n\tcompact = false,\n}: {\n\tsource: LocalizationSource\n\tactiveLocale: Locale\n\tcompact?: boolean\n}) {\n\tconst warningMessage = source.warnings?.[activeLocale.id]\n\n\tconst ref = useRef<HTMLDivElement>(null)\n\n\tconst { triggerProps, tooltipProps } = useTooltip({\n\t\ttriggerRef: ref,\n\t\tdirection: \"bottom\",\n\t\ttint: colors.localizationWarningTint,\n\t})\n\n\tconst status = source.localizedValueStatuses[activeLocale.id] ?? \"new\"\n\n\treturn (\n\t\t<Badge\n\t\t\tref={ref}\n\t\t\tvariant={getBadgeVariant(status)}\n\t\t\tclassName={cx(styles.badge, compact && styles.compact, warningMessage && styles.warning)}\n\t\t\tonMouseDown={warningMessage ? triggerProps.onMouseDown : undefined}\n\t\t\tonPointerEnter={triggerProps.onPointerEnter}\n\t\t\tonPointerLeave={triggerProps.onPointerLeave}\n\t\t>\n\t\t\t{warningMessage ? (\n\t\t\t\t<>\n\t\t\t\t\t<CenterChild>\n\t\t\t\t\t\t<IconWarning style={{ color: colors.localizationWarningTint }} width={iconSize} height={iconSize} />\n\t\t\t\t\t</CenterChild>\n\t\t\t\t\t<FixedPositionTooltip {...tooltipProps}>{warningMessage}</FixedPositionTooltip>\n\t\t\t\t</>\n\t\t\t) : (\n\t\t\t\tgetNameForLocalizationStatus(status)\n\t\t\t)}\n\t\t\t{warningMessage && <FixedPositionTooltip {...tooltipProps}>{warningMessage}</FixedPositionTooltip>}\n\t\t</Badge>\n\t)\n}\n", "import \"LocalizationValueStatus.styles_19a9m53.wyw.css\"; export const badge = \"badge_bwq240g\";\nexport const compact = \"compact_c1nn2bwv\";\nexport const warning = \"warning_w1kel4y9\";", "import { assertNever } from \"@framerjs/shared\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { Locale } from \"document/models/CanvasTree/traits/WithLocales.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { upsellTranslatableWordLimit } from \"../shared/UpsellModal/utils/localizationUpsellModals.tsx\"\nimport { dismissMatchingItemsToast } from \"./dismissMatchingItemsToast.ts\"\nimport type { LocalizationSource, LocalizationSourceGroup } from \"./getLocalizationSources.ts\"\nimport { isImageSource, isOverlayOnlyRichTextSource } from \"./getLocalizationSources.ts\"\nimport { forEachLocalizationSourceInGroup } from \"./localizationSourceGroupUtils.ts\"\nimport { matchingItemsToastKey } from \"./matchingItemsToastKey.ts\"\nimport type { GeneratedByAI, WithLocalizedValueTrackingSource } from \"./updateLocalizedValue.ts\"\nimport { approveLocalizedValue, clearLocalizedValue, setLocalizedValue } from \"./updateLocalizedValue.ts\"\n\ntype ChangeDescription = { type: \"update\"; value: string } | { type: \"ignore\" } | { type: \"clear\" }\n\nfunction getActionPrimaryAndSecondary(\n\tchange: Exclude<ChangeDescription, { type: \"update\" }>,\n\tmatchingItemCount: number,\n): { primaryText: string; secondaryText: string } {\n\tconst isSingular = matchingItemCount === 1\n\tconst countText = isSingular ? \"one\" : String(matchingItemCount)\n\n\tif (change.type === \"clear\") {\n\t\treturn {\n\t\t\tprimaryText: `Clear ${countText}`,\n\t\t\tsecondaryText: isSingular ? \"other identical item?\" : \"identical items?\",\n\t\t}\n\t} else if (change.type === \"ignore\") {\n\t\treturn {\n\t\t\tprimaryText: `Ignore ${countText}`,\n\t\t\tsecondaryText: isSingular ? \"other identical item?\" : \"identical items?\",\n\t\t}\n\t}\n\n\tassertNever(change)\n}\n\nfunction getUpdateSecondaryText(matchingItemCount: number): string {\n\tif (matchingItemCount === 1) return \"to one other identical item?\"\n\treturn `to ${matchingItemCount} identical items?`\n}\n\nfunction getMatchingSources(\n\tsource: LocalizationSource,\n\tfilteredGroups: readonly LocalizationSourceGroup[],\n\tactiveLocale: Locale,\n\tchange: ChangeDescription,\n): readonly LocalizationSource[] {\n\tconst result: LocalizationSource[] = []\n\n\tconst currentLocalizedValue = source.localizedValues[activeLocale.id]\n\tconst currentValue = currentLocalizedValue?.value ?? null\n\n\tforEachLocalizationSourceInGroup(filteredGroups, otherSource => {\n\t\t// Ignore the source itself\n\t\tif (otherSource.keyPath === source.keyPath) return\n\n\t\tif (otherSource.value !== source.value) return\n\t\tif (isOverlayOnlyRichTextSource(otherSource)) return\n\n\t\tconst otherLocalizedValue = otherSource.localizedValues[activeLocale.id]\n\n\t\t// The other source is approved as is, so let's not change it\n\t\tif (otherLocalizedValue?.value === null) return\n\n\t\t// Nothing to clear unless we have a value\n\t\tif (change.type === \"clear\" && !otherLocalizedValue) return\n\n\t\tconst otherValue = otherLocalizedValue?.value ?? null\n\t\tif (currentValue !== otherValue) return\n\n\t\tresult.push(otherSource)\n\t})\n\n\treturn result\n}\n\nexport function showMatchingItemsToast(\n\tengine: VekterEngine,\n\tchange: ChangeDescription,\n\tsource: LocalizationSource,\n\tactiveLocale: Locale,\n\t{ generatedByAI, trackingSource }: GeneratedByAI & WithLocalizedValueTrackingSource,\n) {\n\tdismissMatchingItemsToast()\n\n\tif (change.type === \"update\" && !change.value) return\n\tif (isOverlayOnlyRichTextSource(source) || isImageSource(source)) return\n\n\tconst { filteredGroupsAndSources } = engine.stores.localizationStore\n\tif (!filteredGroupsAndSources) return\n\n\tconst matchingSources = getMatchingSources(source, filteredGroupsAndSources, activeLocale, change)\n\n\tif (matchingSources.length === 0) return\n\n\tconst updateMatchingSources = () => {\n\t\tif (change.type !== \"clear\") {\n\t\t\tif (upsellTranslatableWordLimit(engine, \"toast\")) return\n\t\t}\n\n\t\tfor (const matchingSource of matchingSources) {\n\t\t\tif (change.type === \"clear\") {\n\t\t\t\tclearLocalizedValue(engine, matchingSource, activeLocale, {\n\t\t\t\t\ttarget: \"default\",\n\t\t\t\t\tignoreTracking: true,\n\t\t\t\t\ttrackingSource,\n\t\t\t\t})\n\t\t\t} else if (change.type === \"ignore\") {\n\t\t\t\tapproveLocalizedValue(engine, matchingSource, activeLocale, {\n\t\t\t\t\tignoreTracking: true,\n\t\t\t\t\ttrackingSource,\n\t\t\t\t})\n\t\t\t} else if (change.type === \"update\") {\n\t\t\t\tsetLocalizedValue(engine, change.value, matchingSource, activeLocale, {\n\t\t\t\t\tgeneratedByAI,\n\t\t\t\t\tignoreTracking: true,\n\t\t\t\t\ttrackingSource,\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\trecord(\"localized_value_batch_update\", {\n\t\t\tcode: activeLocale.code,\n\t\t\tvalueLength: change.type === \"update\" ? change.value.length : 0,\n\t\t\tgeneratedByAI,\n\t\t\titemCount: matchingSources.length,\n\t\t\tsource: trackingSource,\n\t\t})\n\t}\n\n\ttoast({\n\t\ttype: \"add\",\n\t\tkey: matchingItemsToastKey,\n\t\tvariant: \"info\",\n\t\t...(change.type === \"update\"\n\t\t\t? {\n\t\t\t\t\tprimaryText: \"Apply translation\",\n\t\t\t\t\tsecondaryText: getUpdateSecondaryText(matchingSources.length),\n\t\t\t\t}\n\t\t\t: getActionPrimaryAndSecondary(change, matchingSources.length)),\n\t\tduration: 10_000,\n\t\tshowCloseButton: \"never\",\n\t\taction: {\n\t\t\ttitle: \"Apply\",\n\t\t\tonClick: updateMatchingSources,\n\t\t},\n\t})\n}\n", "import engine from \"document/engine.ts\"\nimport type { LocalizationSource } from \"./getLocalizationSources.ts\"\n\nexport function openTextEditorOverlay(\n\tsource: LocalizationSource,\n\t{ startTranslation = false }: { startTranslation?: boolean } = {},\n) {\n\tengine.stores.chromeStore.setOverlay({ type: \"localization\", keyPath: source.keyPath, startTranslation })\n}\n", "import { assert, assertNever, unhandledError } from \"@framerjs/shared\"\nimport { PanelElementId, highlightPanel } from \"document/components/chrome/properties/panels/utils/highlightPanel.ts\"\nimport { showCanvasNode } from \"document/components/utils/showCanvasNode.ts\"\nimport engine from \"document/engine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { CONTENT_MANAGEMENT_ID } from \"document/models/CanvasTree/nodes/ContentManagementNode.ts\"\nimport {\n\tisCodeComponentNode,\n\tisCollectionItemNode,\n\tisCollectionNode,\n\tisFormPlainTextInputNode,\n\tisFormSelectNode,\n\tisFrameNode,\n\tisRichTextNode,\n\tisRootNode,\n\tisRouteSegmentNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { withLink } from \"document/models/CanvasTree/traits/WithLink.ts\"\nimport { SiteSettingsTabNames } from \"document/stores/SiteSettingsStore.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ScopeType } from \"document/utils/scopeType.ts\"\nimport { ControlType } from \"library/index.ts\"\nimport { ClassDiscriminator } from \"utils/withClassDiscriminator.ts\"\nimport type { LocalizationSource } from \"./getLocalizationSources.ts\"\nimport { isImageSource } from \"./getLocalizationSources.ts\"\n\nfunction showNodeOnCanvas(node: CanvasNode, source: LocalizationSource) {\n\tconst scopeNode = engine.tree.getScopeNodeFor(node)\n\tif (!scopeNode) return\n\n\tengine.stores.chromeStore.setLocalizationsVisible(false)\n\tshowCanvasNode(engine, node)\n\n\tif (isCodeComponentNode(node)) {\n\t\tengine.scheduler.runBeforeNextFrame(() => {\n\t\t\thighlightPanel({ id: PanelElementId.CodeComponentPanel, flash: true })\n\t\t})\n\t}\n\n\tif (isFrameNode(node) && isImageSource(source)) {\n\t\tengine.floatingWindowPopoutNavigation?.presentPopout(\"fill\")\n\t}\n}\n\nexport function viewLocalizationValueSource(source: LocalizationSource) {\n\tconst node = engine.tree.get(source.nodeId)\n\tconst sourceType = source.type\n\n\tconst {\n\t\tchromeStore,\n\t\tvariablesStore,\n\t\tcontentManagementStore,\n\t\tselectionStore,\n\t\tscopeStore,\n\t\tmodalStore,\n\t\tsiteSettingsStore,\n\t} = engine.stores\n\n\tchromeStore.hideOverlay()\n\n\tswitch (sourceType) {\n\t\tcase ControlType.String:\n\t\tcase ControlType.RichText:\n\t\tcase ControlType.Image:\n\t\tcase ControlType.Link:\n\t\t\tif (isCodeComponentNode(node)) {\n\t\t\t\tshowNodeOnCanvas(node, source)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif (isCollectionItemNode(node)) {\n\t\t\t\tscopeStore.select(CONTENT_MANAGEMENT_ID, { keepHistory: false })\n\t\t\t\tcontentManagementStore.setCollectionItemControlToHighlight(source.controlPropKey)\n\t\t\t\tselectionStore.set(node.id)\n\t\t\t\tchromeStore.setLocalizationsVisible(false)\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tthrow Error(`Unexpected node: ${node?.__class}`)\n\n\t\tcase ControlType.Enum:\n\t\t\tassert(isCollectionNode(node))\n\n\t\t\tscopeStore.select(CONTENT_MANAGEMENT_ID, { keepHistory: false })\n\t\t\tselectionStore.set(node.id)\n\t\t\tmodalStore.set({\n\t\t\t\ttype: ModalType.Variables,\n\t\t\t\tsource: \"localization_table\",\n\t\t\t})\n\t\t\tvariablesStore.selectedVariablePath = [source.variableId]\n\t\t\tchromeStore.setLocalizationsVisible(false)\n\t\t\tbreak\n\n\t\tcase ClassDiscriminator.RootNode: {\n\t\t\tassert(isRootNode(node))\n\n\t\t\tsiteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.project }).catch(unhandledError)\n\t\t\tbreak\n\t\t}\n\t\tcase ClassDiscriminator.WebPageNode: {\n\t\t\tassert(isWebPageNode(node))\n\n\t\t\tsiteSettingsStore.setActiveTab({ tab: SiteSettingsTabNames.page, id: node.id }).catch(unhandledError)\n\t\t\tbreak\n\t\t}\n\n\t\tcase ClassDiscriminator.RichTextNode: {\n\t\t\tassert(isRichTextNode(node))\n\t\t\tshowNodeOnCanvas(node, source)\n\t\t\tbreak\n\t\t}\n\t\tcase ClassDiscriminator.FrameNode: {\n\t\t\tassert(isFrameNode(node))\n\t\t\tshowNodeOnCanvas(node, source)\n\t\t\tbreak\n\t\t}\n\t\tcase \"nodeLink\": {\n\t\t\tassert(withLink(node))\n\t\t\tshowNodeOnCanvas(node, source)\n\t\t\tbreak\n\t\t}\n\t\tcase ClassDiscriminator.FormPlainTextInputNode: {\n\t\t\tassert(isFormPlainTextInputNode(node))\n\t\t\tshowNodeOnCanvas(node, source)\n\t\t\tbreak\n\t\t}\n\t\tcase ClassDiscriminator.FormSelectNode:\n\t\tcase \"formSelectGenericOption\": {\n\t\t\tassert(isFormSelectNode(node))\n\t\t\tshowNodeOnCanvas(node, source)\n\t\t\tbreak\n\t\t}\n\t\tcase ClassDiscriminator.RouteSegmentNode: {\n\t\t\tengine.stores.chromeStore.setLocalizationsVisible(false)\n\n\t\t\tassert(isRouteSegmentNode(node))\n\t\t\tengine.stores.chromeStore.setLocalizationsVisible(false)\n\t\t\tif (node.webPageId) {\n\t\t\t\tengine.stores.scopeStore.select(node.webPageId, { keepHistory: false })\n\t\t\t} else if (engine.stores.scopeStore.scopeType === ScopeType.ContentManagement) {\n\t\t\t\tengine.stores.scopeStore.selectPreviousActiveScope()\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tcase \"prefix\":\n\t\tcase \"suffix\":\n\t\tcase \"convertFromEnum\":\n\t\tcase \"convertFromBoolean\": {\n\t\t\tassert(node)\n\n\t\t\tshowNodeOnCanvas(node, source)\n\n\t\t\tbreak\n\t\t}\n\n\t\tcase \"slug\": {\n\t\t\tassert(isCollectionItemNode(node), 'expected slug source node to be of type \"collectionItem\"')\n\n\t\t\tscopeStore.select(CONTENT_MANAGEMENT_ID, { keepHistory: false })\n\t\t\tcontentManagementStore.setCollectionItemControlToHighlight(source.controlPropKey)\n\t\t\tselectionStore.set(node.id)\n\t\t\tchromeStore.setLocalizationsVisible(false)\n\t\t\tbreak\n\t\t}\n\t\tdefault:\n\t\t\tassertNever(sourceType)\n\t}\n}\n", "import { List, assert, assertNever } from \"@framerjs/shared\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport type { CanvasNode } from \"document/models/CanvasTree/index.ts\"\nimport { getContentManagementNode } from \"document/models/CanvasTree/nodes/ContentManagementNode.utils.ts\"\nimport { randomID } from \"document/models/CanvasTree/nodes/NodeID.ts\"\nimport { isContentNode } from \"document/models/CanvasTree/nodes/TreeNode.ts\"\nimport { isCollectionNode, isSmartComponentNode } from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport type {\n\tEnumVariableCase,\n\tVariableDivider,\n\tWithVariables,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport {\n\tgetDefaultNameForVariable,\n\tisArrayItemVariableType,\n\tvariableTypeTitle,\n} from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { getFallbackValue } from \"document/models/CanvasTree/traits/utils/codeComponentProps.ts\"\nimport { createBoxShadow } from \"document/models/Shadow.ts\"\nimport { CollectionPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { plural, singular } from \"pluralize\"\nimport { getProjectVectorSetVariableCreateMenuOptions } from \"utils/vectorSets.ts\"\nimport { record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { generateVariablePanelPopoutId } from \"../../contentManagement/utils/collectionFieldPopoutId.ts\"\nimport { createGalleryVariableDefaultValue } from \"../../properties/utils/createVariable.ts\"\nimport {\n\ttype CreateVariableInScopeOptions,\n\tcreateVariableInScope,\n\tgetVariableInsertionIndex,\n} from \"../../properties/utils/createVariableInScope.ts\"\nimport {\n\tmenuIconForDivider,\n\tmenuIconForGalleryVariable,\n\tmenuIconForVariableType,\n} from \"../utils/panelIconForVariable.tsx\"\nimport {\n\ttype SelectedVariableInfo,\n\tgetSelectedVariableInfo,\n\tgetVariableListFromVariableParent,\n\tupdateVariableListInVariableParent,\n} from \"./getSelectedVariableInfo.ts\"\n\nconst creationVariables = [\n\tControlType.String,\n\tControlType.RichText,\n\tControlType.Date,\n\tControlType.Link,\n\tControlType.Image,\n\tControlType.Array,\n\tControlType.Color,\n\tControlType.Boolean,\n\tControlType.Number,\n\tControlType.Enum,\n\tControlType.EventHandler,\n\tControlType.File,\n\tControlType.Transition,\n\tControlType.Border,\n\tControlType.Cursor,\n\tControlType.BoxShadow,\n\tControlType.Location,\n\t\"slug\",\n] as const\n\nexport function getVariableCreationMenuOptions({\n\tengine,\n\tnodeWithVariables,\n\tagentExperimentEnabled,\n\tselectedVariableInfo,\n\tshowTypeIcons = false,\n\tonCreate,\n}: {\n\tengine: VekterEngine\n\tnodeWithVariables: CanvasNode & WithVariables\n\tagentExperimentEnabled: boolean\n\tselectedVariableInfo?: SelectedVariableInfo | null\n\tshowTypeIcons?: boolean\n\tonCreate?: () => void\n}): MenuItemOptions[] {\n\tconst isCollection = isCollectionNode(nodeWithVariables)\n\tconst isManagedByPlugin = isCollection && Boolean(nodeWithVariables.managedByPlugin)\n\tconst includeDivider = isCollection\n\tconst isReadOnly = getIsViewOnly(engine, \"canEditVariables\") || isManagedByPlugin\n\tconst showFieldsPopout = isCollection\n\tconst isCreatingArrayItemVariable = Boolean(selectedVariableInfo?.selectedVariableParent)\n\n\tconst createVariableFromMenu = (options: CreateVariableInScopeOptions) => {\n\t\tconst variableReference = createVariableInScope(options)\n\t\tif (variableReference) onCreate?.()\n\t\treturn variableReference\n\t}\n\n\tlet variableTypes: readonly (typeof creationVariables)[number][] | undefined\n\n\tif (selectedVariableInfo?.selectedVariableParent) {\n\t\tvariableTypes = creationVariables.filter(isArrayItemVariableType)\n\t} else {\n\t\tvariableTypes = creationVariables.filter(variableType =>\n\t\t\tnodeWithVariables.canCreateVariable({ type: variableType }),\n\t\t)\n\t}\n\n\tconst options: MenuItemOptions[] = []\n\n\tfor (const variableType of variableTypes) {\n\t\tconst option: MenuItemOptions = {\n\t\t\tlabel: variableTypeTitle(variableType),\n\t\t\ticon: showTypeIcons ? getVariableCreationMenuIcon(variableType, agentExperimentEnabled) : undefined,\n\t\t\tenabled: !isReadOnly,\n\t\t\tclick: () => {\n\t\t\t\tswitch (variableType) {\n\t\t\t\t\tcase ControlType.Number:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: getFallbackValue(variableType),\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.String:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: getFallbackValue(variableType),\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.RichText:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: getFallbackValue(variableType),\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.Boolean:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: getFallbackValue(variableType),\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.Color:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: getFallbackValue(variableType),\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.Image:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.EventHandler:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.Link:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.File:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tallowedFileTypes: [{ extension: \"\", id: randomID() }],\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.Date: {\n\t\t\t\t\t\tlet initialValue: string | undefined\n\t\t\t\t\t\t// We don't want to add a default date within the CMS, because that default value\n\t\t\t\t\t\t// would be mostly wrong, and changing the default later on might result in\n\t\t\t\t\t\t// unexpected issues. For smart components we do want a default because else the\n\t\t\t\t\t\t// date won't be visible while viewing the component in isolation.\n\t\t\t\t\t\tif (!isContentNode(nodeWithVariables)) {\n\t\t\t\t\t\t\tinitialValue = new Date(0).toJSON()\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue,\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase ControlType.BoxShadow:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: [createBoxShadow({})],\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.Border:\n\t\t\t\t\tcase ControlType.Transition:\n\t\t\t\t\tcase ControlType.Location:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.Cursor:\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: \"pointer\",\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.Enum: {\n\t\t\t\t\t\tconst option1: EnumVariableCase = { id: randomID(), name: \"Option 1\" }\n\t\t\t\t\t\tconst option2: EnumVariableCase = { id: randomID(), name: \"Option 2\" }\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: option1.id,\n\t\t\t\t\t\t\tcases: [option1, option2],\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tcase \"slug\":\n\t\t\t\t\t\tassert(isCollectionNode(nodeWithVariables), \"Only collection nodes can have slugs\")\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: \"\",\n\t\t\t\t\t\t\tassociatedStringVariable: null,\n\t\t\t\t\t\t\tname: getDefaultNameForVariable(variableType),\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase ControlType.Array: {\n\t\t\t\t\t\tconst galleryImageId = randomID()\n\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\ttype: variableType,\n\t\t\t\t\t\t\tinitialValue: createGalleryVariableDefaultValue({\n\t\t\t\t\t\t\t\tgalleryImageId,\n\t\t\t\t\t\t\t\tisSmartComponent: isSmartComponentNode(nodeWithVariables),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\titemVariables: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: galleryImageId,\n\t\t\t\t\t\t\t\t\ttype: ControlType.Image,\n\t\t\t\t\t\t\t\t\tname: Dictionary.Image,\n\t\t\t\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\tname: Dictionary.Gallery,\n\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\tinsertAfterVariable: selectedVariableInfo,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassertNever(variableType)\n\t\t\t\t}\n\t\t\t},\n\t\t}\n\n\t\toptions.push(option)\n\t}\n\n\tif (isCollectionNode(nodeWithVariables) && !isCreatingArrayItemVariable) {\n\t\tconst submenu = getProjectVectorSetVariableCreateMenuOptions(engine, nodeWithVariables, isReadOnly, info => {\n\t\t\tcreateVariableFromMenu({\n\t\t\t\tengine,\n\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\ttype: ControlType.VectorSetItem,\n\t\t\t\tname: info.name,\n\t\t\t\tsetModuleId: info.setModuleId,\n\t\t\t\tinitialValue: info.initialValue,\n\t\t\t\tinsertAfterVariable: info.insertAfterVariable,\n\t\t\t})\n\t\t})\n\n\t\tif (submenu.length > 0) {\n\t\t\toptions.push(\n\t\t\t\t{\n\t\t\t\t\ttype: \"separator\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.VectorSet,\n\t\t\t\t\ticon: showTypeIcons\n\t\t\t\t\t\t? getVariableCreationMenuIcon(ControlType.VectorSetItem, agentExperimentEnabled)\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tsubmenu,\n\t\t\t\t},\n\t\t\t)\n\t\t}\n\n\t\tconst collections = getContentManagementNode(engine.tree)?.loaded?.children ?? []\n\n\t\tif (collections.length > 0 && !selectedVariableInfo?.selectedVariableParent) {\n\t\t\toptions.push(\n\t\t\t\t{\n\t\t\t\t\ttype: \"separator\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Reference\",\n\t\t\t\t\ticon: showTypeIcons\n\t\t\t\t\t\t? getVariableCreationMenuIcon(ControlType.CollectionReference, agentExperimentEnabled)\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tsubmenu: collections.map(collection => {\n\t\t\t\t\t\tconst name = collection.resolveValue(\"name\") || Dictionary.Collection\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t\t\t\tclick() {\n\t\t\t\t\t\t\t\trecord(\"collection_reference_create\", { source: \"variables_modal_add\" })\n\t\t\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\t\t\ttype: ControlType.CollectionReference,\n\t\t\t\t\t\t\t\t\tdataIdentifier: collection.instanceIdentifier,\n\t\t\t\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t\t\t\t\tname: singular(name),\n\t\t\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\t\t\tinsertAfterVariable: getSelectedVariableInfo(\n\t\t\t\t\t\t\t\t\t\tnodeWithVariables,\n\t\t\t\t\t\t\t\t\t\tengine.stores.variablesStore.selectedVariablePath,\n\t\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t})\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\t\t\t\t{\n\t\t\t\t\tlabel: \"Multi-Reference\",\n\t\t\t\t\ticon: showTypeIcons\n\t\t\t\t\t\t? getVariableCreationMenuIcon(ControlType.MultiCollectionReference, agentExperimentEnabled)\n\t\t\t\t\t\t: undefined,\n\t\t\t\t\tsubmenu: collections.map(collection => {\n\t\t\t\t\t\tconst name = collection.resolveValue(\"name\") || Dictionary.Collection\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t\t\tenabled: !isReadOnly,\n\t\t\t\t\t\t\tclick() {\n\t\t\t\t\t\t\t\trecord(\"collection_reference_create\", { source: \"variables_modal_add\" })\n\t\t\t\t\t\t\t\tcreateVariableFromMenu({\n\t\t\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\t\t\tscopeId: nodeWithVariables.id,\n\t\t\t\t\t\t\t\t\ttype: ControlType.MultiCollectionReference,\n\t\t\t\t\t\t\t\t\tdataIdentifier: collection.instanceIdentifier,\n\t\t\t\t\t\t\t\t\tinitialValue: undefined,\n\t\t\t\t\t\t\t\t\tname: plural(name),\n\t\t\t\t\t\t\t\t\tisAssigned: false,\n\t\t\t\t\t\t\t\t\tinsertAfterVariable: getSelectedVariableInfo(\n\t\t\t\t\t\t\t\t\t\tnodeWithVariables,\n\t\t\t\t\t\t\t\t\t\tengine.stores.variablesStore.selectedVariablePath,\n\t\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t})\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\t\t\t)\n\t\t}\n\t}\n\n\tif (includeDivider) {\n\t\toptions.push({ type: \"separator\" })\n\t\toptions.push({\n\t\t\tlabel: \"Divider\",\n\t\t\ticon: showTypeIcons ? menuIconForDivider(agentExperimentEnabled) : undefined,\n\t\t\tenabled: !isReadOnly,\n\t\t\tclick: () => {\n\t\t\t\tconst collection = engine.tree.current(nodeWithVariables)\n\t\t\t\tassert(isCollectionNode(collection), \"Dividers can only be added to collection nodes\")\n\n\t\t\t\tconst { variablesStore } = engine.stores\n\n\t\t\t\tconst divider: VariableDivider = {\n\t\t\t\t\tid: randomID(),\n\t\t\t\t\tname: \"\",\n\t\t\t\t\ttype: \"divider\",\n\t\t\t\t\tdescription: undefined,\n\t\t\t\t}\n\n\t\t\t\tconst selectedVariableId = selectedVariableInfo?.selectedVariable?.id\n\n\t\t\t\tif (selectedVariableInfo?.selectedVariableParent) {\n\t\t\t\t\tconst { selectedVariableParent } = selectedVariableInfo\n\t\t\t\t\tconst variableParentId = selectedVariableParent.id\n\n\t\t\t\t\tconst arrayVariables = getVariableListFromVariableParent(collection, variableParentId)\n\t\t\t\t\tif (!arrayVariables) return\n\n\t\t\t\t\tconst insertIndex = getVariableInsertionIndex(arrayVariables, selectedVariableId)\n\t\t\t\t\tconst newArrayVariables = List.insert(arrayVariables, insertIndex, divider)\n\n\t\t\t\t\tupdateVariableListInVariableParent(collection, variableParentId, newArrayVariables)\n\t\t\t\t\tvariablesStore.selectedVariablePath = [variableParentId, divider.id]\n\t\t\t\t} else {\n\t\t\t\t\tconst insertIndex = getVariableInsertionIndex(collection.variables, selectedVariableId)\n\t\t\t\t\tconst newVariables = List.insert(collection.variables, insertIndex, divider)\n\t\t\t\t\tcollection.set({ variables: newVariables })\n\t\t\t\t\tvariablesStore.selectedVariablePath = [divider.id]\n\t\t\t\t}\n\n\t\t\t\tif (showFieldsPopout) {\n\t\t\t\t\tconst parentId = selectedVariableInfo?.selectedVariableParent?.id\n\t\t\t\t\tengine.stores.chromeStore.activeCollectionPanelTab = CollectionPanelTab.Fields\n\t\t\t\t\tengine.floatingWindowPopoutNavigation?.presentPopout(generateVariablePanelPopoutId(divider.id, parentId))\n\t\t\t\t} else {\n\t\t\t\t\tengine.stores.modalStore.set({ type: ModalType.Variables, source: \"context_menu\" })\n\t\t\t\t}\n\n\t\t\t\trecord(\"variable_create\", { scopeType: \"collection\", variableType: \"divider\" })\n\t\t\t\tonCreate?.()\n\t\t\t},\n\t\t})\n\t}\n\n\treturn options\n}\n\nfunction getVariableCreationMenuIcon(\n\ttype:\n\t\t| (typeof creationVariables)[number]\n\t\t| ControlType.CollectionReference\n\t\t| ControlType.MultiCollectionReference\n\t\t| ControlType.VectorSetItem,\n\tagentExperimentEnabled: boolean,\n): NonNullable<MenuItemOptions[\"icon\"]> | undefined {\n\tswitch (type) {\n\t\tcase ControlType.String:\n\t\tcase ControlType.RichText:\n\t\tcase ControlType.Date:\n\t\tcase ControlType.Link:\n\t\tcase ControlType.Image:\n\t\tcase ControlType.Color:\n\t\tcase ControlType.Boolean:\n\t\tcase ControlType.Number:\n\t\tcase ControlType.Enum:\n\t\tcase ControlType.File:\n\t\tcase ControlType.CollectionReference:\n\t\tcase ControlType.MultiCollectionReference:\n\t\tcase ControlType.VectorSetItem:\n\t\tcase \"slug\":\n\t\t\treturn menuIconForVariableType(type, agentExperimentEnabled)\n\t\tcase ControlType.Array:\n\t\t\treturn menuIconForGalleryVariable(agentExperimentEnabled)\n\t\tcase ControlType.EventHandler:\n\t\tcase ControlType.Transition:\n\t\tcase ControlType.Border:\n\t\tcase ControlType.Cursor:\n\t\tcase ControlType.BoxShadow:\n\t\tcase ControlType.Location:\n\t\t\treturn undefined\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n", "import {\n\tIconControlTypeArray,\n\tIconControlTypeBoolean,\n\tIconControlTypeCollectionReference,\n\tIconControlTypeColor,\n\tIconControlTypeDate,\n\tIconControlTypeDivider,\n\tIconControlTypeEnum,\n\tIconControlTypeFile,\n\tIconControlTypeGallery,\n\tIconControlTypeImage,\n\tIconControlTypeLink,\n\tIconControlTypeMultiCollectionReference,\n\tIconControlTypeNumber,\n\tIconControlTypeRichText,\n\tIconControlTypeSlug,\n\tIconControlTypeString,\n\tIconControlTypeVectorSetItem,\n} from \"@framerjs/fresco\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport type { VariableDefinition, VariableType } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { isArrayGalleryVariable } from \"document/models/CanvasTree/traits/WithVariables.ts\"\nimport { ControlType } from \"library/render/types/PropertyControls.ts\"\nimport { assertNever } from \"library/utils/assert.ts\"\nimport type React from \"react\"\nimport { useId, type SVGProps } from \"react\"\nimport { renderToStaticMarkup } from \"react-dom/server\"\nimport { isSlugVariable } from \"utils/variableMetadata.ts\"\nimport {\n\tIconAgentLayerFormSelect,\n\tIconAgentLayerImage,\n\tIconAgentLayerLink,\n\tIconAgentLayerVector,\n} from \"../../layers/AgentLayerIcons.tsx\"\n\nfunction IconAgentControlTypeString(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<g fill=\"transparent\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeMiterlimit=\"10\" strokeWidth=\"1.5\">\n\t\t\t\t<path d=\"M6.25 2.25V10M2 2.25h8.5\" />\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeRichText(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\td=\"M2 2.75h8M2 9.25h8\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeMiterlimit=\"10\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeSlug(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<path d=\"m7.5 1.5-4 9\" fill=\"transparent\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeWidth=\"1.5\" />\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeDate(props: SVGProps<SVGSVGElement>) {\n\tconst clipPathId = `agent-control-type-date-icon-${useId().replace(/:/gu, \"\")}`\n\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<defs>\n\t\t\t\t<clipPath id={clipPathId}>\n\t\t\t\t\t<path d=\"M.5 3.5a3 3 0 0 1 3-3h5a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h-5a3 3 0 0 1-3-3Z\" />\n\t\t\t\t</clipPath>\n\t\t\t</defs>\n\t\t\t<path\n\t\t\t\td=\"M.5 3.5a3 3 0 0 1 3-3h5a3 3 0 0 1 3 3v5a3 3 0 0 1-3 3h-5a3 3 0 0 1-3-3Z\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\tstrokeWidth=\"3\"\n\t\t\t\tclipPath={`url(#${clipPathId})`}\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillOpacity={0.2}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\td=\"M10 1.5H2.5l-1 1v2H11v-1Z\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeGallery(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<g stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.5\">\n\t\t\t\t<path\n\t\t\t\t\tfill=\"currentColor\"\n\t\t\t\t\tfillOpacity={0.2}\n\t\t\t\t\td=\"M4.25 2.25a1.5 1.5 0 0 1 1.5-1.5h4a1.5 1.5 0 0 1 1.5 1.5v4a1.5 1.5 0 0 1-1.5 1.5h-4a1.5 1.5 0 0 1-1.5-1.5Z\"\n\t\t\t\t/>\n\t\t\t\t<path\n\t\t\t\t\tfill=\"transparent\"\n\t\t\t\t\td=\"M8 7.75v2a1.5 1.5 0 0 1-1.5 1.5h-4A1.5 1.5 0 0 1 1 9.75v-4a1.5 1.5 0 0 1 1.5-1.5h1.75\"\n\t\t\t\t/>\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeColor(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillOpacity={0.2}\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\td=\"M9.182 9.932a4.5 4.5 0 0 1-6.364-6.364l2.475-2.475a1 1 0 0 1 1.414 0l2.475 2.475a4.5 4.5 0 0 1 0 6.364\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeBoolean(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\td=\"M.75 6.25a4 4 0 0 1 4-4h2.5a4 4 0 0 1 0 8h-2.5a4 4 0 0 1-4-4Z\"\n\t\t\t/>\n\t\t\t<path fill=\"currentColor\" d=\"M4.75 4.75a1.5 1.5 0 1 1-.001 3.001A1.5 1.5 0 0 1 4.75 4.75\" />\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeNumber(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\td=\"M3.25 1.5v9M8.75 1.5v9M1.5 3.25h9M1.5 8.75h9\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeFile(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\td=\"M1.75 2.75c0-1.105.895-2 2-2h1c.552 0 1 .448 1 1v2.5c0 .552.448 1 1 1h2.5c.552 0 1 .448 1 1v3c0 1.105-.895 2-2 2h-4.5c-1.105 0-2-.895-2-2Z\"\n\t\t\t\tfill=\"currentColor\"\n\t\t\t\tfillOpacity={0.2}\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\td=\"M4.5.75h1.172c.53 0 1.039.211 1.414.586l2.578 2.578c.375.375.586.884.586 1.414V6.5\"\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeReference(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeLinejoin=\"round\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\td=\"m7.5 10.5 3.222-3.02a1 1 0 0 0 0-1.46L7.5 3\"\n\t\t\t/>\n\t\t\t<path\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeMiterlimit=\"10\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\td=\"M1 3v.25c0 2 1.6 3.5 3.5 3.5H11\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeMultiReference(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<g fill=\"transparent\" stroke=\"currentColor\" strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth=\"1.5\">\n\t\t\t\t<path d=\"m1.75 2 4 4-4 4\" />\n\t\t\t\t<path d=\"m7.25 2 2.586 2.586a2 2 0 0 1 0 2.828L7.25 10\" />\n\t\t\t</g>\n\t\t</svg>\n\t)\n}\n\nfunction IconAgentControlTypeDivider(props: SVGProps<SVGSVGElement>) {\n\treturn (\n\t\t<svg role=\"presentation\" xmlns=\"http://www.w3.org/2000/svg\" width=\"12\" height=\"12\" fill=\"none\" {...props}>\n\t\t\t<path\n\t\t\t\tfill=\"transparent\"\n\t\t\t\tstroke=\"currentColor\"\n\t\t\t\tstrokeLinecap=\"round\"\n\t\t\t\tstrokeMiterlimit=\"10\"\n\t\t\t\tstrokeWidth=\"1.5\"\n\t\t\t\td=\"M1 6.25h10\"\n\t\t\t/>\n\t\t</svg>\n\t)\n}\n\nexport function panelIconForVariableType(type: VariableType, agentExperimentEnabled: boolean) {\n\tswitch (type) {\n\t\tcase ControlType.String:\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeString />\n\t\t\treturn <IconControlTypeString />\n\t\tcase ControlType.RichText:\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeRichText />\n\t\t\treturn <IconControlTypeRichText />\n\t\tcase ControlType.Number:\n\t\tcase ControlType.ScrollSectionRef:\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeNumber />\n\t\t\treturn <IconControlTypeNumber />\n\t\tcase ControlType.Boolean:\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeBoolean />\n\t\t\treturn <IconControlTypeBoolean />\n\t\tcase ControlType.Color:\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeColor />\n\t\t\treturn <IconControlTypeColor />\n\t\tcase ControlType.Image:\n\t\t\tif (agentExperimentEnabled) return <IconAgentLayerImage />\n\t\t\treturn <IconControlTypeImage />\n\t\tcase ControlType.Link:\n\t\t\tif (agentExperimentEnabled) return <IconAgentLayerLink />\n\t\t\treturn <IconControlTypeLink />\n\t\tcase ControlType.Date:\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeDate />\n\t\t\treturn <IconControlTypeDate />\n\t\tcase ControlType.Enum:\n\t\tcase \"controlReference\":\n\t\tcase \"nodePropertyControlReference\":\n\t\t\tif (agentExperimentEnabled) return <IconAgentLayerFormSelect />\n\t\t\treturn <IconControlTypeEnum />\n\t\tcase ControlType.File:\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeFile />\n\t\t\treturn <IconControlTypeFile />\n\t\tcase \"slug\":\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeSlug />\n\t\t\treturn <IconControlTypeSlug />\n\t\tcase ControlType.CollectionReference:\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeReference />\n\t\t\treturn <IconControlTypeCollectionReference />\n\t\tcase ControlType.MultiCollectionReference:\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeMultiReference />\n\t\t\treturn <IconControlTypeMultiCollectionReference />\n\t\tcase ControlType.Array:\n\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeGallery />\n\t\t\treturn <IconControlTypeArray />\n\t\tcase ControlType.VectorSetItem:\n\t\t\tif (agentExperimentEnabled) return <IconAgentLayerVector />\n\t\t\treturn <IconControlTypeVectorSetItem />\n\t\tcase ControlType.EventHandler:\n\t\tcase ControlType.CustomCursor:\n\t\tcase ControlType.Cursor:\n\t\tcase ControlType.Transition:\n\t\tcase ControlType.Border:\n\t\tcase ControlType.BoxShadow:\n\t\tcase ControlType.Gap:\n\t\tcase ControlType.Padding:\n\t\tcase ControlType.BorderRadius:\n\t\tcase ControlType.TrackingId:\n\t\tcase ControlType.Location:\n\t\tcase ControlType.LinkRelValues:\n\t\t\tthrow new Error(`Unsupported variable type for variables panel: ${type}`)\n\t\tdefault:\n\t\t\tassertNever(type, `panelIconForVariableType(), unsupported variable type: ${type}`)\n\t}\n}\n\nexport function panelIconForVariable(variable: VariableDefinition, agentExperimentEnabled: boolean) {\n\tif (isArrayGalleryVariable(variable)) {\n\t\tif (agentExperimentEnabled) return <IconAgentControlTypeGallery />\n\t\treturn <IconControlTypeGallery />\n\t}\n\n\tif (isSlugVariable(variable)) {\n\t\tif (agentExperimentEnabled) return <IconAgentControlTypeSlug />\n\t\treturn <IconControlTypeSlug />\n\t}\n\n\tif (variable.type === \"controlReference\" || variable.type === \"nodePropertyControlReference\") {\n\t\tconst { expectedType } = variable\n\t\tswitch (expectedType) {\n\t\t\tcase ControlType.Enum:\n\t\t\tcase ControlType.SegmentedEnum:\n\t\t\t\tif (agentExperimentEnabled) return <IconAgentLayerFormSelect />\n\t\t\t\treturn <IconControlTypeEnum />\n\t\t\tcase ControlType.File:\n\t\t\t\tif (agentExperimentEnabled) return <IconAgentControlTypeFile />\n\t\t\t\treturn <IconControlTypeFile />\n\t\t\tdefault:\n\t\t\t\tassertNever(expectedType, `panelIconForVariable(), unsupported control reference type: ${expectedType}`)\n\t\t}\n\t}\n\n\treturn panelIconForVariableType(variable.type, agentExperimentEnabled)\n}\n\nexport function createMenuIcon(icon: React.ReactElement): NonNullable<MenuItemOptions[\"icon\"]> {\n\tconst src = renderToStaticMarkup(icon)\n\treturn { src, inlineSVG: true, width: 12, height: 12 }\n}\n\ntype AgentExperimentEnabled = boolean\ntype MenuIconByVariableTypeKey = `${VariableType}${AgentExperimentEnabled}`\nconst menuIconsByVariableType = new Map<MenuIconByVariableTypeKey, NonNullable<MenuItemOptions[\"icon\"]>>()\nlet galleryMenuIcon: NonNullable<MenuItemOptions[\"icon\"]> | undefined\nlet dividerMenuIcon: NonNullable<MenuItemOptions[\"icon\"]> | undefined\nlet galleryMenuIconLegacy: NonNullable<MenuItemOptions[\"icon\"]> | undefined\nlet dividerMenuIconLegacy: NonNullable<MenuItemOptions[\"icon\"]> | undefined\n\nexport function menuIconForVariableType(\n\ttype: VariableType,\n\tagentExperimentEnabled: boolean,\n): NonNullable<MenuItemOptions[\"icon\"]> {\n\tconst cacheKey: MenuIconByVariableTypeKey = `${type}${agentExperimentEnabled ? \"true\" : \"false\"}`\n\n\tconst cachedIcon = menuIconsByVariableType.get(cacheKey)\n\tif (cachedIcon) return cachedIcon\n\n\tconst icon = createMenuIcon(panelIconForVariableType(type, agentExperimentEnabled))\n\tmenuIconsByVariableType.set(cacheKey, icon)\n\treturn icon\n}\n\nexport function menuIconForGalleryVariable(agentExperimentEnabled: boolean): NonNullable<MenuItemOptions[\"icon\"]> {\n\tif (!agentExperimentEnabled) {\n\t\tgalleryMenuIconLegacy ??= createMenuIcon(<IconControlTypeGallery />)\n\t\treturn galleryMenuIconLegacy\n\t}\n\n\tgalleryMenuIcon ??= createMenuIcon(<IconAgentControlTypeGallery />)\n\treturn galleryMenuIcon\n}\n\nexport function menuIconForDivider(agentExperimentEnabled: boolean): NonNullable<MenuItemOptions[\"icon\"]> {\n\tif (!agentExperimentEnabled) {\n\t\tdividerMenuIconLegacy ??= createMenuIcon(<IconControlTypeDivider />)\n\t\treturn dividerMenuIconLegacy\n\t}\n\n\tdividerMenuIcon ??= createMenuIcon(<IconAgentControlTypeDivider />)\n\treturn dividerMenuIcon\n}\n", "import type { EntityDefinition } from \"@framerjs/framer-runtime\"\nimport { isReactComponentDefinition } from \"@framerjs/framer-runtime\"\nimport { localPackageFallbackIdentifier } from \"@framerjs/framer-runtime/crossorigin\"\nimport type { LocalModuleExportIdentifierString } from \"@framerjs/shared\"\nimport {\n\tModuleType,\n\tassert,\n\tassertNever,\n\tisExternalModuleIdentifier,\n\tisLocalModuleIdentifier,\n\tparseModuleIdentifier,\n\tunhandledError,\n} from \"@framerjs/shared\"\nimport { noop } from \"@framerjs/shared/src/noop.ts\"\nimport { actionLabels } from \"app/ActionLabels.ts\"\nimport { appAccelerators } from \"app/AppAccelerators.ts\"\nimport { Dictionary } from \"app/dictionary.ts\"\nimport { employeesOnlySettings } from \"app/employeesOnlySettings.ts\"\nimport { experimentIsOnOrForceEnabled, experiments } from \"app/experiments.ts\"\nimport type { MenuItemOptions } from \"app/menu.ts\"\nimport { withEnabledCheck } from \"app/menu.ts\"\nimport { MetricsInteractionViews } from \"app/metrics.ts\"\nimport { projectFeatures } from \"app/projectFeatures.ts\"\nimport type { VekterEngine } from \"document/VekterEngine.ts\"\nimport { convertToOutline, convertToOutlineEnabled } from \"document/components/tools/pathEdit/utils/convertToOutline.ts\"\nimport { flattenEnabled, flattenShape } from \"document/components/tools/pathEdit/utils/index.ts\"\nimport {\n\tgetComponentName,\n\tisUserCreatedComponent,\n\tremoveCategoriesFromName,\n} from \"document/components/utils/componentHelpers.ts\"\nimport { flipShapes } from \"document/components/utils/dimensions.ts\"\nimport { editInfoForCodeComponent } from \"document/components/utils/editActionForCodeComponent.ts\"\nimport type {\n\tCanvasNode,\n\tCanvasTree,\n\tFrameNode,\n\tLoadedScopeNode,\n\tNodeID,\n\tRichTextNode,\n} from \"document/models/CanvasTree/index.ts\"\nimport { CodeComponentNode, isVectorNode } from \"document/models/CanvasTree/index.ts\"\nimport { ComponentEntityTypeRootNode } from \"document/models/CanvasTree/nodes/EntityTypeRootNode.ts\"\nimport type { ExternalModuleNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport { ExternalModulesListNode } from \"document/models/CanvasTree/nodes/ExternalModuleNode.ts\"\nimport { isContentNode, isInlineVectorNode } from \"document/models/CanvasTree/nodes/TreeNode.ts\"\nimport { isInBreakpoint } from \"document/models/CanvasTree/nodes/utils/breakpointHelpers.ts\"\nimport { openExternalModuleWithAccessCheck } from \"document/models/CanvasTree/nodes/utils/externalModuleNodeHelpers.ts\"\nimport { isAnyTextNode } from \"document/models/CanvasTree/nodes/utils/isAnyTextNode.ts\"\nimport { moduleIdentifierToLocalComponentId } from \"document/models/CanvasTree/nodes/utils/moduleIdentifierToLocalComponentId.ts\"\nimport {\n\tisArrayRepeater,\n\tisCanvasPageNode,\n\tisCodeComponentNode,\n\tisCollectionNode,\n\tisCollectionRepeater,\n\tisColorStyleTokenListNode,\n\tisEntityFolderNode,\n\tisEntityReferenceNode,\n\tisExternalModuleNode,\n\tisFrameNode,\n\tisLayoutTemplateNode,\n\tisLinkStylePresetNode,\n\tisRichTextNode,\n\tisShapeContainerNode,\n\tisShapeGroupNode,\n\tisSlotPropertyNode,\n\tisSmartComponentNode,\n\tisTextStylePresetNode,\n\tisVectorInstance,\n\tisVectorSetNode,\n\tisWebPageNode,\n} from \"document/models/CanvasTree/nodes/utils/nodeCheck.ts\"\nimport { isFixedOrRelativeOverlay, nodeHasAnyOverlay } from \"document/models/CanvasTree/nodes/utils/overlayHelpers.ts\"\nimport { isDynamicValue } from \"document/models/CanvasTree/traits/DynamicValue.ts\"\nimport { withCollectionDataSource } from \"document/models/CanvasTree/traits/WithCollectionDataSource.ts\"\nimport { hasCustomizations } from \"document/models/CanvasTree/traits/WithCustomizations.ts\"\nimport { isFormSubmitButtonInstance } from \"document/models/CanvasTree/traits/WithFormVariants.ts\"\nimport type { GuideSelector } from \"document/models/CanvasTree/traits/WithGuides.ts\"\nimport { hasItemsOrderOverride } from \"document/models/CanvasTree/traits/WithItemsOrder.ts\"\nimport { hasLayoutTemplate } from \"document/models/CanvasTree/traits/WithLayoutTemplate.ts\"\nimport type { Overflow } from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport {\n\tallOverflowValues,\n\ttitleForOverflowOption,\n\twithOverflow,\n} from \"document/models/CanvasTree/traits/WithOverflow.ts\"\nimport type { OverlayGrid } from \"document/models/CanvasTree/traits/WithOverlayGrid.ts\"\nimport { withPath } from \"document/models/CanvasTree/traits/WithPath.ts\"\nimport { isScreen } from \"document/models/CanvasTree/traits/WithScreen.ts\"\nimport { withShape } from \"document/models/CanvasTree/traits/WithShape.ts\"\nimport { isReplicaChild, isReplicaOrReplicaChild } from \"document/models/CanvasTree/traits/WithTemplate.ts\"\nimport { migrateLetterSpacing } from \"document/models/CanvasTree/traits/WithTextStyle.ts\"\nimport type { IsBreakpoint, IsVariant } from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport {\n\tisBreakpointVariant,\n\tisPrimaryVariant,\n\tisReplicaVariantOrReplicaVariantChild,\n\tisVariant,\n} from \"document/models/CanvasTree/traits/WithVariant.ts\"\nimport { isVectorSetItem } from \"document/models/CanvasTree/traits/WithVectorSetItem.ts\"\nimport { isFormContainer } from \"document/models/CanvasTree/traits/forms/WithFormContainer.ts\"\nimport { NotFound, isFoundAndNotMixed } from \"document/models/CanvasTree/traits/utils/Reduced.ts\"\nimport { HardCodedCodeIdentifier } from \"document/models/CanvasTree/traits/utils/hardCodedCodeComponentIdentifiers.ts\"\nimport { isSymbolReplicaChild } from \"document/models/CanvasTree/traits/utils/isSymbol.ts\"\nimport type { ReducedOverflow } from \"document/models/CanvasTree/traits/utils/reduceOverflow.ts\"\nimport { reduceOverflow } from \"document/models/CanvasTree/traits/utils/reduceOverflow.ts\"\nimport { getFrameFillColor } from \"document/models/CanvasTree/utils/getFrameFillColor.ts\"\nimport {\n\tgetInheritedVariablesValueMap,\n\tgetNodeUpdateResolvingDynamicValues,\n} from \"document/models/CanvasTree/utils/getNodeUpdateResolvingDynamicValues.ts\"\nimport { canBeHomeNode, isHomeNode, setHomeNode } from \"document/models/CanvasTree/utils/homeNode.ts\"\nimport { sortGroundNodesForPage } from \"document/models/CanvasTree/utils/sortGroundNodes.ts\"\nimport { Tools } from \"document/stores/ToolEnum.ts\"\nimport { ActiveContentPanelTab, ActiveMainView, CollectionPanelTab } from \"document/utils/ActiveEditorType.ts\"\nimport { ModalType } from \"document/utils/ModalType.ts\"\nimport {\n\tgetCollectionNodeFromStackElement,\n\tgetItemNodeFromStackElement,\n} from \"document/utils/contentManagementOverlayStack.ts\"\nimport { applyLayoutTemplate, getSlotNodeIndex } from \"export/exportLayoutTemplates.ts\"\nimport type { Rect } from \"library/index.ts\"\nimport type { Point } from \"library/render/types/Point.ts\"\nimport { isLocalSmartComponent } from \"modules/utils.ts\"\nimport { compareStringsNaturally } from \"utils/compareStringsNaturally.ts\"\nimport { createCollectionItemWhenReady } from \"utils/createCollectionItem.ts\"\nimport { getCollectionForIdentifier } from \"utils/getCollectionForIdentifier.ts\"\nimport { isRepeaterDescendent } from \"utils/isRepeaterDescendent.ts\"\nimport { getParentDataRepeater, getRepeatedItemIdUpdate, isRepeatedItem } from \"utils/repeaterUtils.ts\"\nimport { isFunction } from \"utils/typeChecks.ts\"\nimport { setViewParamsInURL } from \"utils/urlParams.ts\"\nimport { externalVectorSetInfo } from \"utils/vectorSets.ts\"\nimport { toast } from \"web/lib/toaster.ts\"\nimport { Pages, record } from \"web/lib/tracker.ts\"\nimport { getIsViewOnly } from \"web/pages/project/permissions/isViewOnly.ts\"\nimport { isDraftThread } from \"../../../feedback/model.ts\"\nimport { dataForExternalVectorSet, dataForLocalVectorSet } from \"../chrome/assets/DraggableEntityItem.tsx\"\nimport type { ExternalModuleComponent } from \"../chrome/assets/types.ts\"\nimport { getCollectionCreationOptions } from \"../chrome/contentManagement/utils/getCollectionCreationOptions.ts\"\nimport { getCollectionItemMenuOptions } from \"../chrome/contentManagement/utils/getCollectionItemMenuOptions.ts\"\nimport { isEditFieldsUseableInScreen } from \"../chrome/contentManagement/utils/screenFeatureUtils.ts\"\nimport {\n\tgetSourceAndTranslationInfoForLayers,\n\thasBatchTranslatableItems,\n\tshowBatchTranslateAllModal,\n} from \"../chrome/localization/batchTranslateUtils.ts\"\nimport { createLocale } from \"../chrome/localization/createLocale.tsx\"\nimport { viewSourceOption } from \"../chrome/localization/useSourceOptionsMenu.ts\"\nimport { getVariableCreationMenuOptions } from \"../chrome/shared/VariablesModal/getVariableCreationMenuOptions.ts\"\nimport { rightSideOf } from \"../tools/utils/FramesHelper.ts\"\nimport { RenamedIds, updateNodeConnections } from \"../tools/utils/updateNodeConnections.ts\"\nimport type { BreakpointSuggestion } from \"./breakpointSuggestion.ts\"\nimport { getBreakpointMenu } from \"./breakpointSuggestion.ts\"\nimport type { CategorizableComponent } from \"./componentHelpers.ts\"\nimport { ContextAction } from \"./contextActions.ts\"\nimport { ContextAlignment } from \"./contextAlignmentActions.ts\"\nimport { isFramerModule } from \"./defaultComponents.ts\"\nimport { canAutoSizeNodes, enableAutoSizeForNodes, isAutoSizeVisible } from \"./enableAutoSizeForNodes.ts\"\nimport { getExternalModuleComponentGroups } from \"./externalModuleGroups.tsx\"\nimport { scopeAllowsRenameLayers } from \"./renameLayers.ts\"\nimport {\n\tcanReplaceNode,\n\tgetComponentToUseAsReplacement,\n\tmodifyLocalSmartComponentToBeFormButtonInstance,\n\treplacingSubmitButtonWithTemplateWillModifyTemplate,\n\treplaceNodeWithTemplate,\n} from \"./replaceNodes.ts\"\n\nexport enum Context {\n\tCanvas = 0,\n}\n\nexport function createContextMenuItems(\n\tengine: VekterEngine,\n\tmainView: ActiveMainView,\n\tselection?: NodeID[],\n\tselectedGuide?: GuideSelector | null,\n\tclipboardGrid?: OverlayGrid,\n\tcontext?: Context,\n): MenuItemOptions[] | null {\n\t// NOTE: These shortcuts should also be added to the normal shortcut handling (when the menu is not showing)\n\t// NOTE: To add actions, define 'click:' with a function as value\n\tconst {\n\t\tlocalizationStore,\n\t\tchromeStore,\n\t\tcontentManagementStore,\n\t\tselectionStore,\n\t\toverlayStore,\n\t\tmodalStore,\n\t\ttoolStore,\n\t\tfeedbackStore,\n\t\tscopeStore,\n\t\ttreeStore,\n\t\tsiteSettingsStore,\n\t\tpersistedUserDefaults,\n\t\tmodulesStore,\n\t} = engine.stores\n\n\tif (chromeStore.isPreviewingLocaleOnCanvas) {\n\t\treturn null\n\t}\n\n\t// Handle view-only mode.\n\tconst isNotViewOnly = () => !getIsViewOnly(engine, \"canDesign\")\n\tconst isViewOnly = !isNotViewOnly()\n\n\t// Context actions can be requested from quick actions while the site settings is active\n\tif (siteSettingsStore.active) {\n\t\treturn null\n\t}\n\n\t// Localizations\n\tif (mainView === ActiveMainView.Localizations) {\n\t\tconst activeLocale = engine.tree.root.getNonDefaultLocale(localizationStore.selectedLocaleId)\n\t\tconst hasActiveLocale = Boolean(activeLocale)\n\n\t\tconst overlay = chromeStore.overlay\n\t\tif (overlay?.type === \"localization\") {\n\t\t\t// Overlay visible\n\t\t\tconst overlayKeyPath = overlay.keyPath\n\n\t\t\tconst source = localizationStore.getSourceForKeyPath(overlayKeyPath)\n\t\t\tif (!source) return null\n\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Options\",\n\t\t\t\t\tsubmenu: [viewSourceOption(source)],\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Locale,\n\t\t\t\tsubmenu: [\n\t\t\t\t\twithEnabledCheck({\n\t\t\t\t\t\tlabel: `New ${Dictionary.Locale}`,\n\t\t\t\t\t\trole: \"addLocale\",\n\t\t\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\t\t\tclick: () => createLocale(\"localization_sidebar\"),\n\t\t\t\t\t}),\n\t\t\t\t\twithEnabledCheck({\n\t\t\t\t\t\tlabel: `${Dictionary.Translate} All`,\n\t\t\t\t\t\trole: \"batchTranslateAll\",\n\t\t\t\t\t\tenabled: () => !getIsViewOnly(engine, \"canEditContent\") && hasActiveLocale,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tif (!activeLocale) return\n\n\t\t\t\t\t\t\tif (!hasBatchTranslatableItems(activeLocale)) {\n\t\t\t\t\t\t\t\ttoast({\n\t\t\t\t\t\t\t\t\tkey: \"no-batch-translatable-items\",\n\t\t\t\t\t\t\t\t\ttype: \"add\",\n\t\t\t\t\t\t\t\t\tprimaryText: \"All items\",\n\t\t\t\t\t\t\t\t\tsecondaryText: \"have already been translated.\",\n\t\t\t\t\t\t\t\t\tvariant: \"info\",\n\t\t\t\t\t\t\t\t\tduration: 5000,\n\t\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tshowBatchTranslateAllModal(activeLocale, \"quick_actions\")\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t\twithEnabledCheck({\n\t\t\t\t\t\tlabel: activeLocale ? `Edit ${activeLocale.name} Settings` : Dictionary.Settings,\n\t\t\t\t\t\trole: \"editLocale\",\n\t\t\t\t\t\tenabled: () => isNotViewOnly() && hasActiveLocale,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tif (!activeLocale) return\n\t\t\t\t\t\t\tmodalStore.set({\n\t\t\t\t\t\t\t\ttype: ModalType.LocaleSettings,\n\t\t\t\t\t\t\t\tinitialLocaleId: activeLocale.id,\n\t\t\t\t\t\t\t\tsource: \"context_menu\",\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\t{\n\t\t\t\t\t\tlabel: activeLocale ? `View ${activeLocale.name} on Canvas` : `View on Canvas`,\n\t\t\t\t\t\trole: \"viewLocaleOnCanvas\",\n\t\t\t\t\t\tenabled: hasActiveLocale,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tif (!activeLocale) return\n\t\t\t\t\t\t\tchromeStore.canvasLocaleId = activeLocale.id\n\t\t\t\t\t\t\tchromeStore.setLocalizationsVisible(false)\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: \"Filter\",\n\t\t\t\tvisible: hasActiveLocale,\n\t\t\t\tsubmenu: [\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Filter by Page, Collection\u2026\",\n\t\t\t\t\t\trole: \"filterLocalizationByScope\",\n\t\t\t\t\t\tclick: noop, // Handled within quick actions modal\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: \"Filter by Status\u2026\",\n\t\t\t\t\t\trole: \"filterLocalizationByStatus\",\n\t\t\t\t\t\tclick: noop, // Handled within quick actions modal\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t]\n\t}\n\n\tif (selectedGuide) {\n\t\treturn [\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: Dictionary.Delete,\n\t\t\t\trole: \"delete\",\n\t\t\t\tclick: () => ContextAction.deleteAction(engine),\n\t\t\t\tenabled: isNotViewOnly,\n\t\t\t}),\n\t\t]\n\t}\n\n\tif (toolStore.feedbackModeActive && feedbackStore.threadIdUnderMouse) {\n\t\tconst thread = feedbackStore.getThread(feedbackStore.threadIdUnderMouse)\n\t\tif (!thread || isDraftThread(thread.id)) return null\n\n\t\treturn [\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: thread.archived ? \"Reopen\" : \"Resolve\",\n\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\tclick: () =>\n\t\t\t\t\tthread.archived ? feedbackStore.unarchiveThread(thread.id) : feedbackStore.archiveThread(thread.id),\n\t\t\t}),\n\t\t]\n\t}\n\n\tif (selection === undefined || selection.length === 0) {\n\t\tconst noSelectionTemplate: MenuItemOptions[] = [\n\t\t\t{\n\t\t\t\tlabel: Dictionary.Paste,\n\t\t\t\trole: \"paste\",\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: actionLabels[Tools.actionForCase(Tools.Chat)],\n\t\t\t\trole: Tools.actionForCase(Tools.Chat),\n\t\t\t\taccelerator: appAccelerators.toolChat,\n\t\t\t},\n\t\t\t{\n\t\t\t\tlabel: actionLabels.quickActions,\n\t\t\t\trole: \"quickActions\",\n\t\t\t\tellipsis: true,\n\t\t\t\taccelerator: appAccelerators.quickActions,\n\t\t\t},\n\t\t]\n\n\t\tif (engine.tree) {\n\t\t\tconst activeNode = scopeStore.active\n\n\t\t\tif (activeNode.getGroundNodes().length) {\n\t\t\t\tnoSelectionTemplate.push(\n\t\t\t\t\t{ type: \"separator\" },\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: actionLabels.resetZoom,\n\t\t\t\t\t\trole: \"resetZoom\",\n\t\t\t\t\t\taccelerator: appAccelerators.resetZoom,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tlabel: actionLabels.zoomToFitAll,\n\t\t\t\t\t\trole: \"zoomToFitAll\",\n\t\t\t\t\t\taccelerator: appAccelerators.zoomToFitAll,\n\t\t\t\t\t},\n\t\t\t\t)\n\t\t\t}\n\n\t\t\tnoSelectionTemplate.push(\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.selectMostRecentPage,\n\t\t\t\t\trole: \"selectMostRecentPage\",\n\t\t\t\t\tvisible: isSmartComponentNode(activeNode),\n\t\t\t\t},\n\t\t\t)\n\n\t\t\tif (context === Context.Canvas) {\n\t\t\t\tnoSelectionTemplate.push(\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: \"separator\",\n\t\t\t\t\t},\n\t\t\t\t\twithEnabledCheck({\n\t\t\t\t\t\tlabel: Dictionary.SortLayersAlphabetically,\n\t\t\t\t\t\tclick: () => sortGroundNodesForPage({ engine }),\n\t\t\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t\treturn noSelectionTemplate\n\t}\n\n\t// These help the click callbacks.\n\tconst getSelectedNodes = () => engine.tree.getNodes(selection)\n\tconst getWithoutDescendants = () => engine.tree.withoutDescendants(getSelectedNodes())\n\tconst getSingleNode = () => {\n\t\tconst freshSelectedNodes = getSelectedNodes()\n\t\treturn freshSelectedNodes.length === 1 ? freshSelectedNodes[0] : null\n\t}\n\n\t// We capture the current tree and nodes here, but any click callbacks must\n\t// get these again from engine. Because blur events, or multi-user events,\n\t// might changed the nodes while the menu is open.\n\tconst selectedNodes = getSelectedNodes()\n\tconst withoutDescendants = getWithoutDescendants()\n\tconst withoutDescendantsAndReplicaChild = withoutDescendants.filter(n => !isReplicaChild(n))\n\tconst singleNode = getSingleNode()\n\n\t// CMS\n\tif (withoutDescendants.some(isContentNode)) {\n\t\tconst activeStackElement = contentManagementStore.getActiveCollectionStackElement()\n\t\tconst activeCollection = getCollectionNodeFromStackElement({\n\t\t\tstackElement: activeStackElement,\n\t\t\ttree: engine.tree,\n\t\t})\n\t\tconst activeItem = getItemNodeFromStackElement({\n\t\t\ttreeStore,\n\t\t\tcontentManagementStore,\n\t\t\tstackElement: activeStackElement,\n\t\t})\n\n\t\tif (activeCollection && activeItem) {\n\t\t\treturn getCollectionItemMenuOptions({\n\t\t\t\tengine,\n\t\t\t\tcollectionId: activeCollection.id,\n\t\t\t\tcollectionItemId: activeItem.id,\n\t\t\t\ttrackingPage: \"context_menu\",\n\t\t\t})\n\t\t}\n\n\t\tif (isCollectionNode(singleNode)) {\n\t\t\tconst isManagedByPlugin = Boolean(singleNode.managedByPlugin)\n\t\t\tconst canEditContent = () => {\n\t\t\t\treturn !getIsViewOnly(engine, \"canEditContent\") && !isManagedByPlugin\n\t\t\t}\n\n\t\t\tconst collectionItemOptions: MenuItemOptions[] = [\n\t\t\t\twithEnabledCheck({\n\t\t\t\t\tlabel: Dictionary.NewItem,\n\t\t\t\t\trole: \"newCollectionItem\",\n\t\t\t\t\tenabled: canEditContent,\n\t\t\t\t\tvisible: canEditContent(),\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tcreateCollectionItemWhenReady({\n\t\t\t\t\t\t\tcollectionId: singleNode.id,\n\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\tsource: \"context_menu\",\n\t\t\t\t\t\t})\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t]\n\n\t\t\tconst collectionOptions: MenuItemOptions[] = [\n\t\t\t\t{\n\t\t\t\t\tlabel: canEditContent() ? Dictionary.EditFields : Dictionary.ViewFields,\n\t\t\t\t\tvisible: isEditFieldsUseableInScreen() && chromeStore.activeCollectionPanelTab !== CollectionPanelTab.Fields,\n\t\t\t\t\trole: \"editFields\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\trecord(\"ui_interaction\", { id: \"edit_collection_variables\", page: Pages.contextMenu })\n\t\t\t\t\t\tchromeStore.activeCollectionPanelTab = CollectionPanelTab.Fields\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t...getCollectionCreationOptions(engine, MetricsInteractionViews.CONTEXT_MENU, {\n\t\t\t\t\tcollectionIdToDuplicate: singleNode.id,\n\t\t\t\t}),\n\t\t\t]\n\n\t\t\treturn [\n\t\t\t\t...collectionItemOptions,\n\t\t\t\t...collectionOptions,\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.AddField,\n\t\t\t\t\tenabled: !isViewOnly,\n\t\t\t\t\tvisible: !isViewOnly,\n\t\t\t\t\tsubmenu: getVariableCreationMenuOptions({\n\t\t\t\t\t\tengine,\n\t\t\t\t\t\tnodeWithVariables: singleNode,\n\t\t\t\t\t\tagentExperimentEnabled: experiments.isOn(\"agent\"),\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t]\n\t\t}\n\n\t\treturn null\n\t}\n\n\tconst canDetachFromPrimarySymbol = ContextAction.canDetachFromMaster(engine, selectedNodes)\n\tconst canGoToMaster = ContextAction.canGoToMaster(engine.tree, selectedNodes)\n\tconst canUpdateMasterFromInstance = ContextAction.canUpdateMasterFromInstance(engine.tree, selectedNodes)\n\tconst hasMaster = canDetachFromPrimarySymbol || canUpdateMasterFromInstance || canGoToMaster > 0\n\tconst canMakeComponent = ContextAction.canMakeComponent(engine, withoutDescendantsAndReplicaChild)\n\tconst canEditOverlay = singleNode && nodeHasAnyOverlay(singleNode, engine.tree, engine.componentLoader)\n\tconst isSingleCodeComponent = singleNode && isCodeComponentNode(singleNode)\n\n\tconst replaceWithMenu = replaceWithOptions(engine, withoutDescendants)\n\n\tconst replaceAllInstancesWithMenu = replaceWithOptions(engine, () => {\n\t\tlet replaceableComponentInstances: CodeComponentNode[] = []\n\t\tif (withoutDescendants.length === 1) {\n\t\t\tconst selectedNode = withoutDescendants[0]\n\t\t\tif (isCodeComponentNode(selectedNode)) {\n\t\t\t\tconst codeComponents = treeStore\n\t\t\t\t\t.query()\n\t\t\t\t\t.partial(true)\n\t\t\t\t\t.whereClass(CodeComponentNode)\n\t\t\t\t\t.wherePropertyEquals(\"codeComponentIdentifier\", selectedNode.codeComponentIdentifier)\n\t\t\t\t\t.asArray()\n\t\t\t\tconst isReplaceable = (node: CodeComponentNode) => {\n\t\t\t\t\treturn (\n\t\t\t\t\t\t// Don't replace inside replicas & variants, this is not\n\t\t\t\t\t\t// desirable (an instance using a different code component)\n\t\t\t\t\t\t// and not necessary (updating the primary will propagate\n\t\t\t\t\t\t// the update)\n\t\t\t\t\t\t!isSymbolReplicaChild(node) && !isReplicaVariantOrReplicaVariantChild(node)\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\treplaceableComponentInstances = codeComponents.filter(isReplaceable)\n\t\t\t}\n\t\t}\n\t\treturn replaceableComponentInstances\n\t})\n\n\tconst template: MenuItemOptions[] = []\n\n\tif (experiments.isOn(\"agent\") && selection.length > 0) {\n\t\ttemplate.push(\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: `Add To ${Dictionary.Agent}`,\n\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\tclick: () => ContextAction.addSelectionToAgent(engine.stores, selection),\n\t\t\t}),\n\t\t)\n\t\ttemplate.push({ type: \"separator\" })\n\t}\n\n\tif (singleNode && !isReplicaOrReplicaChild(singleNode) && isRepeaterDescendent(singleNode)) {\n\t\tconst parentRepeater = getParentDataRepeater(engine.tree, singleNode)\n\n\t\tif (parentRepeater) {\n\t\t\tconst isRepeated = isRepeatedItem(engine.tree, singleNode)\n\n\t\t\tlet label: string | undefined\n\t\t\tif (isCollectionRepeater(parentRepeater)) {\n\t\t\t\tlabel = isRepeated ? Dictionary.CollectionItem : \"Set as Collection Item\"\n\t\t\t} else if (isArrayRepeater(parentRepeater)) {\n\t\t\t\tlabel = isRepeated ? \"Repeated Item\" : \"Set as Repeated Item\"\n\t\t\t} else {\n\t\t\t\tassertNever(parentRepeater)\n\t\t\t}\n\n\t\t\ttemplate.push(\n\t\t\t\t{\n\t\t\t\t\tlabel,\n\t\t\t\t\tchecked: isRepeated,\n\t\t\t\t\tenabled: !isRepeated,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tengine.tree.current(parentRepeater)?.set(getRepeatedItemIdUpdate(singleNode.id))\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{ type: \"separator\" },\n\t\t\t)\n\t\t}\n\t}\n\n\tif (singleNode && withCollectionDataSource(singleNode) && singleNode.dataIdentifier) {\n\t\tconst collectionNodeId = getCollectionForIdentifier(engine.tree, singleNode.dataIdentifier)?.id\n\t\tif (collectionNodeId) {\n\t\t\ttemplate.push(\n\t\t\t\twithEnabledCheck({\n\t\t\t\t\tlabel: Dictionary.EditContent,\n\t\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\t\tclick: () => ContextAction.openContentCollection(engine, collectionNodeId),\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t}\n\n\tif (canEditOverlay) {\n\t\ttemplate.push(\n\t\t\t{\n\t\t\t\tlabel: \"Edit Overlay\",\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst overlay = singleNode.children?.find(isFixedOrRelativeOverlay)\n\t\t\t\t\tif (!overlay) return\n\t\t\t\t\toverlayStore.showOverlay(selectionStore, overlay, singleNode.id)\n\t\t\t\t},\n\t\t\t},\n\t\t\t{ type: \"separator\" },\n\t\t)\n\t}\n\n\tif (isSingleCodeComponent && singleNode.cache.formContainerAncestorId) {\n\t\tconst formContainer = engine.tree.get(singleNode.cache.formContainerAncestorId)\n\t\tconst originalFormContainer = engine.tree.get(formContainer?.getPrimaryId())\n\t\tconst originalNode = engine.tree.getNode(singleNode.getPrimaryId())\n\t\tif (isFormContainer(originalFormContainer) && isCodeComponentNode(originalNode)) {\n\t\t\tconst checked = originalFormContainer.formSubmitButtonId === originalNode?.id\n\t\t\tconst smartComponentId = moduleIdentifierToLocalComponentId(singleNode.codeComponentIdentifier)\n\t\t\tconst smartComponent = engine.tree.get(smartComponentId)\n\n\t\t\t// Add an item that allows Local Smart Component instances to be\n\t\t\t// promoted to the form's submit button. The item will be\n\t\t\t// checked even if the instance isn't local, but the component\n\t\t\t// can only be promoted if it's local.\n\t\t\ttemplate.push(\n\t\t\t\twithEnabledCheck({\n\t\t\t\t\tchecked,\n\t\t\t\t\tlabel: \"Set Submit Button\",\n\t\t\t\t\tenabled: () => !checked && isSmartComponentNode(smartComponent),\n\t\t\t\t\tclick: async () => {\n\t\t\t\t\t\tif (isViewOnly || !isSmartComponentNode(smartComponent)) return\n\t\t\t\t\t\tif (!smartComponent.isLoaded()) await smartComponent.load()\n\t\t\t\t\t\tassert(smartComponent.isLoaded(), \"Smart component not loaded\")\n\t\t\t\t\t\tif (await replacingSubmitButtonWithTemplateWillModifyTemplate(engine.tree, singleNode)) {\n\t\t\t\t\t\t\tmodalStore.set({\n\t\t\t\t\t\t\t\ttype: ModalType.Confirmation,\n\t\t\t\t\t\t\t\ttitle: \"Replace Submit Button\",\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\"To use this component as the Submit Button of the Form, we need to remove links and change it to a Button element.\",\n\t\t\t\t\t\t\t\tonConfirm: () =>\n\t\t\t\t\t\t\t\t\tmodifyLocalSmartComponentToBeFormButtonInstance(engine.tree, originalNode, originalFormContainer),\n\t\t\t\t\t\t\t\tconfirmLabel: Dictionary.Confirm,\n\t\t\t\t\t\t\t\tsource: \"replace_submit\",\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// The click handler is async and runs inside executeWithScheduler,\n\t\t\t\t\t\t\t// which closes editing after the synchronous portion returns. By\n\t\t\t\t\t\t\t// this point the awaits above have caused editClosed to be true,\n\t\t\t\t\t\t\t// so we need a new editing session for the tree mutation.\n\t\t\t\t\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\t\t\t\t\tmodifyLocalSmartComponentToBeFormButtonInstance(engine.tree, originalNode, originalFormContainer)\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\t\t\t\t{ type: \"separator\" },\n\t\t\t)\n\t\t}\n\t}\n\n\tif (isSingleCodeComponent) {\n\t\tconst parsedId = parseModuleIdentifier(singleNode.codeComponentIdentifier)\n\t\tconst externalModuleNode = isExternalModuleIdentifier(parsedId)\n\t\t\t? engine.tree.getNode<ExternalModuleNode>(parsedId.moduleId)\n\t\t\t: null\n\n\t\tconst items: MenuItemOptions[] = [\n\t\t\t...editInfoForCodeComponent(singleNode, engine, {\n\t\t\t\twithUnlinkModal: false,\n\t\t\t\texternalModuleType: externalModuleNode?.type,\n\t\t\t\tactivateContentPanel: ActiveContentPanelTab.Layers,\n\t\t\t}),\n\t\t]\n\n\t\titems.push(\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Set Default Size\",\n\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.canSetDefaultSize(engine, singleNode),\n\t\t\t\tclick: () => {\n\t\t\t\t\tContextAction.setDefaultSize(engine, singleNode)\n\t\t\t\t},\n\t\t\t}),\n\t\t)\n\n\t\tif (\n\t\t\texternalModuleNode?.ownerType === \"project\" &&\n\t\t\texternalModuleNode.ownerId &&\n\t\t\tparsedId &&\n\t\t\t(employeesOnlySettings.isOn(\"openPrimaryForBuiltInModules\") || !isFramerModule(treeStore.tree, parsedId))\n\t\t) {\n\t\t\titems.push({\n\t\t\t\tlabel: Dictionary.OpenPrimary,\n\t\t\t\tenabled: true,\n\t\t\t\tclick: async () => {\n\t\t\t\t\tconst sourceProjectURL = new URL(`/projects/${externalModuleNode.ownerId}`, window.location.href)\n\t\t\t\t\tif (externalModuleNode.scopeNodeId) {\n\t\t\t\t\t\t// Link straight to the component isolation for smart components.\n\t\t\t\t\t\tsetViewParamsInURL(sourceProjectURL, { nodeId: externalModuleNode.scopeNodeId })\n\t\t\t\t\t}\n\t\t\t\t\tif (externalModuleNode.type === ModuleType.Code && isExternalModuleIdentifier(parsedId)) {\n\t\t\t\t\t\t// Link straight to the code file for code modules\n\t\t\t\t\t\tconst { module: externalModule } = await modulesStore.lookUpModule({\n\t\t\t\t\t\t\tmoduleId: parsedId.moduleId,\n\t\t\t\t\t\t\tsaveId: parsedId.saveId,\n\t\t\t\t\t\t})\n\t\t\t\t\t\tsourceProjectURL.searchParams.set(\"view\", `code:${externalModule.localId}`)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Break out of event handling mode before opening the window.\n\t\t\t\t\t\t// This is needed because react aria triggers a fake blur event,\n\t\t\t\t\t\t// that is then caught inside CanvasEventTarget.tsx, where we\n\t\t\t\t\t\t// assert to not be in the event handling mode.\n\t\t\t\t\t\tawait Promise.resolve()\n\t\t\t\t\t}\n\t\t\t\t\trecord(\"open_primary_component_start\", {})\n\n\t\t\t\t\t// we check ownerType === \"project\" before getting here\n\t\t\t\t\tconst projectId = externalModuleNode.ownerId\n\t\t\t\t\tif (!projectId) return\n\n\t\t\t\t\tawait openExternalModuleWithAccessCheck(sourceProjectURL, projectId)\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\n\t\tconst smartComponentId = moduleIdentifierToLocalComponentId(singleNode.codeComponentIdentifier)\n\t\tif (smartComponentId) {\n\t\t\tconst initialSmartComponent = engine.tree.getNode(smartComponentId)\n\n\t\t\tif (isSmartComponentNode(initialSmartComponent)) {\n\t\t\t\titems.push(\n\t\t\t\t\twithEnabledCheck({\n\t\t\t\t\t\tlabel: \"Detach Instance\",\n\t\t\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.canDetachVariantInstance(engine, singleNode),\n\t\t\t\t\t\tclick: () =>\n\t\t\t\t\t\t\tengine.loadScopesThenProcess([initialSmartComponent], ([smartComponent]) => {\n\t\t\t\t\t\t\t\tif (!smartComponent) return\n\t\t\t\t\t\t\t\tconst replacement = ContextAction.detachSmartComponentOrWebPageInstance(\n\t\t\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\t\t\tsingleNode,\n\t\t\t\t\t\t\t\t\tsmartComponent,\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tif (replacement) selectionStore.set(replacement.id)\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\tif (items.length) template.push(...items, { type: \"separator\" })\n\t}\n\n\tif (singleNode && ContextAction.canCreateBreakpoint(singleNode)) {\n\t\ttemplate.push(\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: \"Edit Breakpoint\",\n\t\t\t\tellipsis: true,\n\t\t\t\tclick() {\n\t\t\t\t\tContextAction.showCustomBreakpointModal(\n\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\"update\",\n\t\t\t\t\t\tsingleNode.id,\n\t\t\t\t\t\tsingleNode.resolveValue(\"name\") ?? undefined,\n\t\t\t\t\t\tsingleNode.width,\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t\tconst activeNode = scopeStore.active\n\t\tconst submenu = getMenuItemsForCreateBreakpoint(engine, activeNode, singleNode)\n\t\tif (submenu) {\n\t\t\ttemplate.push({ label: \"Add Breakpoint\", submenu })\n\t\t}\n\t\ttemplate.push({ type: \"separator\" })\n\t}\n\n\tconst canMakeWebPagePrimaryBreakpoint = ContextAction.canMakeWebPagePrimaryBreakpoint(engine, selectedNodes)\n\tif (canMakeWebPagePrimaryBreakpoint) {\n\t\ttemplate.push(\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Create Web Page\",\n\t\t\t\tclick: () => ContextAction.convertNodeToWebPagePrimaryBreakpoint(engine, getSelectedNodes()),\n\t\t\t\tenabled: () => isNotViewOnly(),\n\t\t\t}),\n\t\t)\n\t}\n\n\tconst selectionContainsBreakpoints = withoutDescendants.some(isBreakpointVariant)\n\tconst anyShapesSelected = selectedNodes.some(node => isVectorNode(node))\n\tconst anyShapeContainersSelected = selectedNodes.some(node => isShapeContainerNode(node))\n\n\tif (canMakeComponent) {\n\t\ttemplate.push(\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Create Component\",\n\t\t\t\tclick: () => ContextAction.makeComponent(engine, \"context_menu\"),\n\t\t\t\tenabled: () => isNotViewOnly() && canMakeComponent,\n\t\t\t\tvisible: !selectionContainsBreakpoints && !hasMaster && !isSingleCodeComponent,\n\t\t\t\trole: \"makeComponent\",\n\t\t\t}),\n\t\t)\n\t}\n\n\tconst activeScope = scopeStore.active\n\n\tif (\n\t\tisWebPageNode(activeScope) &&\n\t\tsingleNode &&\n\t\t!isReplicaOrReplicaChild(singleNode) &&\n\t\tisInBreakpoint(engine.tree, singleNode.id) &&\n\t\t!anyShapesSelected &&\n\t\t!anyShapeContainersSelected &&\n\t\t!isSlotPropertyNode(singleNode)\n\t) {\n\t\tconst canMoveToLayoutTemplate = !isVariant(singleNode) && !isFixedOrRelativeOverlay(singleNode)\n\t\ttemplate.push(\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Create Layout Template\",\n\t\t\t\tvisible: canMoveToLayoutTemplate,\n\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tmodalStore.push({\n\t\t\t\t\t\ttype: ModalType.CreateLayoutTemplate,\n\t\t\t\t\t\tsource: \"context_menu\",\n\t\t\t\t\t\twebPage: activeScope,\n\t\t\t\t\t\tonConfirm: (name: string) => {\n\t\t\t\t\t\t\tif (!isNotViewOnly()) return\n\n\t\t\t\t\t\t\tvoid applyLayoutTemplate(\n\t\t\t\t\t\t\t\tengine,\n\t\t\t\t\t\t\t\tactiveScope,\n\t\t\t\t\t\t\t\t() =>\n\t\t\t\t\t\t\t\t\tContextAction.createLayoutTemplate(\n\t\t\t\t\t\t\t\t\t\tengine.tree,\n\t\t\t\t\t\t\t\t\t\t\"context_menu\",\n\t\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t\tactiveScope.getPrimaryVariant(),\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\tsingleNode,\n\t\t\t\t\t\t\t).catch(unhandledError)\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t}),\n\t\t)\n\n\t\ttemplate.push(\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Add To Layout Template\",\n\t\t\t\tvisible: canMoveToLayoutTemplate && hasLayoutTemplate(activeScope),\n\t\t\t\tenabled: () => isNotViewOnly(),\n\t\t\t\tclick: async () => {\n\t\t\t\t\tassert(hasLayoutTemplate(activeScope), \"activeScope must have a layout template\")\n\t\t\t\t\tconst templateId = parseModuleIdentifier(activeScope.layoutTemplateIdentifier)?.localIdName\n\t\t\t\t\tassert(templateId, \"templateId must be defined\")\n\n\t\t\t\t\tconst maybeLoadedTemplate = engine.tree.getNodeWithTrait(templateId, isLayoutTemplateNode)\n\t\t\t\t\tassert(maybeLoadedTemplate, \"template must be defined\")\n\t\t\t\t\tconst loadedTemplate = maybeLoadedTemplate.isLoaded() ? maybeLoadedTemplate : await maybeLoadedTemplate.load()\n\n\t\t\t\t\tassert(loadedTemplate, \"loadedTemplate must be defined\")\n\t\t\t\t\tengine.scheduler.process(() => {\n\t\t\t\t\t\tconst node = engine.tree.get(singleNode.id)\n\t\t\t\t\t\tif (!node) return\n\n\t\t\t\t\t\tconst scope = engine.tree.getScopeNodeFor(node)\n\t\t\t\t\t\tif (!scope) return\n\n\t\t\t\t\t\tconst renamedIds = new RenamedIds()\n\t\t\t\t\t\tconst clone = node.cloneWithRenamedIds(renamedIds)\n\t\t\t\t\t\tupdateNodeConnections(engine.tree, engine.componentLoader, clone, renamedIds, false)\n\n\t\t\t\t\t\tconst activeBundleHash = engine.componentLoader.activeBundleHash\n\t\t\t\t\t\tif (!activeBundleHash) return\n\n\t\t\t\t\t\tconst values = getInheritedVariablesValueMap(\n\t\t\t\t\t\t\tengine.tree,\n\t\t\t\t\t\t\tengine.componentLoader,\n\t\t\t\t\t\t\tactiveBundleHash,\n\t\t\t\t\t\t\ttreeStore.sandboxRepeaterData,\n\t\t\t\t\t\t\tnode.id,\n\t\t\t\t\t\t)\n\t\t\t\t\t\tfor (const replacement of clone.walk()) {\n\t\t\t\t\t\t\tconst update = getNodeUpdateResolvingDynamicValues(engine.tree, scope.id, replacement, values)\n\t\t\t\t\t\t\tif (!update) continue\n\t\t\t\t\t\t\treplacement.set(update)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst slotIndex = getSlotNodeIndex(loadedTemplate)\n\t\t\t\t\t\tengine.tree.insertNode(clone, loadedTemplate.getPrimaryVariant().id, slotIndex)\n\t\t\t\t\t\tengine.tree.removeNode(node)\n\t\t\t\t\t\tscopeStore.select(loadedTemplate.id, { keepHistory: false })\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t}),\n\t\t)\n\n\t\ttemplate.push({ type: \"separator\" })\n\t}\n\n\tif ((canMakeComponent || hasMaster) && !anyShapesSelected && !anyShapeContainersSelected) {\n\t\tconst hasOrderOverride = Boolean(singleNode && hasItemsOrderOverride(singleNode))\n\t\tconst isHiddenMaster = canGoToMaster > 1\n\t\ttemplate.push(\n\t\t\t{\n\t\t\t\tlabel: isHiddenMaster ? `Unhide ${Dictionary.Primary}` : `Show ${Dictionary.Primary}`,\n\t\t\t\tclick: () => ContextAction.goToMaster(engine, getSelectedNodes()),\n\t\t\t\tenabled: canGoToMaster > 0,\n\t\t\t\tvisible: !selectionContainsBreakpoints && hasMaster,\n\t\t\t},\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: `Detach From ${Dictionary.Primary}`,\n\t\t\t\tclick: () => ContextAction.detachFromMaster(engine, getSelectedNodes()),\n\t\t\t\tenabled: () => isNotViewOnly() && canDetachFromPrimarySymbol,\n\t\t\t\tvisible: !selectionContainsBreakpoints && hasMaster,\n\t\t\t}),\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: `Update ${Dictionary.Primary}`,\n\t\t\t\tclick: () => ContextAction.updateMasterFromInstance(engine, getSelectedNodes()),\n\t\t\t\tenabled: () => isNotViewOnly() && canUpdateMasterFromInstance,\n\t\t\t\tvisible: !selectionContainsBreakpoints && hasMaster,\n\t\t\t}),\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Reset Overrides\",\n\t\t\t\tclick: () => ContextAction.resetToMasterValues(engine.tree, getSelectedNodes()),\n\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.canResetToMasterValues(engine.tree, selectedNodes),\n\t\t\t\tvisible: !selectionContainsBreakpoints && hasMaster,\n\t\t\t}),\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Reset All Letter Spacing Overrides\",\n\t\t\t\tclick: () => {\n\t\t\t\t\tengine.runWithFullyLoadedTree(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tfor (const { node: n, skipChildren } of engine.tree.root.walkWithSkipChildren()) {\n\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\tisCanvasPageNode(n) ||\n\t\t\t\t\t\t\t\t\tisSmartComponentNode(n) ||\n\t\t\t\t\t\t\t\t\tisLinkStylePresetNode(n) ||\n\t\t\t\t\t\t\t\t\tisTextStylePresetNode(n) ||\n\t\t\t\t\t\t\t\t\tisColorStyleTokenListNode(n) ||\n\t\t\t\t\t\t\t\t\tisPrimaryVariant(n)\n\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\tskipChildren()\n\t\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!isRichTextNode(n) || !isReplicaVariantOrReplicaVariantChild(n)) continue\n\t\t\t\t\t\t\t\tconst originalNode = engine.tree.getNode<RichTextNode>(n.originalid)\n\t\t\t\t\t\t\t\tif (!originalNode) {\n\t\t\t\t\t\t\t\t\tskipChildren()\n\t\t\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tconst [letterSpacing] = originalNode.getLetterSpacings(false)\n\t\t\t\t\t\t\t\tif (letterSpacing === undefined) return\n\t\t\t\t\t\t\t\tn.setLetterSpacing(migrateLetterSpacing(letterSpacing), false)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ name: \"Reset Letter Spacing\" },\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t\tenabled: () => isNotViewOnly() && isRichTextNode(singleNode) && isReplicaOrReplicaChild(singleNode),\n\t\t\t\tvisible: !selectionContainsBreakpoints && projectFeatures.isOn(\"kit\"),\n\t\t\t}),\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Reset Order Override\",\n\t\t\t\tclick: () => {\n\t\t\t\t\tif (!singleNode) return\n\t\t\t\t\tContextAction.resetPropertiesToMasterValues(engine.tree, [singleNode], [\"itemsOrder\"])\n\t\t\t\t},\n\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\tvisible: hasOrderOverride,\n\t\t\t}),\n\t\t\t{ type: \"separator\" },\n\t\t)\n\t}\n\n\tif (anyShapesSelected || anyShapeContainersSelected) {\n\t\tif (!isVectorSetNode(activeScope)) {\n\t\t\ttemplate.push({\n\t\t\t\tlabel: \"Create Vector Set\",\n\t\t\t\trole: \"createVectorSet\",\n\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tContextAction.createVectorSetFromNodes(engine, getSelectedNodes())\n\t\t\t\t},\n\t\t\t})\n\n\t\t\tconst vectorSets = engine.tree.root.children.filter(isVectorSetNode)\n\n\t\t\tif (vectorSets.length) {\n\t\t\t\tconst submenu: MenuItemOptions[] = []\n\t\t\t\tfor (const scope of vectorSets) {\n\t\t\t\t\tif (!isVectorSetNode(scope)) continue\n\n\t\t\t\t\tconst name = scope.resolveValue(\"name\") ?? Dictionary.Vector\n\t\t\t\t\tsubmenu.push({\n\t\t\t\t\t\tlabel: name,\n\t\t\t\t\t\tkey: `add-to-vector-set-${scope.id}`,\n\t\t\t\t\t\trole: \"addToVectorSet\",\n\t\t\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tvoid ContextAction.addToVectorSet(engine, getSelectedNodes(), scope.id)\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\ttemplate.push({\n\t\t\t\t\tlabel: \"Add To Vector Set\",\n\t\t\t\t\tsubmenu,\n\t\t\t\t})\n\t\t\t}\n\t\t} else {\n\t\t\ttemplate.push({\n\t\t\t\tlabel: \"Add To Vector Set\",\n\t\t\t\tvisible: selectedNodes.some(node => !isVectorSetItem(engine.tree.getGroundNodeFor(node))),\n\t\t\t\trole: \"addToVectorSet\",\n\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\tclick: () => {\n\t\t\t\t\tvoid ContextAction.addToVectorSet(engine, getSelectedNodes(), activeScope.id)\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t}\n\n\tconst autoSizingVisible = isAutoSizeVisible(withoutDescendants)\n\tconst showFitContentOption = autoSizingVisible && !selectionContainsBreakpoints\n\tif (showFitContentOption) {\n\t\tconst autoSizingEnabled = canAutoSizeNodes(engine.componentLoader, withoutDescendants, isViewOnly)\n\n\t\ttemplate.push({\n\t\t\tlabel: Dictionary.FitContent,\n\t\t\tclick: () => {\n\t\t\t\tenableAutoSizeForNodes(engine, getWithoutDescendants(), \"context_menu\")\n\t\t\t},\n\t\t\tenabled: withoutDescendants.length === 1 && autoSizingEnabled,\n\t\t\tvisible: autoSizingVisible,\n\t\t\t// Role is excluded as it will be overwritten by DocumentActionTarget\n\t\t\taccelerator: appAccelerators.autoSizeLayout,\n\t\t})\n\t}\n\n\tconst framerSiteId = engine.stores.previewStore.framerSiteId\n\tconst localizationAiUpdateExperimentEnabled = experimentIsOnOrForceEnabled(\"localizationAiUpdate\", framerSiteId)\n\n\tconst shouldCheckForTranslatableContent =\n\t\tengine.tree.root.hasAnyNonDefaultLocales() && localizationAiUpdateExperimentEnabled\n\n\tconst anythingToTranslate = shouldCheckForTranslatableContent\n\t\t? getSourceAndTranslationInfoForLayers(getNodesForSelection(withoutDescendants), engine.tree.root.locales)\n\t\t: null\n\n\tconst showTranslateContentOption = !!anythingToTranslate?.sourcesExist\n\n\tif (showTranslateContentOption) {\n\t\ttemplate.push(\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: `${Dictionary.Translate} ${Dictionary.Content}`,\n\t\t\t\tenabled: () =>\n\t\t\t\t\t!getIsViewOnly(engine, \"canEditLocalizedValues\") && anythingToTranslate.sourcesHaveAnythingToTranslate,\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst selectedNodesAndDescendants = getNodesForSelection(getWithoutDescendants()).map(({ id }) => id)\n\n\t\t\t\t\tengine.stores.modalStore.set({\n\t\t\t\t\t\ttype: ModalType.ConfirmBatchTranslateLayers,\n\t\t\t\t\t\tnodeIds: selectedNodesAndDescendants,\n\t\t\t\t\t\tsource: \"context_menu\",\n\t\t\t\t\t})\n\t\t\t\t},\n\t\t\t}),\n\t\t)\n\t}\n\n\tif (showFitContentOption || showTranslateContentOption) {\n\t\ttemplate.push({ type: \"separator\" })\n\t}\n\n\tconst selectAllLayersWithSameFillVisible = isFrameNode(singleNode)\n\tconst selectAllLayersWithSameFillEnabled =\n\t\tisFrameNode(singleNode) && !isDynamicValue(singleNode.fillColor) && singleNode.fillEnabled\n\n\ttemplate.push(\n\t\t{\n\t\t\tlabel: Dictionary.Select,\n\t\t\teditReason: false,\n\t\t\tsubmenu: [\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Top Parent\",\n\t\t\t\t\trole: \"selectGroundNode\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Parent\",\n\t\t\t\t\trole: \"selectParent\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"separator\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: Dictionary.All,\n\t\t\t\t\trole: \"selectAll\",\n\t\t\t\t\tclick: () => ContextAction.selectAll(engine, selection),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Siblings\",\n\t\t\t\t\trole: \"selectSiblings\",\n\t\t\t\t\tclick: () => ContextAction.selectAllSiblings(engine, selection),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Children\",\n\t\t\t\t\trole: \"selectChildren\",\n\t\t\t\t\tenabled: ContextAction.canSelectChildren(engine, selection),\n\t\t\t\t\tclick: () => ContextAction.selectAllChildren(engine, selection),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Text Layers\",\n\t\t\t\t\trole: \"selectTextNodes\",\n\t\t\t\t\tenabled: ContextAction.canSelectChildren(engine, selection),\n\t\t\t\t\tclick: () => ContextAction.selectAllTextNodes(engine, selection),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Text Layers With Same Style\",\n\t\t\t\t\trole: \"selectTextNodesWithSameFont\",\n\t\t\t\t\tenabled: isAnyTextNode(singleNode),\n\t\t\t\t\tvisible: isAnyTextNode(singleNode),\n\t\t\t\t\tclick: () => ContextAction.selectAllTextNodesWithSameFontStyles(engine, selection),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: \"Layers Using This Background\",\n\t\t\t\t\trole: \"selectAllLayersWithSameFill\",\n\t\t\t\t\tenabled: selectAllLayersWithSameFillEnabled,\n\t\t\t\t\tvisible: selectAllLayersWithSameFillVisible,\n\t\t\t\t\tclick: () => ContextAction.selectAllLayersWithSameFill(engine, selection),\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tlabel: \"Align\",\n\t\t\tsubmenu: [\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.alignLeft,\n\t\t\t\t\trole: \"alignLeft\",\n\t\t\t\t\tclick: () => ContextAlignment.align(engine.tree, getWithoutDescendants(), Dictionary.Left),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.alignCenter,\n\t\t\t\t\trole: \"alignCenter\",\n\t\t\t\t\tclick: () => ContextAlignment.align(engine.tree, getWithoutDescendants(), \"Center\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.alignRight,\n\t\t\t\t\trole: \"alignRight\",\n\t\t\t\t\tclick: () => ContextAlignment.align(engine.tree, getWithoutDescendants(), Dictionary.Right),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"separator\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.alignTop,\n\t\t\t\t\trole: \"alignTop\",\n\t\t\t\t\tclick: () => ContextAlignment.align(engine.tree, getWithoutDescendants(), Dictionary.Top),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.alignMiddle,\n\t\t\t\t\trole: \"alignMiddle\",\n\t\t\t\t\tclick: () => ContextAlignment.align(engine.tree, getWithoutDescendants(), Dictionary.Middle),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.alignBottom,\n\t\t\t\t\trole: \"alignBottom\",\n\t\t\t\t\tclick: () => ContextAlignment.align(engine.tree, getWithoutDescendants(), Dictionary.Bottom),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"separator\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.distributeHorizontal,\n\t\t\t\t\trole: \"distributeHorizontal\",\n\t\t\t\t\tclick: () => ContextAlignment.distribute(engine.tree, getWithoutDescendants(), \"Horizontally\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.distributeVertical,\n\t\t\t\t\trole: \"distributeVertical\",\n\t\t\t\t\tclick: () => ContextAlignment.distribute(engine.tree, getWithoutDescendants(), \"Vertically\"),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\ttype: \"separator\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.alignToSelection,\n\t\t\t\t\trole: \"alignToSelection\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpersistedUserDefaults.alignToParent = false\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.alignToParent,\n\t\t\t\t\trole: \"alignToParent\",\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tpersistedUserDefaults.alignToParent = true\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tlabel: \"Replace With\",\n\t\t\tellipsis: true,\n\t\t\teditReason: \"replaceWith\",\n\t\t\tvisible: !isViewOnly && !!replaceWithMenu && replaceWithMenu.length > 0,\n\t\t\tsubmenu: replaceWithMenu,\n\t\t},\n\t\t{\n\t\t\tlabel: \"Replace All Instances With\",\n\t\t\tellipsis: true,\n\t\t\teditReason: \"replaceAllWith\",\n\t\t\tenabled: !isViewOnly && !!replaceWithMenu && replaceAllInstancesWithMenu?.length !== 0,\n\t\t\tvisible: !isViewOnly && !!replaceWithMenu && !!replaceAllInstancesWithMenu?.length,\n\t\t\tsubmenu: replaceAllInstancesWithMenu,\n\t\t},\n\t\t{ type: \"separator\" },\n\t\t{\n\t\t\tlabel: Dictionary.Copy,\n\t\t\teditReason: false,\n\t\t\tsubmenu: [\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copy,\n\t\t\t\t\trole: \"copy\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copyStyle,\n\t\t\t\t\trole: \"copyStyle\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copyFill,\n\t\t\t\t\trole: \"copyFill\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copyLink,\n\t\t\t\t\trole: \"copyLink\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copyCSS,\n\t\t\t\t\trole: \"copyCSS\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copySVG,\n\t\t\t\t\trole: \"copySVG\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copyText,\n\t\t\t\t\trole: \"copyText\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copyGrid,\n\t\t\t\t\trole: \"copyGrid\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copyEffects,\n\t\t\t\t\trole: \"copyEffects\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copyCursor,\n\t\t\t\t\trole: \"copyCursor\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copyURL,\n\t\t\t\t\trole: \"copyURL\",\n\t\t\t\t\tvisible: ContextAction.copyURLEnabled(selectedNodes),\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.copyNodeId,\n\t\t\t\t\trole: \"copyNodeId\",\n\t\t\t\t\tvisible: experiments.isOn(\"apiKeys\"),\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tlabel: Dictionary.Paste,\n\t\t\tenabled: !isViewOnly,\n\t\t\tsubmenu: [\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.paste,\n\t\t\t\t\trole: \"paste\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.pasteStyle,\n\t\t\t\t\trole: \"pasteStyle\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.pasteFill,\n\t\t\t\t\trole: \"pasteFill\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.pasteInPlace,\n\t\t\t\t\trole: \"pasteInPlace\",\n\t\t\t\t\tvisible: !isViewOnly,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.pasteEffects,\n\t\t\t\t\trole: \"pasteEffects\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.pasteCursor,\n\t\t\t\t\trole: \"pasteCursor\",\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tlabel: actionLabels.pasteGrid,\n\t\t\t\t\trole: \"pasteGrid\",\n\t\t\t\t\tvisible: Boolean(singleNode && (isBreakpointVariant(singleNode) || engine.tree.isGroundNode(singleNode))),\n\t\t\t\t\tenabled: !!clipboardGrid,\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t\t{\n\t\t\tlabel: \"Move\",\n\t\t\tenabled: !isViewOnly,\n\t\t\tsubmenu: [\n\t\t\t\twithEnabledCheck({\n\t\t\t\t\tlabel: \"Bring to Front\",\n\t\t\t\t\tclick: () => ContextAction.sendToFront(engine, getSelectedNodes()),\n\t\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.sendForwardEnabled(engine.tree, selectedNodes),\n\t\t\t\t\trole: \"moveToFront\",\n\t\t\t\t}),\n\t\t\t\twithEnabledCheck({\n\t\t\t\t\tlabel: \"Bring Forward\",\n\t\t\t\t\tclick: () => ContextAction.sendForward(engine, getSelectedNodes()),\n\t\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.sendForwardEnabled(engine.tree, selectedNodes),\n\t\t\t\t\trole: \"moveForward\",\n\t\t\t\t}),\n\t\t\t\twithEnabledCheck({\n\t\t\t\t\tlabel: \"Send Backward\",\n\t\t\t\t\tclick: () => ContextAction.sendBackward(engine, getSelectedNodes()),\n\t\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.sendBackwardEnabled(engine.tree, selectedNodes),\n\t\t\t\t\trole: \"moveBackward\",\n\t\t\t\t}),\n\t\t\t\twithEnabledCheck({\n\t\t\t\t\tlabel: \"Send to Back\",\n\t\t\t\t\tclick: () => ContextAction.sendToBack(engine, getSelectedNodes()),\n\t\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.sendBackwardEnabled(engine.tree, selectedNodes),\n\t\t\t\t\trole: \"moveToBack\",\n\t\t\t\t}),\n\t\t\t],\n\t\t},\n\t\twithEnabledCheck({\n\t\t\tlabel: Dictionary.Duplicate,\n\t\t\tclick: () => ContextAction.duplicateNodes(engine, selection),\n\t\t\tenabled: () => isNotViewOnly() && ContextAction.canDuplicateNodes(selectedNodes),\n\t\t\trole: \"duplicate\",\n\t\t}),\n\t\twithEnabledCheck({\n\t\t\tlabel: Dictionary.Delete,\n\t\t\tclick: () => ContextAction.deleteAction(engine, getSelectedNodes()),\n\t\t\tenabled: () => isNotViewOnly() && ContextAction.canDeleteOrHideNodes(engine, selectedNodes),\n\t\t\trole: \"delete\",\n\t\t}),\n\t\t{ type: \"separator\" },\n\t\twithEnabledCheck({\n\t\t\tlabel: Dictionary.Rename,\n\t\t\tclick: () => ContextAction.rename(engine, getSelectedNodes()),\n\t\t\trole: \"rename\",\n\t\t\tenabled: () => isNotViewOnly() && ContextAction.canRename(engine.tree, selectedNodes),\n\t\t}),\n\t\twithEnabledCheck({\n\t\t\tlabel: Dictionary.AutoRename,\n\t\t\tclick: () => ContextAction.renameLayers(engine, getSelectedNodes()),\n\t\t\trole: \"renameLayers\",\n\t\t\tvisible: experiments.isOn(\"renameLayers\"),\n\t\t\tenabled: () =>\n\t\t\t\tisNotViewOnly() &&\n\t\t\t\tselectedNodes.some(node => ContextAction.canRenameNode(engine.tree, node)) &&\n\t\t\t\tscopeAllowsRenameLayers(engine.stores.scopeStore.active),\n\t\t}),\n\t\twithEnabledCheck({\n\t\t\tlabel: ContextAction.toggleLockTitle(withoutDescendants),\n\t\t\tclick: () => ContextAction.toggleLock(engine.tree, getWithoutDescendants()),\n\t\t\tenabled: () => isNotViewOnly() && ContextAction.toggleLockEnabled(withoutDescendants),\n\t\t\trole: \"toggleLayerLock\",\n\t\t}),\n\t\twithEnabledCheck({\n\t\t\tlabel: ContextAction.visibilityTitle(selectedNodes),\n\t\t\tclick: () => ContextAction.visibility(engine, getSelectedNodes()),\n\t\t\tenabled: () => isNotViewOnly() && ContextAction.visibilityEnabled(selectedNodes),\n\t\t\trole: \"toggleLayerVisible\",\n\t\t}),\n\t\t{\n\t\t\tlabel: \"Overflow\",\n\t\t\tenabled: !isViewOnly && ContextAction.overflowEnabled(selectedNodes),\n\t\t\tsubmenu: getOverflowSubMenu(engine, selectedNodes),\n\t\t},\n\t)\n\n\tif (singleNode && projectFeatures.isOn(\"kit\") && !experiments.isOn(\"wireframerKits\")) {\n\t\ttemplate.push(\n\t\t\t{ type: \"separator\" },\n\t\t\t{\n\t\t\t\tlabel: \"Select Customized Layers\",\n\t\t\t\tclick() {\n\t\t\t\t\tengine.runWithFullyLoadedTree(\n\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\tconst selectIds: NodeID[] = []\n\t\t\t\t\t\t\tfor (const node of engine.tree.root.walk()) {\n\t\t\t\t\t\t\t\tif (!hasCustomizations(node)) continue\n\t\t\t\t\t\t\t\tselectIds.push(node.id)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tselectionStore.set(selectIds)\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ name: \"select_customized_layers\" },\n\t\t\t\t\t)\n\t\t\t\t},\n\t\t\t},\n\t\t)\n\t}\n\n\tconst canAddFrame = selectedNodes.every(node => isInlineVectorNode(engine.tree, node) || !isVectorNode(node))\n\n\tif (canAddFrame) {\n\t\ttemplate.push(\n\t\t\t{ type: \"separator\" },\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Add Frame\",\n\t\t\t\tclick: () => {\n\t\t\t\t\tconst frameId = ContextAction.addFrame(engine, getSelectedNodes())\n\t\t\t\t\tconst node = engine.tree.getNode(String(frameId))\n\n\t\t\t\t\tif (!node) return\n\n\t\t\t\t\tconst { width, height } = engine.tree.getRect(node)\n\n\t\t\t\t\trecord(\"layout_frame\", { source: \"context_menu\", width, height })\n\t\t\t\t},\n\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.wrappingEnabled(engine, selectedNodes),\n\t\t\t\trole: \"addEnclosingFrame\",\n\t\t\t}),\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Add Stack\",\n\t\t\t\tclick: () => {\n\t\t\t\t\tContextAction.addStack(engine, getSelectedNodes())\n\t\t\t\t\trecord(\"layout_stack\", { source: \"context_menu\", layoutType: \"stack\" })\n\t\t\t\t},\n\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.wrappingEnabled(engine, selectedNodes),\n\t\t\t\trole: \"addEnclosingStack\",\n\t\t\t}),\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: ContextAction.removeFrameTitle(withoutDescendants),\n\t\t\t\tclick: () => ContextAction.removeFrame(engine, getWithoutDescendants()),\n\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.removeFrameEnabled(engine, withoutDescendants),\n\t\t\t\trole: \"removeFramePreservingChildren\",\n\t\t\t}),\n\t\t)\n\t}\n\n\tconst setOptions: MenuItemOptions[] = []\n\n\tif (singleNode && engine.tree.isGroundNode(singleNode) && isCanvasPageNode(activeScope)) {\n\t\tconst isHome = isHomeNode(engine.tree, activeScope, singleNode)\n\t\tsetOptions.push(\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: isScreen(singleNode) ? \"Set as Home Screen\" : \"Set as Home Frame\",\n\t\t\t\tclick: () => {\n\t\t\t\t\tsetHomeNode(engine.tree, activeScope, singleNode)\n\t\t\t\t},\n\t\t\t\tenabled: () => isNotViewOnly() && canBeHomeNode(activeScope, singleNode) && !isHome,\n\t\t\t\tchecked: isHome,\n\t\t\t}),\n\t\t)\n\t}\n\n\tif (singleNode && isFrameNode(singleNode)) {\n\t\tconst fillColor = getFrameFillColor(engine.tree, singleNode)\n\n\t\tif (fillColor) {\n\t\t\tsetOptions.push({\n\t\t\t\tlabel: \"Set as Default Fill\",\n\t\t\t\tclick: () => {\n\t\t\t\t\tpersistedUserDefaults.frameBackground = fillColor\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t}\n\n\tif (setOptions.length > 0) {\n\t\ttemplate.push({ type: \"separator\" }, ...setOptions)\n\t}\n\n\tconst onlyShapesSelected = selectedNodes.every(node => isVectorNode(node))\n\tif (onlyShapesSelected) {\n\t\ttemplate.push(\n\t\t\t{ type: \"separator\" },\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: Dictionary.Group,\n\t\t\t\tclick: () => ContextAction.joinInGroup(engine, getSelectedNodes()),\n\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.canJoinInGroup(engine, selectedNodes),\n\t\t\t\trole: \"group\",\n\t\t\t}),\n\t\t\twithEnabledCheck({\n\t\t\t\tlabel: \"Ungroup\",\n\t\t\t\tclick: () => ContextAction.ungroup(engine, getSelectedNodes()),\n\t\t\t\tenabled: () => isNotViewOnly() && ContextAction.canUngroup(engine.tree, selectedNodes),\n\t\t\t\trole: \"ungroup\",\n\t\t\t}),\n\t\t)\n\t}\n\n\tif (singleNode) {\n\t\tif (withShape(singleNode) && isVectorNode(singleNode)) {\n\t\t\ttemplate.push(\n\t\t\t\t{ type: \"separator\" },\n\t\t\t\twithEnabledCheck({\n\t\t\t\t\tlabel: \"Flip Horizontally\",\n\t\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst node = getSingleNode()\n\t\t\t\t\t\tif (!node) return\n\t\t\t\t\t\tflipShapes(engine.tree, engine, [node.id], \"horizontal\")\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t\twithEnabledCheck({\n\t\t\t\t\tlabel: \"Flip Vertically\",\n\t\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst node = getSingleNode()\n\t\t\t\t\t\tif (!node) return\n\t\t\t\t\t\tflipShapes(engine.tree, engine, [node.id], \"vertical\")\n\t\t\t\t\t},\n\t\t\t\t}),\n\t\t\t)\n\n\t\t\tif (withPath(singleNode)) {\n\t\t\t\ttemplate.push(\n\t\t\t\t\twithEnabledCheck({\n\t\t\t\t\t\tlabel: \"Reverse Path Direction\",\n\t\t\t\t\t\tenabled: isNotViewOnly,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tconst node = getSingleNode()\n\t\t\t\t\t\t\tif (!node || !isVectorNode(node) || !withPath(node)) return\n\t\t\t\t\t\t\tContextAction.reversePathDirection(engine.tree, node)\n\t\t\t\t\t\t},\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t} else if (!isShapeGroupNode(singleNode)) {\n\t\t\t\ttemplate.push({\n\t\t\t\t\tlabel: \"Flatten\",\n\t\t\t\t\tenabled: flattenEnabled(engine, [singleNode]),\n\t\t\t\t\tclick: () => {\n\t\t\t\t\t\tconst node = getSingleNode()\n\t\t\t\t\t\tif (!node || !isVectorNode(node) || isShapeGroupNode(node)) return\n\t\t\t\t\t\tflattenShape(engine, node)\n\t\t\t\t\t},\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (experiments.isOn(\"convertToOutline\") && convertToOutlineEnabled([singleNode])) {\n\t\t\t\ttemplate.push(\n\t\t\t\t\twithEnabledCheck({\n\t\t\t\t\t\tlabel: actionLabels.convertToOutline,\n\t\t\t\t\t\tclick: () => {\n\t\t\t\t\t\t\tconst node = getSingleNode()\n\t\t\t\t\t\t\tif (!node) return\n\t\t\t\t\t\t\tvoid convertToOutline(engine, node)\n\t\t\t\t\t\t},\n\t\t\t\t\t\tenabled: () => {\n\t\t\t\t\t\t\tconst node = getSingleNode()\n\t\t\t\t\t\t\tif (!node) return false\n\t\t\t\t\t\t\treturn isNotViewOnly() && convertToOutlineEnabled([node])\n\t\t\t\t\t\t},\n\t\t\t\t\t\trole: \"convertToOutline\",\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn template\n}\n\nexport function showContextMenu({\n\tcoordinate,\n\tengine,\n\tselection,\n\tselectedGuide,\n\tclipboardGrid,\n\tcontext,\n}: {\n\tcoordinate: Point\n\tengine: VekterEngine\n\tselection?: NodeID[]\n\tselectedGuide?: GuideSelector | null\n\tclipboardGrid?: OverlayGrid\n\tcontext?: Context\n}) {\n\tconst { chromeStore, contextMenuStore } = engine.stores\n\tconst template = createContextMenuItems(\n\t\tengine,\n\t\tchromeStore.mainView,\n\t\tselection,\n\t\tselectedGuide,\n\t\tclipboardGrid,\n\t\tcontext,\n\t)\n\tif (!template) return\n\tcontextMenuStore.show(template, { location: coordinate })\n}\n\nfunction isValidLocalComponent(\n\tisLocalPackage: boolean,\n\tcomponent: EntityDefinition,\n\tlocalSmartComponentNameByIdentifier: Record<LocalModuleExportIdentifierString, string | null>,\n\tactiveComponentIdentifier: string | null,\n): boolean {\n\tif (!isLocalPackage) return true\n\tif (isReactComponentDefinition(component)) {\n\t\tif (isLocalSmartComponent(component)) {\n\t\t\tif (activeComponentIdentifier === component.identifier) return false\n\t\t\treturn component.identifier in localSmartComponentNameByIdentifier\n\t\t}\n\n\t\t// Local code file\n\t\tconst identifier = parseModuleIdentifier(component.identifier)\n\t\tif (isLocalModuleIdentifier(identifier) && identifier.type === ModuleType.Code) {\n\t\t\treturn activeComponentIdentifier !== identifier.localId\n\t\t}\n\t}\n\treturn true\n}\n\ntype VoidFunction = () => void\n\nfunction vectorsMenu(\n\tengine: VekterEngine,\n\tclickModuleComponent: (node: CodeComponentNode) => VoidFunction,\n): MenuItemOptions[] | undefined {\n\tconst result: MenuItemOptions[] = []\n\n\tconst project: MenuItemOptions[] = []\n\tfor (const node of engine.tree.root.children) {\n\t\tif (!isVectorSetNode(node)) continue\n\n\t\tconst replacementComponent = dataForLocalVectorSet(engine.stores.modulesStore, node.id)?.component\n\t\tif (!isCodeComponentNode(replacementComponent)) continue\n\n\t\tconst item = withEnabledCheck({\n\t\t\tkey: replacementComponent.codeComponentIdentifier,\n\t\t\tlabel: removeCategoriesFromName(node.resolveValue(\"name\") ?? Dictionary.VectorSet),\n\t\t\tclick: clickModuleComponent(replacementComponent),\n\t\t\tenabled: () => !getIsViewOnly(engine, \"canDesign\"),\n\t\t})\n\t\tproject.push(item)\n\t}\n\n\tif (project.length > 0) result.push({ label: Dictionary.Project, submenu: project })\n\n\tconst folders = new Map<string, MenuItemOptions[]>()\n\tconst folderNames = new Map<string, string | undefined>()\n\tfor (const node of ExternalModulesListNode.getModuleNodes(engine.tree)) {\n\t\tif (node.type !== ModuleType.VectorSet) continue\n\t\tconst info = externalVectorSetInfo(engine.tree, node.id)\n\t\tif (!info) continue\n\n\t\tconst replacementComponent = dataForExternalVectorSet(engine.tree, node.id)?.component\n\t\tif (!isCodeComponentNode(replacementComponent)) continue\n\n\t\tconst folderId = node.group?.id ?? Dictionary.Other\n\t\tconst folder = folders.get(folderId) ?? []\n\t\tfolderNames.set(folderId, node.group?.name)\n\n\t\tfolder.push({\n\t\t\tkey: replacementComponent.codeComponentIdentifier,\n\t\t\tlabel: removeCategoriesFromName(info.name ?? Dictionary.VectorSet),\n\t\t\tclick: clickModuleComponent(replacementComponent),\n\t\t\tenabled: () => !getIsViewOnly(engine, \"canDesign\"),\n\t\t})\n\n\t\tfolders.set(folderId, folder)\n\t}\n\n\tfor (const [id, submenu] of folders) {\n\t\tif (submenu.length === 0) continue\n\t\tconst name = folderNames.get(id) ?? Dictionary.Other\n\t\tresult.push({ label: name, submenu })\n\t}\n\n\treturn result\n}\n\nfunction availableComponentsMenu(\n\tengine: VekterEngine,\n\tclickModuleComponent: (node: CodeComponentNode) => VoidFunction,\n\tonlyLocalSmartComponents: boolean = false,\n): MenuItemOptions[] | undefined {\n\tconst result: MenuItemOptions[] = []\n\n\tconst { scopeStore, codeEditorStore, treeStore, modulesStore } = engine.stores\n\n\tconst activeScope = scopeStore.active\n\tconst activeCodeFileId = codeEditorStore.currentCodeFileId\n\tlet activeComponentIdentifier: string | null = null\n\tif (isSmartComponentNode(activeScope)) {\n\t\tactiveComponentIdentifier = activeScope.instanceIdentifier\n\t} else if (activeCodeFileId) {\n\t\tactiveComponentIdentifier = activeCodeFileId\n\t}\n\n\t// Add replace menu(s) for externalModulesComponents.\n\tconst externalModulesListNode = ExternalModulesListNode.get(treeStore.tree)\n\n\tconst externalModuleComponentsGrouped = getExternalModuleComponentGroups({\n\t\texternalModulesListNode,\n\t\texternalModules: modulesStore.externalModulesDynamicInfo,\n\t})\n\n\texternalModuleComponentsGrouped.forEach(group => {\n\t\tif (onlyLocalSmartComponents) return\n\t\tconst menuItems: MenuItemOptions[] = []\n\t\tfor (const item of group.items) {\n\t\t\tassert(item.type === \"externalModuleComponent\", \"found unexpected item type\", item.type)\n\t\t\tmenuItems.push(mapMenuItemForExternalModulesComponent(item, clickModuleComponent))\n\t\t}\n\t\tif (menuItems.length === 0) return\n\t\tresult.push({ label: group.title, submenu: menuItems })\n\t})\n\n\t// Site projects don't use packages, so only have the fake \"local\" package\n\t// (but it's not in `packageIdentifiers` anymore)\n\tconst packageIdentifiers = [localPackageFallbackIdentifier]\n\tconst treeIndexes = treeStore.getPartialIndexes()\n\n\tpackageIdentifiers.forEach(packageIdentifier => {\n\t\tlet packageDisplayName: string | undefined\n\t\tconst isLocalPackage = localPackageFallbackIdentifier === packageIdentifier\n\n\t\tif (isLocalPackage) {\n\t\t\tpackageDisplayName = Dictionary.Project\n\t\t} else {\n\t\t\tif (onlyLocalSmartComponents) return\n\t\t\tpackageDisplayName = \"<Error>\"\n\t\t}\n\n\t\t// Ignore default components package\n\t\tif (packageIdentifier === \"@framer/framer.default\") return\n\t\tif (!packageDisplayName || packageDisplayName === \"Framer\") return\n\n\t\tconst submenu: MenuItemOptions[] = []\n\t\tconst menu: MenuItemOptions = { label: packageDisplayName, submenu }\n\n\t\tconst components = Array.from(engine.componentLoader.getAllEntities()).filter(c => {\n\t\t\tif (c.packageIdentifier !== packageIdentifier) return false\n\t\t\tif (!isUserCreatedComponent(c)) return false\n\t\t\tif (c.identifier === HardCodedCodeIdentifier.legacyDevice) return false\n\t\t\tif (onlyLocalSmartComponents && !isLocalSmartComponent(c)) return false\n\t\t\tconst parsed = parseModuleIdentifier(c.identifier)\n\n\t\t\tif (isLocalModuleIdentifier(parsed)) {\n\t\t\t\tif (!isReplaceableLocalModuleType(parsed.type)) return false\n\t\t\t} else if (isExternalModuleIdentifier(parsed)) {\n\t\t\t\tconst module = engine.tree.getNodeWithTrait(parsed.moduleId, isExternalModuleNode)\n\t\t\t\tif (!module || module.type === ModuleType.Vector || module.type === ModuleType.VectorSet) return false\n\t\t\t}\n\n\t\t\treturn isValidLocalComponent(\n\t\t\t\tisLocalPackage,\n\t\t\t\tc,\n\t\t\t\ttreeIndexes.localSmartComponentNameByIdentifier,\n\t\t\t\tactiveComponentIdentifier,\n\t\t\t)\n\t\t})\n\t\tsubmenu.push(...buildComponentMenuItems(engine, components, clickModuleComponent))\n\n\t\tif (submenu.length === 0) return\n\n\t\tresult.push(menu)\n\t})\n\n\t// Flatten the menu if there is only one item\n\tif (result.length > 0) {\n\t\tif (result.length === 1 && result[0]) {\n\t\t\tconst singleSubmenu = result[0].submenu\n\t\t\tif (Array.isArray(singleSubmenu)) {\n\t\t\t\treturn singleSubmenu\n\t\t\t} else if (isFunction(singleSubmenu)) {\n\t\t\t\treturn singleSubmenu()\n\t\t\t}\n\t\t}\n\t\treturn result\n\t}\n}\n\nfunction isReplaceableLocalModuleType(type: ModuleType) {\n\tswitch (type) {\n\t\tcase ModuleType.Code:\n\t\tcase ModuleType.Canvas:\n\t\t\treturn true\n\t\tcase ModuleType.Design:\n\t\tcase ModuleType.LayoutTemplate:\n\t\t// Vector Sets are in the loader but should not be considered replacements for components.\n\t\tcase ModuleType.Vector:\n\t\tcase ModuleType.VectorSet:\n\t\tcase ModuleType.Collection:\n\t\tcase ModuleType.DraftCollection:\n\t\tcase ModuleType.ComponentPresets:\n\t\tcase ModuleType.Config:\n\t\tcase ModuleType.Prototype:\n\t\tcase ModuleType.Screen:\n\t\tcase ModuleType.CSS:\n\t\tcase ModuleType.WebPageMetadata:\n\t\tcase ModuleType.SiteMetadata:\n\t\tcase ModuleType.Snippets:\n\t\tcase ModuleType.Localization:\n\t\tcase ModuleType.Kit:\n\t\tcase ModuleType.Shader:\n\t\t\treturn false\n\t\tdefault:\n\t\t\tassertNever(type)\n\t}\n}\n\nexport function buildComponentMenuItems<T extends CategorizableComponent>(\n\tengine: VekterEngine,\n\tcomponents: T[],\n\tclickModuleComponent: (node: CodeComponentNode) => VoidFunction,\n): MenuItemOptions[] {\n\tconst entityTypeRootNode = ComponentEntityTypeRootNode.get(engine.tree)\n\tif (!entityTypeRootNode) return []\n\n\t// Mix of referenced and unreferenced components\n\t// We use arrays as values as some modules can be referenced multiple times, e.g. by code files\n\tconst componentMap = new Map<string, T[]>()\n\n\tfor (const component of components) {\n\t\tif (!component.identifier) continue\n\n\t\tconst parsedIdentifier = parseModuleIdentifier(component.identifier)\n\t\tif (!parsedIdentifier || !isLocalModuleIdentifier(parsedIdentifier)) continue\n\n\t\t// Due to referenceIds on EntityReferenceNodes including the complete localId for CodeComponents and only\n\t\t// the localIdName for CanvasComponents, we need to use different identifiers for the map.\n\t\tconst isCodeFile = parsedIdentifier.type === ModuleType.Code\n\t\tconst referenceId = isCodeFile ? parsedIdentifier.localId : parsedIdentifier.localIdName\n\t\tconst existingEntry = componentMap.get(referenceId)\n\n\t\tif (existingEntry) {\n\t\t\texistingEntry.push(component)\n\t\t} else {\n\t\t\tcomponentMap.set(referenceId, [component])\n\t\t}\n\t}\n\n\tconst menuItems: MenuItemOptions[] = []\n\n\tfunction processNode(node: CanvasNode, parentMenu: MenuItemOptions[]) {\n\t\tif (isEntityFolderNode(node)) {\n\t\t\tconst name = node.resolveValue(\"name\")\n\t\t\tif (!name || node.children.length === 0) return\n\n\t\t\tconst folderMenu: MenuItemOptions = {\n\t\t\t\tlabel: name,\n\t\t\t\tsubmenu: [],\n\t\t\t}\n\n\t\t\tfor (const child of node.children) {\n\t\t\t\tprocessNode(child, folderMenu.submenu as MenuItemOptions[])\n\t\t\t}\n\n\t\t\tif ((folderMenu.submenu as MenuItemOptions[]).length > 0) {\n\t\t\t\tparentMenu.push(folderMenu)\n\t\t\t}\n\t\t} else if (isEntityReferenceNode(node)) {\n\t\t\tconst referenceComponents = componentMap.get(node.referenceId)\n\t\t\tif (!referenceComponents) return\n\n\t\t\treferenceComponents.forEach(component =>\n\t\t\t\taddMenuItemForComponentDefinition(engine, component, parentMenu, clickModuleComponent),\n\t\t\t)\n\t\t\tcomponentMap.delete(node.referenceId) // Mark as processed\n\t\t}\n\t}\n\n\t// Start processing from the entity root\n\tfor (const child of entityTypeRootNode.children) {\n\t\tprocessNode(child, menuItems)\n\t}\n\n\t// Add any remaining components at the root level, as these are unreferenced\n\tfor (const [_, referenceComponents] of componentMap) {\n\t\treferenceComponents.forEach(component =>\n\t\t\taddMenuItemForComponentDefinition(engine, component, menuItems, clickModuleComponent),\n\t\t)\n\t}\n\n\treturn sortMenuItemsByTypeAndLabel(menuItems)\n}\n\n/**\n * Helper function to check if an item is a folder (has submenu)\n */\nfunction isFolder(item: MenuItemOptions): item is MenuItemOptions & { submenu: MenuItemOptions[] } {\n\treturn Array.isArray(item.submenu) && item.submenu.length > 0\n}\n\n/**\n * Recursively sorts menu items so that component names come first (alphabetically),\n * followed by folder names (alphabetically). Applies to all submenu levels.\n */\nfunction sortMenuItemsByTypeAndLabel(items: MenuItemOptions[]): MenuItemOptions[] {\n\tif (!Array.isArray(items)) return items\n\n\tconst sorted = [...items].sort((a, b) => {\n\t\tconst aIsFolder = isFolder(a)\n\t\tconst bIsFolder = isFolder(b)\n\t\tif (aIsFolder && !bIsFolder) return 1\n\t\tif (!aIsFolder && bIsFolder) return -1\n\t\treturn compareStringsNaturally(a.label ?? \"\", b.label ?? \"\")\n\t})\n\n\t// Recursively sort submenus\n\tfor (const item of sorted) {\n\t\tif (isFolder(item)) {\n\t\t\titem.submenu = sortMenuItemsByTypeAndLabel(item.submenu)\n\t\t}\n\t}\n\n\treturn sorted\n}\n\nfunction replaceWithOptions(\n\tengine: VekterEngine,\n\tgetReplaceableNodes: (() => CanvasNode[]) | CanvasNode[],\n): MenuItemOptions[] | undefined {\n\tconst withoutDescendants = getNodesWithoutDescendants(getReplaceableNodes)\n\n\tif (\n\t\twithoutDescendants.length === 0 ||\n\t\t!withoutDescendants.every(node => canReplaceNode(node, { allowLockedNodes: true })) ||\n\t\t(withoutDescendants.length > 1 && !areNodesHomogeneous(withoutDescendants))\n\t) {\n\t\treturn\n\t}\n\n\tconst replacingSubmitButton = withoutDescendants.some(\n\t\tnode => isCodeComponentNode(node) && isFormSubmitButtonInstance(engine.tree, node),\n\t)\n\n\tconst replacingVectorInstance = withoutDescendants.every(isVectorInstance)\n\tif (replacingVectorInstance) {\n\t\treturn vectorsMenu(\n\t\t\tengine,\n\t\t\t(node: CodeComponentNode) => () => handleNodeReplacement(engine, node, getReplaceableNodes, false),\n\t\t)\n\t}\n\n\treturn availableComponentsMenu(\n\t\tengine,\n\t\t(node: CodeComponentNode) => () => handleNodeReplacement(engine, node, getReplaceableNodes, replacingSubmitButton),\n\t\treplacingSubmitButton,\n\t)\n}\n\nfunction getNodesWithoutDescendants(getReplacableNodes: (() => CanvasNode[]) | CanvasNode[]): CanvasNode[] {\n\treturn typeof getReplacableNodes === \"function\" ? getReplacableNodes() : getReplacableNodes\n}\n\nfunction handleNodeReplacement(\n\tengine: VekterEngine,\n\tnode: CodeComponentNode,\n\tgetReplaceableNodes: (() => CanvasNode[]) | CanvasNode[],\n\treplacingSubmitButton: boolean,\n) {\n\tconst task = () => executeNodeReplacementTask(engine, node, getReplaceableNodes, replacingSubmitButton)\n\tconst tree = engine.stores.treeStore.getDataTreeOrPartialTree()\n\n\tif (isFunction(getReplaceableNodes) && !tree.isLoaded()) {\n\t\tengine.runWithFullyLoadedTree(task, { name: \"replace_component\" })\n\t} else {\n\t\ttask()\n\t}\n}\n\nfunction executeNodeReplacementTask(\n\tengine: VekterEngine,\n\tnode: CodeComponentNode,\n\tgetReplaceableNodes: (() => CanvasNode[]) | CanvasNode[],\n\treplacingSubmitButton: boolean,\n) {\n\tconst tree = engine.stores.treeStore.getDataTreeOrPartialTree()\n\tconst withoutDescendants = getNodesWithoutDescendants(getReplaceableNodes)\n\tconst nodeIds = withoutDescendants.map(n => n.id)\n\n\tvoid replaceComponentWithConfirmation(\n\t\tnodeIds,\n\t\tengine,\n\t\ttree,\n\t\tisFunction(getReplaceableNodes),\n\t\treplacingSubmitButton ? () => replacingSubmitButtonWithTemplateWillModifyTemplate(engine.tree, node) : false,\n\t\t() => {\n\t\t\tengine.scheduler.processWhenReady(() => {\n\t\t\t\tnodeIds.forEach(nodeId => {\n\t\t\t\t\tconst target = tree.get(nodeId)\n\t\t\t\t\tif (!target) return\n\t\t\t\t\tconst newNode = engine.cloneNode(node, false, false)\n\t\t\t\t\tif (!canReplaceNode(target, { allowLockedNodes: true })) return\n\t\t\t\t\treplaceNodeWithTemplate(engine, target, newNode).catch(unhandledError)\n\t\t\t\t})\n\t\t\t})\n\t\t},\n\t)\n}\n\nasync function replaceComponentWithConfirmation(\n\tnodeIds: string[],\n\tengine: VekterEngine,\n\ttree: CanvasTree,\n\twithConfirmationMessage: boolean,\n\tmodifyForSubmit: boolean | (() => Promise<boolean>),\n\tonConfirm: () => void,\n) {\n\tconst prompt = isFunction(modifyForSubmit) ? await modifyForSubmit() : modifyForSubmit\n\tif (prompt) {\n\t\tengine.stores.modalStore.set({\n\t\t\ttype: ModalType.Confirmation,\n\t\t\ttitle: \"Replace Submit Button\",\n\t\t\tdescription:\n\t\t\t\t\"To use this component as the Submit Button of the Form, we need to remove links from all instances and change it to a Button element.\",\n\t\t\tonConfirm,\n\t\t\tconfirmLabel: Dictionary.Confirm,\n\t\t\tsource: \"replace_submit\",\n\t\t})\n\t\treturn\n\t}\n\n\tif (!withConfirmationMessage) return onConfirm()\n\n\t// If we have less than 5 nodes to replace, let's only ask for confirmation if they're spread over more than one scope\n\tif (nodeIds.length <= 5) {\n\t\tconst scopeIds = new Set<string>()\n\t\tfor (const id of nodeIds) {\n\t\t\tconst node = tree.getNode(id)\n\t\t\tif (!node) continue\n\t\t\tconst scopeNode = tree.getScopeNodeFor(node)\n\t\t\tif (!scopeNode) continue\n\n\t\t\tif (scopeIds.size === 0) {\n\t\t\t\tscopeIds.add(scopeNode.id)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif (!scopeIds.has(scopeNode.id)) {\n\t\t\t\tscopeIds.add(scopeNode.id)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif (scopeIds.size <= 1) return onConfirm()\n\t}\n\n\tengine.stores.modalStore.set({\n\t\ttype: ModalType.Confirmation,\n\t\ttitle: \"Replace All Instances\",\n\t\tdescription: `You are about to replace all ${nodeIds.length} instances of this component in your project.`,\n\t\tonConfirm,\n\t\tconfirmLabel: Dictionary.Confirm,\n\t\tsource: \"replace_all_instances_page\",\n\t})\n}\n\nfunction addMenuItemForComponentDefinition(\n\tengine: VekterEngine,\n\tcomponentDefinition: CategorizableComponent,\n\tsubmenu: MenuItemOptions[],\n\tonClick: (node: CodeComponentNode) => VoidFunction,\n) {\n\tif (!componentDefinition.identifier) return null\n\n\tconst loadedComponent = engine.componentLoader.componentForIdentifier(componentDefinition.identifier)\n\tif (!loadedComponent) return null\n\n\tconst replacementComponent = getComponentToUseAsReplacement(loadedComponent)\n\tif (!replacementComponent || !isCodeComponentNode(replacementComponent)) return null\n\n\tsubmenu.push(\n\t\twithEnabledCheck({\n\t\t\tkey: replacementComponent.codeComponentIdentifier,\n\t\t\tlabel: removeCategoriesFromName(getComponentName(engine.componentLoader, loadedComponent, replacementComponent)),\n\t\t\tclick: onClick(replacementComponent),\n\t\t\tenabled: () => !getIsViewOnly(engine, \"canDesign\"),\n\t\t}),\n\t)\n}\n\nfunction mapMenuItemForExternalModulesComponent(\n\texternalModulesComponent: ExternalModuleComponent,\n\tonClick: (node: CodeComponentNode) => VoidFunction,\n): MenuItemOptions {\n\tconst codeComponentNode = new CodeComponentNode({\n\t\tcodeComponentIdentifier: externalModulesComponent.codeComponentIdentifier,\n\t\twidth: externalModulesComponent.intrinsicWidth,\n\t\theight: externalModulesComponent.intrinsicHeight,\n\t\tslotsAreChildNodes: experiments.isOn(\"componentSlotsAreChildNodes\"),\n\t})\n\n\treturn {\n\t\tkey: codeComponentNode.codeComponentIdentifier,\n\t\tlabel: externalModulesComponent.name,\n\t\tclick: onClick(codeComponentNode),\n\t}\n}\n\nfunction getMenuItemsForCreateBreakpoint(\n\tengine: VekterEngine,\n\twebPageNode: LoadedScopeNode,\n\tnode: CanvasNode & FrameNode & IsVariant & IsBreakpoint,\n) {\n\tconst onSelectBreakpoint = (breakpoint: BreakpointSuggestion) => {\n\t\tconst baseNodeRect = engine.tree.getRect(node)\n\t\tconst newBreakpointRect: Rect | null = rightSideOf(engine.tree, webPageNode, node, baseNodeRect)\n\t\tconst viewportHeight = breakpoint.viewportHeight ?? Math.min(1200, node.height)\n\t\tif (!isWebPageNode(webPageNode)) return\n\n\t\tContextAction.createBreakpoint(\n\t\t\tengine,\n\t\t\tnode,\n\t\t\twebPageNode,\n\t\t\tnewBreakpointRect,\n\t\t\tbreakpoint.width,\n\t\t\tbreakpoint.name,\n\t\t\tviewportHeight,\n\t\t)\n\t}\n\n\treturn getBreakpointMenu(engine, node, onSelectBreakpoint, () =>\n\t\tContextAction.showCustomBreakpointModal(engine, \"add\", node.id),\n\t)\n}\n\nfunction getOverflowSubMenu(engine: VekterEngine, nodes: CanvasNode[]) {\n\t// We are not in a context where we have access to the reduced values like\n\t// the property panel does, so we need to calculate the reduced values here.\n\tconst result: ReducedOverflow = {\n\t\tonlyNodesWithOverflow: true,\n\t\toverflow: NotFound,\n\t\toverflowX: NotFound,\n\t\toverflowY: NotFound,\n\t}\n\tnodes.forEach(n => reduceOverflow(n, result))\n\n\tconst updateOverflow = engine.scheduler.wrapHandler((overflow: Overflow) => {\n\t\tfor (const node of nodes) {\n\t\t\tconst current = engine.tree.current(node)\n\t\t\tif (!withOverflow(current)) continue\n\t\t\tcurrent.set({ overflow }, engine.tree)\n\t\t}\n\t})\n\n\tconst menu: MenuItemOptions[] = allOverflowValues.map(overflow => ({\n\t\tlabel: titleForOverflowOption(overflow),\n\t\tchecked: isFoundAndNotMixed(result.overflow) && result.overflow === overflow,\n\t\tclick: () => updateOverflow(overflow),\n\t}))\n\n\treturn menu\n}\n\n/**\n * Used to identify if a set of nodes are are all instances of the same smart\n * component / external module (using codeComponentIdentifier).\n */\nfunction areNodesHomogeneous(nodes: CanvasNode[]) {\n\tconst firstNode = nodes[0]\n\n\t// As long as all nodes are vector instances, we can consider them homogeneous.\n\tif (isCodeComponentNode(firstNode) && firstNode.isVectorInstance) {\n\t\treturn nodes.every(isVectorInstance)\n\t}\n\n\t// code components / smart components\n\tif (isCodeComponentNode(firstNode)) {\n\t\tconst codeComponentIdentifier = firstNode.codeComponentIdentifier\n\t\treturn nodes.every(node => isCodeComponentNode(node) && node.codeComponentIdentifier === codeComponentIdentifier)\n\t}\n\n\treturn false\n}\n\nfunction getNodesForSelection(selectedNodes: CanvasNode[]) {\n\tconst selectedNodesAndDescendants: CanvasNode[] = []\n\tfor (const node of selectedNodes) {\n\t\tselectedNodesAndDescendants.push(node)\n\t\tfor (const descendant of node.descendants()) {\n\t\t\tselectedNodesAndDescendants.push(descendant)\n\t\t}\n\t}\n\n\treturn selectedNodesAndDescendants\n}\n", "/**\n * Performs case-insensitive substring matching.\n * Returns true if the target string contains the search term.\n */\nexport function matchSubstring(searchTerm: string, target: string | undefined | null): boolean {\n\tif (!searchTerm) return true // empty search term matches everything\n\tif (!target) return false // empty target string matches nothing\n\treturn target.toLowerCase().includes(searchTerm.toLowerCase())\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQO,SAAS,cAAc,mBAAuD;AACpF,QAAM,EAAE,cAAc,aAAa,cAAc,aAAa,IAAI,eAAO;AACzE,QAAM,UAAU,aAAa,SAAS,WAAS,MAAM,OAAO;AAC5D,QAAM,eAAe,YAAY,SAAS,WAAS,MAAM,YAAY;AACrE,QAAM,uBA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I,CAAC,aAAa,OAAO,EAAG;AAC5B,cAAQ,IAAI,EAAE,SAAS,GAAG,OAAO,IAAI;AAAA,IACtC;AAAA,EACD,CAAC;AAED,QAAM,OAA0B,kBAAkB,IAAI,eAAa;AAAA,IAClE,OAAO,uBAAuB,QAAQ;AAAA,IACtC,SAAS,mBAAmB,OAAO,QAAQ,KAAK,OAAO,aAAa;AAAA,IACpE,OAAO,MAAM,eAAe,QAAQ;AAAA,EACrC,EAAE;AAEF,SAAO;AACR;AAMA,SAAS,oBAAoB,OAAqB;AACjD,QAAM,YAAY,MAAM,CAAC;AAGzB,MAAI,oBAAoB,SAAS,KAAK,UAAU,kBAAkB;AACjE,WAAO,MAAM,MAAM,gBAAgB;AAAA,EACpC;AAGA,MAAI,oBAAoB,SAAS,GAAG;AACnC,UAAM,0BAA0B,UAAU;AAC1C,WAAO,MAAM,MAAM,UAAQ,oBAAoB,IAAI,KAAK,KAAK,4BAA4B,uBAAuB;AAAA,EACjH;AAEA,SAAO;AACR;AAEA,SAAS,qBAAqB,eAA6B;AAC1D,QAAM,8BAA4C,CAAC;AACnD,aAAW,QAAQ,eAAe;AACjC,gCAA4B,KAAK,IAAI;AACrC,eAAW,cAAc,KAAK,YAAY,GAAG;AAC5C,kCAA4B,KAAK,UAAU;AAAA,IAC5C;AAAA,EACD;AAEA,SAAO;AACR;;;ACznEO,SAAS,eAAe,YAAoB,QAA4C;AAC9F,MAAI,CAAC,WAAY,QAAO;AACxB,MAAI,CAAC,OAAQ,QAAO;AACpB,SAAO,OAAO,YAAY,EAAE,SAAS,WAAW,YAAY,CAAC;AAC9D;",
  "names": ["scopeType", "import_react", "assert", "text", "import_react", "import_react", "import_jsx_runtime", "React", "icon", "isViewOnly", "ContextAlignment", "import_jsx_runtime", "import_react", "import_jsx_runtime", "import_jsx_runtime", "import_react", "icon", "import_jsx_runtime", "icon", "icon", "import_jsx_runtime", "dashed", "icon", "import_react", "import_jsx_runtime", "isLayoutSection", "mimeTypes", "React", "import_jsx_runtime", "log", "path", "on", "off", "style", "import_react", "React", "assert", "path", "isViewOnly", "import_react", "import_react", "import_react", "input", "icon", "import_react", "input", "editingInput", "import_jsx_runtime", "React", "label", "input", "editingInput", "inputWrapper", "import_jsx_runtime", "React", "CollapsibleRow", "badge", "subLabel", "inputWrapper", "import_jsx_runtime", "targetParent", "container", "import_jsx_runtime", "button", "icon", "getUniqueEntityFolderName", "row", "import_jsx_runtime", "import_jsx_runtime", "React", "DraggableAssetRow", "isFolder", "isViewOnly", "isEntityTypeRootNode", "entityItemsData", "container", "icon", "import_react", "import_jsx_runtime", "import_jsx_runtime", "pluralize", "collection", "assert", "log", "import_react", "import_react", "badge", "import_jsx_runtime", "iconSize", "compact", "badge", "label", "import_pluralize", "import_react", "import_jsx_runtime", "assertNever", "icon", "options", "isViewOnly", "label"]
}
